--- trunk/src/primitives/GhostBend.cpp 2010/07/06 21:23:46 1459 +++ trunk/src/primitives/GhostBend.cpp 2013/12/05 18:19:26 1953 @@ -35,19 +35,22 @@ * * [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 "config.h" +#include #include "primitives/GhostBend.hpp" #include "primitives/DirectionalAtom.hpp" namespace OpenMD { /**@todo still a lot left to improve*/ - void GhostBend::calcForce(RealType& angle) { - DirectionalAtom* ghostAtom = static_cast(atom2_); + void GhostBend::calcForce(RealType& angle, bool doParticlePot) { + DirectionalAtom* ghostAtom = static_cast(atoms_[1]); - Vector3d pos1 = atom1_->getPos(); + Vector3d pos1 = atoms_[0]->getPos(); Vector3d pos2 = ghostAtom->getPos(); Vector3d r21 = pos1 - pos2; @@ -90,14 +93,15 @@ namespace OpenMD { // Total force in current bend is zero - atom1_->addFrc(force1); + atoms_[0]->addFrc(force1); ghostAtom->addFrc(-force1); ghostAtom->addTrq( cross(r23, force3) ); + if(doParticlePot) { + atoms_[0]->addParticlePot(potential_); + ghostAtom->addParticlePot(potential_); + } - atom1_->addParticlePot(potential_); - ghostAtom->addParticlePot(potential_); - angle = theta /M_PI * 180.0; }