ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-2.0/src/UseTheForce/ForceFields.hpp
Revision: 1670
Committed: Thu Oct 28 16:56:20 2004 UTC (19 years, 8 months ago) by gezelter
Original Path: trunk/OOPSE-2.0/src/UseTheForce/ForceFields.hpp
File size: 5963 byte(s)
Log Message:
fixed duplicate declaration foo

File Contents

# User Rev Content
1 gezelter 1490 #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 gezelter 1650 #include <string>
11     #include <map>
12 gezelter 1490
13 tim 1492 #include "primitives/Atom.hpp"
14     #include "brains/SimInfo.hpp"
15     #include "primitives/StuntDouble.hpp"
16 gezelter 1650 #include "types/ShapeAtomType.hpp"
17     #include "io/basic_ifstrstream.hpp"
18 gezelter 1490
19     #ifdef IS_MPI
20 tim 1492 #include "UseTheForce/mpiForceField.h"
21 gezelter 1490 #endif
22    
23 gezelter 1650 using namespace std;
24     using namespace oopse;
25    
26 gezelter 1490 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 gezelter 1650 ForceFields(){
65 gezelter 1670
66     char* force_param_path;
67 gezelter 1650 frcFile = NULL;
68     entry_plug = NULL;
69     has_variant=0;
70 gezelter 1670
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 gezelter 1653 if( ffPath.empty() ) {
79 gezelter 1650 STR_DEFINE(ffPath, FRC_PATH );
80     }
81     }
82 gezelter 1670 ForceFields(const string &theVariant){
83     char* force_param_path;
84 gezelter 1650 frcFile = NULL;
85     entry_plug = NULL;
86     has_variant=1;
87 gezelter 1653 variant = theVariant;
88 gezelter 1670
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 gezelter 1653 if( ffPath.empty() ) {
97 gezelter 1650 STR_DEFINE(ffPath, FRC_PATH );
98     }
99     }
100 gezelter 1490 virtual ~ForceFields(){}
101    
102     void setSimInfo( SimInfo* the_entry_plug ) { entry_plug = the_entry_plug; }
103    
104     virtual void readParams( void ) = 0;
105    
106     virtual void cleanMe( void ) = 0;
107    
108    
109     virtual void initializeAtoms( int nAtoms, Atom** atomArray ) = 0;
110     virtual void initializeBonds( int nBonds, Bond** bondArray,
111     bond_pair* the_bonds ) = 0;
112     virtual void initializeBends( int nBends, Bend** bendArray,
113     bend_set* the_bends ) = 0;
114     virtual void initializeTorsions( int nTorsions, Torsion** torsionArray,
115     torsion_set* the_torsions ) = 0;
116 gezelter 1628 virtual void initForceField() = 0;
117 gezelter 1490 virtual void initRestraints();
118     virtual void dumpzAngle();
119    
120     virtual void calcRcut( void );
121     virtual void setRcut( double LJrcut );
122     virtual void doForces( int calcPot, int calcStress );
123    
124     protected:
125    
126 gezelter 1628 void initFortran( int useReactionField );
127 chuckv 1617
128 gezelter 1490 FILE *frcFile;
129     SimInfo* entry_plug;
130    
131     int lineNum;
132     char readLine[500];
133     char* eof_test;
134     short int has_variant;
135     double bigSigma;
136    
137 gezelter 1653 string ffPath;
138 gezelter 1650 ifstrstream forceFile;
139 gezelter 1653 bool hasVariant;
140     string variant;
141 gezelter 1650 map<string, AtomType*> atomTypeMap;
142 gezelter 1653 // map<pair<string,string>, BondType*> bondTypeMap;
143     // map<tuple3<string,string,string>, BendType*> bendTypeMap;
144     // map<tuple4<string,string,string,string>, TorsionType*> torsionTypeMap;
145 gezelter 1650
146 gezelter 1490 };
147    
148    
149     class DUFF : public ForceFields{
150    
151     public:
152 gezelter 1656 DUFF();
153 gezelter 1490 virtual ~DUFF();
154    
155     void readParams();
156     void cleanMe( void );
157    
158     void initializeAtoms( int nAtoms, Atom** atomArray );
159     void initializeBonds( int nBonds, Bond** bondArray,
160     bond_pair* the_bonds );
161     void initializeBends( int nBends, Bend** bendArray,
162     bend_set* the_bends );
163     void initializeTorsions( int nTorsions, Torsion** torsionArray,
164     torsion_set* the_torsions );
165    
166 gezelter 1628 void initForceField();
167 gezelter 1490
168     private:
169    
170     void fastForward( char* stopText, char* searchOwner );
171     };
172    
173     class LJFF : public ForceFields{
174    
175     public:
176 gezelter 1656 LJFF();
177 gezelter 1490 virtual ~LJFF();
178    
179    
180     void readParams();
181     void cleanMe( void );
182    
183     void initializeAtoms( int nAtoms, Atom** atomArray );
184     void initializeBonds( int nBonds, Bond** bondArray,
185     bond_pair* the_bonds );
186     void initializeBends( int nBends, Bend** bendArray,
187     bend_set* the_bends );
188     void initializeTorsions( int nTorsions, Torsion** torsionArray,
189     torsion_set* the_torsions );
190    
191 gezelter 1628 void initForceField( );
192 gezelter 1490
193 gezelter 1650
194 gezelter 1490 private:
195    
196     void fastForward( char* stopText, char* searchOwner );
197    
198     };
199    
200     class EAM_FF : public ForceFields{
201    
202     public:
203 gezelter 1656
204     EAM_FF();
205 gezelter 1670 EAM_FF(const string &theVariant);
206 gezelter 1656
207 gezelter 1490 virtual ~EAM_FF();
208    
209     void readParams();
210     void cleanMe( void );
211    
212     void initializeAtoms( int nAtoms, Atom** atomArray );
213     void initializeBonds( int nBonds, Bond** bondArray,
214     bond_pair* the_bonds );
215     void initializeBends( int nBends, Bend** bendArray,
216     bend_set* the_bends );
217     void initializeTorsions( int nTorsions, Torsion** torsionArray,
218     torsion_set* the_torsions );
219    
220 gezelter 1628 void initForceField();
221 gezelter 1490
222     void calcRcut( void );
223 gezelter 1650
224 gezelter 1490 private:
225    
226     void fastForward( char* stopText, char* searchOwner );
227    
228     double eamRcut;
229     };
230    
231     class WATER : public ForceFields{
232    
233     public:
234 gezelter 1656 WATER();
235 gezelter 1490 virtual ~WATER();
236    
237     void readParams();
238     void cleanMe( void );
239     void initializeAtoms( int nAtoms, Atom** atomArray );
240     void initializeBonds( int nBonds, Bond** bondArray,
241     bond_pair* the_bonds );
242     void initializeBends( int nBends, Bend** bendArray,
243     bend_set* the_bends );
244     void initializeTorsions( int nTorsions, Torsion** torsionArray,
245     torsion_set* the_torsions );
246 gezelter 1628 void initForceField();
247 gezelter 1490
248 gezelter 1650
249 gezelter 1490 private:
250    
251     void fastForward( char* stopText, char* searchOwner );
252     void sectionSearch( char* secHead, char* stopText, char* searchOwner );
253    
254     };
255    
256 gezelter 1520 class Shapes_FF : public ForceFields{
257    
258     public:
259 gezelter 1650 Shapes_FF() : ForceFields() {};
260 gezelter 1670 Shapes_FF(const string &the_variant) : ForceFields(the_variant) {};
261 gezelter 1520 virtual ~Shapes_FF();
262    
263 gezelter 1650 void readParams();
264 gezelter 1520 void cleanMe( void );
265    
266     void initializeAtoms( int nAtoms, Atom** atomArray );
267     void initializeBonds( int nBonds, Bond** bondArray,
268     bond_pair* the_bonds );
269     void initializeBends( int nBends, Bend** bendArray,
270     bend_set* the_bends );
271     void initializeTorsions( int nTorsions, Torsion** torsionArray,
272     torsion_set* the_torsions );
273    
274 gezelter 1628 void initForceField();
275 gezelter 1520
276 gezelter 1650 void parseShapeFile(string shapeFileName, ShapeAtomType* st);
277    
278 gezelter 1520 void calcRcut( void );
279 chrisfen 1646
280 gezelter 1520 private:
281 gezelter 1650
282     double findLargestContactDistance(ShapeAtomType* st);
283 chrisfen 1646 double shapesRcut;
284 gezelter 1520
285     };
286    
287    
288 gezelter 1490 #endif
289