From 63c1ffd605c730c8d7c0b991d31f822834b62667 Mon Sep 17 00:00:00 2001 From: charlie sievers Date: Mon, 7 Oct 2019 19:41:17 -0700 Subject: [PATCH 1/2] Clean up langevin gjf documentation, fixed potential langevin gjf bugs --- src/fix_langevin.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/fix_langevin.cpp b/src/fix_langevin.cpp index f805fddb4b..c12cdbaa26 100644 --- a/src/fix_langevin.cpp +++ b/src/fix_langevin.cpp @@ -240,7 +240,7 @@ void FixLangevin::init() if (strcmp(id,modify->fix[i]->id) == 0) before = 0; else if ((modify->fmask[i] && utils::strmatch(modify->fix[i]->style,"^nve")) && before) flag = 1; } - if (flag && comm->me == 0) + if (flag) error->all(FLERR,"Fix langevin gjf should come before fix nve"); } @@ -295,12 +295,12 @@ void FixLangevin::init() gfactor1[i] = -atom->mass[i] / t_period / force->ftm2v; if (gjfflag) gfactor2[i] = sqrt(atom->mass[i]) * - sqrt(2.0*force->boltz/t_period/update->dt/force->mvv2e) / - force->ftm2v; + sqrt(2.0*force->boltz/t_period/update->dt/force->mvv2e) / + force->ftm2v; else gfactor2[i] = sqrt(atom->mass[i]) * - sqrt(24.0*force->boltz/t_period/update->dt/force->mvv2e) / - force->ftm2v; + sqrt(24.0*force->boltz/t_period/update->dt/force->mvv2e) / + force->ftm2v; gfactor1[i] *= 1.0/ratio[i]; gfactor2[i] *= 1.0/sqrt(ratio[i]); } @@ -1007,12 +1007,21 @@ void FixLangevin::reset_dt() { if (atom->mass) { for (int i = 1; i <= atom->ntypes; i++) { - gfactor2[i] = sqrt(atom->mass[i]) * - sqrt(24.0*force->boltz/t_period/update->dt/force->mvv2e) / - force->ftm2v; + if (gjfflag) + gfactor2[i] = sqrt(atom->mass[i]) * + sqrt(2.0*force->boltz/t_period/update->dt/force->mvv2e) / + force->ftm2v; + else + gfactor2[i] = sqrt(atom->mass[i]) * + sqrt(24.0*force->boltz/t_period/update->dt/force->mvv2e) / + force->ftm2v; gfactor2[i] *= 1.0/sqrt(ratio[i]); } } + if (gjfflag) { + gjfa = (1.0-update->dt/2.0/t_period)/(1.0+update->dt/2.0/t_period); + gjfsib = sqrt(1.0+update->dt/2.0/t_period); + } } /* ---------------------------------------------------------------------- */ From 9b15f4e2dc4efb25730aff73e0d7ec453070e56c Mon Sep 17 00:00:00 2001 From: charlie sievers Date: Tue, 8 Oct 2019 12:47:30 -0700 Subject: [PATCH 2/2] Added the change to langevin gjf documentation --- doc/src/fix_langevin.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/src/fix_langevin.txt b/doc/src/fix_langevin.txt index 07d8b274aa..49ecf96ff6 100644 --- a/doc/src/fix_langevin.txt +++ b/doc/src/fix_langevin.txt @@ -246,11 +246,11 @@ velocity given in "Gronbech-Jensen/Farago"_#Gronbech-Jensen; this velocity is shown to be systematically lower than the target temperature by a small amount, which grows quadratically with the timestep. The {gjf} option {vhalf} outputs the 2GJ half-step velocity given in -"Gronbech Jensen/Gronbech-Jensen"_#2Gronbech-Jensen; this velocity is shown -to not have any linear statistical errors for any stable time step. +"Gronbech Jensen/Gronbech-Jensen"_#2Gronbech-Jensen; for linear systems, +this velocity is shown to not have any statistical errors for any stable time step. An overview of statistically correct Boltzmann and Maxwell-Boltzmann sampling of true on-site and true half-step velocities is given in -"Gronbech-Jensen_#1Gronbech-Jensen. +"Gronbech-Jensen"_#1Gronbech-Jensen. Regardless of the choice of output velocity, the sampling of the configurational distribution of atom positions is the same, and linearly consistent with the target temperature.