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: 1650
Committed: Tue Oct 26 22:24:52 2004 UTC (19 years, 8 months ago) by gezelter
Original Path: trunk/OOPSE-3.0/src/UseTheForce/ForceFields.hpp
File size: 5525 byte(s)
Log Message:
forcefield refactoring for shapes

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     frcFile = NULL;
66     entry_plug = NULL;
67     has_variant=0;
68     ffPath_env = "FORCE_PARAM_PATH";
69     ffPath = getenv( ffPath_env );
70     if( ffPath == NULL ) {
71     STR_DEFINE(ffPath, FRC_PATH );
72     }
73     }
74     ForceFields(char * theVariant){
75     frcFile = NULL;
76     entry_plug = NULL;
77     has_variant=1;
78     strcpy(variant, theVariant);
79     ffPath_env = "FORCE_PARAM_PATH";
80     ffPath = getenv( ffPath_env );
81     if( ffPath == NULL ) {
82     STR_DEFINE(ffPath, FRC_PATH );
83     }
84     }
85 gezelter 1490 virtual ~ForceFields(){}
86    
87     void setSimInfo( SimInfo* the_entry_plug ) { entry_plug = the_entry_plug; }
88    
89     virtual void readParams( void ) = 0;
90    
91     virtual void cleanMe( void ) = 0;
92    
93    
94     virtual void initializeAtoms( int nAtoms, Atom** atomArray ) = 0;
95     virtual void initializeBonds( int nBonds, Bond** bondArray,
96     bond_pair* the_bonds ) = 0;
97     virtual void initializeBends( int nBends, Bend** bendArray,
98     bend_set* the_bends ) = 0;
99     virtual void initializeTorsions( int nTorsions, Torsion** torsionArray,
100     torsion_set* the_torsions ) = 0;
101 gezelter 1628 virtual void initForceField() = 0;
102 gezelter 1490 virtual void initRestraints();
103     virtual void dumpzAngle();
104    
105     virtual void calcRcut( void );
106     virtual void setRcut( double LJrcut );
107     virtual void doForces( int calcPot, int calcStress );
108    
109     protected:
110    
111 gezelter 1628 void initFortran( int useReactionField );
112 chuckv 1617
113 gezelter 1490 FILE *frcFile;
114     SimInfo* entry_plug;
115    
116     int lineNum;
117     char readLine[500];
118     char* eof_test;
119     char variant[100];
120     short int has_variant;
121     double bigSigma;
122    
123 gezelter 1650 ifstrstream forceFile;
124     map<string, AtomType*> atomTypeMap;
125     char* ffPath_env;
126     char* ffPath;
127    
128 gezelter 1490 };
129    
130    
131     class DUFF : public ForceFields{
132    
133     public:
134     DUFF();
135     virtual ~DUFF();
136    
137     void readParams();
138     void cleanMe( void );
139    
140     void initializeAtoms( int nAtoms, Atom** atomArray );
141     void initializeBonds( int nBonds, Bond** bondArray,
142     bond_pair* the_bonds );
143     void initializeBends( int nBends, Bend** bendArray,
144     bend_set* the_bends );
145     void initializeTorsions( int nTorsions, Torsion** torsionArray,
146     torsion_set* the_torsions );
147    
148 gezelter 1628 void initForceField();
149 gezelter 1490
150     private:
151    
152     void fastForward( char* stopText, char* searchOwner );
153     };
154    
155     class LJFF : public ForceFields{
156    
157     public:
158     LJFF();
159     virtual ~LJFF();
160    
161    
162     void readParams();
163     void cleanMe( void );
164    
165     void initializeAtoms( int nAtoms, Atom** atomArray );
166     void initializeBonds( int nBonds, Bond** bondArray,
167     bond_pair* the_bonds );
168     void initializeBends( int nBends, Bend** bendArray,
169     bend_set* the_bends );
170     void initializeTorsions( int nTorsions, Torsion** torsionArray,
171     torsion_set* the_torsions );
172    
173 gezelter 1628 void initForceField( );
174 gezelter 1490
175 gezelter 1650
176 gezelter 1490 private:
177    
178     void fastForward( char* stopText, char* searchOwner );
179    
180     };
181    
182     class EAM_FF : public ForceFields{
183    
184     public:
185     EAM_FF();
186     EAM_FF(char* the_variant);
187     virtual ~EAM_FF();
188    
189    
190     void readParams();
191     void cleanMe( void );
192    
193     void initializeAtoms( int nAtoms, Atom** atomArray );
194     void initializeBonds( int nBonds, Bond** bondArray,
195     bond_pair* the_bonds );
196     void initializeBends( int nBends, Bend** bendArray,
197     bend_set* the_bends );
198     void initializeTorsions( int nTorsions, Torsion** torsionArray,
199     torsion_set* the_torsions );
200    
201 gezelter 1628 void initForceField();
202 gezelter 1490
203     void calcRcut( void );
204 gezelter 1650
205 gezelter 1490 private:
206    
207     void fastForward( char* stopText, char* searchOwner );
208    
209     double eamRcut;
210     };
211    
212     class WATER : public ForceFields{
213    
214     public:
215     WATER();
216     virtual ~WATER();
217    
218     void readParams();
219     void cleanMe( void );
220     void initializeAtoms( int nAtoms, Atom** atomArray );
221     void initializeBonds( int nBonds, Bond** bondArray,
222     bond_pair* the_bonds );
223     void initializeBends( int nBends, Bend** bendArray,
224     bend_set* the_bends );
225     void initializeTorsions( int nTorsions, Torsion** torsionArray,
226     torsion_set* the_torsions );
227 gezelter 1628 void initForceField();
228 gezelter 1490
229 gezelter 1650
230 gezelter 1490 private:
231    
232     void fastForward( char* stopText, char* searchOwner );
233     void sectionSearch( char* secHead, char* stopText, char* searchOwner );
234    
235     };
236    
237 gezelter 1520 class Shapes_FF : public ForceFields{
238    
239     public:
240 gezelter 1650 Shapes_FF() : ForceFields() {};
241     Shapes_FF(char* the_variant) : ForceFields(the_variant) {};
242 gezelter 1520 virtual ~Shapes_FF();
243    
244 gezelter 1650 void readParams();
245 gezelter 1520 void cleanMe( void );
246    
247     void initializeAtoms( int nAtoms, Atom** atomArray );
248     void initializeBonds( int nBonds, Bond** bondArray,
249     bond_pair* the_bonds );
250     void initializeBends( int nBends, Bend** bendArray,
251     bend_set* the_bends );
252     void initializeTorsions( int nTorsions, Torsion** torsionArray,
253     torsion_set* the_torsions );
254    
255 gezelter 1628 void initForceField();
256 gezelter 1520
257 gezelter 1650 void parseShapeFile(string shapeFileName, ShapeAtomType* st);
258    
259 gezelter 1520 void calcRcut( void );
260 chrisfen 1646
261 gezelter 1520 private:
262 gezelter 1650
263     double findLargestContactDistance(ShapeAtomType* st);
264 chrisfen 1646 double shapesRcut;
265 gezelter 1520
266     };
267    
268    
269 gezelter 1490 #endif
270