Pteros  2.0
Molecular modeling library for human beings!
force_field.h
1 /*
2  *
3  * This source code is part of
4  * ******************
5  * *** Pteros ***
6  * ******************
7  * molecular modeling library
8  *
9  * Copyright (c) 2009-2013, Semen Yesylevskyy
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of Artistic License:
13  *
14  * Please note, that Artistic License is slightly more restrictive
15  * then GPL license in terms of distributing the modified versions
16  * of this software (they should be approved first).
17  * Read http://www.opensource.org/licenses/artistic-license-2.0.php
18  * for details. Such license fits scientific software better then
19  * GPL because it prevents the distribution of bugged derivatives.
20  *
21 */
22 
23 #ifndef FORCE_FIELD_H
24 #define FORCE_FIELD_H
25 
26 #include <vector>
27 #include <unordered_set>
28 #include <unordered_map>
29 #include <Eigen/Core>
30 
31 namespace pteros {
32 
47 class Force_field {
48 public:
50  std::vector<Eigen::Vector2i> charge_groups;
55  std::vector<std::unordered_set<int> > exclusions;
60  Eigen::MatrixXf LJ_C6, LJ_C12;
62  std::vector<Eigen::Vector2f> LJ14_interactions;
66  std::unordered_map<int,int> LJ14_pairs;
68  float fudgeQQ;
69 
70  float rcoulomb, epsilon_r, epsilon_rf, rcoulomb_switch, rvdw_switch, rvdw;
71  std::string coulomb_type, coulomb_modifier, vdw_type, vdw_modifier;
72 
74  std::vector<Eigen::Vector2i> bonds;
75 
77  bool ready;
78 
80  std::function<float(float,float,float)> coulomb_kernel_ptr;
81 
83  std::function<float(float,float,float)> LJ_kernel_ptr;
84 
85  // Aux constants to be precomputed by set_kernels()
86  float coulomb_prefactor, k_rf, c_rf;
87  // potential shift constants
88  Eigen::Vector3f shift_1, shift_6, shift_12;
89 
91  Force_field();
92 
94  Force_field(const Force_field& other);
95 
98 
99  // Clear ff
100  void clear();
101 
102  // Setup coulomb and VDW kernel pointers
103  void setup_kernels();
104 
105  float LJ_en_kernel(float C6, float C12, float r);
106  float LJ_en_kernel_cutoff(float C6, float C12, float r);
107  float LJ_en_kernel_shifted(float C6, float C12, float r);
108  float Coulomb_en_kernel(float q1, float q2, float r);
109  float Coulomb_en_kernel_rf(float q1, float q2, float r);
110  float Coulomb_en_kernel_shifted(float q1, float q2, float r);
111  float Coulomb_en_kernel_cutoff(float q1, float q2, float r);
112 };
113 
114 
115 }
116 
117 #endif /* FORCE_FIELD_H */
std::unordered_map< int, int > LJ14_pairs
The list of LJ14 pairs.
Definition: force_field.h:66
Force_field & operator=(Force_field other)
Assignment operator.
Definition: force_field.cpp:190
std::function< float(float, float, float)> coulomb_kernel_ptr
Pointer to chosen coulomb kernel.
Definition: force_field.h:80
Pteros namespace.
Definition: options.cpp:32
Force field parameters of the system.
Definition: force_field.h:47
std::function< float(float, float, float)> LJ_kernel_ptr
Pointer to chosen VDW kernel.
Definition: force_field.h:83
float fudgeQQ
Scaling factor of 1-4 Coulomb interactions.
Definition: force_field.h:68
std::vector< Eigen::Vector2i > charge_groups
Charge groups. Currently not used and could be deleted later.
Definition: force_field.h:50
std::vector< Eigen::Vector2f > LJ14_interactions
The list of distinct types of LJ14 interactions in the format [C6,C12].
Definition: force_field.h:62
std::vector< Eigen::Vector2i > bonds
Topology-related infromation.
Definition: force_field.h:74
bool ready
Is the force field properly set up?
Definition: force_field.h:77
Eigen::MatrixXf LJ_C6
Matrices of normal (not excluded, not 1-4) LJ interactions.
Definition: force_field.h:60
Force_field()
Constructor.
Definition: force_field.cpp:164
std::vector< std::unordered_set< int > > exclusions
Exclusions.
Definition: force_field.h:55