Skip to content
Snippets Groups Projects
Commit 26d22a4b authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

restrain energy must be incremented. bugfix from robert meissner posted to lammps-users

parent 6f9a2245
No related branches found
No related tags found
No related merge requests found
...@@ -261,7 +261,7 @@ void FixRestrain::restrain_bond(int m) ...@@ -261,7 +261,7 @@ void FixRestrain::restrain_bond(int m)
if (r > 0.0) fbond = -2.0*rk/r; if (r > 0.0) fbond = -2.0*rk/r;
else fbond = 0.0; else fbond = 0.0;
energy = rk*dr; energy += rk*dr;
// apply force to each of 2 atoms // apply force to each of 2 atoms
...@@ -368,7 +368,7 @@ void FixRestrain::restrain_angle(int m) ...@@ -368,7 +368,7 @@ void FixRestrain::restrain_angle(int m)
dtheta = acos(c) - target[m]; dtheta = acos(c) - target[m];
tk = k * dtheta; tk = k * dtheta;
energy = tk*dtheta; energy += tk*dtheta;
a = -2.0 * tk * s; a = -2.0 * tk * s;
a11 = a*c / rsq1; a11 = a*c / rsq1;
...@@ -549,7 +549,7 @@ void FixRestrain::restrain_dihedral(int m) ...@@ -549,7 +549,7 @@ void FixRestrain::restrain_dihedral(int m)
df1 *= -mult; df1 *= -mult;
p += 1.0; p += 1.0;
energy = k * p; energy += k * p;
fg = vb1x*vb2xm + vb1y*vb2ym + vb1z*vb2zm; fg = vb1x*vb2xm + vb1y*vb2ym + vb1z*vb2zm;
hg = vb3x*vb2xm + vb3y*vb2ym + vb3z*vb2zm; hg = vb3x*vb2xm + vb3y*vb2ym + vb3z*vb2zm;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment