ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-3.0/src/UseTheForce/ForceFields.hpp
Revision: 1653
Committed: Wed Oct 27 00:01:29 2004 UTC (19 years, 8 months ago) by gezelter
Original Path: trunk/OOPSE-3.0/src/UseTheForce/ForceFields.hpp
File size: 5646 byte(s)
Log Message:
char* -> string

File Contents

# Content
1 #ifndef __FORCEFIELDS_H__
2 #define __FORCEFIELDS_H__
3
4 #define MK_STR(s) # s
5 #define STR_DEFINE(t, s) t = MK_STR(s)
6
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 using namespace std;
24 using namespace oopse;
25
26 class bond_pair{
27 public:
28 bond_pair(){}
29 ~bond_pair(){}
30
31 int a;
32 int b;
33 };
34
35 class bend_set{
36 public:
37 bend_set(){ isGhost = 0; }
38 ~bend_set(){}
39
40 int ghost;
41 int isGhost;
42
43 int a;
44 int b;
45 int c;
46 };
47
48 class torsion_set{
49 public:
50 torsion_set(){}
51 ~torsion_set(){}
52
53 int a;
54 int b;
55 int c;
56 int d;
57 };
58
59
60
61 class ForceFields{
62
63 public:
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; }
86
87 virtual void readParams( void ) = 0;
88
89 virtual void cleanMe( void ) = 0;
90
91
92 virtual void initializeAtoms( int nAtoms, Atom** atomArray ) = 0;
93 virtual void initializeBonds( int nBonds, Bond** bondArray,
94 bond_pair* the_bonds ) = 0;
95 virtual void initializeBends( int nBends, Bend** bendArray,
96 bend_set* the_bends ) = 0;
97 virtual void initializeTorsions( int nTorsions, Torsion** torsionArray,
98 torsion_set* the_torsions ) = 0;
99 virtual void initForceField() = 0;
100 virtual void initRestraints();
101 virtual void dumpzAngle();
102
103 virtual void calcRcut( void );
104 virtual void setRcut( double LJrcut );
105 virtual void doForces( int calcPot, int calcStress );
106
107 protected:
108
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;
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
131
132 class DUFF : public ForceFields{
133
134 public:
135 DUFF();
136 virtual ~DUFF();
137
138 void readParams();
139 void cleanMe( void );
140
141 void initializeAtoms( int nAtoms, Atom** atomArray );
142 void initializeBonds( int nBonds, Bond** bondArray,
143 bond_pair* the_bonds );
144 void initializeBends( int nBends, Bend** bendArray,
145 bend_set* the_bends );
146 void initializeTorsions( int nTorsions, Torsion** torsionArray,
147 torsion_set* the_torsions );
148
149 void initForceField();
150
151 private:
152
153 void fastForward( char* stopText, char* searchOwner );
154 };
155
156 class LJFF : public ForceFields{
157
158 public:
159 LJFF();
160 virtual ~LJFF();
161
162
163 void readParams();
164 void cleanMe( void );
165
166 void initializeAtoms( int nAtoms, Atom** atomArray );
167 void initializeBonds( int nBonds, Bond** bondArray,
168 bond_pair* the_bonds );
169 void initializeBends( int nBends, Bend** bendArray,
170 bend_set* the_bends );
171 void initializeTorsions( int nTorsions, Torsion** torsionArray,
172 torsion_set* the_torsions );
173
174 void initForceField( );
175
176
177 private:
178
179 void fastForward( char* stopText, char* searchOwner );
180
181 };
182
183 class EAM_FF : public ForceFields{
184
185 public:
186 EAM_FF();
187 EAM_FF(string the_variant);
188 virtual ~EAM_FF();
189
190
191 void readParams();
192 void cleanMe( void );
193
194 void initializeAtoms( int nAtoms, Atom** atomArray );
195 void initializeBonds( int nBonds, Bond** bondArray,
196 bond_pair* the_bonds );
197 void initializeBends( int nBends, Bend** bendArray,
198 bend_set* the_bends );
199 void initializeTorsions( int nTorsions, Torsion** torsionArray,
200 torsion_set* the_torsions );
201
202 void initForceField();
203
204 void calcRcut( void );
205
206 private:
207
208 void fastForward( char* stopText, char* searchOwner );
209
210 double eamRcut;
211 };
212
213 class WATER : public ForceFields{
214
215 public:
216 WATER();
217 virtual ~WATER();
218
219 void readParams();
220 void cleanMe( void );
221 void initializeAtoms( int nAtoms, Atom** atomArray );
222 void initializeBonds( int nBonds, Bond** bondArray,
223 bond_pair* the_bonds );
224 void initializeBends( int nBends, Bend** bendArray,
225 bend_set* the_bends );
226 void initializeTorsions( int nTorsions, Torsion** torsionArray,
227 torsion_set* the_torsions );
228 void initForceField();
229
230
231 private:
232
233 void fastForward( char* stopText, char* searchOwner );
234 void sectionSearch( char* secHead, char* stopText, char* searchOwner );
235
236 };
237
238 class Shapes_FF : public ForceFields{
239
240 public:
241 Shapes_FF() : ForceFields() {};
242 Shapes_FF(char* the_variant) : ForceFields(the_variant) {};
243 virtual ~Shapes_FF();
244
245 void readParams();
246 void cleanMe( void );
247
248 void initializeAtoms( int nAtoms, Atom** atomArray );
249 void initializeBonds( int nBonds, Bond** bondArray,
250 bond_pair* the_bonds );
251 void initializeBends( int nBends, Bend** bendArray,
252 bend_set* the_bends );
253 void initializeTorsions( int nTorsions, Torsion** torsionArray,
254 torsion_set* the_torsions );
255
256 void initForceField();
257
258 void parseShapeFile(string shapeFileName, ShapeAtomType* st);
259
260 void calcRcut( void );
261
262 private:
263
264 double findLargestContactDistance(ShapeAtomType* st);
265 double shapesRcut;
266
267 };
268
269
270 #endif
271