| 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 <cstdio> | 
| 9 | #include <cstdlib> | 
| 10 |  | 
| 11 | #include "Atom.hpp" | 
| 12 | #include "SimInfo.hpp" | 
| 13 |  | 
| 14 | #ifdef IS_MPI | 
| 15 | #include "mpiForceField.h" | 
| 16 | #endif | 
| 17 |  | 
| 18 | #include "fForceField.h" | 
| 19 | #include "fortranWrapDefines.hpp" | 
| 20 |  | 
| 21 | class bond_pair{ | 
| 22 | public: | 
| 23 | bond_pair(){} | 
| 24 | ~bond_pair(){} | 
| 25 |  | 
| 26 | int a; | 
| 27 | int b; | 
| 28 | }; | 
| 29 |  | 
| 30 | class bend_set{ | 
| 31 | public: | 
| 32 | bend_set(){ isGhost = 0; } | 
| 33 | ~bend_set(){} | 
| 34 |  | 
| 35 | int ghost; | 
| 36 | int isGhost; | 
| 37 |  | 
| 38 | int a; | 
| 39 | int b; | 
| 40 | int c; | 
| 41 | }; | 
| 42 |  | 
| 43 | class torsion_set{ | 
| 44 | public: | 
| 45 | torsion_set(){} | 
| 46 | ~torsion_set(){} | 
| 47 |  | 
| 48 | int a; | 
| 49 | int b; | 
| 50 | int c; | 
| 51 | int d; | 
| 52 | }; | 
| 53 |  | 
| 54 |  | 
| 55 |  | 
| 56 | class ForceFields{ | 
| 57 |  | 
| 58 | public: | 
| 59 | ForceFields(){ frcFile = NULL; entry_plug = NULL; } | 
| 60 | virtual ~ForceFields(){} | 
| 61 |  | 
| 62 | void setSimInfo( SimInfo* the_entry_plug ) { entry_plug = the_entry_plug; } | 
| 63 |  | 
| 64 | virtual void readParams( void ) = 0; | 
| 65 | virtual void cleanMe( void ) = 0; | 
| 66 |  | 
| 67 |  | 
| 68 | virtual void initializeAtoms( int nAtoms, Atom** atomArray ) = 0; | 
| 69 | virtual void initializeBonds( int nBonds, Bond** bondArray, | 
| 70 | bond_pair* the_bonds ) = 0; | 
| 71 | virtual void initializeBends( int nBends, Bend** bendArray, | 
| 72 | bend_set* the_bends ) = 0; | 
| 73 | virtual void initializeTorsions( int nTorsions, Torsion** torsionArray, | 
| 74 | torsion_set* the_torsions ) = 0; | 
| 75 | virtual void initForceField( int ljMixRule ) = 0; | 
| 76 |  | 
| 77 | virtual void calcRcut( void ); | 
| 78 | virtual void doForces( int calcPot, int calcStress ); | 
| 79 |  | 
| 80 | void setFortranForceLoop( void (*fsub) doForceLoopList ){ | 
| 81 | fortranForceLoop = fsub; | 
| 82 | } | 
| 83 |  | 
| 84 | protected: | 
| 85 |  | 
| 86 | void initFortran( int ljMixPolicy, int useReactionField ); | 
| 87 | void (*fortranForceLoop) doForceLoopList; | 
| 88 |  | 
| 89 | FILE *frcFile; | 
| 90 | SimInfo* entry_plug; | 
| 91 |  | 
| 92 | int lineNum; | 
| 93 | char readLine[500]; | 
| 94 | char* eof_test; | 
| 95 | double bigSigma; | 
| 96 |  | 
| 97 | }; | 
| 98 |  | 
| 99 |  | 
| 100 | class TraPPE_ExFF : public ForceFields{ | 
| 101 |  | 
| 102 | public: | 
| 103 | TraPPE_ExFF(); | 
| 104 | virtual ~TraPPE_ExFF(); | 
| 105 |  | 
| 106 | void readParams(); | 
| 107 | void cleanMe( void ); | 
| 108 |  | 
| 109 | void initializeAtoms( int nAtoms, Atom** atomArray ); | 
| 110 | void initializeBonds( int nBonds, Bond** bondArray, | 
| 111 | bond_pair* the_bonds ); | 
| 112 | void initializeBends( int nBends, Bend** bendArray, | 
| 113 | bend_set* the_bends ); | 
| 114 | void initializeTorsions( int nTorsions, Torsion** torsionArray, | 
| 115 | torsion_set* the_torsions ); | 
| 116 |  | 
| 117 | void initForceField( int ljMixRule ); | 
| 118 |  | 
| 119 | private: | 
| 120 |  | 
| 121 | void fastForward( char* stopText, char* searchOwner ); | 
| 122 | }; | 
| 123 |  | 
| 124 | class LJ_FF : public ForceFields{ | 
| 125 |  | 
| 126 | public: | 
| 127 | LJ_FF(); | 
| 128 | virtual ~LJ_FF(); | 
| 129 |  | 
| 130 |  | 
| 131 | void readParams(); | 
| 132 | void cleanMe( void ); | 
| 133 |  | 
| 134 | void initializeAtoms( int nAtoms, Atom** atomArray ); | 
| 135 | void initializeBonds( int nBonds, Bond** bondArray, | 
| 136 | bond_pair* the_bonds ); | 
| 137 | void initializeBends( int nBends, Bend** bendArray, | 
| 138 | bend_set* the_bends ); | 
| 139 | void initializeTorsions( int nTorsions, Torsion** torsionArray, | 
| 140 | torsion_set* the_torsions ); | 
| 141 |  | 
| 142 | void initForceField( int ljMixRule ); | 
| 143 |  | 
| 144 | private: | 
| 145 |  | 
| 146 | void fastForward( char* stopText, char* searchOwner ); | 
| 147 |  | 
| 148 | }; | 
| 149 | class EAM_FF : public ForceFields{ | 
| 150 |  | 
| 151 | public: | 
| 152 | EAM_FF(); | 
| 153 | virtual ~EAM_FF(); | 
| 154 |  | 
| 155 |  | 
| 156 | void readParams(); | 
| 157 | void cleanMe( void ); | 
| 158 |  | 
| 159 | void initializeAtoms( int nAtoms, Atom** atomArray ); | 
| 160 | void initializeBonds( int nBonds, Bond** bondArray, | 
| 161 | bond_pair* the_bonds ); | 
| 162 | void initializeBends( int nBends, Bend** bendArray, | 
| 163 | bend_set* the_bends ); | 
| 164 | void initializeTorsions( int nTorsions, Torsion** torsionArray, | 
| 165 | torsion_set* the_torsions ); | 
| 166 |  | 
| 167 | void initForceField( int ljMixRule ); | 
| 168 |  | 
| 169 | private: | 
| 170 |  | 
| 171 | void fastForward( char* stopText, char* searchOwner ); | 
| 172 |  | 
| 173 | }; | 
| 174 |  | 
| 175 | #endif | 
| 176 |  |