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 |
> |
frcFile = NULL; |
66 |
> |
entry_plug = NULL; |
67 |
> |
has_variant=0; |
68 |
> |
ffPath = getenv("FORCE_PARAM_PATH"); |
69 |
> |
if( ffPath.empty() ) { |
70 |
> |
STR_DEFINE(ffPath, FRC_PATH ); |
71 |
> |
} |
72 |
> |
} |
73 |
> |
ForceFields(string theVariant){ |
74 |
> |
frcFile = NULL; |
75 |
> |
entry_plug = NULL; |
76 |
> |
has_variant=1; |
77 |
> |
variant = theVariant; |
78 |
> |
ffPath = getenv("FORCE_PARAM_PATH"); |
79 |
> |
if( ffPath.empty() ) { |
80 |
> |
STR_DEFINE(ffPath, FRC_PATH ); |
81 |
> |
} |
82 |
> |
} |
83 |
|
virtual ~ForceFields(){} |
84 |
|
|
85 |
|
void setSimInfo( SimInfo* the_entry_plug ) { entry_plug = the_entry_plug; } |
96 |
|
bend_set* the_bends ) = 0; |
97 |
|
virtual void initializeTorsions( int nTorsions, Torsion** torsionArray, |
98 |
|
torsion_set* the_torsions ) = 0; |
99 |
< |
virtual void initForceField( int ljMixRule ) = 0; |
99 |
> |
virtual void initForceField() = 0; |
100 |
|
virtual void initRestraints(); |
101 |
|
virtual void dumpzAngle(); |
102 |
|
|
104 |
|
virtual void setRcut( double LJrcut ); |
105 |
|
virtual void doForces( int calcPot, int calcStress ); |
106 |
|
|
87 |
– |
virtual double getAtomTypeMass(char* atomType) = 0; |
88 |
– |
|
89 |
– |
void setFortranForceLoop( doForceLoop_TD fsub ){ |
90 |
– |
fortranForceLoop = fsub; |
91 |
– |
} |
92 |
– |
|
107 |
|
protected: |
108 |
|
|
109 |
< |
void initFortran( int ljMixPolicy, int useReactionField ); |
110 |
< |
doForceLoop_TD fortranForceLoop; |
97 |
< |
|
109 |
> |
void initFortran( int useReactionField ); |
110 |
> |
|
111 |
|
FILE *frcFile; |
112 |
|
SimInfo* entry_plug; |
113 |
|
|
114 |
|
int lineNum; |
115 |
|
char readLine[500]; |
116 |
|
char* eof_test; |
104 |
– |
char variant[100]; |
117 |
|
short int has_variant; |
118 |
|
double bigSigma; |
119 |
+ |
|
120 |
+ |
string ffPath; |
121 |
+ |
ifstrstream forceFile; |
122 |
+ |
bool hasVariant; |
123 |
+ |
string variant; |
124 |
+ |
map<string, AtomType*> atomTypeMap; |
125 |
+ |
// map<pair<string,string>, BondType*> bondTypeMap; |
126 |
+ |
// map<tuple3<string,string,string>, BendType*> bendTypeMap; |
127 |
+ |
// map<tuple4<string,string,string,string>, TorsionType*> torsionTypeMap; |
128 |
|
|
129 |
|
}; |
130 |
|
|
146 |
|
void initializeTorsions( int nTorsions, Torsion** torsionArray, |
147 |
|
torsion_set* the_torsions ); |
148 |
|
|
149 |
< |
void initForceField( int ljMixRule ); |
129 |
< |
double getAtomTypeMass(char* atomType); |
149 |
> |
void initForceField(); |
150 |
|
|
151 |
|
private: |
152 |
|
|
171 |
|
void initializeTorsions( int nTorsions, Torsion** torsionArray, |
172 |
|
torsion_set* the_torsions ); |
173 |
|
|
174 |
< |
void initForceField( int ljMixRule ); |
155 |
< |
double getAtomTypeMass(char* atomType); |
174 |
> |
void initForceField( ); |
175 |
|
|
176 |
+ |
|
177 |
|
private: |
178 |
|
|
179 |
|
void fastForward( char* stopText, char* searchOwner ); |
183 |
|
class EAM_FF : public ForceFields{ |
184 |
|
|
185 |
|
public: |
186 |
+ |
|
187 |
|
EAM_FF(); |
188 |
< |
EAM_FF(char* the_variant); |
188 |
> |
EAM_FF(string theVariant); |
189 |
> |
|
190 |
|
virtual ~EAM_FF(); |
191 |
|
|
170 |
– |
|
192 |
|
void readParams(); |
193 |
|
void cleanMe( void ); |
194 |
|
|
200 |
|
void initializeTorsions( int nTorsions, Torsion** torsionArray, |
201 |
|
torsion_set* the_torsions ); |
202 |
|
|
203 |
< |
void initForceField( int ljMixRule ); |
203 |
> |
void initForceField(); |
204 |
|
|
205 |
|
void calcRcut( void ); |
206 |
< |
double getAtomTypeMass(char* atomType); |
206 |
> |
|
207 |
|
private: |
208 |
|
|
209 |
|
void fastForward( char* stopText, char* searchOwner ); |
226 |
|
bend_set* the_bends ); |
227 |
|
void initializeTorsions( int nTorsions, Torsion** torsionArray, |
228 |
|
torsion_set* the_torsions ); |
229 |
< |
void initForceField( int ljMixRule ); |
209 |
< |
double getAtomTypeMass(char* atomType); |
229 |
> |
void initForceField(); |
230 |
|
|
231 |
+ |
|
232 |
|
private: |
233 |
|
|
234 |
|
void fastForward( char* stopText, char* searchOwner ); |
239 |
|
class Shapes_FF : public ForceFields{ |
240 |
|
|
241 |
|
public: |
242 |
< |
Shapes_FF(); |
243 |
< |
Shapes_FF(char* the_variant); |
242 |
> |
Shapes_FF() : ForceFields() {}; |
243 |
> |
Shapes_FF(char* the_variant) : ForceFields(the_variant) {}; |
244 |
|
virtual ~Shapes_FF(); |
245 |
|
|
225 |
– |
|
246 |
|
void readParams(); |
247 |
|
void cleanMe( void ); |
248 |
|
|
254 |
|
void initializeTorsions( int nTorsions, Torsion** torsionArray, |
255 |
|
torsion_set* the_torsions ); |
256 |
|
|
257 |
< |
void initForceField( int ljMixRule ); |
257 |
> |
void initForceField(); |
258 |
|
|
259 |
+ |
void parseShapeFile(string shapeFileName, ShapeAtomType* st); |
260 |
+ |
|
261 |
|
void calcRcut( void ); |
262 |
< |
double getAtomTypeMass(char* atomType); |
262 |
> |
|
263 |
|
private: |
264 |
|
|
265 |
< |
void fastForward( char* stopText, char* searchOwner ); |
244 |
< |
|
265 |
> |
double findLargestContactDistance(ShapeAtomType* st); |
266 |
|
double shapesRcut; |
267 |
+ |
|
268 |
|
}; |
269 |
|
|
270 |
|
|