ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/restraints/ObjectRestraint.cpp
(Generate patch)

Comparing trunk/src/restraints/ObjectRestraint.cpp (file contents):
Revision 2020 by gezelter, Mon Sep 22 19:18:35 2014 UTC vs.
Revision 2069 by gezelter, Thu Mar 5 16:30:23 2015 UTC

# Line 69 | Line 69 | namespace OpenMD {
69        Vector3d tBody(0.0);
70        
71        RotMat3x3d temp = A * refA_.transpose();
72
72        Quat4d quat = temp.toQuaternion();
73  
74        RealType twistAngle;
# Line 78 | Line 77 | namespace OpenMD {
77        
78        quat.toSwingTwist(swingX, swingY, twistAngle);
79  
80 +
81        RealType p;
82        Vector3d tTwist, tSwing;
83  
84        if (restType_ & rtTwist){
85 <        RealType dTwist = twistAngle - twist0_;
86 <        RealType dVdtwist = kTwist_ * sin(dTwist);
87 <        p = kTwist_ * (1.0 - cos(dTwist) );
85 >        RealType dTwist = twistAngle - twist0_;      
86 >        /// RealType dVdtwist = kTwist_ * sin(dTwist);
87 >        /// p = kTwist_ * (1.0 - cos(dTwist) );
88 >        RealType dVdtwist = kTwist_ * dTwist;
89 >        p = 0.5 * kTwist_ * dTwist * dTwist;
90          pot_ += p;
91          tBody -= dVdtwist * V3Z;
92          if (printRest_) restInfo_[rtTwist] = std::make_pair(twistAngle, p);
# Line 92 | Line 94 | namespace OpenMD {
94  
95        if (restType_ & rtSwingX){
96          RealType dSwingX = swingX - swingX0_;
97 <        RealType dVdswingX = kSwingX_ * 0.5 * sin(2.0 * dSwingX);
98 <        p = 0.25 * kSwingX_ * (1.0 - cos(2.0 * dSwingX));
97 >        /// RealType dVdswingX = kSwingX_ * 0.5 * sin(2.0 * dSwingX);
98 >        /// p = 0.25 * kSwingX_ * (1.0 - cos(2.0 * dSwingX));
99 >        RealType dVdswingX = kSwingX_ * dSwingX;        
100 >        p = 0.5 * kSwingX_ * dSwingX * dSwingX;
101          pot_ += p;
102          tBody -= dVdswingX * V3X;
103          if (printRest_) restInfo_[rtSwingX] = std::make_pair(swingX, p);
# Line 101 | Line 105 | namespace OpenMD {
105  
106        if (restType_ & rtSwingY){
107          RealType dSwingY = swingY - swingY0_;
108 <        RealType dVdswingY = kSwingY_ * 0.5 * sin(2.0 * dSwingY);
109 <        p = 0.25 * kSwingY_ * (1.0 - cos(2.0 * dSwingY));
108 >        /// RealType dVdswingY = kSwingY_ * 0.5 * sin(2.0 * dSwingY);
109 >        /// p = 0.25 * kSwingY_ * (1.0 - cos(2.0 * dSwingY));
110 >        RealType dVdswingY = kSwingY_ * dSwingY;        
111 >        p = 0.5 * kSwingX_ * dSwingY * dSwingY;
112          pot_ += p;
113          tBody -= dVdswingY * V3Y;
114          if (printRest_) restInfo_[rtSwingY] = std::make_pair(swingY, p);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines