4 |
|
#define MK_STR(s) # s |
5 |
|
#define STR_DEFINE(t, s) t = MK_STR(s) |
6 |
|
|
7 |
– |
|
7 |
|
#include <stdio.h> |
8 |
|
#include <stdlib.h> |
9 |
|
#include <math.h> |
10 |
+ |
#include <string> |
11 |
+ |
#include <map> |
12 |
|
|
13 |
< |
#include "Atom.hpp" |
14 |
< |
#include "SimInfo.hpp" |
15 |
< |
#include "StuntDouble.hpp" |
13 |
> |
#include "primitives/Atom.hpp" |
14 |
> |
#include "brains/SimInfo.hpp" |
15 |
> |
#include "primitives/StuntDouble.hpp" |
16 |
> |
#include "types/ShapeAtomType.hpp" |
17 |
> |
#include "io/basic_ifstrstream.hpp" |
18 |
|
|
19 |
|
#ifdef IS_MPI |
20 |
< |
#include "mpiForceField.h" |
20 |
> |
#include "UseTheForce/mpiForceField.h" |
21 |
|
#endif |
22 |
|
|
23 |
< |
#include "fForceField.h" |
24 |
< |
#include "fortranWrapDefines.hpp" |
23 |
> |
using namespace std; |
24 |
> |
using namespace oopse; |
25 |
|
|
26 |
|
class bond_pair{ |
27 |
|
public: |
61 |
|
class ForceFields{ |
62 |
|
|
63 |
|
public: |
64 |
< |
ForceFields(){ frcFile = NULL; entry_plug = NULL; has_variant=0;} |
65 |
< |
ForceFields(char * theVariant ){ frcFile = NULL; entry_plug = NULL; has_variant=1; strcpy(variant, theVariant); } |
64 |
> |
ForceFields(){ |
65 |
> |
|
66 |
> |
char* force_param_path; |
67 |
> |
frcFile = NULL; |
68 |
> |
entry_plug = NULL; |
69 |
> |
has_variant=0; |
70 |
> |
|
71 |
> |
force_param_path = getenv("FORCE_PARAM_PATH"); |
72 |
> |
if (force_param_path != NULL) { |
73 |
> |
ffPath = force_param_path; |
74 |
> |
} else { |
75 |
> |
ffPath = ""; |
76 |
> |
} |
77 |
> |
|
78 |
> |
if( ffPath.empty() ) { |
79 |
> |
STR_DEFINE(ffPath, FRC_PATH ); |
80 |
> |
} |
81 |
> |
} |
82 |
> |
ForceFields(const string &theVariant){ |
83 |
> |
char* force_param_path; |
84 |
> |
frcFile = NULL; |
85 |
> |
entry_plug = NULL; |
86 |
> |
has_variant=1; |
87 |
> |
variant = theVariant; |
88 |
> |
|
89 |
> |
force_param_path = getenv("FORCE_PARAM_PATH"); |
90 |
> |
if (force_param_path != NULL) { |
91 |
> |
ffPath = force_param_path; |
92 |
> |
} else { |
93 |
> |
ffPath = ""; |
94 |
> |
} |
95 |
> |
|
96 |
> |
if( ffPath.empty() ) { |
97 |
> |
STR_DEFINE(ffPath, FRC_PATH ); |
98 |
> |
} |
99 |
> |
} |
100 |
|
virtual ~ForceFields(){} |
101 |
|
|
102 |
|
void setSimInfo( SimInfo* the_entry_plug ) { entry_plug = the_entry_plug; } |
113 |
|
bend_set* the_bends ) = 0; |
114 |
|
virtual void initializeTorsions( int nTorsions, Torsion** torsionArray, |
115 |
|
torsion_set* the_torsions ) = 0; |
116 |
< |
virtual void initForceField( int ljMixRule ) = 0; |
80 |
< |
virtual void initRestraints(); |
81 |
< |
virtual void dumpzAngle(); |
116 |
> |
virtual void initForceField() = 0; |
117 |
|
|
118 |
|
virtual void calcRcut( void ); |
119 |
|
virtual void setRcut( double LJrcut ); |
120 |
|
virtual void doForces( int calcPot, int calcStress ); |
121 |
|
|
87 |
– |
virtual double getAtomTypeMass(char* atomType) = 0; |
88 |
– |
|
89 |
– |
void setFortranForceLoop( doForceLoop_TD fsub ){ |
90 |
– |
fortranForceLoop = fsub; |
91 |
– |
} |
92 |
– |
|
122 |
|
protected: |
123 |
|
|
124 |
< |
void initFortran( int ljMixPolicy, int useReactionField ); |
125 |
< |
doForceLoop_TD fortranForceLoop; |
97 |
< |
|
124 |
> |
void initFortran( int useReactionField ); |
125 |
> |
|
126 |
|
FILE *frcFile; |
127 |
|
SimInfo* entry_plug; |
128 |
|
|
129 |
|
int lineNum; |
130 |
|
char readLine[500]; |
131 |
|
char* eof_test; |
104 |
– |
char variant[100]; |
132 |
|
short int has_variant; |
133 |
|
double bigSigma; |
134 |
|
|
135 |
+ |
string ffPath; |
136 |
+ |
ifstrstream forceFile; |
137 |
+ |
bool hasVariant; |
138 |
+ |
string variant; |
139 |
+ |
map<string, AtomType*> atomTypeMap; |
140 |
+ |
// map<pair<string,string>, BondType*> bondTypeMap; |
141 |
+ |
// map<tuple3<string,string,string>, BendType*> bendTypeMap; |
142 |
+ |
// map<tuple4<string,string,string,string>, TorsionType*> torsionTypeMap; |
143 |
+ |
|
144 |
|
}; |
145 |
|
|
146 |
|
|
161 |
|
void initializeTorsions( int nTorsions, Torsion** torsionArray, |
162 |
|
torsion_set* the_torsions ); |
163 |
|
|
164 |
< |
void initForceField( int ljMixRule ); |
129 |
< |
double getAtomTypeMass(char* atomType); |
164 |
> |
void initForceField(); |
165 |
|
|
166 |
|
private: |
167 |
|
|
186 |
|
void initializeTorsions( int nTorsions, Torsion** torsionArray, |
187 |
|
torsion_set* the_torsions ); |
188 |
|
|
189 |
< |
void initForceField( int ljMixRule ); |
155 |
< |
double getAtomTypeMass(char* atomType); |
189 |
> |
void initForceField( ); |
190 |
|
|
191 |
+ |
|
192 |
|
private: |
193 |
|
|
194 |
|
void fastForward( char* stopText, char* searchOwner ); |
198 |
|
class EAM_FF : public ForceFields{ |
199 |
|
|
200 |
|
public: |
201 |
+ |
|
202 |
|
EAM_FF(); |
203 |
< |
EAM_FF(char* the_variant); |
203 |
> |
EAM_FF(const string &theVariant); |
204 |
> |
|
205 |
|
virtual ~EAM_FF(); |
206 |
|
|
170 |
– |
|
207 |
|
void readParams(); |
208 |
|
void cleanMe( void ); |
209 |
|
|
215 |
|
void initializeTorsions( int nTorsions, Torsion** torsionArray, |
216 |
|
torsion_set* the_torsions ); |
217 |
|
|
218 |
< |
void initForceField( int ljMixRule ); |
218 |
> |
void initForceField(); |
219 |
|
|
220 |
|
void calcRcut( void ); |
221 |
< |
double getAtomTypeMass(char* atomType); |
221 |
> |
|
222 |
|
private: |
223 |
|
|
224 |
|
void fastForward( char* stopText, char* searchOwner ); |
241 |
|
bend_set* the_bends ); |
242 |
|
void initializeTorsions( int nTorsions, Torsion** torsionArray, |
243 |
|
torsion_set* the_torsions ); |
244 |
< |
void initForceField( int ljMixRule ); |
209 |
< |
double getAtomTypeMass(char* atomType); |
244 |
> |
void initForceField(); |
245 |
|
|
246 |
+ |
|
247 |
|
private: |
248 |
|
|
249 |
|
void fastForward( char* stopText, char* searchOwner ); |
251 |
|
|
252 |
|
}; |
253 |
|
|
254 |
+ |
class Shapes_FF : public ForceFields{ |
255 |
+ |
|
256 |
+ |
public: |
257 |
+ |
Shapes_FF() : ForceFields() {}; |
258 |
+ |
Shapes_FF(const string &the_variant) : ForceFields(the_variant) {}; |
259 |
+ |
virtual ~Shapes_FF(); |
260 |
+ |
|
261 |
+ |
void readParams(); |
262 |
+ |
void cleanMe( void ); |
263 |
+ |
|
264 |
+ |
void initializeAtoms( int nAtoms, Atom** atomArray ); |
265 |
+ |
void initializeBonds( int nBonds, Bond** bondArray, |
266 |
+ |
bond_pair* the_bonds ); |
267 |
+ |
void initializeBends( int nBends, Bend** bendArray, |
268 |
+ |
bend_set* the_bends ); |
269 |
+ |
void initializeTorsions( int nTorsions, Torsion** torsionArray, |
270 |
+ |
torsion_set* the_torsions ); |
271 |
+ |
|
272 |
+ |
void initForceField(); |
273 |
+ |
|
274 |
+ |
void calcRcut( void ); |
275 |
+ |
|
276 |
+ |
void parseShapeFile(string shapeFileName, ShapeAtomType* st); |
277 |
+ |
|
278 |
+ |
private: |
279 |
+ |
|
280 |
+ |
double findLargestContactDistance(ShapeAtomType* st); |
281 |
+ |
double findCutoffDistance(ShapeAtomType* st); |
282 |
+ |
double shapesRcut; |
283 |
+ |
double bigContact; |
284 |
+ |
|
285 |
+ |
}; |
286 |
+ |
|
287 |
+ |
|
288 |
|
#endif |
289 |
|
|