--- trunk/src/restraints/ObjectRestraint.cpp 2012/08/22 02:28:28 1782 +++ trunk/src/restraints/ObjectRestraint.cpp 2014/10/16 19:13:51 2024 @@ -35,7 +35,7 @@ * * [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). + * [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). */ @@ -52,9 +52,10 @@ namespace OpenMD { RealType r = del.length(); Vector3d frc = -kDisp_ * del; RealType p = 0.5 * kDisp_ * del.lengthSquare(); + pot_ = p; force_ = frc * scaleFactor_; - restInfo_[rtDisplacement] = std::make_pair(r,p); + if (printRest_) restInfo_[rtDisplacement] = std::make_pair(r,p); } } @@ -69,6 +70,8 @@ namespace OpenMD { RotMat3x3d temp = A * refA_.transpose(); + Vector3d euler = temp.toEulerAngles(); + Quat4d quat = temp.toQuaternion(); RealType twistAngle; @@ -77,36 +80,41 @@ namespace OpenMD { quat.toSwingTwist(swingX, swingY, twistAngle); - RealType dVdtwist, dVdswingX, dVdswingY; - RealType dTwist, dSwingX, dSwingY; + RealType p; Vector3d tTwist, tSwing; if (restType_ & rtTwist){ - dTwist = twistAngle - twist0_; - dVdtwist = kTwist_ * sin(dTwist); - p = kTwist_ * (1.0 - cos(dTwist) ); + RealType dTwist = twistAngle - twist0_; + /// RealType dVdtwist = kTwist_ * sin(dTwist); + /// p = kTwist_ * (1.0 - cos(dTwist) ); + RealType dVdtwist = kTwist_ * dTwist; + p = 0.5 * kTwist_ * dTwist * dTwist; pot_ += p; tBody -= dVdtwist * V3Z; - restInfo_[rtTwist] = std::make_pair(twistAngle, p); + if (printRest_) restInfo_[rtTwist] = std::make_pair(twistAngle, p); } if (restType_ & rtSwingX){ - dSwingX = swingX - swingX0_; - dVdswingX = kSwingX_ * 0.5 * sin(2.0 * dSwingX); - p = 0.25 * kSwingX_ * (1.0 - cos(2.0 * dSwingX)); + RealType dSwingX = swingX - swingX0_; + /// RealType dVdswingX = kSwingX_ * 0.5 * sin(2.0 * dSwingX); + /// p = 0.25 * kSwingX_ * (1.0 - cos(2.0 * dSwingX)); + RealType dVdswingX = kSwingX_ * dSwingX; + p = 0.5 * kSwingX_ * dSwingX * dSwingX; pot_ += p; tBody -= dVdswingX * V3X; - restInfo_[rtSwingX] = std::make_pair(swingX, p); + if (printRest_) restInfo_[rtSwingX] = std::make_pair(swingX, p); } if (restType_ & rtSwingY){ - dSwingY = swingY - swingY0_; - dVdswingY = kSwingY_ * 0.5 * sin(2.0 * dSwingY); - p = 0.25 * kSwingY_ * (1.0 - cos(2.0 * dSwingY)); + RealType dSwingY = swingY - swingY0_; + /// RealType dVdswingY = kSwingY_ * 0.5 * sin(2.0 * dSwingY); + /// p = 0.25 * kSwingY_ * (1.0 - cos(2.0 * dSwingY)); + RealType dVdswingY = kSwingY_ * dSwingY; + p = 0.5 * kSwingX_ * dSwingY * dSwingY; pot_ += p; tBody -= dVdswingY * V3Y; - restInfo_[rtSwingY] = std::make_pair(swingY, p); + if (printRest_) restInfo_[rtSwingY] = std::make_pair(swingY, p); } Vector3d tLab = A.transpose() * tBody;