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 "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 "UseTheForce/mpiForceField.h" |
21 |
|
#endif |
22 |
|
|
23 |
< |
#include "UseTheForce/fForceField.h" |
24 |
< |
#include "UseTheForce/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; |
116 |
> |
virtual void initForceField() = 0; |
117 |
|
virtual void initRestraints(); |
118 |
|
virtual void dumpzAngle(); |
119 |
|
|
121 |
|
virtual void setRcut( double LJrcut ); |
122 |
|
virtual void doForces( int calcPot, int calcStress ); |
123 |
|
|
87 |
– |
virtual double getAtomTypeMass(char* atomType) = 0; |
88 |
– |
|
89 |
– |
void setFortranForceLoop( doForceLoop_TD fsub ){ |
90 |
– |
fortranForceLoop = fsub; |
91 |
– |
} |
92 |
– |
|
124 |
|
protected: |
125 |
|
|
126 |
< |
void initFortran( int ljMixPolicy, int useReactionField ); |
127 |
< |
doForceLoop_TD fortranForceLoop; |
97 |
< |
|
126 |
> |
void initFortran( int useReactionField ); |
127 |
> |
|
128 |
|
FILE *frcFile; |
129 |
|
SimInfo* entry_plug; |
130 |
|
|
131 |
|
int lineNum; |
132 |
|
char readLine[500]; |
133 |
|
char* eof_test; |
104 |
– |
char variant[100]; |
134 |
|
short int has_variant; |
135 |
|
double bigSigma; |
136 |
|
|
137 |
+ |
string ffPath; |
138 |
+ |
ifstrstream forceFile; |
139 |
+ |
bool hasVariant; |
140 |
+ |
string variant; |
141 |
+ |
map<string, AtomType*> atomTypeMap; |
142 |
+ |
// map<pair<string,string>, BondType*> bondTypeMap; |
143 |
+ |
// map<tuple3<string,string,string>, BendType*> bendTypeMap; |
144 |
+ |
// map<tuple4<string,string,string,string>, TorsionType*> torsionTypeMap; |
145 |
+ |
|
146 |
|
}; |
147 |
|
|
148 |
|
|
163 |
|
void initializeTorsions( int nTorsions, Torsion** torsionArray, |
164 |
|
torsion_set* the_torsions ); |
165 |
|
|
166 |
< |
void initForceField( int ljMixRule ); |
129 |
< |
double getAtomTypeMass(char* atomType); |
166 |
> |
void initForceField(); |
167 |
|
|
168 |
|
private: |
169 |
|
|
188 |
|
void initializeTorsions( int nTorsions, Torsion** torsionArray, |
189 |
|
torsion_set* the_torsions ); |
190 |
|
|
191 |
< |
void initForceField( int ljMixRule ); |
155 |
< |
double getAtomTypeMass(char* atomType); |
191 |
> |
void initForceField( ); |
192 |
|
|
193 |
+ |
|
194 |
|
private: |
195 |
|
|
196 |
|
void fastForward( char* stopText, char* searchOwner ); |
200 |
|
class EAM_FF : public ForceFields{ |
201 |
|
|
202 |
|
public: |
203 |
+ |
|
204 |
|
EAM_FF(); |
205 |
< |
EAM_FF(char* the_variant); |
205 |
> |
EAM_FF(const string &theVariant); |
206 |
> |
|
207 |
|
virtual ~EAM_FF(); |
208 |
|
|
170 |
– |
|
209 |
|
void readParams(); |
210 |
|
void cleanMe( void ); |
211 |
|
|
217 |
|
void initializeTorsions( int nTorsions, Torsion** torsionArray, |
218 |
|
torsion_set* the_torsions ); |
219 |
|
|
220 |
< |
void initForceField( int ljMixRule ); |
220 |
> |
void initForceField(); |
221 |
|
|
222 |
|
void calcRcut( void ); |
223 |
< |
double getAtomTypeMass(char* atomType); |
223 |
> |
|
224 |
|
private: |
225 |
|
|
226 |
|
void fastForward( char* stopText, char* searchOwner ); |
243 |
|
bend_set* the_bends ); |
244 |
|
void initializeTorsions( int nTorsions, Torsion** torsionArray, |
245 |
|
torsion_set* the_torsions ); |
246 |
< |
void initForceField( int ljMixRule ); |
209 |
< |
double getAtomTypeMass(char* atomType); |
246 |
> |
void initForceField(); |
247 |
|
|
248 |
+ |
|
249 |
|
private: |
250 |
|
|
251 |
|
void fastForward( char* stopText, char* searchOwner ); |
256 |
|
class Shapes_FF : public ForceFields{ |
257 |
|
|
258 |
|
public: |
259 |
< |
Shapes_FF(); |
260 |
< |
Shapes_FF(char* the_variant); |
259 |
> |
Shapes_FF() : ForceFields() {}; |
260 |
> |
Shapes_FF(const string &the_variant) : ForceFields(the_variant) {}; |
261 |
|
virtual ~Shapes_FF(); |
262 |
|
|
225 |
– |
|
263 |
|
void readParams(); |
264 |
|
void cleanMe( void ); |
265 |
|
|
271 |
|
void initializeTorsions( int nTorsions, Torsion** torsionArray, |
272 |
|
torsion_set* the_torsions ); |
273 |
|
|
274 |
< |
void initForceField( int ljMixRule ); |
274 |
> |
void initForceField(); |
275 |
|
|
276 |
|
void calcRcut( void ); |
277 |
< |
double getAtomTypeMass(char* atomType); |
277 |
> |
|
278 |
> |
void parseShapeFile(string shapeFileName, ShapeAtomType* st); |
279 |
> |
|
280 |
|
private: |
281 |
|
|
282 |
< |
void fastForward( char* stopText, char* searchOwner ); |
283 |
< |
|
282 |
> |
double findLargestContactDistance(ShapeAtomType* st); |
283 |
> |
double findCutoffDistance(ShapeAtomType* st); |
284 |
|
double shapesRcut; |
285 |
+ |
double bigContact; |
286 |
+ |
|
287 |
|
}; |
288 |
|
|
289 |
|
|