838 |
|
Atom* atom; |
839 |
|
RealType totalMass; |
840 |
|
|
841 |
< |
//to avoid memory reallocation, reserve enough space for massFactors_ |
841 |
> |
/** |
842 |
> |
* The mass factor is the relative mass of an atom to the total |
843 |
> |
* mass of the cutoff group it belongs to. By default, all atoms |
844 |
> |
* are their own cutoff groups, and therefore have mass factors of |
845 |
> |
* 1. We need some special handling for massless atoms, which |
846 |
> |
* will be treated as carrying the entire mass of the cutoff |
847 |
> |
* group. |
848 |
> |
*/ |
849 |
|
massFactors_.clear(); |
850 |
< |
massFactors_.reserve(getNCutoffGroups()); |
850 |
> |
massFactors_.resize(getNAtoms(), 1.0); |
851 |
|
|
852 |
|
for(mol = beginMolecule(mi); mol != NULL; mol = nextMolecule(mi)) { |
853 |
|
for (cg = mol->beginCutoffGroup(ci); cg != NULL; |
856 |
|
totalMass = cg->getMass(); |
857 |
|
for(atom = cg->beginAtom(ai); atom != NULL; atom = cg->nextAtom(ai)) { |
858 |
|
// Check for massless groups - set mfact to 1 if true |
859 |
< |
if (totalMass != 0) |
860 |
< |
massFactors_.push_back(atom->getMass()/totalMass); |
859 |
> |
if (totalMass != 0) |
860 |
> |
massFactors_[atom->getLocalIndex()] = atom->getMass()/totalMass; |
861 |
|
else |
862 |
< |
massFactors_.push_back( 1.0 ); |
862 |
> |
massFactors_[atom->getLocalIndex()] = 1.0; |
863 |
|
} |
864 |
|
} |
865 |
|
} |
886 |
|
int* oneThreeList = oneThreeInteractions_.getPairList(); |
887 |
|
int* oneFourList = oneFourInteractions_.getPairList(); |
888 |
|
|
882 |
– |
//setFortranSim( &fInfo_, &nGlobalAtoms_, &nAtoms_, &identArray_[0], |
883 |
– |
// &nExclude, excludeList, |
884 |
– |
// &nOneTwo, oneTwoList, |
885 |
– |
// &nOneThree, oneThreeList, |
886 |
– |
// &nOneFour, oneFourList, |
887 |
– |
// &molMembershipArray[0], &mfact[0], &nCutoffGroups_, |
888 |
– |
// &fortranGlobalGroupMembership[0], &isError); |
889 |
– |
|
889 |
|
topologyDone_ = true; |
890 |
|
} |
891 |
|
|