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

Comparing trunk/src/restraints/MolecularRestraint.cpp (file contents):
Revision 1407 by cli2, Wed Jan 20 16:04:40 2010 UTC vs.
Revision 2069 by gezelter, Thu Mar 5 16:30:23 2015 UTC

# Line 35 | Line 35
35   *                                                                      
36   * [1]  Meineke, et al., J. Comp. Chem. 26, 252-271 (2005).            
37   * [2]  Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006).          
38 < * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008).          
39 < * [4]  Vardeman & Gezelter, in progress (2009).                        
38 > * [3]  Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008).          
39 > * [4]  Kuang & Gezelter,  J. Chem. Phys. 133, 164101 (2010).
40 > * [5]  Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011).
41   */
42  
43   #include "restraints/MolecularRestraint.hpp"
# Line 70 | Line 71 | namespace OpenMD {
71  
72        pot_ += p;
73  
74 <      restInfo_[rtDisplacement] = std::make_pair(r, p);
74 >      if (printRest_) restInfo_[rtDisplacement] = std::make_pair(r, p);
75  
76        for(it = forces_.begin(); it != forces_.end(); ++it)
77          (*it) = -kDisp_ * del * scaleFactor_;
# Line 85 | Line 86 | namespace OpenMD {
86        
87        Mat3x3d R(0.0);
88        
89 <      for (int n = 0; n < struc.size(); n++){
89 >      for (unsigned int n = 0; n < struc.size(); n++){
90  
91          /*
92           * correlation matrix R:  
# Line 134 | Line 135 | namespace OpenMD {
135        RotMat3x3d Atrans = v * w_tr.transpose();
136        RotMat3x3d A = Atrans.transpose();
137  
138 <      Vector3d eularAngles = A.toEulerAngles();
138 <
139 <
140 <      RealType twistAngle, swingAngle;
138 >      RealType twistAngle;
139        Vector3d swingAxis;
140  
141        Quat4d quat = A.toQuaternion();  
142  
143 <      RealType tw, sx, sy, ttw, swingX, swingY;
143 >      RealType swingX, swingY;
144        quat.toSwingTwist(swingX, swingY, twistAngle);
145  
146 <      RealType dVdtwist, dVdswing, dVdswingX, dVdswingY;
147 <      RealType dTwist, dSwing, dSwingX, dSwingY;
146 >      RealType dVdtwist, dVdswingX, dVdswingY;
147 >      RealType dTwist, dSwingX, dSwingY;
148        RealType p;
149  
150        if (restType_ & rtTwist){
151          dTwist = twistAngle - twist0_;
152 <        dVdtwist = kTwist_ * sin(dTwist) ;
153 <        p = kTwist_ * (1.0 - cos(dTwist) ) ;
152 >        /// dVdtwist = kTwist_ * sin(dTwist) ;
153 >        /// p = kTwist_ * (1.0 - cos(dTwist) ) ;
154 >        dVdtwist = kTwist_ * dTwist;
155 >        p = 0.5 * kTwist_ * dTwist * dTwist;
156          pot_ += p;
157          tBody -= dVdtwist * V3Z;
158 <        restInfo_[rtTwist] = std::make_pair(twistAngle, p);
158 >        if (printRest_) restInfo_[rtTwist] = std::make_pair(twistAngle, p);
159        }
160  
161 //       if (restType_ & rtSwing){
162 //         dSwing = swingAngle - swing0_;
163 //         dVdswing = kSwing_ * 2.0 * sin(2.0 * dSwing);
164 //         p = kSwing_ * (1.0 - cos(2.0 * dSwing));
165 //         pot_ += p;
166 //         tBody -= dVdswing * swingAxis;
167 //         restInfo_[rtSwing] = std::make_pair(swingAngle, p);
168 //       }
169
161        if (restType_ & rtSwingX){
162          dSwingX = swingX - swingX0_;
163 <        dVdswingX = kSwingX_ * 2.0 * sin(2.0 * dSwingX);
164 <        p = kSwingX_ * (1.0 - cos(2.0 * dSwingX));
163 >        /// dVdswingX = kSwingX_ * 2.0 * sin(2.0 * dSwingX);
164 >        /// p = kSwingX_ * (1.0 - cos(2.0 * dSwingX));
165 >        dVdswingX = kSwingX_ * dSwingX;        
166 >        p = 0.5 * kSwingX_ * dSwingX * dSwingX;
167          pot_ += p;
168          tBody -= dVdswingX * V3X;
169 <        restInfo_[rtSwingX] = std::make_pair(swingX, p);
169 >        if (printRest_) restInfo_[rtSwingX] = std::make_pair(swingX, p);
170        }
171        if (restType_ & rtSwingY){
172          dSwingY = swingY - swingY0_;
173 <        dVdswingY = kSwingY_ * 2.0 * sin(2.0 * dSwingY);
174 <        p = kSwingY_ * (1.0 - cos(2.0 * dSwingY));
173 >        /// dVdswingY = kSwingY_ * 2.0 * sin(2.0 * dSwingY);
174 >        /// p = kSwingY_ * (1.0 - cos(2.0 * dSwingY));
175 >        dVdswingY = kSwingY_ * dSwingY;        
176 >        p = 0.5 * kSwingX_ * dSwingY * dSwingY;
177          pot_ += p;
178          tBody -= dVdswingY * V3Y;
179 <        restInfo_[rtSwingY] = std::make_pair(swingY, p);
179 >        if (printRest_) restInfo_[rtSwingY] = std::make_pair(swingY, p);
180        }
181  
182              
# Line 189 | Line 184 | namespace OpenMD {
184        
185        Vector3d rLab, rBody, txr, fBody, fLab;
186  
187 <      for (int i = 0; i < struc.size(); i++) {
187 >      for (unsigned int i = 0; i < struc.size(); i++) {
188                    
189          rLab = struc[i];        
190          rBody = A * rLab;

Comparing trunk/src/restraints/MolecularRestraint.cpp (property svn:keywords):
Revision 1407 by cli2, Wed Jan 20 16:04:40 2010 UTC vs.
Revision 2069 by gezelter, Thu Mar 5 16:30:23 2015 UTC

# Line 0 | Line 1
1 + Author Id Revision Date

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines