diff --git a/src/fix_restrain.cpp b/src/fix_restrain.cpp
index af11136d78d666851d4f446dac505ed526409632..a949d1f6d58fcd2a4b2921b34502de3013fe1602 100644
--- a/src/fix_restrain.cpp
+++ b/src/fix_restrain.cpp
@@ -261,7 +261,7 @@ void FixRestrain::restrain_bond(int m)
   if (r > 0.0) fbond = -2.0*rk/r;
   else fbond = 0.0;
 
-  energy = rk*dr;
+  energy += rk*dr;
 
   // apply force to each of 2 atoms
 
@@ -368,7 +368,7 @@ void FixRestrain::restrain_angle(int m)
   dtheta = acos(c) - target[m];
   tk = k * dtheta;
 
-  energy = tk*dtheta;
+  energy += tk*dtheta;
 
   a = -2.0 * tk * s;
   a11 = a*c / rsq1;
@@ -549,7 +549,7 @@ void FixRestrain::restrain_dihedral(int m)
   df1 *= -mult;
   p += 1.0;
 
-  energy = k * p;
+  energy += k * p;
 
   fg = vb1x*vb2xm + vb1y*vb2ym + vb1z*vb2zm;
   hg = vb3x*vb2xm + vb3y*vb2ym + vb3z*vb2zm;