From 641d496d4b075b9feeb08006af5b08d53fbe864e Mon Sep 17 00:00:00 2001 From: talinke Date: Mon, 7 Apr 2025 17:36:48 -0700 Subject: [PATCH 01/17] Refined keyword options --- src/EXTRA-FIX/fix_langevin_gjf.cpp | 706 +++++++++++++++++++++++++++++ src/EXTRA-FIX/fix_langevin_gjf.h | 85 ++++ 2 files changed, 791 insertions(+) create mode 100644 src/EXTRA-FIX/fix_langevin_gjf.cpp create mode 100644 src/EXTRA-FIX/fix_langevin_gjf.h diff --git a/src/EXTRA-FIX/fix_langevin_gjf.cpp b/src/EXTRA-FIX/fix_langevin_gjf.cpp new file mode 100644 index 0000000000..7f38a4d201 --- /dev/null +++ b/src/EXTRA-FIX/fix_langevin_gjf.cpp @@ -0,0 +1,706 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing authors: Tim Linke & Niels Gronbech-Jensen (UC Davis) +------------------------------------------------------------------------- */ + +#include "fix_langevin.h" + +#include "atom.h" +#include "atom_vec_ellipsoid.h" +#include "comm.h" +#include "compute.h" +#include "error.h" +#include "force.h" +#include "group.h" +#include "input.h" +#include "math_extra.h" +#include "memory.h" +#include "modify.h" +#include "random_mars.h" +#include "respa.h" +#include "update.h" +#include "variable.h" + +#include +#include + +using namespace LAMMPS_NS; +using namespace FixConst; + +enum { NOBIAS, BIAS }; +enum { CONSTANT, EQUAL, ATOM }; + +/* ---------------------------------------------------------------------- */ + +FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg), gjfflag(0), gfactor1(nullptr), gfactor2(nullptr), ratio(nullptr), + tstr(nullptr), flangevin(nullptr), tforce(nullptr), lv(nullptr), id_temp(nullptr), random(nullptr) +{ + if (narg < 8) error->all(FLERR, "Illegal fix langevin/gjf command"); + + time_integrate = 1; + restart_peratom = 1; + // dynamic_group_allow = 1; + // scalar_flag = 1; + // global_freq = 1; + // extscalar = 1; + // ecouple_flag = 1; + nevery = 1; + + if (utils::strmatch(arg[3], "^v_")) { + tstr = utils::strdup(arg[3] + 2); + } else { + t_start = utils::numeric(FLERR, arg[3], false, lmp); + t_target = t_start; + tstyle = CONSTANT; + } + + t_stop = utils::numeric(FLERR, arg[4], false, lmp); + t_period = utils::numeric(FLERR, arg[5], false, lmp); + seed = utils::inumeric(FLERR, arg[6], false, lmp); + + if (t_period <= 0.0) error->all(FLERR, "Fix langevin/gjf period must be > 0.0"); + if (seed <= 0) error->all(FLERR, "Illegal fix langevin/gjf command"); + + // initialize Marsaglia RNG with processor-unique seed + + random = new RanMars(lmp, seed + comm->me); + + // allocate per-type arrays for force prefactors + + // gfactor1 = new double[atom->ntypes + 1]; + // gfactor2 = new double[atom->ntypes + 1]; + // ratio = new double[atom->ntypes + 1]; + int GJmethods = 8 // number of currently implemented GJ methods + + // optional args + + for (int i = 1; i <= atom->ntypes; i++) ratio[i] = 1.0; + osflag = 0; + GJmethod = 0; + + int iarg = 7; + while (iarg < narg) { + if (strcmp(arg[iarg], "vel") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix langevin/gjf command"); + if (strcmp(arg[iarg + 1], "vfull") == 0) { + osflag = 1; + } else if (strcmp(arg[iarg + 1], "vhalf") == 0) { + osflag = 0; + } else + error->all(FLERR, "Illegal fix langevin/gjf command"); + iarg += 2; + } else if (strcmp(arg[iarg], "method") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix langevin/gjf command"); + GJmethod = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); + if (GJmethod <= 0 || GJmethod > GJmethods) error->all(FLERR, "Invalid GJ method choice in langevin/gjf command"); + iarg += 2; + } else + error->all(FLERR, "Illegal fix langevin/gjf command"); + } + + // set temperature = nullptr, user can override via fix_modify if wants bias + + id_temp = nullptr; + temperature = nullptr; + + energy = 0.0; + + // flangevin is unallocated until first call to setup() + // compute_scalar checks for this and returns 0.0 + // if flangevin_allocated is not set + + flangevin = nullptr; + flangevin_allocated = 0; + lv = nullptr; + tforce = nullptr; + maxatom1 = maxatom2 = 0; + + // setup atom-based array for lv + // register with Atom class + // no need to set peratom_flag, b/c data is for internal use only + + + FixLangevin::grow_arrays(atom->nmax); + atom->add_callback(Atom::GROW); + + // initialize lv to zero + + int nlocal = atom->nlocal; + for (int i = 0; i < nlocal; i++) { + lv[i][0] = 0.0; + lv[i][1] = 0.0; + lv[i][2] = 0.0; + } +} + +/* ---------------------------------------------------------------------- */ + +FixLangevin::~FixLangevin() +{ + if (copymode) return; + + delete random; + delete[] tstr; + delete[] gfactor1; + delete[] gfactor2; + delete[] ratio; + delete[] id_temp; + memory->destroy(flangevin); + memory->destroy(tforce); + + memory->destroy(lv); + if (modify->get_fix_by_id(id)) atom->delete_callback(id, Atom::GROW); +} + +/* ---------------------------------------------------------------------- */ + +int FixLangevin::setmask() +{ + int mask = 0; + mask |= INITIAL_INTEGRATE; + mask |= FINAL_INTEGRATE; + mask |= END_OF_STEP; + return mask; +} + +/* ---------------------------------------------------------------------- */ + +void FixLangevin::init() +{ + if (id_temp) { + temperature = modify->get_compute_by_id(id_temp); + if (!temperature) { + error->all(FLERR, "Temperature compute ID {} for fix {} does not exist", id_temp, style); + } else { + if (temperature->tempflag == 0) + error->all(FLERR, "Compute ID {} for fix {} does not compute temperature", id_temp, style); + } + } + // check variable + + if (tstr) { + tvar = input->variable->find(tstr); + if (tvar < 0) error->all(FLERR, "Variable name {} for fix langevin does not exist", tstr); + if (input->variable->equalstyle(tvar)) + tstyle = EQUAL; + else if (input->variable->atomstyle(tvar)) + tstyle = ATOM; + else + error->all(FLERR, "Variable {} for fix langevin is invalid style", tstr); + } + + // set force prefactors + + if (!atom->rmass) { + for (int i = 1; i <= atom->ntypes; i++) { + gfactor1[i] = -atom->mass[i] / t_period / force->ftm2v; + gfactor2[i] = sqrt(atom->mass[i]) / force->ftm2v; + gfactor2[i] *= sqrt(2.0 * update->dt * force->boltz / t_period / force->mvv2e); // gjfflag + } + } + + if (temperature && temperature->tempbias) + tbiasflag = BIAS; + else + tbiasflag = NOBIAS; + + if (utils::strmatch(update->integrate_style, "^respa")) { + nlevels_respa = (static_cast(update->integrate))->nlevels; + if (gjfflag) error->all(FLERR, "Fix langevin gjf and run style respa are not compatible"); + } + + if (gjfflag) { + gjfc2 = (1.0 - update->dt / 2.0 / t_period) / (1.0 + update->dt / 2.0 / t_period); + gjfc1 = 1.0 / (1.0 + update->dt / 2.0 / t_period); + } + + switch (GJmethod) { + case 1: + gjfc2 = (1.0 - update->dt / 2.0 / t_period) / (1.0 + update->dt / 2.0 / t_period); + gjfc1 = 1.0 / (1.0 + update->dt / 2.0 / t_period); + break; + case 2: + // Insert logic for method 2 + break; + case 3: + // Insert logic for method 3 + break; + case 4: + // Insert logic for method 4 + break; + case 5: + // Insert logic for method 5 + break; + case 6: + // Insert logic for method 6 + break; + case 7: + // Insert logic for method 7 + break; + case 8: + // Insert logic for method 8 + break; + default: + error->all(FLERR, "Fix langevin/gjf method not found"); + break; +} +} + +/* ---------------------------------------------------------------------- + integrate position and velocity according to the GJF method + in Grønbech-Jensen, J Stat Phys 191, 137 (2024). The general workflow is + 1. Langevin GJF Initial Integration + 2. Force Update + 3. Langevin GJF Final Integration + 4. Velocity Choice in end_of_step() +------------------------------------------------------------------------- */ + +void FixLangevin::initial_integrate(int /* vflag */) +{ + double gamma1,gamma2; + + double **x = atom->x; + double **v = atom->v; + double **f = atom->f; + double *mass = atom->mass; + double *rmass = atom->rmass; + int *type = atom->type; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + double fran[3]; + + double boltz = force->boltz; + double dt = update->dt; + double mvv2e = force->mvv2e; + double ftm2v = force->ftm2v; + + double dtf = 0.5 * dt * ftm2v; + double dtfm; + double c1sqrt = sqrt(gjfc1); + + // NVE integrates position and velocity according to Eq. 8a, 8b + // This function embeds the GJF formulation into the NVE framework, which corresponds to the GJF case c1=c3. + + //NVE + if (rmass) { + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + dtfm = dtf / rmass[i]; + v[i][0] += dtfm * f[i][0]; + v[i][1] += dtfm * f[i][1]; + v[i][2] += dtfm * f[i][2]; + x[i][0] += dt * v[i][0]; + x[i][1] += dt * v[i][1]; + x[i][2] += dt * v[i][2]; + } + + } else { + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + dtfm = dtf / mass[type[i]]; + v[i][0] += dtfm * f[i][0]; + v[i][1] += dtfm * f[i][1]; + v[i][2] += dtfm * f[i][2]; + x[i][0] += dt * v[i][0]; + x[i][1] += dt * v[i][1]; + x[i][2] += dt * v[i][2]; + } + } + + // The initial NVE integration should always use the on-site velocity. Therefore, a velocity correction + // must be done when using the half-step option. + //---------- + if (!osflag) { + if (rmass) { + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + dtfm = dtf / rmass[i]; + // Undo NVE integration + x[i][0] -= dt * v[i][0]; + x[i][1] -= dt * v[i][1]; + x[i][2] -= dt * v[i][2]; + // Obtain Eq. 24a. lv[][] stores on-site velocity from previous timestep + v[i][0] = lv[i][0] + dtfm * f[i][0]; + v[i][1] = lv[i][1] + dtfm * f[i][1]; + v[i][2] = lv[i][2] + dtfm * f[i][2]; + // Redo NVE integration with correct velocity + x[i][0] += dt * v[i][0]; + x[i][1] += dt * v[i][1]; + x[i][2] += dt * v[i][2]; + } + + } else { + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + dtfm = dtf / mass[type[i]]; + // Undo NVE integration + x[i][0] -= dt * v[i][0]; + x[i][1] -= dt * v[i][1]; + x[i][2] -= dt * v[i][2]; + // Obtain Eq. 24a. lv[][] stores on-site velocity from previous timestep + v[i][0] = lv[i][0] + dtfm * f[i][0]; + v[i][1] = lv[i][1] + dtfm * f[i][1]; + v[i][2] = lv[i][2] + dtfm * f[i][2]; + // Redo NVE integration with correct velocity + x[i][0] += dt * v[i][0]; + x[i][1] += dt * v[i][1]; + x[i][2] += dt * v[i][2]; + } + } + } + //---------- + + compute_target(); + + if (tbiasflag == BIAS) temperature->compute_scalar(); + + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + if (tstyle == ATOM) tsqrt = sqrt(tforce[i]); + if (rmass) { + gamma2 = sqrt(rmass[i]) * sqrt(2.0*dt*boltz/t_period/mvv2e) / ftm2v; + gamma2 *= 1.0/sqrt(ratio[type[i]]) * tsqrt; + } else { + gamma2 = gfactor2[type[i]] * tsqrt; + } + fran[0] = gamma2*random->gaussian(); + fran[1] = gamma2*random->gaussian(); + fran[2] = gamma2*random->gaussian(); + + // NVE integrator delivers Eq. 24a, but also overshoots position integration. Calculate Eq. 24b: + x[i][0] -= 0.5 * dt * v[i][0]; + x[i][1] -= 0.5 * dt * v[i][1]; + x[i][2] -= 0.5 * dt * v[i][2]; + // Calculate Eq. 24c: + if (tbiasflag == BIAS) + temperature->remove_bias(i,v[i]); + if (rmass) { + lv[i][0] = c1sqrt*v[i][0] + ftm2v * (c1sqrt / (2.0 * rmass[i])) * fran[0]; + lv[i][1] = c1sqrt*v[i][1] + ftm2v * (c1sqrt / (2.0 * rmass[i])) * fran[1]; + lv[i][2] = c1sqrt*v[i][2] + ftm2v * (c1sqrt / (2.0 * rmass[i])) * fran[2]; + } else { + lv[i][0] = c1sqrt*v[i][0] + ftm2v * (c1sqrt / (2.0 * mass[type[i]])) * fran[0]; + lv[i][1] = c1sqrt*v[i][1] + ftm2v * (c1sqrt / (2.0 * mass[type[i]])) * fran[1]; + lv[i][2] = c1sqrt*v[i][2] + ftm2v * (c1sqrt / (2.0 * mass[type[i]])) * fran[2]; + } + if (tbiasflag == BIAS) + temperature->restore_bias(i,v[i]); + if (tbiasflag == BIAS) + temperature->restore_bias(i,lv[i]); + + // Calculate Eq. 24d + if (tbiasflag == BIAS) temperature->remove_bias(i, lv[i]); + if (atom->rmass) { + v[i][0] = (gjfc2 / c1sqrt) * lv[i][0] + ftm2v * (0.5 / rmass[i]) * fran[0]; + v[i][1] = (gjfc2 / c1sqrt) * lv[i][1] + ftm2v * (0.5 / rmass[i]) * fran[1]; + v[i][2] = (gjfc2 / c1sqrt) * lv[i][2] + ftm2v * (0.5 / rmass[i]) * fran[2]; + } else { + v[i][0] = (gjfc2 / c1sqrt) * lv[i][0] + ftm2v * (0.5 / mass[type[i]]) * fran[0]; + v[i][1] = (gjfc2 / c1sqrt) * lv[i][1] + ftm2v * (0.5 / mass[type[i]]) * fran[1]; + v[i][2] = (gjfc2 / c1sqrt) * lv[i][2] + ftm2v * (0.5 / mass[type[i]]) * fran[2]; + } + if (tbiasflag == BIAS) temperature->restore_bias(i, lv[i]); + // Calculate Eq. 24e. NVE integrator then calculates Eq. 24f. + x[i][0] += 0.5 * dt * v[i][0]; + x[i][1] += 0.5 * dt * v[i][1]; + x[i][2] += 0.5 * dt * v[i][2]; + } + } +} + +void FixLangevin::final_integrate() +{ + double dtfm; + double dt = update->dt; + double ftm2v = force->ftm2v; + double dtf = 0.5 * dt * ftm2v; + + // update v of atoms in group + + double **v = atom->v; + double **f = atom->f; + double *rmass = atom->rmass; + double *mass = atom->mass; + int *type = atom->type; + int *mask = atom->mask; + int nlocal = atom->nlocal; + if (igroup == atom->firstgroup) nlocal = atom->nfirst; + + if (rmass) { + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + dtfm = dtf / rmass[i]; + v[i][0] += dtfm * f[i][0]; + v[i][1] += dtfm * f[i][1]; + v[i][2] += dtfm * f[i][2]; + } + + } else { + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + dtfm = dtf / mass[type[i]]; + v[i][0] += dtfm * f[i][0]; + v[i][1] += dtfm * f[i][1]; + v[i][2] += dtfm * f[i][2]; + } + } +} + +/* ---------------------------------------------------------------------- + set current t_target and t_sqrt +------------------------------------------------------------------------- */ + +void FixLangevin::compute_target() +{ + int *mask = atom->mask; + int nlocal = atom->nlocal; + + double delta = update->ntimestep - update->beginstep; + if (delta != 0.0) delta /= update->endstep - update->beginstep; + + // if variable temp, evaluate variable, wrap with clear/add + // reallocate tforce array if necessary + + if (tstyle == CONSTANT) { + t_target = t_start + delta * (t_stop-t_start); + tsqrt = sqrt(t_target); + } else { + modify->clearstep_compute(); + if (tstyle == EQUAL) { + t_target = input->variable->compute_equal(tvar); + if (t_target < 0.0) + error->one(FLERR, "Fix langevin variable returned negative temperature"); + tsqrt = sqrt(t_target); + } else { + if (atom->nmax > maxatom2) { + maxatom2 = atom->nmax; + memory->destroy(tforce); + memory->create(tforce,maxatom2,"langevin:tforce"); + } + input->variable->compute_atom(tvar,igroup,tforce,1,0); + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) + if (tforce[i] < 0.0) + error->one(FLERR, "Fix langevin variable returned negative temperature"); + } + modify->addstep_compute(update->ntimestep + 1); + } +} + +/* ---------------------------------------------------------------------- + tally energy transfer to thermal reservoir, select velocity for GJF +------------------------------------------------------------------------- */ + +void FixLangevin::end_of_step() +{ + double **v = atom->v; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + energy_onestep = 0.0; + + if (tallyflag) { + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) + energy_onestep += flangevin[i][0]*v[i][0] + flangevin[i][1]*v[i][1] + + flangevin[i][2]*v[i][2]; + } + + energy += energy_onestep*update->dt; + + // After the NVE integrator delivers 24f, either the on-site or half-step + // velocity is used in remaining simulation tasks, depending on user input + if (gjfflag && !osflag) { + double tmp[3]; + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + // v is Eq. 24f + tmp[0] = v[i][0]; + tmp[1] = v[i][1]; + tmp[2] = v[i][2]; + // Move on with half-step velocity + v[i][0] = lv[i][0]; + v[i][1] = lv[i][1]; + v[i][2] = lv[i][2]; + // store Eq. 24f in lv for next timestep + lv[i][0] = tmp[0]; + lv[i][1] = tmp[1]; + lv[i][2] = tmp[2]; + } + } +} + +// clang-format on +/* ---------------------------------------------------------------------- */ + +void FixLangevin::reset_target(double t_new) +{ + t_target = t_start = t_stop = t_new; +} + +/* ---------------------------------------------------------------------- */ + +void FixLangevin::reset_dt() +{ + if (atom->mass) { + for (int i = 1; i <= atom->ntypes; i++) { + gfactor2[i] = sqrt(atom->mass[i]) / force->ftm2v; + if (gjfflag) + gfactor2[i] *= sqrt(2.0 * update->dt * force->boltz / t_period / force->mvv2e); // sqrt(2*alpha*kT*dt) + else + gfactor2[i] *= sqrt(24.0 * force->boltz / t_period / update->dt / force->mvv2e); + gfactor2[i] *= 1.0 / sqrt(ratio[i]); + } + } + if (gjfflag) { + gjfc2 = (1.0 - update->dt / 2.0 / t_period) / (1.0 + update->dt / 2.0 / t_period); + gjfc1 = 1.0 / (1.0 + update->dt / 2.0 / t_period); + } +} + +/* ---------------------------------------------------------------------- */ + +int FixLangevin::modify_param(int narg, char **arg) +{ + if (strcmp(arg[0], "temp") == 0) { + if (narg < 2) utils::missing_cmd_args(FLERR, "fix_modify", error); + delete[] id_temp; + id_temp = utils::strdup(arg[1]); + temperature = modify->get_compute_by_id(id_temp); + if (!temperature) + error->all(FLERR, "Could not find fix_modify temperature compute ID: {}", id_temp); + + if (temperature->tempflag == 0) + error->all(FLERR, "Fix_modify temperature compute {} does not compute temperature", id_temp); + if (temperature->igroup != igroup && comm->me == 0) + error->warning(FLERR, "Group for fix_modify temp != fix group: {} vs {}", + group->names[igroup], group->names[temperature->igroup]); + return 2; + } + return 0; +} + +/* ---------------------------------------------------------------------- */ + +double FixLangevin::compute_scalar() +{ + if (!tallyflag || !flangevin_allocated) return 0.0; + + // capture the very first energy transfer to thermal reservoir + + double **v = atom->v; + int *mask = atom->mask; + int nlocal = atom->nlocal; + + if (update->ntimestep == update->beginstep) { + energy_onestep = 0.0; + if (!gjfflag) { + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) + energy_onestep += + flangevin[i][0] * v[i][0] + flangevin[i][1] * v[i][1] + flangevin[i][2] * v[i][2]; + energy = 0.5 * energy_onestep * update->dt; + } else { + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + if (tbiasflag) temperature->remove_bias(i, lv[i]); + energy_onestep += + flangevin[i][0] * lv[i][0] + flangevin[i][1] * lv[i][1] + flangevin[i][2] * lv[i][2]; + if (tbiasflag) temperature->restore_bias(i, lv[i]); + } + energy = -0.5 * energy_onestep * update->dt; + } + } + + // convert midstep energy back to previous fullstep energy + + double energy_me = energy - 0.5 * energy_onestep * update->dt; + + double energy_all; + MPI_Allreduce(&energy_me, &energy_all, 1, MPI_DOUBLE, MPI_SUM, world); + return -energy_all; +} + +/* ---------------------------------------------------------------------- + extract thermostat properties +------------------------------------------------------------------------- */ + +void *FixLangevin::extract(const char *str, int &dim) +{ + dim = 0; + if (strcmp(str, "t_target") == 0) { return &t_target; } + return nullptr; +} + +/* ---------------------------------------------------------------------- + memory usage of tally array +------------------------------------------------------------------------- */ + +double FixLangevin::memory_usage() +{ + double bytes = 0.0; + if (gjfflag) bytes += (double) atom->nmax * 3 * sizeof(double); + if (tallyflag || osflag) bytes += (double) atom->nmax * 3 * sizeof(double); + if (tforce) bytes += (double) atom->nmax * sizeof(double); + return bytes; +} + +/* ---------------------------------------------------------------------- + allocate atom-based array for lv +------------------------------------------------------------------------- */ + +void FixLangevin::grow_arrays(int nmax) +{ + memory->grow(lv, nmax, 3, "fix_langevin:lv"); +} + +/* ---------------------------------------------------------------------- + copy values within local atom-based array +------------------------------------------------------------------------- */ + +void FixLangevin::copy_arrays(int i, int j, int /*delflag*/) +{ + lv[j][0] = lv[i][0]; + lv[j][1] = lv[i][1]; + lv[j][2] = lv[i][2]; +} + +/* ---------------------------------------------------------------------- + pack values in local atom-based array for exchange with another proc +------------------------------------------------------------------------- */ + +int FixLangevin::pack_exchange(int i, double *buf) +{ + int n = 0; + buf[n++] = lv[i][0]; + buf[n++] = lv[i][1]; + buf[n++] = lv[i][2]; + return n; +} + +/* ---------------------------------------------------------------------- + unpack values in local atom-based array from exchange with another proc +------------------------------------------------------------------------- */ + +int FixLangevin::unpack_exchange(int nlocal, double *buf) +{ + int n = 0; + lv[nlocal][0] = buf[n++]; + lv[nlocal][1] = buf[n++]; + lv[nlocal][2] = buf[n++]; + return n; +} diff --git a/src/EXTRA-FIX/fix_langevin_gjf.h b/src/EXTRA-FIX/fix_langevin_gjf.h new file mode 100644 index 0000000000..c54772c457 --- /dev/null +++ b/src/EXTRA-FIX/fix_langevin_gjf.h @@ -0,0 +1,85 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef FIX_CLASS +// clang-format off +FixStyle(langevin,FixLangevin); +// clang-format on +#else + +#ifndef LMP_FIX_LANGEVIN_H +#define LMP_FIX_LANGEVIN_H + +#include "fix.h" + +namespace LAMMPS_NS { + +class FixLangevin : public Fix { + public: + FixLangevin(class LAMMPS *, int, char **); + ~FixLangevin() override; + int setmask() override; + void init() override; + void setup(int) override; + void initial_integrate(int) override; + void post_force(int) override; + void post_force_respa(int, int, int) override; + void end_of_step() override; + void reset_target(double) override; + void reset_dt() override; + int modify_param(int, char **) override; + double compute_scalar() override; + double memory_usage() override; + void *extract(const char *, int &) override; + void grow_arrays(int) override; + void copy_arrays(int, int, int) override; + int pack_exchange(int, double *) override; + int unpack_exchange(int, double *) override; + + protected: + int osflag, GJmethod; + int flangevin_allocated; + double t_start, t_stop, t_period, t_target; + double *gfactor1, *gfactor2, *ratio; + double energy, energy_onestep; + double tsqrt; + double gjfc1, gjfc2; + int tstyle, tvar; + char *tstr; + + class AtomVecEllipsoid *avec; + + int maxatom1, maxatom2; + double **flangevin; + double *tforce; + double **lv; //half step velocity + + char *id_temp; + class Compute *temperature; + + int nlevels_respa; + class RanMars *random; + int seed; + + template + void post_force_templated(); + + void omega_thermostat(); + void angmom_thermostat(); + void compute_target(); +}; + +} // namespace LAMMPS_NS + +#endif +#endif From bd6bb3ce1082df0c5e71ef9c8dfb46cfeb8f6875 Mon Sep 17 00:00:00 2001 From: talinke Date: Tue, 8 Apr 2025 17:35:09 -0700 Subject: [PATCH 02/17] Updated integrator, streamlined variables --- src/EXTRA-FIX/fix_langevin_gjf.cpp | 423 ++++++++++------------------- src/EXTRA-FIX/fix_langevin_gjf.h | 25 +- 2 files changed, 155 insertions(+), 293 deletions(-) diff --git a/src/EXTRA-FIX/fix_langevin_gjf.cpp b/src/EXTRA-FIX/fix_langevin_gjf.cpp index 7f38a4d201..59d5cff1c5 100644 --- a/src/EXTRA-FIX/fix_langevin_gjf.cpp +++ b/src/EXTRA-FIX/fix_langevin_gjf.cpp @@ -44,8 +44,8 @@ enum { CONSTANT, EQUAL, ATOM }; /* ---------------------------------------------------------------------- */ -FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), gjfflag(0), gfactor1(nullptr), gfactor2(nullptr), ratio(nullptr), +FixLangevinGJF::FixLangevinGJF(LAMMPS *lmp, int narg, char **arg) : + Fix(lmp, narg, arg), gjfflag(0), tstr(nullptr), flangevin(nullptr), tforce(nullptr), lv(nullptr), id_temp(nullptr), random(nullptr) { if (narg < 8) error->all(FLERR, "Illegal fix langevin/gjf command"); @@ -78,16 +78,10 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) : random = new RanMars(lmp, seed + comm->me); - // allocate per-type arrays for force prefactors - - // gfactor1 = new double[atom->ntypes + 1]; - // gfactor2 = new double[atom->ntypes + 1]; - // ratio = new double[atom->ntypes + 1]; int GJmethods = 8 // number of currently implemented GJ methods // optional args - for (int i = 1; i <= atom->ntypes; i++) ratio[i] = 1.0; osflag = 0; GJmethod = 0; @@ -105,39 +99,28 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) : } else if (strcmp(arg[iarg], "method") == 0) { if (iarg + 2 > narg) error->all(FLERR, "Illegal fix langevin/gjf command"); GJmethod = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); - if (GJmethod <= 0 || GJmethod > GJmethods) error->all(FLERR, "Invalid GJ method choice in langevin/gjf command"); + if (GJmethod < 0 || GJmethod > GJmethods) error->all(FLERR, "Invalid GJ method choice in langevin/gjf command"); iarg += 2; } else error->all(FLERR, "Illegal fix langevin/gjf command"); } // set temperature = nullptr, user can override via fix_modify if wants bias - id_temp = nullptr; temperature = nullptr; - energy = 0.0; - - // flangevin is unallocated until first call to setup() - // compute_scalar checks for this and returns 0.0 - // if flangevin_allocated is not set - - flangevin = nullptr; - flangevin_allocated = 0; lv = nullptr; tforce = nullptr; - maxatom1 = maxatom2 = 0; // setup atom-based array for lv // register with Atom class // no need to set peratom_flag, b/c data is for internal use only - FixLangevin::grow_arrays(atom->nmax); + FixLangevinGJF::grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); // initialize lv to zero - int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { lv[i][0] = 0.0; @@ -148,17 +131,13 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) : /* ---------------------------------------------------------------------- */ -FixLangevin::~FixLangevin() +FixLangevinGJF::~FixLangevinGJF() { if (copymode) return; delete random; delete[] tstr; - delete[] gfactor1; - delete[] gfactor2; - delete[] ratio; delete[] id_temp; - memory->destroy(flangevin); memory->destroy(tforce); memory->destroy(lv); @@ -167,18 +146,18 @@ FixLangevin::~FixLangevin() /* ---------------------------------------------------------------------- */ -int FixLangevin::setmask() +int FixLangevinGJF::setmask() { int mask = 0; mask |= INITIAL_INTEGRATE; mask |= FINAL_INTEGRATE; - mask |= END_OF_STEP; + if (!osflag) mask |= END_OF_STEP; return mask; } /* ---------------------------------------------------------------------- */ -void FixLangevin::init() +void FixLangevinGJF::init() { if (id_temp) { temperature = modify->get_compute_by_id(id_temp); @@ -193,23 +172,13 @@ void FixLangevin::init() if (tstr) { tvar = input->variable->find(tstr); - if (tvar < 0) error->all(FLERR, "Variable name {} for fix langevin does not exist", tstr); + if (tvar < 0) error->all(FLERR, "Variable name {} for fix langevin/gjf does not exist", tstr); if (input->variable->equalstyle(tvar)) tstyle = EQUAL; else if (input->variable->atomstyle(tvar)) tstyle = ATOM; else - error->all(FLERR, "Variable {} for fix langevin is invalid style", tstr); - } - - // set force prefactors - - if (!atom->rmass) { - for (int i = 1; i <= atom->ntypes; i++) { - gfactor1[i] = -atom->mass[i] / t_period / force->ftm2v; - gfactor2[i] = sqrt(atom->mass[i]) / force->ftm2v; - gfactor2[i] *= sqrt(2.0 * update->dt * force->boltz / t_period / force->mvv2e); // gjfflag - } + error->all(FLERR, "Variable {} for fix langevin/gjf is invalid style", tstr); } if (temperature && temperature->tempbias) @@ -219,44 +188,44 @@ void FixLangevin::init() if (utils::strmatch(update->integrate_style, "^respa")) { nlevels_respa = (static_cast(update->integrate))->nlevels; - if (gjfflag) error->all(FLERR, "Fix langevin gjf and run style respa are not compatible"); - } - - if (gjfflag) { - gjfc2 = (1.0 - update->dt / 2.0 / t_period) / (1.0 + update->dt / 2.0 / t_period); - gjfc1 = 1.0 / (1.0 + update->dt / 2.0 / t_period); + error->all(FLERR, "Fix langevin gjf and run style respa are not compatible"); } + // Complete set of thermostats is given in Gronbech-Jensen, Molecular Physics, 118 (2020) switch (GJmethod) { case 1: gjfc2 = (1.0 - update->dt / 2.0 / t_period) / (1.0 + update->dt / 2.0 / t_period); - gjfc1 = 1.0 / (1.0 + update->dt / 2.0 / t_period); break; case 2: - // Insert logic for method 2 + gjfc2 = exp(-update->dt / t_period); break; case 3: - // Insert logic for method 3 + gjfc2 = 1.0 - update->dt / t_period; break; case 4: - // Insert logic for method 4 + gjfc2 = ( sqrt(1.0 + 4.0 * (update->dt / t_period) ) - 1.0 ) / ( 2.0 * update->dt / t_period ); break; case 5: - // Insert logic for method 5 + gjfc2 = 1.0 / (1.0 + update->dt / t_period); break; case 6: - // Insert logic for method 6 + gjfc2 = (1.0 / (1.0 + update->dt / 2.0 / t_period)) * (1.0 / (1.0 + update->dt / 2.0 / t_period)); break; - case 7: - // Insert logic for method 7 + case 7: // provided in Finkelstein (2021) + gjfc2 = 1; // TODO: correct this break; - case 8: - // Insert logic for method 8 + case 8: // provided in Gronbech-Jensen (2024) + gjfc2 = sqrt( (update->dt / t_period)*(update->dt / t_period) + 1.0 ) - update->dt / t_period; + break; + case 0: + gjfc2 = 0.0; break; default: error->all(FLERR, "Fix langevin/gjf method not found"); break; -} + } + gjfc1 = (1.0 + gjfc2) / 2.0; + gjfc3 = (1.0 - gjfc2) * t_period / update->dt; } /* ---------------------------------------------------------------------- @@ -268,10 +237,9 @@ void FixLangevin::init() 4. Velocity Choice in end_of_step() ------------------------------------------------------------------------- */ -void FixLangevin::initial_integrate(int /* vflag */) +void FixLangevinGJF::initial_integrate(int /* vflag */) { - double gamma1,gamma2; - + // This function provides the integration of the GJ formulation 24a-e double **x = atom->x; double **v = atom->v; double **f = atom->f; @@ -290,79 +258,21 @@ void FixLangevin::initial_integrate(int /* vflag */) double dtf = 0.5 * dt * ftm2v; double dtfm; - double c1sqrt = sqrt(gjfc1); - - // NVE integrates position and velocity according to Eq. 8a, 8b - // This function embeds the GJF formulation into the NVE framework, which corresponds to the GJF case c1=c3. + double c1sq = sqrt(gjfc1); + double c3sq = sqrt(gjfc3); + double csq = sqrt(gjfc3 / gjfc1); + double m, beta; - //NVE - if (rmass) { - for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit) { - dtfm = dtf / rmass[i]; - v[i][0] += dtfm * f[i][0]; - v[i][1] += dtfm * f[i][1]; - v[i][2] += dtfm * f[i][2]; - x[i][0] += dt * v[i][0]; - x[i][1] += dt * v[i][1]; - x[i][2] += dt * v[i][2]; - } - - } else { - for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit) { - dtfm = dtf / mass[type[i]]; - v[i][0] += dtfm * f[i][0]; - v[i][1] += dtfm * f[i][1]; - v[i][2] += dtfm * f[i][2]; - x[i][0] += dt * v[i][0]; - x[i][1] += dt * v[i][1]; - x[i][2] += dt * v[i][2]; - } - } - - // The initial NVE integration should always use the on-site velocity. Therefore, a velocity correction - // must be done when using the half-step option. - //---------- + // If user elected vhalf, v needs to be reassigned to onsite velocity for integration if (!osflag) { - if (rmass) { - for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit) { - dtfm = dtf / rmass[i]; - // Undo NVE integration - x[i][0] -= dt * v[i][0]; - x[i][1] -= dt * v[i][1]; - x[i][2] -= dt * v[i][2]; - // Obtain Eq. 24a. lv[][] stores on-site velocity from previous timestep - v[i][0] = lv[i][0] + dtfm * f[i][0]; - v[i][1] = lv[i][1] + dtfm * f[i][1]; - v[i][2] = lv[i][2] + dtfm * f[i][2]; - // Redo NVE integration with correct velocity - x[i][0] += dt * v[i][0]; - x[i][1] += dt * v[i][1]; - x[i][2] += dt * v[i][2]; - } - - } else { - for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit) { - dtfm = dtf / mass[type[i]]; - // Undo NVE integration - x[i][0] -= dt * v[i][0]; - x[i][1] -= dt * v[i][1]; - x[i][2] -= dt * v[i][2]; - // Obtain Eq. 24a. lv[][] stores on-site velocity from previous timestep - v[i][0] = lv[i][0] + dtfm * f[i][0]; - v[i][1] = lv[i][1] + dtfm * f[i][1]; - v[i][2] = lv[i][2] + dtfm * f[i][2]; - // Redo NVE integration with correct velocity - x[i][0] += dt * v[i][0]; - x[i][1] += dt * v[i][1]; - x[i][2] += dt * v[i][2]; - } - } + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + // lv is Eq. 24f from previous time step + v[i][0] = lv[i][0]; + v[i][1] = lv[i][1]; + v[i][2] = lv[i][2]; + } } - //---------- compute_target(); @@ -370,59 +280,58 @@ void FixLangevin::initial_integrate(int /* vflag */) for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { + if (tstyle == ATOM) tsqrt = sqrt(tforce[i]); - if (rmass) { - gamma2 = sqrt(rmass[i]) * sqrt(2.0*dt*boltz/t_period/mvv2e) / ftm2v; - gamma2 *= 1.0/sqrt(ratio[type[i]]) * tsqrt; + if (rmass) { + m = rmass[i]; + beta = tsqrt * sqrt(2.0*dt*rmass[i]*boltz/t_period/mvv2e) / ftm2v; } else { - gamma2 = gfactor2[type[i]] * tsqrt; + m = mass[type[i]]; + beta = tsqrt * sqrt(2.0*dt*atom->mass[i]*boltz/t_period/mvv2e) / ftm2v; } - fran[0] = gamma2*random->gaussian(); - fran[1] = gamma2*random->gaussian(); - fran[2] = gamma2*random->gaussian(); + + fran[0] = beta*random->gaussian(); + fran[1] = beta*random->gaussian(); + fran[2] = beta*random->gaussian(); + + // First integration delivers Eq. 24a and 24b: + dtfm = dtf / m; + v[i][0] += csq * dtfm * f[i][0]; + v[i][1] += csq * dtfm * f[i][1]; + v[i][2] += csq * dtfm * f[i][2]; + x[i][0] += 0.5 * csq * dt * v[i][0]; + x[i][1] += 0.5 * csq * dt * v[i][1]; + x[i][2] += 0.5 * csq * dt * v[i][2]; - // NVE integrator delivers Eq. 24a, but also overshoots position integration. Calculate Eq. 24b: - x[i][0] -= 0.5 * dt * v[i][0]; - x[i][1] -= 0.5 * dt * v[i][1]; - x[i][2] -= 0.5 * dt * v[i][2]; // Calculate Eq. 24c: if (tbiasflag == BIAS) temperature->remove_bias(i,v[i]); - if (rmass) { - lv[i][0] = c1sqrt*v[i][0] + ftm2v * (c1sqrt / (2.0 * rmass[i])) * fran[0]; - lv[i][1] = c1sqrt*v[i][1] + ftm2v * (c1sqrt / (2.0 * rmass[i])) * fran[1]; - lv[i][2] = c1sqrt*v[i][2] + ftm2v * (c1sqrt / (2.0 * rmass[i])) * fran[2]; - } else { - lv[i][0] = c1sqrt*v[i][0] + ftm2v * (c1sqrt / (2.0 * mass[type[i]])) * fran[0]; - lv[i][1] = c1sqrt*v[i][1] + ftm2v * (c1sqrt / (2.0 * mass[type[i]])) * fran[1]; - lv[i][2] = c1sqrt*v[i][2] + ftm2v * (c1sqrt / (2.0 * mass[type[i]])) * fran[2]; - } + lv[i][0] = c1sqrt*v[i][0] + ftm2v * (c3sqrt / (2.0 * m)) * fran[0]; + lv[i][1] = c1sqrt*v[i][1] + ftm2v * (c3sqrt / (2.0 * m)) * fran[1]; + lv[i][2] = c1sqrt*v[i][2] + ftm2v * (c3sqrt / (2.0 * m)) * fran[2]; + if (tbiasflag == BIAS) temperature->restore_bias(i,v[i]); if (tbiasflag == BIAS) temperature->restore_bias(i,lv[i]); // Calculate Eq. 24d - if (tbiasflag == BIAS) temperature->remove_bias(i, lv[i]); - if (atom->rmass) { - v[i][0] = (gjfc2 / c1sqrt) * lv[i][0] + ftm2v * (0.5 / rmass[i]) * fran[0]; - v[i][1] = (gjfc2 / c1sqrt) * lv[i][1] + ftm2v * (0.5 / rmass[i]) * fran[1]; - v[i][2] = (gjfc2 / c1sqrt) * lv[i][2] + ftm2v * (0.5 / rmass[i]) * fran[2]; - } else { - v[i][0] = (gjfc2 / c1sqrt) * lv[i][0] + ftm2v * (0.5 / mass[type[i]]) * fran[0]; - v[i][1] = (gjfc2 / c1sqrt) * lv[i][1] + ftm2v * (0.5 / mass[type[i]]) * fran[1]; - v[i][2] = (gjfc2 / c1sqrt) * lv[i][2] + ftm2v * (0.5 / mass[type[i]]) * fran[2]; - } - if (tbiasflag == BIAS) temperature->restore_bias(i, lv[i]); - // Calculate Eq. 24e. NVE integrator then calculates Eq. 24f. - x[i][0] += 0.5 * dt * v[i][0]; - x[i][1] += 0.5 * dt * v[i][1]; - x[i][2] += 0.5 * dt * v[i][2]; + if (tbiasflag == BIAS) temperature->remove_bias(i, v[i]); + + v[i][0] = (gjfc2 / c1sqrt) * lv[i][0] + ftm2v * csq * (0.5 / m) * fran[0]; + v[i][1] = (gjfc2 / c1sqrt) * lv[i][1] + ftm2v * csq * (0.5 / m) * fran[1]; + v[i][2] = (gjfc2 / c1sqrt) * lv[i][2] + ftm2v * csq * (0.5 / m) * fran[2]; + if (tbiasflag == BIAS) temperature->restore_bias(i, v[i]); + + // Calculate Eq. 24e. Final integrator then calculates Eq. 24f after force update. + x[i][0] += 0.5 * csq * dt * v[i][0]; + x[i][1] += 0.5 * csq * dt * v[i][1]; + x[i][2] += 0.5 * csq * dt * v[i][2]; } } } -void FixLangevin::final_integrate() +void FixLangevinGJF::final_integrate() { double dtfm; double dt = update->dt; @@ -444,18 +353,18 @@ void FixLangevin::final_integrate() for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { dtfm = dtf / rmass[i]; - v[i][0] += dtfm * f[i][0]; - v[i][1] += dtfm * f[i][1]; - v[i][2] += dtfm * f[i][2]; + v[i][0] += csq * dtfm * f[i][0]; + v[i][1] += csq * dtfm * f[i][1]; + v[i][2] += csq * dtfm * f[i][2]; } } else { for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { dtfm = dtf / mass[type[i]]; - v[i][0] += dtfm * f[i][0]; - v[i][1] += dtfm * f[i][1]; - v[i][2] += dtfm * f[i][2]; + v[i][0] += csq * dtfm * f[i][0]; + v[i][1] += csq * dtfm * f[i][1]; + v[i][2] += csq * dtfm * f[i][2]; } } } @@ -464,7 +373,7 @@ void FixLangevin::final_integrate() set current t_target and t_sqrt ------------------------------------------------------------------------- */ -void FixLangevin::compute_target() +void FixLangevinGJF::compute_target() { int *mask = atom->mask; int nlocal = atom->nlocal; @@ -483,7 +392,7 @@ void FixLangevin::compute_target() if (tstyle == EQUAL) { t_target = input->variable->compute_equal(tvar); if (t_target < 0.0) - error->one(FLERR, "Fix langevin variable returned negative temperature"); + error->one(FLERR, "Fix langevin/gjf variable returned negative temperature"); tsqrt = sqrt(t_target); } else { if (atom->nmax > maxatom2) { @@ -495,86 +404,94 @@ void FixLangevin::compute_target() for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) if (tforce[i] < 0.0) - error->one(FLERR, "Fix langevin variable returned negative temperature"); + error->one(FLERR, "Fix langevin/gjf variable returned negative temperature"); } modify->addstep_compute(update->ntimestep + 1); } } /* ---------------------------------------------------------------------- - tally energy transfer to thermal reservoir, select velocity for GJF + select velocity for GJF ------------------------------------------------------------------------- */ -void FixLangevin::end_of_step() +void FixLangevinGJF::end_of_step() { double **v = atom->v; int *mask = atom->mask; int nlocal = atom->nlocal; - energy_onestep = 0.0; - - if (tallyflag) { - for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit) - energy_onestep += flangevin[i][0]*v[i][0] + flangevin[i][1]*v[i][1] + - flangevin[i][2]*v[i][2]; - } - - energy += energy_onestep*update->dt; - - // After the NVE integrator delivers 24f, either the on-site or half-step + // After the final integrator delivers 24f, either the on-site or half-step // velocity is used in remaining simulation tasks, depending on user input - if (gjfflag && !osflag) { - double tmp[3]; - for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit) { - // v is Eq. 24f - tmp[0] = v[i][0]; - tmp[1] = v[i][1]; - tmp[2] = v[i][2]; - // Move on with half-step velocity - v[i][0] = lv[i][0]; - v[i][1] = lv[i][1]; - v[i][2] = lv[i][2]; - // store Eq. 24f in lv for next timestep - lv[i][0] = tmp[0]; - lv[i][1] = tmp[1]; - lv[i][2] = tmp[2]; - } - } + double tmp[3]; + for (int i = 0; i < nlocal; i++) + if (mask[i] & groupbit) { + // v is Eq. 24f + tmp[0] = v[i][0]; + tmp[1] = v[i][1]; + tmp[2] = v[i][2]; + // Move on with half-step velocity + v[i][0] = lv[i][0]; + v[i][1] = lv[i][1]; + v[i][2] = lv[i][2]; + // store Eq. 24f in lv for next timestep + lv[i][0] = tmp[0]; + lv[i][1] = tmp[1]; + lv[i][2] = tmp[2]; + } } // clang-format on /* ---------------------------------------------------------------------- */ -void FixLangevin::reset_target(double t_new) +void FixLangevinGJF::reset_target(double t_new) { t_target = t_start = t_stop = t_new; } /* ---------------------------------------------------------------------- */ -void FixLangevin::reset_dt() +void FixLangevinGJF::reset_dt() { - if (atom->mass) { - for (int i = 1; i <= atom->ntypes; i++) { - gfactor2[i] = sqrt(atom->mass[i]) / force->ftm2v; - if (gjfflag) - gfactor2[i] *= sqrt(2.0 * update->dt * force->boltz / t_period / force->mvv2e); // sqrt(2*alpha*kT*dt) - else - gfactor2[i] *= sqrt(24.0 * force->boltz / t_period / update->dt / force->mvv2e); - gfactor2[i] *= 1.0 / sqrt(ratio[i]); - } - } - if (gjfflag) { - gjfc2 = (1.0 - update->dt / 2.0 / t_period) / (1.0 + update->dt / 2.0 / t_period); - gjfc1 = 1.0 / (1.0 + update->dt / 2.0 / t_period); + // Complete set of thermostats is given in Gronbech-Jensen, Molecular Physics, 118 (2020) + switch (GJmethod) { + case 1: + gjfc2 = (1.0 - update->dt / 2.0 / t_period) / (1.0 + update->dt / 2.0 / t_period); + break; + case 2: + gjfc2 = exp(-update->dt / t_period); + break; + case 3: + gjfc2 = 1.0 - update->dt / t_period; + break; + case 4: + gjfc2 = ( sqrt(1.0 + 4.0 * (update->dt / t_period) ) - 1.0 ) / ( 2.0 * update->dt / t_period ); + break; + case 5: + gjfc2 = 1.0 / (1.0 + update->dt / t_period); + break; + case 6: + gjfc2 = (1.0 / (1.0 + update->dt / 2.0 / t_period)) * (1.0 / (1.0 + update->dt / 2.0 / t_period)); + break; + case 7: // provided in Finkelstein (2021) + gjfc2 = 1; // TODO: correct this + break; + case 8: // provided in Gronbech-Jensen (2024) + gjfc2 = sqrt( (update->dt / t_period)*(update->dt / t_period) + 1.0 ) - update->dt / t_period; + break; + case 0: + gjfc2 = 0.0; + break; + default: + error->all(FLERR, "Fix langevin/gjf method not found"); + break; } + gjfc1 = (1.0 + gjfc2) / 2.0; + gjfc3 = (1.0 - gjfc2) * t_period / update->dt; } /* ---------------------------------------------------------------------- */ -int FixLangevin::modify_param(int narg, char **arg) +int FixLangevinGJF::modify_param(int narg, char **arg) { if (strcmp(arg[0], "temp") == 0) { if (narg < 2) utils::missing_cmd_args(FLERR, "fix_modify", error); @@ -594,52 +511,11 @@ int FixLangevin::modify_param(int narg, char **arg) return 0; } -/* ---------------------------------------------------------------------- */ - -double FixLangevin::compute_scalar() -{ - if (!tallyflag || !flangevin_allocated) return 0.0; - - // capture the very first energy transfer to thermal reservoir - - double **v = atom->v; - int *mask = atom->mask; - int nlocal = atom->nlocal; - - if (update->ntimestep == update->beginstep) { - energy_onestep = 0.0; - if (!gjfflag) { - for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit) - energy_onestep += - flangevin[i][0] * v[i][0] + flangevin[i][1] * v[i][1] + flangevin[i][2] * v[i][2]; - energy = 0.5 * energy_onestep * update->dt; - } else { - for (int i = 0; i < nlocal; i++) - if (mask[i] & groupbit) { - if (tbiasflag) temperature->remove_bias(i, lv[i]); - energy_onestep += - flangevin[i][0] * lv[i][0] + flangevin[i][1] * lv[i][1] + flangevin[i][2] * lv[i][2]; - if (tbiasflag) temperature->restore_bias(i, lv[i]); - } - energy = -0.5 * energy_onestep * update->dt; - } - } - - // convert midstep energy back to previous fullstep energy - - double energy_me = energy - 0.5 * energy_onestep * update->dt; - - double energy_all; - MPI_Allreduce(&energy_me, &energy_all, 1, MPI_DOUBLE, MPI_SUM, world); - return -energy_all; -} - /* ---------------------------------------------------------------------- extract thermostat properties ------------------------------------------------------------------------- */ -void *FixLangevin::extract(const char *str, int &dim) +void *FixLangevinGJF::extract(const char *str, int &dim) { dim = 0; if (strcmp(str, "t_target") == 0) { return &t_target; } @@ -650,11 +526,10 @@ void *FixLangevin::extract(const char *str, int &dim) memory usage of tally array ------------------------------------------------------------------------- */ -double FixLangevin::memory_usage() +double FixLangevinGJF::memory_usage() { double bytes = 0.0; - if (gjfflag) bytes += (double) atom->nmax * 3 * sizeof(double); - if (tallyflag || osflag) bytes += (double) atom->nmax * 3 * sizeof(double); + bytes += (double) atom->nmax * 3 * sizeof(double); if (tforce) bytes += (double) atom->nmax * sizeof(double); return bytes; } @@ -663,16 +538,16 @@ double FixLangevin::memory_usage() allocate atom-based array for lv ------------------------------------------------------------------------- */ -void FixLangevin::grow_arrays(int nmax) +void FixLangevinGJF::grow_arrays(int nmax) { - memory->grow(lv, nmax, 3, "fix_langevin:lv"); + memory->grow(lv, nmax, 3, "fix_langevin_gjf:lv"); } /* ---------------------------------------------------------------------- copy values within local atom-based array ------------------------------------------------------------------------- */ -void FixLangevin::copy_arrays(int i, int j, int /*delflag*/) +void FixLangevinGJF::copy_arrays(int i, int j, int /*delflag*/) { lv[j][0] = lv[i][0]; lv[j][1] = lv[i][1]; @@ -683,7 +558,7 @@ void FixLangevin::copy_arrays(int i, int j, int /*delflag*/) pack values in local atom-based array for exchange with another proc ------------------------------------------------------------------------- */ -int FixLangevin::pack_exchange(int i, double *buf) +int FixLangevinGJF::pack_exchange(int i, double *buf) { int n = 0; buf[n++] = lv[i][0]; @@ -696,7 +571,7 @@ int FixLangevin::pack_exchange(int i, double *buf) unpack values in local atom-based array from exchange with another proc ------------------------------------------------------------------------- */ -int FixLangevin::unpack_exchange(int nlocal, double *buf) +int FixLangevinGJF::unpack_exchange(int nlocal, double *buf) { int n = 0; lv[nlocal][0] = buf[n++]; diff --git a/src/EXTRA-FIX/fix_langevin_gjf.h b/src/EXTRA-FIX/fix_langevin_gjf.h index c54772c457..df6b80e1b7 100644 --- a/src/EXTRA-FIX/fix_langevin_gjf.h +++ b/src/EXTRA-FIX/fix_langevin_gjf.h @@ -24,21 +24,19 @@ FixStyle(langevin,FixLangevin); namespace LAMMPS_NS { -class FixLangevin : public Fix { +class FixLangevinGJF : public Fix { public: - FixLangevin(class LAMMPS *, int, char **); - ~FixLangevin() override; + FixLangevinGJF(class LAMMPS *, int, char **); + ~FixLangevinGJF() override; int setmask() override; void init() override; void setup(int) override; void initial_integrate(int) override; - void post_force(int) override; - void post_force_respa(int, int, int) override; + void final_integrate() override; void end_of_step() override; void reset_target(double) override; void reset_dt() override; int modify_param(int, char **) override; - double compute_scalar() override; double memory_usage() override; void *extract(const char *, int &) override; void grow_arrays(int) override; @@ -48,19 +46,13 @@ class FixLangevin : public Fix { protected: int osflag, GJmethod; - int flangevin_allocated; double t_start, t_stop, t_period, t_target; - double *gfactor1, *gfactor2, *ratio; - double energy, energy_onestep; + double *gfactor2; double tsqrt; - double gjfc1, gjfc2; + double gjfc1, gjfc2, gjfc3; int tstyle, tvar; char *tstr; - class AtomVecEllipsoid *avec; - - int maxatom1, maxatom2; - double **flangevin; double *tforce; double **lv; //half step velocity @@ -71,11 +63,6 @@ class FixLangevin : public Fix { class RanMars *random; int seed; - template - void post_force_templated(); - - void omega_thermostat(); - void angmom_thermostat(); void compute_target(); }; From 4dd8c66390a723accb315d96f5e84bfbdadc4e44 Mon Sep 17 00:00:00 2001 From: talinke Date: Thu, 10 Apr 2025 10:33:08 -0700 Subject: [PATCH 03/17] Updated documentation --- doc/src/Commands_fix.rst | 1 + doc/src/Howto_thermostat.rst | 3 +- doc/src/fix.rst | 1 + doc/src/fix_langevin_gjf.rst | 211 +++++++++++++++++++++++++++++++++++ 4 files changed, 215 insertions(+), 1 deletion(-) create mode 100644 doc/src/fix_langevin_gjf.rst diff --git a/doc/src/Commands_fix.rst b/doc/src/Commands_fix.rst index 35c3804969..58397d7c7e 100644 --- a/doc/src/Commands_fix.rst +++ b/doc/src/Commands_fix.rst @@ -92,6 +92,7 @@ OPT. * :doc:`langevin (k) ` * :doc:`langevin/drude ` * :doc:`langevin/eff ` + * :doc:`langevin/gjf ` * :doc:`langevin/spin ` * :doc:`lb/fluid ` * :doc:`lb/momentum ` diff --git a/doc/src/Howto_thermostat.rst b/doc/src/Howto_thermostat.rst index fe53fff540..6719abfc82 100644 --- a/doc/src/Howto_thermostat.rst +++ b/doc/src/Howto_thermostat.rst @@ -22,6 +22,7 @@ can be invoked via the *dpd/tstat* pair style: * :doc:`fix temp/berendsen ` * :doc:`fix temp/csvr ` * :doc:`fix langevin ` +* :doc:`fix langevin/gjf ` * :doc:`fix temp/rescale ` * :doc:`pair_style dpd/tstat ` @@ -82,7 +83,7 @@ that: .. note:: - Only the nvt fixes perform time integration, meaning they update + Only the nvt and langevin/gjf fixes perform time integration, meaning they update the velocities and positions of particles due to forces and velocities respectively. The other thermostat fixes only adjust velocities; they do NOT perform time integration updates. Thus they should be used in diff --git a/doc/src/fix.rst b/doc/src/fix.rst index 3b1bc4a75c..13a6ad166d 100644 --- a/doc/src/fix.rst +++ b/doc/src/fix.rst @@ -271,6 +271,7 @@ accelerated styles exist. * :doc:`langevin ` - Langevin temperature control * :doc:`langevin/drude ` - Langevin temperature control of Drude oscillators * :doc:`langevin/eff ` - Langevin temperature control for the electron force field model +* :doc:`langevin/gjf ` - statistically correct Langevin temperature control using the GJ methods * :doc:`langevin/spin ` - Langevin temperature control for a spin or spin-lattice system * :doc:`lb/fluid ` - lattice-Boltzmann fluid on a uniform mesh * :doc:`lb/momentum ` - :doc:`fix momentum ` replacement for use with a lattice-Boltzmann fluid diff --git a/doc/src/fix_langevin_gjf.rst b/doc/src/fix_langevin_gjf.rst new file mode 100644 index 0000000000..08e6c1c87b --- /dev/null +++ b/doc/src/fix_langevin_gjf.rst @@ -0,0 +1,211 @@ +.. index:: fix langevin/gjf + +fix langevin/gjf command +======================== + +Syntax +"""""" + +.. code-block:: LAMMPS + + fix ID group-ID langevin/gjf Tstart Tstop damp seed keyword values ... + +* ID, group-ID are documented in :doc:`fix ` command +* langevin/gjf = style name of this fix command +* Tstart,Tstop = desired temperature at start/end of run (temperature units) +* Tstart can be a variable (see below) +* damp = damping parameter (time units) +* seed = random number seed to use for white noise (positive integer) +* zero or more keyword/value pairs may be appended +* keyword = *vel* or *method* + + .. parsed-literal:: + + *vel* value = *vfull* or *vhalf* + *vfull* = use on-site velocity + *vhalf* = use half-step velocity + *method* value = *1-8* + *1-8* = choose one of the many GJ formulations + +Examples +"""""""" + +.. code-block:: LAMMPS + + fix 3 boundary langevin/gjf 10.0 10.0 1.0 699483 + fix 1 all langevin/gjf 10.0 100.0 100.0 48279 vel vfull method 4 + +Description +""""""""""" + +Apply a Langevin thermostat as described in :ref:`(Gronbech-Jensen-2024) ` +to a group of atoms which models an interaction with a background +implicit solvent. As described in the papers cited below, the purpose of this method is to +enable longer timesteps to be used (up to the numerical stability +limit of the integrator), while still producing the correct Boltzmann +distribution of atom positions. + +The current implementation provides the user with the option to output +the velocity in one of two forms: *vfull* or *vhalf*. The option *vfull* outputs the +on-site velocity given in :ref:`Gronbech-Jensen/Farago +`; this velocity is shown to be systematically lower +than the target temperature by a small amount, which grows +quadratically with the timestep. The option *vhalf* outputs the +2GJ half-step velocity given in :ref:`Gronbech Jensen/Gronbech-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 +:ref:`Gronbech-Jensen-2020 `. + +This fix allows the use of any of the GJ methods as listed in :ref:`Gronbech-Jensen-2020 `. +The GJ-VII method is described in :ref:`Finkelstein `. +The implementation follows the splitting form provided in Eqs. (24) and (25) +in :ref:`Gronbech-Jensen-2024 `, including the application +of Gaussian noise values, per the description in +:ref:`Gronbech-Jensen-2023 `. + + +.. note:: + + Unlike the :doc:`fix langevin ` command which performs force + modifications only, this fix performs thermostatting and time integration. + Thus you no longer need a separate time integration fix, like :doc:`fix nve `. + +See the :doc:`Howto thermostat ` page for +a discussion of different ways to compute temperature and perform +thermostatting. + +The desired temperature at each timestep is a ramped value during the +run from *Tstart* to *Tstop*\ . + +*Tstart* can be specified as an equal-style or atom-style +:doc:`variable `. In this case, the *Tstop* setting is +ignored. If the value is a variable, it should be specified as +v_name, where name is the variable name. In this case, the variable +will be evaluated each timestep, and its value used to determine the +target temperature. + +Equal-style variables can specify formulas with various mathematical +functions, and include :doc:`thermo_style ` command +keywords for the simulation box parameters and timestep and elapsed +time. Thus it is easy to specify a time-dependent temperature. + +Atom-style variables can specify the same formulas as equal-style +variables but can also include per-atom values, such as atom +coordinates. Thus it is easy to specify a spatially-dependent +temperature with optional time-dependence as well. + +Like other fixes that perform thermostatting, this fix can be used +with :doc:`compute commands ` that remove a "bias" from the +atom velocities. E.g. to apply the thermostat only to atoms within a +spatial :doc:`region `, or to remove the center-of-mass +velocity from a group of atoms, or to remove the x-component of +velocity from the calculation. + +This is not done by default, but only if the :doc:`fix_modify +` command is used to assign a temperature compute to this +fix that includes such a bias term. See the doc pages for individual +:doc:`compute temp commands ` to determine which ones include +a bias. In this case, the thermostat works in the following manner: +bias is removed from each atom, thermostatting is performed on the +remaining thermal degrees of freedom, and the bias is added back in. + +The *damp* parameter is specified in time units and determines how +rapidly the temperature is relaxed. For example, a value of 100.0 means +to relax the temperature in a timespan of (roughly) 100 time units +(:math:`\tau` or fs or ps - see the :doc:`units ` command). The +damp factor can be thought of as inversely related to the viscosity of +the solvent. I.e. a small relaxation time implies a high-viscosity +solvent and vice versa. See the discussion about :math:`\gamma` and +viscosity in the documentation for the :doc:`fix viscous ` +command for more details. + +The random # *seed* must be a positive integer. A Marsaglia random +number generator is used. Each processor uses the input seed to +generate its own unique seed and its own stream of random numbers. +Thus the dynamics of the system will not be identical on two runs on +different numbers of processors. + +---------- + +The keyword/value option pairs are used in the following ways. + +The keyword *vel* determine which velocity is used to determine +quantities of interest in the simulation. + +The keyword *method* selects one of the eight GJ-methods implemented in LAMMPS. + +*Insert brief explanation for each method* + +---------- + +.. include:: accel_styles.rst + +---------- + +Restart, fix_modify, output, run start/stop, minimize info +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +No information about this fix is written to :doc:`binary restart files `. +For the Bruenger thermostat: Because the state of the random number generator +is not saved in restart files, this means you cannot do "exact" +restarts with this fix, where the simulation continues on the same as +if no restart had taken place. However, in a statistical sense, a +restarted simulation should produce the same behavior. The "exact" restart is +done with either vfull or vhalf velocity output for as long as the choice of +vfull/vhalf is the same for the simulation as it is in the restart file. + +The :doc:`fix_modify ` *temp* option is supported by this +fix. You can use it to assign a temperature :doc:`compute ` +you have defined to this fix which will be used in its thermostatting +procedure, as described above. For consistency, the group used by +this fix and by the compute should be the same. + +This fix can ramp its target temperature over multiple runs, using the +*start* and *stop* keywords of the :doc:`run ` command. See the +:doc:`run ` command for details of how to do this. + +This fix is not invoked during :doc:`energy minimization `. + +Restrictions +"""""""""""" + +This fix is not compatible with run_style respa. + +Related commands +"""""""""""""""" + +:doc:`fix langevin `, :doc:`fix nvt ` + +Default +""""""" + +The option defaults are vel = vhalf, method = 1. + +---------- + +.. _Gronbech-Jensen-2024: + +**(Gronbech-Jensen-2024)** Gronbech-Jensen, J. Stat. Phys. 191, 137 (2024). + +.. _Gronbech-Jensen-Farago: + +**(Gronbech-Jensen/Farago)** Gronbech-Jensen and Farago, Mol Phys, 111, 983 +(2013). + +.. _Gronbech-Jensen-2019: + +**(Gronbech Jensen/Gronbech-Jensen)** Gronbech Jensen and Gronbech-Jensen, Mol Phys, 117, 2511 (2019) + +.. _Gronbech-Jensen-2020: + +**(Gronbech-Jensen-2020)** Gronbech-Jensen, Mol Phys 118, e1662506 (2020). + +.. _Finkelstein: + +**(Finkelstein)** Finkelstein, Cheng, Florin, Seibold, Gronbech-Jensen, J. Chem. Phys., 155, 18 (2021) + +.. _Gronbech-Jensen-2023: + +**(Gronbech-Jensen-2023)** Gronbech-Jensen, J. Stat. Phys. 190, 96 (2023). From 43a7b14b7ceebaaadb01366bf030d711e0ab3003 Mon Sep 17 00:00:00 2001 From: talinke Date: Thu, 10 Apr 2025 12:01:02 -0700 Subject: [PATCH 04/17] New example structure --- doc/src/fix_langevin_gjf.rst | 18 ++- examples/gjf/README | 46 +++++++ examples/gjf/README.md | 13 -- examples/gjf/in.gjf.vfull | 5 +- examples/gjf/in.gjf.vhalf | 5 +- examples/gjf/log.15Oct19.gjf.vfull.g++.1 | 125 ------------------- examples/gjf/log.15Oct19.gjf.vfull.g++.4 | 125 ------------------- examples/gjf/log.15Oct19.gjf.vhalf.g++.1 | 125 ------------------- examples/gjf/log.15Oct19.gjf.vhalf.g++.4 | 125 ------------------- examples/gjf/log.2Apr25.gjf.vfull.g++.1 | 152 +++++++++++++++++++++++ examples/gjf/log.2Apr25.gjf.vfull.g++.4 | 152 +++++++++++++++++++++++ examples/gjf/log.2Apr25.gjf.vhalf.g++.1 | 152 +++++++++++++++++++++++ examples/gjf/log.2Apr25.gjf.vhalf.g++.4 | 152 +++++++++++++++++++++++ src/EXTRA-FIX/fix_langevin_gjf.cpp | 87 +++++++------ src/EXTRA-FIX/fix_langevin_gjf.h | 14 +-- 15 files changed, 713 insertions(+), 583 deletions(-) create mode 100644 examples/gjf/README delete mode 100644 examples/gjf/README.md delete mode 100644 examples/gjf/log.15Oct19.gjf.vfull.g++.1 delete mode 100644 examples/gjf/log.15Oct19.gjf.vfull.g++.4 delete mode 100644 examples/gjf/log.15Oct19.gjf.vhalf.g++.1 delete mode 100644 examples/gjf/log.15Oct19.gjf.vhalf.g++.4 create mode 100644 examples/gjf/log.2Apr25.gjf.vfull.g++.1 create mode 100644 examples/gjf/log.2Apr25.gjf.vfull.g++.4 create mode 100644 examples/gjf/log.2Apr25.gjf.vhalf.g++.1 create mode 100644 examples/gjf/log.2Apr25.gjf.vhalf.g++.4 diff --git a/doc/src/fix_langevin_gjf.rst b/doc/src/fix_langevin_gjf.rst index 08e6c1c87b..e58b4305bd 100644 --- a/doc/src/fix_langevin_gjf.rst +++ b/doc/src/fix_langevin_gjf.rst @@ -107,9 +107,7 @@ This is not done by default, but only if the :doc:`fix_modify ` command is used to assign a temperature compute to this fix that includes such a bias term. See the doc pages for individual :doc:`compute temp commands ` to determine which ones include -a bias. In this case, the thermostat works in the following manner: -bias is removed from each atom, thermostatting is performed on the -remaining thermal degrees of freedom, and the bias is added back in. +a bias. The *damp* parameter is specified in time units and determines how rapidly the temperature is relaxed. For example, a value of 100.0 means @@ -148,13 +146,13 @@ Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" No information about this fix is written to :doc:`binary restart files `. -For the Bruenger thermostat: Because the state of the random number generator -is not saved in restart files, this means you cannot do "exact" -restarts with this fix, where the simulation continues on the same as -if no restart had taken place. However, in a statistical sense, a -restarted simulation should produce the same behavior. The "exact" restart is -done with either vfull or vhalf velocity output for as long as the choice of -vfull/vhalf is the same for the simulation as it is in the restart file. +Because the state of the random number generator is not saved in restart files, +this means you cannot do "exact" restarts with this fix, where the simulation +continues on the same as if no restart had taken place. However, in a +statistical sense, a restarted simulation should produce the same behavior. +The "exact" restart is done with either vfull or vhalf velocity output for as +long as the choice of vfull/vhalf is the same for the simulation as it is in +the restart file. The :doc:`fix_modify ` *temp* option is supported by this fix. You can use it to assign a temperature :doc:`compute ` diff --git a/examples/gjf/README b/examples/gjf/README new file mode 100644 index 0000000000..fdbc843522 --- /dev/null +++ b/examples/gjf/README @@ -0,0 +1,46 @@ +LAMMPS GJ THERMOSTAT EXAMPLE + +Required LAMMPS packages: EXTRA-FIX, MOLECULE, EXTRA-PAIR + +This directory contains the ingredients to run an NVT simulation using the +GJ thermostats. + +Example: + +NP=4 #number of processors +mpirun -np $NP lmp_mpi -in.gjf.vhalf + +Compared to other thermostats, the GJ thermostat allows for larger timesteps +with the correct Boltzmann statistics. A comparison using averaged properties +from this example's input file is shown below. 'X' denotes a failed simulation. + +KINETIC ENERGY (eV) +| Δt || 0.01 | 0.05 | 0.10 | 0.11 | 0.12 | 0.13 | 0.14 | +|==============||========|========|========|========|========|========|========| +| langevin/gjf || 1.112 | 1.108 | 1.114 | 1.118 | 1.111 | 1.133 | 1.168 | +| langevin || 1.113 | 1.125 | 1.121 | 1.135 | 1.152 | X | X | +| nvt || 1.094 | 1.114 | 1.117 | 1.113 | 1.121 | X | X | +|--------------||--------|--------|--------|--------|--------|--------|--------| + +POTENTIAL ENERGY (eV) +| Δt || 0.01 | 0.05 | 0.10 | 0.11 | 0.12 | 0.13 | 0.14 | +|==============||========|========|========|========|========|========|========| +| langevin/gjf || -55.16 | -55.16 | -55.15 | -55.15 | -55.15 | -55.14 | -55.12 | +| langevin || -55.16 | -55.12 | -54.93 | -54.85 | -54.71 | X | X | +| nvt || -55.17 | -55.10 | -54.95 | -54.88 | -54.82 | X | X | +|--------------||--------|--------|--------|--------|--------|--------|--------| + + +Script Commands: +-- +fix nve all nve +fix lang all langevin 10 10 1 26488 +-- +vs +-- +fix noho all nvt temp 10 10 1 +-- +vs +-- +fix lang all langevin/gjf 10 10 1 26488 +-- \ No newline at end of file diff --git a/examples/gjf/README.md b/examples/gjf/README.md deleted file mode 100644 index e6886cb2dd..0000000000 --- a/examples/gjf/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# LAMMPS GJF-2GJ THERMOSTAT EXAMPLE - -## GJF-2GJ THERMOSTAT - -This directory contains the ingredients to run an NVT simulation using the GJF-2GJ thermostat. - -Example: -``` -NP=4 #number of processors -mpirun -np $NP lmp_mpi -in.gjf.vhalf -``` - -## Required LAMMPS packages: MOLECULE package diff --git a/examples/gjf/in.gjf.vfull b/examples/gjf/in.gjf.vfull index 40512ac37a..8512dad837 100644 --- a/examples/gjf/in.gjf.vfull +++ b/examples/gjf/in.gjf.vfull @@ -1,4 +1,4 @@ -# GJF-2GJ thermostat +# GJ thermostat units metal atom_style full @@ -14,8 +14,7 @@ neighbor 1 bin timestep 0.1 -fix lang all langevin 10 10 1 26488 gjf vfull -fix nve all nve +fix lang all langevin/gjf 10 10 1 26488 vel vfull method 4 thermo 200 run 5000 diff --git a/examples/gjf/in.gjf.vhalf b/examples/gjf/in.gjf.vhalf index 63fb8bd467..08b0b45c8c 100644 --- a/examples/gjf/in.gjf.vhalf +++ b/examples/gjf/in.gjf.vhalf @@ -1,4 +1,4 @@ -# GJF-2GJ thermostat +# GJ thermostat units metal atom_style full @@ -14,8 +14,7 @@ neighbor 1 bin timestep 0.1 -fix lang all langevin 10 10 1 26488 gjf vhalf -fix nve all nve +fix lang all langevin/gjf 10 10 1 26488 thermo 200 run 5000 diff --git a/examples/gjf/log.15Oct19.gjf.vfull.g++.1 b/examples/gjf/log.15Oct19.gjf.vfull.g++.1 deleted file mode 100644 index e3e9cce124..0000000000 --- a/examples/gjf/log.15Oct19.gjf.vfull.g++.1 +++ /dev/null @@ -1,125 +0,0 @@ -LAMMPS (19 Sep 2019) - using 1 OpenMP thread(s) per MPI task -# GJF-2GJ thermostat - -units metal -atom_style full - -boundary p p p -read_data argon.lmp - orthogonal box = (0 0 0) to (32.146 32.146 32.146) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 864 atoms - 0 = max # of 1-2 neighbors - 0 = max # of 1-3 neighbors - 0 = max # of 1-4 neighbors - 1 = max # of special neighbors - special bonds CPU = 0.000150019 secs - read_data CPU = 0.001946 secs - -include ff-argon.lmp -############################# -#Atoms types - mass - charge# -############################# -#@ 1 atom types #!THIS LINE IS NECESSARY DON'T SPEND HOURS FINDING THAT OUT!# - -variable Ar equal 1 - -############# -#Atom Masses# -############# - -mass ${Ar} 39.903 -mass 1 39.903 - -########################### -#Pair Potentials - Tersoff# -########################### - -pair_style lj/cubic -pair_coeff * * 0.0102701 3.42 - - -velocity all create 10 2357 mom yes dist gaussian - -neighbor 1 bin - -timestep 0.1 - -fix lang all langevin 10 10 1 26488 gjf vfull -fix nve all nve - -thermo 200 -run 5000 -Neighbor list info ... - update every 1 steps, delay 10 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 6.94072 - ghost atom cutoff = 6.94072 - binsize = 3.47036, bins = 10 10 10 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair lj/cubic, perpetual - attributes: half, newton on - pair build: half/bin/newton - stencil: half/bin/3d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 6.875 | 6.875 | 6.875 Mbytes -Step Temp E_pair E_mol TotEng Press - 0 11.080223 -56.207655 0 -54.97164 37.215524 - 200 8.2588471 -55.073602 0 -54.152316 339.80416 - 400 8.1427292 -55.072244 0 -54.16391 338.91883 - 600 8.7595618 -55.066739 0 -54.089596 344.25426 - 800 8.550633 -55.148315 0 -54.194479 318.9385 - 1000 8.5394337 -55.125709 0 -54.173122 326.59471 - 1200 8.565973 -55.114892 0 -54.159345 328.5193 - 1400 8.2092914 -55.109233 0 -54.193475 329.56161 - 1600 8.209495 -55.138161 0 -54.22238 321.39971 - 1800 8.4039924 -55.13355 0 -54.196072 322.64214 - 2000 8.4548937 -55.062994 0 -54.119838 343.29888 - 2200 8.3775139 -55.13364 0 -54.199116 323.63744 - 2400 8.537332 -55.163702 0 -54.21135 315.62864 - 2600 8.672488 -55.112054 0 -54.144625 330.1106 - 2800 8.3000218 -55.147275 0 -54.221396 318.73112 - 3000 8.3552421 -55.135164 0 -54.203124 323.53075 - 3200 8.4126798 -55.135753 0 -54.197306 321.48817 - 3400 8.4986413 -55.135408 0 -54.187372 323.42951 - 3600 8.38431 -55.103932 0 -54.16865 330.68929 - 3800 8.8262454 -55.103648 0 -54.119067 332.97779 - 4000 7.9658136 -55.120402 0 -54.231803 324.9595 - 4200 8.2265544 -55.129011 0 -54.211327 323.87069 - 4400 8.1253738 -55.153089 0 -54.246691 316.304 - 4600 8.2010823 -55.124053 0 -54.20921 325.98402 - 4800 8.5512149 -55.075877 0 -54.121976 338.30137 - 5000 8.4737659 -55.158604 0 -54.213343 316.22418 -Loop time of 2.73236 on 1 procs for 5000 steps with 864 atoms - -Performance: 15810.507 ns/day, 0.002 hours/ns, 1829.920 timesteps/s -99.7% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 1.4262 | 1.4262 | 1.4262 | 0.0 | 52.20 -Bond | 0.00042836 | 0.00042836 | 0.00042836 | 0.0 | 0.02 -Neigh | 0.12819 | 0.12819 | 0.12819 | 0.0 | 4.69 -Comm | 0.058611 | 0.058611 | 0.058611 | 0.0 | 2.15 -Output | 0.00047283 | 0.00047283 | 0.00047283 | 0.0 | 0.02 -Modify | 1.0924 | 1.0924 | 1.0924 | 0.0 | 39.98 -Other | | 0.02605 | | | 0.95 - -Nlocal: 864 ave 864 max 864 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 1593 ave 1593 max 1593 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 18143 ave 18143 max 18143 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 18143 -Ave neighs/atom = 20.9988 -Ave special neighs/atom = 0 -Neighbor list builds = 158 -Dangerous builds = 5 - - -Total wall time: 0:00:02 diff --git a/examples/gjf/log.15Oct19.gjf.vfull.g++.4 b/examples/gjf/log.15Oct19.gjf.vfull.g++.4 deleted file mode 100644 index 95caed5dc9..0000000000 --- a/examples/gjf/log.15Oct19.gjf.vfull.g++.4 +++ /dev/null @@ -1,125 +0,0 @@ -LAMMPS (19 Sep 2019) - using 1 OpenMP thread(s) per MPI task -# GJF-2GJ thermostat - -units metal -atom_style full - -boundary p p p -read_data argon.lmp - orthogonal box = (0 0 0) to (32.146 32.146 32.146) - 1 by 2 by 2 MPI processor grid - reading atoms ... - 864 atoms - 0 = max # of 1-2 neighbors - 0 = max # of 1-3 neighbors - 0 = max # of 1-4 neighbors - 1 = max # of special neighbors - special bonds CPU = 0.000556268 secs - read_data CPU = 0.003817 secs - -include ff-argon.lmp -############################# -#Atoms types - mass - charge# -############################# -#@ 1 atom types #!THIS LINE IS NECESSARY DON'T SPEND HOURS FINDING THAT OUT!# - -variable Ar equal 1 - -############# -#Atom Masses# -############# - -mass ${Ar} 39.903 -mass 1 39.903 - -########################### -#Pair Potentials - Tersoff# -########################### - -pair_style lj/cubic -pair_coeff * * 0.0102701 3.42 - - -velocity all create 10 2357 mom yes dist gaussian - -neighbor 1 bin - -timestep 0.1 - -fix lang all langevin 10 10 1 26488 gjf vfull -fix nve all nve - -thermo 200 -run 5000 -Neighbor list info ... - update every 1 steps, delay 10 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 6.94072 - ghost atom cutoff = 6.94072 - binsize = 3.47036, bins = 10 10 10 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair lj/cubic, perpetual - attributes: half, newton on - pair build: half/bin/newton - stencil: half/bin/3d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 6.808 | 6.808 | 6.808 Mbytes -Step Temp E_pair E_mol TotEng Press - 0 11.080228 -56.207655 0 -54.971639 37.215541 - 200 8.4818184 -55.127334 0 -54.181174 324.96159 - 400 8.5960916 -55.09236 0 -54.133453 334.83136 - 600 8.1607556 -55.073136 0 -54.162791 339.035 - 800 8.8350489 -55.133382 0 -54.147819 324.48149 - 1000 8.5692704 -55.118463 0 -54.162548 327.26328 - 1200 8.4174147 -55.126297 0 -54.187322 324.4248 - 1400 8.6362603 -55.123075 0 -54.159688 326.7798 - 1600 8.222512 -55.153799 0 -54.236565 317.8147 - 1800 8.324523 -55.116698 0 -54.188085 327.35373 - 2000 7.9615959 -55.155825 0 -54.267697 315.37215 - 2200 8.495968 -55.083943 0 -54.136205 336.67775 - 2400 7.7926986 -55.044816 0 -54.175529 344.87758 - 2600 8.1551351 -55.069404 0 -54.159687 339.60901 - 2800 8.2593599 -55.084151 0 -54.162807 336.54935 - 3000 8.2860869 -55.110296 0 -54.185971 328.99074 - 3200 8.4074534 -55.123576 0 -54.185712 326.06823 - 3400 8.6694364 -55.128925 0 -54.161836 324.67512 - 3600 8.5718984 -55.129861 0 -54.173653 325.20586 - 3800 8.508102 -55.099093 0 -54.150001 333.91437 - 4000 8.2966658 -55.117782 0 -54.192276 327.13516 - 4200 8.7641728 -55.135792 0 -54.158136 324.00844 - 4400 8.8827909 -55.096369 0 -54.10548 335.08467 - 4600 8.7666577 -55.127213 0 -54.149279 326.15539 - 4800 8.6670762 -55.163395 0 -54.19657 316.48383 - 5000 8.1893094 -55.073756 0 -54.160226 337.95271 -Loop time of 0.870594 on 4 procs for 5000 steps with 864 atoms - -Performance: 49621.267 ns/day, 0.000 hours/ns, 5743.202 timesteps/s -96.5% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.33582 | 0.35125 | 0.3724 | 2.3 | 40.35 -Bond | 0.00030267 | 0.00031316 | 0.00033538 | 0.0 | 0.04 -Neigh | 0.034246 | 0.03479 | 0.035904 | 0.4 | 4.00 -Comm | 0.15068 | 0.17419 | 0.19191 | 3.6 | 20.01 -Output | 0.00044776 | 0.00054703 | 0.00083177 | 0.0 | 0.06 -Modify | 0.27679 | 0.28079 | 0.28849 | 0.9 | 32.25 -Other | | 0.02871 | | | 3.30 - -Nlocal: 216 ave 216 max 216 min -Histogram: 4 0 0 0 0 0 0 0 0 0 -Nghost: 888.75 ave 899 max 876 min -Histogram: 1 0 1 0 0 0 0 0 0 2 -Neighs: 4536 ave 4737 max 4335 min -Histogram: 2 0 0 0 0 0 0 0 0 2 - -Total # of neighbors = 18144 -Ave neighs/atom = 21 -Ave special neighs/atom = 0 -Neighbor list builds = 178 -Dangerous builds = 11 - - -Total wall time: 0:00:00 diff --git a/examples/gjf/log.15Oct19.gjf.vhalf.g++.1 b/examples/gjf/log.15Oct19.gjf.vhalf.g++.1 deleted file mode 100644 index a87b20a887..0000000000 --- a/examples/gjf/log.15Oct19.gjf.vhalf.g++.1 +++ /dev/null @@ -1,125 +0,0 @@ -LAMMPS (19 Sep 2019) - using 1 OpenMP thread(s) per MPI task -# GJF-2GJ thermostat - -units metal -atom_style full - -boundary p p p -read_data argon.lmp - orthogonal box = (0 0 0) to (32.146 32.146 32.146) - 1 by 1 by 1 MPI processor grid - reading atoms ... - 864 atoms - 0 = max # of 1-2 neighbors - 0 = max # of 1-3 neighbors - 0 = max # of 1-4 neighbors - 1 = max # of special neighbors - special bonds CPU = 0.000147804 secs - read_data CPU = 0.00194898 secs - -include ff-argon.lmp -############################# -#Atoms types - mass - charge# -############################# -#@ 1 atom types #!THIS LINE IS NECESSARY DON'T SPEND HOURS FINDING THAT OUT!# - -variable Ar equal 1 - -############# -#Atom Masses# -############# - -mass ${Ar} 39.903 -mass 1 39.903 - -########################### -#Pair Potentials - Tersoff# -########################### - -pair_style lj/cubic -pair_coeff * * 0.0102701 3.42 - - -velocity all create 10 2357 mom yes dist gaussian - -neighbor 1 bin - -timestep 0.1 - -fix lang all langevin 10 10 1 26488 gjf vhalf -fix nve all nve - -thermo 200 -run 5000 -Neighbor list info ... - update every 1 steps, delay 10 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 6.94072 - ghost atom cutoff = 6.94072 - binsize = 3.47036, bins = 10 10 10 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair lj/cubic, perpetual - attributes: half, newton on - pair build: half/bin/newton - stencil: half/bin/3d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 6.5 | 6.5 | 6.5 Mbytes -Step Temp E_pair E_mol TotEng Press - 0 11.080223 -56.207655 0 -54.97164 37.215524 - 200 9.8808568 -55.073602 0 -53.971378 345.62207 - 400 9.8712816 -55.072244 0 -53.971088 345.11889 - 600 10.528988 -55.066739 0 -53.892214 350.60093 - 800 10.167171 -55.148315 0 -54.014152 324.73679 - 1000 10.029026 -55.125709 0 -54.006956 331.93766 - 1200 10.194424 -55.114892 0 -53.977688 334.36032 - 1400 9.3473846 -55.109233 0 -54.066518 333.64378 - 1600 9.7774071 -55.138161 0 -54.047477 327.02358 - 1800 9.9814275 -55.13355 0 -54.020107 328.30017 - 2000 10.2515 -55.062994 0 -53.919424 349.74304 - 2200 9.8126922 -55.13364 0 -54.039019 328.78521 - 2400 10.044314 -55.163702 0 -54.043244 321.03397 - 2600 10.543316 -55.112054 0 -53.935932 336.82099 - 2800 9.7874375 -55.147275 0 -54.055472 324.06626 - 3000 9.7703821 -55.135164 0 -54.045263 328.60665 - 3200 10.141958 -55.135753 0 -54.004402 327.69084 - 3400 10.160576 -55.135408 0 -54.00198 329.39063 - 3600 10.044652 -55.103932 0 -53.983436 336.64469 - 3800 10.662403 -55.103648 0 -53.914241 339.56382 - 4000 9.2921047 -55.120402 0 -54.083853 329.71671 - 4200 9.8744553 -55.129011 0 -54.027501 329.78147 - 4400 9.4085964 -55.153089 0 -54.103546 320.90673 - 4600 9.5463801 -55.124053 0 -54.05914 330.80941 - 4800 10.223884 -55.075877 0 -53.935387 344.30099 - 5000 9.6243338 -55.158604 0 -54.084996 320.3511 -Loop time of 2.29551 on 1 procs for 5000 steps with 864 atoms - -Performance: 18819.358 ns/day, 0.001 hours/ns, 2178.166 timesteps/s -99.7% CPU use with 1 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 1.4393 | 1.4393 | 1.4393 | 0.0 | 62.70 -Bond | 0.0004441 | 0.0004441 | 0.0004441 | 0.0 | 0.02 -Neigh | 0.12136 | 0.12136 | 0.12136 | 0.0 | 5.29 -Comm | 0.059342 | 0.059342 | 0.059342 | 0.0 | 2.59 -Output | 0.00046968 | 0.00046968 | 0.00046968 | 0.0 | 0.02 -Modify | 0.64937 | 0.64937 | 0.64937 | 0.0 | 28.29 -Other | | 0.02522 | | | 1.10 - -Nlocal: 864 ave 864 max 864 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Nghost: 1593 ave 1593 max 1593 min -Histogram: 1 0 0 0 0 0 0 0 0 0 -Neighs: 18143 ave 18143 max 18143 min -Histogram: 1 0 0 0 0 0 0 0 0 0 - -Total # of neighbors = 18143 -Ave neighs/atom = 20.9988 -Ave special neighs/atom = 0 -Neighbor list builds = 158 -Dangerous builds = 5 - - -Total wall time: 0:00:02 diff --git a/examples/gjf/log.15Oct19.gjf.vhalf.g++.4 b/examples/gjf/log.15Oct19.gjf.vhalf.g++.4 deleted file mode 100644 index a70a67a89c..0000000000 --- a/examples/gjf/log.15Oct19.gjf.vhalf.g++.4 +++ /dev/null @@ -1,125 +0,0 @@ -LAMMPS (19 Sep 2019) - using 1 OpenMP thread(s) per MPI task -# GJF-2GJ thermostat - -units metal -atom_style full - -boundary p p p -read_data argon.lmp - orthogonal box = (0 0 0) to (32.146 32.146 32.146) - 1 by 2 by 2 MPI processor grid - reading atoms ... - 864 atoms - 0 = max # of 1-2 neighbors - 0 = max # of 1-3 neighbors - 0 = max # of 1-4 neighbors - 1 = max # of special neighbors - special bonds CPU = 0.000315903 secs - read_data CPU = 0.0653752 secs - -include ff-argon.lmp -############################# -#Atoms types - mass - charge# -############################# -#@ 1 atom types #!THIS LINE IS NECESSARY DON'T SPEND HOURS FINDING THAT OUT!# - -variable Ar equal 1 - -############# -#Atom Masses# -############# - -mass ${Ar} 39.903 -mass 1 39.903 - -########################### -#Pair Potentials - Tersoff# -########################### - -pair_style lj/cubic -pair_coeff * * 0.0102701 3.42 - - -velocity all create 10 2357 mom yes dist gaussian - -neighbor 1 bin - -timestep 0.1 - -fix lang all langevin 10 10 1 26488 gjf vhalf -fix nve all nve - -thermo 200 -run 5000 -Neighbor list info ... - update every 1 steps, delay 10 steps, check yes - max neighbors/atom: 2000, page size: 100000 - master list distance cutoff = 6.94072 - ghost atom cutoff = 6.94072 - binsize = 3.47036, bins = 10 10 10 - 1 neighbor lists, perpetual/occasional/extra = 1 0 0 - (1) pair lj/cubic, perpetual - attributes: half, newton on - pair build: half/bin/newton - stencil: half/bin/3d/newton - bin: standard -Per MPI rank memory allocation (min/avg/max) = 6.433 | 6.433 | 6.433 Mbytes -Step Temp E_pair E_mol TotEng Press - 0 11.080228 -56.207655 0 -54.971639 37.215541 - 200 9.8046716 -55.127334 0 -54.033608 329.70647 - 400 10.174622 -55.09236 0 -53.957366 340.49331 - 600 9.9812299 -55.073136 0 -53.959714 345.56477 - 800 10.512874 -55.133382 0 -53.960655 330.4996 - 1000 9.9587885 -55.118463 0 -54.007545 332.24728 - 1200 10.236607 -55.126297 0 -53.984388 330.94998 - 1400 10.134679 -55.123075 0 -53.992537 332.15441 - 1600 9.8934078 -55.153799 0 -54.050174 323.80795 - 1800 10.064966 -55.116698 0 -53.993936 333.59644 - 2000 9.6736107 -55.155825 0 -54.076719 321.5129 - 2200 10.264537 -55.083943 0 -53.938918 343.02135 - 2400 9.5640032 -55.044816 0 -53.977937 351.23099 - 2600 9.6581077 -55.069404 0 -53.992028 344.99996 - 2800 9.9622575 -55.084151 0 -53.972846 342.6574 - 3000 9.8724909 -55.110296 0 -54.009005 334.68094 - 3200 10.032027 -55.123576 0 -54.004488 331.89534 - 3400 10.221132 -55.128925 0 -53.988742 330.24082 - 3600 10.085802 -55.129861 0 -54.004774 330.63601 - 3800 10.098545 -55.099093 0 -53.972585 339.61905 - 4000 10.000257 -55.117782 0 -54.002238 333.24569 - 4200 10.20477 -55.135792 0 -53.997435 329.17565 - 4400 10.545132 -55.096369 0 -53.920044 341.04725 - 4600 10.376108 -55.127213 0 -53.969743 331.92825 - 4800 10.247392 -55.163395 0 -54.020283 322.15219 - 5000 9.7753102 -55.073756 0 -53.983305 343.64146 -Loop time of 1.19785 on 4 procs for 5000 steps with 864 atoms - -Performance: 36064.674 ns/day, 0.001 hours/ns, 4174.152 timesteps/s -88.6% CPU use with 4 MPI tasks x 1 OpenMP threads - -MPI task timing breakdown: -Section | min time | avg time | max time |%varavg| %total ---------------------------------------------------------------- -Pair | 0.36387 | 0.38652 | 0.44086 | 5.1 | 32.27 -Bond | 0.00028847 | 0.00030833 | 0.000338 | 0.0 | 0.03 -Neigh | 0.033934 | 0.034959 | 0.036917 | 0.6 | 2.92 -Comm | 0.39292 | 0.47821 | 0.52198 | 7.3 | 39.92 -Output | 0.00050343 | 0.0012343 | 0.0023338 | 1.9 | 0.10 -Modify | 0.1605 | 0.17963 | 0.19457 | 2.9 | 15.00 -Other | | 0.117 | | | 9.77 - -Nlocal: 216 ave 216 max 216 min -Histogram: 4 0 0 0 0 0 0 0 0 0 -Nghost: 888.75 ave 899 max 876 min -Histogram: 1 0 1 0 0 0 0 0 0 2 -Neighs: 4536 ave 4737 max 4335 min -Histogram: 2 0 0 0 0 0 0 0 0 2 - -Total # of neighbors = 18144 -Ave neighs/atom = 21 -Ave special neighs/atom = 0 -Neighbor list builds = 178 -Dangerous builds = 11 - - -Total wall time: 0:00:01 diff --git a/examples/gjf/log.2Apr25.gjf.vfull.g++.1 b/examples/gjf/log.2Apr25.gjf.vfull.g++.1 new file mode 100644 index 0000000000..a1cb4de702 --- /dev/null +++ b/examples/gjf/log.2Apr25.gjf.vfull.g++.1 @@ -0,0 +1,152 @@ +LAMMPS (2 Apr 2025 - Development - 4dd8c66390-modified) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:99) + using 1 OpenMP thread(s) per MPI task +# GJ thermostat + +units metal +atom_style full + +boundary p p p +read_data argon.lmp +Reading data file ... + orthogonal box = (0 0 0) to (32.146 32.146 32.146) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 864 atoms +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 0 0 + special bond factors coul: 0 0 0 + 0 = max # of 1-2 neighbors + 0 = max # of 1-3 neighbors + 0 = max # of 1-4 neighbors + 1 = max # of special neighbors + special bonds CPU = 0.000 seconds + read_data CPU = 0.007 seconds + +include ff-argon.lmp +############################# +#Atoms types - mass - charge# +############################# +#@ 1 atom types #!THIS LINE IS NECESSARY DON'T SPEND HOURS FINDING THAT OUT!# + +variable Ar equal 1 + +############# +#Atom Masses# +############# + +mass ${Ar} 39.903 +mass 1 39.903 + +########################### +#Pair Potentials - Tersoff# +########################### + +pair_style lj/cubic +pair_coeff * * 0.0102701 3.42 + + +velocity all create 10 2357 mom yes dist gaussian + +neighbor 1 bin + +timestep 0.1 + +fix lang all langevin/gjf 10 10 1 26488 vel vfull method 4 + +thermo 200 +run 5000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- Langevin GJF methods: doi:10.1007/s10955-024-03345-1 + +@Article{gronbech_jensen_2024, +title = {On the Definition of Velocity in Discrete-Time, Stochastic Langevin Simulations}, +volume = {191}, +number = {10}, +url = {https://doi.org/10.1007/s10955-024-03345-1}, +doi = {10.1007/s10955-024-03345-1}, +urldate = {2024-10-22}, +journal = {J. Stat. Phys.}, +author = {Gronbech-Jensen, Niels}, +year = {2024}, +pages = {137} +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 6.9407173 + ghost atom cutoff = 6.9407173 + binsize = 3.4703587, bins = 10 10 10 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cubic, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 6.481 | 6.481 | 6.481 Mbytes + Step Temp E_pair E_mol TotEng Press + 0 10 -56.207652 0 -55.092137 33.341103 + 200 8.3566091 -55.074758 0 -54.142565 340.34804 + 400 8.5550582 -55.098903 0 -54.144573 333.63174 + 600 8.7873675 -55.044559 0 -54.064315 350.7384 + 800 8.7258741 -55.149735 0 -54.17635 318.83613 + 1000 8.3748307 -55.059754 0 -54.125529 343.7989 + 1200 8.6082188 -55.156326 0 -54.196066 316.8728 + 1400 8.9291902 -55.11836 0 -54.122295 328.12488 + 1600 8.3386383 -55.119788 0 -54.189601 325.81369 + 1800 8.0698034 -55.076285 0 -54.176086 338.69767 + 2000 8.5103978 -55.084479 0 -54.135131 338.12197 + 2200 8.3201517 -55.104858 0 -54.176733 329.95905 + 2400 8.7070407 -55.120649 0 -54.149366 328.06488 + 2600 8.4244379 -55.147583 0 -54.207824 321.45013 + 2800 8.7911907 -55.127309 0 -54.146638 325.76049 + 3000 8.250829 -55.1039 0 -54.183508 332.05048 + 3200 8.693979 -55.155552 0 -54.185726 318.29736 + 3400 8.9806023 -55.127303 0 -54.125504 327.48861 + 3600 8.8313967 -55.081076 0 -54.09592 339.16793 + 3800 8.8008688 -55.176748 0 -54.194998 313.08151 + 4000 8.1780418 -55.105368 0 -54.193096 330.04164 + 4200 8.3772045 -55.128813 0 -54.194323 324.29069 + 4400 8.3580983 -55.086979 0 -54.154621 335.63911 + 4600 8.1493124 -55.096648 0 -54.18758 332.51502 + 4800 9.0189389 -55.126828 0 -54.120752 326.36041 + 5000 8.7587383 -55.084993 0 -54.107943 337.17399 +Loop time of 2.34344 on 1 procs for 5000 steps with 864 atoms + +Performance: 18434.456 ns/day, 0.001 hours/ns, 2133.618 timesteps/s, 1.843 Matom-step/s +99.9% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 1.3044 | 1.3044 | 1.3044 | 0.0 | 55.66 +Bond | 0.00055276 | 0.00055276 | 0.00055276 | 0.0 | 0.02 +Neigh | 0.27376 | 0.27376 | 0.27376 | 0.0 | 11.68 +Comm | 0.055077 | 0.055077 | 0.055077 | 0.0 | 2.35 +Output | 0.00055401 | 0.00055401 | 0.00055401 | 0.0 | 0.02 +Modify | 0.68502 | 0.68502 | 0.68502 | 0.0 | 29.23 +Other | | 0.02412 | | | 1.03 + +Nlocal: 864 ave 864 max 864 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1593 ave 1593 max 1593 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 18143 ave 18143 max 18143 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 18143 +Ave neighs/atom = 20.998843 +Ave special neighs/atom = 0 +Neighbor list builds = 257 +Dangerous builds = 0 + + +Total wall time: 0:00:02 diff --git a/examples/gjf/log.2Apr25.gjf.vfull.g++.4 b/examples/gjf/log.2Apr25.gjf.vfull.g++.4 new file mode 100644 index 0000000000..6d9543c087 --- /dev/null +++ b/examples/gjf/log.2Apr25.gjf.vfull.g++.4 @@ -0,0 +1,152 @@ +LAMMPS (2 Apr 2025 - Development - 4dd8c66390-modified) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:99) + using 1 OpenMP thread(s) per MPI task +# GJ thermostat + +units metal +atom_style full + +boundary p p p +read_data argon.lmp +Reading data file ... + orthogonal box = (0 0 0) to (32.146 32.146 32.146) + 1 by 2 by 2 MPI processor grid + reading atoms ... + 864 atoms +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 0 0 + special bond factors coul: 0 0 0 + 0 = max # of 1-2 neighbors + 0 = max # of 1-3 neighbors + 0 = max # of 1-4 neighbors + 1 = max # of special neighbors + special bonds CPU = 0.002 seconds + read_data CPU = 0.014 seconds + +include ff-argon.lmp +############################# +#Atoms types - mass - charge# +############################# +#@ 1 atom types #!THIS LINE IS NECESSARY DON'T SPEND HOURS FINDING THAT OUT!# + +variable Ar equal 1 + +############# +#Atom Masses# +############# + +mass ${Ar} 39.903 +mass 1 39.903 + +########################### +#Pair Potentials - Tersoff# +########################### + +pair_style lj/cubic +pair_coeff * * 0.0102701 3.42 + + +velocity all create 10 2357 mom yes dist gaussian + +neighbor 1 bin + +timestep 0.1 + +fix lang all langevin/gjf 10 10 1 26488 vel vfull method 4 + +thermo 200 +run 5000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- Langevin GJF methods: doi:10.1007/s10955-024-03345-1 + +@Article{gronbech_jensen_2024, +title = {On the Definition of Velocity in Discrete-Time, Stochastic Langevin Simulations}, +volume = {191}, +number = {10}, +url = {https://doi.org/10.1007/s10955-024-03345-1}, +doi = {10.1007/s10955-024-03345-1}, +urldate = {2024-10-22}, +journal = {J. Stat. Phys.}, +author = {Gronbech-Jensen, Niels}, +year = {2024}, +pages = {137} +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 6.9407173 + ghost atom cutoff = 6.9407173 + binsize = 3.4703587, bins = 10 10 10 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cubic, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 6.427 | 6.427 | 6.427 Mbytes + Step Temp E_pair E_mol TotEng Press + 0 10 -56.207652 0 -55.092137 33.341103 + 200 8.3950866 -55.088994 0 -54.15251 334.90536 + 400 8.6408464 -55.090811 0 -54.126912 335.23135 + 600 8.3101447 -55.121286 0 -54.194277 325.43222 + 800 8.5045003 -55.090513 0 -54.141824 335.05857 + 1000 8.7236378 -55.101455 0 -54.12832 331.96596 + 1200 8.7063561 -55.109371 0 -54.138164 331.62683 + 1400 8.7935957 -55.089763 0 -54.108824 336.89842 + 1600 8.454418 -55.105207 0 -54.162104 330.18927 + 1800 8.7989267 -55.142078 0 -54.160544 322.47021 + 2000 8.7823094 -55.153625 0 -54.173945 318.95028 + 2200 8.6201117 -55.11511 0 -54.153524 329.13488 + 2400 9.1165215 -55.161069 0 -54.144107 318.48524 + 2600 8.7636341 -55.142401 0 -54.164805 322.46493 + 2800 8.4876731 -55.111528 0 -54.164715 329.66127 + 3000 8.7005957 -55.149445 0 -54.178881 319.92878 + 3200 8.1711364 -55.137611 0 -54.226108 322.83713 + 3400 8.7172512 -55.143449 0 -54.171026 322.68918 + 3600 8.6262526 -55.1002 0 -54.137928 333.02737 + 3800 8.1680259 -55.166423 0 -54.255267 313.66684 + 4000 8.8340067 -55.121759 0 -54.136312 328.58235 + 4200 8.427926 -55.126903 0 -54.186755 324.95528 + 4400 8.6352614 -55.193826 0 -54.23055 307.14392 + 4600 8.7381405 -55.120503 0 -54.14575 327.73985 + 4800 8.3857194 -55.081944 0 -54.146505 337.38629 + 5000 8.1179517 -55.162247 0 -54.256677 314.50176 +Loop time of 2.08834 on 4 procs for 5000 steps with 864 atoms + +Performance: 20686.324 ns/day, 0.001 hours/ns, 2394.250 timesteps/s, 2.069 Matom-step/s +63.4% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.53532 | 0.5439 | 0.54781 | 0.7 | 26.04 +Bond | 0.0006347 | 0.00066042 | 0.00068198 | 0.0 | 0.03 +Neigh | 0.10879 | 0.11194 | 0.118 | 1.1 | 5.36 +Comm | 0.94935 | 0.96017 | 0.97155 | 0.8 | 45.98 +Output | 0.0060135 | 0.006061 | 0.0061217 | 0.1 | 0.29 +Modify | 0.2483 | 0.24911 | 0.25049 | 0.2 | 11.93 +Other | | 0.2165 | | | 10.37 + +Nlocal: 216 ave 216 max 216 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Nghost: 884.25 ave 892 max 875 min +Histogram: 1 1 0 0 0 0 0 0 0 2 +Neighs: 4535.5 ave 4737 max 4333 min +Histogram: 2 0 0 0 0 0 0 0 0 2 + +Total # of neighbors = 18142 +Ave neighs/atom = 20.997685 +Ave special neighs/atom = 0 +Neighbor list builds = 280 +Dangerous builds = 0 + + +Total wall time: 0:00:02 diff --git a/examples/gjf/log.2Apr25.gjf.vhalf.g++.1 b/examples/gjf/log.2Apr25.gjf.vhalf.g++.1 new file mode 100644 index 0000000000..fed8f271e5 --- /dev/null +++ b/examples/gjf/log.2Apr25.gjf.vhalf.g++.1 @@ -0,0 +1,152 @@ +LAMMPS (2 Apr 2025 - Development - 4dd8c66390-modified) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:99) + using 1 OpenMP thread(s) per MPI task +# GJ thermostat + +units metal +atom_style full + +boundary p p p +read_data argon.lmp +Reading data file ... + orthogonal box = (0 0 0) to (32.146 32.146 32.146) + 1 by 1 by 1 MPI processor grid + reading atoms ... + 864 atoms +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 0 0 + special bond factors coul: 0 0 0 + 0 = max # of 1-2 neighbors + 0 = max # of 1-3 neighbors + 0 = max # of 1-4 neighbors + 1 = max # of special neighbors + special bonds CPU = 0.000 seconds + read_data CPU = 0.008 seconds + +include ff-argon.lmp +############################# +#Atoms types - mass - charge# +############################# +#@ 1 atom types #!THIS LINE IS NECESSARY DON'T SPEND HOURS FINDING THAT OUT!# + +variable Ar equal 1 + +############# +#Atom Masses# +############# + +mass ${Ar} 39.903 +mass 1 39.903 + +########################### +#Pair Potentials - Tersoff# +########################### + +pair_style lj/cubic +pair_coeff * * 0.0102701 3.42 + + +velocity all create 10 2357 mom yes dist gaussian + +neighbor 1 bin + +timestep 0.1 + +fix lang all langevin/gjf 10 10 1 26488 + +thermo 200 +run 5000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- Langevin GJF methods: doi:10.1007/s10955-024-03345-1 + +@Article{gronbech_jensen_2024, +title = {On the Definition of Velocity in Discrete-Time, Stochastic Langevin Simulations}, +volume = {191}, +number = {10}, +url = {https://doi.org/10.1007/s10955-024-03345-1}, +doi = {10.1007/s10955-024-03345-1}, +urldate = {2024-10-22}, +journal = {J. Stat. Phys.}, +author = {Gronbech-Jensen, Niels}, +year = {2024}, +pages = {137} +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 6.9407173 + ghost atom cutoff = 6.9407173 + binsize = 3.4703587, bins = 10 10 10 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cubic, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 6.481 | 6.481 | 6.481 Mbytes + Step Temp E_pair E_mol TotEng Press + 0 10 -56.207652 0 -55.092137 33.341103 + 200 9.8808461 -55.073599 0 -53.971376 345.62224 + 400 9.8712816 -55.072241 0 -53.971084 345.11909 + 600 10.528988 -55.066736 0 -53.892211 350.60112 + 800 10.167171 -55.148312 0 -54.014149 324.73698 + 1000 10.029026 -55.125705 0 -54.006952 331.93785 + 1200 9.8898479 -55.086642 0 -53.983414 342.04309 + 1400 10.610014 -55.076793 0 -53.89323 346.34338 + 1600 9.9402137 -55.111688 0 -54.002842 335.04779 + 1800 9.8078801 -55.140475 0 -54.046391 325.88652 + 2000 10.472791 -55.06102 0 -53.892765 349.97306 + 2200 9.877248 -55.191201 0 -54.089379 312.77421 + 2400 9.9739487 -55.108904 0 -53.996295 335.9089 + 2600 10.131803 -55.149444 0 -54.019226 325.44115 + 2800 9.6980127 -55.118395 0 -54.036568 331.2097 + 3000 9.7193425 -55.149785 0 -54.065577 323.32384 + 3200 10.27638 -55.083302 0 -53.936957 342.56458 + 3400 9.9253941 -55.082368 0 -53.975175 342.28594 + 3600 10.665862 -55.056774 0 -53.866981 352.03551 + 3800 10.011077 -55.084664 0 -53.967913 341.45122 + 4000 9.4182671 -55.128803 0 -54.078181 327.81846 + 4200 10.02466 -55.106046 0 -53.98778 336.56944 + 4400 9.3721033 -55.146068 0 -54.100596 322.38199 + 4600 9.5485537 -55.118577 0 -54.053421 332.04274 + 4800 10.039726 -55.074068 0 -53.954122 344.76817 + 5000 9.7731898 -55.150518 0 -54.060304 322.94195 +Loop time of 2.28614 on 1 procs for 5000 steps with 864 atoms + +Performance: 18896.448 ns/day, 0.001 hours/ns, 2187.089 timesteps/s, 1.890 Matom-step/s +100.0% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 1.2918 | 1.2918 | 1.2918 | 0.0 | 56.51 +Bond | 0.00048345 | 0.00048345 | 0.00048345 | 0.0 | 0.02 +Neigh | 0.2776 | 0.2776 | 0.2776 | 0.0 | 12.14 +Comm | 0.055375 | 0.055375 | 0.055375 | 0.0 | 2.42 +Output | 0.00054609 | 0.00054609 | 0.00054609 | 0.0 | 0.02 +Modify | 0.63625 | 0.63625 | 0.63625 | 0.0 | 27.83 +Other | | 0.02408 | | | 1.05 + +Nlocal: 864 ave 864 max 864 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1593 ave 1593 max 1593 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 18143 ave 18143 max 18143 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 18143 +Ave neighs/atom = 20.998843 +Ave special neighs/atom = 0 +Neighbor list builds = 258 +Dangerous builds = 0 + + +Total wall time: 0:00:02 diff --git a/examples/gjf/log.2Apr25.gjf.vhalf.g++.4 b/examples/gjf/log.2Apr25.gjf.vhalf.g++.4 new file mode 100644 index 0000000000..aa90fb779b --- /dev/null +++ b/examples/gjf/log.2Apr25.gjf.vhalf.g++.4 @@ -0,0 +1,152 @@ +LAMMPS (2 Apr 2025 - Development - 4dd8c66390-modified) +OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:99) + using 1 OpenMP thread(s) per MPI task +# GJ thermostat + +units metal +atom_style full + +boundary p p p +read_data argon.lmp +Reading data file ... + orthogonal box = (0 0 0) to (32.146 32.146 32.146) + 1 by 2 by 2 MPI processor grid + reading atoms ... + 864 atoms +Finding 1-2 1-3 1-4 neighbors ... + special bond factors lj: 0 0 0 + special bond factors coul: 0 0 0 + 0 = max # of 1-2 neighbors + 0 = max # of 1-3 neighbors + 0 = max # of 1-4 neighbors + 1 = max # of special neighbors + special bonds CPU = 0.002 seconds + read_data CPU = 0.014 seconds + +include ff-argon.lmp +############################# +#Atoms types - mass - charge# +############################# +#@ 1 atom types #!THIS LINE IS NECESSARY DON'T SPEND HOURS FINDING THAT OUT!# + +variable Ar equal 1 + +############# +#Atom Masses# +############# + +mass ${Ar} 39.903 +mass 1 39.903 + +########################### +#Pair Potentials - Tersoff# +########################### + +pair_style lj/cubic +pair_coeff * * 0.0102701 3.42 + + +velocity all create 10 2357 mom yes dist gaussian + +neighbor 1 bin + +timestep 0.1 + +fix lang all langevin/gjf 10 10 1 26488 + +thermo 200 +run 5000 + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Your simulation uses code contributions which should be cited: + +- Langevin GJF methods: doi:10.1007/s10955-024-03345-1 + +@Article{gronbech_jensen_2024, +title = {On the Definition of Velocity in Discrete-Time, Stochastic Langevin Simulations}, +volume = {191}, +number = {10}, +url = {https://doi.org/10.1007/s10955-024-03345-1}, +doi = {10.1007/s10955-024-03345-1}, +urldate = {2024-10-22}, +journal = {J. Stat. Phys.}, +author = {Gronbech-Jensen, Niels}, +year = {2024}, +pages = {137} +} + +CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE + +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Neighbor list info ... + update: every = 1 steps, delay = 0 steps, check = yes + max neighbors/atom: 2000, page size: 100000 + master list distance cutoff = 6.9407173 + ghost atom cutoff = 6.9407173 + binsize = 3.4703587, bins = 10 10 10 + 1 neighbor lists, perpetual/occasional/extra = 1 0 0 + (1) pair lj/cubic, perpetual + attributes: half, newton on + pair build: half/bin/newton + stencil: half/bin/3d + bin: standard +Per MPI rank memory allocation (min/avg/max) = 6.427 | 6.427 | 6.427 Mbytes + Step Temp E_pair E_mol TotEng Press + 0 10 -56.207652 0 -55.092137 33.341103 + 200 9.8046819 -55.12733 0 -54.033603 329.70683 + 400 10.174622 -55.092357 0 -53.957363 340.4935 + 600 9.6157634 -55.174205 0 -54.101552 316.68047 + 800 9.9617862 -55.097525 0 -53.986273 339.257 + 1000 10.373198 -55.116484 0 -53.959338 335.09796 + 1200 10.064779 -55.17366 0 -54.050919 318.66487 + 1400 10.562182 -55.067856 0 -53.889628 349.23452 + 1600 9.7696935 -55.081542 0 -53.991718 342.92593 + 1800 10.454466 -55.130637 0 -53.964426 330.88658 + 2000 10.253701 -55.154093 0 -54.010277 323.15259 + 2200 9.6688957 -55.143479 0 -54.064899 325.16815 + 2400 10.059787 -55.134941 0 -54.012756 329.83534 + 2600 9.9050905 -55.096231 0 -53.991303 338.94947 + 2800 9.663551 -55.130202 0 -54.052218 328.77571 + 3000 9.950484 -55.123447 0 -54.013455 332.00143 + 3200 9.7210637 -55.120005 0 -54.035606 331.39812 + 3400 9.6457139 -55.080953 0 -54.004959 341.95838 + 3600 10.42249 -55.102379 0 -53.939734 339.66808 + 3800 10.276893 -55.126271 0 -53.979868 332.40943 + 4000 10.135481 -55.091551 0 -53.960922 340.60675 + 4200 10.129209 -55.084189 0 -53.95426 343.39315 + 4400 10.006953 -55.120704 0 -54.004413 331.57121 + 4600 10.497483 -55.144898 0 -53.973888 327.22996 + 4800 9.9230954 -55.126028 0 -54.019091 330.70489 + 5000 9.3726166 -55.076514 0 -54.030985 342.43571 +Loop time of 2.0887 on 4 procs for 5000 steps with 864 atoms + +Performance: 20682.713 ns/day, 0.001 hours/ns, 2393.833 timesteps/s, 2.068 Matom-step/s +62.5% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 0.53905 | 0.54518 | 0.5484 | 0.5 | 26.10 +Bond | 0.00062355 | 0.00066183 | 0.0007207 | 0.0 | 0.03 +Neigh | 0.10715 | 0.10937 | 0.11212 | 0.5 | 5.24 +Comm | 0.94637 | 0.95041 | 0.95905 | 0.5 | 45.50 +Output | 0.0061059 | 0.0061286 | 0.0061661 | 0.0 | 0.29 +Modify | 0.26086 | 0.26355 | 0.26979 | 0.7 | 12.62 +Other | | 0.2134 | | | 10.22 + +Nlocal: 216 ave 216 max 216 min +Histogram: 4 0 0 0 0 0 0 0 0 0 +Nghost: 884.75 ave 885 max 884 min +Histogram: 1 0 0 0 0 0 0 0 0 3 +Neighs: 4536 ave 4737 max 4335 min +Histogram: 2 0 0 0 0 0 0 0 0 2 + +Total # of neighbors = 18144 +Ave neighs/atom = 21 +Ave special neighs/atom = 0 +Neighbor list builds = 273 +Dangerous builds = 0 + + +Total wall time: 0:00:02 diff --git a/src/EXTRA-FIX/fix_langevin_gjf.cpp b/src/EXTRA-FIX/fix_langevin_gjf.cpp index 59d5cff1c5..95d67fb15f 100644 --- a/src/EXTRA-FIX/fix_langevin_gjf.cpp +++ b/src/EXTRA-FIX/fix_langevin_gjf.cpp @@ -15,17 +15,16 @@ Contributing authors: Tim Linke & Niels Gronbech-Jensen (UC Davis) ------------------------------------------------------------------------- */ -#include "fix_langevin.h" +#include "fix_langevin_gjf.h" #include "atom.h" -#include "atom_vec_ellipsoid.h" +#include "citeme.h" #include "comm.h" #include "compute.h" #include "error.h" #include "force.h" #include "group.h" #include "input.h" -#include "math_extra.h" #include "memory.h" #include "modify.h" #include "random_mars.h" @@ -42,21 +41,33 @@ using namespace FixConst; enum { NOBIAS, BIAS }; enum { CONSTANT, EQUAL, ATOM }; +static const char cite_langevin_gjf[] = + "Langevin GJF methods: doi:10.1007/s10955-024-03345-1\n\n" + "@Article{gronbech_jensen_2024,\n" + "title = {On the Definition of Velocity in Discrete-Time, Stochastic Langevin Simulations},\n" + "volume = {191},\n" + "number = {10},\n" + "url = {https://doi.org/10.1007/s10955-024-03345-1},\n" + "doi = {10.1007/s10955-024-03345-1},\n" + "urldate = {2024-10-22},\n" + "journal = {J. Stat. Phys.},\n" + "author = {Gronbech-Jensen, Niels},\n" + "year = {2024},\n" + "pages = {137}\n" + "}\n\n"; + + /* ---------------------------------------------------------------------- */ FixLangevinGJF::FixLangevinGJF(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), gjfflag(0), - tstr(nullptr), flangevin(nullptr), tforce(nullptr), lv(nullptr), id_temp(nullptr), random(nullptr) + Fix(lmp, narg, arg), tstr(nullptr), tforce(nullptr), lv(nullptr), id_temp(nullptr), random(nullptr) { - if (narg < 8) error->all(FLERR, "Illegal fix langevin/gjf command"); + if (lmp->citeme) lmp->citeme->add(cite_langevin_gjf); + if (narg < 7) error->all(FLERR, "Illegal fix langevin/gjf command"); time_integrate = 1; restart_peratom = 1; - // dynamic_group_allow = 1; - // scalar_flag = 1; - // global_freq = 1; - // extscalar = 1; - // ecouple_flag = 1; + global_freq = 1; nevery = 1; if (utils::strmatch(arg[3], "^v_")) { @@ -75,15 +86,17 @@ FixLangevinGJF::FixLangevinGJF(LAMMPS *lmp, int narg, char **arg) : if (seed <= 0) error->all(FLERR, "Illegal fix langevin/gjf command"); // initialize Marsaglia RNG with processor-unique seed - random = new RanMars(lmp, seed + comm->me); - int GJmethods = 8 // number of currently implemented GJ methods + int GJmethods = 8; // number of currently implemented GJ methods + maxatom = 0; // optional args + // per default, use half step and GJ-I osflag = 0; - GJmethod = 0; + GJmethod = 1; + lv_allocated = 0; int iarg = 7; while (iarg < narg) { @@ -120,7 +133,7 @@ FixLangevinGJF::FixLangevinGJF(LAMMPS *lmp, int narg, char **arg) : FixLangevinGJF::grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); - // initialize lv to zero + // initialize lv to onsite velocity int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { lv[i][0] = 0.0; @@ -181,14 +194,8 @@ void FixLangevinGJF::init() error->all(FLERR, "Variable {} for fix langevin/gjf is invalid style", tstr); } - if (temperature && temperature->tempbias) - tbiasflag = BIAS; - else - tbiasflag = NOBIAS; - if (utils::strmatch(update->integrate_style, "^respa")) { - nlevels_respa = (static_cast(update->integrate))->nlevels; - error->all(FLERR, "Fix langevin gjf and run style respa are not compatible"); + error->all(FLERR, "Fix langevin/gjf and run style respa are not compatible"); } // Complete set of thermostats is given in Gronbech-Jensen, Molecular Physics, 118 (2020) @@ -215,7 +222,7 @@ void FixLangevinGJF::init() gjfc2 = 1; // TODO: correct this break; case 8: // provided in Gronbech-Jensen (2024) - gjfc2 = sqrt( (update->dt / t_period)*(update->dt / t_period) + 1.0 ) - update->dt / t_period; + gjfc2 = sqrt( (update->dt / t_period) * (update->dt / t_period) + 1.0 ) - update->dt / t_period; break; case 0: gjfc2 = 0.0; @@ -239,7 +246,7 @@ void FixLangevinGJF::init() void FixLangevinGJF::initial_integrate(int /* vflag */) { - // This function provides the integration of the GJ formulation 24a-e + // This function provides the integration of the GJ formulation 24 a-e double **x = atom->x; double **v = atom->v; double **f = atom->f; @@ -258,13 +265,13 @@ void FixLangevinGJF::initial_integrate(int /* vflag */) double dtf = 0.5 * dt * ftm2v; double dtfm; - double c1sq = sqrt(gjfc1); - double c3sq = sqrt(gjfc3); + double c1sqrt = sqrt(gjfc1); + double c3sqrt = sqrt(gjfc3); double csq = sqrt(gjfc3 / gjfc1); double m, beta; // If user elected vhalf, v needs to be reassigned to onsite velocity for integration - if (!osflag) { + if (!osflag && lv_allocated) { for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { // lv is Eq. 24f from previous time step @@ -275,8 +282,6 @@ void FixLangevinGJF::initial_integrate(int /* vflag */) } compute_target(); - - if (tbiasflag == BIAS) temperature->compute_scalar(); for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { @@ -284,10 +289,10 @@ void FixLangevinGJF::initial_integrate(int /* vflag */) if (tstyle == ATOM) tsqrt = sqrt(tforce[i]); if (rmass) { m = rmass[i]; - beta = tsqrt * sqrt(2.0*dt*rmass[i]*boltz/t_period/mvv2e) / ftm2v; + beta = tsqrt * sqrt(2.0*dt*m*boltz/t_period/mvv2e) / ftm2v; } else { m = mass[type[i]]; - beta = tsqrt * sqrt(2.0*dt*atom->mass[i]*boltz/t_period/mvv2e) / ftm2v; + beta = tsqrt * sqrt(2.0*dt*m*boltz/t_period/mvv2e) / ftm2v; } fran[0] = beta*random->gaussian(); @@ -304,24 +309,14 @@ void FixLangevinGJF::initial_integrate(int /* vflag */) x[i][2] += 0.5 * csq * dt * v[i][2]; // Calculate Eq. 24c: - if (tbiasflag == BIAS) - temperature->remove_bias(i,v[i]); lv[i][0] = c1sqrt*v[i][0] + ftm2v * (c3sqrt / (2.0 * m)) * fran[0]; lv[i][1] = c1sqrt*v[i][1] + ftm2v * (c3sqrt / (2.0 * m)) * fran[1]; lv[i][2] = c1sqrt*v[i][2] + ftm2v * (c3sqrt / (2.0 * m)) * fran[2]; - if (tbiasflag == BIAS) - temperature->restore_bias(i,v[i]); - if (tbiasflag == BIAS) - temperature->restore_bias(i,lv[i]); - // Calculate Eq. 24d - if (tbiasflag == BIAS) temperature->remove_bias(i, v[i]); - v[i][0] = (gjfc2 / c1sqrt) * lv[i][0] + ftm2v * csq * (0.5 / m) * fran[0]; v[i][1] = (gjfc2 / c1sqrt) * lv[i][1] + ftm2v * csq * (0.5 / m) * fran[1]; v[i][2] = (gjfc2 / c1sqrt) * lv[i][2] + ftm2v * csq * (0.5 / m) * fran[2]; - if (tbiasflag == BIAS) temperature->restore_bias(i, v[i]); // Calculate Eq. 24e. Final integrator then calculates Eq. 24f after force update. x[i][0] += 0.5 * csq * dt * v[i][0]; @@ -337,9 +332,9 @@ void FixLangevinGJF::final_integrate() double dt = update->dt; double ftm2v = force->ftm2v; double dtf = 0.5 * dt * ftm2v; + double csq = sqrt(gjfc3 / gjfc1); // update v of atoms in group - double **v = atom->v; double **f = atom->f; double *rmass = atom->rmass; @@ -367,6 +362,8 @@ void FixLangevinGJF::final_integrate() v[i][2] += csq * dtfm * f[i][2]; } } + + lv_allocated = 1; } /* ---------------------------------------------------------------------- @@ -395,10 +392,10 @@ void FixLangevinGJF::compute_target() error->one(FLERR, "Fix langevin/gjf variable returned negative temperature"); tsqrt = sqrt(t_target); } else { - if (atom->nmax > maxatom2) { - maxatom2 = atom->nmax; + if (atom->nmax > maxatom) { + maxatom = atom->nmax; memory->destroy(tforce); - memory->create(tforce,maxatom2,"langevin:tforce"); + memory->create(tforce,maxatom,"langevin_gjf:tforce"); } input->variable->compute_atom(tvar,igroup,tforce,1,0); for (int i = 0; i < nlocal; i++) diff --git a/src/EXTRA-FIX/fix_langevin_gjf.h b/src/EXTRA-FIX/fix_langevin_gjf.h index df6b80e1b7..4b65051cf5 100644 --- a/src/EXTRA-FIX/fix_langevin_gjf.h +++ b/src/EXTRA-FIX/fix_langevin_gjf.h @@ -13,12 +13,12 @@ #ifdef FIX_CLASS // clang-format off -FixStyle(langevin,FixLangevin); +FixStyle(langevin/gjf,FixLangevinGJF); // clang-format on #else -#ifndef LMP_FIX_LANGEVIN_H -#define LMP_FIX_LANGEVIN_H +#ifndef LMP_FIX_LANGEVINGJF_H +#define LMP_FIX_LANGEVINGJF_H #include "fix.h" @@ -30,7 +30,6 @@ class FixLangevinGJF : public Fix { ~FixLangevinGJF() override; int setmask() override; void init() override; - void setup(int) override; void initial_integrate(int) override; void final_integrate() override; void end_of_step() override; @@ -45,10 +44,8 @@ class FixLangevinGJF : public Fix { int unpack_exchange(int, double *) override; protected: - int osflag, GJmethod; - double t_start, t_stop, t_period, t_target; - double *gfactor2; - double tsqrt; + int osflag, GJmethod, maxatom, lv_allocated; + double t_start, t_stop, t_period, t_target, tsqrt; double gjfc1, gjfc2, gjfc3; int tstyle, tvar; char *tstr; @@ -59,7 +56,6 @@ class FixLangevinGJF : public Fix { char *id_temp; class Compute *temperature; - int nlevels_respa; class RanMars *random; int seed; From 2bb945419012724480e4773e98e191ee53f2d9a2 Mon Sep 17 00:00:00 2001 From: talinke Date: Thu, 10 Apr 2025 13:15:30 -0700 Subject: [PATCH 05/17] Correct style --- doc/src/fix_langevin_gjf.rst | 32 +++++++++++++----------------- src/EXTRA-FIX/fix_langevin_gjf.cpp | 12 +++++------ 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/doc/src/fix_langevin_gjf.rst b/doc/src/fix_langevin_gjf.rst index e58b4305bd..a1fcea9c9a 100644 --- a/doc/src/fix_langevin_gjf.rst +++ b/doc/src/fix_langevin_gjf.rst @@ -56,20 +56,20 @@ quadratically with the timestep. The option *vhalf* outputs the 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 -:ref:`Gronbech-Jensen-2020 `. +:ref:`Gronbech-Jensen-2020 `. -This fix allows the use of any of the GJ methods as listed in :ref:`Gronbech-Jensen-2020 `. -The GJ-VII method is described in :ref:`Finkelstein `. -The implementation follows the splitting form provided in Eqs. (24) and (25) -in :ref:`Gronbech-Jensen-2024 `, including the application -of Gaussian noise values, per the description in +This fix allows the use of any of the GJ methods as listed in :ref:`Gronbech-Jensen-2020 `. +The GJ-VII method is described in :ref:`Finkelstein `. +The implementation follows the splitting form provided in Eqs. (24) and (25) +in :ref:`Gronbech-Jensen-2024 `, including the application +of Gaussian noise values, per the description in :ref:`Gronbech-Jensen-2023 `. .. note:: Unlike the :doc:`fix langevin ` command which performs force - modifications only, this fix performs thermostatting and time integration. + modifications only, this fix performs thermostatting and time integration. Thus you no longer need a separate time integration fix, like :doc:`fix nve `. See the :doc:`Howto thermostat ` page for @@ -138,20 +138,16 @@ The keyword *method* selects one of the eight GJ-methods implemented in LAMMPS. ---------- -.. include:: accel_styles.rst - ----------- - Restart, fix_modify, output, run start/stop, minimize info """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" -No information about this fix is written to :doc:`binary restart files `. -Because the state of the random number generator is not saved in restart files, -this means you cannot do "exact" restarts with this fix, where the simulation -continues on the same as if no restart had taken place. However, in a -statistical sense, a restarted simulation should produce the same behavior. -The "exact" restart is done with either vfull or vhalf velocity output for as -long as the choice of vfull/vhalf is the same for the simulation as it is in +No information about this fix is written to :doc:`binary restart files `. +Because the state of the random number generator is not saved in restart files, +this means you cannot do "exact" restarts with this fix, where the simulation +continues on the same as if no restart had taken place. However, in a +statistical sense, a restarted simulation should produce the same behavior. +The "exact" restart is done with either vfull or vhalf velocity output for as +long as the choice of vfull/vhalf is the same for the simulation as it is in the restart file. The :doc:`fix_modify ` *temp* option is supported by this diff --git a/src/EXTRA-FIX/fix_langevin_gjf.cpp b/src/EXTRA-FIX/fix_langevin_gjf.cpp index 95d67fb15f..c1aa3dfac7 100644 --- a/src/EXTRA-FIX/fix_langevin_gjf.cpp +++ b/src/EXTRA-FIX/fix_langevin_gjf.cpp @@ -129,7 +129,7 @@ FixLangevinGJF::FixLangevinGJF(LAMMPS *lmp, int narg, char **arg) : // register with Atom class // no need to set peratom_flag, b/c data is for internal use only - + FixLangevinGJF::grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); @@ -282,12 +282,12 @@ void FixLangevinGJF::initial_integrate(int /* vflag */) } compute_target(); - + for (int i = 0; i < nlocal; i++) { if (mask[i] & groupbit) { if (tstyle == ATOM) tsqrt = sqrt(tforce[i]); - if (rmass) { + if (rmass) { m = rmass[i]; beta = tsqrt * sqrt(2.0*dt*m*boltz/t_period/mvv2e) / ftm2v; } else { @@ -298,7 +298,7 @@ void FixLangevinGJF::initial_integrate(int /* vflag */) fran[0] = beta*random->gaussian(); fran[1] = beta*random->gaussian(); fran[2] = beta*random->gaussian(); - + // First integration delivers Eq. 24a and 24b: dtfm = dtf / m; v[i][0] += csq * dtfm * f[i][0]; @@ -307,12 +307,12 @@ void FixLangevinGJF::initial_integrate(int /* vflag */) x[i][0] += 0.5 * csq * dt * v[i][0]; x[i][1] += 0.5 * csq * dt * v[i][1]; x[i][2] += 0.5 * csq * dt * v[i][2]; - + // Calculate Eq. 24c: lv[i][0] = c1sqrt*v[i][0] + ftm2v * (c3sqrt / (2.0 * m)) * fran[0]; lv[i][1] = c1sqrt*v[i][1] + ftm2v * (c3sqrt / (2.0 * m)) * fran[1]; lv[i][2] = c1sqrt*v[i][2] + ftm2v * (c3sqrt / (2.0 * m)) * fran[2]; - + // Calculate Eq. 24d v[i][0] = (gjfc2 / c1sqrt) * lv[i][0] + ftm2v * csq * (0.5 / m) * fran[0]; v[i][1] = (gjfc2 / c1sqrt) * lv[i][1] + ftm2v * csq * (0.5 / m) * fran[1]; From a30daec3483d749489e387284186c275fc1b32d3 Mon Sep 17 00:00:00 2001 From: talinke Date: Fri, 11 Apr 2025 13:40:35 -0700 Subject: [PATCH 06/17] Addition of GJ-VII --- src/EXTRA-FIX/fix_langevin_gjf.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/EXTRA-FIX/fix_langevin_gjf.cpp b/src/EXTRA-FIX/fix_langevin_gjf.cpp index c1aa3dfac7..f9e523548f 100644 --- a/src/EXTRA-FIX/fix_langevin_gjf.cpp +++ b/src/EXTRA-FIX/fix_langevin_gjf.cpp @@ -66,7 +66,6 @@ FixLangevinGJF::FixLangevinGJF(LAMMPS *lmp, int narg, char **arg) : if (narg < 7) error->all(FLERR, "Illegal fix langevin/gjf command"); time_integrate = 1; - restart_peratom = 1; global_freq = 1; nevery = 1; @@ -219,7 +218,10 @@ void FixLangevinGJF::init() gjfc2 = (1.0 / (1.0 + update->dt / 2.0 / t_period)) * (1.0 / (1.0 + update->dt / 2.0 / t_period)); break; case 7: // provided in Finkelstein (2021) - gjfc2 = 1; // TODO: correct this + gjfc2 = (1.0 - update->dt / 2.0 / t_period) / (1.0 + update->dt / 2.0 / t_period); //using GJ-I + gjfc1 = (1.0 + gjfc2) / 2.0; + gjfc3 = (1.0 - gjfc2) * t_period / update->dt; + gjfc2 = exp(-sqrt(gjfc3/gjfc1)*update->dt / t_period); break; case 8: // provided in Gronbech-Jensen (2024) gjfc2 = sqrt( (update->dt / t_period) * (update->dt / t_period) + 1.0 ) - update->dt / t_period; @@ -470,7 +472,10 @@ void FixLangevinGJF::reset_dt() gjfc2 = (1.0 / (1.0 + update->dt / 2.0 / t_period)) * (1.0 / (1.0 + update->dt / 2.0 / t_period)); break; case 7: // provided in Finkelstein (2021) - gjfc2 = 1; // TODO: correct this + gjfc2 = (1.0 - update->dt / 2.0 / t_period) / (1.0 + update->dt / 2.0 / t_period); //using GJ-I + gjfc1 = (1.0 + gjfc2) / 2.0; + gjfc3 = (1.0 - gjfc2) * t_period / update->dt; + gjfc2 = exp(-sqrt(gjfc3/gjfc1)*update->dt / t_period); break; case 8: // provided in Gronbech-Jensen (2024) gjfc2 = sqrt( (update->dt / t_period)*(update->dt / t_period) + 1.0 ) - update->dt / t_period; From 09d3ac0a1bdfa1656329400a72598ece7a008fc6 Mon Sep 17 00:00:00 2001 From: talinke Date: Fri, 11 Apr 2025 20:07:25 -0700 Subject: [PATCH 07/17] Updated GJ-VII, GJ-VIII --- examples/gjf/README | 7 ++- src/EXTRA-FIX/fix_langevin_gjf.cpp | 69 ++++++++++++++++++++++-------- 2 files changed, 54 insertions(+), 22 deletions(-) diff --git a/examples/gjf/README b/examples/gjf/README index fdbc843522..c22df903e7 100644 --- a/examples/gjf/README +++ b/examples/gjf/README @@ -33,14 +33,13 @@ POTENTIAL ENERGY (eV) Script Commands: -- +fix lang all langevin/gjf 10 10 1 26488 +vs +-- fix nve all nve fix lang all langevin 10 10 1 26488 -- vs -- fix noho all nvt temp 10 10 1 --- -vs --- -fix lang all langevin/gjf 10 10 1 26488 -- \ No newline at end of file diff --git a/src/EXTRA-FIX/fix_langevin_gjf.cpp b/src/EXTRA-FIX/fix_langevin_gjf.cpp index f9e523548f..c00fbb9ee5 100644 --- a/src/EXTRA-FIX/fix_langevin_gjf.cpp +++ b/src/EXTRA-FIX/fix_langevin_gjf.cpp @@ -41,8 +41,37 @@ using namespace FixConst; enum { NOBIAS, BIAS }; enum { CONSTANT, EQUAL, ATOM }; + static const char cite_langevin_gjf[] = - "Langevin GJF methods: doi:10.1007/s10955-024-03345-1\n\n" + "Langevin GJ methods: doi:10.1080/00268976.2019.1662506\n\n" + "@Article{gronbech-jensen_complete_2020,\n" + "title = {Complete set of stochastic Verlet-type thermostats for correct Langevin simulations},\n" + "volume = {118},\n" + "number = {8},\n" + "url = {https://www.tandfonline.com/doi/full/10.1080/00268976.2019.1662506},\n" + "doi = {10.1080/00268976.2019.1662506},\n" + "journal = {Molecular Physics},\n" + "author = {Grønbech-Jensen, Niels},\n" + "year = {2020},\n" + "}\n\n"; + +static const char cite_langevin_gjf_7[] = + "Langevin GJ-VII method: doi:10.1063/5.0066008\n\n" + "@Article{finkelstein_2021,\n" + "title = {Bringing discrete-time Langevin splitting methods into agreement with thermodynamics},\n" + "volume = {155},\n" + "number = {18},\n" + "url = {https://doi.org/10.1063/5.0066008},\n" + "doi = {10.1063/5.0066008},\n" + "urldate = {2021-11-14},\n" + "journal = {J. Chem. Phys.},\n" + "author = {Finkelstein, Joshua and Cheng, Chungho and Fiorin, Giacomo and Seibold, Benjamin and Grønbech-Jensen, Niels},\n" + "year = {2021},\n" + "pages = {184104}\n" + "}\n\n"; + +static const char cite_langevin_gjf_8[] = + "Langevin GJ-VIII method: doi:10.1007/s10955-024-03345-1\n\n" "@Article{gronbech_jensen_2024,\n" "title = {On the Definition of Velocity in Discrete-Time, Stochastic Langevin Simulations},\n" "volume = {191},\n" @@ -55,7 +84,7 @@ static const char cite_langevin_gjf[] = "year = {2024},\n" "pages = {137}\n" "}\n\n"; - + /* ---------------------------------------------------------------------- */ @@ -109,10 +138,20 @@ FixLangevinGJF::FixLangevinGJF(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Illegal fix langevin/gjf command"); iarg += 2; } else if (strcmp(arg[iarg], "method") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix langevin/gjf command"); GJmethod = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); - if (GJmethod < 0 || GJmethod > GJmethods) error->all(FLERR, "Invalid GJ method choice in langevin/gjf command"); - iarg += 2; + if (GJmethod = 7) { + if (iarg + 3 > narg) error->all(FLERR, "Illegal fix langevin/gjf command for GJ-VII"); + gjfc2 = utils::numeric(FLERR, arg[iarg + 2], false, lmp); + if (gjfc2 < 0 || gjfc2 > 1) error->all(FLERR, "Choice of c2 in GJ-VII must be 0≤c2≤1"); + iarg += 3; + if (lmp->citeme) lmp->citeme->add(cite_langevin_gjf_7); + } + else { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix langevin/gjf command"); + if (GJmethod < 0 || GJmethod > GJmethods) error->all(FLERR, "Invalid GJ method choice in langevin/gjf command"); + if (GJmethod = 8) if (lmp->citeme) lmp->citeme->add(cite_langevin_gjf_8); + iarg += 2; + } } else error->all(FLERR, "Illegal fix langevin/gjf command"); } @@ -218,10 +257,7 @@ void FixLangevinGJF::init() gjfc2 = (1.0 / (1.0 + update->dt / 2.0 / t_period)) * (1.0 / (1.0 + update->dt / 2.0 / t_period)); break; case 7: // provided in Finkelstein (2021) - gjfc2 = (1.0 - update->dt / 2.0 / t_period) / (1.0 + update->dt / 2.0 / t_period); //using GJ-I - gjfc1 = (1.0 + gjfc2) / 2.0; - gjfc3 = (1.0 - gjfc2) * t_period / update->dt; - gjfc2 = exp(-sqrt(gjfc3/gjfc1)*update->dt / t_period); + update->dt = (1.0 + gjfc2) / (1.0 - gjfc2) * log(gjfc2) * log(gjfc2) * 0.5 * t_period; break; case 8: // provided in Gronbech-Jensen (2024) gjfc2 = sqrt( (update->dt / t_period) * (update->dt / t_period) + 1.0 ) - update->dt / t_period; @@ -238,11 +274,11 @@ void FixLangevinGJF::init() } /* ---------------------------------------------------------------------- - integrate position and velocity according to the GJF method + integrate position and velocity according to the GJ methods in Grønbech-Jensen, J Stat Phys 191, 137 (2024). The general workflow is - 1. Langevin GJF Initial Integration + 1. Langevin GJ Initial Integration 2. Force Update - 3. Langevin GJF Final Integration + 3. Langevin GJ Final Integration 4. Velocity Choice in end_of_step() ------------------------------------------------------------------------- */ @@ -336,7 +372,6 @@ void FixLangevinGJF::final_integrate() double dtf = 0.5 * dt * ftm2v; double csq = sqrt(gjfc3 / gjfc1); - // update v of atoms in group double **v = atom->v; double **f = atom->f; double *rmass = atom->rmass; @@ -346,6 +381,7 @@ void FixLangevinGJF::final_integrate() int nlocal = atom->nlocal; if (igroup == atom->firstgroup) nlocal = atom->nfirst; + // Calculate Eq. 24f. if (rmass) { for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { @@ -410,7 +446,7 @@ void FixLangevinGJF::compute_target() } /* ---------------------------------------------------------------------- - select velocity for GJF + select velocity for GJ ------------------------------------------------------------------------- */ void FixLangevinGJF::end_of_step() @@ -472,10 +508,7 @@ void FixLangevinGJF::reset_dt() gjfc2 = (1.0 / (1.0 + update->dt / 2.0 / t_period)) * (1.0 / (1.0 + update->dt / 2.0 / t_period)); break; case 7: // provided in Finkelstein (2021) - gjfc2 = (1.0 - update->dt / 2.0 / t_period) / (1.0 + update->dt / 2.0 / t_period); //using GJ-I - gjfc1 = (1.0 + gjfc2) / 2.0; - gjfc3 = (1.0 - gjfc2) * t_period / update->dt; - gjfc2 = exp(-sqrt(gjfc3/gjfc1)*update->dt / t_period); + update->dt = (1.0 + gjfc2) / (1.0 - gjfc2) * log(gjfc2) * log(gjfc2) * 0.5 * t_period; break; case 8: // provided in Gronbech-Jensen (2024) gjfc2 = sqrt( (update->dt / t_period)*(update->dt / t_period) + 1.0 ) - update->dt / t_period; From e4c3b0c05e6a83d6d933a0514e09b8cb162728db Mon Sep 17 00:00:00 2001 From: talinke Date: Mon, 14 Apr 2025 11:33:02 -0700 Subject: [PATCH 08/17] New example and log files --- examples/gjf/README | 20 ++-- examples/gjf/in.gjf.vfull | 11 +- examples/gjf/in.gjf.vhalf | 9 +- examples/gjf/log.2Apr25.gjf.vfull.g++.1 | 137 +++++++++++++--------- examples/gjf/log.2Apr25.gjf.vfull.g++.4 | 147 ++++++++++++++---------- examples/gjf/log.2Apr25.gjf.vhalf.g++.1 | 131 ++++++++++++--------- examples/gjf/log.2Apr25.gjf.vhalf.g++.4 | 129 +++++++++++++-------- src/EXTRA-FIX/fix_langevin_gjf.cpp | 4 +- 8 files changed, 354 insertions(+), 234 deletions(-) diff --git a/examples/gjf/README b/examples/gjf/README index c22df903e7..b98e4134ab 100644 --- a/examples/gjf/README +++ b/examples/gjf/README @@ -13,33 +13,35 @@ mpirun -np $NP lmp_mpi -in.gjf.vhalf Compared to other thermostats, the GJ thermostat allows for larger timesteps with the correct Boltzmann statistics. A comparison using averaged properties from this example's input file is shown below. 'X' denotes a failed simulation. +The theoretical value for KE is 1.1168 eV. KINETIC ENERGY (eV) | Δt || 0.01 | 0.05 | 0.10 | 0.11 | 0.12 | 0.13 | 0.14 | |==============||========|========|========|========|========|========|========| -| langevin/gjf || 1.112 | 1.108 | 1.114 | 1.118 | 1.111 | 1.133 | 1.168 | -| langevin || 1.113 | 1.125 | 1.121 | 1.135 | 1.152 | X | X | -| nvt || 1.094 | 1.114 | 1.117 | 1.113 | 1.121 | X | X | +| gjf half || 1.117 | 1.116 | 1.119 | 1.119 | 1.123 | 1.136 | 1.170 | +| gjf full || 1.116 | 1.071 | 0.938 | 0.898 | 0.858 | 0.817 | 0.780 | +| langevin || 1.110 | 1.113 | 1.121 | 1.129 | 1.157 | X | X | +| nvt || 1.083 | 1.109 | 1.112 | 1.113 | 1.114 | X | X | |--------------||--------|--------|--------|--------|--------|--------|--------| POTENTIAL ENERGY (eV) | Δt || 0.01 | 0.05 | 0.10 | 0.11 | 0.12 | 0.13 | 0.14 | |==============||========|========|========|========|========|========|========| -| langevin/gjf || -55.16 | -55.16 | -55.15 | -55.15 | -55.15 | -55.14 | -55.12 | -| langevin || -55.16 | -55.12 | -54.93 | -54.85 | -54.71 | X | X | -| nvt || -55.17 | -55.10 | -54.95 | -54.88 | -54.82 | X | X | +| gjf half || -55.11 | -55.11 | -55.11 | -55.11 | -55.11 | -55.10 | -55.07 | +| gjf full || -55.11 | -55.11 | -55.11 | -55.11 | -55.11 | -55.10 | -55.07 | +| langevin || -55.11 | -55.07 | -54.87 | -54.79 | -54.65 | X | X | +| nvt || -55.14 | -55.07 | -54.90 | -54.84 | -54.76 | X | X | |--------------||--------|--------|--------|--------|--------|--------|--------| Script Commands: -- fix lang all langevin/gjf 10 10 1 26488 -vs +-- +fix lang all langevin/gjf 10 10 1 26488 vel vfull -- fix nve all nve fix lang all langevin 10 10 1 26488 -- -vs --- fix noho all nvt temp 10 10 1 -- \ No newline at end of file diff --git a/examples/gjf/in.gjf.vfull b/examples/gjf/in.gjf.vfull index 8512dad837..127b8fef87 100644 --- a/examples/gjf/in.gjf.vfull +++ b/examples/gjf/in.gjf.vfull @@ -5,18 +5,21 @@ atom_style full boundary p p p read_data argon.lmp - include ff-argon.lmp velocity all create 10 2357 mom yes dist gaussian - neighbor 1 bin timestep 0.1 -fix lang all langevin/gjf 10 10 1 26488 vel vfull method 4 +compute myKE all ke +compute myPE all pe -thermo 200 +fix lang all langevin/gjf 10 10 1 26488 vel vfull method 1 + +thermo 2000 run 5000 +fix energies all ave/time 1 20000 20000 c_myKE c_myPE file ave.out +run 35000 \ No newline at end of file diff --git a/examples/gjf/in.gjf.vhalf b/examples/gjf/in.gjf.vhalf index 08b0b45c8c..ba805d693a 100644 --- a/examples/gjf/in.gjf.vhalf +++ b/examples/gjf/in.gjf.vhalf @@ -5,18 +5,21 @@ atom_style full boundary p p p read_data argon.lmp - include ff-argon.lmp velocity all create 10 2357 mom yes dist gaussian - neighbor 1 bin timestep 0.1 +compute myKE all ke +compute myPE all pe + fix lang all langevin/gjf 10 10 1 26488 -thermo 200 run 5000 +fix energies all ave/time 1 20000 20000 c_myKE c_myPE file ave.out +thermo 2000 +run 35000 \ No newline at end of file diff --git a/examples/gjf/log.2Apr25.gjf.vfull.g++.1 b/examples/gjf/log.2Apr25.gjf.vfull.g++.1 index a1cb4de702..30a0f7e9c9 100644 --- a/examples/gjf/log.2Apr25.gjf.vfull.g++.1 +++ b/examples/gjf/log.2Apr25.gjf.vfull.g++.1 @@ -1,4 +1,4 @@ -LAMMPS (2 Apr 2025 - Development - 4dd8c66390-modified) +LAMMPS (2 Apr 2025 - Development - 09d3ac0a1b-modified) OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:99) using 1 OpenMP thread(s) per MPI task # GJ thermostat @@ -22,7 +22,6 @@ Finding 1-2 1-3 1-4 neighbors ... 1 = max # of special neighbors special bonds CPU = 0.000 seconds read_data CPU = 0.007 seconds - include ff-argon.lmp ############################# #Atoms types - mass - charge# @@ -47,33 +46,33 @@ pair_coeff * * 0.0102701 3.42 velocity all create 10 2357 mom yes dist gaussian - neighbor 1 bin timestep 0.1 -fix lang all langevin/gjf 10 10 1 26488 vel vfull method 4 +compute myKE all ke +compute myPE all pe -thermo 200 +fix lang all langevin/gjf 10 10 1 26488 vel vfull method 1 + +thermo 2000 run 5000 CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE Your simulation uses code contributions which should be cited: -- Langevin GJF methods: doi:10.1007/s10955-024-03345-1 +- Langevin GJ methods: doi:10.1080/00268976.2019.1662506 -@Article{gronbech_jensen_2024, -title = {On the Definition of Velocity in Discrete-Time, Stochastic Langevin Simulations}, -volume = {191}, -number = {10}, -url = {https://doi.org/10.1007/s10955-024-03345-1}, -doi = {10.1007/s10955-024-03345-1}, -urldate = {2024-10-22}, -journal = {J. Stat. Phys.}, -author = {Gronbech-Jensen, Niels}, -year = {2024}, -pages = {137} +@Article{gronbech-jensen_complete_2020, +title = {Complete set of stochastic Verlet-type thermostats for correct Langevin simulations}, +volume = {118}, +number = {8}, +url = {https://www.tandfonline.com/doi/full/10.1080/00268976.2019.1662506}, +doi = {10.1080/00268976.2019.1662506}, +journal = {Molecular Physics}, +author = {Grønbech-Jensen, Niels}, +year = {2020}, } CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE @@ -94,46 +93,24 @@ Neighbor list info ... Per MPI rank memory allocation (min/avg/max) = 6.481 | 6.481 | 6.481 Mbytes Step Temp E_pair E_mol TotEng Press 0 10 -56.207652 0 -55.092137 33.341103 - 200 8.3566091 -55.074758 0 -54.142565 340.34804 - 400 8.5550582 -55.098903 0 -54.144573 333.63174 - 600 8.7873675 -55.044559 0 -54.064315 350.7384 - 800 8.7258741 -55.149735 0 -54.17635 318.83613 - 1000 8.3748307 -55.059754 0 -54.125529 343.7989 - 1200 8.6082188 -55.156326 0 -54.196066 316.8728 - 1400 8.9291902 -55.11836 0 -54.122295 328.12488 - 1600 8.3386383 -55.119788 0 -54.189601 325.81369 - 1800 8.0698034 -55.076285 0 -54.176086 338.69767 - 2000 8.5103978 -55.084479 0 -54.135131 338.12197 - 2200 8.3201517 -55.104858 0 -54.176733 329.95905 - 2400 8.7070407 -55.120649 0 -54.149366 328.06488 - 2600 8.4244379 -55.147583 0 -54.207824 321.45013 - 2800 8.7911907 -55.127309 0 -54.146638 325.76049 - 3000 8.250829 -55.1039 0 -54.183508 332.05048 - 3200 8.693979 -55.155552 0 -54.185726 318.29736 - 3400 8.9806023 -55.127303 0 -54.125504 327.48861 - 3600 8.8313967 -55.081076 0 -54.09592 339.16793 - 3800 8.8008688 -55.176748 0 -54.194998 313.08151 - 4000 8.1780418 -55.105368 0 -54.193096 330.04164 - 4200 8.3772045 -55.128813 0 -54.194323 324.29069 - 4400 8.3580983 -55.086979 0 -54.154621 335.63911 - 4600 8.1493124 -55.096648 0 -54.18758 332.51502 - 4800 9.0189389 -55.126828 0 -54.120752 326.36041 - 5000 8.7587383 -55.084993 0 -54.107943 337.17399 -Loop time of 2.34344 on 1 procs for 5000 steps with 864 atoms + 2000 8.5329244 -55.06102 0 -54.10916 343.01505 + 4000 7.8165794 -55.128803 0 -54.256851 322.07344 + 5000 8.4535562 -55.150518 0 -54.207511 318.20862 +Loop time of 2.26625 on 1 procs for 5000 steps with 864 atoms -Performance: 18434.456 ns/day, 0.001 hours/ns, 2133.618 timesteps/s, 1.843 Matom-step/s -99.9% CPU use with 1 MPI tasks x 1 OpenMP threads +Performance: 19062.331 ns/day, 0.001 hours/ns, 2206.288 timesteps/s, 1.906 Matom-step/s +100.0% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 1.3044 | 1.3044 | 1.3044 | 0.0 | 55.66 -Bond | 0.00055276 | 0.00055276 | 0.00055276 | 0.0 | 0.02 -Neigh | 0.27376 | 0.27376 | 0.27376 | 0.0 | 11.68 -Comm | 0.055077 | 0.055077 | 0.055077 | 0.0 | 2.35 -Output | 0.00055401 | 0.00055401 | 0.00055401 | 0.0 | 0.02 -Modify | 0.68502 | 0.68502 | 0.68502 | 0.0 | 29.23 -Other | | 0.02412 | | | 1.03 +Pair | 1.2907 | 1.2907 | 1.2907 | 0.0 | 56.95 +Bond | 0.00032498 | 0.00032498 | 0.00032498 | 0.0 | 0.01 +Neigh | 0.28343 | 0.28343 | 0.28343 | 0.0 | 12.51 +Comm | 0.055491 | 0.055491 | 0.055491 | 0.0 | 2.45 +Output | 8.5614e-05 | 8.5614e-05 | 8.5614e-05 | 0.0 | 0.00 +Modify | 0.61129 | 0.61129 | 0.61129 | 0.0 | 26.97 +Other | | 0.02497 | | | 1.10 Nlocal: 864 ave 864 max 864 min Histogram: 1 0 0 0 0 0 0 0 0 0 @@ -145,8 +122,60 @@ Histogram: 1 0 0 0 0 0 0 0 0 0 Total # of neighbors = 18143 Ave neighs/atom = 20.998843 Ave special neighs/atom = 0 -Neighbor list builds = 257 +Neighbor list builds = 258 Dangerous builds = 0 +fix energies all ave/time 1 20000 20000 c_myKE c_myPE file ave.out -Total wall time: 0:00:02 +run 35000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Per MPI rank memory allocation (min/avg/max) = 6.481 | 6.481 | 6.481 Mbytes + Step Temp E_pair E_mol TotEng Press + 5000 8.4535562 -55.150518 0 -54.207511 318.20862 + 6000 8.4899401 -55.108242 0 -54.161176 331.10703 + 8000 8.3618893 -55.092171 0 -54.15939 334.11831 + 10000 8.8684311 -55.100316 0 -54.111029 334.09931 + 12000 8.4339192 -55.07343 0 -54.132614 340.00487 + 14000 8.072393 -55.115121 0 -54.214633 327.98965 + 16000 8.3420289 -55.077813 0 -54.147247 337.74926 + 18000 8.3803911 -55.12201 0 -54.187164 326.10485 + 20000 8.4676985 -55.176339 0 -54.231754 311.57092 + 22000 8.8560138 -55.110505 0 -54.122603 330.66179 + 24000 8.3187826 -55.120592 0 -54.192619 327.01148 + 26000 8.0327666 -55.116664 0 -54.220596 326.25179 + 28000 8.3672169 -55.130413 0 -54.197037 324.2368 + 30000 8.1669275 -55.057678 0 -54.146645 344.9168 + 32000 8.3819314 -55.08989 0 -54.154873 335.45317 + 34000 8.109088 -55.17222 0 -54.267639 310.83717 + 36000 8.3048574 -55.079475 0 -54.153056 338.04291 + 38000 8.8708544 -55.108991 0 -54.119434 330.70097 + 40000 8.4012779 -55.080817 0 -54.143642 338.54326 +Loop time of 19.3814 on 1 procs for 35000 steps with 864 atoms + +Performance: 15602.554 ns/day, 0.002 hours/ns, 1805.851 timesteps/s, 1.560 Matom-step/s +100.0% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 12.065 | 12.065 | 12.065 | 0.0 | 62.25 +Bond | 0.0021494 | 0.0021494 | 0.0021494 | 0.0 | 0.01 +Neigh | 2.3755 | 2.3755 | 2.3755 | 0.0 | 12.26 +Comm | 0.40916 | 0.40916 | 0.40916 | 0.0 | 2.11 +Output | 0.0004907 | 0.0004907 | 0.0004907 | 0.0 | 0.00 +Modify | 4.3528 | 4.3528 | 4.3528 | 0.0 | 22.46 +Other | | 0.1765 | | | 0.91 + +Nlocal: 864 ave 864 max 864 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1592 ave 1592 max 1592 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 18144 ave 18144 max 18144 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 18144 +Ave neighs/atom = 21 +Ave special neighs/atom = 0 +Neighbor list builds = 2122 +Dangerous builds = 0 +Total wall time: 0:00:21 diff --git a/examples/gjf/log.2Apr25.gjf.vfull.g++.4 b/examples/gjf/log.2Apr25.gjf.vfull.g++.4 index 6d9543c087..454887a106 100644 --- a/examples/gjf/log.2Apr25.gjf.vfull.g++.4 +++ b/examples/gjf/log.2Apr25.gjf.vfull.g++.4 @@ -1,4 +1,4 @@ -LAMMPS (2 Apr 2025 - Development - 4dd8c66390-modified) +LAMMPS (2 Apr 2025 - Development - 09d3ac0a1b-modified) OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:99) using 1 OpenMP thread(s) per MPI task # GJ thermostat @@ -22,7 +22,6 @@ Finding 1-2 1-3 1-4 neighbors ... 1 = max # of special neighbors special bonds CPU = 0.002 seconds read_data CPU = 0.014 seconds - include ff-argon.lmp ############################# #Atoms types - mass - charge# @@ -47,33 +46,33 @@ pair_coeff * * 0.0102701 3.42 velocity all create 10 2357 mom yes dist gaussian - neighbor 1 bin timestep 0.1 -fix lang all langevin/gjf 10 10 1 26488 vel vfull method 4 +compute myKE all ke +compute myPE all pe -thermo 200 +fix lang all langevin/gjf 10 10 1 26488 vel vfull method 1 + +thermo 2000 run 5000 CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE Your simulation uses code contributions which should be cited: -- Langevin GJF methods: doi:10.1007/s10955-024-03345-1 +- Langevin GJ methods: doi:10.1080/00268976.2019.1662506 -@Article{gronbech_jensen_2024, -title = {On the Definition of Velocity in Discrete-Time, Stochastic Langevin Simulations}, -volume = {191}, -number = {10}, -url = {https://doi.org/10.1007/s10955-024-03345-1}, -doi = {10.1007/s10955-024-03345-1}, -urldate = {2024-10-22}, -journal = {J. Stat. Phys.}, -author = {Gronbech-Jensen, Niels}, -year = {2024}, -pages = {137} +@Article{gronbech-jensen_complete_2020, +title = {Complete set of stochastic Verlet-type thermostats for correct Langevin simulations}, +volume = {118}, +number = {8}, +url = {https://www.tandfonline.com/doi/full/10.1080/00268976.2019.1662506}, +doi = {10.1080/00268976.2019.1662506}, +journal = {Molecular Physics}, +author = {Grønbech-Jensen, Niels}, +year = {2020}, } CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE @@ -94,59 +93,89 @@ Neighbor list info ... Per MPI rank memory allocation (min/avg/max) = 6.427 | 6.427 | 6.427 Mbytes Step Temp E_pair E_mol TotEng Press 0 10 -56.207652 0 -55.092137 33.341103 - 200 8.3950866 -55.088994 0 -54.15251 334.90536 - 400 8.6408464 -55.090811 0 -54.126912 335.23135 - 600 8.3101447 -55.121286 0 -54.194277 325.43222 - 800 8.5045003 -55.090513 0 -54.141824 335.05857 - 1000 8.7236378 -55.101455 0 -54.12832 331.96596 - 1200 8.7063561 -55.109371 0 -54.138164 331.62683 - 1400 8.7935957 -55.089763 0 -54.108824 336.89842 - 1600 8.454418 -55.105207 0 -54.162104 330.18927 - 1800 8.7989267 -55.142078 0 -54.160544 322.47021 - 2000 8.7823094 -55.153625 0 -54.173945 318.95028 - 2200 8.6201117 -55.11511 0 -54.153524 329.13488 - 2400 9.1165215 -55.161069 0 -54.144107 318.48524 - 2600 8.7636341 -55.142401 0 -54.164805 322.46493 - 2800 8.4876731 -55.111528 0 -54.164715 329.66127 - 3000 8.7005957 -55.149445 0 -54.178881 319.92878 - 3200 8.1711364 -55.137611 0 -54.226108 322.83713 - 3400 8.7172512 -55.143449 0 -54.171026 322.68918 - 3600 8.6262526 -55.1002 0 -54.137928 333.02737 - 3800 8.1680259 -55.166423 0 -54.255267 313.66684 - 4000 8.8340067 -55.121759 0 -54.136312 328.58235 - 4200 8.427926 -55.126903 0 -54.186755 324.95528 - 4400 8.6352614 -55.193826 0 -54.23055 307.14392 - 4600 8.7381405 -55.120503 0 -54.14575 327.73985 - 4800 8.3857194 -55.081944 0 -54.146505 337.38629 - 5000 8.1179517 -55.162247 0 -54.256677 314.50176 -Loop time of 2.08834 on 4 procs for 5000 steps with 864 atoms + 2000 8.63533 -55.154093 0 -54.190809 317.34773 + 4000 8.2482881 -55.091551 0 -54.171442 333.83766 + 5000 7.946377 -55.076514 0 -54.190084 337.31999 +Loop time of 2.06641 on 4 procs for 5000 steps with 864 atoms -Performance: 20686.324 ns/day, 0.001 hours/ns, 2394.250 timesteps/s, 2.069 Matom-step/s -63.4% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 20905.811 ns/day, 0.001 hours/ns, 2419.654 timesteps/s, 2.091 Matom-step/s +62.1% CPU use with 4 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.53532 | 0.5439 | 0.54781 | 0.7 | 26.04 -Bond | 0.0006347 | 0.00066042 | 0.00068198 | 0.0 | 0.03 -Neigh | 0.10879 | 0.11194 | 0.118 | 1.1 | 5.36 -Comm | 0.94935 | 0.96017 | 0.97155 | 0.8 | 45.98 -Output | 0.0060135 | 0.006061 | 0.0061217 | 0.1 | 0.29 -Modify | 0.2483 | 0.24911 | 0.25049 | 0.2 | 11.93 -Other | | 0.2165 | | | 10.37 +Pair | 0.53593 | 0.54393 | 0.55031 | 0.7 | 26.32 +Bond | 0.0004435 | 0.00052388 | 0.000586 | 0.0 | 0.03 +Neigh | 0.10844 | 0.11152 | 0.11687 | 1.0 | 5.40 +Comm | 0.94337 | 0.94742 | 0.94979 | 0.3 | 45.85 +Output | 0.00076423 | 0.00077499 | 0.00078949 | 0.0 | 0.04 +Modify | 0.24993 | 0.25116 | 0.25286 | 0.2 | 12.15 +Other | | 0.2111 | | | 10.21 Nlocal: 216 ave 216 max 216 min Histogram: 4 0 0 0 0 0 0 0 0 0 -Nghost: 884.25 ave 892 max 875 min -Histogram: 1 1 0 0 0 0 0 0 0 2 -Neighs: 4535.5 ave 4737 max 4333 min +Nghost: 884.75 ave 885 max 884 min +Histogram: 1 0 0 0 0 0 0 0 0 3 +Neighs: 4536 ave 4737 max 4335 min Histogram: 2 0 0 0 0 0 0 0 0 2 -Total # of neighbors = 18142 -Ave neighs/atom = 20.997685 +Total # of neighbors = 18144 +Ave neighs/atom = 21 Ave special neighs/atom = 0 -Neighbor list builds = 280 +Neighbor list builds = 273 Dangerous builds = 0 +fix energies all ave/time 1 20000 20000 c_myKE c_myPE file ave.out -Total wall time: 0:00:02 +run 35000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Per MPI rank memory allocation (min/avg/max) = 6.428 | 6.428 | 6.428 Mbytes + Step Temp E_pair E_mol TotEng Press + 5000 7.946377 -55.076514 0 -54.190084 337.31999 + 6000 8.2565866 -55.129244 0 -54.208209 324.57967 + 8000 7.9942397 -55.101417 0 -54.209648 331.24127 + 10000 8.5413968 -55.083292 0 -54.130486 337.82599 + 12000 8.3682078 -55.090905 0 -54.157419 335.08066 + 14000 8.5082065 -55.085051 0 -54.135948 336.2765 + 16000 8.1944037 -55.090733 0 -54.176635 334.03786 + 18000 8.2607106 -55.030131 0 -54.108637 352.49892 + 20000 8.1154691 -55.104072 0 -54.198779 330.14203 + 22000 8.5592601 -55.152019 0 -54.197221 318.03507 + 24000 8.3182914 -55.115242 0 -54.187324 328.46084 + 26000 8.3691375 -55.125275 0 -54.191685 325.43673 + 28000 8.531632 -55.107097 0 -54.155381 331.42771 + 30000 8.1102222 -55.099011 0 -54.194304 332.04678 + 32000 8.5558571 -55.077016 0 -54.122598 339.87746 + 34000 8.4213946 -55.097068 0 -54.157649 333.34935 + 36000 8.0936615 -55.152202 0 -54.249342 316.20169 + 38000 7.999652 -55.048407 0 -54.156034 345.07945 + 40000 8.6699753 -55.087634 0 -54.120485 337.23709 +Loop time of 17.4329 on 4 procs for 35000 steps with 864 atoms + +Performance: 17346.528 ns/day, 0.001 hours/ns, 2007.700 timesteps/s, 1.735 Matom-step/s +65.5% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 5.1129 | 5.1423 | 5.1581 | 0.8 | 29.50 +Bond | 0.0029266 | 0.0034929 | 0.0038279 | 0.6 | 0.02 +Neigh | 0.85004 | 0.87543 | 0.90992 | 2.4 | 5.02 +Comm | 6.6875 | 6.6993 | 6.7123 | 0.4 | 38.43 +Output | 0.0043725 | 0.0045522 | 0.005017 | 0.4 | 0.03 +Modify | 3.2524 | 3.2579 | 3.2677 | 0.3 | 18.69 +Other | | 1.45 | | | 8.32 + +Nlocal: 216 ave 222 max 210 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Nghost: 905.5 ave 911 max 899 min +Histogram: 1 1 0 0 0 0 0 0 0 2 +Neighs: 4535.75 ave 4837 max 4218 min +Histogram: 1 0 0 1 0 0 1 0 0 1 + +Total # of neighbors = 18143 +Ave neighs/atom = 20.998843 +Ave special neighs/atom = 0 +Neighbor list builds = 2140 +Dangerous builds = 0 +Total wall time: 0:00:19 diff --git a/examples/gjf/log.2Apr25.gjf.vhalf.g++.1 b/examples/gjf/log.2Apr25.gjf.vhalf.g++.1 index fed8f271e5..5d07985f1c 100644 --- a/examples/gjf/log.2Apr25.gjf.vhalf.g++.1 +++ b/examples/gjf/log.2Apr25.gjf.vhalf.g++.1 @@ -1,4 +1,4 @@ -LAMMPS (2 Apr 2025 - Development - 4dd8c66390-modified) +LAMMPS (2 Apr 2025 - Development - 09d3ac0a1b-modified) OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:99) using 1 OpenMP thread(s) per MPI task # GJ thermostat @@ -21,8 +21,7 @@ Finding 1-2 1-3 1-4 neighbors ... 0 = max # of 1-4 neighbors 1 = max # of special neighbors special bonds CPU = 0.000 seconds - read_data CPU = 0.008 seconds - + read_data CPU = 0.007 seconds include ff-argon.lmp ############################# #Atoms types - mass - charge# @@ -47,33 +46,32 @@ pair_coeff * * 0.0102701 3.42 velocity all create 10 2357 mom yes dist gaussian - neighbor 1 bin timestep 0.1 +compute myKE all ke +compute myPE all pe + fix lang all langevin/gjf 10 10 1 26488 -thermo 200 run 5000 CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE Your simulation uses code contributions which should be cited: -- Langevin GJF methods: doi:10.1007/s10955-024-03345-1 +- Langevin GJ methods: doi:10.1080/00268976.2019.1662506 -@Article{gronbech_jensen_2024, -title = {On the Definition of Velocity in Discrete-Time, Stochastic Langevin Simulations}, -volume = {191}, -number = {10}, -url = {https://doi.org/10.1007/s10955-024-03345-1}, -doi = {10.1007/s10955-024-03345-1}, -urldate = {2024-10-22}, -journal = {J. Stat. Phys.}, -author = {Gronbech-Jensen, Niels}, -year = {2024}, -pages = {137} +@Article{gronbech-jensen_complete_2020, +title = {Complete set of stochastic Verlet-type thermostats for correct Langevin simulations}, +volume = {118}, +number = {8}, +url = {https://www.tandfonline.com/doi/full/10.1080/00268976.2019.1662506}, +doi = {10.1080/00268976.2019.1662506}, +journal = {Molecular Physics}, +author = {Grønbech-Jensen, Niels}, +year = {2020}, } CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE @@ -94,46 +92,22 @@ Neighbor list info ... Per MPI rank memory allocation (min/avg/max) = 6.481 | 6.481 | 6.481 Mbytes Step Temp E_pair E_mol TotEng Press 0 10 -56.207652 0 -55.092137 33.341103 - 200 9.8808461 -55.073599 0 -53.971376 345.62224 - 400 9.8712816 -55.072241 0 -53.971084 345.11909 - 600 10.528988 -55.066736 0 -53.892211 350.60112 - 800 10.167171 -55.148312 0 -54.014149 324.73698 - 1000 10.029026 -55.125705 0 -54.006952 331.93785 - 1200 9.8898479 -55.086642 0 -53.983414 342.04309 - 1400 10.610014 -55.076793 0 -53.89323 346.34338 - 1600 9.9402137 -55.111688 0 -54.002842 335.04779 - 1800 9.8078801 -55.140475 0 -54.046391 325.88652 - 2000 10.472791 -55.06102 0 -53.892765 349.97306 - 2200 9.877248 -55.191201 0 -54.089379 312.77421 - 2400 9.9739487 -55.108904 0 -53.996295 335.9089 - 2600 10.131803 -55.149444 0 -54.019226 325.44115 - 2800 9.6980127 -55.118395 0 -54.036568 331.2097 - 3000 9.7193425 -55.149785 0 -54.065577 323.32384 - 3200 10.27638 -55.083302 0 -53.936957 342.56458 - 3400 9.9253941 -55.082368 0 -53.975175 342.28594 - 3600 10.665862 -55.056774 0 -53.866981 352.03551 - 3800 10.011077 -55.084664 0 -53.967913 341.45122 - 4000 9.4182671 -55.128803 0 -54.078181 327.81846 - 4200 10.02466 -55.106046 0 -53.98778 336.56944 - 4400 9.3721033 -55.146068 0 -54.100596 322.38199 - 4600 9.5485537 -55.118577 0 -54.053421 332.04274 - 4800 10.039726 -55.074068 0 -53.954122 344.76817 5000 9.7731898 -55.150518 0 -54.060304 322.94195 -Loop time of 2.28614 on 1 procs for 5000 steps with 864 atoms +Loop time of 2.32188 on 1 procs for 5000 steps with 864 atoms -Performance: 18896.448 ns/day, 0.001 hours/ns, 2187.089 timesteps/s, 1.890 Matom-step/s -100.0% CPU use with 1 MPI tasks x 1 OpenMP threads +Performance: 18605.621 ns/day, 0.001 hours/ns, 2153.428 timesteps/s, 1.861 Matom-step/s +99.8% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 1.2918 | 1.2918 | 1.2918 | 0.0 | 56.51 -Bond | 0.00048345 | 0.00048345 | 0.00048345 | 0.0 | 0.02 -Neigh | 0.2776 | 0.2776 | 0.2776 | 0.0 | 12.14 -Comm | 0.055375 | 0.055375 | 0.055375 | 0.0 | 2.42 -Output | 0.00054609 | 0.00054609 | 0.00054609 | 0.0 | 0.02 -Modify | 0.63625 | 0.63625 | 0.63625 | 0.0 | 27.83 -Other | | 0.02408 | | | 1.05 +Pair | 1.3154 | 1.3154 | 1.3154 | 0.0 | 56.65 +Bond | 0.00030719 | 0.00030719 | 0.00030719 | 0.0 | 0.01 +Neigh | 0.28939 | 0.28939 | 0.28939 | 0.0 | 12.46 +Comm | 0.055279 | 0.055279 | 0.055279 | 0.0 | 2.38 +Output | 4.3714e-05 | 4.3714e-05 | 4.3714e-05 | 0.0 | 0.00 +Modify | 0.63675 | 0.63675 | 0.63675 | 0.0 | 27.42 +Other | | 0.02471 | | | 1.06 Nlocal: 864 ave 864 max 864 min Histogram: 1 0 0 0 0 0 0 0 0 0 @@ -148,5 +122,58 @@ Ave special neighs/atom = 0 Neighbor list builds = 258 Dangerous builds = 0 +fix energies all ave/time 1 20000 20000 c_myKE c_myPE file ave.out -Total wall time: 0:00:02 +thermo 2000 +run 35000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Per MPI rank memory allocation (min/avg/max) = 6.481 | 6.481 | 6.481 Mbytes + Step Temp E_pair E_mol TotEng Press + 5000 9.7731898 -55.150518 0 -54.060304 322.94195 + 6000 10.024842 -55.108242 0 -53.989956 336.6125 + 8000 10.118994 -55.092171 0 -53.963382 340.42078 + 10000 10.541359 -55.100316 0 -53.924412 340.09986 + 12000 10.023234 -55.07343 0 -53.955323 345.70551 + 14000 9.5912018 -55.115121 0 -54.045208 333.43739 + 16000 9.9450498 -55.077813 0 -53.968428 343.49906 + 18000 10.113744 -55.12201 0 -53.993806 332.32214 + 20000 9.9345204 -55.176339 0 -54.068128 316.83219 + 22000 10.585719 -55.110505 0 -53.929652 336.86599 + 24000 10.024757 -55.120592 0 -54.002315 333.13056 + 26000 9.7787474 -55.116664 0 -54.02583 332.51437 + 28000 9.6092087 -55.130413 0 -54.058491 328.69165 + 30000 9.8245787 -55.057678 0 -53.961731 350.86255 + 32000 10.066994 -55.08989 0 -53.966902 341.49724 + 34000 9.5677059 -55.17222 0 -54.104928 316.06902 + 36000 9.7252627 -55.079475 0 -53.994608 343.13769 + 38000 10.438984 -55.108991 0 -53.944506 336.32562 + 40000 10.238268 -55.080817 0 -53.938723 345.13228 +Loop time of 19.5673 on 1 procs for 35000 steps with 864 atoms + +Performance: 15454.339 ns/day, 0.002 hours/ns, 1788.697 timesteps/s, 1.545 Matom-step/s +99.9% CPU use with 1 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 12.065 | 12.065 | 12.065 | 0.0 | 61.66 +Bond | 0.002157 | 0.002157 | 0.002157 | 0.0 | 0.01 +Neigh | 2.384 | 2.384 | 2.384 | 0.0 | 12.18 +Comm | 0.40912 | 0.40912 | 0.40912 | 0.0 | 2.09 +Output | 0.00050573 | 0.00050573 | 0.00050573 | 0.0 | 0.00 +Modify | 4.5321 | 4.5321 | 4.5321 | 0.0 | 23.16 +Other | | 0.1749 | | | 0.89 + +Nlocal: 864 ave 864 max 864 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Nghost: 1592 ave 1592 max 1592 min +Histogram: 1 0 0 0 0 0 0 0 0 0 +Neighs: 18144 ave 18144 max 18144 min +Histogram: 1 0 0 0 0 0 0 0 0 0 + +Total # of neighbors = 18144 +Ave neighs/atom = 21 +Ave special neighs/atom = 0 +Neighbor list builds = 2122 +Dangerous builds = 0 +Total wall time: 0:00:21 diff --git a/examples/gjf/log.2Apr25.gjf.vhalf.g++.4 b/examples/gjf/log.2Apr25.gjf.vhalf.g++.4 index aa90fb779b..cac135e578 100644 --- a/examples/gjf/log.2Apr25.gjf.vhalf.g++.4 +++ b/examples/gjf/log.2Apr25.gjf.vhalf.g++.4 @@ -1,4 +1,4 @@ -LAMMPS (2 Apr 2025 - Development - 4dd8c66390-modified) +LAMMPS (2 Apr 2025 - Development - 09d3ac0a1b-modified) OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:99) using 1 OpenMP thread(s) per MPI task # GJ thermostat @@ -22,7 +22,6 @@ Finding 1-2 1-3 1-4 neighbors ... 1 = max # of special neighbors special bonds CPU = 0.002 seconds read_data CPU = 0.014 seconds - include ff-argon.lmp ############################# #Atoms types - mass - charge# @@ -47,33 +46,32 @@ pair_coeff * * 0.0102701 3.42 velocity all create 10 2357 mom yes dist gaussian - neighbor 1 bin timestep 0.1 +compute myKE all ke +compute myPE all pe + fix lang all langevin/gjf 10 10 1 26488 -thermo 200 run 5000 CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE Your simulation uses code contributions which should be cited: -- Langevin GJF methods: doi:10.1007/s10955-024-03345-1 +- Langevin GJ methods: doi:10.1080/00268976.2019.1662506 -@Article{gronbech_jensen_2024, -title = {On the Definition of Velocity in Discrete-Time, Stochastic Langevin Simulations}, -volume = {191}, -number = {10}, -url = {https://doi.org/10.1007/s10955-024-03345-1}, -doi = {10.1007/s10955-024-03345-1}, -urldate = {2024-10-22}, -journal = {J. Stat. Phys.}, -author = {Gronbech-Jensen, Niels}, -year = {2024}, -pages = {137} +@Article{gronbech-jensen_complete_2020, +title = {Complete set of stochastic Verlet-type thermostats for correct Langevin simulations}, +volume = {118}, +number = {8}, +url = {https://www.tandfonline.com/doi/full/10.1080/00268976.2019.1662506}, +doi = {10.1080/00268976.2019.1662506}, +journal = {Molecular Physics}, +author = {Grønbech-Jensen, Niels}, +year = {2020}, } CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE @@ -94,46 +92,22 @@ Neighbor list info ... Per MPI rank memory allocation (min/avg/max) = 6.427 | 6.427 | 6.427 Mbytes Step Temp E_pair E_mol TotEng Press 0 10 -56.207652 0 -55.092137 33.341103 - 200 9.8046819 -55.12733 0 -54.033603 329.70683 - 400 10.174622 -55.092357 0 -53.957363 340.4935 - 600 9.6157634 -55.174205 0 -54.101552 316.68047 - 800 9.9617862 -55.097525 0 -53.986273 339.257 - 1000 10.373198 -55.116484 0 -53.959338 335.09796 - 1200 10.064779 -55.17366 0 -54.050919 318.66487 - 1400 10.562182 -55.067856 0 -53.889628 349.23452 - 1600 9.7696935 -55.081542 0 -53.991718 342.92593 - 1800 10.454466 -55.130637 0 -53.964426 330.88658 - 2000 10.253701 -55.154093 0 -54.010277 323.15259 - 2200 9.6688957 -55.143479 0 -54.064899 325.16815 - 2400 10.059787 -55.134941 0 -54.012756 329.83534 - 2600 9.9050905 -55.096231 0 -53.991303 338.94947 - 2800 9.663551 -55.130202 0 -54.052218 328.77571 - 3000 9.950484 -55.123447 0 -54.013455 332.00143 - 3200 9.7210637 -55.120005 0 -54.035606 331.39812 - 3400 9.6457139 -55.080953 0 -54.004959 341.95838 - 3600 10.42249 -55.102379 0 -53.939734 339.66808 - 3800 10.276893 -55.126271 0 -53.979868 332.40943 - 4000 10.135481 -55.091551 0 -53.960922 340.60675 - 4200 10.129209 -55.084189 0 -53.95426 343.39315 - 4400 10.006953 -55.120704 0 -54.004413 331.57121 - 4600 10.497483 -55.144898 0 -53.973888 327.22996 - 4800 9.9230954 -55.126028 0 -54.019091 330.70489 5000 9.3726166 -55.076514 0 -54.030985 342.43571 -Loop time of 2.0887 on 4 procs for 5000 steps with 864 atoms +Loop time of 2.09273 on 4 procs for 5000 steps with 864 atoms -Performance: 20682.713 ns/day, 0.001 hours/ns, 2393.833 timesteps/s, 2.068 Matom-step/s -62.5% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 20642.908 ns/day, 0.001 hours/ns, 2389.226 timesteps/s, 2.064 Matom-step/s +62.7% CPU use with 4 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.53905 | 0.54518 | 0.5484 | 0.5 | 26.10 -Bond | 0.00062355 | 0.00066183 | 0.0007207 | 0.0 | 0.03 -Neigh | 0.10715 | 0.10937 | 0.11212 | 0.5 | 5.24 -Comm | 0.94637 | 0.95041 | 0.95905 | 0.5 | 45.50 -Output | 0.0061059 | 0.0061286 | 0.0061661 | 0.0 | 0.29 -Modify | 0.26086 | 0.26355 | 0.26979 | 0.7 | 12.62 -Other | | 0.2134 | | | 10.22 +Pair | 0.53092 | 0.54173 | 0.55017 | 1.0 | 25.89 +Bond | 0.00049283 | 0.00052862 | 0.00057217 | 0.0 | 0.03 +Neigh | 0.10693 | 0.11084 | 0.1158 | 1.0 | 5.30 +Comm | 0.95622 | 0.96088 | 0.96553 | 0.4 | 45.92 +Output | 0.00027302 | 0.00027645 | 0.00028114 | 0.0 | 0.01 +Modify | 0.2615 | 0.26289 | 0.2635 | 0.2 | 12.56 +Other | | 0.2156 | | | 10.30 Nlocal: 216 ave 216 max 216 min Histogram: 4 0 0 0 0 0 0 0 0 0 @@ -148,5 +122,58 @@ Ave special neighs/atom = 0 Neighbor list builds = 273 Dangerous builds = 0 +fix energies all ave/time 1 20000 20000 c_myKE c_myPE file ave.out -Total wall time: 0:00:02 +thermo 2000 +run 35000 +Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule +Per MPI rank memory allocation (min/avg/max) = 6.428 | 6.428 | 6.428 Mbytes + Step Temp E_pair E_mol TotEng Press + 5000 9.3726166 -55.076514 0 -54.030985 342.43571 + 6000 9.6911866 -55.129244 0 -54.048177 329.72537 + 8000 9.7296551 -55.101417 0 -54.016059 337.46595 + 10000 10.098808 -55.083292 0 -53.956755 343.4122 + 12000 10.114344 -55.090905 0 -53.962635 341.3438 + 14000 10.230012 -55.085051 0 -53.943878 342.45237 + 16000 9.5989709 -55.090733 0 -54.019954 339.07584 + 18000 10.016071 -55.030131 0 -53.912824 358.79514 + 20000 9.7197057 -55.104072 0 -54.019824 335.89619 + 22000 9.959647 -55.152019 0 -54.041005 323.05805 + 24000 10.075138 -55.115242 0 -53.991345 334.76239 + 26000 10.227192 -55.125275 0 -53.984416 332.10131 + 28000 10.177109 -55.107097 0 -53.971825 337.32979 + 30000 9.521036 -55.099011 0 -54.036925 337.10716 + 32000 10.265633 -55.077016 0 -53.93187 346.01018 + 34000 10.173978 -55.097068 0 -53.962146 339.63562 + 36000 9.6032778 -55.152202 0 -54.080942 321.61646 + 38000 9.8802995 -55.048407 0 -53.946245 351.82506 + 40000 10.372288 -55.087634 0 -53.93059 343.34304 +Loop time of 17.6209 on 4 procs for 35000 steps with 864 atoms + +Performance: 17161.415 ns/day, 0.001 hours/ns, 1986.275 timesteps/s, 1.716 Matom-step/s +64.2% CPU use with 4 MPI tasks x 1 OpenMP threads + +MPI task timing breakdown: +Section | min time | avg time | max time |%varavg| %total +--------------------------------------------------------------- +Pair | 5.0439 | 5.1029 | 5.1534 | 2.0 | 28.96 +Bond | 0.0031373 | 0.0034925 | 0.0038794 | 0.5 | 0.02 +Neigh | 0.84082 | 0.87558 | 0.91665 | 3.0 | 4.97 +Comm | 6.7337 | 6.7936 | 6.8487 | 1.6 | 38.55 +Output | 0.0044073 | 0.004559 | 0.0049773 | 0.4 | 0.03 +Modify | 3.3556 | 3.3647 | 3.3722 | 0.3 | 19.10 +Other | | 1.476 | | | 8.38 + +Nlocal: 216 ave 222 max 210 min +Histogram: 2 0 0 0 0 0 0 0 0 2 +Nghost: 905.5 ave 911 max 899 min +Histogram: 1 1 0 0 0 0 0 0 0 2 +Neighs: 4535.75 ave 4837 max 4218 min +Histogram: 1 0 0 1 0 0 1 0 0 1 + +Total # of neighbors = 18143 +Ave neighs/atom = 20.998843 +Ave special neighs/atom = 0 +Neighbor list builds = 2140 +Dangerous builds = 0 +Total wall time: 0:00:19 diff --git a/src/EXTRA-FIX/fix_langevin_gjf.cpp b/src/EXTRA-FIX/fix_langevin_gjf.cpp index c00fbb9ee5..ea0e75c598 100644 --- a/src/EXTRA-FIX/fix_langevin_gjf.cpp +++ b/src/EXTRA-FIX/fix_langevin_gjf.cpp @@ -139,7 +139,7 @@ FixLangevinGJF::FixLangevinGJF(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg], "method") == 0) { GJmethod = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); - if (GJmethod = 7) { + if (GJmethod == 7) { if (iarg + 3 > narg) error->all(FLERR, "Illegal fix langevin/gjf command for GJ-VII"); gjfc2 = utils::numeric(FLERR, arg[iarg + 2], false, lmp); if (gjfc2 < 0 || gjfc2 > 1) error->all(FLERR, "Choice of c2 in GJ-VII must be 0≤c2≤1"); @@ -149,7 +149,7 @@ FixLangevinGJF::FixLangevinGJF(LAMMPS *lmp, int narg, char **arg) : else { if (iarg + 2 > narg) error->all(FLERR, "Illegal fix langevin/gjf command"); if (GJmethod < 0 || GJmethod > GJmethods) error->all(FLERR, "Invalid GJ method choice in langevin/gjf command"); - if (GJmethod = 8) if (lmp->citeme) lmp->citeme->add(cite_langevin_gjf_8); + if (GJmethod == 8) if (lmp->citeme) lmp->citeme->add(cite_langevin_gjf_8); iarg += 2; } } else From 648cd3f0c6a7a54d3eb99173dab1e707d978674e Mon Sep 17 00:00:00 2001 From: talinke Date: Tue, 22 Apr 2025 17:43:21 -0700 Subject: [PATCH 09/17] Temperature bias capability --- examples/gjf/README | 32 +++--- examples/gjf/in.gjf.vfull | 4 +- examples/gjf/in.gjf.vhalf | 2 +- examples/gjf/log.2Apr25.gjf.vfull.g++.1 | 50 ++++---- examples/gjf/log.2Apr25.gjf.vfull.g++.4 | 50 ++++---- examples/gjf/log.2Apr25.gjf.vhalf.g++.1 | 59 ++++++---- examples/gjf/log.2Apr25.gjf.vhalf.g++.4 | 61 ++++++---- src/EXTRA-FIX/fix_langevin_gjf.cpp | 145 +++++++++++++++++------- src/EXTRA-FIX/fix_langevin_gjf.h | 2 +- 9 files changed, 242 insertions(+), 163 deletions(-) diff --git a/examples/gjf/README b/examples/gjf/README index b98e4134ab..34b60292bb 100644 --- a/examples/gjf/README +++ b/examples/gjf/README @@ -15,23 +15,23 @@ with the correct Boltzmann statistics. A comparison using averaged properties from this example's input file is shown below. 'X' denotes a failed simulation. The theoretical value for KE is 1.1168 eV. -KINETIC ENERGY (eV) -| Δt || 0.01 | 0.05 | 0.10 | 0.11 | 0.12 | 0.13 | 0.14 | -|==============||========|========|========|========|========|========|========| -| gjf half || 1.117 | 1.116 | 1.119 | 1.119 | 1.123 | 1.136 | 1.170 | -| gjf full || 1.116 | 1.071 | 0.938 | 0.898 | 0.858 | 0.817 | 0.780 | -| langevin || 1.110 | 1.113 | 1.121 | 1.129 | 1.157 | X | X | -| nvt || 1.083 | 1.109 | 1.112 | 1.113 | 1.114 | X | X | -|--------------||--------|--------|--------|--------|--------|--------|--------| - POTENTIAL ENERGY (eV) -| Δt || 0.01 | 0.05 | 0.10 | 0.11 | 0.12 | 0.13 | 0.14 | -|==============||========|========|========|========|========|========|========| -| gjf half || -55.11 | -55.11 | -55.11 | -55.11 | -55.11 | -55.10 | -55.07 | -| gjf full || -55.11 | -55.11 | -55.11 | -55.11 | -55.11 | -55.10 | -55.07 | -| langevin || -55.11 | -55.07 | -54.87 | -54.79 | -54.65 | X | X | -| nvt || -55.14 | -55.07 | -54.90 | -54.84 | -54.76 | X | X | -|--------------||--------|--------|--------|--------|--------|--------|--------| +| Δt || 0.01 | 0.05 | 0.10 | 0.11 | 0.12 | 0.13 | 0.14 | +|===================||========|========|========|========|========|========|========| +| gjf half || -55.11 | -55.11 | -55.11 | -55.11 | -55.11 | -55.10 | -55.07 | +| gjf full || -55.11 | -55.11 | -55.11 | -55.11 | -55.11 | -55.10 | -55.07 | +| langevin || -55.11 | -55.07 | -54.87 | -54.79 | -54.65 | X | X | +| nvt (Nose-Hoover) || -55.14 | -55.07 | -54.90 | -54.84 | -54.76 | X | X | +|-------------------||--------|--------|--------|--------|--------|--------|--------| + +KINETIC ENERGY (eV) +| Δt || 0.01 | 0.05 | 0.10 | 0.11 | 0.12 | 0.13 | 0.14 | +|===================||========|========|========|========|========|========|========| +| gjf half || 1.117 | 1.116 | 1.119 | 1.119 | 1.123 | 1.136 | 1.170 | +| gjf full || 1.116 | 1.071 | 0.938 | 0.898 | 0.858 | 0.817 | 0.780 | +| langevin || 1.110 | 1.113 | 1.121 | 1.129 | 1.157 | X | X | +| nvt (Nose-Hoover) || 1.083 | 1.109 | 1.112 | 1.113 | 1.114 | X | X | +|-------------------||--------|--------|--------|--------|--------|--------|--------| Script Commands: diff --git a/examples/gjf/in.gjf.vfull b/examples/gjf/in.gjf.vfull index 127b8fef87..c36a5b0690 100644 --- a/examples/gjf/in.gjf.vfull +++ b/examples/gjf/in.gjf.vfull @@ -17,9 +17,9 @@ compute myPE all pe fix lang all langevin/gjf 10 10 1 26488 vel vfull method 1 -thermo 2000 run 5000 -fix energies all ave/time 1 20000 20000 c_myKE c_myPE file ave.out +fix energies all ave/time 1 20000 20000 c_myKE c_myPE #file ave.out +thermo 2000 run 35000 \ No newline at end of file diff --git a/examples/gjf/in.gjf.vhalf b/examples/gjf/in.gjf.vhalf index ba805d693a..0635998954 100644 --- a/examples/gjf/in.gjf.vhalf +++ b/examples/gjf/in.gjf.vhalf @@ -19,7 +19,7 @@ fix lang all langevin/gjf 10 10 1 26488 run 5000 -fix energies all ave/time 1 20000 20000 c_myKE c_myPE file ave.out +fix energies all ave/time 1 20000 20000 c_myKE c_myPE #file ave.out thermo 2000 run 35000 \ No newline at end of file diff --git a/examples/gjf/log.2Apr25.gjf.vfull.g++.1 b/examples/gjf/log.2Apr25.gjf.vfull.g++.1 index 30a0f7e9c9..3bb204704b 100644 --- a/examples/gjf/log.2Apr25.gjf.vfull.g++.1 +++ b/examples/gjf/log.2Apr25.gjf.vfull.g++.1 @@ -1,4 +1,4 @@ -LAMMPS (2 Apr 2025 - Development - 09d3ac0a1b-modified) +LAMMPS (2 Apr 2025 - Development - e4c3b0c05e-modified) OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:99) using 1 OpenMP thread(s) per MPI task # GJ thermostat @@ -55,7 +55,6 @@ compute myPE all pe fix lang all langevin/gjf 10 10 1 26488 vel vfull method 1 -thermo 2000 run 5000 CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE @@ -72,7 +71,7 @@ url = {https://www.tandfonline.com/doi/full/10.1080/00268976.2019.1662506}, doi = {10.1080/00268976.2019.1662506}, journal = {Molecular Physics}, author = {Grønbech-Jensen, Niels}, -year = {2020}, +year = {2020} } CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE @@ -93,24 +92,22 @@ Neighbor list info ... Per MPI rank memory allocation (min/avg/max) = 6.481 | 6.481 | 6.481 Mbytes Step Temp E_pair E_mol TotEng Press 0 10 -56.207652 0 -55.092137 33.341103 - 2000 8.5329244 -55.06102 0 -54.10916 343.01505 - 4000 7.8165794 -55.128803 0 -54.256851 322.07344 5000 8.4535562 -55.150518 0 -54.207511 318.20862 -Loop time of 2.26625 on 1 procs for 5000 steps with 864 atoms +Loop time of 2.32365 on 1 procs for 5000 steps with 864 atoms -Performance: 19062.331 ns/day, 0.001 hours/ns, 2206.288 timesteps/s, 1.906 Matom-step/s -100.0% CPU use with 1 MPI tasks x 1 OpenMP threads +Performance: 18591.401 ns/day, 0.001 hours/ns, 2151.782 timesteps/s, 1.859 Matom-step/s +99.9% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 1.2907 | 1.2907 | 1.2907 | 0.0 | 56.95 -Bond | 0.00032498 | 0.00032498 | 0.00032498 | 0.0 | 0.01 -Neigh | 0.28343 | 0.28343 | 0.28343 | 0.0 | 12.51 -Comm | 0.055491 | 0.055491 | 0.055491 | 0.0 | 2.45 -Output | 8.5614e-05 | 8.5614e-05 | 8.5614e-05 | 0.0 | 0.00 -Modify | 0.61129 | 0.61129 | 0.61129 | 0.0 | 26.97 -Other | | 0.02497 | | | 1.10 +Pair | 1.3067 | 1.3067 | 1.3067 | 0.0 | 56.23 +Bond | 0.00027472 | 0.00027472 | 0.00027472 | 0.0 | 0.01 +Neigh | 0.28218 | 0.28218 | 0.28218 | 0.0 | 12.14 +Comm | 0.057388 | 0.057388 | 0.057388 | 0.0 | 2.47 +Output | 5.6019e-05 | 5.6019e-05 | 5.6019e-05 | 0.0 | 0.00 +Modify | 0.65159 | 0.65159 | 0.65159 | 0.0 | 28.04 +Other | | 0.02549 | | | 1.10 Nlocal: 864 ave 864 max 864 min Histogram: 1 0 0 0 0 0 0 0 0 0 @@ -125,8 +122,9 @@ Ave special neighs/atom = 0 Neighbor list builds = 258 Dangerous builds = 0 -fix energies all ave/time 1 20000 20000 c_myKE c_myPE file ave.out +fix energies all ave/time 1 20000 20000 c_myKE c_myPE #file ave.out +thermo 2000 run 35000 Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule Per MPI rank memory allocation (min/avg/max) = 6.481 | 6.481 | 6.481 Mbytes @@ -150,21 +148,21 @@ Per MPI rank memory allocation (min/avg/max) = 6.481 | 6.481 | 6.481 Mbytes 36000 8.3048574 -55.079475 0 -54.153056 338.04291 38000 8.8708544 -55.108991 0 -54.119434 330.70097 40000 8.4012779 -55.080817 0 -54.143642 338.54326 -Loop time of 19.3814 on 1 procs for 35000 steps with 864 atoms +Loop time of 19.3834 on 1 procs for 35000 steps with 864 atoms -Performance: 15602.554 ns/day, 0.002 hours/ns, 1805.851 timesteps/s, 1.560 Matom-step/s -100.0% CPU use with 1 MPI tasks x 1 OpenMP threads +Performance: 15601.000 ns/day, 0.002 hours/ns, 1805.671 timesteps/s, 1.560 Matom-step/s +99.9% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 12.065 | 12.065 | 12.065 | 0.0 | 62.25 -Bond | 0.0021494 | 0.0021494 | 0.0021494 | 0.0 | 0.01 -Neigh | 2.3755 | 2.3755 | 2.3755 | 0.0 | 12.26 -Comm | 0.40916 | 0.40916 | 0.40916 | 0.0 | 2.11 -Output | 0.0004907 | 0.0004907 | 0.0004907 | 0.0 | 0.00 -Modify | 4.3528 | 4.3528 | 4.3528 | 0.0 | 22.46 -Other | | 0.1765 | | | 0.91 +Pair | 11.828 | 11.828 | 11.828 | 0.0 | 61.02 +Bond | 0.0024424 | 0.0024424 | 0.0024424 | 0.0 | 0.01 +Neigh | 2.3519 | 2.3519 | 2.3519 | 0.0 | 12.13 +Comm | 0.42251 | 0.42251 | 0.42251 | 0.0 | 2.18 +Output | 0.00056686 | 0.00056686 | 0.00056686 | 0.0 | 0.00 +Modify | 4.5987 | 4.5987 | 4.5987 | 0.0 | 23.73 +Other | | 0.1793 | | | 0.93 Nlocal: 864 ave 864 max 864 min Histogram: 1 0 0 0 0 0 0 0 0 0 diff --git a/examples/gjf/log.2Apr25.gjf.vfull.g++.4 b/examples/gjf/log.2Apr25.gjf.vfull.g++.4 index 454887a106..4c6fe82e54 100644 --- a/examples/gjf/log.2Apr25.gjf.vfull.g++.4 +++ b/examples/gjf/log.2Apr25.gjf.vfull.g++.4 @@ -1,4 +1,4 @@ -LAMMPS (2 Apr 2025 - Development - 09d3ac0a1b-modified) +LAMMPS (2 Apr 2025 - Development - e4c3b0c05e-modified) OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:99) using 1 OpenMP thread(s) per MPI task # GJ thermostat @@ -55,7 +55,6 @@ compute myPE all pe fix lang all langevin/gjf 10 10 1 26488 vel vfull method 1 -thermo 2000 run 5000 CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE @@ -72,7 +71,7 @@ url = {https://www.tandfonline.com/doi/full/10.1080/00268976.2019.1662506}, doi = {10.1080/00268976.2019.1662506}, journal = {Molecular Physics}, author = {Grønbech-Jensen, Niels}, -year = {2020}, +year = {2020} } CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE @@ -93,24 +92,22 @@ Neighbor list info ... Per MPI rank memory allocation (min/avg/max) = 6.427 | 6.427 | 6.427 Mbytes Step Temp E_pair E_mol TotEng Press 0 10 -56.207652 0 -55.092137 33.341103 - 2000 8.63533 -55.154093 0 -54.190809 317.34773 - 4000 8.2482881 -55.091551 0 -54.171442 333.83766 5000 7.946377 -55.076514 0 -54.190084 337.31999 -Loop time of 2.06641 on 4 procs for 5000 steps with 864 atoms +Loop time of 2.0791 on 4 procs for 5000 steps with 864 atoms -Performance: 20905.811 ns/day, 0.001 hours/ns, 2419.654 timesteps/s, 2.091 Matom-step/s -62.1% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 20778.210 ns/day, 0.001 hours/ns, 2404.885 timesteps/s, 2.078 Matom-step/s +64.9% CPU use with 4 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.53593 | 0.54393 | 0.55031 | 0.7 | 26.32 -Bond | 0.0004435 | 0.00052388 | 0.000586 | 0.0 | 0.03 -Neigh | 0.10844 | 0.11152 | 0.11687 | 1.0 | 5.40 -Comm | 0.94337 | 0.94742 | 0.94979 | 0.3 | 45.85 -Output | 0.00076423 | 0.00077499 | 0.00078949 | 0.0 | 0.04 -Modify | 0.24993 | 0.25116 | 0.25286 | 0.2 | 12.15 -Other | | 0.2111 | | | 10.21 +Pair | 0.52985 | 0.53809 | 0.54586 | 0.8 | 25.88 +Bond | 0.00054599 | 0.00057676 | 0.00061668 | 0.0 | 0.03 +Neigh | 0.10872 | 0.10965 | 0.11044 | 0.2 | 5.27 +Comm | 0.95581 | 0.96284 | 0.97025 | 0.5 | 46.31 +Output | 0.00027472 | 0.00028374 | 0.00029435 | 0.0 | 0.01 +Modify | 0.25077 | 0.25198 | 0.2529 | 0.2 | 12.12 +Other | | 0.2157 | | | 10.37 Nlocal: 216 ave 216 max 216 min Histogram: 4 0 0 0 0 0 0 0 0 0 @@ -125,8 +122,9 @@ Ave special neighs/atom = 0 Neighbor list builds = 273 Dangerous builds = 0 -fix energies all ave/time 1 20000 20000 c_myKE c_myPE file ave.out +fix energies all ave/time 1 20000 20000 c_myKE c_myPE #file ave.out +thermo 2000 run 35000 Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule Per MPI rank memory allocation (min/avg/max) = 6.428 | 6.428 | 6.428 Mbytes @@ -150,21 +148,21 @@ Per MPI rank memory allocation (min/avg/max) = 6.428 | 6.428 | 6.428 Mbytes 36000 8.0936615 -55.152202 0 -54.249342 316.20169 38000 7.999652 -55.048407 0 -54.156034 345.07945 40000 8.6699753 -55.087634 0 -54.120485 337.23709 -Loop time of 17.4329 on 4 procs for 35000 steps with 864 atoms +Loop time of 17.5212 on 4 procs for 35000 steps with 864 atoms -Performance: 17346.528 ns/day, 0.001 hours/ns, 2007.700 timesteps/s, 1.735 Matom-step/s -65.5% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 17259.111 ns/day, 0.001 hours/ns, 1997.582 timesteps/s, 1.726 Matom-step/s +63.6% CPU use with 4 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 5.1129 | 5.1423 | 5.1581 | 0.8 | 29.50 -Bond | 0.0029266 | 0.0034929 | 0.0038279 | 0.6 | 0.02 -Neigh | 0.85004 | 0.87543 | 0.90992 | 2.4 | 5.02 -Comm | 6.6875 | 6.6993 | 6.7123 | 0.4 | 38.43 -Output | 0.0043725 | 0.0045522 | 0.005017 | 0.4 | 0.03 -Modify | 3.2524 | 3.2579 | 3.2677 | 0.3 | 18.69 -Other | | 1.45 | | | 8.32 +Pair | 4.9924 | 5.0801 | 5.1446 | 2.4 | 28.99 +Bond | 0.0041975 | 0.0044234 | 0.0046863 | 0.3 | 0.03 +Neigh | 0.85805 | 0.86369 | 0.87021 | 0.5 | 4.93 +Comm | 6.7339 | 6.8008 | 6.8891 | 2.1 | 38.81 +Output | 0.0044786 | 0.0046306 | 0.0050572 | 0.4 | 0.03 +Modify | 3.2849 | 3.2919 | 3.2981 | 0.3 | 18.79 +Other | | 1.476 | | | 8.42 Nlocal: 216 ave 222 max 210 min Histogram: 2 0 0 0 0 0 0 0 0 2 diff --git a/examples/gjf/log.2Apr25.gjf.vhalf.g++.1 b/examples/gjf/log.2Apr25.gjf.vhalf.g++.1 index 5d07985f1c..7ea6355b64 100644 --- a/examples/gjf/log.2Apr25.gjf.vhalf.g++.1 +++ b/examples/gjf/log.2Apr25.gjf.vhalf.g++.1 @@ -1,4 +1,4 @@ -LAMMPS (2 Apr 2025 - Development - 09d3ac0a1b-modified) +LAMMPS (2 Apr 2025 - Development - e4c3b0c05e-modified) OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:99) using 1 OpenMP thread(s) per MPI task # GJ thermostat @@ -21,7 +21,7 @@ Finding 1-2 1-3 1-4 neighbors ... 0 = max # of 1-4 neighbors 1 = max # of special neighbors special bonds CPU = 0.000 seconds - read_data CPU = 0.007 seconds + read_data CPU = 0.012 seconds include ff-argon.lmp ############################# #Atoms types - mass - charge# @@ -71,7 +71,20 @@ url = {https://www.tandfonline.com/doi/full/10.1080/00268976.2019.1662506}, doi = {10.1080/00268976.2019.1662506}, journal = {Molecular Physics}, author = {Grønbech-Jensen, Niels}, -year = {2020}, +year = {2020} +} + +- Langevin GJ-I vhalf method: doi:10.1080/00268976.2019.1570369 + +@Article{jensen_accurate_2019, +title = {Accurate configurational and kinetic statistics in discrete-time Langevin systems}, +volume = {117}, +url = {https://www.tandfonline.com/doi/full/10.1080/00268976.2019.1570369}, +doi = {10.1080/00268976.2019.1570369}, +number = {18}, +journal = {Molecular Physics}, +author = {Jensen, Lucas Frese Grønbech and Grønbech-Jensen, Niels}, +year = {2019} } CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE @@ -93,21 +106,21 @@ Per MPI rank memory allocation (min/avg/max) = 6.481 | 6.481 | 6.481 Mbytes Step Temp E_pair E_mol TotEng Press 0 10 -56.207652 0 -55.092137 33.341103 5000 9.7731898 -55.150518 0 -54.060304 322.94195 -Loop time of 2.32188 on 1 procs for 5000 steps with 864 atoms +Loop time of 2.33802 on 1 procs for 5000 steps with 864 atoms -Performance: 18605.621 ns/day, 0.001 hours/ns, 2153.428 timesteps/s, 1.861 Matom-step/s -99.8% CPU use with 1 MPI tasks x 1 OpenMP threads +Performance: 18477.199 ns/day, 0.001 hours/ns, 2138.565 timesteps/s, 1.848 Matom-step/s +99.6% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 1.3154 | 1.3154 | 1.3154 | 0.0 | 56.65 -Bond | 0.00030719 | 0.00030719 | 0.00030719 | 0.0 | 0.01 -Neigh | 0.28939 | 0.28939 | 0.28939 | 0.0 | 12.46 -Comm | 0.055279 | 0.055279 | 0.055279 | 0.0 | 2.38 -Output | 4.3714e-05 | 4.3714e-05 | 4.3714e-05 | 0.0 | 0.00 -Modify | 0.63675 | 0.63675 | 0.63675 | 0.0 | 27.42 -Other | | 0.02471 | | | 1.06 +Pair | 1.3074 | 1.3074 | 1.3074 | 0.0 | 55.92 +Bond | 0.00028207 | 0.00028207 | 0.00028207 | 0.0 | 0.01 +Neigh | 0.27625 | 0.27625 | 0.27625 | 0.0 | 11.82 +Comm | 0.056554 | 0.056554 | 0.056554 | 0.0 | 2.42 +Output | 5.3527e-05 | 5.3527e-05 | 5.3527e-05 | 0.0 | 0.00 +Modify | 0.67274 | 0.67274 | 0.67274 | 0.0 | 28.77 +Other | | 0.02477 | | | 1.06 Nlocal: 864 ave 864 max 864 min Histogram: 1 0 0 0 0 0 0 0 0 0 @@ -122,7 +135,7 @@ Ave special neighs/atom = 0 Neighbor list builds = 258 Dangerous builds = 0 -fix energies all ave/time 1 20000 20000 c_myKE c_myPE file ave.out +fix energies all ave/time 1 20000 20000 c_myKE c_myPE #file ave.out thermo 2000 run 35000 @@ -148,21 +161,21 @@ Per MPI rank memory allocation (min/avg/max) = 6.481 | 6.481 | 6.481 Mbytes 36000 9.7252627 -55.079475 0 -53.994608 343.13769 38000 10.438984 -55.108991 0 -53.944506 336.32562 40000 10.238268 -55.080817 0 -53.938723 345.13228 -Loop time of 19.5673 on 1 procs for 35000 steps with 864 atoms +Loop time of 19.4518 on 1 procs for 35000 steps with 864 atoms -Performance: 15454.339 ns/day, 0.002 hours/ns, 1788.697 timesteps/s, 1.545 Matom-step/s +Performance: 15546.156 ns/day, 0.002 hours/ns, 1799.324 timesteps/s, 1.555 Matom-step/s 99.9% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 12.065 | 12.065 | 12.065 | 0.0 | 61.66 -Bond | 0.002157 | 0.002157 | 0.002157 | 0.0 | 0.01 -Neigh | 2.384 | 2.384 | 2.384 | 0.0 | 12.18 -Comm | 0.40912 | 0.40912 | 0.40912 | 0.0 | 2.09 -Output | 0.00050573 | 0.00050573 | 0.00050573 | 0.0 | 0.00 -Modify | 4.5321 | 4.5321 | 4.5321 | 0.0 | 23.16 -Other | | 0.1749 | | | 0.89 +Pair | 11.789 | 11.789 | 11.789 | 0.0 | 60.61 +Bond | 0.0022933 | 0.0022933 | 0.0022933 | 0.0 | 0.01 +Neigh | 2.3359 | 2.3359 | 2.3359 | 0.0 | 12.01 +Comm | 0.4146 | 0.4146 | 0.4146 | 0.0 | 2.13 +Output | 0.0005505 | 0.0005505 | 0.0005505 | 0.0 | 0.00 +Modify | 4.7341 | 4.7341 | 4.7341 | 0.0 | 24.34 +Other | | 0.1749 | | | 0.90 Nlocal: 864 ave 864 max 864 min Histogram: 1 0 0 0 0 0 0 0 0 0 diff --git a/examples/gjf/log.2Apr25.gjf.vhalf.g++.4 b/examples/gjf/log.2Apr25.gjf.vhalf.g++.4 index cac135e578..088fa73044 100644 --- a/examples/gjf/log.2Apr25.gjf.vhalf.g++.4 +++ b/examples/gjf/log.2Apr25.gjf.vhalf.g++.4 @@ -1,4 +1,4 @@ -LAMMPS (2 Apr 2025 - Development - 09d3ac0a1b-modified) +LAMMPS (2 Apr 2025 - Development - e4c3b0c05e-modified) OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:99) using 1 OpenMP thread(s) per MPI task # GJ thermostat @@ -21,7 +21,7 @@ Finding 1-2 1-3 1-4 neighbors ... 0 = max # of 1-4 neighbors 1 = max # of special neighbors special bonds CPU = 0.002 seconds - read_data CPU = 0.014 seconds + read_data CPU = 0.015 seconds include ff-argon.lmp ############################# #Atoms types - mass - charge# @@ -71,7 +71,20 @@ url = {https://www.tandfonline.com/doi/full/10.1080/00268976.2019.1662506}, doi = {10.1080/00268976.2019.1662506}, journal = {Molecular Physics}, author = {Grønbech-Jensen, Niels}, -year = {2020}, +year = {2020} +} + +- Langevin GJ-I vhalf method: doi:10.1080/00268976.2019.1570369 + +@Article{jensen_accurate_2019, +title = {Accurate configurational and kinetic statistics in discrete-time Langevin systems}, +volume = {117}, +url = {https://www.tandfonline.com/doi/full/10.1080/00268976.2019.1570369}, +doi = {10.1080/00268976.2019.1570369}, +number = {18}, +journal = {Molecular Physics}, +author = {Jensen, Lucas Frese Grønbech and Grønbech-Jensen, Niels}, +year = {2019} } CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE @@ -93,21 +106,21 @@ Per MPI rank memory allocation (min/avg/max) = 6.427 | 6.427 | 6.427 Mbytes Step Temp E_pair E_mol TotEng Press 0 10 -56.207652 0 -55.092137 33.341103 5000 9.3726166 -55.076514 0 -54.030985 342.43571 -Loop time of 2.09273 on 4 procs for 5000 steps with 864 atoms +Loop time of 2.09482 on 4 procs for 5000 steps with 864 atoms -Performance: 20642.908 ns/day, 0.001 hours/ns, 2389.226 timesteps/s, 2.064 Matom-step/s -62.7% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 20622.269 ns/day, 0.001 hours/ns, 2386.837 timesteps/s, 2.062 Matom-step/s +64.9% CPU use with 4 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.53092 | 0.54173 | 0.55017 | 1.0 | 25.89 -Bond | 0.00049283 | 0.00052862 | 0.00057217 | 0.0 | 0.03 -Neigh | 0.10693 | 0.11084 | 0.1158 | 1.0 | 5.30 -Comm | 0.95622 | 0.96088 | 0.96553 | 0.4 | 45.92 -Output | 0.00027302 | 0.00027645 | 0.00028114 | 0.0 | 0.01 -Modify | 0.2615 | 0.26289 | 0.2635 | 0.2 | 12.56 -Other | | 0.2156 | | | 10.30 +Pair | 0.5344 | 0.54263 | 0.54877 | 0.8 | 25.90 +Bond | 0.00049036 | 0.00055513 | 0.00061267 | 0.0 | 0.03 +Neigh | 0.10741 | 0.10898 | 0.11004 | 0.3 | 5.20 +Comm | 0.95869 | 0.96388 | 0.96936 | 0.4 | 46.01 +Output | 0.00025982 | 0.00026553 | 0.00026761 | 0.0 | 0.01 +Modify | 0.26091 | 0.26108 | 0.26137 | 0.0 | 12.46 +Other | | 0.2174 | | | 10.38 Nlocal: 216 ave 216 max 216 min Histogram: 4 0 0 0 0 0 0 0 0 0 @@ -122,7 +135,7 @@ Ave special neighs/atom = 0 Neighbor list builds = 273 Dangerous builds = 0 -fix energies all ave/time 1 20000 20000 c_myKE c_myPE file ave.out +fix energies all ave/time 1 20000 20000 c_myKE c_myPE #file ave.out thermo 2000 run 35000 @@ -148,21 +161,21 @@ Per MPI rank memory allocation (min/avg/max) = 6.428 | 6.428 | 6.428 Mbytes 36000 9.6032778 -55.152202 0 -54.080942 321.61646 38000 9.8802995 -55.048407 0 -53.946245 351.82506 40000 10.372288 -55.087634 0 -53.93059 343.34304 -Loop time of 17.6209 on 4 procs for 35000 steps with 864 atoms +Loop time of 17.6294 on 4 procs for 35000 steps with 864 atoms -Performance: 17161.415 ns/day, 0.001 hours/ns, 1986.275 timesteps/s, 1.716 Matom-step/s -64.2% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 17153.172 ns/day, 0.001 hours/ns, 1985.321 timesteps/s, 1.715 Matom-step/s +63.7% CPU use with 4 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 5.0439 | 5.1029 | 5.1534 | 2.0 | 28.96 -Bond | 0.0031373 | 0.0034925 | 0.0038794 | 0.5 | 0.02 -Neigh | 0.84082 | 0.87558 | 0.91665 | 3.0 | 4.97 -Comm | 6.7337 | 6.7936 | 6.8487 | 1.6 | 38.55 -Output | 0.0044073 | 0.004559 | 0.0049773 | 0.4 | 0.03 -Modify | 3.3556 | 3.3647 | 3.3722 | 0.3 | 19.10 -Other | | 1.476 | | | 8.38 +Pair | 5.0222 | 5.1025 | 5.1759 | 2.5 | 28.94 +Bond | 0.0040066 | 0.0042899 | 0.0045178 | 0.3 | 0.02 +Neigh | 0.8511 | 0.85865 | 0.86632 | 0.6 | 4.87 +Comm | 6.7448 | 6.8089 | 6.8793 | 1.8 | 38.62 +Output | 0.0043966 | 0.0045518 | 0.0049846 | 0.4 | 0.03 +Modify | 3.364 | 3.3672 | 3.3717 | 0.2 | 19.10 +Other | | 1.483 | | | 8.41 Nlocal: 216 ave 222 max 210 min Histogram: 2 0 0 0 0 0 0 0 0 2 diff --git a/src/EXTRA-FIX/fix_langevin_gjf.cpp b/src/EXTRA-FIX/fix_langevin_gjf.cpp index ea0e75c598..73ab2a852f 100644 --- a/src/EXTRA-FIX/fix_langevin_gjf.cpp +++ b/src/EXTRA-FIX/fix_langevin_gjf.cpp @@ -41,7 +41,6 @@ using namespace FixConst; enum { NOBIAS, BIAS }; enum { CONSTANT, EQUAL, ATOM }; - static const char cite_langevin_gjf[] = "Langevin GJ methods: doi:10.1080/00268976.2019.1662506\n\n" "@Article{gronbech-jensen_complete_2020,\n" @@ -52,7 +51,7 @@ static const char cite_langevin_gjf[] = "doi = {10.1080/00268976.2019.1662506},\n" "journal = {Molecular Physics},\n" "author = {Grønbech-Jensen, Niels},\n" - "year = {2020},\n" + "year = {2020}\n" "}\n\n"; static const char cite_langevin_gjf_7[] = @@ -63,7 +62,6 @@ static const char cite_langevin_gjf_7[] = "number = {18},\n" "url = {https://doi.org/10.1063/5.0066008},\n" "doi = {10.1063/5.0066008},\n" - "urldate = {2021-11-14},\n" "journal = {J. Chem. Phys.},\n" "author = {Finkelstein, Joshua and Cheng, Chungho and Fiorin, Giacomo and Seibold, Benjamin and Grønbech-Jensen, Niels},\n" "year = {2021},\n" @@ -78,12 +76,24 @@ static const char cite_langevin_gjf_8[] = "number = {10},\n" "url = {https://doi.org/10.1007/s10955-024-03345-1},\n" "doi = {10.1007/s10955-024-03345-1},\n" - "urldate = {2024-10-22},\n" "journal = {J. Stat. Phys.},\n" "author = {Gronbech-Jensen, Niels},\n" "year = {2024},\n" "pages = {137}\n" "}\n\n"; + +static const char cite_langevin_gjf_vhalf[] = + "Langevin GJ-I vhalf method: doi:10.1080/00268976.2019.1570369\n\n" + "@Article{jensen_accurate_2019,\n" + "title = {Accurate configurational and kinetic statistics in discrete-time Langevin systems},\n" + "volume = {117},\n" + "url = {https://www.tandfonline.com/doi/full/10.1080/00268976.2019.1570369},\n" + "doi = {10.1080/00268976.2019.1570369},\n" + "number = {18},\n" + "journal = {Molecular Physics},\n" + "author = {Jensen, Lucas Frese Grønbech and Grønbech-Jensen, Niels},\n" + "year = {2019}\n" + "}\n\n"; /* ---------------------------------------------------------------------- */ @@ -155,6 +165,7 @@ FixLangevinGJF::FixLangevinGJF(LAMMPS *lmp, int narg, char **arg) : } else error->all(FLERR, "Illegal fix langevin/gjf command"); } + if (GJmethod == 1 && osflag == 0) if (lmp->citeme) lmp->citeme->add(cite_langevin_gjf_vhalf); // set temperature = nullptr, user can override via fix_modify if wants bias id_temp = nullptr; @@ -236,6 +247,11 @@ void FixLangevinGJF::init() error->all(FLERR, "Fix langevin/gjf and run style respa are not compatible"); } + if (temperature && temperature->tempbias) + tbiasflag = BIAS; + else + tbiasflag = NOBIAS; + // Complete set of thermostats is given in Gronbech-Jensen, Molecular Physics, 118 (2020) switch (GJmethod) { case 1: @@ -320,58 +336,95 @@ void FixLangevinGJF::initial_integrate(int /* vflag */) } compute_target(); + if (tbiasflag) temperature->compute_scalar(); - for (int i = 0; i < nlocal; i++) { - if (mask[i] & groupbit) { - - if (tstyle == ATOM) tsqrt = sqrt(tforce[i]); - if (rmass) { + if (rmass) { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + if (tstyle == ATOM) tsqrt = sqrt(tforce[i]); m = rmass[i]; beta = tsqrt * sqrt(2.0*dt*m*boltz/t_period/mvv2e) / ftm2v; - } else { + + fran[0] = beta*random->gaussian(); + fran[1] = beta*random->gaussian(); + fran[2] = beta*random->gaussian(); + + // First integration delivers Eq. 24a and 24b: + dtfm = dtf / m; + v[i][0] += csq * dtfm * f[i][0]; + v[i][1] += csq * dtfm * f[i][1]; + v[i][2] += csq * dtfm * f[i][2]; + x[i][0] += 0.5 * csq * dt * v[i][0]; + x[i][1] += 0.5 * csq * dt * v[i][1]; + x[i][2] += 0.5 * csq * dt * v[i][2]; + + if (tbiasflag) temperature->remove_bias(i, v[i]); + + // Calculate Eq. 24c: + lv[i][0] = c1sqrt*v[i][0] + ftm2v * (c3sqrt / (2.0 * m)) * fran[0]; + lv[i][1] = c1sqrt*v[i][1] + ftm2v * (c3sqrt / (2.0 * m)) * fran[1]; + lv[i][2] = c1sqrt*v[i][2] + ftm2v * (c3sqrt / (2.0 * m)) * fran[2]; + + // Calculate Eq. 24d + v[i][0] = (gjfc2 / c1sqrt) * lv[i][0] + ftm2v * csq * (0.5 / m) * fran[0]; + v[i][1] = (gjfc2 / c1sqrt) * lv[i][1] + ftm2v * csq * (0.5 / m) * fran[1]; + v[i][2] = (gjfc2 / c1sqrt) * lv[i][2] + ftm2v * csq * (0.5 / m) * fran[2]; + + if (tbiasflag) temperature->restore_bias(i, v[i]); + if (tbiasflag) temperature->restore_bias(i, lv[i]); + + // Calculate Eq. 24e. Final integrator then calculates Eq. 24f after force update. + x[i][0] += 0.5 * csq * dt * v[i][0]; + x[i][1] += 0.5 * csq * dt * v[i][1]; + x[i][2] += 0.5 * csq * dt * v[i][2]; + } + } + } else { + for (int i = 0; i < nlocal; i++) { + if (mask[i] & groupbit) { + if (tstyle == ATOM) tsqrt = sqrt(tforce[i]); m = mass[type[i]]; beta = tsqrt * sqrt(2.0*dt*m*boltz/t_period/mvv2e) / ftm2v; + + fran[0] = beta*random->gaussian(); + fran[1] = beta*random->gaussian(); + fran[2] = beta*random->gaussian(); + + // First integration delivers Eq. 24a and 24b: + dtfm = dtf / m; + v[i][0] += csq * dtfm * f[i][0]; + v[i][1] += csq * dtfm * f[i][1]; + v[i][2] += csq * dtfm * f[i][2]; + x[i][0] += 0.5 * csq * dt * v[i][0]; + x[i][1] += 0.5 * csq * dt * v[i][1]; + x[i][2] += 0.5 * csq * dt * v[i][2]; + + if (tbiasflag) temperature->remove_bias(i, v[i]); + + // Calculate Eq. 24c: + lv[i][0] = c1sqrt*v[i][0] + ftm2v * (c3sqrt / (2.0 * m)) * fran[0]; + lv[i][1] = c1sqrt*v[i][1] + ftm2v * (c3sqrt / (2.0 * m)) * fran[1]; + lv[i][2] = c1sqrt*v[i][2] + ftm2v * (c3sqrt / (2.0 * m)) * fran[2]; + + // Calculate Eq. 24d + v[i][0] = (gjfc2 / c1sqrt) * lv[i][0] + ftm2v * csq * (0.5 / m) * fran[0]; + v[i][1] = (gjfc2 / c1sqrt) * lv[i][1] + ftm2v * csq * (0.5 / m) * fran[1]; + v[i][2] = (gjfc2 / c1sqrt) * lv[i][2] + ftm2v * csq * (0.5 / m) * fran[2]; + + if (tbiasflag) temperature->restore_bias(i, v[i]); + if (tbiasflag) temperature->restore_bias(i, lv[i]); + + // Calculate Eq. 24e. Final integrator then calculates Eq. 24f after force update. + x[i][0] += 0.5 * csq * dt * v[i][0]; + x[i][1] += 0.5 * csq * dt * v[i][1]; + x[i][2] += 0.5 * csq * dt * v[i][2]; } - - fran[0] = beta*random->gaussian(); - fran[1] = beta*random->gaussian(); - fran[2] = beta*random->gaussian(); - - // First integration delivers Eq. 24a and 24b: - dtfm = dtf / m; - v[i][0] += csq * dtfm * f[i][0]; - v[i][1] += csq * dtfm * f[i][1]; - v[i][2] += csq * dtfm * f[i][2]; - x[i][0] += 0.5 * csq * dt * v[i][0]; - x[i][1] += 0.5 * csq * dt * v[i][1]; - x[i][2] += 0.5 * csq * dt * v[i][2]; - - // Calculate Eq. 24c: - lv[i][0] = c1sqrt*v[i][0] + ftm2v * (c3sqrt / (2.0 * m)) * fran[0]; - lv[i][1] = c1sqrt*v[i][1] + ftm2v * (c3sqrt / (2.0 * m)) * fran[1]; - lv[i][2] = c1sqrt*v[i][2] + ftm2v * (c3sqrt / (2.0 * m)) * fran[2]; - - // Calculate Eq. 24d - v[i][0] = (gjfc2 / c1sqrt) * lv[i][0] + ftm2v * csq * (0.5 / m) * fran[0]; - v[i][1] = (gjfc2 / c1sqrt) * lv[i][1] + ftm2v * csq * (0.5 / m) * fran[1]; - v[i][2] = (gjfc2 / c1sqrt) * lv[i][2] + ftm2v * csq * (0.5 / m) * fran[2]; - - // Calculate Eq. 24e. Final integrator then calculates Eq. 24f after force update. - x[i][0] += 0.5 * csq * dt * v[i][0]; - x[i][1] += 0.5 * csq * dt * v[i][1]; - x[i][2] += 0.5 * csq * dt * v[i][2]; } } } void FixLangevinGJF::final_integrate() { - double dtfm; - double dt = update->dt; - double ftm2v = force->ftm2v; - double dtf = 0.5 * dt * ftm2v; - double csq = sqrt(gjfc3 / gjfc1); - double **v = atom->v; double **f = atom->f; double *rmass = atom->rmass; @@ -381,6 +434,10 @@ void FixLangevinGJF::final_integrate() int nlocal = atom->nlocal; if (igroup == atom->firstgroup) nlocal = atom->nfirst; + double dtfm; + double dtf = 0.5 * update->dt * force->ftm2v; + double csq = sqrt(gjfc3 / gjfc1); + // Calculate Eq. 24f. if (rmass) { for (int i = 0; i < nlocal; i++) diff --git a/src/EXTRA-FIX/fix_langevin_gjf.h b/src/EXTRA-FIX/fix_langevin_gjf.h index 4b65051cf5..45ccf4cbe2 100644 --- a/src/EXTRA-FIX/fix_langevin_gjf.h +++ b/src/EXTRA-FIX/fix_langevin_gjf.h @@ -44,7 +44,7 @@ class FixLangevinGJF : public Fix { int unpack_exchange(int, double *) override; protected: - int osflag, GJmethod, maxatom, lv_allocated; + int osflag, tbiasflag, GJmethod, maxatom, lv_allocated; double t_start, t_stop, t_period, t_target, tsqrt; double gjfc1, gjfc2, gjfc3; int tstyle, tvar; From 11f6b3483bfe4f958c6568830bc09f8c705c1592 Mon Sep 17 00:00:00 2001 From: talinke Date: Mon, 28 Apr 2025 13:02:47 -0700 Subject: [PATCH 10/17] Updated documentation, updated log files --- doc/src/fix_langevin_gjf.rst | 66 +++++++++++++------------ examples/gjf/log.2Apr25.gjf.vfull.g++.1 | 58 +++++++++++++--------- examples/gjf/log.2Apr25.gjf.vfull.g++.4 | 56 +++++++++++++-------- src/EXTRA-FIX/fix_langevin_gjf.cpp | 16 +++++- 4 files changed, 120 insertions(+), 76 deletions(-) diff --git a/doc/src/fix_langevin_gjf.rst b/doc/src/fix_langevin_gjf.rst index a1fcea9c9a..623c1e4d59 100644 --- a/doc/src/fix_langevin_gjf.rst +++ b/doc/src/fix_langevin_gjf.rst @@ -26,6 +26,7 @@ Syntax *vhalf* = use half-step velocity *method* value = *1-8* *1-8* = choose one of the many GJ formulations + *7* = requires input of additional scalar between 0 and 1 Examples """""""" @@ -34,32 +35,34 @@ Examples fix 3 boundary langevin/gjf 10.0 10.0 1.0 699483 fix 1 all langevin/gjf 10.0 100.0 100.0 48279 vel vfull method 4 + fix 2 all langevin/gjf 10.0 10.0 1.0 26488 method 7 0.95 Description """"""""""" -Apply a Langevin thermostat as described in :ref:`(Gronbech-Jensen-2024) ` +Apply a Langevin thermostat as described in :ref:`(Gronbech-Jensen-2020) ` to a group of atoms which models an interaction with a background -implicit solvent. As described in the papers cited below, the purpose of this method is to -enable longer timesteps to be used (up to the numerical stability -limit of the integrator), while still producing the correct Boltzmann -distribution of atom positions. +implicit solvent. As described in the papers cited below, the GJ methods +provide exact diffusion, drift, and Boltzmann sampling for linear systems for +any time step within the stability limit. The purpose of this set of methods +is therefore to significantly improve statistical accuracy at longer time steps +compared to other thermostats. The current implementation provides the user with the option to output -the velocity in one of two forms: *vfull* or *vhalf*. The option *vfull* outputs the -on-site velocity given in :ref:`Gronbech-Jensen/Farago +the velocity in one of two forms: *vfull* or *vhalf*. The option *vhalf* +outputs the 2GJ half-step velocity given in :ref:`Gronbech Jensen/Gronbech-Jensen +`; for linear systems, this velocity is shown to not +have any statistical errors for any stable time step. The option *vfull* +outputs the on-site velocity given in :ref:`Gronbech-Jensen/Farago `; this velocity is shown to be systematically lower than the target temperature by a small amount, which grows -quadratically with the timestep. The option *vhalf* outputs the -2GJ half-step velocity given in :ref:`Gronbech Jensen/Gronbech-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 -:ref:`Gronbech-Jensen-2020 `. +quadratically with the timestep. An overview of statistically correct Boltzmann +and Maxwell-Boltzmann sampling of true on-site and true half-step velocities is +given in :ref:`Gronbech-Jensen-2020 `. -This fix allows the use of any of the GJ methods as listed in :ref:`Gronbech-Jensen-2020 `. -The GJ-VII method is described in :ref:`Finkelstein `. +This fix allows the use of several GJ methods as listed in :ref:`Gronbech-Jensen-2020 `. +The GJ-VII method is described in :ref:`Finkelstein ` and GJ-VIII +is described in :ref:`Gronbech-Jensen-2024 `. The implementation follows the splitting form provided in Eqs. (24) and (25) in :ref:`Gronbech-Jensen-2024 `, including the application of Gaussian noise values, per the description in @@ -129,13 +132,11 @@ different numbers of processors. The keyword/value option pairs are used in the following ways. -The keyword *vel* determine which velocity is used to determine +The keyword *vel* determines which velocity is used to determine quantities of interest in the simulation. The keyword *method* selects one of the eight GJ-methods implemented in LAMMPS. -*Insert brief explanation for each method* - ---------- Restart, fix_modify, output, run start/stop, minimize info @@ -146,9 +147,10 @@ Because the state of the random number generator is not saved in restart files, this means you cannot do "exact" restarts with this fix, where the simulation continues on the same as if no restart had taken place. However, in a statistical sense, a restarted simulation should produce the same behavior. -The "exact" restart is done with either vfull or vhalf velocity output for as -long as the choice of vfull/vhalf is the same for the simulation as it is in -the restart file. +additionally, the GJ methods implement noise exclusively within each time step +(unlike the BBK thermostat of the fix-langevin). The restart is done with +either vfull or vhalf velocity output for as long as the choice of vfull/vhalf +is the same for the simulation as it is in the restart file. The :doc:`fix_modify ` *temp* option is supported by this fix. You can use it to assign a temperature :doc:`compute ` @@ -165,7 +167,8 @@ This fix is not invoked during :doc:`energy minimization `. Restrictions """""""""""" -This fix is not compatible with run_style respa. +This fix is not compatible with run_style respa. It is not compatible with +accelerated packages such as KOKKOS. Related commands """""""""""""""" @@ -179,27 +182,26 @@ The option defaults are vel = vhalf, method = 1. ---------- -.. _Gronbech-Jensen-2024: +.. _Gronbech-Jensen-2020: -**(Gronbech-Jensen-2024)** Gronbech-Jensen, J. Stat. Phys. 191, 137 (2024). - -.. _Gronbech-Jensen-Farago: - -**(Gronbech-Jensen/Farago)** Gronbech-Jensen and Farago, Mol Phys, 111, 983 -(2013). +**(Gronbech-Jensen-2020)** Gronbech-Jensen, Mol Phys 118, e1662506 (2020). .. _Gronbech-Jensen-2019: **(Gronbech Jensen/Gronbech-Jensen)** Gronbech Jensen and Gronbech-Jensen, Mol Phys, 117, 2511 (2019) -.. _Gronbech-Jensen-2020: +.. _Gronbech-Jensen-Farago: -**(Gronbech-Jensen-2020)** Gronbech-Jensen, Mol Phys 118, e1662506 (2020). +**(Gronbech-Jensen/Farago)** Gronbech-Jensen and Farago, Mol Phys, 111, 983 (2013). .. _Finkelstein: **(Finkelstein)** Finkelstein, Cheng, Florin, Seibold, Gronbech-Jensen, J. Chem. Phys., 155, 18 (2021) +.. _Gronbech-Jensen-2024: + +**(Gronbech-Jensen-2024)** Gronbech-Jensen, J. Stat. Phys. 191, 137 (2024). + .. _Gronbech-Jensen-2023: **(Gronbech-Jensen-2023)** Gronbech-Jensen, J. Stat. Phys. 190, 96 (2023). diff --git a/examples/gjf/log.2Apr25.gjf.vfull.g++.1 b/examples/gjf/log.2Apr25.gjf.vfull.g++.1 index 3bb204704b..f85c13672d 100644 --- a/examples/gjf/log.2Apr25.gjf.vfull.g++.1 +++ b/examples/gjf/log.2Apr25.gjf.vfull.g++.1 @@ -1,4 +1,4 @@ -LAMMPS (2 Apr 2025 - Development - e4c3b0c05e-modified) +LAMMPS (2 Apr 2025 - Development - 648cd3f0c6-modified) OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:99) using 1 OpenMP thread(s) per MPI task # GJ thermostat @@ -21,7 +21,7 @@ Finding 1-2 1-3 1-4 neighbors ... 0 = max # of 1-4 neighbors 1 = max # of special neighbors special bonds CPU = 0.000 seconds - read_data CPU = 0.007 seconds + read_data CPU = 0.009 seconds include ff-argon.lmp ############################# #Atoms types - mass - charge# @@ -74,6 +74,20 @@ author = {Grønbech-Jensen, Niels}, year = {2020} } +- Langevin GJ-I vfull method: doi:10.1080/00268976.2012.760055 + +@Article{gronbech-jensen_simple_2013, +title = {A simple and effective Verlet-type algorithm for simulating Langevin dynamics}, +volume = {111}, +url = {http://www.tandfonline.com/doi/abs/10.1080/00268976.2012.760055}, +doi = {10.1080/00268976.2012.760055}, +pages = {983-991}, +number = {8}, +journal = {Molecular Physics}, +author = {Grønbech-Jensen, Niels and Farago, Oded}, +year = {2013} +} + CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule @@ -93,21 +107,21 @@ Per MPI rank memory allocation (min/avg/max) = 6.481 | 6.481 | 6.481 Mbytes Step Temp E_pair E_mol TotEng Press 0 10 -56.207652 0 -55.092137 33.341103 5000 8.4535562 -55.150518 0 -54.207511 318.20862 -Loop time of 2.32365 on 1 procs for 5000 steps with 864 atoms +Loop time of 2.27448 on 1 procs for 5000 steps with 864 atoms -Performance: 18591.401 ns/day, 0.001 hours/ns, 2151.782 timesteps/s, 1.859 Matom-step/s -99.9% CPU use with 1 MPI tasks x 1 OpenMP threads +Performance: 18993.378 ns/day, 0.001 hours/ns, 2198.308 timesteps/s, 1.899 Matom-step/s +100.0% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 1.3067 | 1.3067 | 1.3067 | 0.0 | 56.23 -Bond | 0.00027472 | 0.00027472 | 0.00027472 | 0.0 | 0.01 -Neigh | 0.28218 | 0.28218 | 0.28218 | 0.0 | 12.14 -Comm | 0.057388 | 0.057388 | 0.057388 | 0.0 | 2.47 -Output | 5.6019e-05 | 5.6019e-05 | 5.6019e-05 | 0.0 | 0.00 -Modify | 0.65159 | 0.65159 | 0.65159 | 0.0 | 28.04 -Other | | 0.02549 | | | 1.10 +Pair | 1.2877 | 1.2877 | 1.2877 | 0.0 | 56.61 +Bond | 0.00049357 | 0.00049357 | 0.00049357 | 0.0 | 0.02 +Neigh | 0.28068 | 0.28068 | 0.28068 | 0.0 | 12.34 +Comm | 0.055813 | 0.055813 | 0.055813 | 0.0 | 2.45 +Output | 5.5144e-05 | 5.5144e-05 | 5.5144e-05 | 0.0 | 0.00 +Modify | 0.62478 | 0.62478 | 0.62478 | 0.0 | 27.47 +Other | | 0.02499 | | | 1.10 Nlocal: 864 ave 864 max 864 min Histogram: 1 0 0 0 0 0 0 0 0 0 @@ -148,21 +162,21 @@ Per MPI rank memory allocation (min/avg/max) = 6.481 | 6.481 | 6.481 Mbytes 36000 8.3048574 -55.079475 0 -54.153056 338.04291 38000 8.8708544 -55.108991 0 -54.119434 330.70097 40000 8.4012779 -55.080817 0 -54.143642 338.54326 -Loop time of 19.3834 on 1 procs for 35000 steps with 864 atoms +Loop time of 19.0379 on 1 procs for 35000 steps with 864 atoms -Performance: 15601.000 ns/day, 0.002 hours/ns, 1805.671 timesteps/s, 1.560 Matom-step/s -99.9% CPU use with 1 MPI tasks x 1 OpenMP threads +Performance: 15884.146 ns/day, 0.002 hours/ns, 1838.443 timesteps/s, 1.588 Matom-step/s +100.0% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 11.828 | 11.828 | 11.828 | 0.0 | 61.02 -Bond | 0.0024424 | 0.0024424 | 0.0024424 | 0.0 | 0.01 -Neigh | 2.3519 | 2.3519 | 2.3519 | 0.0 | 12.13 -Comm | 0.42251 | 0.42251 | 0.42251 | 0.0 | 2.18 -Output | 0.00056686 | 0.00056686 | 0.00056686 | 0.0 | 0.00 -Modify | 4.5987 | 4.5987 | 4.5987 | 0.0 | 23.73 -Other | | 0.1793 | | | 0.93 +Pair | 11.641 | 11.641 | 11.641 | 0.0 | 61.14 +Bond | 0.003055 | 0.003055 | 0.003055 | 0.0 | 0.02 +Neigh | 2.3613 | 2.3613 | 2.3613 | 0.0 | 12.40 +Comm | 0.41299 | 0.41299 | 0.41299 | 0.0 | 2.17 +Output | 0.00055686 | 0.00055686 | 0.00055686 | 0.0 | 0.00 +Modify | 4.442 | 4.442 | 4.442 | 0.0 | 23.33 +Other | | 0.1775 | | | 0.93 Nlocal: 864 ave 864 max 864 min Histogram: 1 0 0 0 0 0 0 0 0 0 diff --git a/examples/gjf/log.2Apr25.gjf.vfull.g++.4 b/examples/gjf/log.2Apr25.gjf.vfull.g++.4 index 4c6fe82e54..12bc5ca3b2 100644 --- a/examples/gjf/log.2Apr25.gjf.vfull.g++.4 +++ b/examples/gjf/log.2Apr25.gjf.vfull.g++.4 @@ -1,4 +1,4 @@ -LAMMPS (2 Apr 2025 - Development - e4c3b0c05e-modified) +LAMMPS (2 Apr 2025 - Development - 648cd3f0c6-modified) OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:99) using 1 OpenMP thread(s) per MPI task # GJ thermostat @@ -74,6 +74,20 @@ author = {Grønbech-Jensen, Niels}, year = {2020} } +- Langevin GJ-I vfull method: doi:10.1080/00268976.2012.760055 + +@Article{gronbech-jensen_simple_2013, +title = {A simple and effective Verlet-type algorithm for simulating Langevin dynamics}, +volume = {111}, +url = {http://www.tandfonline.com/doi/abs/10.1080/00268976.2012.760055}, +doi = {10.1080/00268976.2012.760055}, +pages = {983-991}, +number = {8}, +journal = {Molecular Physics}, +author = {Grønbech-Jensen, Niels and Farago, Oded}, +year = {2013} +} + CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE Generated 0 of 0 mixed pair_coeff terms from geometric mixing rule @@ -93,21 +107,21 @@ Per MPI rank memory allocation (min/avg/max) = 6.427 | 6.427 | 6.427 Mbytes Step Temp E_pair E_mol TotEng Press 0 10 -56.207652 0 -55.092137 33.341103 5000 7.946377 -55.076514 0 -54.190084 337.31999 -Loop time of 2.0791 on 4 procs for 5000 steps with 864 atoms +Loop time of 2.10015 on 4 procs for 5000 steps with 864 atoms -Performance: 20778.210 ns/day, 0.001 hours/ns, 2404.885 timesteps/s, 2.078 Matom-step/s -64.9% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 20570.001 ns/day, 0.001 hours/ns, 2380.787 timesteps/s, 2.057 Matom-step/s +64.0% CPU use with 4 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.52985 | 0.53809 | 0.54586 | 0.8 | 25.88 -Bond | 0.00054599 | 0.00057676 | 0.00061668 | 0.0 | 0.03 -Neigh | 0.10872 | 0.10965 | 0.11044 | 0.2 | 5.27 -Comm | 0.95581 | 0.96284 | 0.97025 | 0.5 | 46.31 -Output | 0.00027472 | 0.00028374 | 0.00029435 | 0.0 | 0.01 -Modify | 0.25077 | 0.25198 | 0.2529 | 0.2 | 12.12 -Other | | 0.2157 | | | 10.37 +Pair | 0.54244 | 0.54516 | 0.54794 | 0.3 | 25.96 +Bond | 0.00056978 | 0.00065706 | 0.00071013 | 0.0 | 0.03 +Neigh | 0.10885 | 0.11 | 0.11178 | 0.4 | 5.24 +Comm | 0.96848 | 0.97341 | 0.97775 | 0.3 | 46.35 +Output | 0.00028754 | 0.00029437 | 0.00030094 | 0.0 | 0.01 +Modify | 0.25125 | 0.25293 | 0.25477 | 0.3 | 12.04 +Other | | 0.2177 | | | 10.37 Nlocal: 216 ave 216 max 216 min Histogram: 4 0 0 0 0 0 0 0 0 0 @@ -148,21 +162,21 @@ Per MPI rank memory allocation (min/avg/max) = 6.428 | 6.428 | 6.428 Mbytes 36000 8.0936615 -55.152202 0 -54.249342 316.20169 38000 7.999652 -55.048407 0 -54.156034 345.07945 40000 8.6699753 -55.087634 0 -54.120485 337.23709 -Loop time of 17.5212 on 4 procs for 35000 steps with 864 atoms +Loop time of 17.6531 on 4 procs for 35000 steps with 864 atoms -Performance: 17259.111 ns/day, 0.001 hours/ns, 1997.582 timesteps/s, 1.726 Matom-step/s -63.6% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 17130.136 ns/day, 0.001 hours/ns, 1982.655 timesteps/s, 1.713 Matom-step/s +63.9% CPU use with 4 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 4.9924 | 5.0801 | 5.1446 | 2.4 | 28.99 -Bond | 0.0041975 | 0.0044234 | 0.0046863 | 0.3 | 0.03 -Neigh | 0.85805 | 0.86369 | 0.87021 | 0.5 | 4.93 -Comm | 6.7339 | 6.8008 | 6.8891 | 2.1 | 38.81 -Output | 0.0044786 | 0.0046306 | 0.0050572 | 0.4 | 0.03 -Modify | 3.2849 | 3.2919 | 3.2981 | 0.3 | 18.79 -Other | | 1.476 | | | 8.42 +Pair | 5.0485 | 5.078 | 5.11 | 1.0 | 28.77 +Bond | 0.0038244 | 0.0043855 | 0.0047706 | 0.6 | 0.02 +Neigh | 0.8487 | 0.86408 | 0.87685 | 1.1 | 4.89 +Comm | 6.8368 | 6.8833 | 6.9317 | 1.4 | 38.99 +Output | 0.004493 | 0.0045296 | 0.0045945 | 0.1 | 0.03 +Modify | 3.3123 | 3.3253 | 3.3366 | 0.5 | 18.84 +Other | | 1.494 | | | 8.46 Nlocal: 216 ave 222 max 210 min Histogram: 2 0 0 0 0 0 0 0 0 2 diff --git a/src/EXTRA-FIX/fix_langevin_gjf.cpp b/src/EXTRA-FIX/fix_langevin_gjf.cpp index 73ab2a852f..b1637ff54c 100644 --- a/src/EXTRA-FIX/fix_langevin_gjf.cpp +++ b/src/EXTRA-FIX/fix_langevin_gjf.cpp @@ -94,7 +94,20 @@ static const char cite_langevin_gjf_vhalf[] = "author = {Jensen, Lucas Frese Grønbech and Grønbech-Jensen, Niels},\n" "year = {2019}\n" "}\n\n"; - + +static const char cite_langevin_gjf_vfull[] = + "Langevin GJ-I vfull method: doi:10.1080/00268976.2012.760055\n\n" + "@Article{gronbech-jensen_simple_2013,\n" + "title = {A simple and effective Verlet-type algorithm for simulating Langevin dynamics},\n" + "volume = {111},\n" + "url = {http://www.tandfonline.com/doi/abs/10.1080/00268976.2012.760055},\n" + "doi = {10.1080/00268976.2012.760055},\n" + "pages = {983-991},\n" + "number = {8},\n" + "journal = {Molecular Physics},\n" + "author = {Grønbech-Jensen, Niels and Farago, Oded},\n" + "year = {2013}\n" + "}\n\n"; /* ---------------------------------------------------------------------- */ @@ -166,6 +179,7 @@ FixLangevinGJF::FixLangevinGJF(LAMMPS *lmp, int narg, char **arg) : error->all(FLERR, "Illegal fix langevin/gjf command"); } if (GJmethod == 1 && osflag == 0) if (lmp->citeme) lmp->citeme->add(cite_langevin_gjf_vhalf); + if (GJmethod == 1 && osflag == 1) if (lmp->citeme) lmp->citeme->add(cite_langevin_gjf_vfull); // set temperature = nullptr, user can override via fix_modify if wants bias id_temp = nullptr; From fc0788f61c8bdb513c5e3b2e705135fed5564af1 Mon Sep 17 00:00:00 2001 From: talinke Date: Mon, 28 Apr 2025 13:18:33 -0700 Subject: [PATCH 11/17] Styling --- doc/src/fix_langevin_gjf.rst | 24 ++++++++++++------------ src/EXTRA-FIX/fix_langevin_gjf.cpp | 30 +++++++++++++++--------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/doc/src/fix_langevin_gjf.rst b/doc/src/fix_langevin_gjf.rst index 623c1e4d59..1dd9178505 100644 --- a/doc/src/fix_langevin_gjf.rst +++ b/doc/src/fix_langevin_gjf.rst @@ -42,26 +42,26 @@ Description Apply a Langevin thermostat as described in :ref:`(Gronbech-Jensen-2020) ` to a group of atoms which models an interaction with a background -implicit solvent. As described in the papers cited below, the GJ methods -provide exact diffusion, drift, and Boltzmann sampling for linear systems for -any time step within the stability limit. The purpose of this set of methods -is therefore to significantly improve statistical accuracy at longer time steps +implicit solvent. As described in the papers cited below, the GJ methods +provide exact diffusion, drift, and Boltzmann sampling for linear systems for +any time step within the stability limit. The purpose of this set of methods +is therefore to significantly improve statistical accuracy at longer time steps compared to other thermostats. The current implementation provides the user with the option to output -the velocity in one of two forms: *vfull* or *vhalf*. The option *vhalf* +the velocity in one of two forms: *vfull* or *vhalf*. The option *vhalf* outputs the 2GJ half-step velocity given in :ref:`Gronbech Jensen/Gronbech-Jensen `; for linear systems, this velocity is shown to not -have any statistical errors for any stable time step. The option *vfull* +have any statistical errors for any stable time step. The option *vfull* outputs the on-site velocity given in :ref:`Gronbech-Jensen/Farago `; this velocity is shown to be systematically lower than the target temperature by a small amount, which grows -quadratically with the timestep. An overview of statistically correct Boltzmann -and Maxwell-Boltzmann sampling of true on-site and true half-step velocities is +quadratically with the timestep. An overview of statistically correct Boltzmann +and Maxwell-Boltzmann sampling of true on-site and true half-step velocities is given in :ref:`Gronbech-Jensen-2020 `. This fix allows the use of several GJ methods as listed in :ref:`Gronbech-Jensen-2020 `. -The GJ-VII method is described in :ref:`Finkelstein ` and GJ-VIII +The GJ-VII method is described in :ref:`Finkelstein ` and GJ-VIII is described in :ref:`Gronbech-Jensen-2024 `. The implementation follows the splitting form provided in Eqs. (24) and (25) in :ref:`Gronbech-Jensen-2024 `, including the application @@ -147,8 +147,8 @@ Because the state of the random number generator is not saved in restart files, this means you cannot do "exact" restarts with this fix, where the simulation continues on the same as if no restart had taken place. However, in a statistical sense, a restarted simulation should produce the same behavior. -additionally, the GJ methods implement noise exclusively within each time step -(unlike the BBK thermostat of the fix-langevin). The restart is done with +Additionally, the GJ methods implement noise exclusively within each time step +(unlike the BBK thermostat of the fix-langevin). The restart is done with either vfull or vhalf velocity output for as long as the choice of vfull/vhalf is the same for the simulation as it is in the restart file. @@ -167,7 +167,7 @@ This fix is not invoked during :doc:`energy minimization `. Restrictions """""""""""" -This fix is not compatible with run_style respa. It is not compatible with +This fix is not compatible with run_style respa. It is not compatible with accelerated packages such as KOKKOS. Related commands diff --git a/src/EXTRA-FIX/fix_langevin_gjf.cpp b/src/EXTRA-FIX/fix_langevin_gjf.cpp index b1637ff54c..cf9a8bb8cd 100644 --- a/src/EXTRA-FIX/fix_langevin_gjf.cpp +++ b/src/EXTRA-FIX/fix_langevin_gjf.cpp @@ -44,14 +44,14 @@ enum { CONSTANT, EQUAL, ATOM }; static const char cite_langevin_gjf[] = "Langevin GJ methods: doi:10.1080/00268976.2019.1662506\n\n" "@Article{gronbech-jensen_complete_2020,\n" - "title = {Complete set of stochastic Verlet-type thermostats for correct Langevin simulations},\n" - "volume = {118},\n" + "title = {Complete set of stochastic Verlet-type thermostats for correct Langevin simulations},\n" + "volume = {118},\n" "number = {8},\n" - "url = {https://www.tandfonline.com/doi/full/10.1080/00268976.2019.1662506},\n" - "doi = {10.1080/00268976.2019.1662506},\n" - "journal = {Molecular Physics},\n" - "author = {Grønbech-Jensen, Niels},\n" - "year = {2020}\n" + "url = {https://www.tandfonline.com/doi/full/10.1080/00268976.2019.1662506},\n" + "doi = {10.1080/00268976.2019.1662506},\n" + "journal = {Molecular Physics},\n" + "author = {Grønbech-Jensen, Niels},\n" + "year = {2020}\n" "}\n\n"; static const char cite_langevin_gjf_7[] = @@ -85,14 +85,14 @@ static const char cite_langevin_gjf_8[] = static const char cite_langevin_gjf_vhalf[] = "Langevin GJ-I vhalf method: doi:10.1080/00268976.2019.1570369\n\n" "@Article{jensen_accurate_2019,\n" - "title = {Accurate configurational and kinetic statistics in discrete-time Langevin systems},\n" - "volume = {117},\n" - "url = {https://www.tandfonline.com/doi/full/10.1080/00268976.2019.1570369},\n" - "doi = {10.1080/00268976.2019.1570369},\n" - "number = {18},\n" - "journal = {Molecular Physics},\n" - "author = {Jensen, Lucas Frese Grønbech and Grønbech-Jensen, Niels},\n" - "year = {2019}\n" + "title = {Accurate configurational and kinetic statistics in discrete-time Langevin systems},\n" + "volume = {117},\n" + "url = {https://www.tandfonline.com/doi/full/10.1080/00268976.2019.1570369},\n" + "doi = {10.1080/00268976.2019.1570369},\n" + "number = {18},\n" + "journal = {Molecular Physics},\n" + "author = {Jensen, Lucas Frese Grønbech and Grønbech-Jensen, Niels},\n" + "year = {2019}\n" "}\n\n"; static const char cite_langevin_gjf_vfull[] = From 4a3c08576f0c6f1929c8849600d0b2df3894c362 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 28 Apr 2025 22:19:14 -0400 Subject: [PATCH 12/17] small formal updates --- doc/src/Howto_thermostat.rst | 8 ++++++-- src/.gitignore | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/src/Howto_thermostat.rst b/doc/src/Howto_thermostat.rst index 6719abfc82..812b56cf21 100644 --- a/doc/src/Howto_thermostat.rst +++ b/doc/src/Howto_thermostat.rst @@ -21,10 +21,14 @@ can be invoked via the *dpd/tstat* pair style: * :doc:`fix nvt/sllod ` * :doc:`fix temp/berendsen ` * :doc:`fix temp/csvr ` +* :doc:`fix ffl ` +* :doc:`fix gld ` +* :doc:`fix gle ` * :doc:`fix langevin ` * :doc:`fix langevin/gjf ` * :doc:`fix temp/rescale ` * :doc:`pair_style dpd/tstat ` +* :doc:`pair_style dpd/ext/tstat ` :doc:`Fix nvt ` only thermostats the translational velocity of particles. :doc:`Fix nvt/sllod ` also does this, @@ -83,10 +87,10 @@ that: .. note:: - Only the nvt and langevin/gjf fixes perform time integration, meaning they update + Not all thermostat fixes perform time integration, meaning they update the velocities and positions of particles due to forces and velocities respectively. The other thermostat fixes only adjust velocities; they - do NOT perform time integration updates. Thus they should be used in + do NOT perform time integration updates. Thus, they should be used in conjunction with a constant NVE integration fix such as these: * :doc:`fix nve ` diff --git a/src/.gitignore b/src/.gitignore index a25a884a8a..9feb76ddc9 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -879,6 +879,8 @@ /fix_gld.h /fix_gle.cpp /fix_gle.h +/fix_langevin_gjf.cpp +/fix_langevin_gjf.h /fix_gpu.cpp /fix_gpu.h /fix_grem.cpp From 2927b08792cce403c6d8fac0c185fbd4ca7ca8c0 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 26 Apr 2025 02:17:54 -0400 Subject: [PATCH 13/17] correct reference --- doc/src/pair_lj_pirani.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/pair_lj_pirani.rst b/doc/src/pair_lj_pirani.rst index c7f2703c01..822d277a1b 100644 --- a/doc/src/pair_lj_pirani.rst +++ b/doc/src/pair_lj_pirani.rst @@ -74,7 +74,7 @@ electrostatic interactions. If these are desired, this pair style should be used along with a Coulomb pair style like :doc:`pair styles coul/cut or coul/long ` by using :doc:`pair style hybrid/overlay ` and a suitable -kspace style :doc:``, if needed. +:doc:`kspace style `, if needed. As discussed in :ref:`(Pirani) `, analysis of a variety of systems showed that :math:`\alpha= 4` generally works very well. In From d4867ab55e426de7dd000df557c859935d362f73 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 28 Apr 2025 22:22:47 -0400 Subject: [PATCH 14/17] add false positives --- doc/utils/sphinx-config/false_positives.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index cf90ce802d..ef27b28a66 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -1197,6 +1197,7 @@ filesystem filesystems Fily Fincham +Finkelstein Fint fingerprintconstants fingerprintsperelement @@ -1351,6 +1352,7 @@ Gillan Gingold Gissinger github +GJ gjf gjwagne gl @@ -3463,6 +3465,7 @@ sectoring sed Seddon segmental +Seibold Seifert Seleson sellerio @@ -4082,9 +4085,11 @@ versa Verstraelen ves vf +vfull vflag vflow vfrac +vhalf vhi vibrational Vij From 332006923d2c65a45f04803ab71988416e964cca Mon Sep 17 00:00:00 2001 From: talinke Date: Tue, 29 Apr 2025 12:00:06 -0700 Subject: [PATCH 15/17] Name change: langevin/gjf to gjf --- doc/src/Commands_fix.rst | 2 +- doc/src/Howto_thermostat.rst | 2 +- doc/src/fix.rst | 2 +- doc/src/{fix_langevin_gjf.rst => fix_gjf.rst} | 14 +-- examples/gjf/README | 4 +- examples/gjf/in.gjf.vfull | 2 +- examples/gjf/in.gjf.vhalf | 2 +- examples/gjf/log.2Apr25.gjf.vfull.g++.1 | 50 ++++---- examples/gjf/log.2Apr25.gjf.vfull.g++.4 | 50 ++++---- examples/gjf/log.2Apr25.gjf.vhalf.g++.1 | 48 ++++---- examples/gjf/log.2Apr25.gjf.vhalf.g++.4 | 50 ++++---- src/.gitignore | 4 +- .../{fix_langevin_gjf.cpp => fix_gjf.cpp} | 108 +++++++++--------- .../{fix_langevin_gjf.h => fix_gjf.h} | 12 +- 14 files changed, 175 insertions(+), 175 deletions(-) rename doc/src/{fix_langevin_gjf.rst => fix_gjf.rst} (95%) rename src/EXTRA-FIX/{fix_langevin_gjf.cpp => fix_gjf.cpp} (86%) rename src/EXTRA-FIX/{fix_langevin_gjf.h => fix_gjf.h} (88%) diff --git a/doc/src/Commands_fix.rst b/doc/src/Commands_fix.rst index 58397d7c7e..e80f01b87a 100644 --- a/doc/src/Commands_fix.rst +++ b/doc/src/Commands_fix.rst @@ -77,6 +77,7 @@ OPT. * :doc:`flow/gauss ` * :doc:`freeze (k) ` * :doc:`gcmc ` + * :doc:`gjf ` * :doc:`gld ` * :doc:`gle ` * :doc:`gravity (ko) ` @@ -92,7 +93,6 @@ OPT. * :doc:`langevin (k) ` * :doc:`langevin/drude ` * :doc:`langevin/eff ` - * :doc:`langevin/gjf ` * :doc:`langevin/spin ` * :doc:`lb/fluid ` * :doc:`lb/momentum ` diff --git a/doc/src/Howto_thermostat.rst b/doc/src/Howto_thermostat.rst index 812b56cf21..bda3bc6cb4 100644 --- a/doc/src/Howto_thermostat.rst +++ b/doc/src/Howto_thermostat.rst @@ -22,10 +22,10 @@ can be invoked via the *dpd/tstat* pair style: * :doc:`fix temp/berendsen ` * :doc:`fix temp/csvr ` * :doc:`fix ffl ` +* :doc:`fix gjf ` * :doc:`fix gld ` * :doc:`fix gle ` * :doc:`fix langevin ` -* :doc:`fix langevin/gjf ` * :doc:`fix temp/rescale ` * :doc:`pair_style dpd/tstat ` * :doc:`pair_style dpd/ext/tstat ` diff --git a/doc/src/fix.rst b/doc/src/fix.rst index 13a6ad166d..cdc0e786ce 100644 --- a/doc/src/fix.rst +++ b/doc/src/fix.rst @@ -256,6 +256,7 @@ accelerated styles exist. * :doc:`flow/gauss ` - Gaussian dynamics for constant mass flux * :doc:`freeze ` - freeze atoms in a granular simulation * :doc:`gcmc ` - grand canonical insertions/deletions +* :doc:`gjf ` - statistically correct Langevin temperature control using the GJ methods * :doc:`gld ` - generalized Langevin dynamics integrator * :doc:`gle ` - generalized Langevin equation thermostat * :doc:`gravity ` - add gravity to atoms in a granular simulation @@ -271,7 +272,6 @@ accelerated styles exist. * :doc:`langevin ` - Langevin temperature control * :doc:`langevin/drude ` - Langevin temperature control of Drude oscillators * :doc:`langevin/eff ` - Langevin temperature control for the electron force field model -* :doc:`langevin/gjf ` - statistically correct Langevin temperature control using the GJ methods * :doc:`langevin/spin ` - Langevin temperature control for a spin or spin-lattice system * :doc:`lb/fluid ` - lattice-Boltzmann fluid on a uniform mesh * :doc:`lb/momentum ` - :doc:`fix momentum ` replacement for use with a lattice-Boltzmann fluid diff --git a/doc/src/fix_langevin_gjf.rst b/doc/src/fix_gjf.rst similarity index 95% rename from doc/src/fix_langevin_gjf.rst rename to doc/src/fix_gjf.rst index 1dd9178505..f55a811ab7 100644 --- a/doc/src/fix_langevin_gjf.rst +++ b/doc/src/fix_gjf.rst @@ -1,6 +1,6 @@ -.. index:: fix langevin/gjf +.. index:: fix gjf -fix langevin/gjf command +fix gjf command ======================== Syntax @@ -8,10 +8,10 @@ Syntax .. code-block:: LAMMPS - fix ID group-ID langevin/gjf Tstart Tstop damp seed keyword values ... + fix ID group-ID gjf Tstart Tstop damp seed keyword values ... * ID, group-ID are documented in :doc:`fix ` command -* langevin/gjf = style name of this fix command +* gjf = style name of this fix command * Tstart,Tstop = desired temperature at start/end of run (temperature units) * Tstart can be a variable (see below) * damp = damping parameter (time units) @@ -33,9 +33,9 @@ Examples .. code-block:: LAMMPS - fix 3 boundary langevin/gjf 10.0 10.0 1.0 699483 - fix 1 all langevin/gjf 10.0 100.0 100.0 48279 vel vfull method 4 - fix 2 all langevin/gjf 10.0 10.0 1.0 26488 method 7 0.95 + fix 3 boundary gjf 10.0 10.0 1.0 699483 + fix 1 all gjf 10.0 100.0 100.0 48279 vel vfull method 4 + fix 2 all gjf 10.0 10.0 1.0 26488 method 7 0.95 Description """"""""""" diff --git a/examples/gjf/README b/examples/gjf/README index 34b60292bb..f7c955080f 100644 --- a/examples/gjf/README +++ b/examples/gjf/README @@ -36,9 +36,9 @@ KINETIC ENERGY (eV) Script Commands: -- -fix lang all langevin/gjf 10 10 1 26488 +fix lang all gjf 10 10 1 26488 -- -fix lang all langevin/gjf 10 10 1 26488 vel vfull +fix lang all gjf 10 10 1 26488 vel vfull -- fix nve all nve fix lang all langevin 10 10 1 26488 diff --git a/examples/gjf/in.gjf.vfull b/examples/gjf/in.gjf.vfull index c36a5b0690..fad6df4a9b 100644 --- a/examples/gjf/in.gjf.vfull +++ b/examples/gjf/in.gjf.vfull @@ -15,7 +15,7 @@ timestep 0.1 compute myKE all ke compute myPE all pe -fix lang all langevin/gjf 10 10 1 26488 vel vfull method 1 +fix lang all gjf 10 10 1 26488 vel vfull method 1 run 5000 diff --git a/examples/gjf/in.gjf.vhalf b/examples/gjf/in.gjf.vhalf index 0635998954..2f5c482928 100644 --- a/examples/gjf/in.gjf.vhalf +++ b/examples/gjf/in.gjf.vhalf @@ -15,7 +15,7 @@ timestep 0.1 compute myKE all ke compute myPE all pe -fix lang all langevin/gjf 10 10 1 26488 +fix lang all gjf 10 10 1 26488 run 5000 diff --git a/examples/gjf/log.2Apr25.gjf.vfull.g++.1 b/examples/gjf/log.2Apr25.gjf.vfull.g++.1 index f85c13672d..ca739b3a22 100644 --- a/examples/gjf/log.2Apr25.gjf.vfull.g++.1 +++ b/examples/gjf/log.2Apr25.gjf.vfull.g++.1 @@ -1,4 +1,4 @@ -LAMMPS (2 Apr 2025 - Development - 648cd3f0c6-modified) +LAMMPS (2 Apr 2025 - Development - d4867ab55e-modified) OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:99) using 1 OpenMP thread(s) per MPI task # GJ thermostat @@ -21,7 +21,7 @@ Finding 1-2 1-3 1-4 neighbors ... 0 = max # of 1-4 neighbors 1 = max # of special neighbors special bonds CPU = 0.000 seconds - read_data CPU = 0.009 seconds + read_data CPU = 0.007 seconds include ff-argon.lmp ############################# #Atoms types - mass - charge# @@ -53,7 +53,7 @@ timestep 0.1 compute myKE all ke compute myPE all pe -fix lang all langevin/gjf 10 10 1 26488 vel vfull method 1 +fix lang all gjf 10 10 1 26488 vel vfull method 1 run 5000 @@ -61,7 +61,7 @@ CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE Your simulation uses code contributions which should be cited: -- Langevin GJ methods: doi:10.1080/00268976.2019.1662506 +- GJ methods: doi:10.1080/00268976.2019.1662506 @Article{gronbech-jensen_complete_2020, title = {Complete set of stochastic Verlet-type thermostats for correct Langevin simulations}, @@ -74,7 +74,7 @@ author = {Grønbech-Jensen, Niels}, year = {2020} } -- Langevin GJ-I vfull method: doi:10.1080/00268976.2012.760055 +- GJ-I vfull method: doi:10.1080/00268976.2012.760055 @Article{gronbech-jensen_simple_2013, title = {A simple and effective Verlet-type algorithm for simulating Langevin dynamics}, @@ -107,21 +107,21 @@ Per MPI rank memory allocation (min/avg/max) = 6.481 | 6.481 | 6.481 Mbytes Step Temp E_pair E_mol TotEng Press 0 10 -56.207652 0 -55.092137 33.341103 5000 8.4535562 -55.150518 0 -54.207511 318.20862 -Loop time of 2.27448 on 1 procs for 5000 steps with 864 atoms +Loop time of 2.26831 on 1 procs for 5000 steps with 864 atoms -Performance: 18993.378 ns/day, 0.001 hours/ns, 2198.308 timesteps/s, 1.899 Matom-step/s -100.0% CPU use with 1 MPI tasks x 1 OpenMP threads +Performance: 19044.977 ns/day, 0.001 hours/ns, 2204.280 timesteps/s, 1.904 Matom-step/s +99.9% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 1.2877 | 1.2877 | 1.2877 | 0.0 | 56.61 -Bond | 0.00049357 | 0.00049357 | 0.00049357 | 0.0 | 0.02 -Neigh | 0.28068 | 0.28068 | 0.28068 | 0.0 | 12.34 -Comm | 0.055813 | 0.055813 | 0.055813 | 0.0 | 2.45 -Output | 5.5144e-05 | 5.5144e-05 | 5.5144e-05 | 0.0 | 0.00 -Modify | 0.62478 | 0.62478 | 0.62478 | 0.0 | 27.47 -Other | | 0.02499 | | | 1.10 +Pair | 1.2802 | 1.2802 | 1.2802 | 0.0 | 56.44 +Bond | 0.00051213 | 0.00051213 | 0.00051213 | 0.0 | 0.02 +Neigh | 0.27007 | 0.27007 | 0.27007 | 0.0 | 11.91 +Comm | 0.057527 | 0.057527 | 0.057527 | 0.0 | 2.54 +Output | 6.3876e-05 | 6.3876e-05 | 6.3876e-05 | 0.0 | 0.00 +Modify | 0.63364 | 0.63364 | 0.63364 | 0.0 | 27.93 +Other | | 0.02635 | | | 1.16 Nlocal: 864 ave 864 max 864 min Histogram: 1 0 0 0 0 0 0 0 0 0 @@ -162,21 +162,21 @@ Per MPI rank memory allocation (min/avg/max) = 6.481 | 6.481 | 6.481 Mbytes 36000 8.3048574 -55.079475 0 -54.153056 338.04291 38000 8.8708544 -55.108991 0 -54.119434 330.70097 40000 8.4012779 -55.080817 0 -54.143642 338.54326 -Loop time of 19.0379 on 1 procs for 35000 steps with 864 atoms +Loop time of 18.9699 on 1 procs for 35000 steps with 864 atoms -Performance: 15884.146 ns/day, 0.002 hours/ns, 1838.443 timesteps/s, 1.588 Matom-step/s -100.0% CPU use with 1 MPI tasks x 1 OpenMP threads +Performance: 15941.040 ns/day, 0.002 hours/ns, 1845.028 timesteps/s, 1.594 Matom-step/s +99.9% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 11.641 | 11.641 | 11.641 | 0.0 | 61.14 -Bond | 0.003055 | 0.003055 | 0.003055 | 0.0 | 0.02 -Neigh | 2.3613 | 2.3613 | 2.3613 | 0.0 | 12.40 -Comm | 0.41299 | 0.41299 | 0.41299 | 0.0 | 2.17 -Output | 0.00055686 | 0.00055686 | 0.00055686 | 0.0 | 0.00 -Modify | 4.442 | 4.442 | 4.442 | 0.0 | 23.33 -Other | | 0.1775 | | | 0.93 +Pair | 11.593 | 11.593 | 11.593 | 0.0 | 61.11 +Bond | 0.0041801 | 0.0041801 | 0.0041801 | 0.0 | 0.02 +Neigh | 2.2671 | 2.2671 | 2.2671 | 0.0 | 11.95 +Comm | 0.42339 | 0.42339 | 0.42339 | 0.0 | 2.23 +Output | 0.00062204 | 0.00062204 | 0.00062204 | 0.0 | 0.00 +Modify | 4.4976 | 4.4976 | 4.4976 | 0.0 | 23.71 +Other | | 0.1839 | | | 0.97 Nlocal: 864 ave 864 max 864 min Histogram: 1 0 0 0 0 0 0 0 0 0 diff --git a/examples/gjf/log.2Apr25.gjf.vfull.g++.4 b/examples/gjf/log.2Apr25.gjf.vfull.g++.4 index 12bc5ca3b2..93466e8dfe 100644 --- a/examples/gjf/log.2Apr25.gjf.vfull.g++.4 +++ b/examples/gjf/log.2Apr25.gjf.vfull.g++.4 @@ -1,4 +1,4 @@ -LAMMPS (2 Apr 2025 - Development - 648cd3f0c6-modified) +LAMMPS (2 Apr 2025 - Development - d4867ab55e-modified) OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:99) using 1 OpenMP thread(s) per MPI task # GJ thermostat @@ -21,7 +21,7 @@ Finding 1-2 1-3 1-4 neighbors ... 0 = max # of 1-4 neighbors 1 = max # of special neighbors special bonds CPU = 0.002 seconds - read_data CPU = 0.014 seconds + read_data CPU = 0.015 seconds include ff-argon.lmp ############################# #Atoms types - mass - charge# @@ -53,7 +53,7 @@ timestep 0.1 compute myKE all ke compute myPE all pe -fix lang all langevin/gjf 10 10 1 26488 vel vfull method 1 +fix lang all gjf 10 10 1 26488 vel vfull method 1 run 5000 @@ -61,7 +61,7 @@ CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE Your simulation uses code contributions which should be cited: -- Langevin GJ methods: doi:10.1080/00268976.2019.1662506 +- GJ methods: doi:10.1080/00268976.2019.1662506 @Article{gronbech-jensen_complete_2020, title = {Complete set of stochastic Verlet-type thermostats for correct Langevin simulations}, @@ -74,7 +74,7 @@ author = {Grønbech-Jensen, Niels}, year = {2020} } -- Langevin GJ-I vfull method: doi:10.1080/00268976.2012.760055 +- GJ-I vfull method: doi:10.1080/00268976.2012.760055 @Article{gronbech-jensen_simple_2013, title = {A simple and effective Verlet-type algorithm for simulating Langevin dynamics}, @@ -107,21 +107,21 @@ Per MPI rank memory allocation (min/avg/max) = 6.427 | 6.427 | 6.427 Mbytes Step Temp E_pair E_mol TotEng Press 0 10 -56.207652 0 -55.092137 33.341103 5000 7.946377 -55.076514 0 -54.190084 337.31999 -Loop time of 2.10015 on 4 procs for 5000 steps with 864 atoms +Loop time of 2.0998 on 4 procs for 5000 steps with 864 atoms -Performance: 20570.001 ns/day, 0.001 hours/ns, 2380.787 timesteps/s, 2.057 Matom-step/s -64.0% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 20573.405 ns/day, 0.001 hours/ns, 2381.181 timesteps/s, 2.057 Matom-step/s +65.2% CPU use with 4 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.54244 | 0.54516 | 0.54794 | 0.3 | 25.96 -Bond | 0.00056978 | 0.00065706 | 0.00071013 | 0.0 | 0.03 -Neigh | 0.10885 | 0.11 | 0.11178 | 0.4 | 5.24 -Comm | 0.96848 | 0.97341 | 0.97775 | 0.3 | 46.35 -Output | 0.00028754 | 0.00029437 | 0.00030094 | 0.0 | 0.01 -Modify | 0.25125 | 0.25293 | 0.25477 | 0.3 | 12.04 -Other | | 0.2177 | | | 10.37 +Pair | 0.53641 | 0.54389 | 0.54721 | 0.6 | 25.90 +Bond | 0.00056487 | 0.0006195 | 0.00068462 | 0.0 | 0.03 +Neigh | 0.10567 | 0.1086 | 0.11128 | 0.7 | 5.17 +Comm | 0.96913 | 0.97758 | 0.98191 | 0.5 | 46.56 +Output | 0.00025213 | 0.00025642 | 0.00026405 | 0.0 | 0.01 +Modify | 0.25061 | 0.25105 | 0.25172 | 0.1 | 11.96 +Other | | 0.2178 | | | 10.37 Nlocal: 216 ave 216 max 216 min Histogram: 4 0 0 0 0 0 0 0 0 0 @@ -162,21 +162,21 @@ Per MPI rank memory allocation (min/avg/max) = 6.428 | 6.428 | 6.428 Mbytes 36000 8.0936615 -55.152202 0 -54.249342 316.20169 38000 7.999652 -55.048407 0 -54.156034 345.07945 40000 8.6699753 -55.087634 0 -54.120485 337.23709 -Loop time of 17.6531 on 4 procs for 35000 steps with 864 atoms +Loop time of 17.6726 on 4 procs for 35000 steps with 864 atoms -Performance: 17130.136 ns/day, 0.001 hours/ns, 1982.655 timesteps/s, 1.713 Matom-step/s -63.9% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 17111.263 ns/day, 0.001 hours/ns, 1980.470 timesteps/s, 1.711 Matom-step/s +65.4% CPU use with 4 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 5.0485 | 5.078 | 5.11 | 1.0 | 28.77 -Bond | 0.0038244 | 0.0043855 | 0.0047706 | 0.6 | 0.02 -Neigh | 0.8487 | 0.86408 | 0.87685 | 1.1 | 4.89 -Comm | 6.8368 | 6.8833 | 6.9317 | 1.4 | 38.99 -Output | 0.004493 | 0.0045296 | 0.0045945 | 0.1 | 0.03 -Modify | 3.3123 | 3.3253 | 3.3366 | 0.5 | 18.84 -Other | | 1.494 | | | 8.46 +Pair | 5.0739 | 5.1178 | 5.1689 | 1.5 | 28.96 +Bond | 0.0043764 | 0.004688 | 0.0051706 | 0.4 | 0.03 +Neigh | 0.83797 | 0.85506 | 0.87554 | 1.8 | 4.84 +Comm | 6.816 | 6.8932 | 6.9215 | 1.7 | 39.00 +Output | 0.0043624 | 0.0045336 | 0.004998 | 0.4 | 0.03 +Modify | 3.3008 | 3.3033 | 3.3066 | 0.1 | 18.69 +Other | | 1.494 | | | 8.45 Nlocal: 216 ave 222 max 210 min Histogram: 2 0 0 0 0 0 0 0 0 2 diff --git a/examples/gjf/log.2Apr25.gjf.vhalf.g++.1 b/examples/gjf/log.2Apr25.gjf.vhalf.g++.1 index 7ea6355b64..569b13bad6 100644 --- a/examples/gjf/log.2Apr25.gjf.vhalf.g++.1 +++ b/examples/gjf/log.2Apr25.gjf.vhalf.g++.1 @@ -1,4 +1,4 @@ -LAMMPS (2 Apr 2025 - Development - e4c3b0c05e-modified) +LAMMPS (2 Apr 2025 - Development - d4867ab55e-modified) OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:99) using 1 OpenMP thread(s) per MPI task # GJ thermostat @@ -21,7 +21,7 @@ Finding 1-2 1-3 1-4 neighbors ... 0 = max # of 1-4 neighbors 1 = max # of special neighbors special bonds CPU = 0.000 seconds - read_data CPU = 0.012 seconds + read_data CPU = 0.010 seconds include ff-argon.lmp ############################# #Atoms types - mass - charge# @@ -53,7 +53,7 @@ timestep 0.1 compute myKE all ke compute myPE all pe -fix lang all langevin/gjf 10 10 1 26488 +fix lang all gjf 10 10 1 26488 run 5000 @@ -61,7 +61,7 @@ CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE Your simulation uses code contributions which should be cited: -- Langevin GJ methods: doi:10.1080/00268976.2019.1662506 +- GJ methods: doi:10.1080/00268976.2019.1662506 @Article{gronbech-jensen_complete_2020, title = {Complete set of stochastic Verlet-type thermostats for correct Langevin simulations}, @@ -74,7 +74,7 @@ author = {Grønbech-Jensen, Niels}, year = {2020} } -- Langevin GJ-I vhalf method: doi:10.1080/00268976.2019.1570369 +- GJ-I vhalf method: doi:10.1080/00268976.2019.1570369 @Article{jensen_accurate_2019, title = {Accurate configurational and kinetic statistics in discrete-time Langevin systems}, @@ -106,21 +106,21 @@ Per MPI rank memory allocation (min/avg/max) = 6.481 | 6.481 | 6.481 Mbytes Step Temp E_pair E_mol TotEng Press 0 10 -56.207652 0 -55.092137 33.341103 5000 9.7731898 -55.150518 0 -54.060304 322.94195 -Loop time of 2.33802 on 1 procs for 5000 steps with 864 atoms +Loop time of 2.28421 on 1 procs for 5000 steps with 864 atoms -Performance: 18477.199 ns/day, 0.001 hours/ns, 2138.565 timesteps/s, 1.848 Matom-step/s -99.6% CPU use with 1 MPI tasks x 1 OpenMP threads +Performance: 18912.438 ns/day, 0.001 hours/ns, 2188.940 timesteps/s, 1.891 Matom-step/s +99.9% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 1.3074 | 1.3074 | 1.3074 | 0.0 | 55.92 -Bond | 0.00028207 | 0.00028207 | 0.00028207 | 0.0 | 0.01 -Neigh | 0.27625 | 0.27625 | 0.27625 | 0.0 | 11.82 -Comm | 0.056554 | 0.056554 | 0.056554 | 0.0 | 2.42 -Output | 5.3527e-05 | 5.3527e-05 | 5.3527e-05 | 0.0 | 0.00 -Modify | 0.67274 | 0.67274 | 0.67274 | 0.0 | 28.77 -Other | | 0.02477 | | | 1.06 +Pair | 1.2715 | 1.2715 | 1.2715 | 0.0 | 55.66 +Bond | 0.00057126 | 0.00057126 | 0.00057126 | 0.0 | 0.03 +Neigh | 0.27008 | 0.27008 | 0.27008 | 0.0 | 11.82 +Comm | 0.057938 | 0.057938 | 0.057938 | 0.0 | 2.54 +Output | 6.1954e-05 | 6.1954e-05 | 6.1954e-05 | 0.0 | 0.00 +Modify | 0.658 | 0.658 | 0.658 | 0.0 | 28.81 +Other | | 0.0261 | | | 1.14 Nlocal: 864 ave 864 max 864 min Histogram: 1 0 0 0 0 0 0 0 0 0 @@ -161,21 +161,21 @@ Per MPI rank memory allocation (min/avg/max) = 6.481 | 6.481 | 6.481 Mbytes 36000 9.7252627 -55.079475 0 -53.994608 343.13769 38000 10.438984 -55.108991 0 -53.944506 336.32562 40000 10.238268 -55.080817 0 -53.938723 345.13228 -Loop time of 19.4518 on 1 procs for 35000 steps with 864 atoms +Loop time of 19.138 on 1 procs for 35000 steps with 864 atoms -Performance: 15546.156 ns/day, 0.002 hours/ns, 1799.324 timesteps/s, 1.555 Matom-step/s +Performance: 15801.041 ns/day, 0.002 hours/ns, 1828.824 timesteps/s, 1.580 Matom-step/s 99.9% CPU use with 1 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 11.789 | 11.789 | 11.789 | 0.0 | 60.61 -Bond | 0.0022933 | 0.0022933 | 0.0022933 | 0.0 | 0.01 -Neigh | 2.3359 | 2.3359 | 2.3359 | 0.0 | 12.01 -Comm | 0.4146 | 0.4146 | 0.4146 | 0.0 | 2.13 -Output | 0.0005505 | 0.0005505 | 0.0005505 | 0.0 | 0.00 -Modify | 4.7341 | 4.7341 | 4.7341 | 0.0 | 24.34 -Other | | 0.1749 | | | 0.90 +Pair | 11.568 | 11.568 | 11.568 | 0.0 | 60.44 +Bond | 0.0042372 | 0.0042372 | 0.0042372 | 0.0 | 0.02 +Neigh | 2.2577 | 2.2577 | 2.2577 | 0.0 | 11.80 +Comm | 0.42841 | 0.42841 | 0.42841 | 0.0 | 2.24 +Output | 0.00060128 | 0.00060128 | 0.00060128 | 0.0 | 0.00 +Modify | 4.694 | 4.694 | 4.694 | 0.0 | 24.53 +Other | | 0.1852 | | | 0.97 Nlocal: 864 ave 864 max 864 min Histogram: 1 0 0 0 0 0 0 0 0 0 diff --git a/examples/gjf/log.2Apr25.gjf.vhalf.g++.4 b/examples/gjf/log.2Apr25.gjf.vhalf.g++.4 index 088fa73044..2b5e19e634 100644 --- a/examples/gjf/log.2Apr25.gjf.vhalf.g++.4 +++ b/examples/gjf/log.2Apr25.gjf.vhalf.g++.4 @@ -1,4 +1,4 @@ -LAMMPS (2 Apr 2025 - Development - e4c3b0c05e-modified) +LAMMPS (2 Apr 2025 - Development - d4867ab55e-modified) OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:99) using 1 OpenMP thread(s) per MPI task # GJ thermostat @@ -53,7 +53,7 @@ timestep 0.1 compute myKE all ke compute myPE all pe -fix lang all langevin/gjf 10 10 1 26488 +fix lang all gjf 10 10 1 26488 run 5000 @@ -61,7 +61,7 @@ CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE Your simulation uses code contributions which should be cited: -- Langevin GJ methods: doi:10.1080/00268976.2019.1662506 +- GJ methods: doi:10.1080/00268976.2019.1662506 @Article{gronbech-jensen_complete_2020, title = {Complete set of stochastic Verlet-type thermostats for correct Langevin simulations}, @@ -74,7 +74,7 @@ author = {Grønbech-Jensen, Niels}, year = {2020} } -- Langevin GJ-I vhalf method: doi:10.1080/00268976.2019.1570369 +- GJ-I vhalf method: doi:10.1080/00268976.2019.1570369 @Article{jensen_accurate_2019, title = {Accurate configurational and kinetic statistics in discrete-time Langevin systems}, @@ -106,21 +106,21 @@ Per MPI rank memory allocation (min/avg/max) = 6.427 | 6.427 | 6.427 Mbytes Step Temp E_pair E_mol TotEng Press 0 10 -56.207652 0 -55.092137 33.341103 5000 9.3726166 -55.076514 0 -54.030985 342.43571 -Loop time of 2.09482 on 4 procs for 5000 steps with 864 atoms +Loop time of 2.11818 on 4 procs for 5000 steps with 864 atoms -Performance: 20622.269 ns/day, 0.001 hours/ns, 2386.837 timesteps/s, 2.062 Matom-step/s -64.9% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 20394.822 ns/day, 0.001 hours/ns, 2360.512 timesteps/s, 2.039 Matom-step/s +63.1% CPU use with 4 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 0.5344 | 0.54263 | 0.54877 | 0.8 | 25.90 -Bond | 0.00049036 | 0.00055513 | 0.00061267 | 0.0 | 0.03 -Neigh | 0.10741 | 0.10898 | 0.11004 | 0.3 | 5.20 -Comm | 0.95869 | 0.96388 | 0.96936 | 0.4 | 46.01 -Output | 0.00025982 | 0.00026553 | 0.00026761 | 0.0 | 0.01 -Modify | 0.26091 | 0.26108 | 0.26137 | 0.0 | 12.46 -Other | | 0.2174 | | | 10.38 +Pair | 0.53987 | 0.54922 | 0.56044 | 1.2 | 25.93 +Bond | 0.00058281 | 0.00063674 | 0.00075153 | 0.0 | 0.03 +Neigh | 0.10821 | 0.10912 | 0.11017 | 0.2 | 5.15 +Comm | 0.96075 | 0.97484 | 0.98645 | 1.1 | 46.02 +Output | 0.00026318 | 0.00026575 | 0.00027192 | 0.0 | 0.01 +Modify | 0.26142 | 0.2634 | 0.26465 | 0.2 | 12.44 +Other | | 0.2207 | | | 10.42 Nlocal: 216 ave 216 max 216 min Histogram: 4 0 0 0 0 0 0 0 0 0 @@ -161,21 +161,21 @@ Per MPI rank memory allocation (min/avg/max) = 6.428 | 6.428 | 6.428 Mbytes 36000 9.6032778 -55.152202 0 -54.080942 321.61646 38000 9.8802995 -55.048407 0 -53.946245 351.82506 40000 10.372288 -55.087634 0 -53.93059 343.34304 -Loop time of 17.6294 on 4 procs for 35000 steps with 864 atoms +Loop time of 17.867 on 4 procs for 35000 steps with 864 atoms -Performance: 17153.172 ns/day, 0.001 hours/ns, 1985.321 timesteps/s, 1.715 Matom-step/s -63.7% CPU use with 4 MPI tasks x 1 OpenMP threads +Performance: 16925.013 ns/day, 0.001 hours/ns, 1958.914 timesteps/s, 1.693 Matom-step/s +65.3% CPU use with 4 MPI tasks x 1 OpenMP threads MPI task timing breakdown: Section | min time | avg time | max time |%varavg| %total --------------------------------------------------------------- -Pair | 5.0222 | 5.1025 | 5.1759 | 2.5 | 28.94 -Bond | 0.0040066 | 0.0042899 | 0.0045178 | 0.3 | 0.02 -Neigh | 0.8511 | 0.85865 | 0.86632 | 0.6 | 4.87 -Comm | 6.7448 | 6.8089 | 6.8793 | 1.8 | 38.62 -Output | 0.0043966 | 0.0045518 | 0.0049846 | 0.4 | 0.03 -Modify | 3.364 | 3.3672 | 3.3717 | 0.2 | 19.10 -Other | | 1.483 | | | 8.41 +Pair | 5.0932 | 5.1683 | 5.2256 | 2.5 | 28.93 +Bond | 0.0044473 | 0.0048347 | 0.0058137 | 0.8 | 0.03 +Neigh | 0.85262 | 0.8601 | 0.87438 | 0.9 | 4.81 +Comm | 6.8164 | 6.8981 | 6.9859 | 2.6 | 38.61 +Output | 0.0046884 | 0.0047093 | 0.0047322 | 0.0 | 0.03 +Modify | 3.4107 | 3.4186 | 3.4248 | 0.3 | 19.13 +Other | | 1.512 | | | 8.47 Nlocal: 216 ave 222 max 210 min Histogram: 2 0 0 0 0 0 0 0 0 2 @@ -189,4 +189,4 @@ Ave neighs/atom = 20.998843 Ave special neighs/atom = 0 Neighbor list builds = 2140 Dangerous builds = 0 -Total wall time: 0:00:19 +Total wall time: 0:00:21 diff --git a/src/.gitignore b/src/.gitignore index 9feb76ddc9..20d1bccc4a 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -875,12 +875,12 @@ /fix_freeze.h /fix_gcmc.cpp /fix_gcmc.h +/fix_gjf.cpp +/fix_gjf.h /fix_gld.cpp /fix_gld.h /fix_gle.cpp /fix_gle.h -/fix_langevin_gjf.cpp -/fix_langevin_gjf.h /fix_gpu.cpp /fix_gpu.h /fix_grem.cpp diff --git a/src/EXTRA-FIX/fix_langevin_gjf.cpp b/src/EXTRA-FIX/fix_gjf.cpp similarity index 86% rename from src/EXTRA-FIX/fix_langevin_gjf.cpp rename to src/EXTRA-FIX/fix_gjf.cpp index cf9a8bb8cd..f602e6181d 100644 --- a/src/EXTRA-FIX/fix_langevin_gjf.cpp +++ b/src/EXTRA-FIX/fix_gjf.cpp @@ -15,7 +15,7 @@ Contributing authors: Tim Linke & Niels Gronbech-Jensen (UC Davis) ------------------------------------------------------------------------- */ -#include "fix_langevin_gjf.h" +#include "fix_gjf.h" #include "atom.h" #include "citeme.h" @@ -41,8 +41,8 @@ using namespace FixConst; enum { NOBIAS, BIAS }; enum { CONSTANT, EQUAL, ATOM }; -static const char cite_langevin_gjf[] = - "Langevin GJ methods: doi:10.1080/00268976.2019.1662506\n\n" +static const char cite_gjf[] = + "GJ methods: doi:10.1080/00268976.2019.1662506\n\n" "@Article{gronbech-jensen_complete_2020,\n" "title = {Complete set of stochastic Verlet-type thermostats for correct Langevin simulations},\n" "volume = {118},\n" @@ -54,8 +54,8 @@ static const char cite_langevin_gjf[] = "year = {2020}\n" "}\n\n"; -static const char cite_langevin_gjf_7[] = - "Langevin GJ-VII method: doi:10.1063/5.0066008\n\n" +static const char cite_gjf_7[] = + "GJ-VII method: doi:10.1063/5.0066008\n\n" "@Article{finkelstein_2021,\n" "title = {Bringing discrete-time Langevin splitting methods into agreement with thermodynamics},\n" "volume = {155},\n" @@ -68,8 +68,8 @@ static const char cite_langevin_gjf_7[] = "pages = {184104}\n" "}\n\n"; -static const char cite_langevin_gjf_8[] = - "Langevin GJ-VIII method: doi:10.1007/s10955-024-03345-1\n\n" +static const char cite_gjf_8[] = + "GJ-VIII method: doi:10.1007/s10955-024-03345-1\n\n" "@Article{gronbech_jensen_2024,\n" "title = {On the Definition of Velocity in Discrete-Time, Stochastic Langevin Simulations},\n" "volume = {191},\n" @@ -82,8 +82,8 @@ static const char cite_langevin_gjf_8[] = "pages = {137}\n" "}\n\n"; -static const char cite_langevin_gjf_vhalf[] = - "Langevin GJ-I vhalf method: doi:10.1080/00268976.2019.1570369\n\n" +static const char cite_gjf_vhalf[] = + "GJ-I vhalf method: doi:10.1080/00268976.2019.1570369\n\n" "@Article{jensen_accurate_2019,\n" "title = {Accurate configurational and kinetic statistics in discrete-time Langevin systems},\n" "volume = {117},\n" @@ -95,8 +95,8 @@ static const char cite_langevin_gjf_vhalf[] = "year = {2019}\n" "}\n\n"; -static const char cite_langevin_gjf_vfull[] = - "Langevin GJ-I vfull method: doi:10.1080/00268976.2012.760055\n\n" +static const char cite_gjf_vfull[] = + "GJ-I vfull method: doi:10.1080/00268976.2012.760055\n\n" "@Article{gronbech-jensen_simple_2013,\n" "title = {A simple and effective Verlet-type algorithm for simulating Langevin dynamics},\n" "volume = {111},\n" @@ -111,11 +111,11 @@ static const char cite_langevin_gjf_vfull[] = /* ---------------------------------------------------------------------- */ -FixLangevinGJF::FixLangevinGJF(LAMMPS *lmp, int narg, char **arg) : +FixGJF::FixGJF(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), tstr(nullptr), tforce(nullptr), lv(nullptr), id_temp(nullptr), random(nullptr) { - if (lmp->citeme) lmp->citeme->add(cite_langevin_gjf); - if (narg < 7) error->all(FLERR, "Illegal fix langevin/gjf command"); + if (lmp->citeme) lmp->citeme->add(cite_gjf); + if (narg < 7) error->all(FLERR, "Illegal fix gjf command"); time_integrate = 1; global_freq = 1; @@ -133,8 +133,8 @@ FixLangevinGJF::FixLangevinGJF(LAMMPS *lmp, int narg, char **arg) : t_period = utils::numeric(FLERR, arg[5], false, lmp); seed = utils::inumeric(FLERR, arg[6], false, lmp); - if (t_period <= 0.0) error->all(FLERR, "Fix langevin/gjf period must be > 0.0"); - if (seed <= 0) error->all(FLERR, "Illegal fix langevin/gjf command"); + if (t_period <= 0.0) error->all(FLERR, "Fix gjf period must be > 0.0"); + if (seed <= 0) error->all(FLERR, "Illegal fix gjf command"); // initialize Marsaglia RNG with processor-unique seed random = new RanMars(lmp, seed + comm->me); @@ -152,34 +152,34 @@ FixLangevinGJF::FixLangevinGJF(LAMMPS *lmp, int narg, char **arg) : int iarg = 7; while (iarg < narg) { if (strcmp(arg[iarg], "vel") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix langevin/gjf command"); + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix gjf command"); if (strcmp(arg[iarg + 1], "vfull") == 0) { osflag = 1; } else if (strcmp(arg[iarg + 1], "vhalf") == 0) { osflag = 0; } else - error->all(FLERR, "Illegal fix langevin/gjf command"); + error->all(FLERR, "Illegal fix gjf command"); iarg += 2; } else if (strcmp(arg[iarg], "method") == 0) { GJmethod = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); if (GJmethod == 7) { - if (iarg + 3 > narg) error->all(FLERR, "Illegal fix langevin/gjf command for GJ-VII"); + if (iarg + 3 > narg) error->all(FLERR, "Illegal fix gjf command for GJ-VII"); gjfc2 = utils::numeric(FLERR, arg[iarg + 2], false, lmp); if (gjfc2 < 0 || gjfc2 > 1) error->all(FLERR, "Choice of c2 in GJ-VII must be 0≤c2≤1"); iarg += 3; - if (lmp->citeme) lmp->citeme->add(cite_langevin_gjf_7); + if (lmp->citeme) lmp->citeme->add(cite_gjf_7); } else { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix langevin/gjf command"); - if (GJmethod < 0 || GJmethod > GJmethods) error->all(FLERR, "Invalid GJ method choice in langevin/gjf command"); - if (GJmethod == 8) if (lmp->citeme) lmp->citeme->add(cite_langevin_gjf_8); + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix gjf command"); + if (GJmethod < 0 || GJmethod > GJmethods) error->all(FLERR, "Invalid GJ method choice in gjf command"); + if (GJmethod == 8) if (lmp->citeme) lmp->citeme->add(cite_gjf_8); iarg += 2; } } else - error->all(FLERR, "Illegal fix langevin/gjf command"); + error->all(FLERR, "Illegal fix gjf command"); } - if (GJmethod == 1 && osflag == 0) if (lmp->citeme) lmp->citeme->add(cite_langevin_gjf_vhalf); - if (GJmethod == 1 && osflag == 1) if (lmp->citeme) lmp->citeme->add(cite_langevin_gjf_vfull); + if (GJmethod == 1 && osflag == 0) if (lmp->citeme) lmp->citeme->add(cite_gjf_vhalf); + if (GJmethod == 1 && osflag == 1) if (lmp->citeme) lmp->citeme->add(cite_gjf_vfull); // set temperature = nullptr, user can override via fix_modify if wants bias id_temp = nullptr; @@ -193,7 +193,7 @@ FixLangevinGJF::FixLangevinGJF(LAMMPS *lmp, int narg, char **arg) : // no need to set peratom_flag, b/c data is for internal use only - FixLangevinGJF::grow_arrays(atom->nmax); + FixGJF::grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); // initialize lv to onsite velocity @@ -207,7 +207,7 @@ FixLangevinGJF::FixLangevinGJF(LAMMPS *lmp, int narg, char **arg) : /* ---------------------------------------------------------------------- */ -FixLangevinGJF::~FixLangevinGJF() +FixGJF::~FixGJF() { if (copymode) return; @@ -222,7 +222,7 @@ FixLangevinGJF::~FixLangevinGJF() /* ---------------------------------------------------------------------- */ -int FixLangevinGJF::setmask() +int FixGJF::setmask() { int mask = 0; mask |= INITIAL_INTEGRATE; @@ -233,7 +233,7 @@ int FixLangevinGJF::setmask() /* ---------------------------------------------------------------------- */ -void FixLangevinGJF::init() +void FixGJF::init() { if (id_temp) { temperature = modify->get_compute_by_id(id_temp); @@ -248,17 +248,17 @@ void FixLangevinGJF::init() if (tstr) { tvar = input->variable->find(tstr); - if (tvar < 0) error->all(FLERR, "Variable name {} for fix langevin/gjf does not exist", tstr); + if (tvar < 0) error->all(FLERR, "Variable name {} for fix gjf does not exist", tstr); if (input->variable->equalstyle(tvar)) tstyle = EQUAL; else if (input->variable->atomstyle(tvar)) tstyle = ATOM; else - error->all(FLERR, "Variable {} for fix langevin/gjf is invalid style", tstr); + error->all(FLERR, "Variable {} for fix gjf is invalid style", tstr); } if (utils::strmatch(update->integrate_style, "^respa")) { - error->all(FLERR, "Fix langevin/gjf and run style respa are not compatible"); + error->all(FLERR, "Fix gjf and run style respa are not compatible"); } if (temperature && temperature->tempbias) @@ -296,7 +296,7 @@ void FixLangevinGJF::init() gjfc2 = 0.0; break; default: - error->all(FLERR, "Fix langevin/gjf method not found"); + error->all(FLERR, "Fix gjf method not found"); break; } gjfc1 = (1.0 + gjfc2) / 2.0; @@ -306,13 +306,13 @@ void FixLangevinGJF::init() /* ---------------------------------------------------------------------- integrate position and velocity according to the GJ methods in Grønbech-Jensen, J Stat Phys 191, 137 (2024). The general workflow is - 1. Langevin GJ Initial Integration + 1. GJ Initial Integration 2. Force Update - 3. Langevin GJ Final Integration + 3. GJ Final Integration 4. Velocity Choice in end_of_step() ------------------------------------------------------------------------- */ -void FixLangevinGJF::initial_integrate(int /* vflag */) +void FixGJF::initial_integrate(int /* vflag */) { // This function provides the integration of the GJ formulation 24 a-e double **x = atom->x; @@ -437,7 +437,7 @@ void FixLangevinGJF::initial_integrate(int /* vflag */) } } -void FixLangevinGJF::final_integrate() +void FixGJF::final_integrate() { double **v = atom->v; double **f = atom->f; @@ -479,7 +479,7 @@ void FixLangevinGJF::final_integrate() set current t_target and t_sqrt ------------------------------------------------------------------------- */ -void FixLangevinGJF::compute_target() +void FixGJF::compute_target() { int *mask = atom->mask; int nlocal = atom->nlocal; @@ -498,19 +498,19 @@ void FixLangevinGJF::compute_target() if (tstyle == EQUAL) { t_target = input->variable->compute_equal(tvar); if (t_target < 0.0) - error->one(FLERR, "Fix langevin/gjf variable returned negative temperature"); + error->one(FLERR, "Fix gjf variable returned negative temperature"); tsqrt = sqrt(t_target); } else { if (atom->nmax > maxatom) { maxatom = atom->nmax; memory->destroy(tforce); - memory->create(tforce,maxatom,"langevin_gjf:tforce"); + memory->create(tforce,maxatom,"gjf:tforce"); } input->variable->compute_atom(tvar,igroup,tforce,1,0); for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) if (tforce[i] < 0.0) - error->one(FLERR, "Fix langevin/gjf variable returned negative temperature"); + error->one(FLERR, "Fix gjf variable returned negative temperature"); } modify->addstep_compute(update->ntimestep + 1); } @@ -520,7 +520,7 @@ void FixLangevinGJF::compute_target() select velocity for GJ ------------------------------------------------------------------------- */ -void FixLangevinGJF::end_of_step() +void FixGJF::end_of_step() { double **v = atom->v; int *mask = atom->mask; @@ -549,14 +549,14 @@ void FixLangevinGJF::end_of_step() // clang-format on /* ---------------------------------------------------------------------- */ -void FixLangevinGJF::reset_target(double t_new) +void FixGJF::reset_target(double t_new) { t_target = t_start = t_stop = t_new; } /* ---------------------------------------------------------------------- */ -void FixLangevinGJF::reset_dt() +void FixGJF::reset_dt() { // Complete set of thermostats is given in Gronbech-Jensen, Molecular Physics, 118 (2020) switch (GJmethod) { @@ -588,7 +588,7 @@ void FixLangevinGJF::reset_dt() gjfc2 = 0.0; break; default: - error->all(FLERR, "Fix langevin/gjf method not found"); + error->all(FLERR, "Fix gjf method not found"); break; } gjfc1 = (1.0 + gjfc2) / 2.0; @@ -597,7 +597,7 @@ void FixLangevinGJF::reset_dt() /* ---------------------------------------------------------------------- */ -int FixLangevinGJF::modify_param(int narg, char **arg) +int FixGJF::modify_param(int narg, char **arg) { if (strcmp(arg[0], "temp") == 0) { if (narg < 2) utils::missing_cmd_args(FLERR, "fix_modify", error); @@ -621,7 +621,7 @@ int FixLangevinGJF::modify_param(int narg, char **arg) extract thermostat properties ------------------------------------------------------------------------- */ -void *FixLangevinGJF::extract(const char *str, int &dim) +void *FixGJF::extract(const char *str, int &dim) { dim = 0; if (strcmp(str, "t_target") == 0) { return &t_target; } @@ -632,7 +632,7 @@ void *FixLangevinGJF::extract(const char *str, int &dim) memory usage of tally array ------------------------------------------------------------------------- */ -double FixLangevinGJF::memory_usage() +double FixGJF::memory_usage() { double bytes = 0.0; bytes += (double) atom->nmax * 3 * sizeof(double); @@ -644,16 +644,16 @@ double FixLangevinGJF::memory_usage() allocate atom-based array for lv ------------------------------------------------------------------------- */ -void FixLangevinGJF::grow_arrays(int nmax) +void FixGJF::grow_arrays(int nmax) { - memory->grow(lv, nmax, 3, "fix_langevin_gjf:lv"); + memory->grow(lv, nmax, 3, "fix_gjf:lv"); } /* ---------------------------------------------------------------------- copy values within local atom-based array ------------------------------------------------------------------------- */ -void FixLangevinGJF::copy_arrays(int i, int j, int /*delflag*/) +void FixGJF::copy_arrays(int i, int j, int /*delflag*/) { lv[j][0] = lv[i][0]; lv[j][1] = lv[i][1]; @@ -664,7 +664,7 @@ void FixLangevinGJF::copy_arrays(int i, int j, int /*delflag*/) pack values in local atom-based array for exchange with another proc ------------------------------------------------------------------------- */ -int FixLangevinGJF::pack_exchange(int i, double *buf) +int FixGJF::pack_exchange(int i, double *buf) { int n = 0; buf[n++] = lv[i][0]; @@ -677,7 +677,7 @@ int FixLangevinGJF::pack_exchange(int i, double *buf) unpack values in local atom-based array from exchange with another proc ------------------------------------------------------------------------- */ -int FixLangevinGJF::unpack_exchange(int nlocal, double *buf) +int FixGJF::unpack_exchange(int nlocal, double *buf) { int n = 0; lv[nlocal][0] = buf[n++]; diff --git a/src/EXTRA-FIX/fix_langevin_gjf.h b/src/EXTRA-FIX/fix_gjf.h similarity index 88% rename from src/EXTRA-FIX/fix_langevin_gjf.h rename to src/EXTRA-FIX/fix_gjf.h index 45ccf4cbe2..154f6543da 100644 --- a/src/EXTRA-FIX/fix_langevin_gjf.h +++ b/src/EXTRA-FIX/fix_gjf.h @@ -13,21 +13,21 @@ #ifdef FIX_CLASS // clang-format off -FixStyle(langevin/gjf,FixLangevinGJF); +FixStyle(gjf,FixGJF); // clang-format on #else -#ifndef LMP_FIX_LANGEVINGJF_H -#define LMP_FIX_LANGEVINGJF_H +#ifndef LMP_FIX_GJF_H +#define LMP_FIX_GJF_H #include "fix.h" namespace LAMMPS_NS { -class FixLangevinGJF : public Fix { +class FixGJF : public Fix { public: - FixLangevinGJF(class LAMMPS *, int, char **); - ~FixLangevinGJF() override; + FixGJF(class LAMMPS *, int, char **); + ~FixGJF() override; int setmask() override; void init() override; void initial_integrate(int) override; From 1062a8fb3acb62614e7da405d5cf6d6c7c348ef8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 29 Apr 2025 17:20:04 -0400 Subject: [PATCH 16/17] add deprecation warning to fix langevin and document it --- doc/src/Commands_removed.rst | 11 +++++++++++ doc/src/fix_langevin.rst | 7 +++++++ src/fix_langevin.cpp | 3 +++ 3 files changed, 21 insertions(+) diff --git a/doc/src/Commands_removed.rst b/doc/src/Commands_removed.rst index cea964fe79..54679c6d46 100644 --- a/doc/src/Commands_removed.rst +++ b/doc/src/Commands_removed.rst @@ -12,6 +12,17 @@ stop LAMMPS and print a suitable error message in most cases, when a style/command is used that has been removed or will replace the command with the direct alternative (if available) and print a warning. +GJF formulation in fix langevin +------------------------------- + +.. deprecated:: TBD + +The *gjf* keyword in fix langevin is deprecated and will be removed +soon. The GJF functionality has been moved to its own fix style +:doc:`fix gjf ` and it is strongly recommended to use that +fix instead. + + LAMMPS shell ------------ diff --git a/doc/src/fix_langevin.rst b/doc/src/fix_langevin.rst index 30e4c48270..f9956bbec9 100644 --- a/doc/src/fix_langevin.rst +++ b/doc/src/fix_langevin.rst @@ -241,6 +241,13 @@ to zero by subtracting off an equal part of it from each atom in the group. As a result, the center-of-mass of a system with zero initial momentum will not drift over time. +.. deprecated:: TDB + +The *gjf* keyword in fix langevin is deprecated and will be removed +soon. The GJF functionality has been moved to its own fix style +:doc:`fix gjf ` and it is strongly recommended to use that +fix instead. + The keyword *gjf* can be used to run the :ref:`Gronbech-Jensen/Farago ` time-discretization of the Langevin model. As described in the papers cited below, the purpose of this method is to diff --git a/src/fix_langevin.cpp b/src/fix_langevin.cpp index 60a55bbbb4..5f754b6d2b 100644 --- a/src/fix_langevin.cpp +++ b/src/fix_langevin.cpp @@ -170,6 +170,9 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) : // no need to set peratom_flag, b/c data is for internal use only if (gjfflag) { + if (comm->me == 0) + error->warning(FLERR, "The GJF formulation in fix {} is deprecated and will be removed soon. " + "\nPlease use fix gjf instead: https://docs.lammps.org/fix_gjf.html", style); FixLangevin::grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); From def38bf0f36195fc66640da038ba4593e49e10af Mon Sep 17 00:00:00 2001 From: talinke Date: Tue, 29 Apr 2025 15:03:49 -0700 Subject: [PATCH 17/17] Updated fix langevin algorithm citation --- doc/src/fix_langevin.rst | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/src/fix_langevin.rst b/doc/src/fix_langevin.rst index f9956bbec9..b8be16e16d 100644 --- a/doc/src/fix_langevin.rst +++ b/doc/src/fix_langevin.rst @@ -56,7 +56,7 @@ Examples Description """"""""""" -Apply a Langevin thermostat as described in :ref:`(Schneider) ` +Apply a Langevin thermostat as described in :ref:`(Bruenger) ` to a group of atoms which models an interaction with a background implicit solvent. Used with :doc:`fix nve `, this command performs Brownian dynamics (BD), since the total force on each atom @@ -331,14 +331,16 @@ types, tally = no, zero = no, gjf = no. ---------- +.. _Bruenger1: + +**(Bruenger)** Bruenger, Brooks, and Karplus, Chem. Phys. Lett. 105, 495 (1982). +[Previously attributed to Schneider and Stoll, Phys. Rev. B 17, 1302 (1978). +Implementation remains unchanged.] + .. _Dunweg1: **(Dunweg)** Dunweg and Paul, Int J of Modern Physics C, 2, 817-27 (1991). -.. _Schneider1: - -**(Schneider)** Schneider and Stoll, Phys Rev B, 17, 1302 (1978). - .. _Gronbech-Jensen: **(Gronbech-Jensen)** Gronbech-Jensen and Farago, Mol Phys, 111, 983