diff --git a/doc/fix_momentum.html b/doc/fix_momentum.html index 6069793306..c18b2d3547 100644 --- a/doc/fix_momentum.html +++ b/doc/fix_momentum.html @@ -19,7 +19,8 @@
  • momentum = style name of this fix command -
  • one or more keyword/value pairs may be appended to the args +
  • N = adjust the momentum every this many timesteps +one or more keyword/value pairs may be appended to the args
  • keyword = linear or angular @@ -31,12 +32,14 @@

    Examples:

    -
    fix 1 all momentum 1 linear 1 1 0 angular 
    +
    fix 1 all momentum 1 linear 1 1 0
    +fix 1 all momentum 100 linear 1 1 1 angular 
     

    Description:

    Zero the linear and/or angular momentum of the group of atoms every N -timesteps by adjusting the velocities of the atoms. +timesteps by adjusting the velocities of the atoms. One (or both) of +the linear or angular keywords must be specified.

    If the linear keyword is used, the linear momentum is zeroed by subtracting the center-of-mass velocity of the group from each atom. @@ -53,7 +56,7 @@ to random perturbations (e.g. fix langevin thermostatting).

    Note that the velocity command can be used to create -velocities with zero aggregate linear and/or angular momentum. +initial velocities with zero aggregate linear and/or angular momentum.

    Restrictions: none

    diff --git a/doc/fix_momentum.txt b/doc/fix_momentum.txt index a6a6cae957..8e55236025 100644 --- a/doc/fix_momentum.txt +++ b/doc/fix_momentum.txt @@ -14,7 +14,7 @@ fix ID group-ID momentum N keyword values ... :pre ID, group-ID are documented in "fix"_fix.html command :ulb,l momentum = style name of this fix command :l - +N = adjust the momentum every this many timesteps one or more keyword/value pairs may be appended to the args :l keyword = {linear} or {angular} :l {linear} values = xflag yflag zflag @@ -24,12 +24,14 @@ keyword = {linear} or {angular} :l [Examples:] -fix 1 all momentum 1 linear 1 1 0 angular :pre +fix 1 all momentum 1 linear 1 1 0 +fix 1 all momentum 100 linear 1 1 1 angular :pre [Description:] Zero the linear and/or angular momentum of the group of atoms every N -timesteps by adjusting the velocities of the atoms. +timesteps by adjusting the velocities of the atoms. One (or both) of +the {linear} or {angular} keywords must be specified. If the {linear} keyword is used, the linear momentum is zeroed by subtracting the center-of-mass velocity of the group from each atom. @@ -46,7 +48,7 @@ to random perturbations (e.g. "fix langevin"_fix_langevin.html thermostatting). Note that the "velocity"_velocity.html command can be used to create -velocities with zero aggregate linear and/or angular momentum. +initial velocities with zero aggregate linear and/or angular momentum. [Restrictions:] none diff --git a/doc/fix_recenter.html b/doc/fix_recenter.html index 6ee87bcb06..a224eb5c7b 100644 --- a/doc/fix_recenter.html +++ b/doc/fix_recenter.html @@ -33,7 +33,10 @@

    Examples:

    -
    fix 1 all recenter 1 1 1 0 
    +
    fix 1 all recenter 0.0 0.5 0.0 
    +
    +
    fix 1 all recenter INIT INIT NULL
    +fix 1 all recenter INIT 0.0 0.0 units box 
     

    Description:

    diff --git a/doc/fix_recenter.txt b/doc/fix_recenter.txt index 6518942033..721b8cf5dd 100644 --- a/doc/fix_recenter.txt +++ b/doc/fix_recenter.txt @@ -25,7 +25,9 @@ keyword = {shift} or {units} :l [Examples:] -fix 1 all recenter 1 1 1 0 :pre +fix 1 all recenter 0.0 0.5 0.0 :pre +fix 1 all recenter INIT INIT NULL +fix 1 all recenter INIT 0.0 0.0 units box :pre [Description:] diff --git a/src/fix_momentum.cpp b/src/fix_momentum.cpp index c3fc68f602..fab96b9429 100644 --- a/src/fix_momentum.cpp +++ b/src/fix_momentum.cpp @@ -27,7 +27,7 @@ FixMomentum::FixMomentum(int narg, char **arg) : Fix(narg, arg) { - if (narg != 7) error->all("Illegal fix momentum command"); + if (narg < 4) error->all("Illegal fix momentum command"); nevery = atoi(arg[3]); if (nevery <= 0) error->all("Illegal fix momentum command"); diff --git a/src/group.cpp b/src/group.cpp index 606d910969..6850f5b91d 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -699,7 +699,7 @@ void Group::angmom(int igroup, double *cm, double *lmom) dy = (x[i][1] + ybox*yprd) - cm[1]; dz = (x[i][2] + zbox*zprd) - cm[2]; if (mass_require) massone = mass[type[i]]; - massone = rmass[i]; + else massone = rmass[i]; p[0] += massone * (dy*v[i][2] - dz*v[i][1]); p[1] += massone * (dz*v[i][0] - dx*v[i][2]); p[2] += massone * (dx*v[i][1] - dy*v[i][0]); diff --git a/src/pppm.cpp b/src/pppm.cpp index 8f486a58a6..ad47238fdf 100644 --- a/src/pppm.cpp +++ b/src/pppm.cpp @@ -18,6 +18,7 @@ #include "mpi.h" #include "string.h" #include "stdio.h" +#include "stdlib.h" #include "math.h" #include "pppm.h" #include "atom.h"