73 |
|
|
74 |
|
void ForceFields::doForces( int calcPot, int calcStress ){ |
75 |
|
|
76 |
< |
int i, isError; |
76 |
> |
int i, j, isError; |
77 |
|
double* frc; |
78 |
|
double* pos; |
79 |
|
double* trq; |
83 |
|
double* massRatio; |
84 |
|
SimState* config; |
85 |
|
|
86 |
+ |
Molecule* myMols; |
87 |
+ |
Atom** myAtoms; |
88 |
+ |
int numAtom; |
89 |
+ |
int curIndex; |
90 |
+ |
double mtot; |
91 |
+ |
int numMol; |
92 |
+ |
int numCutoffGroups; |
93 |
+ |
CutoffGroup* myCutoffGroup; |
94 |
+ |
vector<CutoffGroup*>::iterator iterCutoff; |
95 |
+ |
double com[3]; |
96 |
+ |
vector<double> rcGroup; |
97 |
+ |
|
98 |
|
short int passedCalcPot = (short int)calcPot; |
99 |
|
short int passedCalcStress = (short int)calcStress; |
100 |
|
|
112 |
|
for(i=0; i<entry_plug->n_mol; i++ ){ |
113 |
|
// CalcForces in molecules takes care of mapping rigid body coordinates |
114 |
|
// into atomic coordinates |
115 |
< |
entry_plug->molecules[i].calcForces(); |
115 |
> |
entry_plug->molecules[i].calcForces(); |
116 |
|
} |
117 |
|
|
118 |
|
#ifdef PROFILE |
126 |
|
trq = config->getTrqArray(); |
127 |
|
A = config->getAmatArray(); |
128 |
|
u_l = config->getUlArray(); |
117 |
– |
rc = config->getRcArray(); |
118 |
– |
massRatio = config->getMassRatioArray(); |
129 |
|
|
130 |
+ |
if(entry_plug->haveCutoffGroups){ |
131 |
+ |
myMols = entry_plug->molecules; |
132 |
+ |
numMol = entry_plug->n_mol; |
133 |
+ |
for(int i = 0; i < numMol; i++){ |
134 |
+ |
|
135 |
+ |
numCutoffGroups = myMols[i].getNCutoffGroups(); |
136 |
+ |
for(myCutoffGroup =myMols[i].beginCutoffGroup(iterCutoff); myCutoffGroup != NULL; |
137 |
+ |
myCutoffGroup =myMols[i].nextCutoffGroup(iterCutoff)){ |
138 |
+ |
//get center of mass of the cutoff group |
139 |
+ |
myCutoffGroup->getCOM(com); |
140 |
+ |
|
141 |
+ |
rcGroup.push_back(com[0]); |
142 |
+ |
rcGroup.push_back(com[1]); |
143 |
+ |
rcGroup.push_back(com[2]); |
144 |
+ |
|
145 |
+ |
}// end for(myCutoffGroup) |
146 |
+ |
|
147 |
+ |
}//end for(int i = 0) |
148 |
+ |
|
149 |
+ |
rc = &rcGroup[0]; |
150 |
+ |
} |
151 |
+ |
else{ |
152 |
+ |
// center of mass of the group is the same as position of the atom if cutoff group does not exist |
153 |
+ |
rc = pos; |
154 |
+ |
} |
155 |
+ |
|
156 |
+ |
|
157 |
+ |
|
158 |
|
isError = 0; |
159 |
|
entry_plug->lrPot = 0.0; |
160 |
|
|