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: 1617
Committed: Wed Oct 20 20:46:20 2004 UTC (19 years, 8 months ago) by chuckv
Original Path: trunk/OOPSE-2.0/src/UseTheForce/ForceFields.hpp
File size: 5293 byte(s)
Log Message:
Fortran/C++ interface de-obfuscation project (It is a very long story)

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
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <math.h>
11
12 #include "primitives/Atom.hpp"
13 #include "brains/SimInfo.hpp"
14 #include "primitives/StuntDouble.hpp"
15
16 #ifdef IS_MPI
17 #include "UseTheForce/mpiForceField.h"
18 #endif
19
20 #include "UseTheForce/fForceField.h"
21 //#include "UseTheForce/fortranWrapDefines.hpp"
22
23 class bond_pair{
24 public:
25 bond_pair(){}
26 ~bond_pair(){}
27
28 int a;
29 int b;
30 };
31
32 class bend_set{
33 public:
34 bend_set(){ isGhost = 0; }
35 ~bend_set(){}
36
37 int ghost;
38 int isGhost;
39
40 int a;
41 int b;
42 int c;
43 };
44
45 class torsion_set{
46 public:
47 torsion_set(){}
48 ~torsion_set(){}
49
50 int a;
51 int b;
52 int c;
53 int d;
54 };
55
56
57
58 class ForceFields{
59
60 public:
61 ForceFields(){ frcFile = NULL; entry_plug = NULL; has_variant=0;}
62 ForceFields(char * theVariant ){ frcFile = NULL; entry_plug = NULL; has_variant=1; strcpy(variant, theVariant); }
63 virtual ~ForceFields(){}
64
65 void setSimInfo( SimInfo* the_entry_plug ) { entry_plug = the_entry_plug; }
66
67 virtual void readParams( void ) = 0;
68
69 virtual void cleanMe( void ) = 0;
70
71
72 virtual void initializeAtoms( int nAtoms, Atom** atomArray ) = 0;
73 virtual void initializeBonds( int nBonds, Bond** bondArray,
74 bond_pair* the_bonds ) = 0;
75 virtual void initializeBends( int nBends, Bend** bendArray,
76 bend_set* the_bends ) = 0;
77 virtual void initializeTorsions( int nTorsions, Torsion** torsionArray,
78 torsion_set* the_torsions ) = 0;
79 virtual void initForceField( int ljMixRule ) = 0;
80 virtual void initRestraints();
81 virtual void dumpzAngle();
82
83 virtual void calcRcut( void );
84 virtual void setRcut( double LJrcut );
85 virtual void doForces( int calcPot, int calcStress );
86
87 virtual double getAtomTypeMass(char* atomType) = 0;
88
89
90 protected:
91
92 void initFortran( int ljMixPolicy, int useReactionField );
93
94
95 FILE *frcFile;
96 SimInfo* entry_plug;
97
98 int lineNum;
99 char readLine[500];
100 char* eof_test;
101 char variant[100];
102 short int has_variant;
103 double bigSigma;
104
105 };
106
107
108 class DUFF : public ForceFields{
109
110 public:
111 DUFF();
112 virtual ~DUFF();
113
114 void readParams();
115 void cleanMe( void );
116
117 void initializeAtoms( int nAtoms, Atom** atomArray );
118 void initializeBonds( int nBonds, Bond** bondArray,
119 bond_pair* the_bonds );
120 void initializeBends( int nBends, Bend** bendArray,
121 bend_set* the_bends );
122 void initializeTorsions( int nTorsions, Torsion** torsionArray,
123 torsion_set* the_torsions );
124
125 void initForceField( int ljMixRule );
126 double getAtomTypeMass(char* atomType);
127
128 private:
129
130 void fastForward( char* stopText, char* searchOwner );
131 };
132
133 class LJFF : public ForceFields{
134
135 public:
136 LJFF();
137 virtual ~LJFF();
138
139
140 void readParams();
141 void cleanMe( void );
142
143 void initializeAtoms( int nAtoms, Atom** atomArray );
144 void initializeBonds( int nBonds, Bond** bondArray,
145 bond_pair* the_bonds );
146 void initializeBends( int nBends, Bend** bendArray,
147 bend_set* the_bends );
148 void initializeTorsions( int nTorsions, Torsion** torsionArray,
149 torsion_set* the_torsions );
150
151 void initForceField( int ljMixRule );
152 double getAtomTypeMass(char* atomType);
153
154 private:
155
156 void fastForward( char* stopText, char* searchOwner );
157
158 };
159
160 class EAM_FF : public ForceFields{
161
162 public:
163 EAM_FF();
164 EAM_FF(char* the_variant);
165 virtual ~EAM_FF();
166
167
168 void readParams();
169 void cleanMe( void );
170
171 void initializeAtoms( int nAtoms, Atom** atomArray );
172 void initializeBonds( int nBonds, Bond** bondArray,
173 bond_pair* the_bonds );
174 void initializeBends( int nBends, Bend** bendArray,
175 bend_set* the_bends );
176 void initializeTorsions( int nTorsions, Torsion** torsionArray,
177 torsion_set* the_torsions );
178
179 void initForceField( int ljMixRule );
180
181 void calcRcut( void );
182 double getAtomTypeMass(char* atomType);
183 private:
184
185 void fastForward( char* stopText, char* searchOwner );
186
187 double eamRcut;
188 };
189
190 class WATER : public ForceFields{
191
192 public:
193 WATER();
194 virtual ~WATER();
195
196 void readParams();
197 void cleanMe( void );
198 void initializeAtoms( int nAtoms, Atom** atomArray );
199 void initializeBonds( int nBonds, Bond** bondArray,
200 bond_pair* the_bonds );
201 void initializeBends( int nBends, Bend** bendArray,
202 bend_set* the_bends );
203 void initializeTorsions( int nTorsions, Torsion** torsionArray,
204 torsion_set* the_torsions );
205 void initForceField( int ljMixRule );
206 double getAtomTypeMass(char* atomType);
207
208 private:
209
210 void fastForward( char* stopText, char* searchOwner );
211 void sectionSearch( char* secHead, char* stopText, char* searchOwner );
212
213 };
214
215 class Shapes_FF : public ForceFields{
216
217 public:
218 Shapes_FF();
219 Shapes_FF(char* the_variant);
220 virtual ~Shapes_FF();
221
222
223 void readParams();
224 void cleanMe( void );
225
226 void initializeAtoms( int nAtoms, Atom** atomArray );
227 void initializeBonds( int nBonds, Bond** bondArray,
228 bond_pair* the_bonds );
229 void initializeBends( int nBends, Bend** bendArray,
230 bend_set* the_bends );
231 void initializeTorsions( int nTorsions, Torsion** torsionArray,
232 torsion_set* the_torsions );
233
234 void initForceField( int ljMixRule );
235
236 void calcRcut( void );
237 double getAtomTypeMass(char* atomType);
238 private:
239
240 void fastForward( char* stopText, char* searchOwner );
241
242 double shapesRcut;
243 };
244
245
246 #endif
247