--- trunk/src/utils/MoLocator.cpp 2009/11/25 20:02:06 1390 +++ trunk/src/utils/MoLocator.cpp 2013/06/16 15:15:42 1879 @@ -35,8 +35,9 @@ * * [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). * [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). - * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). - * [4] Vardeman & Gezelter, in progress (2009). + * [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008). + * [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). + * [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). */ #include @@ -57,7 +58,8 @@ namespace OpenMD { calcRef(); } - void MoLocator::placeMol( const Vector3d& offset, const Vector3d& ort, Molecule* mol){ + void MoLocator::placeMol( const Vector3d& offset, const Vector3d& ort, + Molecule* mol) { Vector3d newCoor; Vector3d curRefCoor; @@ -65,27 +67,28 @@ namespace OpenMD { if(mol->getNIntegrableObjects() != nIntegrableObjects){ sprintf( painCave.errMsg, - "MoLocator error.\n" - " The number of integrable objects of MoleculeStamp is not the same as that of Molecule\n"); + "MoLocator::placeMol error.\n" + "\tThe number of integrable objects of MoleculeStamp is not\n" + "\tthe same as that of Molecule\n"); painCave.isFatal = 1; simError(); } Molecule::IntegrableObjectIterator ii; - StuntDouble* integrableObject; + StuntDouble* sd; int i; - for (integrableObject = mol->beginIntegrableObject(ii), i = 0; integrableObject != NULL; - integrableObject = mol->nextIntegrableObject(ii), ++i) { + for (sd = mol->beginIntegrableObject(ii), i = 0; sd != NULL; + sd = mol->nextIntegrableObject(ii), ++i) { newCoor = rotMat * refCoords[i]; newCoor += offset; - integrableObject->setPos(newCoor); - integrableObject->setVel(V3Zero); + sd->setPos(newCoor); + sd->setVel(V3Zero); - if(integrableObject->isDirectional()){ - integrableObject->setA(rotMat * integrableObject->getA()); - integrableObject->setJ(V3Zero); + if(sd->isDirectional()){ + sd->setA(rotMat * sd->getA()); + sd->setJ(V3Zero); } } } @@ -93,7 +96,7 @@ namespace OpenMD { void MoLocator::calcRef( void ){ AtomStamp* currAtomStamp; RigidBodyStamp* rbStamp; - int nAtoms; + unsigned int nAtoms; int nRigidBodies; std::vector mass; Vector3d coor; @@ -106,15 +109,15 @@ namespace OpenMD { nAtoms= myStamp->getNAtoms(); nRigidBodies = myStamp->getNRigidBodies(); - for(size_t i=0; igetAtomStamp(i); if( !currAtomStamp->havePosition() ){ sprintf( painCave.errMsg, - "MoLocator error.\n" - " Component %s, atom %s does not have a position specified.\n" - " This means MoLocator cannot initalize it's position.\n", + "MoLocator::calcRef error.\n" + "\tComponent %s, atom %s does not have a position specified.\n" + "\tThis means MoLocator cannot initalize it's position.\n", myStamp->getName().c_str(), currAtomStamp->getType().c_str()); @@ -177,13 +180,13 @@ namespace OpenMD { refMolCom /= molMass; - //move the reference center of mass to (0,0,0) and adjust the reference coordinate - //of the integrabel objects + //move the reference center of mass to (0,0,0) and adjust the + //reference coordinate of the integrabel objects for(int i = 0; i < nIntegrableObjects; i++) refCoords[i] -= refMolCom; } - RealType getAtomMass(const std::string& at, ForceField* myFF) { + RealType MoLocator::getAtomMass(const std::string& at, ForceField* myFF) { RealType mass; AtomType* atomType= myFF->getAtomType(at); if (atomType != NULL) { @@ -195,25 +198,25 @@ namespace OpenMD { return mass; } - RealType getMolMass(MoleculeStamp *molStamp, ForceField *myFF) { - int nAtoms; + RealType MoLocator::getMolMass(MoleculeStamp *molStamp, ForceField *myFF) { + unsigned int nAtoms; RealType totMass = 0; nAtoms = molStamp->getNAtoms(); - for(size_t i = 0; i < nAtoms; i++) { + for(unsigned int i = 0; i < nAtoms; i++) { AtomStamp *currAtomStamp = molStamp->getAtomStamp(i); totMass += getAtomMass(currAtomStamp->getType(), myFF); } return totMass; } - RotMat3x3d latVec2RotMat(const Vector3d& lv){ + + RotMat3x3d MoLocator::latVec2RotMat(const Vector3d& lv){ RealType theta =acos(lv[2]); RealType phi = atan2(lv[1], lv[0]); RealType psi = 0; - return RotMat3x3d(phi, theta, psi); - + return RotMat3x3d(phi, theta, psi); } }