ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-2.0/src/types/CharmmTorsionType.cpp
(Generate patch)

Comparing trunk/OOPSE-2.0/src/types/CharmmTorsionType.cpp (file contents):
Revision 1937 by tim, Thu Jan 13 19:40:37 2005 UTC vs.
Revision 2204 by gezelter, Fri Apr 15 22:04:00 2005 UTC

# Line 1 | Line 1
1 < /*
1 > /*
2   * Copyright (c) 2005 The University of Notre Dame. All Rights Reserved.
3   *
4   * The University of Notre Dame grants you ("Licensee") a
# Line 43 | Line 43 | void CharmmTorsionType::calcForce(double cosPhi, doubl
43   #include "utils/NumericConstant.hpp"
44   namespace oopse {
45  
46 < void CharmmTorsionType::calcForce(double cosPhi, double sinPhi, double& V, double& dVdPhi) {
46 >  void CharmmTorsionType::calcForce(double cosPhi, double sinPhi, double& V, double& dVdPhi) {
47      V = 0;
48      dVdPhi = 0;
49      double phi = -std::atan2(sinPhi, cosPhi);
50      
51      std::vector<CharmmTorsionParameter>::iterator i;
52      for (i = parameter_.begin(); i != parameter_.end(); ++i) {
53 <        double kchi= i->kchi;
54 <        int n = i->n;        
55 <        double delta = i->delta;
53 >      double kchi= i->kchi;
54 >      int n = i->n;        
55 >      double delta = i->delta;
56  
57 <        if (n == 0) {
58 <            //if periodicity is equal to 0, use harmonic form
59 <            double diff = phi - delta;
57 >      if (n == 0) {
58 >        //if periodicity is equal to 0, use harmonic form
59 >        double diff = phi - delta;
60  
61 <            if (diff < -NumericConstant::PI) {
62 <                diff += NumericConstant::TWO_PI;
63 <            } else if (diff > NumericConstant::PI) {
64 <                diff -= NumericConstant::TWO_PI;
65 <            }
61 >        if (diff < -NumericConstant::PI) {
62 >          diff += NumericConstant::TWO_PI;
63 >        } else if (diff > NumericConstant::PI) {
64 >          diff -= NumericConstant::TWO_PI;
65 >        }
66              
67 <            V += kchi * diff * diff;
68 <            dVdPhi += 2.0 * kchi * diff;
67 >        V += kchi * diff * diff;
68 >        dVdPhi += 2.0 * kchi * diff;
69  
70 <        } else {
71 <            //use normal cos form if periodicity is greater than 0
72 <            V += kchi * (1 + std::cos(n * phi + delta));
73 <            dVdPhi += -n * kchi * std::sin(n * phi + delta);
74 <        }
70 >      } else {
71 >        //use normal cos form if periodicity is greater than 0
72 >        V += kchi * (1 + std::cos(n * phi + delta));
73 >        dVdPhi += -n * kchi * std::sin(n * phi + delta);
74 >      }
75      }
76 < }
76 >  }
77  
78   } //end namespace oopse

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines