90 |
|
|
91 |
|
ForceField::AtomTypeContainer* atomTypes = forceField_->getAtomTypes(); |
92 |
|
int nTypes = atomTypes->size(); |
93 |
+ |
sHash_.resize(nTypes); |
94 |
|
iHash_.resize(nTypes); |
95 |
|
interactions_.resize(nTypes); |
96 |
|
ForceField::AtomTypeContainer::MapTypeIterator i1, i2; |
116 |
|
set<AtomType*>::iterator at; |
117 |
|
|
118 |
|
for (at = atypes.begin(); at != atypes.end(); ++at) { |
119 |
< |
|
119 |
< |
//for (atype1 = atomTypes->beginType(i1); atype1 != NULL; |
120 |
< |
// atype1 = atomTypes->nextType(i1)) { |
121 |
< |
|
119 |
> |
|
120 |
|
atype1 = *at; |
121 |
|
atid1 = atype1->getIdent(); |
122 |
|
iHash_[atid1].resize(nTypes); |
133 |
|
painCave.isFatal = 0; |
134 |
|
simError(); |
135 |
|
} |
136 |
+ |
|
137 |
+ |
if (atype1->isLennardJones()) { |
138 |
+ |
sHash_[atid1] |= LJ_INTERACTION; |
139 |
+ |
} |
140 |
+ |
if (atype1->isElectrostatic()) { |
141 |
+ |
sHash_[atid1] |= ELECTROSTATIC_INTERACTION; |
142 |
+ |
} |
143 |
+ |
if (atype1->isSticky()) { |
144 |
+ |
sHash_[atid1] |= STICKY_INTERACTION; |
145 |
+ |
} |
146 |
+ |
if (atype1->isStickyPower()) { |
147 |
+ |
sHash_[atid1] |= STICKY_INTERACTION; |
148 |
+ |
} |
149 |
+ |
if (atype1->isEAM()) { |
150 |
+ |
sHash_[atid1] |= EAM_INTERACTION; |
151 |
+ |
} |
152 |
+ |
if (atype1->isSC()) { |
153 |
+ |
sHash_[atid1] |= SC_INTERACTION; |
154 |
+ |
} |
155 |
+ |
if (atype1->isGayBerne()) { |
156 |
+ |
sHash_[atid1] |= GB_INTERACTION; |
157 |
+ |
} |
158 |
|
} |
139 |
– |
|
159 |
|
// Now, iterate over all known types and add to the interaction map: |
160 |
|
|
161 |
|
map<int, AtomType*>::iterator it1, it2; |
171 |
|
|
172 |
|
if (atype1->isLennardJones() && atype2->isLennardJones()) { |
173 |
|
interactions_[atid1][atid2].insert(lj_); |
174 |
< |
iHash_[atid1][atid2] |= LJ_PAIR; |
174 |
> |
iHash_[atid1][atid2] |= LJ_INTERACTION; |
175 |
|
} |
176 |
|
if (atype1->isElectrostatic() && atype2->isElectrostatic() ) { |
177 |
|
interactions_[atid1][atid2].insert(electrostatic_); |
178 |
< |
iHash_[atid1][atid2] |= ELECTROSTATIC_PAIR; |
178 |
> |
iHash_[atid1][atid2] |= ELECTROSTATIC_INTERACTION; |
179 |
|
} |
180 |
|
if (atype1->isSticky() && atype2->isSticky() ) { |
181 |
|
interactions_[atid1][atid2].insert(sticky_); |
182 |
< |
iHash_[atid1][atid2] |= STICKY_PAIR; |
182 |
> |
iHash_[atid1][atid2] |= STICKY_INTERACTION; |
183 |
|
} |
184 |
|
if (atype1->isStickyPower() && atype2->isStickyPower() ) { |
185 |
|
interactions_[atid1][atid2].insert(sticky_); |
186 |
< |
iHash_[atid1][atid2] |= STICKY_PAIR; |
186 |
> |
iHash_[atid1][atid2] |= STICKY_INTERACTION; |
187 |
|
} |
188 |
|
if (atype1->isEAM() && atype2->isEAM() ) { |
189 |
|
interactions_[atid1][atid2].insert(eam_); |
190 |
< |
iHash_[atid1][atid2] |= EAM_PAIR; |
190 |
> |
iHash_[atid1][atid2] |= EAM_INTERACTION; |
191 |
|
} |
192 |
|
if (atype1->isSC() && atype2->isSC() ) { |
193 |
|
interactions_[atid1][atid2].insert(sc_); |
194 |
< |
iHash_[atid1][atid2] |= SC_PAIR; |
194 |
> |
iHash_[atid1][atid2] |= SC_INTERACTION; |
195 |
|
} |
196 |
|
if (atype1->isGayBerne() && atype2->isGayBerne() ) { |
197 |
|
interactions_[atid1][atid2].insert(gb_); |
198 |
< |
iHash_[atid1][atid2] |= GB_PAIR; |
198 |
> |
iHash_[atid1][atid2] |= GB_INTERACTION; |
199 |
|
} |
200 |
|
if ((atype1->isGayBerne() && atype2->isLennardJones()) |
201 |
|
|| (atype1->isLennardJones() && atype2->isGayBerne())) { |
202 |
|
interactions_[atid1][atid2].insert(gb_); |
203 |
< |
iHash_[atid1][atid2] |= GB_PAIR; |
203 |
> |
iHash_[atid1][atid2] |= GB_INTERACTION; |
204 |
|
} |
205 |
|
|
206 |
|
// look for an explicitly-set non-bonded interaction type using the |
226 |
|
} |
227 |
|
} |
228 |
|
interactions_[atid1][atid2].insert(lj_); |
229 |
< |
iHash_[atid1][atid2] |= LJ_PAIR; |
229 |
> |
iHash_[atid1][atid2] |= LJ_INTERACTION; |
230 |
|
vdwExplicit = true; |
231 |
|
} |
232 |
|
|
253 |
|
} |
254 |
|
} |
255 |
|
interactions_[atid1][atid2].insert(morse_); |
256 |
< |
iHash_[atid1][atid2] |= MORSE_PAIR; |
256 |
> |
iHash_[atid1][atid2] |= MORSE_INTERACTION; |
257 |
|
vdwExplicit = true; |
258 |
|
} |
259 |
|
|
280 |
|
} |
281 |
|
} |
282 |
|
interactions_[atid1][atid2].insert(repulsivePower_); |
283 |
< |
iHash_[atid1][atid2] |= REPULSIVEPOWER_PAIR; |
283 |
> |
iHash_[atid1][atid2] |= REPULSIVEPOWER_INTERACTION; |
284 |
|
vdwExplicit = true; |
285 |
|
} |
286 |
|
|
298 |
|
} |
299 |
|
} |
300 |
|
interactions_[atid1][atid2].insert(eam_); |
301 |
< |
iHash_[atid1][atid2] |= EAM_PAIR; |
301 |
> |
iHash_[atid1][atid2] |= EAM_INTERACTION; |
302 |
|
metExplicit = true; |
303 |
|
} |
304 |
|
|
325 |
|
} |
326 |
|
} |
327 |
|
interactions_[atid1][atid2].insert(sc_); |
328 |
< |
iHash_[atid1][atid2] |= SC_PAIR; |
328 |
> |
iHash_[atid1][atid2] |= SC_INTERACTION; |
329 |
|
metExplicit = true; |
330 |
|
} |
331 |
|
|
352 |
|
} |
353 |
|
} |
354 |
|
interactions_[atid1][atid2].insert(maw_); |
355 |
< |
iHash_[atid1][atid2] |= MAW_PAIR; |
355 |
> |
iHash_[atid1][atid2] |= MAW_INTERACTION; |
356 |
|
vdwExplicit = true; |
357 |
|
} |
358 |
|
} |
371 |
|
atid1 = atype1->getIdent(); |
372 |
|
for (jt = it; jt != simTypes.end(); ++jt) { |
373 |
|
atype2 = (*jt); |
374 |
< |
atid1 = atype1->getIdent(); |
374 |
> |
atid2 = atype2->getIdent(); |
375 |
|
|
376 |
|
if (interactions_[atid1][atid2].size() == 0) { |
377 |
|
sprintf( painCave.errMsg, |
404 |
|
|
405 |
|
int& iHash = iHash_[idat.atid1][idat.atid2]; |
406 |
|
|
407 |
< |
if ((iHash & EAM_PAIR) != 0) eam_->calcDensity(idat); |
408 |
< |
if ((iHash & SC_PAIR) != 0) sc_->calcDensity(idat); |
407 |
> |
if ((iHash & EAM_INTERACTION) != 0) eam_->calcDensity(idat); |
408 |
> |
if ((iHash & SC_INTERACTION) != 0) sc_->calcDensity(idat); |
409 |
|
|
410 |
|
// set<NonBondedInteraction*>::iterator it; |
411 |
|
|
423 |
|
|
424 |
|
if (!initialized_) initialize(); |
425 |
|
|
426 |
< |
int& iHash = iHash_[sdat.atid][sdat.atid]; |
426 |
> |
int& sHash = sHash_[sdat.atid]; |
427 |
|
|
428 |
< |
if ((iHash & EAM_PAIR) != 0) eam_->calcFunctional(sdat); |
429 |
< |
if ((iHash & SC_PAIR) != 0) sc_->calcFunctional(sdat); |
428 |
> |
if ((sHash & EAM_INTERACTION) != 0) eam_->calcFunctional(sdat); |
429 |
> |
if ((sHash & SC_INTERACTION) != 0) sc_->calcFunctional(sdat); |
430 |
|
|
431 |
|
// set<NonBondedInteraction*>::iterator it; |
432 |
|
|
445 |
|
|
446 |
|
int& iHash = iHash_[idat.atid1][idat.atid2]; |
447 |
|
|
448 |
< |
if ((iHash & ELECTROSTATIC_PAIR) != 0) electrostatic_->calcForce(idat); |
448 |
> |
if ((iHash & ELECTROSTATIC_INTERACTION) != 0) electrostatic_->calcForce(idat); |
449 |
|
|
450 |
|
// electrostatics still has to worry about indirect |
451 |
|
// contributions from excluded pairs of atoms, but nothing else does: |
452 |
|
|
453 |
|
if (idat.excluded) return; |
454 |
|
|
455 |
< |
if ((iHash & LJ_PAIR) != 0) lj_->calcForce(idat); |
456 |
< |
if ((iHash & GB_PAIR) != 0) gb_->calcForce(idat); |
457 |
< |
if ((iHash & STICKY_PAIR) != 0) sticky_->calcForce(idat); |
458 |
< |
if ((iHash & MORSE_PAIR) != 0) morse_->calcForce(idat); |
459 |
< |
if ((iHash & REPULSIVEPOWER_PAIR) != 0) repulsivePower_->calcForce(idat); |
460 |
< |
if ((iHash & EAM_PAIR) != 0) eam_->calcForce(idat); |
461 |
< |
if ((iHash & SC_PAIR) != 0) sc_->calcForce(idat); |
462 |
< |
if ((iHash & MAW_PAIR) != 0) maw_->calcForce(idat); |
455 |
> |
if ((iHash & LJ_INTERACTION) != 0) lj_->calcForce(idat); |
456 |
> |
if ((iHash & GB_INTERACTION) != 0) gb_->calcForce(idat); |
457 |
> |
if ((iHash & STICKY_INTERACTION) != 0) sticky_->calcForce(idat); |
458 |
> |
if ((iHash & MORSE_INTERACTION) != 0) morse_->calcForce(idat); |
459 |
> |
if ((iHash & REPULSIVEPOWER_INTERACTION) != 0) repulsivePower_->calcForce(idat); |
460 |
> |
if ((iHash & EAM_INTERACTION) != 0) eam_->calcForce(idat); |
461 |
> |
if ((iHash & SC_INTERACTION) != 0) sc_->calcForce(idat); |
462 |
> |
if ((iHash & MAW_INTERACTION) != 0) maw_->calcForce(idat); |
463 |
|
|
464 |
|
// set<NonBondedInteraction*>::iterator it; |
465 |
|
|
481 |
|
|
482 |
|
if (!initialized_) initialize(); |
483 |
|
|
484 |
< |
int& iHash = iHash_[sdat.atid][sdat.atid]; |
484 |
> |
int& sHash = sHash_[sdat.atid]; |
485 |
|
|
486 |
< |
if ((iHash & ELECTROSTATIC_PAIR) != 0) electrostatic_->calcSelfCorrection(sdat); |
486 |
> |
if ((sHash & ELECTROSTATIC_INTERACTION) != 0) electrostatic_->calcSelfCorrection(sdat); |
487 |
|
|
488 |
|
// set<NonBondedInteraction*>::iterator it; |
489 |
|
|