Commit 5310d81c by Francois Gygi

Fix discontinuity in torsion constraint function

parent ee9efe55
...@@ -348,7 +348,11 @@ double TorsionConstraint::sigma(D3vector a, D3vector b, ...@@ -348,7 +348,11 @@ double TorsionConstraint::sigma(D3vector a, D3vector b,
D3vector c, D3vector d) const D3vector c, D3vector d) const
{ {
// compute the constraint function // compute the constraint function
return torsion_angle(a,b,c,d) - angle_; double delta = torsion_angle(a,b,c,d) - angle_;
// account for discontinuity at +/- 180 deg
if ( delta > 180.0 ) delta -= 360.0;
if ( delta < -180.0 ) delta += 360.0;
return delta;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment