diff --git a/doc/fix_langevin.txt b/doc/fix_langevin.txt index ed741c804c..30e70d93c5 100644 --- a/doc/fix_langevin.txt +++ b/doc/fix_langevin.txt @@ -217,6 +217,10 @@ the particles. As described below, this energy can then be printed out or added to the potential energy of the system to monitor energy conservation. +IMPORTANT NOTE: this accumulated energy does NOT include kinetic +energy removed by the {zero} flag. LAMMPS will print a warning when +both options are active. + The keyword {zero} can be used to eliminate drift due to the thermostat. Because the random forces on different atoms are independent, they do not sum exactly to zero. As a result, this fix diff --git a/src/fix_langevin.cpp b/src/fix_langevin.cpp index 5a0103a8a8..e8f3290be9 100644 --- a/src/fix_langevin.cpp +++ b/src/fix_langevin.cpp @@ -174,6 +174,8 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) : } } + if (tallyflag && zeroflag && comm->me == 0) + error->warning(FLERR,"Energy tally does not account for 'zero yes'"); } /* ---------------------------------------------------------------------- */ diff --git a/src/fix_langevin.h b/src/fix_langevin.h index ecfca919a5..b736000107 100644 --- a/src/fix_langevin.h +++ b/src/fix_langevin.h @@ -103,6 +103,12 @@ E: Fix langevin period must be > 0.0 The time window for temperature relaxation must be > 0 +W: Energy tally does not account for 'zero yes' + +The energy removed by using the 'zero yes' flag is not accounted +for in the energy tally and thus energy conservation cannot be +monitored in this case. + E: Fix langevin omega requires atom style sphere Self-explanatory.