| 1 |
gezelter |
2 |
#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 |
tim |
3 |
#include "primitives/Atom.hpp" |
| 13 |
|
|
#include "brains/SimInfo.hpp" |
| 14 |
|
|
#include "primitives/StuntDouble.hpp" |
| 15 |
gezelter |
2 |
|
| 16 |
|
|
#ifdef IS_MPI |
| 17 |
tim |
3 |
#include "UseTheForce/mpiForceField.h" |
| 18 |
gezelter |
2 |
#endif |
| 19 |
|
|
|
| 20 |
tim |
8 |
#include "UseTheForce/fForceField.h" |
| 21 |
tim |
3 |
#include "UseTheForce/fortranWrapDefines.hpp" |
| 22 |
gezelter |
2 |
|
| 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 |
|
|
void setFortranForceLoop( doForceLoop_TD fsub ){ |
| 90 |
|
|
fortranForceLoop = fsub; |
| 91 |
|
|
} |
| 92 |
|
|
|
| 93 |
|
|
protected: |
| 94 |
|
|
|
| 95 |
|
|
void initFortran( int ljMixPolicy, int useReactionField ); |
| 96 |
|
|
doForceLoop_TD fortranForceLoop; |
| 97 |
|
|
|
| 98 |
|
|
FILE *frcFile; |
| 99 |
|
|
SimInfo* entry_plug; |
| 100 |
|
|
|
| 101 |
|
|
int lineNum; |
| 102 |
|
|
char readLine[500]; |
| 103 |
|
|
char* eof_test; |
| 104 |
|
|
char variant[100]; |
| 105 |
|
|
short int has_variant; |
| 106 |
|
|
double bigSigma; |
| 107 |
|
|
|
| 108 |
|
|
}; |
| 109 |
|
|
|
| 110 |
|
|
|
| 111 |
|
|
class DUFF : public ForceFields{ |
| 112 |
|
|
|
| 113 |
|
|
public: |
| 114 |
|
|
DUFF(); |
| 115 |
|
|
virtual ~DUFF(); |
| 116 |
|
|
|
| 117 |
|
|
void readParams(); |
| 118 |
|
|
void cleanMe( void ); |
| 119 |
|
|
|
| 120 |
|
|
void initializeAtoms( int nAtoms, Atom** atomArray ); |
| 121 |
|
|
void initializeBonds( int nBonds, Bond** bondArray, |
| 122 |
|
|
bond_pair* the_bonds ); |
| 123 |
|
|
void initializeBends( int nBends, Bend** bendArray, |
| 124 |
|
|
bend_set* the_bends ); |
| 125 |
|
|
void initializeTorsions( int nTorsions, Torsion** torsionArray, |
| 126 |
|
|
torsion_set* the_torsions ); |
| 127 |
|
|
|
| 128 |
|
|
void initForceField( int ljMixRule ); |
| 129 |
|
|
double getAtomTypeMass(char* atomType); |
| 130 |
|
|
|
| 131 |
|
|
private: |
| 132 |
|
|
|
| 133 |
|
|
void fastForward( char* stopText, char* searchOwner ); |
| 134 |
|
|
}; |
| 135 |
|
|
|
| 136 |
|
|
class LJFF : public ForceFields{ |
| 137 |
|
|
|
| 138 |
|
|
public: |
| 139 |
|
|
LJFF(); |
| 140 |
|
|
virtual ~LJFF(); |
| 141 |
|
|
|
| 142 |
|
|
|
| 143 |
|
|
void readParams(); |
| 144 |
|
|
void cleanMe( void ); |
| 145 |
|
|
|
| 146 |
|
|
void initializeAtoms( int nAtoms, Atom** atomArray ); |
| 147 |
|
|
void initializeBonds( int nBonds, Bond** bondArray, |
| 148 |
|
|
bond_pair* the_bonds ); |
| 149 |
|
|
void initializeBends( int nBends, Bend** bendArray, |
| 150 |
|
|
bend_set* the_bends ); |
| 151 |
|
|
void initializeTorsions( int nTorsions, Torsion** torsionArray, |
| 152 |
|
|
torsion_set* the_torsions ); |
| 153 |
|
|
|
| 154 |
|
|
void initForceField( int ljMixRule ); |
| 155 |
|
|
double getAtomTypeMass(char* atomType); |
| 156 |
|
|
|
| 157 |
|
|
private: |
| 158 |
|
|
|
| 159 |
|
|
void fastForward( char* stopText, char* searchOwner ); |
| 160 |
|
|
|
| 161 |
|
|
}; |
| 162 |
|
|
|
| 163 |
|
|
class EAM_FF : public ForceFields{ |
| 164 |
|
|
|
| 165 |
|
|
public: |
| 166 |
|
|
EAM_FF(); |
| 167 |
|
|
EAM_FF(char* the_variant); |
| 168 |
|
|
virtual ~EAM_FF(); |
| 169 |
|
|
|
| 170 |
|
|
|
| 171 |
|
|
void readParams(); |
| 172 |
|
|
void cleanMe( void ); |
| 173 |
|
|
|
| 174 |
|
|
void initializeAtoms( int nAtoms, Atom** atomArray ); |
| 175 |
|
|
void initializeBonds( int nBonds, Bond** bondArray, |
| 176 |
|
|
bond_pair* the_bonds ); |
| 177 |
|
|
void initializeBends( int nBends, Bend** bendArray, |
| 178 |
|
|
bend_set* the_bends ); |
| 179 |
|
|
void initializeTorsions( int nTorsions, Torsion** torsionArray, |
| 180 |
|
|
torsion_set* the_torsions ); |
| 181 |
|
|
|
| 182 |
|
|
void initForceField( int ljMixRule ); |
| 183 |
|
|
|
| 184 |
|
|
void calcRcut( void ); |
| 185 |
|
|
double getAtomTypeMass(char* atomType); |
| 186 |
|
|
private: |
| 187 |
|
|
|
| 188 |
|
|
void fastForward( char* stopText, char* searchOwner ); |
| 189 |
|
|
|
| 190 |
|
|
double eamRcut; |
| 191 |
|
|
}; |
| 192 |
|
|
|
| 193 |
|
|
class WATER : public ForceFields{ |
| 194 |
|
|
|
| 195 |
|
|
public: |
| 196 |
|
|
WATER(); |
| 197 |
|
|
virtual ~WATER(); |
| 198 |
|
|
|
| 199 |
|
|
void readParams(); |
| 200 |
|
|
void cleanMe( void ); |
| 201 |
|
|
void initializeAtoms( int nAtoms, Atom** atomArray ); |
| 202 |
|
|
void initializeBonds( int nBonds, Bond** bondArray, |
| 203 |
|
|
bond_pair* the_bonds ); |
| 204 |
|
|
void initializeBends( int nBends, Bend** bendArray, |
| 205 |
|
|
bend_set* the_bends ); |
| 206 |
|
|
void initializeTorsions( int nTorsions, Torsion** torsionArray, |
| 207 |
|
|
torsion_set* the_torsions ); |
| 208 |
|
|
void initForceField( int ljMixRule ); |
| 209 |
|
|
double getAtomTypeMass(char* atomType); |
| 210 |
|
|
|
| 211 |
|
|
private: |
| 212 |
|
|
|
| 213 |
|
|
void fastForward( char* stopText, char* searchOwner ); |
| 214 |
|
|
void sectionSearch( char* secHead, char* stopText, char* searchOwner ); |
| 215 |
|
|
|
| 216 |
|
|
}; |
| 217 |
|
|
|
| 218 |
|
|
#endif |
| 219 |
|
|
|