diff --git a/doc/src/fix_restrain.rst b/doc/src/fix_restrain.rst index 9b9beaa5ac..110b26680d 100644 --- a/doc/src/fix_restrain.rst +++ b/doc/src/fix_restrain.rst @@ -150,16 +150,19 @@ is included in :math:`K`. ---------- -The *lbond* keyword applies a lowerbound bond restraint to the specified atoms +The *lbond* keyword applies a lower bound bond restraint to the specified atoms using the same functional form used by the :doc:`bond_style harmonic ` command if the distance between the atoms is smaller than the equilibrium bond distance and 0 otherwise. The potential associated with the restraint is .. math:: - E = K (r - r_0)^2 if r < r_0 - E = 0 if r >= r_0 + E = K (r - r_0)^2 ,if\;r < r_0 +.. math:: + + E = 0 \qquad\quad\quad ,if\;r \ge r_0 + with the following coefficients: * :math:`K` (energy/distance\^2) diff --git a/src/fix_restrain.cpp b/src/fix_restrain.cpp index 5f65d7069b..a6793a36be 100644 --- a/src/fix_restrain.cpp +++ b/src/fix_restrain.cpp @@ -87,11 +87,11 @@ FixRestrain::FixRestrain(LAMMPS *lmp, int narg, char **arg) : kstop[nrestrain] = force->numeric(FLERR,arg[iarg+4]); deqstart[nrestrain] = force->numeric(FLERR,arg[iarg+5]); if (iarg+6 == narg) { - deqstop[nrestrain] = force->numeric(FLERR,arg[iarg+5]); - iarg += 6; + deqstop[nrestrain] = force->numeric(FLERR,arg[iarg+5]); + iarg += 6; } else { - deqstop[nrestrain] = force->numeric(FLERR,arg[iarg+6]); - iarg += 7; + deqstop[nrestrain] = force->numeric(FLERR,arg[iarg+6]); + iarg += 7; } } else if (strcmp(arg[iarg],"lbound") == 0) { if (iarg+6 > narg) error->all(FLERR,"Illegal fix restrain command"); @@ -102,11 +102,11 @@ FixRestrain::FixRestrain(LAMMPS *lmp, int narg, char **arg) : kstop[nrestrain] = force->numeric(FLERR,arg[iarg+4]); deqstart[nrestrain] = force->numeric(FLERR,arg[iarg+5]); if (iarg+6 == narg) { - deqstop[nrestrain] = force->numeric(FLERR,arg[iarg+5]); - iarg += 6; + deqstop[nrestrain] = force->numeric(FLERR,arg[iarg+5]); + iarg += 6; } else { - deqstop[nrestrain] = force->numeric(FLERR,arg[iarg+6]); - iarg += 7; + deqstop[nrestrain] = force->numeric(FLERR,arg[iarg+6]); + iarg += 7; } } else if (strcmp(arg[iarg],"angle") == 0) { if (iarg+7 > narg) error->all(FLERR,"Illegal fix restrain command");