From a7b6dc7b5954077cd3da19a3c77798eca683739b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 30 Apr 2022 19:03:28 -0400 Subject: [PATCH 01/59] initial implementation of minimizer support in fix shake/rattle --- doc/src/fix_shake.rst | 27 ++-- src/KOKKOS/fix_shake_kokkos.cpp | 15 +- src/RIGID/fix_rattle.cpp | 104 ++++++-------- src/RIGID/fix_shake.cpp | 233 ++++++++++++++++++++++---------- src/RIGID/fix_shake.h | 15 +- src/fix_restrain.cpp | 21 ++- 6 files changed, 249 insertions(+), 166 deletions(-) diff --git a/doc/src/fix_shake.rst b/doc/src/fix_shake.rst index f0c847cb5e..d723f28fc0 100644 --- a/doc/src/fix_shake.rst +++ b/doc/src/fix_shake.rst @@ -33,12 +33,14 @@ Syntax *m* value = one or more mass values * zero or more keyword/value pairs may be appended -* keyword = *mol* +* keyword = *mol* or *kbond* .. parsed-literal:: *mol* value = template-ID template-ID = ID of molecule template specified in a separate :doc:`molecule ` command + *kbond* value = force constant + force constant = force constant used to apply a restraint force when used during minimization Examples """""""" @@ -152,17 +154,23 @@ for. ---------- -The *mol* keyword should be used when other commands, such as :doc:`fix deposit ` or :doc:`fix pour `, add molecules +The *mol* keyword should be used when other commands, such as :doc:`fix +deposit ` or :doc:`fix pour `, add molecules on-the-fly during a simulation, and you wish to constrain the new molecules via SHAKE. You specify a *template-ID* previously defined using the :doc:`molecule ` command, which reads a file that defines the molecule. You must use the same *template-ID* that the command adding molecules uses. The coordinates, atom types, special -bond restrictions, and SHAKE info can be specified in the molecule -file. See the :doc:`molecule ` command for details. The only +bond restrictions, and SHAKE info can be specified in the molecule file. +See the :doc:`molecule ` command for details. The only settings required to be in this file (by this command) are the SHAKE info of atoms in the molecule. +The *kbond* keyword allows to set the restraint force constant when +fix shake or fix rattle are used during minimization. In that case +the constraint algorithms are **not** applied and restraint +forces are used instead to help maintaining the geometries. + ---------- .. include:: accel_styles.rst @@ -205,8 +213,10 @@ setting for this fix is :doc:`fix_modify virial yes `. No global or per-atom quantities are stored by these fixes for access by various :doc:`output commands `. No parameter of these fixes can be used with the *start/stop* keywords of the -:doc:`run ` command. These fixes are not invoked during -:doc:`energy minimization `. +:doc:`run ` command. + +When used during minimization, the SHAKE or RATTLE algorithms are **not** +applied. Strong restraint forces are applied instead. Restrictions """""""""""" @@ -232,13 +242,14 @@ make a linear molecule rigid. Related commands """""""""""""""" -none +`fix rigid `, `fix ehex `, +`fix nve/manifold/rattle ` Default """"""" -none +kbond = 1.0e6 ---------- diff --git a/src/KOKKOS/fix_shake_kokkos.cpp b/src/KOKKOS/fix_shake_kokkos.cpp index a24c47c1e2..5ed8cfccb3 100644 --- a/src/KOKKOS/fix_shake_kokkos.cpp +++ b/src/KOKKOS/fix_shake_kokkos.cpp @@ -12,12 +12,8 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include -#include -#include -#include -#include #include "fix_shake_kokkos.h" + #include "fix_rattle.h" #include "atom_kokkos.h" #include "atom_vec.h" @@ -38,6 +34,9 @@ #include "kokkos.h" #include "atom_masks.h" +#include +#include + using namespace LAMMPS_NS; using namespace FixConst; using namespace MathConst; @@ -292,7 +291,7 @@ void FixShakeKokkos::pre_neighbor() if (h_error_flag() == 1) { error->one(FLERR,"Shake atoms missing on proc " - "{} at step {}",me,update->ntimestep); + "{} at step {}",comm->me,update->ntimestep); } } @@ -341,7 +340,7 @@ void FixShakeKokkos::post_force(int vflag) // communicate results if necessary unconstrained_update(); - if (nprocs > 1) comm->forward_comm(this); + if (comm->nprocs > 1) comm->forward_comm(this); k_xshake.sync(); // virial setup @@ -1702,7 +1701,7 @@ void FixShakeKokkos::correct_coordinates(int vflag) { double **xtmp = xshake; xshake = x; - if (nprocs > 1) { + if (comm->nprocs > 1) { forward_comm_device = 0; comm->forward_comm(this); forward_comm_device = 1; diff --git a/src/RIGID/fix_rattle.cpp b/src/RIGID/fix_rattle.cpp index afe08415c3..1d6336712b 100644 --- a/src/RIGID/fix_rattle.cpp +++ b/src/RIGID/fix_rattle.cpp @@ -81,7 +81,7 @@ FixRattle::~FixRattle() { memory->destroy(vp); - if (RATTLE_DEBUG) { +#if RATTLE_DEBUG // communicate maximum distance error @@ -91,13 +91,11 @@ FixRattle::~FixRattle() MPI_Reduce(&derr_max, &global_derr_max, 1 , MPI_DOUBLE, MPI_MAX, 0, world); MPI_Reduce(&verr_max, &global_verr_max, 1 , MPI_DOUBLE, MPI_MAX, 0, world); - MPI_Comm_rank (world, &npid); // Find out process rank - - if (npid == 0 && screen) { + if (comm->me == 0 && screen) { fprintf(screen, "RATTLE: Maximum overall relative position error ( (r_ij-d_ij)/d_ij ): %.10g\n", global_derr_max); fprintf(screen, "RATTLE: Maximum overall absolute velocity error (r_ij * v_ij): %.10g\n", global_verr_max); } - } +#endif } /* ---------------------------------------------------------------------- */ @@ -110,7 +108,10 @@ int FixRattle::setmask() mask |= POST_FORCE_RESPA; mask |= FINAL_INTEGRATE; mask |= FINAL_INTEGRATE_RESPA; - if (RATTLE_DEBUG) mask |= END_OF_STEP; + mask |= MIN_POST_FORCE; +#if RATTLE_DEBUG + mask |= END_OF_STEP; +#endif return mask; } @@ -156,7 +157,7 @@ void FixRattle::post_force(int vflag) // communicate the unconstrained velocities - if (nprocs > 1) { + if (comm->nprocs > 1) { comm_mode = VP; comm->forward_comm(this); } @@ -188,7 +189,7 @@ void FixRattle::post_force_respa(int vflag, int ilevel, int /*iloop*/) // communicate the unconstrained velocities - if (nprocs > 1) { + if (comm->nprocs > 1) { comm_mode = VP; comm->forward_comm(this); } @@ -718,7 +719,7 @@ void FixRattle::unpack_forward_comm(int n, int first, double *buf) void FixRattle::shake_end_of_step(int vflag) { - if (nprocs > 1) { + if (comm->nprocs > 1) { comm_mode = V; comm->forward_comm(this); } @@ -738,7 +739,6 @@ void FixRattle::correct_coordinates(int vflag) { FixShake::correct_coordinates(vflag); } - /* ---------------------------------------------------------------------- Remove the velocity component along any bond. ------------------------------------------------------------------------- */ @@ -759,7 +759,7 @@ void FixRattle::correct_velocities() { // communicate the unconstrained velocities - if (nprocs > 1) { + if (comm->nprocs > 1) { comm_mode = VP; comm->forward_comm(this); } @@ -769,14 +769,13 @@ void FixRattle::correct_velocities() { int m; for (int i = 0; i < nlist; i++) { m = list[i]; - if (shake_flag[m] == 2) vrattle2(m); - else if (shake_flag[m] == 3) vrattle3(m); - else if (shake_flag[m] == 4) vrattle4(m); - else vrattle3angle(m); + if (shake_flag[m] == 2) vrattle2(m); + else if (shake_flag[m] == 3) vrattle3(m); + else if (shake_flag[m] == 4) vrattle4(m); + else vrattle3angle(m); } } - /* ---------------------------------------------------------------------- DEBUGGING methods The functions below allow you to check whether the @@ -788,16 +787,16 @@ void FixRattle::correct_velocities() { void FixRattle::end_of_step() { - if (nprocs > 1) { - comm_mode = V; - comm->forward_comm(this); + if (comm->nprocs > 1) { + comm_mode = V; + comm->forward_comm(this); } - if (!check_constraints(v, RATTLE_TEST_POS, RATTLE_TEST_VEL) && RATTLE_RAISE_ERROR) { +#if RATTLE_RAISE_ERROR + if (!check_constraints(v, RATTLE_TEST_POS, RATTLE_TEST_VEL)) error->one(FLERR, "Rattle failed "); - } +#endif } - /* ---------------------------------------------------------------------- */ bool FixRattle::check_constraints(double **v, bool checkr, bool checkv) @@ -807,12 +806,11 @@ bool FixRattle::check_constraints(double **v, bool checkr, bool checkv) int i=0; while (i < nlist && ret) { m = list[i]; - if (shake_flag[m] == 2) ret = check2(v,m,checkr,checkv); - else if (shake_flag[m] == 3) ret = check3(v,m,checkr,checkv); - else if (shake_flag[m] == 4) ret = check4(v,m,checkr,checkv); - else ret = check3angle(v,m,checkr,checkv); + if (shake_flag[m] == 2) ret = check2(v,m,checkr,checkv); + else if (shake_flag[m] == 3) ret = check3(v,m,checkr,checkv); + else if (shake_flag[m] == 4) ret = check4(v,m,checkr,checkv); + else ret = check3angle(v,m,checkr,checkv); i++; - if (!RATTLE_RAISE_ERROR) ret = true; } return ret; } @@ -834,14 +832,10 @@ bool FixRattle::check2(double **v, int m, bool checkr, bool checkv) MathExtra::sub3(v[i1],v[i0],v01); stat = !(checkr && (fabs(sqrt(MathExtra::dot3(r01,r01)) - bond1) > tol)); - if (!stat) - error->one(FLERR,"Coordinate constraints are not satisfied " - "up to desired tolerance "); + if (!stat) error->one(FLERR,"Coordinate constraints are not satisfied up to desired tolerance "); stat = !(checkv && (fabs(MathExtra::dot3(r01,v01)) > tol)); - if (!stat) - error->one(FLERR,"Velocity constraints are not satisfied " - "up to desired tolerance "); + if (!stat) error->one(FLERR,"Velocity constraints are not satisfied up to desired tolerance "); return stat; } @@ -871,15 +865,11 @@ bool FixRattle::check3(double **v, int m, bool checkr, bool checkv) stat = !(checkr && (fabs(sqrt(MathExtra::dot3(r01,r01)) - bond1) > tol || fabs(sqrt(MathExtra::dot3(r02,r02))-bond2) > tol)); - if (!stat) - error->one(FLERR,"Coordinate constraints are not satisfied " - "up to desired tolerance "); + if (!stat) error->one(FLERR,"Coordinate constraints are not satisfied up to desired tolerance "); stat = !(checkv && (fabs(MathExtra::dot3(r01,v01)) > tol || fabs(MathExtra::dot3(r02,v02)) > tol)); - if (!stat) - error->one(FLERR,"Velocity constraints are not satisfied " - "up to desired tolerance "); + if (!stat) error->one(FLERR,"Velocity constraints are not satisfied up to desired tolerance "); return stat; } @@ -914,16 +904,12 @@ bool FixRattle::check4(double **v, int m, bool checkr, bool checkv) stat = !(checkr && (fabs(sqrt(MathExtra::dot3(r01,r01)) - bond1) > tol || fabs(sqrt(MathExtra::dot3(r02,r02))-bond2) > tol || fabs(sqrt(MathExtra::dot3(r03,r03))-bond3) > tol)); - if (!stat) - error->one(FLERR,"Coordinate constraints are not satisfied " - "up to desired tolerance "); + if (!stat) error->one(FLERR,"Coordinate constraints are not satisfied up to desired tolerance "); stat = !(checkv && (fabs(MathExtra::dot3(r01,v01)) > tol || fabs(MathExtra::dot3(r02,v02)) > tol || fabs(MathExtra::dot3(r03,v03)) > tol)); - if (!stat) - error->one(FLERR,"Velocity constraints are not satisfied " - "up to desired tolerance "); + if (!stat) error->one(FLERR,"Velocity constraints are not satisfied up to desired tolerance "); return stat; } @@ -954,25 +940,19 @@ bool FixRattle::check3angle(double **v, int m, bool checkr, bool checkv) MathExtra::sub3(v[i2],v[i0],v02); MathExtra::sub3(v[i2],v[i1],v12); - - double db1 = fabs(sqrt(MathExtra::dot3(r01,r01)) - bond1); double db2 = fabs(sqrt(MathExtra::dot3(r02,r02))-bond2); double db12 = fabs(sqrt(MathExtra::dot3(r12,r12))-bond12); - - stat = !(checkr && (db1 > tol || - db2 > tol || - db12 > tol)); + stat = !(checkr && (db1 > tol || db2 > tol || db12 > tol)); if (derr_max < db1/bond1) derr_max = db1/bond1; if (derr_max < db2/bond2) derr_max = db2/bond2; if (derr_max < db12/bond12) derr_max = db12/bond12; - - if (!stat && RATTLE_RAISE_ERROR) - error->one(FLERR,"Coordinate constraints are not satisfied " - "up to desired tolerance "); +#if RATTLE_RAISE_ERROR + if (!stat) error->one(FLERR,"Coordinate constraints are not satisfied up to desired tolerance "); +#endif double dv1 = fabs(MathExtra::dot3(r01,v01)); double dv2 = fabs(MathExtra::dot3(r02,v02)); @@ -982,16 +962,10 @@ bool FixRattle::check3angle(double **v, int m, bool checkr, bool checkv) if (verr_max < dv2) verr_max = dv2; if (verr_max < dv12) verr_max = dv12; + stat = !(checkv && (dv1 > tol || dv2 > tol || dv12> tol)); - stat = !(checkv && (dv1 > tol || - dv2 > tol || - dv12> tol)); - - - if (!stat && RATTLE_RAISE_ERROR) - error->one(FLERR,"Velocity constraints are not satisfied " - "up to desired tolerance!"); - - +#if RATTLE_RAISE_ERROR + if (!stat) error->one(FLERR,"Velocity constraints are not satisfied up to desired tolerance!"); +#endif return stat; } diff --git a/src/RIGID/fix_shake.cpp b/src/RIGID/fix_shake.cpp index d74f72fb69..41d8c1599c 100644 --- a/src/RIGID/fix_shake.cpp +++ b/src/RIGID/fix_shake.cpp @@ -41,8 +41,8 @@ using namespace MathConst; #define RVOUS 1 // 0 for irregular, 1 for all2all -#define BIG 1.0e20 -#define MASSDELTA 0.1 +static constexpr double BIG = 1.0e20; +static constexpr double MASSDELTA = 0.1; /* ---------------------------------------------------------------------- */ @@ -57,21 +57,20 @@ FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) : a_count_all(nullptr), a_ave(nullptr), a_max(nullptr), a_min(nullptr), a_ave_all(nullptr), a_max_all(nullptr), a_min_all(nullptr), atommols(nullptr), onemols(nullptr) { - MPI_Comm_rank(world,&me); - MPI_Comm_size(world,&nprocs); - + energy_global_flag = energy_peratom_flag = 1; virial_global_flag = virial_peratom_flag = 1; - thermo_virial = 1; + thermo_energy = thermo_virial = 1; create_attribute = 1; dof_flag = 1; stores_ids = 1; centroidstressflag = CENTROID_AVAIL; + next_output = -1; // error check molecular = atom->molecular; if (molecular == Atom::ATOMIC) - error->all(FLERR,"Cannot use fix shake with non-molecular system"); + error->all(FLERR,"Cannot use fix {} with non-molecular system", style); // perform initial allocation of atom-based arrays // register with Atom class @@ -92,8 +91,9 @@ FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) : comm_forward = 3; // parse SHAKE args + auto mystyle = fmt::format("fix {}",style); - if (narg < 8) error->all(FLERR,"Illegal fix shake command"); + if (narg < 8) utils::missing_cmd_args(FLERR,mystyle, error); tolerance = utils::numeric(FLERR,arg[3],false,lmp); max_iter = utils::inumeric(FLERR,arg[4],false,lmp); @@ -133,49 +133,55 @@ FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) : else if (mode == 'b') { int i = utils::inumeric(FLERR,arg[next],false,lmp); if (i < 1 || i > atom->nbondtypes) - error->all(FLERR,"Invalid bond type index for fix shake"); + error->all(FLERR,"Invalid bond type index for {}", mystyle); bond_flag[i] = 1; } else if (mode == 'a') { int i = utils::inumeric(FLERR,arg[next],false,lmp); if (i < 1 || i > atom->nangletypes) - error->all(FLERR,"Invalid angle type index for fix shake"); + error->all(FLERR,"Invalid angle type index for {}", mystyle); angle_flag[i] = 1; } else if (mode == 't') { int i = utils::inumeric(FLERR,arg[next],false,lmp); if (i < 1 || i > atom->ntypes) - error->all(FLERR,"Invalid atom type index for fix shake"); + error->all(FLERR,"Invalid atom type index for {}", mystyle); type_flag[i] = 1; } else if (mode == 'm') { double massone = utils::numeric(FLERR,arg[next],false,lmp); - if (massone == 0.0) error->all(FLERR,"Invalid atom mass for fix shake"); + if (massone == 0.0) error->all(FLERR,"Invalid atom mass for {}", mystyle); if (nmass == atom->ntypes) - error->all(FLERR,"Too many masses for fix shake"); + error->all(FLERR,"Too many masses for {}", mystyle); mass_list[nmass++] = massone; - } else error->all(FLERR,"Illegal fix shake command"); + } else error->all(FLERR,"Unknown {} command option: {}", mystyle, arg[next]); next++; } // parse optional args onemols = nullptr; + kbond = 1.0e6; int iarg = next; while (iarg < narg) { - if (strcmp(arg[next],"mol") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix shake command"); + if (strcmp(arg[iarg],"mol") == 0) { + if (iarg+2 > narg) utils::missing_cmd_args(FLERR,mystyle+" mol",error); int imol = atom->find_molecule(arg[iarg+1]); if (imol == -1) - error->all(FLERR,"Molecule template ID for fix shake does not exist"); - if (atom->molecules[imol]->nset > 1 && comm->me == 0) - error->warning(FLERR,"Molecule template for fix shake has multiple molecules"); + error->all(FLERR,"Molecule template ID {} for {} does not exist", mystyle, arg[iarg+1]); + if ((atom->molecules[imol]->nset > 1) && (comm->me == 0)) + error->warning(FLERR,"Molecule template for {} has multiple molecules", mystyle); onemols = &atom->molecules[imol]; nmol = onemols[0]->nset; iarg += 2; - } else error->all(FLERR,"Illegal fix shake command"); + } else if (strcmp(arg[iarg],"kbond") == 0) { + if (iarg+2 > narg) utils::missing_cmd_args(FLERR,mystyle+" kbond",error); + kbond = utils::numeric(FLERR, arg[iarg+1], false, lmp); + if (kbond < 0) error->all(FLERR,"Illegal {} kbond value {}. Must be >= 0.0", mystyle, kbond); + iarg += 2; + } else error->all(FLERR,"Unknown {} command option: {}", mystyle, arg[iarg]); } // error check for Molecule template @@ -183,7 +189,7 @@ FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) : if (onemols) { for (int i = 0; i < nmol; i++) if (onemols[i]->shakeflag == 0) - error->all(FLERR,"Fix shake molecule template must have shake info"); + error->all(FLERR,"Fix {} molecule template must have shake info", style); } // allocate bond and angle distance arrays, indexed from 1 to n @@ -321,6 +327,7 @@ int FixShake::setmask() mask |= PRE_NEIGHBOR; mask |= POST_FORCE; mask |= POST_FORCE_RESPA; + mask |= MIN_POST_FORCE; return mask; } @@ -335,28 +342,24 @@ void FixShake::init() double rsq,angle; // error if more than one shake fix + auto pattern = fmt::format("^{}",style); - int count = 0; - for (i = 0; i < modify->nfix; i++) - if (strcmp(modify->fix[i]->style,"shake") == 0) count++; - if (count > 1) error->all(FLERR,"More than one fix shake"); + if (modify->get_fix_by_style(pattern).size() > 1) + error->all(FLERR,"More than one fix {} instance",style); // cannot use with minimization since SHAKE turns off bonds // that should contribute to potential energy - if (update->whichflag == 2) - error->all(FLERR,"Fix shake cannot be used with minimization"); + if ((comm->me == 0) && (update->whichflag == 2)) + error->warning(FLERR,"Using fix {} with minimization. Substituting constraints with " + "restraint forces using k={:.4g}", style, kbond); - // error if npt,nph fix comes before shake fix - - for (i = 0; i < modify->nfix; i++) { - if (strcmp(modify->fix[i]->style,"npt") == 0) break; - if (strcmp(modify->fix[i]->style,"nph") == 0) break; - } - if (i < modify->nfix) { - for (int j = i; j < modify->nfix; j++) - if (strcmp(modify->fix[j]->style,"shake") == 0) - error->all(FLERR,"Shake fix must come before NPT/NPH fix"); + // error if a fix changing the box comes before shake fix + bool boxflag = false; + for (auto ifix : modify->get_fix_list()) { + if (boxflag && utils::strmatch(ifix->style,pattern)) + error->all(FLERR,"Fix {} must come before any box changing fix", style); + if (ifix->box_change) boxflag = true; } // if rRESPA, find associated fix that must exist @@ -379,7 +382,7 @@ void FixShake::init() // set equilibrium bond distances if (force->bond == nullptr) - error->all(FLERR,"Bond potential must be defined for SHAKE"); + error->all(FLERR,"Bond style must be defined for fix {}",style); for (i = 1; i <= atom->nbondtypes; i++) bond_distance[i] = force->bond->equilibrium_distance(i); @@ -390,7 +393,7 @@ void FixShake::init() for (i = 1; i <= atom->nangletypes; i++) { if (angle_flag[i] == 0) continue; if (force->angle == nullptr) - error->all(FLERR,"Angle potential must be defined for SHAKE"); + error->all(FLERR,"Angle style must be defined for fix {}",style); // scan all atoms for a SHAKE angle cluster // extract bond types for the 2 bonds in the cluster @@ -417,7 +420,7 @@ void FixShake::init() // error check for any bond types that are not the same MPI_Allreduce(&flag,&flag_all,1,MPI_INT,MPI_MAX,world); - if (flag_all) error->all(FLERR,"Shake angles have different bond types"); + if (flag_all) error->all(FLERR,"Fix {} angles have different bond types", style); // insure all procs have bond types @@ -494,6 +497,16 @@ void FixShake::setup(int vflag) shake_end_of_step(vflag); } +/* ---------------------------------------------------------------------- + during minimization fix SHAKE adds strong bond forces +------------------------------------------------------------------------- */ + +void FixShake::min_setup(int vflag) +{ + pre_neighbor(); + min_post_force(vflag); +} + /* ---------------------------------------------------------------------- build list of SHAKE clusters to constrain if one or more atoms in cluster are on this proc, @@ -533,19 +546,17 @@ void FixShake::pre_neighbor() atom1 = atom->map(shake_atom[i][0]); atom2 = atom->map(shake_atom[i][1]); if (atom1 == -1 || atom2 == -1) - error->one(FLERR,"Shake atoms {} {} missing on proc " - "{} at step {}",shake_atom[i][0], - shake_atom[i][1],me,update->ntimestep); + error->one(FLERR,"Shake atoms {} {} missing on proc {} at step {}",shake_atom[i][0], + shake_atom[i][1],comm->me,update->ntimestep); if (i <= atom1 && i <= atom2) list[nlist++] = i; } else if (shake_flag[i] % 2 == 1) { atom1 = atom->map(shake_atom[i][0]); atom2 = atom->map(shake_atom[i][1]); atom3 = atom->map(shake_atom[i][2]); if (atom1 == -1 || atom2 == -1 || atom3 == -1) - error->one(FLERR,"Shake atoms {} {} {} missing on proc " - "{} at step {}",shake_atom[i][0], + error->one(FLERR,"Shake atoms {} {} {} missing on proc {} at step {}",shake_atom[i][0], shake_atom[i][1],shake_atom[i][2], - me,update->ntimestep); + comm->me,update->ntimestep); if (i <= atom1 && i <= atom2 && i <= atom3) list[nlist++] = i; } else { atom1 = atom->map(shake_atom[i][0]); @@ -553,10 +564,9 @@ void FixShake::pre_neighbor() atom3 = atom->map(shake_atom[i][2]); atom4 = atom->map(shake_atom[i][3]); if (atom1 == -1 || atom2 == -1 || atom3 == -1 || atom4 == -1) - error->one(FLERR,"Shake atoms {} {} {} {} missing on " - "proc {} at step {}",shake_atom[i][0], + error->one(FLERR,"Shake atoms {} {} {} {} missing on proc {} at step {}",shake_atom[i][0], shake_atom[i][1],shake_atom[i][2], - shake_atom[i][3],me,update->ntimestep); + shake_atom[i][3],comm->me,update->ntimestep); if (i <= atom1 && i <= atom2 && i <= atom3 && i <= atom4) list[nlist++] = i; } @@ -575,7 +585,7 @@ void FixShake::post_force(int vflag) // communicate results if necessary unconstrained_update(); - if (nprocs > 1) comm->forward_comm(this); + if (comm->nprocs > 1) comm->forward_comm(this); // virial setup @@ -619,7 +629,7 @@ void FixShake::post_force_respa(int vflag, int ilevel, int iloop) // communicate results if necessary unconstrained_update_respa(ilevel); - if (nprocs > 1) comm->forward_comm(this); + if (comm->nprocs > 1) comm->forward_comm(this); // virial setup only needed on last iteration of innermost level // and if pressure is requested @@ -644,6 +654,48 @@ void FixShake::post_force_respa(int vflag, int ilevel, int iloop) vflag_post_force = vflag; } +/* ---------------------------------------------------------------------- + substitute shake constraints with very strong bonds +------------------------------------------------------------------------- */ + +void FixShake::min_post_force(int vflag) +{ + if (output_every) { + bigint ntimestep = update->ntimestep; + if (next_output == ntimestep) stats(); + + next_output = ntimestep + output_every; + if (ntimestep % output_every != 0) + next_output = (ntimestep/output_every)*output_every + output_every; + } else next_output = -1; + + v_init(vflag); + + x = atom->x; + f = atom->f; + nlocal = atom->nlocal; + + // loop over clusters to add strong restraint forces + + for (int i = 0; i < nlist; i++) { + int m = list[i]; + if (shake_flag[m] == 2) { + bond_force(shake_atom[m][0], shake_atom[m][1], bond_distance[shake_type[m][0]]); + } else if (shake_flag[m] == 3) { + bond_force(shake_atom[m][0], shake_atom[m][1], bond_distance[shake_type[m][0]]); + bond_force(shake_atom[m][0], shake_atom[m][2], bond_distance[shake_type[m][1]]); + } else if (shake_flag[m] == 4) { + bond_force(shake_atom[m][0], shake_atom[m][1], bond_distance[shake_type[m][0]]); + bond_force(shake_atom[m][0], shake_atom[m][2], bond_distance[shake_type[m][1]]); + bond_force(shake_atom[m][0], shake_atom[m][3], bond_distance[shake_type[m][2]]); + } else { + bond_force(shake_atom[m][0], shake_atom[m][1], bond_distance[shake_type[m][0]]); + bond_force(shake_atom[m][0], shake_atom[m][2], bond_distance[shake_type[m][1]]); + bond_force(shake_atom[m][1], shake_atom[m][2], angle_distance[shake_type[m][2]]); + } + } +} + /* ---------------------------------------------------------------------- count # of degrees-of-freedom removed by SHAKE for atoms in igroup ------------------------------------------------------------------------- */ @@ -690,10 +742,7 @@ void FixShake::find_clusters() tagint tagprev; double massone; - if ((me == 0) && screen) { - if (!rattle) fputs("Finding SHAKE clusters ...\n",screen); - else fputs("Finding RATTLE clusters ...\n",screen); - } + if (comm->me == 0) utils::logmesg(lmp, "Finding {} clusters ...\n",utils::uppercase(style)); atommols = atom->avec->onemols; tagint *tag = atom->tag; @@ -805,7 +854,7 @@ void FixShake::find_clusters() } MPI_Allreduce(&flag,&flag_all,1,MPI_INT,MPI_SUM,world); - if (flag_all) error->all(FLERR,"Did not find fix shake partner info"); + if (flag_all) error->all(FLERR,"Did not find fix {} partner info", style); // ----------------------------------------------------- // identify SHAKEable bonds @@ -1015,7 +1064,7 @@ void FixShake::find_clusters() tmp = count4; MPI_Allreduce(&tmp,&count4,1,MPI_INT,MPI_SUM,world); - if (me == 0) { + if (comm->me == 0) { utils::logmesg(lmp,"{:>8} = # of size 2 clusters\n" "{:>8} = # of size 3 clusters\n" "{:>8} = # of size 4 clusters\n" @@ -1043,8 +1092,8 @@ void FixShake::atom_owners() // one datum for each owned atom: datum = owning proc, atomID for (int i = 0; i < nlocal; i++) { - proclist[i] = tag[i] % nprocs; - idbuf[i].me = me; + proclist[i] = tag[i] % comm->nprocs; + idbuf[i].me = comm->me; idbuf[i].atomID = tag[i]; } @@ -1089,7 +1138,7 @@ void FixShake::partner_info(int *npartner, tagint **partner_tag, // set values in 4 partner arrays for all partner atoms I own // also setup input buf to rendezvous comm // input datums = pair of bonded atoms where I do not own partner - // owning proc for each datum = partner_tag % nprocs + // owning proc for each datum = partner_tag % comm->nprocs // datum: atomID = partner_tag (off-proc), partnerID = tag (on-proc) // 4 values for my owned atom @@ -1127,7 +1176,7 @@ void FixShake::partner_info(int *npartner, tagint **partner_tag, } } else { - proclist[nsend] = partner_tag[i][j] % nprocs; + proclist[nsend] = partner_tag[i][j] % comm->nprocs; inbuf[nsend].atomID = partner_tag[i][j]; inbuf[nsend].partnerID = tag[i]; inbuf[nsend].mask = mask[i]; @@ -1217,7 +1266,7 @@ void FixShake::nshake_info(int *npartner, tagint **partner_tag, // set partner_nshake for all partner atoms I own // also setup input buf to rendezvous comm // input datums = pair of bonded atoms where I do not own partner - // owning proc for each datum = partner_tag % nprocs + // owning proc for each datum = partner_tag % comm->nprocs // datum: atomID = partner_tag (off-proc), partnerID = tag (on-proc) // nshake value for my owned atom @@ -1231,7 +1280,7 @@ void FixShake::nshake_info(int *npartner, tagint **partner_tag, if (m >= 0 && m < nlocal) { partner_nshake[i][j] = nshake[m]; } else { - proclist[nsend] = partner_tag[i][j] % nprocs; + proclist[nsend] = partner_tag[i][j] % comm->nprocs; inbuf[nsend].atomID = partner_tag[i][j]; inbuf[nsend].partnerID = tag[i]; inbuf[nsend].nshake = nshake[i]; @@ -1295,7 +1344,7 @@ void FixShake::shake_info(int *npartner, tagint **partner_tag, // set 3 shake arrays for all partner atoms I own // also setup input buf to rendezvous comm // input datums = partner atom where I do not own partner - // owning proc for each datum = partner_tag % nprocs + // owning proc for each datum = partner_tag % comm->nprocs // datum: atomID = partner_tag (off-proc) // values in 3 shake arrays @@ -1317,7 +1366,7 @@ void FixShake::shake_info(int *npartner, tagint **partner_tag, shake_type[m][2] = shake_type[i][2]; } else { - proclist[nsend] = partner_tag[i][j] % nprocs; + proclist[nsend] = partner_tag[i][j] % comm->nprocs; inbuf[nsend].atomID = partner_tag[i][j]; inbuf[nsend].shake_flag = shake_flag[i]; inbuf[nsend].shake_atom[0] = shake_atom[i][0]; @@ -2451,6 +2500,53 @@ void FixShake::shake3angle(int m) } } +/* ---------------------------------------------------------------------- + apply bond force for minimization +------------------------------------------------------------------------- */ + +void FixShake::bond_force(tagint id1, tagint id2, double length) +{ + + int i1 = atom->map(id1); + int i2 = atom->map(id2); + + if ((i1 < 0) || (i2 < 0)) return; + + // distance vec between atoms, with PBC + + double delx = x[i1][0] - x[i2][0]; + double dely = x[i1][1] - x[i2][1]; + double delz = x[i1][2] - x[i2][2]; + domain->minimum_image(delx, dely, delz); + + // compute and apply force + + const double r = sqrt(delx * delx + dely * dely + delz * delz); + const double dr = r - length; + const double rk = kbond * dr; + const double fbond = (r > 0.0) ? -2.0 * rk / r : 0.0; + double v[6]; + v[0] = 0.5 * delx * delx * fbond; + v[1] = 0.5 * dely * dely * fbond; + v[2] = 0.5 * delz * delz * fbond; + v[3] = 0.5 * delx * dely * fbond; + v[4] = 0.5 * delx * delz * fbond; + v[5] = 0.5 * dely * delz * fbond; + + if (i1 < nlocal) { + f[i1][0] += delx * fbond; + f[i1][1] += dely * fbond; + f[i1][2] += delz * fbond; + if (evflag) v_tally(i1, v); + } + if (i2 < nlocal) { + f[i2][0] -= delx * fbond; + f[i2][1] -= dely * fbond; + f[i2][2] -= delz * fbond; + if (evflag) v_tally(i2, v); + } +} + /* ---------------------------------------------------------------------- print-out bond & angle statistics ------------------------------------------------------------------------- */ @@ -2558,9 +2654,10 @@ void FixShake::stats() // print stats only for non-zero counts - if (me == 0) { + if (comm->me == 0) { const int width = log10((MAX(MAX(1,nb),na)))+2; - auto mesg = fmt::format("SHAKE stats (type/ave/delta/count) on step {}\n", update->ntimestep); + auto mesg = fmt::format("{} stats (type/ave/delta/count) on step {}\n", + utils::uppercase(style), update->ntimestep); for (i = 1; i < nb; i++) { const auto bcnt = b_count_all[i]; if (bcnt) @@ -3109,7 +3206,7 @@ void FixShake::correct_coordinates(int vflag) { double **xtmp = xshake; xshake = x; - if (nprocs > 1) { + if (comm->nprocs > 1) { comm->forward_comm(this); } xshake = xtmp; diff --git a/src/RIGID/fix_shake.h b/src/RIGID/fix_shake.h index 12e24fb350..a0f743d7d2 100644 --- a/src/RIGID/fix_shake.h +++ b/src/RIGID/fix_shake.h @@ -34,9 +34,11 @@ class FixShake : public Fix { int setmask() override; void init() override; void setup(int) override; + void min_setup(int) override; void pre_neighbor() override; void post_force(int) override; void post_force_respa(int, int, int) override; + void min_post_force(int) override; double memory_usage() override; void grow_arrays(int) override; @@ -61,12 +63,11 @@ class FixShake : public Fix { protected: int vflag_post_force; // store the vflag of last post_force call int respa; // 0 = vel. Verlet, 1 = respa - int me, nprocs; - int rattle; // 0 = SHAKE, 1 = RATTLE - double tolerance; // SHAKE tolerance - int max_iter; // max # of SHAKE iterations - int output_every; // SHAKE stat output every so often - bigint next_output; // timestep for next output + int rattle; // 0 = SHAKE, 1 = RATTLE + double tolerance; // SHAKE tolerance + int max_iter; // max # of SHAKE iterations + int output_every; // SHAKE stat output every so often + bigint next_output; // timestep for next output // settings from input command int *bond_flag, *angle_flag; // bond/angle types to constrain @@ -76,6 +77,7 @@ class FixShake : public Fix { int molecular; // copy of atom->molecular double *bond_distance, *angle_distance; // constraint distances + double kbond; // force constant for restraint class FixRespa *fix_respa; // rRESPA fix needed by SHAKE int nlevels_respa; // copies of needed rRESPA variables @@ -133,6 +135,7 @@ class FixShake : public Fix { void shake3(int); void shake4(int); void shake3angle(int); + void bond_force(tagint, tagint, double); void stats(); int bondtype_findset(int, tagint, tagint, int); int angletype_findset(int, tagint, tagint, int); diff --git a/src/fix_restrain.cpp b/src/fix_restrain.cpp index 8b97715ff6..e5440830f5 100644 --- a/src/fix_restrain.cpp +++ b/src/fix_restrain.cpp @@ -19,17 +19,18 @@ #include "fix_restrain.h" -#include -#include #include "atom.h" -#include "force.h" -#include "update.h" -#include "domain.h" #include "comm.h" -#include "respa.h" +#include "domain.h" +#include "error.h" +#include "force.h" #include "math_const.h" #include "memory.h" -#include "error.h" +#include "respa.h" +#include "update.h" + +#include +#include using namespace LAMMPS_NS; using namespace FixConst; @@ -271,14 +272,12 @@ void FixRestrain::restrain_bond(int m) if (newton_bond) { if (i2 == -1 || i2 >= nlocal) return; if (i1 == -1) - error->one(FLERR,"Restrain atoms {} {} missing on " - "proc {} at step {}", ids[m][0],ids[m][1], + error->one(FLERR,"Restrain atoms {} {} missing on proc {} at step {}", ids[m][0],ids[m][1], comm->me,update->ntimestep); } else { if ((i1 == -1 || i1 >= nlocal) && (i2 == -1 || i2 >= nlocal)) return; if (i1 == -1 || i2 == -1) - error->one(FLERR,"Restrain atoms {} {} missing on " - "proc {} at step {}", ids[m][0],ids[m][1], + error->one(FLERR,"Restrain atoms {} {} missing on proc {} at step {}", ids[m][0],ids[m][1], comm->me,update->ntimestep); } From 322bf1ef477e928a49796eacdfe686e897a3a4c1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 9 Jun 2022 22:34:35 -0400 Subject: [PATCH 02/59] compute energy due to restraint forces during minimization. output stats. --- doc/src/fix_shake.rst | 31 ++++++++++++++--------- src/RIGID/fix_shake.cpp | 54 ++++++++++++++++++++++++++--------------- src/RIGID/fix_shake.h | 3 +++ 3 files changed, 57 insertions(+), 31 deletions(-) diff --git a/doc/src/fix_shake.rst b/doc/src/fix_shake.rst index d723f28fc0..137cb1aedb 100644 --- a/doc/src/fix_shake.rst +++ b/doc/src/fix_shake.rst @@ -58,7 +58,9 @@ Description Apply bond and angle constraints to specified bonds and angles in the simulation by either the SHAKE or RATTLE algorithms. This typically -enables a longer timestep. +enables a longer timestep. This SHAKE or RATTLE algorithms can *only* +be applied during molecular dynamics runs. When this fix is used during +a minimization, the constraints are replaced by strong harmonic restraints. **SHAKE vs RATTLE:** @@ -166,10 +168,13 @@ See the :doc:`molecule ` command for details. The only settings required to be in this file (by this command) are the SHAKE info of atoms in the molecule. -The *kbond* keyword allows to set the restraint force constant when -fix shake or fix rattle are used during minimization. In that case -the constraint algorithms are **not** applied and restraint -forces are used instead to help maintaining the geometries. +The *kbond* keyword allows to set the restraint force constant when fix +shake or fix rattle are used during minimization. In that case the +constraint algorithms are *not* applied and restraint forces are used +instead to help maintaining the geometries. How well the geometries +are maintained and how quickly a minimization will converge depends on +the magnitude of the force constant (kbond). If it is chosen too large +the minimization may converge slowly. The default is 1.0e6*k_B. ---------- @@ -202,6 +207,9 @@ Restart, fix_modify, output, run start/stop, minimize info No information about these fixes is written to :doc:`binary restart files `. +When used during minimization, the SHAKE or RATTLE algorithms are **not** +applied. Strong restraint forces are applied instead. + The :doc:`fix_modify ` *virial* option is supported by these fixes to add the contribution due to the added forces on atoms to both the global pressure and per-atom stress of the system via the @@ -209,14 +217,15 @@ to both the global pressure and per-atom stress of the system via the stress/atom ` commands. The former can be accessed by :doc:`thermodynamic output `. The default setting for this fix is :doc:`fix_modify virial yes `. +During minimization, the virial contribution is *NOT* available. -No global or per-atom quantities are stored by these fixes for access -by various :doc:`output commands `. No parameter of -these fixes can be used with the *start/stop* keywords of the +No global or per-atom quantities are stored by these fixes for access by +various :doc:`output commands ` during a run. During +minimization, this fix computes a global scalar which is the energy of +the restraint forces applied insteat of the constraints. No parameter +of these fixes can be used with the *start/stop* keywords of the :doc:`run ` command. -When used during minimization, the SHAKE or RATTLE algorithms are **not** -applied. Strong restraint forces are applied instead. Restrictions """""""""""" @@ -249,7 +258,7 @@ Related commands Default """"""" -kbond = 1.0e6 +kbond = 1.0e9*k_B ---------- diff --git a/src/RIGID/fix_shake.cpp b/src/RIGID/fix_shake.cpp index 41d8c1599c..99836483dd 100644 --- a/src/RIGID/fix_shake.cpp +++ b/src/RIGID/fix_shake.cpp @@ -52,16 +52,17 @@ FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) : loop_respa(nullptr), step_respa(nullptr), x(nullptr), v(nullptr), f(nullptr), ftmp(nullptr), vtmp(nullptr), mass(nullptr), rmass(nullptr), type(nullptr), shake_flag(nullptr), shake_atom(nullptr), shake_type(nullptr), xshake(nullptr), nshake(nullptr), list(nullptr), - b_count(nullptr), b_count_all(nullptr), b_atom(nullptr), b_atom_all(nullptr), b_ave(nullptr), b_max(nullptr), - b_min(nullptr), b_ave_all(nullptr), b_max_all(nullptr), b_min_all(nullptr), a_count(nullptr), - a_count_all(nullptr), a_ave(nullptr), a_max(nullptr), a_min(nullptr), a_ave_all(nullptr), - a_max_all(nullptr), a_min_all(nullptr), atommols(nullptr), onemols(nullptr) + b_count(nullptr), b_count_all(nullptr), b_atom(nullptr), b_atom_all(nullptr), b_ave(nullptr), + b_max(nullptr), b_min(nullptr), b_ave_all(nullptr), b_max_all(nullptr), b_min_all(nullptr), + a_count(nullptr), a_count_all(nullptr), a_ave(nullptr), a_max(nullptr), a_min(nullptr), + a_ave_all(nullptr), a_max_all(nullptr), a_min_all(nullptr), atommols(nullptr), onemols(nullptr) { energy_global_flag = energy_peratom_flag = 1; virial_global_flag = virial_peratom_flag = 1; thermo_energy = thermo_virial = 1; create_attribute = 1; dof_flag = 1; + scalar_flag = 1; stores_ids = 1; centroidstressflag = CENTROID_AVAIL; next_output = -1; @@ -162,7 +163,7 @@ FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) : // parse optional args onemols = nullptr; - kbond = 1.0e6; + kbond = 1.0e6*force->boltz; int iarg = next; while (iarg < narg) { @@ -328,6 +329,7 @@ int FixShake::setmask() mask |= POST_FORCE; mask |= POST_FORCE_RESPA; mask |= MIN_POST_FORCE; + mask |= POST_RUN; return mask; } @@ -351,8 +353,8 @@ void FixShake::init() // that should contribute to potential energy if ((comm->me == 0) && (update->whichflag == 2)) - error->warning(FLERR,"Using fix {} with minimization. Substituting constraints with " - "restraint forces using k={:.4g}", style, kbond); + error->warning(FLERR,"Using fix {} with minimization.\n Substituting constraints with " + "harmonic restraint forces using kbond={:.4g}", style, kbond); // error if a fix changing the box comes before shake fix bool boxflag = false; @@ -590,6 +592,7 @@ void FixShake::post_force(int vflag) // virial setup v_init(vflag); + ebond = 0.0; // loop over clusters to add constraint forces @@ -669,13 +672,12 @@ void FixShake::min_post_force(int vflag) next_output = (ntimestep/output_every)*output_every + output_every; } else next_output = -1; - v_init(vflag); - x = atom->x; f = atom->f; nlocal = atom->nlocal; + ebond = 0.0; - // loop over clusters to add strong restraint forces + // loop over shake clusters to add restraint forces for (int i = 0; i < nlist; i++) { int m = list[i]; @@ -2506,7 +2508,6 @@ void FixShake::shake3angle(int m) void FixShake::bond_force(tagint id1, tagint id2, double length) { - int i1 = atom->map(id1); int i2 = atom->map(id2); @@ -2525,25 +2526,18 @@ void FixShake::bond_force(tagint id1, tagint id2, double length) const double dr = r - length; const double rk = kbond * dr; const double fbond = (r > 0.0) ? -2.0 * rk / r : 0.0; - double v[6]; - v[0] = 0.5 * delx * delx * fbond; - v[1] = 0.5 * dely * dely * fbond; - v[2] = 0.5 * delz * delz * fbond; - v[3] = 0.5 * delx * dely * fbond; - v[4] = 0.5 * delx * delz * fbond; - v[5] = 0.5 * dely * delz * fbond; if (i1 < nlocal) { f[i1][0] += delx * fbond; f[i1][1] += dely * fbond; f[i1][2] += delz * fbond; - if (evflag) v_tally(i1, v); + ebond += 0.5*rk*dr; } if (i2 < nlocal) { f[i2][0] -= delx * fbond; f[i2][1] -= dely * fbond; f[i2][2] -= delz * fbond; - if (evflag) v_tally(i2, v); + ebond += 0.5*rk*dr; } } @@ -3102,6 +3096,26 @@ void *FixShake::extract(const char *str, int &dim) return nullptr; } +/* ---------------------------------------------------------------------- + energy due to restraint forces +------------------------------------------------------------------------- */ + +double FixShake::compute_scalar() +{ + double all; + MPI_Allreduce(&ebond, &all, 1, MPI_DOUBLE, MPI_SUM, world); + return all; +} + +/* ---------------------------------------------------------------------- + print shake stats at the end of a minimization +------------------------------------------------------------------------- */ +void FixShake::post_run() +{ + if ((update->whichflag == 2) && (output_every > 0)) stats(); +} + + /* ---------------------------------------------------------------------- add coordinate constraining forces this method is called at the end of a timestep diff --git a/src/RIGID/fix_shake.h b/src/RIGID/fix_shake.h index a0f743d7d2..d6f9a8f5d6 100644 --- a/src/RIGID/fix_shake.h +++ b/src/RIGID/fix_shake.h @@ -39,6 +39,7 @@ class FixShake : public Fix { void post_force(int) override; void post_force_respa(int, int, int) override; void min_post_force(int) override; + void post_run() override; double memory_usage() override; void grow_arrays(int) override; @@ -59,6 +60,7 @@ class FixShake : public Fix { int dof(int) override; void reset_dt() override; void *extract(const char *, int &) override; + double compute_scalar() override; protected: int vflag_post_force; // store the vflag of last post_force call @@ -78,6 +80,7 @@ class FixShake : public Fix { int molecular; // copy of atom->molecular double *bond_distance, *angle_distance; // constraint distances double kbond; // force constant for restraint + double ebond; // energy of bond restraints class FixRespa *fix_respa; // rRESPA fix needed by SHAKE int nlevels_respa; // copies of needed rRESPA variables From 1ee35bea6117c0df955326d4857a7a4475ff696e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 10 Jun 2022 01:41:14 -0400 Subject: [PATCH 03/59] fix shake stats (again) --- src/RIGID/fix_shake.cpp | 60 ++++++++++++++++++++--------------------- src/RIGID/fix_shake.h | 3 +-- 2 files changed, 30 insertions(+), 33 deletions(-) diff --git a/src/RIGID/fix_shake.cpp b/src/RIGID/fix_shake.cpp index 99836483dd..c284d99011 100644 --- a/src/RIGID/fix_shake.cpp +++ b/src/RIGID/fix_shake.cpp @@ -52,10 +52,10 @@ FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) : loop_respa(nullptr), step_respa(nullptr), x(nullptr), v(nullptr), f(nullptr), ftmp(nullptr), vtmp(nullptr), mass(nullptr), rmass(nullptr), type(nullptr), shake_flag(nullptr), shake_atom(nullptr), shake_type(nullptr), xshake(nullptr), nshake(nullptr), list(nullptr), - b_count(nullptr), b_count_all(nullptr), b_atom(nullptr), b_atom_all(nullptr), b_ave(nullptr), - b_max(nullptr), b_min(nullptr), b_ave_all(nullptr), b_max_all(nullptr), b_min_all(nullptr), - a_count(nullptr), a_count_all(nullptr), a_ave(nullptr), a_max(nullptr), a_min(nullptr), - a_ave_all(nullptr), a_max_all(nullptr), a_min_all(nullptr), atommols(nullptr), onemols(nullptr) + b_count(nullptr), b_count_all(nullptr), b_ave(nullptr), b_max(nullptr), b_min(nullptr), + b_ave_all(nullptr), b_max_all(nullptr), b_min_all(nullptr), a_count(nullptr), + a_count_all(nullptr), a_ave(nullptr), a_max(nullptr), a_min(nullptr), a_ave_all(nullptr), + a_max_all(nullptr), a_min_all(nullptr), atommols(nullptr), onemols(nullptr) { energy_global_flag = energy_peratom_flag = 1; virial_global_flag = virial_peratom_flag = 1; @@ -204,8 +204,6 @@ FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) : int nb = atom->nbondtypes + 1; b_count = new int[nb]; b_count_all = new int[nb]; - b_atom = new int[nb]; - b_atom_all = new int[nb]; b_ave = new double[nb]; b_ave_all = new double[nb]; b_max = new double[nb]; @@ -298,8 +296,6 @@ FixShake::~FixShake() if (output_every) { delete[] b_count; delete[] b_count_all; - delete[] b_atom; - delete[] b_atom_all; delete[] b_ave; delete[] b_ave_all; delete[] b_max; @@ -2547,7 +2543,6 @@ void FixShake::bond_force(tagint id1, tagint id2, double length) void FixShake::stats() { - int i,j,m,n,iatom,jatom,katom; double delx,dely,delz; double r,r1,r2,r3,angle; @@ -2556,13 +2551,12 @@ void FixShake::stats() int nb = atom->nbondtypes + 1; int na = atom->nangletypes + 1; - for (i = 0; i < nb; i++) { + for (int i = 0; i < nb; i++) { b_count[i] = 0; b_ave[i] = b_max[i] = 0.0; b_min[i] = BIG; - b_atom[i] = -1; } - for (i = 0; i < na; i++) { + for (int i = 0; i < na; i++) { a_count[i] = 0; a_ave[i] = a_max[i] = 0.0; a_min[i] = BIG; @@ -2574,25 +2568,26 @@ void FixShake::stats() double **x = atom->x; int nlocal = atom->nlocal; - for (i = 0; i < nlocal; i++) { - if (shake_flag[i] == 0) continue; + for (int ii = 0; ii < nlist; ++ii) { + int i = list[ii]; + int n = shake_flag[i]; + if (n == 0) continue; // bond stats - n = shake_flag[i]; if (n == 1) n = 3; - iatom = atom->map(shake_atom[i][0]); - for (j = 1; j < n; j++) { - jatom = atom->map(shake_atom[i][j]); + int iatom = atom->map(shake_atom[i][0]); + for (int j = 1; j < n; j++) { + int jatom = atom->map(shake_atom[i][j]); + if (jatom >= nlocal) continue; delx = x[iatom][0] - x[jatom][0]; dely = x[iatom][1] - x[jatom][1]; delz = x[iatom][2] - x[jatom][2]; domain->minimum_image(delx,dely,delz); - r = sqrt(delx*delx + dely*dely + delz*delz); - m = shake_type[i][j-1]; + r = sqrt(delx*delx + dely*dely + delz*delz); + int m = shake_type[i][j-1]; b_count[m]++; - b_atom[m] = n; b_ave[m] += r; b_max[m] = MAX(b_max[m],r); b_min[m] = MIN(b_min[m],r); @@ -2601,9 +2596,13 @@ void FixShake::stats() // angle stats if (shake_flag[i] == 1) { - iatom = atom->map(shake_atom[i][0]); - jatom = atom->map(shake_atom[i][1]); - katom = atom->map(shake_atom[i][2]); + int iatom = atom->map(shake_atom[i][0]); + int jatom = atom->map(shake_atom[i][1]); + int katom = atom->map(shake_atom[i][2]); + int n = 0; + if (iatom < nlocal) ++n; + if (jatom < nlocal) ++n; + if (katom < nlocal) ++n; delx = x[iatom][0] - x[jatom][0]; dely = x[iatom][1] - x[jatom][1]; @@ -2625,9 +2624,9 @@ void FixShake::stats() angle = acos((r1*r1 + r2*r2 - r3*r3) / (2.0*r1*r2)); angle *= 180.0/MY_PI; - m = shake_type[i][2]; - a_count[m]++; - a_ave[m] += angle; + int m = shake_type[i][2]; + a_count[m] += n; + a_ave[m] += n*angle; a_max[m] = MAX(a_max[m],angle); a_min[m] = MIN(a_min[m],angle); } @@ -2636,7 +2635,6 @@ void FixShake::stats() // sum across all procs MPI_Allreduce(b_count,b_count_all,nb,MPI_INT,MPI_SUM,world); - MPI_Allreduce(b_atom,b_atom_all,nb,MPI_INT,MPI_MAX,world); MPI_Allreduce(b_ave,b_ave_all,nb,MPI_DOUBLE,MPI_SUM,world); MPI_Allreduce(b_max,b_max_all,nb,MPI_DOUBLE,MPI_MAX,world); MPI_Allreduce(b_min,b_min_all,nb,MPI_DOUBLE,MPI_MIN,world); @@ -2652,13 +2650,13 @@ void FixShake::stats() const int width = log10((MAX(MAX(1,nb),na)))+2; auto mesg = fmt::format("{} stats (type/ave/delta/count) on step {}\n", utils::uppercase(style), update->ntimestep); - for (i = 1; i < nb; i++) { + for (int i = 1; i < nb; i++) { const auto bcnt = b_count_all[i]; if (bcnt) mesg += fmt::format("Bond: {:>{}d} {:<9.6} {:<11.6} {:>8d}\n",i,width, - b_ave_all[i]/bcnt,b_max_all[i]-b_min_all[i],bcnt/b_atom_all[i]); + b_ave_all[i]/bcnt,b_max_all[i]-b_min_all[i],bcnt); } - for (i = 1; i < na; i++) { + for (int i = 1; i < na; i++) { const auto acnt = a_count_all[i]; if (acnt) mesg += fmt::format("Angle: {:>{}d} {:<9.6} {:<11.6} {:>8d}\n",i,width, diff --git a/src/RIGID/fix_shake.h b/src/RIGID/fix_shake.h index d6f9a8f5d6..820d68ebe7 100644 --- a/src/RIGID/fix_shake.h +++ b/src/RIGID/fix_shake.h @@ -113,8 +113,7 @@ class FixShake : public Fix { int nlist, maxlist; // size and max-size of list // stat quantities - int *b_count, *b_count_all, *b_atom, - *b_atom_all; // counts for each bond type, atoms in bond cluster + int *b_count, *b_count_all; // counts for each bond type, atoms in bond cluster double *b_ave, *b_max, *b_min; // ave/max/min dist for each bond type double *b_ave_all, *b_max_all, *b_min_all; // MPI summing arrays int *a_count, *a_count_all; // ditto for angle types From c4a76103667823d30ce4ce1b4d89ff90889270a0 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 10 Jun 2022 11:07:50 -0400 Subject: [PATCH 04/59] update docs and include suggestions --- doc/src/fix_shake.rst | 56 ++++++++++++--------- doc/utils/sphinx-config/false_positives.txt | 1 + 2 files changed, 33 insertions(+), 24 deletions(-) diff --git a/doc/src/fix_shake.rst b/doc/src/fix_shake.rst index 137cb1aedb..4ba2eb7f4d 100644 --- a/doc/src/fix_shake.rst +++ b/doc/src/fix_shake.rst @@ -168,13 +168,17 @@ See the :doc:`molecule ` command for details. The only settings required to be in this file (by this command) are the SHAKE info of atoms in the molecule. -The *kbond* keyword allows to set the restraint force constant when fix -shake or fix rattle are used during minimization. In that case the -constraint algorithms are *not* applied and restraint forces are used -instead to help maintaining the geometries. How well the geometries -are maintained and how quickly a minimization will converge depends on -the magnitude of the force constant (kbond). If it is chosen too large -the minimization may converge slowly. The default is 1.0e6*k_B. +The *kbond* keyword sets the restraint force constant when fix shake or +fix rattle are used during minimization. In that case the constraint +algorithms are *not* applied and restraint forces are used instead to +maintain the geometries similar to the constraints. How well the +geometries are maintained and how quickly a minimization converges, +depends on the force constant *kbond*: larger values will reduce the +deviation from the desired geometry, but can also lead to slower +convergence of the minimization or lead to instabilities depending on +the minimization algorithm requiring to reduce the value of +:doc:`timestep `. The default value for *kbond* depends on +the :doc:`units ` setting and is 1.0e6*k_B. ---------- @@ -190,7 +194,7 @@ LAMMPS closely follows (:ref:`Andersen (1983) `). .. note:: - The fix rattle command modifies forces and velocities and thus + The *fix rattle* command modifies forces and velocities and thus should be defined after all other integration fixes in your input script. If you define other fixes that modify velocities or forces after fix rattle operates, then fix rattle will not take them into @@ -207,24 +211,28 @@ Restart, fix_modify, output, run start/stop, minimize info No information about these fixes is written to :doc:`binary restart files `. -When used during minimization, the SHAKE or RATTLE algorithms are **not** -applied. Strong restraint forces are applied instead. +Fix *shake* and *rattle* behave differently during minimization and +during a molecular dynamics run. -The :doc:`fix_modify ` *virial* option is supported by -these fixes to add the contribution due to the added forces on atoms -to both the global pressure and per-atom stress of the system via the -:doc:`compute pressure ` and :doc:`compute -stress/atom ` commands. The former can be -accessed by :doc:`thermodynamic output `. The default -setting for this fix is :doc:`fix_modify virial yes `. -During minimization, the virial contribution is *NOT* available. +When used during minimization, the SHAKE or RATTLE algorithms are +**not** applied. The constraints are replaced by restraint forces +instead. The energy due to restraint forces is included in the global +potential energy, but virial contributions from them are not included in +the global pressure. The restraint energy is also accessible as a +global scalar property of the fix. -No global or per-atom quantities are stored by these fixes for access by -various :doc:`output commands ` during a run. During -minimization, this fix computes a global scalar which is the energy of -the restraint forces applied insteat of the constraints. No parameter -of these fixes can be used with the *start/stop* keywords of the -:doc:`run ` command. +During molecular dynamics runs, the fixes apply the requested +constraints. The :doc:`fix_modify ` *virial* option is in +this case supported by these fixes to add the contribution due to the +added constraint forces on atoms to both the global pressure and +per-atom stress of the system via the :doc:`compute pressure +` and :doc:`compute stress/atom ` +commands. The former can be accessed by :doc:`thermodynamic output +`. The default setting for this fix is :doc:`fix_modify +virial yes `. No global or per-atom quantities are stored by +these fixes for access by various :doc:`output commands ` +during a run. No parameter of these fixes can be used with the +*start/stop* keywords of the :doc:`run ` command. Restrictions diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index b42cff262a..ff1d17ee07 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -1609,6 +1609,7 @@ kb kB kbit kbits +kbond kcal kcl Kd From f05fcaf0d5f8b086a0deaf07839bd8c1686ba68e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 17 Jun 2022 05:31:42 -0400 Subject: [PATCH 05/59] change energy tally during minimize --- src/RIGID/fix_shake.cpp | 45 ++++++++++++++++++++++++++-- src/RIGID/fix_shake.h | 3 ++ src/compute_pe_atom.cpp | 66 ++++++++++++++++++++++------------------- 3 files changed, 82 insertions(+), 32 deletions(-) diff --git a/src/RIGID/fix_shake.cpp b/src/RIGID/fix_shake.cpp index c284d99011..5b2cc7a33a 100644 --- a/src/RIGID/fix_shake.cpp +++ b/src/RIGID/fix_shake.cpp @@ -67,6 +67,11 @@ FixShake::FixShake(LAMMPS *lmp, int narg, char **arg) : centroidstressflag = CENTROID_AVAIL; next_output = -1; + // to avoid uninitialized access + vflag_post_force = 0; + eflag_pre_reverse = 0; + ebond = 0.0; + // error check molecular = atom->molecular; @@ -324,6 +329,7 @@ int FixShake::setmask() mask |= PRE_NEIGHBOR; mask |= POST_FORCE; mask |= POST_FORCE_RESPA; + mask |= MIN_PRE_REVERSE; mask |= MIN_POST_FORCE; mask |= POST_RUN; return mask; @@ -505,6 +511,13 @@ void FixShake::min_setup(int vflag) min_post_force(vflag); } +/* --------------------------------------------------------------------- */ + +void FixShake::setup_pre_reverse(int eflag, int vflag) +{ + min_pre_reverse(eflag,vflag); +} + /* ---------------------------------------------------------------------- build list of SHAKE clusters to constrain if one or more atoms in cluster are on this proc, @@ -513,6 +526,7 @@ void FixShake::min_setup(int vflag) void FixShake::pre_neighbor() { + ebond = 0.0; int atom1,atom2,atom3,atom4; // local copies of atom quantities @@ -653,6 +667,15 @@ void FixShake::post_force_respa(int vflag, int ilevel, int iloop) vflag_post_force = vflag; } +/* ---------------------------------------------------------------------- + store eflag so it can be used in min_post_force +------------------------------------------------------------------------- */ + +void FixShake::min_pre_reverse(int eflag, int /*vflag*/) +{ + eflag_pre_reverse = eflag; +} + /* ---------------------------------------------------------------------- substitute shake constraints with very strong bonds ------------------------------------------------------------------------- */ @@ -668,6 +691,9 @@ void FixShake::min_post_force(int vflag) next_output = (ntimestep/output_every)*output_every + output_every; } else next_output = -1; + int eflag = eflag_pre_reverse; + ev_init(eflag, vflag); + x = atom->x; f = atom->f; nlocal = atom->nlocal; @@ -2522,18 +2548,33 @@ void FixShake::bond_force(tagint id1, tagint id2, double length) const double dr = r - length; const double rk = kbond * dr; const double fbond = (r > 0.0) ? -2.0 * rk / r : 0.0; + const double eb = rk*dr; + int list[2]; + int nlist = 0; if (i1 < nlocal) { f[i1][0] += delx * fbond; f[i1][1] += dely * fbond; f[i1][2] += delz * fbond; - ebond += 0.5*rk*dr; + list[nlist++] = i1; + ebond += 0.5*eb; } if (i2 < nlocal) { f[i2][0] -= delx * fbond; f[i2][1] -= dely * fbond; f[i2][2] -= delz * fbond; - ebond += 0.5*rk*dr; + list[nlist++] = i2; + ebond += 0.5*eb; + } + if (evflag) { + double v[6]; + v[0] = 0.5 * delx * delx * fbond; + v[1] = 0.5 * dely * dely * fbond; + v[2] = 0.5 * delz * delz * fbond; + v[3] = 0.5 * delx * dely * fbond; + v[4] = 0.5 * delx * delz * fbond; + v[5] = 0.5 * dely * delz * fbond; + ev_tally(nlist, list, 2.0, eb, v); } } diff --git a/src/RIGID/fix_shake.h b/src/RIGID/fix_shake.h index 820d68ebe7..914b73ea34 100644 --- a/src/RIGID/fix_shake.h +++ b/src/RIGID/fix_shake.h @@ -34,10 +34,12 @@ class FixShake : public Fix { int setmask() override; void init() override; void setup(int) override; + void setup_pre_reverse(int, int) override; void min_setup(int) override; void pre_neighbor() override; void post_force(int) override; void post_force_respa(int, int, int) override; + void min_pre_reverse(int, int) override; void min_post_force(int) override; void post_run() override; @@ -64,6 +66,7 @@ class FixShake : public Fix { protected: int vflag_post_force; // store the vflag of last post_force call + int eflag_pre_reverse; // store the eflag of last pre_reverse call int respa; // 0 = vel. Verlet, 1 = respa int rattle; // 0 = SHAKE, 1 = RATTLE double tolerance; // SHAKE tolerance diff --git a/src/compute_pe_atom.cpp b/src/compute_pe_atom.cpp index a627e133e5..b1b62ec16d 100644 --- a/src/compute_pe_atom.cpp +++ b/src/compute_pe_atom.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -13,30 +12,31 @@ ------------------------------------------------------------------------- */ #include "compute_pe_atom.h" -#include -#include "atom.h" -#include "update.h" -#include "comm.h" -#include "force.h" -#include "pair.h" -#include "bond.h" + #include "angle.h" +#include "atom.h" +#include "bond.h" +#include "comm.h" #include "dihedral.h" +#include "error.h" +#include "force.h" #include "improper.h" #include "kspace.h" -#include "modify.h" #include "memory.h" -#include "error.h" +#include "modify.h" +#include "pair.h" +#include "update.h" + +#include using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ ComputePEAtom::ComputePEAtom(LAMMPS *lmp, int narg, char **arg) : - Compute(lmp, narg, arg), - energy(nullptr) + Compute(lmp, narg, arg), energy(nullptr) { - if (narg < 3) error->all(FLERR,"Illegal compute pe/atom command"); + if (narg < 3) error->all(FLERR, "Illegal compute pe/atom command"); peratom_flag = 1; size_peratom_cols = 0; @@ -56,14 +56,22 @@ ComputePEAtom::ComputePEAtom(LAMMPS *lmp, int narg, char **arg) : fixflag = 0; int iarg = 3; while (iarg < narg) { - if (strcmp(arg[iarg],"pair") == 0) pairflag = 1; - else if (strcmp(arg[iarg],"bond") == 0) bondflag = 1; - else if (strcmp(arg[iarg],"angle") == 0) angleflag = 1; - else if (strcmp(arg[iarg],"dihedral") == 0) dihedralflag = 1; - else if (strcmp(arg[iarg],"improper") == 0) improperflag = 1; - else if (strcmp(arg[iarg],"kspace") == 0) kspaceflag = 1; - else if (strcmp(arg[iarg],"fix") == 0) fixflag = 1; - else error->all(FLERR,"Illegal compute pe/atom command"); + if (strcmp(arg[iarg], "pair") == 0) + pairflag = 1; + else if (strcmp(arg[iarg], "bond") == 0) + bondflag = 1; + else if (strcmp(arg[iarg], "angle") == 0) + angleflag = 1; + else if (strcmp(arg[iarg], "dihedral") == 0) + dihedralflag = 1; + else if (strcmp(arg[iarg], "improper") == 0) + improperflag = 1; + else if (strcmp(arg[iarg], "kspace") == 0) + kspaceflag = 1; + else if (strcmp(arg[iarg], "fix") == 0) + fixflag = 1; + else + error->all(FLERR, "Illegal compute pe/atom command"); iarg++; } } @@ -86,7 +94,7 @@ void ComputePEAtom::compute_peratom() invoked_peratom = update->ntimestep; if (update->eflag_atom != invoked_peratom) - error->all(FLERR,"Per-atom energy was not tallied on needed timestep"); + error->all(FLERR, "Per-atom energy was not tallied on needed timestep"); // grow local energy array if necessary // needs to be atom->nmax in length @@ -94,7 +102,7 @@ void ComputePEAtom::compute_peratom() if (atom->nmax > nmax) { memory->destroy(energy); nmax = atom->nmax; - memory->create(energy,nmax,"pe/atom:energy"); + memory->create(energy, nmax, "pe/atom:energy"); vector_atom = energy; } @@ -153,13 +161,11 @@ void ComputePEAtom::compute_peratom() // add in per-atom contributions from relevant fixes // always only for owned atoms, not ghost - if (fixflag && modify->n_energy_atom) - modify->energy_atom(nlocal,energy); + if (fixflag && modify->n_energy_atom) modify->energy_atom(nlocal, energy); // communicate ghost energy between neighbor procs - if (force->newton || (force->kspace && force->kspace->tip4pflag)) - comm->reverse_comm(this); + if (force->newton || (force->kspace && force->kspace->tip4pflag)) comm->reverse_comm(this); // zero energy of atoms not in group // only do this after comm since ghost contributions must be included @@ -174,7 +180,7 @@ void ComputePEAtom::compute_peratom() int ComputePEAtom::pack_reverse_comm(int n, int first, double *buf) { - int i,m,last; + int i, m, last; m = 0; last = first + n; @@ -186,7 +192,7 @@ int ComputePEAtom::pack_reverse_comm(int n, int first, double *buf) void ComputePEAtom::unpack_reverse_comm(int n, int *list, double *buf) { - int i,j,m; + int i, j, m; m = 0; for (i = 0; i < n; i++) { @@ -201,6 +207,6 @@ void ComputePEAtom::unpack_reverse_comm(int n, int *list, double *buf) double ComputePEAtom::memory_usage() { - double bytes = (double)nmax * sizeof(double); + double bytes = (double) nmax * sizeof(double); return bytes; } From 0ad45a02249d6c60e2c80a34330fb76f08f6f620 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 17 Jun 2022 05:53:34 -0400 Subject: [PATCH 06/59] correctly produce eatom (=0) for MD runs --- src/RIGID/fix_shake.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/RIGID/fix_shake.cpp b/src/RIGID/fix_shake.cpp index 5b2cc7a33a..6673472458 100644 --- a/src/RIGID/fix_shake.cpp +++ b/src/RIGID/fix_shake.cpp @@ -601,7 +601,8 @@ void FixShake::post_force(int vflag) // virial setup - v_init(vflag); + int eflag = eflag_pre_reverse; + ev_init(eflag, vflag); ebond = 0.0; // loop over clusters to add constraint forces From e66229dadb61f60c784c7f1863331a6afefcf4de Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 17 Jun 2022 06:19:57 -0400 Subject: [PATCH 07/59] update docs --- doc/src/fix_shake.rst | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/doc/src/fix_shake.rst b/doc/src/fix_shake.rst index 4ba2eb7f4d..b53f8602ec 100644 --- a/doc/src/fix_shake.rst +++ b/doc/src/fix_shake.rst @@ -216,23 +216,25 @@ during a molecular dynamics run. When used during minimization, the SHAKE or RATTLE algorithms are **not** applied. The constraints are replaced by restraint forces -instead. The energy due to restraint forces is included in the global -potential energy, but virial contributions from them are not included in -the global pressure. The restraint energy is also accessible as a -global scalar property of the fix. +instead. The energy and virial contributions due to the restraint +forces are tallied into global and per-atom accumulators. The total +restraint energy is also accessible as a global scalar property of the +fix. During molecular dynamics runs, the fixes apply the requested -constraints. The :doc:`fix_modify ` *virial* option is in -this case supported by these fixes to add the contribution due to the -added constraint forces on atoms to both the global pressure and -per-atom stress of the system via the :doc:`compute pressure -` and :doc:`compute stress/atom ` -commands. The former can be accessed by :doc:`thermodynamic output -`. The default setting for this fix is :doc:`fix_modify -virial yes `. No global or per-atom quantities are stored by -these fixes for access by various :doc:`output commands ` -during a run. No parameter of these fixes can be used with the -*start/stop* keywords of the :doc:`run ` command. +constraints. + +The :doc:`fix_modify ` *virial* option is supported by these +fixes to add the contribution due to the added constraint forces on +atoms to both the global pressure and per-atom stress of the system via +the :doc:`compute pressure ` and :doc:`compute +stress/atom ` commands. The former can be accessed +by :doc:`thermodynamic output `. The default setting for +this fix is :doc:`fix_modify virial yes `. No global or +per-atom quantities are stored by these fixes for access by various +:doc:`output commands ` during an MD run. No parameter of +these fixes can be used with the *start/stop* keywords of the :doc:`run +` command. Restrictions @@ -256,6 +258,11 @@ degrees (e.g. linear CO2 molecule). This causes numeric difficulties. You can use :doc:`fix rigid or fix rigid/small ` instead to make a linear molecule rigid. +When used during minimization choosing a too large value of the *kbond* +can make minimization very inefficent and also cause stability problems +with some minimization algorithms. Sometimes those can be avoided by +reducing the :doc:`timestep `. + Related commands """""""""""""""" From 114b19f620b3d7904cfe9bb5cbf1a1621767bd40 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 23 Jun 2022 06:51:13 -0400 Subject: [PATCH 08/59] make certain that the fix energy is properly reset to zero --- src/KOKKOS/fix_shake_kokkos.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/KOKKOS/fix_shake_kokkos.cpp b/src/KOKKOS/fix_shake_kokkos.cpp index 5ed8cfccb3..40f641780a 100644 --- a/src/KOKKOS/fix_shake_kokkos.cpp +++ b/src/KOKKOS/fix_shake_kokkos.cpp @@ -192,6 +192,7 @@ void FixShakeKokkos::pre_neighbor() // local copies of atom quantities // used by SHAKE until next re-neighboring + ebond = 0.0; x = atom->x; v = atom->v; f = atom->f; @@ -302,6 +303,7 @@ void FixShakeKokkos::pre_neighbor() template void FixShakeKokkos::post_force(int vflag) { + ebond = 0.0; copymode = 1; d_x = atomKK->k_x.view(); From caf21d09b43c2820518e00e033168e767b10119b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 5 Aug 2022 18:12:29 -0400 Subject: [PATCH 09/59] disallow using fix shake/rattle with KOKKOS during minimization (for now) --- src/KOKKOS/fix_shake_kokkos.cpp | 10 ++++++++++ src/KOKKOS/fix_shake_kokkos.h | 1 + 2 files changed, 11 insertions(+) diff --git a/src/KOKKOS/fix_shake_kokkos.cpp b/src/KOKKOS/fix_shake_kokkos.cpp index 40f641780a..d622da94ec 100644 --- a/src/KOKKOS/fix_shake_kokkos.cpp +++ b/src/KOKKOS/fix_shake_kokkos.cpp @@ -180,6 +180,16 @@ void FixShakeKokkos::init() } +/* ---------------------------------------------------------------------- + run setup for minimization. +------------------------------------------------------------------------- */ + +template +void FixShakeKokkos::min_setup(int /*vflag*/) +{ + error->all(FLERR, "Cannot yet use fix {} during minimization with Kokkos", style); +} + /* ---------------------------------------------------------------------- build list of SHAKE clusters to constrain if one or more atoms in cluster are on this proc, diff --git a/src/KOKKOS/fix_shake_kokkos.h b/src/KOKKOS/fix_shake_kokkos.h index 027b36b100..df5256422f 100644 --- a/src/KOKKOS/fix_shake_kokkos.h +++ b/src/KOKKOS/fix_shake_kokkos.h @@ -51,6 +51,7 @@ class FixShakeKokkos : public FixShake, public KokkosBase { FixShakeKokkos(class LAMMPS *, int, char **); ~FixShakeKokkos() override; void init() override; + void min_setup(int) override; void pre_neighbor() override; void post_force(int) override; From 76123d33473c62cedbedc6c44bafcaed6f15a4eb Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Aug 2022 01:52:27 -0400 Subject: [PATCH 10/59] change hyper command to use `get_dump_by_id()` instead of `find_dump()` --- src/REPLICA/hyper.cpp | 21 ++++++--------------- src/REPLICA/hyper.h | 4 ++-- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/src/REPLICA/hyper.cpp b/src/REPLICA/hyper.cpp index eb739f486f..f13711f213 100644 --- a/src/REPLICA/hyper.cpp +++ b/src/REPLICA/hyper.cpp @@ -39,7 +39,7 @@ enum{NOHYPER,GLOBAL,LOCAL}; /* ---------------------------------------------------------------------- */ -Hyper::Hyper(LAMMPS *lmp) : Command(lmp), dumplist(nullptr) {} +Hyper::Hyper(LAMMPS *_lmp) : Command(_lmp) {} /* ---------------------------------------------------------------------- perform hyperdynamics simulation @@ -177,9 +177,7 @@ void Hyper::command(int narg, char **arg) fix_event->store_state_quench(); quench(1); - if (dumpflag) - for (int idump = 0; idump < ndump; idump++) - output->dump[dumplist[idump]]->write(); + if (dumpflag) for (auto idump : dumplist) idump->write(); fix_event->store_event(); if (hyperenable) fix_hyper->build_bond_list(0); fix_event->restore_state_quench(); @@ -208,9 +206,7 @@ void Hyper::command(int narg, char **arg) nevent++; nevent_atoms += ecount; - if (dumpflag) - for (int idump = 0; idump < ndump; idump++) - output->dump[dumplist[idump]]->write(); + if (dumpflag) for (auto idump : dumplist) idump->write(); fix_event->store_event(); if (hyperenable) fix_hyper->build_bond_list(ecount); @@ -345,7 +341,6 @@ void Hyper::command(int narg, char **arg) delete [] id_fix; delete [] id_compute; - memory->destroy(dumplist); delete finish; modify->delete_fix("hyper_event"); @@ -444,8 +439,6 @@ void Hyper::options(int narg, char **arg) maxiter = 40; maxeval = 50; dumpflag = 0; - ndump = 0; - dumplist = nullptr; rebond = 0; int iarg = 0; @@ -462,11 +455,9 @@ void Hyper::options(int narg, char **arg) } else if (strcmp(arg[iarg],"dump") == 0) { if (iarg+2 > narg) error->all(FLERR,"Illegal hyper command"); dumpflag = 1; - int idump = output->find_dump(arg[iarg+1]); - if (idump < 0) - error->all(FLERR,"Dump ID in hyper command does not exist"); - memory->grow(dumplist,ndump+1,"hyper:dumplist"); - dumplist[ndump++] = idump; + auto idump = output->get_dump_by_id(arg[iarg+1]); + if (!idump) error->all(FLERR,"Dump ID {} in hyper command does not exist", arg[iarg+1]); + dumplist.emplace_back(idump); iarg += 2; } else if (strcmp(arg[iarg],"rebond") == 0) { diff --git a/src/REPLICA/hyper.h b/src/REPLICA/hyper.h index 1ea7fa0327..28229d819e 100644 --- a/src/REPLICA/hyper.h +++ b/src/REPLICA/hyper.h @@ -35,8 +35,8 @@ class Hyper : public Command { int t_event; double etol, ftol; int maxiter, maxeval; - int stepmode, dumpflag, ndump, rebond; - int *dumplist; + int stepmode, dumpflag, rebond; + std::vector dumplist; int neigh_every, neigh_delay, neigh_dist_check; int quench_reneighbor; From e8e6beed505ed83ba59c39b3a066b7a413879938 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Aug 2022 01:52:42 -0400 Subject: [PATCH 11/59] find dump is no longer used --- src/output.cpp | 15 --------------- src/output.h | 1 - 2 files changed, 16 deletions(-) diff --git a/src/output.cpp b/src/output.cpp index 7d8188a4c3..1e0d74bf20 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -835,21 +835,6 @@ void Output::delete_dump(const std::string &id) ndump--; } -/* ---------------------------------------------------------------------- - find a dump by ID - return index of dump or -1 if not found -------------------------------------------------------------------------- */ - -int Output::find_dump(const char *id) -{ - if (id == nullptr) return -1; - int idump; - for (idump = 0; idump < ndump; idump++) - if (strcmp(id,dump[idump]->id) == 0) break; - if (idump == ndump) return -1; - return idump; -} - /* ---------------------------------------------------------------------- find a dump by ID return pointer to dump diff --git a/src/output.h b/src/output.h index c35d2728e5..4f9bfc3c67 100644 --- a/src/output.h +++ b/src/output.h @@ -83,7 +83,6 @@ class Output : protected Pointers { Dump *add_dump(int, char **); // add a Dump to Dump list void modify_dump(int, char **); // modify a Dump void delete_dump(const std::string &); // delete a Dump from Dump list - int find_dump(const char *); // find a Dump ID Dump *get_dump_by_id(const std::string &); // find a Dump by ID int check_time_dumps(bigint); // check if any time dump is output now From 2b16a8d1c6bf6e5aee4f6936675d7137cb929360 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Aug 2022 02:19:18 -0400 Subject: [PATCH 12/59] document how to update code that uses `Output::find_dump()` --- doc/src/Developer_updating.rst | 41 +++++++++++++++++++++ doc/utils/sphinx-config/false_positives.txt | 1 + 2 files changed, 42 insertions(+) diff --git a/doc/src/Developer_updating.rst b/doc/src/Developer_updating.rst index 1913a38cbd..c4831d8db7 100644 --- a/doc/src/Developer_updating.rst +++ b/doc/src/Developer_updating.rst @@ -24,6 +24,7 @@ Available topics in mostly chronological order are: - `Use of "override" instead of "virtual"`_ - `Simplified and more compact neighbor list requests`_ - `Split of fix STORE into fix STORE/GLOBAL and fix STORE/PERATOM`_ +- `Use Output::get_dump_by_id() instead of Output::find_dump()`_ ---- @@ -382,3 +383,43 @@ New: FixStoreGlobal *fix = dynamic_cast(modify->get_fix_by_id(id_fix)); This change is **required** or else the code will not compile. + +Use Output::get_dump_by_id() instead of Output::find_dump() +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. versionchanged:: TBD + +The accessor function to individual dump style instances has been changed +from ``Output::find_dump()`` returning the index of the dump instance in +the list of dumps to ``Output::get_dump_by_id()`` returning a pointer to +the dump directly. Example: + +Old: + +.. code-block:: C++ + + int idump = output->find_dump(arg[iarg+1]); + if (idump < 0) + error->all(FLERR,"Dump ID in hyper command does not exist"); + memory->grow(dumplist,ndump+1,"hyper:dumplist"); + dumplist[ndump++] = idump; + + [...] + + if (dumpflag) + for (int idump = 0; idump < ndump; idump++) + output->dump[dumplist[idump]]->write(); + +New: + +.. code-block:: C++ + + auto idump = output->get_dump_by_id(arg[iarg+1]); + if (!idump) error->all(FLERR,"Dump ID {} in hyper command does not exist", arg[iarg+1]); + dumplist.emplace_back(idump); + + [...] + + if (dumpflag) for (auto idump : dumplist) idump->write(); + +This change is **required** or else the code will not compile. diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index 56fd7a1305..ee225b4a1f 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -13,6 +13,7 @@ Accelrys acceptor Acceptor acceptors +accessor accomx accomy accomz From 9bd45e70da6aaf59947aa159b6dfe05d7c6d16f5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Aug 2022 03:00:37 -0400 Subject: [PATCH 13/59] simplify and modernize --- src/modify.cpp | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/src/modify.cpp b/src/modify.cpp index aac08bb31e..90399abec4 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -797,7 +797,7 @@ int Modify::min_reset_ref() Fix *Modify::add_fix(int narg, char **arg, int trysuffix) { - if (narg < 3) error->all(FLERR, "Illegal fix command"); + if (narg < 3) utils::missing_cmd_args(FLERR, "fix", error); // cannot define fix before box exists unless style is in exception list // don't like this way of checking for exceptions by adding fixes to list, @@ -988,7 +988,7 @@ Fix *Modify::replace_fix(const char *replaceID, int narg, char **arg, int trysuf // change ID, igroup, style of fix being replaced to match new fix // requires some error checking on arguments for new fix - if (narg < 3) error->all(FLERR, "Illegal replace_fix invocation"); + if (narg < 3) error->all(FLERR, "Not enough arguments for replace_fix invocation"); if (get_fix_by_id(arg[0])) error->all(FLERR, "Replace_fix ID {} is already in use", arg[0]); delete[] oldfix->id; @@ -1026,16 +1026,11 @@ Fix *Modify::replace_fix(const std::string &oldfix, const std::string &fixcmd, i void Modify::modify_fix(int narg, char **arg) { - if (narg < 2) error->all(FLERR, "Illegal fix_modify command"); + if (narg < 2) utils::missing_cmd_args(FLERR, "fix_modify", error); - // lookup Fix ID - - int ifix; - for (ifix = 0; ifix < nfix; ifix++) - if (strcmp(arg[0], fix[ifix]->id) == 0) break; - if (ifix == nfix) error->all(FLERR, "Could not find fix_modify ID {}", arg[0]); - - fix[ifix]->modify_params(narg - 1, &arg[1]); + auto ifix = get_fix_by_id(arg[0]); + if (!ifix) error->all(FLERR, "Could not find fix_modify ID {}", arg[0]); + ifix->modify_params(narg - 1, &arg[1]); } /* ---------------------------------------------------------------------- @@ -1226,13 +1221,11 @@ int Modify::check_rigid_list_overlap(int *select) Compute *Modify::add_compute(int narg, char **arg, int trysuffix) { - if (narg < 3) error->all(FLERR, "Illegal compute command"); + if (narg < 3) utils::missing_cmd_args(FLERR, "compute", error); // error check - for (int icompute = 0; icompute < ncompute; icompute++) - if (strcmp(arg[0], compute[icompute]->id) == 0) - error->all(FLERR, "Reuse of compute ID '{}'", arg[0]); + if (get_compute_by_id(arg[0])) error->all(FLERR, "Reuse of compute ID '{}'", arg[0]); // extend Compute list if necessary @@ -1299,16 +1292,13 @@ Compute *Modify::add_compute(const std::string &computecmd, int trysuffix) void Modify::modify_compute(int narg, char **arg) { - if (narg < 2) error->all(FLERR, "Illegal compute_modify command"); + if (narg < 2) utils::missing_cmd_args(FLERR, "compute_modify",error); // lookup Compute ID - int icompute; - for (icompute = 0; icompute < ncompute; icompute++) - if (strcmp(arg[0], compute[icompute]->id) == 0) break; - if (icompute == ncompute) error->all(FLERR, "Could not find compute_modify ID {}", arg[0]); - - compute[icompute]->modify_params(narg - 1, &arg[1]); + auto icompute = get_compute_by_id(arg[0]); + if (!icompute) error->all(FLERR, "Could not find compute_modify ID {}", arg[0]); + icompute->modify_params(narg - 1, &arg[1]); } /* ---------------------------------------------------------------------- From c574ed51b5fa0c7659f9d04ce4258d278b513f4f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Aug 2022 03:04:58 -0400 Subject: [PATCH 14/59] modernize and simplify --- src/output.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/output.cpp b/src/output.cpp index 1e0d74bf20..b525510f61 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -792,16 +792,13 @@ Dump *Output::add_dump(int narg, char **arg) void Output::modify_dump(int narg, char **arg) { - if (narg < 1) utils::missing_cmd_args(FLERR, "dump_modify",error); + if (narg < 2) utils::missing_cmd_args(FLERR, "dump_modify",error); // find which dump it is - int idump; - for (idump = 0; idump < ndump; idump++) - if (strcmp(arg[0],dump[idump]->id) == 0) break; - if (idump == ndump) error->all(FLERR,"Could not find dump_modify ID: {}", arg[0]); - - dump[idump]->modify_params(narg-1,&arg[1]); + auto idump = get_dump_by_id(arg[0]); + if (!idump) error->all(FLERR,"Could not find dump_modify ID: {}", arg[0]); + idump->modify_params(narg-1,&arg[1]); } /* ---------------------------------------------------------------------- From aab62d5ed9ef3ddb4e0ad727ba00507d5e2b9974 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Aug 2022 03:05:11 -0400 Subject: [PATCH 15/59] add get_dump_list() function --- src/output.cpp | 12 ++++++++++++ src/output.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/output.cpp b/src/output.cpp index b525510f61..1525d4630d 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -783,6 +783,7 @@ Dump *Output::add_dump(int narg, char **arg) next_dump[idump] = 0; ndump++; + dump_list = std::vector(dump, dump + ndump); return dump[idump]; } @@ -830,6 +831,7 @@ void Output::delete_dump(const std::string &id) ivar_dump[i-1] = ivar_dump[i]; } ndump--; + dump_list = std::vector(dump, dump + ndump); } /* ---------------------------------------------------------------------- @@ -844,6 +846,16 @@ Dump *Output::get_dump_by_id(const std::string &id) return nullptr; } +/* ---------------------------------------------------------------------- + return list of dumps as vector +------------------------------------------------------------------------- */ + +const std::vector &Output::get_dump_list() +{ + dump_list = std::vector(dump, dump + ndump); + return dump_list; +} + /* ---------------------------------------------------------------------- set thermo output frequency from input script ------------------------------------------------------------------------- */ diff --git a/src/output.h b/src/output.h index 4f9bfc3c67..85b6886fce 100644 --- a/src/output.h +++ b/src/output.h @@ -84,6 +84,7 @@ class Output : protected Pointers { void modify_dump(int, char **); // modify a Dump void delete_dump(const std::string &); // delete a Dump from Dump list Dump *get_dump_by_id(const std::string &); // find a Dump by ID + const std::vector &get_dump_list(); // get vector with all dumps int check_time_dumps(bigint); // check if any time dump is output now void set_thermo(int, char **); // set thermo output freqquency @@ -93,6 +94,7 @@ class Output : protected Pointers { void memory_usage(); // print out memory usage private: + std::vector dump_list; void calculate_next_dump(int, int, bigint); }; From 91b98484ad9926eb83b1635076a34108b3176714 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Aug 2022 03:45:36 -0400 Subject: [PATCH 16/59] modernize and simplify --- src/KOKKOS/comm_kokkos.cpp | 18 ++++++++-------- src/comm.cpp | 22 +++++++++---------- src/group.cpp | 25 +++++++++++----------- src/library.cpp | 44 +++++++++----------------------------- 4 files changed, 41 insertions(+), 68 deletions(-) diff --git a/src/KOKKOS/comm_kokkos.cpp b/src/KOKKOS/comm_kokkos.cpp index fea5864225..527ac2c174 100644 --- a/src/KOKKOS/comm_kokkos.cpp +++ b/src/KOKKOS/comm_kokkos.cpp @@ -125,19 +125,19 @@ void CommKokkos::init() if (force->pair && (force->pair->execution_space == Host)) check_reverse += force->pair->comm_reverse; - for (int i = 0; i < modify->nfix; i++) { - check_forward += modify->fix[i]->comm_forward; - check_reverse += modify->fix[i]->comm_reverse; + for (const auto &fix : modify->get_fix_list()) { + check_forward += fix->comm_forward; + check_reverse += fix->comm_reverse; } - for (int i = 0; i < modify->ncompute; i++) { - check_forward += modify->compute[i]->comm_forward; - check_reverse += modify->compute[i]->comm_reverse; + for (const auto &compute : modify->get_compute_list()) { + check_forward += compute->comm_forward; + check_reverse += compute->comm_reverse; } - for (int i = 0; i < output->ndump; i++) { - check_forward += output->dump[i]->comm_forward; - check_reverse += output->dump[i]->comm_reverse; + for (const auto &dump : output->get_dump_list()) { + check_forward += dump->comm_forward; + check_reverse += dump->comm_reverse; } if (force->newton == 0) check_reverse = 0; diff --git a/src/comm.cpp b/src/comm.cpp index 9f46031185..5175af28e5 100644 --- a/src/comm.cpp +++ b/src/comm.cpp @@ -222,18 +222,18 @@ void Comm::init() if (force->bond) maxreverse = MAX(maxreverse,force->bond->comm_reverse); for (const auto &fix : fix_list) { - maxforward = MAX(maxforward,fix->comm_forward); - maxreverse = MAX(maxreverse,fix->comm_reverse); + maxforward = MAX(maxforward, fix->comm_forward); + maxreverse = MAX(maxreverse, fix->comm_reverse); } - for (int i = 0; i < modify->ncompute; i++) { - maxforward = MAX(maxforward,modify->compute[i]->comm_forward); - maxreverse = MAX(maxreverse,modify->compute[i]->comm_reverse); + for (const auto &compute : modify->get_compute_list()) { + maxforward = MAX(maxforward,compute->comm_forward); + maxreverse = MAX(maxreverse,compute->comm_reverse); } - for (int i = 0; i < output->ndump; i++) { - maxforward = MAX(maxforward,output->dump[i]->comm_forward); - maxreverse = MAX(maxreverse,output->dump[i]->comm_reverse); + for (const auto &dump: output->get_dump_list()) { + maxforward = MAX(maxforward,dump->comm_forward); + maxreverse = MAX(maxreverse,dump->comm_reverse); } if (force->newton == 0) maxreverse = 0; @@ -247,8 +247,7 @@ void Comm::init() maxexchange_atom = atom->avec->maxexchange; maxexchange_fix_dynamic = 0; - for (const auto &fix : fix_list) - if (fix->maxexchange_dynamic) maxexchange_fix_dynamic = 1; + for (const auto &fix : fix_list) if (fix->maxexchange_dynamic) maxexchange_fix_dynamic = 1; if ((mode == Comm::MULTI) && (neighbor->style != Neighbor::MULTI)) error->all(FLERR,"Cannot use comm mode multi without multi-style neighbor lists"); @@ -270,8 +269,7 @@ void Comm::init() void Comm::init_exchange() { maxexchange_fix = 0; - for (const auto &fix : modify->get_fix_list()) - maxexchange_fix += fix->maxexchange; + for (const auto &fix : modify->get_fix_list()) maxexchange_fix += fix->maxexchange; maxexchange = maxexchange_atom + maxexchange_fix; bufextra = maxexchange + BUFEXTRA; diff --git a/src/group.cpp b/src/group.cpp index 41c24b8f48..4179797d35 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -101,22 +101,21 @@ void Group::assign(int narg, char **arg) // clear mask of each atom assigned to this group if (strcmp(arg[1],"delete") == 0) { - if (narg != 2) error->all(FLERR,"Illegal group command"); + if (narg != 2) error->all(FLERR,"Illegal group command: too many arguments"); int igroup = find(arg[0]); - if (igroup == -1) error->all(FLERR,"Could not find group delete group ID"); + if (igroup == -1) error->all(FLERR,"Could not find group delete group ID {}",arg[0]); if (igroup == 0) error->all(FLERR,"Cannot delete group all"); - for (const auto &fix : modify->get_fix_list()) - if (fix->igroup == igroup) - error->all(FLERR,"Cannot delete group currently used by a fix"); - for (i = 0; i < modify->ncompute; i++) - if (modify->compute[i]->igroup == igroup) - error->all(FLERR,"Cannot delete group currently used by a compute"); - for (i = 0; i < output->ndump; i++) - if (output->dump[i]->igroup == igroup) - error->all(FLERR,"Cannot delete group currently used by a dump"); + for (const auto &i : modify->get_fix_list()) + if (i->igroup == igroup) + error->all(FLERR,"Cannot delete group {} currently used by fix ID {}",arg[0],i->id); + for (const auto &i : modify->get_compute_list()) + if (i->igroup == igroup) + error->all(FLERR,"Cannot delete group {} currently used by compute ID {}",arg[0],i->id); + for (const auto &i : output->get_dump_list()) + if (i->igroup == igroup) + error->all(FLERR,"Cannot delete group {} currently used by dump ID {}",arg[0],i->id); if (atom->firstgroupname && strcmp(arg[0],atom->firstgroupname) == 0) - error->all(FLERR, - "Cannot delete group currently used by atom_modify first"); + error->all(FLERR,"Cannot delete group {} currently used by atom_modify first",arg[0]); int *mask = atom->mask; int nlocal = atom->nlocal; diff --git a/src/library.cpp b/src/library.cpp index 584504599e..8692c35848 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -4761,43 +4761,19 @@ int lammps_has_id(void *handle, const char *category, const char *name) { auto lmp = (LAMMPS *) handle; if (strcmp(category,"compute") == 0) { - int ncompute = lmp->modify->ncompute; - Compute **compute = lmp->modify->compute; - for (int i=0; i < ncompute; ++i) { - if (strcmp(name,compute[i]->id) == 0) return 1; - } + if (lmp->modify->get_compute_by_id(name)) return 1; } else if (strcmp(category,"dump") == 0) { - int ndump = lmp->output->ndump; - Dump **dump = lmp->output->dump; - for (int i=0; i < ndump; ++i) { - if (strcmp(name,dump[i]->id) == 0) return 1; - } + if (lmp->output->get_dump_by_id(name)) return 1; } else if (strcmp(category,"fix") == 0) { - for (auto &ifix : lmp->modify->get_fix_list()) { - if (strcmp(name,ifix->id) == 0) return 1; - } + if (lmp->modify->get_fix_by_id(name)) return 1; } else if (strcmp(category,"group") == 0) { - int ngroup = lmp->group->ngroup; - char **groups = lmp->group->names; - for (int i=0; i < ngroup; ++i) { - if (strcmp(groups[i],name) == 0) return 1; - } + if (lmp->group->find(name) >= 0) return 1; } else if (strcmp(category,"molecule") == 0) { - int nmolecule = lmp->atom->nmolecule; - Molecule **molecule = lmp->atom->molecules; - for (int i=0; i < nmolecule; ++i) { - if (strcmp(name,molecule[i]->id) == 0) return 1; - } + if (lmp->atom->find_molecule(name) >= 0) return 1; } else if (strcmp(category,"region") == 0) { - for (auto ® : lmp->domain->get_region_list()) { - if (strcmp(name,reg->id) == 0) return 1; - } + if (lmp->domain->get_region_by_id(name)) return 1; } else if (strcmp(category,"variable") == 0) { - int nvariable = lmp->input->variable->nvar; - char **varnames = lmp->input->variable->names; - for (int i=0; i < nvariable; ++i) { - if (strcmp(name,varnames[i]) == 0) return 1; - } + if (lmp->input->variable->find(name) >= 0) return 1; } return 0; } @@ -4823,11 +4799,11 @@ categories. int lammps_id_count(void *handle, const char *category) { auto lmp = (LAMMPS *) handle; if (strcmp(category,"compute") == 0) { - return lmp->modify->ncompute; + return lmp->modify->get_compute_list().size(); } else if (strcmp(category,"dump") == 0) { - return lmp->output->ndump; + return lmp->output->get_dump_list().size(); } else if (strcmp(category,"fix") == 0) { - return lmp->modify->nfix; + return lmp->modify->get_fix_list().size(); } else if (strcmp(category,"group") == 0) { return lmp->group->ngroup; } else if (strcmp(category,"molecule") == 0) { From 2eb6ff1111a74b033bd990b0f83630bfbb6a66fc Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Aug 2022 03:45:56 -0400 Subject: [PATCH 17/59] allow const char * argument --- src/atom.cpp | 5 ++--- src/atom.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/atom.cpp b/src/atom.cpp index 91b72841f0..8981993ec8 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -1891,11 +1891,10 @@ void Atom::add_molecule(int narg, char **arg) return -1 if does not exist ------------------------------------------------------------------------- */ -int Atom::find_molecule(char *id) +int Atom::find_molecule(const char *id) { if (id == nullptr) return -1; - int imol; - for (imol = 0; imol < nmolecule; imol++) + for (int imol = 0; imol < nmolecule; imol++) if (strcmp(id,molecules[imol]->id) == 0) return imol; return -1; } diff --git a/src/atom.h b/src/atom.h index df43898dbf..b9f8536171 100644 --- a/src/atom.h +++ b/src/atom.h @@ -344,7 +344,7 @@ class Atom : protected Pointers { int shape_consistency(int, double &, double &, double &); void add_molecule(int, char **); - int find_molecule(char *); + int find_molecule(const char *); void add_molecule_atom(class Molecule *, int, int, tagint); void first_reorder(); From f9352e6ad7ecf7076d41c4b452fbb59ea54e53ba Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Aug 2022 03:56:29 -0400 Subject: [PATCH 18/59] update unit test for groups --- unittest/commands/test_groups.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/unittest/commands/test_groups.cpp b/unittest/commands/test_groups.cpp index b0706ea775..a5c1a50f41 100644 --- a/unittest/commands/test_groups.cpp +++ b/unittest/commands/test_groups.cpp @@ -122,13 +122,13 @@ TEST_F(GroupTest, EmptyDelete) TEST_FAILURE(".*ERROR: Illegal group command.*", command("group new2 delete xxx");); TEST_FAILURE(".*ERROR: Cannot delete group all.*", command("group all delete");); TEST_FAILURE(".*ERROR: Could not find group delete.*", command("group new0 delete");); - TEST_FAILURE(".*ERROR: Cannot delete group currently used by a fix.*", + TEST_FAILURE(".*ERROR: Cannot delete group new2 currently used by fix.*", command("group new2 delete");); - TEST_FAILURE(".*ERROR: Cannot delete group currently used by a compute.*", + TEST_FAILURE(".*ERROR: Cannot delete group new3 currently used by compute.*", command("group new3 delete");); - TEST_FAILURE(".*ERROR: Cannot delete group currently used by a dump.*", + TEST_FAILURE(".*ERROR: Cannot delete group new4 currently used by dump.*", command("group new4 delete");); - TEST_FAILURE(".*ERROR: Cannot delete group currently used by atom_modify.*", + TEST_FAILURE(".*ERROR: Cannot delete group new5 currently used by atom_modify.*", command("group new5 delete");); } From d41d5960e49eaf375fed10b89ed610b59299929f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Aug 2022 04:07:49 -0400 Subject: [PATCH 19/59] simplify and modernize --- src/H5MD/dump_h5md.cpp | 13 ++++--------- src/H5MD/dump_h5md.h | 2 +- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/H5MD/dump_h5md.cpp b/src/H5MD/dump_h5md.cpp index 1ee2bd2a54..2bb5af3043 100644 --- a/src/H5MD/dump_h5md.cpp +++ b/src/H5MD/dump_h5md.cpp @@ -73,7 +73,7 @@ DumpH5MD::DumpH5MD(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg) format_default = nullptr; flush_flag = 0; unwrap_flag = 0; - datafile_from_dump = -1; + other_dump = nullptr; author_name = nullptr; every_dump = utils::inumeric(FLERR,arg[3],false,lmp); @@ -141,11 +141,8 @@ DumpH5MD::DumpH5MD(LAMMPS *lmp, int narg, char **arg) : Dump(lmp, narg, arg) } if (box_is_set||create_group_is_set) error->all(FLERR, "Cannot set file_from in dump h5md after box or create_group"); - int idump; - for (idump = 0; idump < output->ndump; idump++) - if (strcmp(arg[iarg+1],output->dump[idump]->id) == 0) break; - if (idump == output->ndump) error->all(FLERR,"Cound not find dump_modify ID"); - datafile_from_dump = idump; + other_dump = dynamic_cast(output->get_dump_by_id(arg[iarg+1])); + if (!other_dump) error->all(FLERR,"Cound not find dump_modify H5MD dump ID {}", arg[iarg+1]); do_box=false; create_group=false; iarg+=2; @@ -262,7 +259,7 @@ void DumpH5MD::openfile() } if (me == 0) { - if (datafile_from_dump<0) { + if (!other_dump) { if (author_name==nullptr) { datafile = h5md_create_file(filename, "N/A", nullptr, "lammps", LAMMPS_VERSION); } else { @@ -296,8 +293,6 @@ void DumpH5MD::openfile() h5md_write_string_attribute(particles_data.group, "charge", "type", "effective"); } } else { - DumpH5MD* other_dump; - other_dump=(DumpH5MD*)output->dump[datafile_from_dump]; datafile = other_dump->datafile; group_name_length = strlen(group->names[igroup]); group_name = new char[group_name_length]; diff --git a/src/H5MD/dump_h5md.h b/src/H5MD/dump_h5md.h index 6634cdb8ae..e33f64f54a 100644 --- a/src/H5MD/dump_h5md.h +++ b/src/H5MD/dump_h5md.h @@ -35,9 +35,9 @@ class DumpH5MD : public Dump { int natoms, ntotal; int unwrap_flag; // 1 if atom coords are unwrapped, 0 if no h5md_file datafile; - int datafile_from_dump; h5md_particles_group particles_data; char *author_name; + DumpH5MD *other_dump; bool do_box; bool create_group; From 0c9964dd0e293623cb49ff55ec765ae869bae390 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Aug 2022 07:54:36 -0400 Subject: [PATCH 20/59] accept 'neigh_modify every 1 delay 0' regardless of "check" setting downgrade the "WARNING" message to a regular output (and thus be less confusing to new LAMMPS users). --- src/min.cpp | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/src/min.cpp b/src/min.cpp index 1adb88184a..d00c0deca4 100644 --- a/src/min.cpp +++ b/src/min.cpp @@ -94,13 +94,13 @@ Min::Min(LAMMPS *lmp) : Pointers(lmp) Min::~Min() { - delete [] elist_global; - delete [] elist_atom; - delete [] vlist_global; - delete [] vlist_atom; - delete [] cvlist_atom; + delete[] elist_global; + delete[] elist_atom; + delete[] vlist_global; + delete[] vlist_atom; + delete[] cvlist_atom; - delete [] fextra; + delete[] fextra; memory->sfree(xextra_atom); memory->sfree(fextra_atom); @@ -128,7 +128,7 @@ void Min::init() // can then add vectors to fix_minimize in setup() nextra_global = 0; - delete [] fextra; + delete[] fextra; fextra = nullptr; nextra_atom = 0; @@ -182,16 +182,15 @@ void Min::init() neigh_delay = neighbor->delay; neigh_dist_check = neighbor->dist_check; - if (neigh_every != 1 || neigh_delay != 0 || neigh_dist_check != 1) { + if ((neigh_every != 1) || (neigh_delay != 0)) { if (comm->me == 0) - error->warning(FLERR, "Using 'neigh_modify every 1 delay 0 check" - " yes' setting during minimization"); + utils::logmesg(lmp, "Switching to 'neigh_modify every 1 delay 0 check yes' " + "setting during minimization\n"); + neighbor->every = 1; + neighbor->delay = 0; + neighbor->dist_check = 1; } - neighbor->every = 1; - neighbor->delay = 0; - neighbor->dist_check = 1; - niter = neval = 0; // store timestep size (important for variable timestep minimizer) @@ -751,11 +750,11 @@ void Min::modify_params(int narg, char **arg) void Min::ev_setup() { - delete [] elist_global; - delete [] elist_atom; - delete [] vlist_global; - delete [] vlist_atom; - delete [] cvlist_atom; + delete[] elist_global; + delete[] elist_atom; + delete[] vlist_global; + delete[] vlist_atom; + delete[] cvlist_atom; elist_global = elist_atom = nullptr; vlist_global = vlist_atom = cvlist_atom = nullptr; From 871a6d5cf7997853f8cc78e78944d8c7563769fe Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Aug 2022 07:54:47 -0400 Subject: [PATCH 21/59] more consistent output format --- src/neighbor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/neighbor.cpp b/src/neighbor.cpp index b6b095ddf4..809a0f7a37 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -1720,7 +1720,7 @@ void Neighbor::print_pairwise_info() } std::string out = "Neighbor list info ...\n"; - out += fmt::format(" update every {} steps, delay {} steps, check {}\n", + out += fmt::format(" update: every = {} steps, delay = {} steps, check = {}\n", every,delay,dist_check ? "yes" : "no"); out += fmt::format(" max neighbors/atom: {}, page size: {}\n", oneatom, pgsize); From 0b38cbea2d45a3179f943aea5dfc4773290d0b39 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Aug 2022 09:46:22 -0400 Subject: [PATCH 22/59] add get_dump_by_index() function --- src/output.cpp | 2 +- src/output.h | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/output.cpp b/src/output.cpp index 1525d4630d..4035de3529 100644 --- a/src/output.cpp +++ b/src/output.cpp @@ -839,7 +839,7 @@ void Output::delete_dump(const std::string &id) return pointer to dump ------------------------------------------------------------------------- */ -Dump *Output::get_dump_by_id(const std::string &id) +Dump *Output::get_dump_by_id(const std::string &id) const { if (id.empty()) return nullptr; for (int idump = 0; idump < ndump; idump++) if (id == dump[idump]->id) return dump[idump]; diff --git a/src/output.h b/src/output.h index 85b6886fce..adbfd1b165 100644 --- a/src/output.h +++ b/src/output.h @@ -80,12 +80,17 @@ class Output : protected Pointers { void reset_timestep(bigint); // reset output which depends on timestep void reset_dt(); // reset output which depends on timestep size - Dump *add_dump(int, char **); // add a Dump to Dump list - void modify_dump(int, char **); // modify a Dump - void delete_dump(const std::string &); // delete a Dump from Dump list - Dump *get_dump_by_id(const std::string &); // find a Dump by ID - const std::vector &get_dump_list(); // get vector with all dumps - int check_time_dumps(bigint); // check if any time dump is output now + Dump *add_dump(int, char **); // add a Dump to Dump list + void modify_dump(int, char **); // modify a Dump + void delete_dump(const std::string &); // delete a Dump from Dump list + Dump *get_dump_by_id(const std::string &) const; // find a Dump by ID + Dump *get_dump_by_index(int idx) const // find a Dump by index in Dump list + { + return ((idx >= 0) && (idx < ndump)) ? dump[idx] : nullptr; + } + + const std::vector &get_dump_list(); // get vector with all dumps + int check_time_dumps(bigint); // check if any time dump is output now void set_thermo(int, char **); // set thermo output freqquency void create_thermo(int, char **); // create a thermo style From 0e2b51010ce1ad9e75982f46ed0fd9b75a62eee0 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 11 Aug 2022 09:46:34 -0400 Subject: [PATCH 23/59] simplify --- src/info.cpp | 37 ++++++------------------------------- src/library.cpp | 6 ++++-- 2 files changed, 10 insertions(+), 33 deletions(-) diff --git a/src/info.cpp b/src/info.cpp index fd8c233868..dc59bdadee 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -887,42 +887,17 @@ bool Info::is_defined(const char *category, const char *name) if ((category == nullptr) || (name == nullptr)) return false; if (strcmp(category,"compute") == 0) { - int ncompute = modify->ncompute; - Compute **compute = modify->compute; - for (int i=0; i < ncompute; ++i) { - if (strcmp(compute[i]->id,name) == 0) - return true; - } + if (modify->get_compute_by_id(name)) return true; } else if (strcmp(category,"dump") == 0) { - int ndump = output->ndump; - Dump **dump = output->dump; - for (int i=0; i < ndump; ++i) { - if (strcmp(dump[i]->id,name) == 0) - return true; - } + if (output->get_dump_by_id(name)) return true; } else if (strcmp(category,"fix") == 0) { - for (const auto &fix : modify->get_fix_list()) { - if (strcmp(fix->id,name) == 0) - return true; - } + if (modify->get_fix_by_id(name)) return true; } else if (strcmp(category,"group") == 0) { - int ngroup = group->ngroup; - char **names = group->names; - for (int i=0; i < ngroup; ++i) { - if (strcmp(names[i],name) == 0) - return true; - } + if (group->find(name) >= 0) return true; } else if (strcmp(category,"region") == 0) { - for (auto ® : domain->get_region_list()) - if (strcmp(reg->id,name) == 0) return true; + if (domain->get_region_by_id(name)) return true; } else if (strcmp(category,"variable") == 0) { - int nvar = input->variable->nvar; - char **names = input->variable->names; - - for (int i=0; i < nvar; ++i) { - if (strcmp(names[i],name) == 0) - return true; - } + if (input->variable->find(name) >= 0) return true; } else error->all(FLERR,"Unknown category for info is_defined(): {}", category); return false; diff --git a/src/library.cpp b/src/library.cpp index 8692c35848..771508ff1b 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -4841,6 +4841,7 @@ set to an empty string, otherwise 1. */ int lammps_id_name(void *handle, const char *category, int idx, char *buffer, int buf_size) { auto lmp = (LAMMPS *) handle; + if (idx < 0) return 0; if (strcmp(category,"compute") == 0) { auto icompute = lmp->modify->get_compute_by_index(idx); @@ -4849,8 +4850,9 @@ int lammps_id_name(void *handle, const char *category, int idx, char *buffer, in return 1; } } else if (strcmp(category,"dump") == 0) { - if ((idx >=0) && (idx < lmp->output->ndump)) { - strncpy(buffer, lmp->output->dump[idx]->id, buf_size); + auto idump = lmp->output->get_dump_by_index(idx); + if (idump) { + strncpy(buffer, idump->id, buf_size); return 1; } } else if (strcmp(category,"fix") == 0) { From 73bee3c53c31fbc5fd58f1f08e563b5ec13abdf1 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 12 Aug 2022 14:47:08 -0400 Subject: [PATCH 24/59] add discussion of neighbor list settings during minimizations. minor tweaks --- doc/src/minimize.rst | 114 +++++++++++++++++++++++++++---------------- 1 file changed, 71 insertions(+), 43 deletions(-) diff --git a/doc/src/minimize.rst b/doc/src/minimize.rst index 14bc4d0d21..cd546d7f68 100644 --- a/doc/src/minimize.rst +++ b/doc/src/minimize.rst @@ -32,30 +32,49 @@ Description Perform an energy minimization of the system, by iteratively adjusting atom coordinates. Iterations are terminated when one of the stopping criteria is satisfied. At that point the configuration will hopefully -be in local potential energy minimum. More precisely, the +be in a local potential energy minimum. More precisely, the configuration should approximate a critical point for the objective function (see below), which may or may not be a local minimum. -The minimization algorithm used is set by the -:doc:`min_style ` command. Other options are set by the -:doc:`min_modify ` command. Minimize commands can be -interspersed with :doc:`run ` commands to alternate between -relaxation and dynamics. The minimizers bound the distance atoms move -in one iteration, so that you can relax systems with highly overlapped -atoms (large energies and forces) by pushing the atoms off of each -other. +The minimization algorithm used is set by the :doc:`min_style +` command. Other options are set by the :doc:`min_modify +` command. Minimize commands can be interspersed with +:doc:`run ` commands to alternate between relaxation and dynamics. +The minimizers bound the distance atoms may move in one iteration, so +that you can relax systems with highly overlapped atoms (large energies +and forces) by pushing the atoms off of each other. -Alternate means of relaxing a system are to run dynamics with a small -or :doc:`limited timestep `. Or dynamics can be run -using :doc:`fix viscous ` to impose a damping force that -slowly drains all kinetic energy from the system. The :doc:`pair_style soft ` potential can be used to un-overlap atoms while -running dynamics. -un-overlap atoms while running dynamics. +.. admonition:: Neighbor list update settings + :class: note + + The distance that atoms can move during individual minimization steps + can be quite large, especially at the beginning of a minimization. + Thus `neighbor list settings ` of *every = 1* and + *delay = 0* are **required**. This may be combined with *check = no* + (always update the neighbor list) or *check = yes* (only update the + neighbor list if at least one atom has moved more than half the + `neighbor list skin ` distance since the last + reneighboring). Using *check = yes* is recommended since it avoids + unneeded reneighboring steps when the system is closer to the minimum + and thus atoms move only small distances. + + If if the settings are **not** *every = 1* and *delay = 0*, LAMMPS + will temporarily apply a `neigh_modify every 1 delay 0 check yes + ` setting during the minimization and restore the + original setting at the end of the minimization. A corresponding + message will be printed to the screen and log file, if this happens. + +Alternate means of relaxing a system are to run dynamics with a small or +:doc:`limited timestep `. Or dynamics can be run using +:doc:`fix viscous ` to impose a damping force that slowly +drains all kinetic energy from the system. The :doc:`pair_style soft +` potential can be used to un-overlap atoms while running +dynamics. Note that you can minimize some atoms in the system while holding the -coordinates of other atoms fixed by applying :doc:`fix setforce -` to the other atoms. See a fuller discussion of using -fixes while minimizing below. +coordinates of other atoms fixed by applying :doc:`fix setforce 0.0 0.0 +0.0 ` to the other atoms. See a more detailed discussion +of :ref:`using fixes while minimizing below `. The :doc:`minimization styles ` *cg*, *sd*, and *hftn* involves an outer iteration loop which sets the search direction along @@ -74,10 +93,11 @@ they require a :doc:`timestep ` be defined. .. note:: - The damped dynamic minimizers use whatever timestep you have - defined via the :doc:`timestep ` command. Often they - will converge more quickly if you use a timestep about 10x larger - than you would normally use for dynamics simulations. + The damped dynamic minimizer algorithms will use the timestep you + have defined via the :doc:`timestep ` command or its + default value. Often they will converge more quickly if you use a + timestep about 10x larger than you would normally use for regular + molecular dynamics simulations. ---------- @@ -210,34 +230,42 @@ The iterations and force evaluation values are what is checked by the .. note:: - There are several force fields in LAMMPS which have - discontinuities or other approximations which may prevent you from - performing an energy minimization to high tolerances. For example, - you should use a :doc:`pair style ` that goes to 0.0 at the - cutoff distance when performing minimization (even if you later change - it when running dynamics). If you do not do this, the total energy of + There are several force fields in LAMMPS which have discontinuities + or other approximations which may prevent you from performing an + energy minimization to tight tolerances. For example, you should use + a :doc:`pair style ` that goes to 0.0 at the cutoff + distance when performing minimization (even if you later change it + when running dynamics). If you do not do this, the total energy of the system will have discontinuities when the relative distance - between any pair of atoms changes from cutoff+epsilon to - cutoff-epsilon and the minimizer may behave poorly. Some of the - many-body potentials use splines and other internal cutoffs that - inherently have this problem. The :doc:`long-range Coulombic styles ` (PPPM, Ewald) are approximate to within the - user-specified tolerance, which means their energy and forces may not - agree to a higher precision than the Kspace-specified tolerance. In - all these cases, the minimizer may give up and stop before finding a - minimum to the specified energy or force tolerance. + between any pair of atoms changes from cutoff *plus* epsilon to + cutoff *minus* epsilon and the minimizer may thus behave poorly. + Some of the many-body potentials use splines and other internal + cutoffs that inherently have this problem. The :doc:`long-range + Coulombic styles ` (PPPM, Ewald) are approximate to + within the user-specified tolerance, which means their energy and + forces may not agree to a higher precision than the Kspace-specified + tolerance. This agreement is further reduced when using tabulation + to speed up the computation of the real-space part of the Coulomb + interactions, which is enabled by default. In all these cases, the + minimizer may give up and stop before finding a minimum to the + specified energy or force tolerance. Note that a cutoff Lennard-Jones potential (and others) can be shifted -so that its energy is 0.0 at the cutoff via the -:doc:`pair_modify ` command. See the doc pages for -individual :doc:`pair styles ` for details. Note that -Coulombic potentials always have a cutoff, unless versions with a -long-range component are used (e.g. :doc:`pair_style lj/cut/coul/long `). The CHARMM potentials go to 0.0 at -the cutoff (e.g. :doc:`pair_style lj/charmm/coul/charmm `), -as do the GROMACS potentials (e.g. :doc:`pair_style lj/gromacs `). +so that its energy is 0.0 at the cutoff via the :doc:`pair_modify +` command. See the doc pages for individual :doc:`pair +styles ` for details. Note that most Coulombic potentials +have a cutoff, unless versions with a long-range component are used +(e.g. :doc:`pair_style lj/cut/coul/long `) or some +other damping/smoothing schemes are used. The CHARMM potentials go to +0.0 at the cutoff (e.g. :doc:`pair_style lj/charmm/coul/charmm +`), as do the GROMACS potentials (e.g. :doc:`pair_style +lj/gromacs `). If a soft potential (:doc:`pair_style soft `) is used the Astop value is used for the prefactor (no time dependence). +.. _fix_minimize: + The :doc:`fix box/relax ` command can be used to apply an external pressure to the simulation box and allow it to shrink/expand during the minimization. From 894b053ef45189d487e2b1fadd8d8a0fb8ccb18b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 12 Aug 2022 17:13:44 -0400 Subject: [PATCH 25/59] silence compiler warnings --- src/AMOEBA/amoeba_induce.cpp | 4 +--- src/MISC/pair_srp_react.h | 2 +- src/ML-SNAP/compute_snap.cpp | 18 +++++++++--------- src/REAXFF/fix_reaxff_species.cpp | 3 +-- src/SMTBQ/pair_smtbq.cpp | 4 +--- 5 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/AMOEBA/amoeba_induce.cpp b/src/AMOEBA/amoeba_induce.cpp index 7434c57e27..ae801e5a62 100644 --- a/src/AMOEBA/amoeba_induce.cpp +++ b/src/AMOEBA/amoeba_induce.cpp @@ -53,8 +53,7 @@ enum{GORDON1,GORDON2}; void PairAmoeba::induce() { bool done; - int i,j,m,itype; - int iter,maxiter; + int i,j,m,itype,iter; double polmin; double eps,epsold; double epsd,epsp; @@ -159,7 +158,6 @@ void PairAmoeba::induce() if (poltyp == MUTUAL) { done = false; - maxiter = 100; iter = 0; polmin = 0.00000001; eps = 100.0; diff --git a/src/MISC/pair_srp_react.h b/src/MISC/pair_srp_react.h index 95a8163900..a6e4cebb6f 100644 --- a/src/MISC/pair_srp_react.h +++ b/src/MISC/pair_srp_react.h @@ -34,7 +34,7 @@ class PairSRPREACT : public PairSRP { private: char *idbreak; char *idcreate; - bool bond_create, bond_break; + bool bond_break, bond_create; }; } // namespace LAMMPS_NS #endif diff --git a/src/ML-SNAP/compute_snap.cpp b/src/ML-SNAP/compute_snap.cpp index 5d2f3666bc..11b17ebcb2 100644 --- a/src/ML-SNAP/compute_snap.cpp +++ b/src/ML-SNAP/compute_snap.cpp @@ -539,18 +539,18 @@ void ComputeSnap::compute_array() for (int icoeff = 0; icoeff < ncoeff; icoeff++) snap[irow][k++] += snaptr->blist[icoeff]; - // quadratic contributions + // quadratic contributions - if (quadraticflag) { - for (int icoeff = 0; icoeff < ncoeff; icoeff++) { - double bveci = snaptr->blist[icoeff]; - snap[irow][k++] += 0.5*bveci*bveci; - for (int jcoeff = icoeff+1; jcoeff < ncoeff; jcoeff++) { - double bvecj = snaptr->blist[jcoeff]; - snap[irow][k++] += bveci*bvecj; - } + if (quadraticflag) { + for (int icoeff = 0; icoeff < ncoeff; icoeff++) { + double bveci = snaptr->blist[icoeff]; + snap[irow][k++] += 0.5*bveci*bveci; + for (int jcoeff = icoeff+1; jcoeff < ncoeff; jcoeff++) { + double bvecj = snaptr->blist[jcoeff]; + snap[irow][k++] += bveci*bvecj; } } + } } else { int k = 3; diff --git a/src/REAXFF/fix_reaxff_species.cpp b/src/REAXFF/fix_reaxff_species.cpp index 0f5af77453..f38b6fb1c5 100644 --- a/src/REAXFF/fix_reaxff_species.cpp +++ b/src/REAXFF/fix_reaxff_species.cpp @@ -827,12 +827,11 @@ void FixReaxFFSpecies::WritePos(int Nmole, int Nspec) void FixReaxFFSpecies::DeleteSpecies(int Nmole, int Nspec) { - int i, j, m, n, k, itype, cid; + int i, j, m, n, itype, cid; int ndel, ndelone, count, count_tmp; int *Nameall; int *mask = atom->mask; double localmass, totalmass; - double **spec_atom = f_SPECBOND->array_atom; std::string species_str; AtomVec *avec = atom->avec; diff --git a/src/SMTBQ/pair_smtbq.cpp b/src/SMTBQ/pair_smtbq.cpp index 60198f062e..988958ca36 100644 --- a/src/SMTBQ/pair_smtbq.cpp +++ b/src/SMTBQ/pair_smtbq.cpp @@ -1232,8 +1232,6 @@ void PairSMTBQ::tabqeq() double aCoeff,bCoeff,rcoupe,nang; int n = atom->ntypes; - int nlocal = atom->nlocal; - int nghost = atom->nghost; nmax = atom->nmax; nntype = int((n+1)*n/2); @@ -1242,7 +1240,7 @@ void PairSMTBQ::tabqeq() #if VERBOSE printf ("kmax %d, ds %f, nmax %d\n",kmax,ds,nmax); - printf ("nlocal = %d, nghost = %d\n",nlocal,nghost); + printf ("nlocal = %d, nghost = %d\n",atom->nlocal,atom->nghost); printf ("nntypes %d, kmax %d, rc %f, n %d\n",nntype,kmax,rc,n); #endif From a4faa3aced6933c2844f8320d402520472f474d9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 13 Aug 2022 01:49:00 -0400 Subject: [PATCH 26/59] modernize using get_fix_by_id() --- src/read_data.cpp | 65 ++++++++++++++++++++++------------------------- src/read_data.h | 6 ++--- 2 files changed, 34 insertions(+), 37 deletions(-) diff --git a/src/read_data.cpp b/src/read_data.cpp index 1ec8210e5e..17cbf9c50c 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -17,6 +17,7 @@ #include "angle.h" #include "atom.h" #include "atom_vec.h" +#include "atom_vec_body.h" #include "atom_vec_ellipsoid.h" #include "atom_vec_line.h" #include "atom_vec_tri.h" @@ -99,30 +100,30 @@ ReadData::ReadData(LAMMPS *lmp) : Command(lmp) // pointers to atom styles that store bonus info nellipsoids = 0; - avec_ellipsoid = dynamic_cast( atom->style_match("ellipsoid")); + avec_ellipsoid = dynamic_cast(atom->style_match("ellipsoid")); nlines = 0; - avec_line = dynamic_cast( atom->style_match("line")); + avec_line = dynamic_cast(atom->style_match("line")); ntris = 0; - avec_tri = dynamic_cast( atom->style_match("tri")); + avec_tri = dynamic_cast(atom->style_match("tri")); nbodies = 0; - avec_body = (AtomVecBody *) atom->style_match("body"); + avec_body = dynamic_cast(atom->style_match("body")); } /* ---------------------------------------------------------------------- */ ReadData::~ReadData() { - delete [] line; - delete [] keyword; - delete [] style; - delete [] buffer; + delete[] line; + delete[] keyword; + delete[] style; + delete[] buffer; memory->sfree(coeffarg); for (int i = 0; i < nfix; i++) { - delete [] fix_header[i]; - delete [] fix_section[i]; + delete[] fix_header[i]; + delete[] fix_section[i]; } - memory->destroy(fix_index); + memory->sfree(fix_index); memory->sfree(fix_header); memory->sfree(fix_section); } @@ -285,16 +286,13 @@ void ReadData::command(int narg, char **arg) } else if (strcmp(arg[iarg],"fix") == 0) { if (iarg+4 > narg) error->all(FLERR,"Illegal read_data command"); - memory->grow(fix_index,nfix+1,"read_data:fix_index"); - fix_header = (char **) memory->srealloc(fix_header,(nfix+1)*sizeof(char *), - "read_data:fix_header"); - fix_section = (char **) memory->srealloc(fix_section,(nfix+1)*sizeof(char *), - "read_data:fix_section"); + fix_index = (Fix **)memory->srealloc(fix_index,(nfix+1)*sizeof(Fix *),"read_data:fix_index"); + fix_header = (char **) memory->srealloc(fix_header,(nfix+1)*sizeof(char *),"read_data:fix_header"); + fix_section = (char **) memory->srealloc(fix_section,(nfix+1)*sizeof(char *),"read_data:fix_section"); if (is_data_section(arg[iarg+3])) - error->all(FLERR,"Custom data section name {} for fix {} collides with existing " - "data section",arg[iarg+3],arg[iarg+1]); - fix_index[nfix] = modify->find_fix(arg[iarg+1]); - if (fix_index[nfix] < 0) error->all(FLERR,"Fix ID for read_data does not exist"); + error->all(FLERR,"Custom data section name {} for fix {} collides with existing data section",arg[iarg+3],arg[iarg+1]); + fix_index[nfix] = modify->get_fix_by_id(arg[iarg+1]); + if (!fix_index[nfix]) error->all(FLERR,"Fix ID {} for read_data does not exist",arg[iarg+1]); if (strcmp(arg[iarg+2],"NULL") == 0) fix_header[nfix] = nullptr; else fix_header[nfix] = utils::strdup(arg[iarg+2]); if (strcmp(arg[iarg+3],"NULL") == 0) fix_section[nfix] = utils::strdup(arg[iarg+1]); @@ -743,8 +741,7 @@ void ReadData::command(int narg, char **arg) for (i = 0; i < nfix; i++) if (strcmp(keyword,fix_section[i]) == 0) { if (firstpass) fix(fix_index[i],keyword); - else skip_lines(modify->fix[fix_index[i]]-> - read_data_skip_lines(keyword)); + else skip_lines(fix_index[i]->read_data_skip_lines(keyword)); break; } if (i == nfix) @@ -1008,7 +1005,7 @@ void ReadData::header(int firstpass) for (n = 0; n < nfix; n++) { if (!fix_header[n]) continue; if (strstr(line,fix_header[n])) { - modify->fix[fix_index[n]]->read_data_header(line); + fix_index[n]->read_data_header(line); break; } } @@ -1754,7 +1751,7 @@ void ReadData::mass() atom->set_mass(FLERR,buf,toffset); buf = next + 1; } - delete [] original; + delete[] original; } /* ---------------------------------------------------------------------- */ @@ -1777,7 +1774,7 @@ void ReadData::paircoeffs() force->pair->coeff(ncoeffarg,coeffarg); buf = next + 1; } - delete [] original; + delete[] original; } /* ---------------------------------------------------------------------- */ @@ -1804,7 +1801,7 @@ void ReadData::pairIJcoeffs() force->pair->coeff(ncoeffarg,coeffarg); buf = next + 1; } - delete [] original; + delete[] original; } /* ---------------------------------------------------------------------- */ @@ -1829,7 +1826,7 @@ void ReadData::bondcoeffs() force->bond->coeff(ncoeffarg,coeffarg); buf = next + 1; } - delete [] original; + delete[] original; } /* ---------------------------------------------------------------------- */ @@ -1856,7 +1853,7 @@ void ReadData::anglecoeffs(int which) force->angle->coeff(ncoeffarg,coeffarg); buf = next + 1; } - delete [] original; + delete[] original; } /* ---------------------------------------------------------------------- */ @@ -1886,7 +1883,7 @@ void ReadData::dihedralcoeffs(int which) force->dihedral->coeff(ncoeffarg,coeffarg); buf = next + 1; } - delete [] original; + delete[] original; } /* ---------------------------------------------------------------------- */ @@ -1911,7 +1908,7 @@ void ReadData::impropercoeffs(int which) force->improper->coeff(ncoeffarg,coeffarg); buf = next + 1; } - delete [] original; + delete[] original; } /* ---------------------------------------------------------------------- @@ -1919,18 +1916,18 @@ void ReadData::impropercoeffs(int which) n = index of fix ------------------------------------------------------------------------- */ -void ReadData::fix(int ifix, char *keyword) +void ReadData::fix(Fix *ifix, char *keyword) { int nchunk,eof; - bigint nline = modify->fix[ifix]->read_data_skip_lines(keyword); + bigint nline = ifix->read_data_skip_lines(keyword); bigint nread = 0; while (nread < nline) { nchunk = MIN(nline-nread,CHUNK); eof = utils::read_lines_from_file(fp,nchunk,MAXLINE,buffer,me,world); - if (eof) error->all(FLERR,"Unexpected end of data file"); - modify->fix[ifix]->read_data_section(keyword,nchunk,buffer,id_offset); + if (eof) error->all(FLERR,"Unexpected end of data file while reading section {}",keyword); + ifix->read_data_section(keyword,nchunk,buffer,id_offset); nread += nchunk; } } diff --git a/src/read_data.h b/src/read_data.h index 250cdf3178..5002894019 100644 --- a/src/read_data.h +++ b/src/read_data.h @@ -23,7 +23,7 @@ CommandStyle(read_data,ReadData); #include "command.h" namespace LAMMPS_NS { - +class Fix; class ReadData : public Command { public: ReadData(class LAMMPS *); @@ -73,7 +73,7 @@ class ReadData : public Command { int groupbit; int nfix; - int *fix_index; + Fix **fix_index; char **fix_header; char **fix_section; @@ -108,7 +108,7 @@ class ReadData : public Command { void dihedralcoeffs(int); void impropercoeffs(int); - void fix(int, char *); + void fix(Fix *, char *); }; } // namespace LAMMPS_NS From c2115c27e8b64aa32f5ad9f507c888aa3f4b56ba Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 13 Aug 2022 02:10:28 -0400 Subject: [PATCH 27/59] regularize a few citation reminders --- src/KIM/kim_command.cpp | 4 ++-- src/KIM/pair_kim.cpp | 2 +- src/compute_centroid_stress_atom.cpp | 8 ++++---- src/neighbor.cpp | 5 ----- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/KIM/kim_command.cpp b/src/KIM/kim_command.cpp index 06b651e377..b93b87fa7c 100644 --- a/src/KIM/kim_command.cpp +++ b/src/KIM/kim_command.cpp @@ -70,7 +70,7 @@ using namespace LAMMPS_NS; static constexpr const char *const cite_openkim = - "OpenKIM: https://doi.org/10.1007/s11837-011-0102-6\n\n" + "OpenKIM Project: doi:10.1007/s11837-011-0102-6\n\n" "@Article{tadmor:elliott:2011,\n" " author = {E. B. Tadmor and R. S. Elliott and J. P. Sethna and R. E. Miller " "and C. A. Becker},\n" @@ -85,7 +85,7 @@ static constexpr const char *const cite_openkim = "}\n\n"; static constexpr const char *const cite_openkim_query = - "OpenKIM query: https://doi.org/10.1063/5.0014267\n\n" + "OpenKIM query: doi:10.1063/5.0014267\n\n" "@Article{karls:bierbaum:2020,\n" " author = {D. S. Karls and M. Bierbaum and A. A. Alemi and R. S. Elliott " "and J. P. Sethna and E. B. Tadmor},\n" diff --git a/src/KIM/pair_kim.cpp b/src/KIM/pair_kim.cpp index f3b53ac71f..d496ffde04 100644 --- a/src/KIM/pair_kim.cpp +++ b/src/KIM/pair_kim.cpp @@ -77,7 +77,7 @@ using namespace LAMMPS_NS; static constexpr const char *const cite_openkim = - "OpenKIM: https://doi.org/10.1007/s11837-011-0102-6\n\n" + "OpenKIM Project: doi:10.1007/s11837-011-0102-6\n\n" "@Article{tadmor:elliott:2011,\n" " author = {E. B. Tadmor and R. S. Elliott and J. P. Sethna and R. E. Miller " "and C. A. Becker},\n" diff --git a/src/compute_centroid_stress_atom.cpp b/src/compute_centroid_stress_atom.cpp index ee362927cf..2e7ff5d069 100644 --- a/src/compute_centroid_stress_atom.cpp +++ b/src/compute_centroid_stress_atom.cpp @@ -36,8 +36,8 @@ using namespace LAMMPS_NS; enum { NOBIAS, BIAS }; static const char cite_centroid_angle_improper_dihedral[] = - "compute centroid/stress/atom for angles, impropers and dihedrals:\n\n" - "@article{PhysRevE.99.051301,\n" + "compute centroid/stress/atom for angles, impropers and dihedrals: doi:10.1103/PhysRevE.99.051301\n\n" + "@article{Surblys2019,\n" " title = {Application of atomic stress to compute heat flux via molecular dynamics for " "systems with many-body interactions},\n" " author = {Surblys, Donatas and Matsubara, Hiroki and Kikugawa, Gota and Ohara, Taku},\n" @@ -51,8 +51,8 @@ static const char cite_centroid_angle_improper_dihedral[] = "}\n\n"; static const char cite_centroid_shake_rigid[] = - "compute centroid/stress/atom for constrained dynamics:\n\n" - "@article{doi:10.1063/5.0070930,\n" + "compute centroid/stress/atom for constrained dynamics: doi:10.1063/5.0070930\n\n" + "@article{Surblys2021,\n" " author = {Surblys, Donatas and Matsubara, Hiroki and Kikugawa, Gota and Ohara, Taku},\n" " journal = {Journal of Applied Physics},\n" " title = {Methodology and meaning of computing heat flux via atomic stress in systems with " diff --git a/src/neighbor.cpp b/src/neighbor.cpp index b6b095ddf4..fb7e20f0eb 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -90,11 +90,6 @@ static const char cite_neigh_multi[] = " volume = 179,\n" " pages = {320--329}\n" "}\n\n" - "@article{Stratford2018,\n" - " author = {Stratford, Kevin and Shire, Tom and Hanley, Kevin},\n" - " title = {Implementation of multi-level contact detection in LAMMPS},\n" - " year = {2018}\n" - "}\n\n" "@article{Shire2020,\n" " author = {Shire, Tom and Hanley, Kevin J. and Stratford, Kevin},\n" " title = {DEM simulations of polydisperse media: efficient contact\n" From 6973b80343f89cd3153d7cf96bf9c8532207fb7f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 13 Aug 2022 02:17:04 -0400 Subject: [PATCH 28/59] regularize a couple more --- src/DIFFRACTION/compute_saed.cpp | 2 +- src/DIFFRACTION/compute_xrd.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DIFFRACTION/compute_saed.cpp b/src/DIFFRACTION/compute_saed.cpp index e21570d76d..8ae1ed8d31 100644 --- a/src/DIFFRACTION/compute_saed.cpp +++ b/src/DIFFRACTION/compute_saed.cpp @@ -37,7 +37,7 @@ using namespace LAMMPS_NS; using namespace MathConst; static const char cite_compute_saed_c[] = - "compute_saed command: doi:10.1088/0965-0393/21/5/055020\n\n" + "compute saed command: doi:10.1088/0965-0393/21/5/055020\n\n" "@Article{Coleman13,\n" " author = {S. P. Coleman, D. E. Spearot, L. Capolungo},\n" " title = {Virtual diffraction analysis of Ni [010] symmetric tilt grain boundaries},\n" diff --git a/src/DIFFRACTION/compute_xrd.cpp b/src/DIFFRACTION/compute_xrd.cpp index aef4d932a9..b0434100da 100644 --- a/src/DIFFRACTION/compute_xrd.cpp +++ b/src/DIFFRACTION/compute_xrd.cpp @@ -38,7 +38,7 @@ using namespace LAMMPS_NS; using namespace MathConst; static const char cite_compute_xrd_c[] = - "compute_xrd command: doi:10.1088/0965-0393/21/5/055020\n\n" + "compute xrd command: doi:10.1088/0965-0393/21/5/055020\n\n" "@Article{Coleman13,\n" " author = {S. P. Coleman, D. E. Spearot, L. Capolungo},\n" " title = {Virtual diffraction analysis of Ni [010] symmetric tilt grain boundaries},\n" From e66a4b2423b5042802a949840f9f6a97277b5438 Mon Sep 17 00:00:00 2001 From: Karl Hammond Date: Sat, 13 Aug 2022 01:32:49 -0500 Subject: [PATCH 29/59] Changed a few; now pulling new ones from commit c2115c2 so I do not replicate --- src/ASPHERE/pair_gayberne.cpp | 3 ++- src/BOCS/fix_bocs.cpp | 7 ++++--- src/DPD-MESO/pair_edpd.cpp | 2 +- src/DPD-MESO/pair_mdpd.cpp | 3 ++- src/DPD-MESO/pair_tdpd.cpp | 3 ++- src/GPU/fix_gpu.cpp | 2 +- src/MANYBODY/pair_atm.cpp | 3 ++- 7 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/ASPHERE/pair_gayberne.cpp b/src/ASPHERE/pair_gayberne.cpp index 04fa5330f9..53cdecc8f1 100644 --- a/src/ASPHERE/pair_gayberne.cpp +++ b/src/ASPHERE/pair_gayberne.cpp @@ -34,13 +34,14 @@ using namespace LAMMPS_NS; static const char cite_pair_gayberne[] = - "pair gayberne command:\n\n" + "pair gayberne command: doi:10.1063/1.3058435\n\n" "@Article{Brown09,\n" " author = {W. M. Brown, M. K. Petersen, S. J. Plimpton, and G. S. Grest},\n" " title = {Liquid crystal nanodroplets in solution},\n" " journal = {J.~Chem.~Phys.},\n" " year = 2009,\n" " volume = 130,\n" + " number = 4,\n" " pages = {044901}\n" "}\n\n"; diff --git a/src/BOCS/fix_bocs.cpp b/src/BOCS/fix_bocs.cpp index 3083286be8..204994f21f 100644 --- a/src/BOCS/fix_bocs.cpp +++ b/src/BOCS/fix_bocs.cpp @@ -42,13 +42,14 @@ using namespace LAMMPS_NS; using namespace FixConst; static const char cite_user_bocs_package[] = - "BOCS package:\n\n" + "BOCS package: doi:10.1021/acs.jpcb.7b09993\n\n" "@Article{Dunn2018,\n" " author = {NJH Dunn, KM Lebold, MR DeLyser, JF Rudzinski, WG Noid},\n" - " title = {BOCS: Bottom-Up Open-Source Coarse-Graining Software},\n" - " journal = {J. Phys. Chem. B},\n" + " title = {{BOCS}: Bottom-Up Open-Source Coarse-Graining Software},\n" + " journal = {J.~Phys.\\ Chem.~B},\n" " year = 2018,\n" " volume = 122,\n" + " number = 13,\n" " pages = {3363--3377}\n" "}\n\n"; diff --git a/src/DPD-MESO/pair_edpd.cpp b/src/DPD-MESO/pair_edpd.cpp index b05f588b7c..e9e379273b 100644 --- a/src/DPD-MESO/pair_edpd.cpp +++ b/src/DPD-MESO/pair_edpd.cpp @@ -41,7 +41,7 @@ using namespace LAMMPS_NS; #define EPSILON 1.0e-10 static const char cite_pair_edpd[] = - "pair edpd command:\n\n" + "pair edpd command: doi:10.1016/j.jcp.2014.02.003\n\n" "@Article{ZLi2014_JCP,\n" " author = {Li, Z. and Tang, Y.-H. and Lei, H. and Caswell, B. and Karniadakis, G.E.},\n" " title = {Energy-conserving dissipative particle dynamics with temperature-dependent properties},\n" diff --git a/src/DPD-MESO/pair_mdpd.cpp b/src/DPD-MESO/pair_mdpd.cpp index ec0a57be15..b4878cd27c 100644 --- a/src/DPD-MESO/pair_mdpd.cpp +++ b/src/DPD-MESO/pair_mdpd.cpp @@ -37,13 +37,14 @@ using namespace LAMMPS_NS; #define EPSILON 1.0e-10 static const char cite_pair_mdpd[] = - "pair mdpd command:\n\n" + "pair mdpd command: doi:10.1063/1.4812366\n\n" "@Article{ZLi2013_POF,\n" " author = {Li, Z. and Hu, G.H. and Wang, Z.L. and Ma Y.B. and Zhou, Z.W.},\n" " title = {Three dimensional flow structures in a moving droplet on substrate: a dissipative particle dynamics study},\n" " journal = {Physics of Fluids},\n" " year = {2013},\n" " volume = {25},\n" + " number = {7},\n" " pages = {072103}\n" "}\n\n"; diff --git a/src/DPD-MESO/pair_tdpd.cpp b/src/DPD-MESO/pair_tdpd.cpp index 39d9a151d9..448cc41181 100644 --- a/src/DPD-MESO/pair_tdpd.cpp +++ b/src/DPD-MESO/pair_tdpd.cpp @@ -40,13 +40,14 @@ using namespace LAMMPS_NS; #define EPSILON 1.0e-10 static const char cite_pair_tdpd[] = - "pair tdpd command:\n\n" + "pair tdpd command: doi:10.1063/1.4923254\n\n" "@Article{ZLi2015_JCP,\n" " author = {Li, Z. and Yazdani, A. and Tartakovsky, A. and Karniadakis, G.E.},\n" " title = {Transport dissipative particle dynamics model for mesoscopic advection-diffusion-reaction problems},\n" " journal = {The Journal of Chemical Physics},\n" " year = {2015},\n" " volume = {143},\n" + " number = {1},\n" " pages = {014101}\n" "}\n\n"; diff --git a/src/GPU/fix_gpu.cpp b/src/GPU/fix_gpu.cpp index 3ca57133a9..e6f682a2a3 100644 --- a/src/GPU/fix_gpu.cpp +++ b/src/GPU/fix_gpu.cpp @@ -53,7 +53,7 @@ extern double lmp_gpu_update_bin_size(const double subx, const double suby, cons const int nlocal, const double cut); static const char cite_gpu_package[] = - "GPU package (short-range, long-range and three-body potentials):\n\n" + "GPU package (short-range, long-range and three-body potentials): doi:10.1016/j.cpc.2010.12.021\n\n" "@Article{Brown11,\n" " author = {W. M. Brown, P. Wang, S. J. Plimpton, A. N. Tharrington},\n" " title = {Implementing Molecular Dynamics on Hybrid High Performance Computers - Short Range Forces},\n" diff --git a/src/MANYBODY/pair_atm.cpp b/src/MANYBODY/pair_atm.cpp index 4b61e575a3..1d1432c330 100644 --- a/src/MANYBODY/pair_atm.cpp +++ b/src/MANYBODY/pair_atm.cpp @@ -32,13 +32,14 @@ using namespace LAMMPS_NS; static const char cite_atm_package[] = - "ATM package:\n\n" + "ATM package: doi:10.1063/1.4704930\n\n" "@Article{Lishchuk:2012:164501,\n" " author = {S. V. Lishchuk},\n" " title = {Role of three-body interactions in formation of bulk viscosity in liquid argon},\n" " journal = {J.~Chem.~Phys.},\n" " year = 2012,\n" " volume = 136,\n" + " number = 16,\n" " pages = {164501}\n" "}\n\n"; From 29e1595fb431db8e8776f01142d761124e8a5165 Mon Sep 17 00:00:00 2001 From: Karl Hammond Date: Sat, 13 Aug 2022 04:51:54 -0500 Subject: [PATCH 30/59] Updates to BibTeX syntax for anything that needed it that I caught and fixes to address Issue #2597 --- src/ASPHERE/pair_gayberne.cpp | 6 +-- src/BOCS/fix_bocs.cpp | 3 +- src/DIELECTRIC/atom_vec_dielectric.cpp | 12 +++--- src/DIFFRACTION/compute_saed.cpp | 4 +- src/DIFFRACTION/compute_xrd.cpp | 4 +- src/DPD-MESO/pair_edpd.cpp | 4 +- src/DPD-MESO/pair_mdpd.cpp | 4 +- src/DPD-MESO/pair_tdpd.cpp | 4 +- src/DPD-REACT/fix_shardlow.cpp | 17 +++++---- src/DPD-REACT/pair_multi_lucy.cpp | 9 +++-- src/DPD-REACT/pair_multi_lucy_rx.cpp | 8 ++-- src/EFF/atom_vec_electron.cpp | 5 ++- .../compute_stress_cartesian.cpp | 6 +-- src/EXTRA-COMPUTE/compute_stress_cylinder.cpp | 9 +++-- .../compute_stress_spherical.cpp | 6 +-- src/EXTRA-FIX/fix_ave_correlate_long.cpp | 7 ++-- src/EXTRA-FIX/fix_electron_stopping_fit.cpp | 16 ++++---- src/EXTRA-FIX/fix_filter_corotate.cpp | 8 ++-- src/EXTRA-FIX/fix_flow_gauss.cpp | 4 +- src/EXTRA-FIX/fix_pafi.cpp | 6 +-- src/EXTRA-FIX/fix_rhok.cpp | 6 +-- src/EXTRA-FIX/fix_ti_spring.cpp | 2 +- src/EXTRA-FIX/fix_ttm_mod.cpp | 8 ++-- src/EXTRA-MOLECULE/dihedral_table_cut.cpp | 6 +-- src/EXTRA-PAIR/pair_e3b.cpp | 16 ++++---- src/EXTRA-PAIR/pair_lj_relres.cpp | 10 ++--- src/EXTRA-PAIR/pair_momb.cpp | 10 ++--- src/GPU/fix_gpu.cpp | 38 +++++++++++-------- src/INTERLAYER/pair_ilp_graphene_hbn.cpp | 4 +- src/INTERLAYER/pair_ilp_tmd.cpp | 23 +++++------ .../pair_kolmogorov_crespi_full.cpp | 2 +- src/INTERLAYER/pair_saip_metal.cpp | 8 ++-- src/LATBOLTZ/fix_lb_fluid.cpp | 10 ++--- src/MANYBODY/pair_atm.cpp | 4 +- src/MANYBODY/pair_edip_multi.cpp | 8 ++-- src/MANYBODY/pair_local_density.cpp | 18 ++++----- src/MC/fix_bond_swap.cpp | 9 +++-- src/MC/fix_charge_regulation.cpp | 8 ++-- src/MISC/pair_agni.cpp | 8 ++-- src/MISC/pair_srp.cpp | 7 ++-- src/MISC/pair_srp_react.cpp | 10 +++-- src/ML-HDNNP/pair_hdnnp.cpp | 8 ++-- src/ML-RANN/pair_rann.cpp | 6 +-- src/OPENMP/pair_reaxff_omp.cpp | 10 +++-- src/OPT/pair_ilp_graphene_hbn_opt.cpp | 4 +- src/ORIENT/fix_orient_bcc.cpp | 15 ++++---- src/ORIENT/fix_orient_eco.cpp | 6 +-- src/ORIENT/fix_orient_fcc.cpp | 2 +- src/PERI/atom_vec_peri.cpp | 9 +++-- src/PHONON/fix_phonon.cpp | 6 +-- src/POEMS/fix_poems.cpp | 11 +++--- src/PTM/compute_ptm_atom.cpp | 6 +-- src/REACTION/fix_bond_react.cpp | 9 +++-- src/REAXFF/fix_acks2_reaxff.cpp | 7 ++-- src/REAXFF/fix_qeq_reaxff.cpp | 6 +-- src/REAXFF/pair_reaxff.cpp | 7 ++-- src/SPIN/fix_nve_spin.cpp | 10 ++--- src/SPIN/min_spin_cg.cpp | 2 +- src/SPIN/min_spin_lbfgs.cpp | 2 +- src/SPIN/neb_spin.cpp | 8 ++-- src/SRD/fix_srd.cpp | 23 +++++------ src/UEF/fix_nh_uef.cpp | 6 ++- src/compute_centroid_stress_atom.cpp | 6 +-- src/neighbor.cpp | 15 ++++---- 64 files changed, 285 insertions(+), 256 deletions(-) diff --git a/src/ASPHERE/pair_gayberne.cpp b/src/ASPHERE/pair_gayberne.cpp index 53cdecc8f1..71b8a82cc7 100644 --- a/src/ASPHERE/pair_gayberne.cpp +++ b/src/ASPHERE/pair_gayberne.cpp @@ -36,9 +36,9 @@ using namespace LAMMPS_NS; static const char cite_pair_gayberne[] = "pair gayberne command: doi:10.1063/1.3058435\n\n" "@Article{Brown09,\n" - " author = {W. M. Brown, M. K. Petersen, S. J. Plimpton, and G. S. Grest},\n" - " title = {Liquid crystal nanodroplets in solution},\n" - " journal = {J.~Chem.~Phys.},\n" + " author = {W. M. Brown and M. K. Petersen and S. J. Plimpton and G. S. Grest},\n" + " title = {Liquid Crystal Nanodroplets in Solution},\n" + " journal = {J.~Chem.\\ Phys.},\n" " year = 2009,\n" " volume = 130,\n" " number = 4,\n" diff --git a/src/BOCS/fix_bocs.cpp b/src/BOCS/fix_bocs.cpp index 204994f21f..449deefd59 100644 --- a/src/BOCS/fix_bocs.cpp +++ b/src/BOCS/fix_bocs.cpp @@ -44,7 +44,8 @@ using namespace FixConst; static const char cite_user_bocs_package[] = "BOCS package: doi:10.1021/acs.jpcb.7b09993\n\n" "@Article{Dunn2018,\n" - " author = {NJH Dunn, KM Lebold, MR DeLyser, JF Rudzinski, WG Noid},\n" + " author = {N. J. H. Dunn and K. M. Lebold and M. R. {DeLyser} and\n" + " J. F. Rudzinski and W. G. Noid},\n" " title = {{BOCS}: Bottom-Up Open-Source Coarse-Graining Software},\n" " journal = {J.~Phys.\\ Chem.~B},\n" " year = 2018,\n" diff --git a/src/DIELECTRIC/atom_vec_dielectric.cpp b/src/DIELECTRIC/atom_vec_dielectric.cpp index 67bb9f7dc3..d43c9ec6eb 100644 --- a/src/DIELECTRIC/atom_vec_dielectric.cpp +++ b/src/DIELECTRIC/atom_vec_dielectric.cpp @@ -21,13 +21,13 @@ using namespace LAMMPS_NS; static const char cite_user_dielectric_package[] = - "DIELECTRIC package:\n\n" + "DIELECTRIC package: doi:10.1016/j.cpc.2019.03.006\n\n" "@Article{TrungCPC19,\n" - " author = {Trung Dac Nguyen, Honghao Li, Debarshee Bagchi," - " Francisco J. Solis, Monica Olvera de la Cruz,\n" - " title = {Incorporating surface polarization effects into large-scale" - " coarse-grained Molecular Dynamics simulation},\n" - " journal = {Comp.~Phys.~Comm.},\n" + " author = {Trung Dac Nguyen and Honghao Li and Debarshee Bagchi and" + " Francisco J. Solis and Olvera de la Cruz, Monica}\n" + " title = {Incorporating Surface Polarization Effects Into Large-Scale" + " Coarse-Grained Molecular Dynamics Simulation},\n" + " journal = {Comput.\\ Phys.\\ Commun.},\n" " year = 2019,\n" " volume = 241,\n" " pages = {80--91}\n" diff --git a/src/DIFFRACTION/compute_saed.cpp b/src/DIFFRACTION/compute_saed.cpp index e21570d76d..6688d7a010 100644 --- a/src/DIFFRACTION/compute_saed.cpp +++ b/src/DIFFRACTION/compute_saed.cpp @@ -39,8 +39,8 @@ using namespace MathConst; static const char cite_compute_saed_c[] = "compute_saed command: doi:10.1088/0965-0393/21/5/055020\n\n" "@Article{Coleman13,\n" - " author = {S. P. Coleman, D. E. Spearot, L. Capolungo},\n" - " title = {Virtual diffraction analysis of Ni [010] symmetric tilt grain boundaries},\n" + " author = {S. P. Coleman and D. E. Spearot and L. Capolungo},\n" + " title = {Virtual Diffraction Analysis of {Ni} [010] Symmetric Tilt Grain Boundaries},\n" " journal = {Modelling and Simulation in Materials Science and Engineering},\n" " year = 2013,\n" " volume = 21,\n" diff --git a/src/DIFFRACTION/compute_xrd.cpp b/src/DIFFRACTION/compute_xrd.cpp index aef4d932a9..874fc614ce 100644 --- a/src/DIFFRACTION/compute_xrd.cpp +++ b/src/DIFFRACTION/compute_xrd.cpp @@ -40,8 +40,8 @@ using namespace MathConst; static const char cite_compute_xrd_c[] = "compute_xrd command: doi:10.1088/0965-0393/21/5/055020\n\n" "@Article{Coleman13,\n" - " author = {S. P. Coleman, D. E. Spearot, L. Capolungo},\n" - " title = {Virtual diffraction analysis of Ni [010] symmetric tilt grain boundaries},\n" + " author = {S. P. Coleman and D. E. Spearot and L. Capolungo},\n" + " title = {Virtual Diffraction Analysis of {Ni} [010] Symmetric Tilt Grain Boundaries},\n" " journal = {Modelling and Simulation in Materials Science and Engineering},\n" " year = 2013,\n" " volume = 21,\n" diff --git a/src/DPD-MESO/pair_edpd.cpp b/src/DPD-MESO/pair_edpd.cpp index e9e379273b..9050ac9dd7 100644 --- a/src/DPD-MESO/pair_edpd.cpp +++ b/src/DPD-MESO/pair_edpd.cpp @@ -44,7 +44,7 @@ static const char cite_pair_edpd[] = "pair edpd command: doi:10.1016/j.jcp.2014.02.003\n\n" "@Article{ZLi2014_JCP,\n" " author = {Li, Z. and Tang, Y.-H. and Lei, H. and Caswell, B. and Karniadakis, G.E.},\n" - " title = {Energy-conserving dissipative particle dynamics with temperature-dependent properties},\n" + " title = {Energy-Conserving Dissipative Particle Dynamics with Temperature-Dependent Properties},\n" " journal = {Journal of Computational Physics},\n" " year = {2014},\n" " volume = {265},\n" @@ -52,7 +52,7 @@ static const char cite_pair_edpd[] = "}\n\n" "@Article{ZLi2015_CC,\n" " author = {Li, Z. and Tang, Y.-H. and Li, X. and Karniadakis, G.E.},\n" - " title = {Mesoscale modeling of phase transition dynamics of thermoresponsive polymers},\n" + " title = {Mesoscale Modeling of Phase Transition Dynamics of Thermoresponsive Polymers},\n" " journal = {Chemical Communications},\n" " year = {2015},\n" " volume = {51},\n" diff --git a/src/DPD-MESO/pair_mdpd.cpp b/src/DPD-MESO/pair_mdpd.cpp index b4878cd27c..c08ac2dde3 100644 --- a/src/DPD-MESO/pair_mdpd.cpp +++ b/src/DPD-MESO/pair_mdpd.cpp @@ -39,8 +39,8 @@ using namespace LAMMPS_NS; static const char cite_pair_mdpd[] = "pair mdpd command: doi:10.1063/1.4812366\n\n" "@Article{ZLi2013_POF,\n" - " author = {Li, Z. and Hu, G.H. and Wang, Z.L. and Ma Y.B. and Zhou, Z.W.},\n" - " title = {Three dimensional flow structures in a moving droplet on substrate: a dissipative particle dynamics study},\n" + " author = {Li, Z. and Hu, G. H. and Wang, Z. L. and Ma Y. B. and Zhou, Z. W.},\n" + " title = {Three Dimensional Flow Structures in a Moving Droplet on Substrate: a Dissipative Particle Dynamics Study},\n" " journal = {Physics of Fluids},\n" " year = {2013},\n" " volume = {25},\n" diff --git a/src/DPD-MESO/pair_tdpd.cpp b/src/DPD-MESO/pair_tdpd.cpp index 448cc41181..6efe3f4546 100644 --- a/src/DPD-MESO/pair_tdpd.cpp +++ b/src/DPD-MESO/pair_tdpd.cpp @@ -42,8 +42,8 @@ using namespace LAMMPS_NS; static const char cite_pair_tdpd[] = "pair tdpd command: doi:10.1063/1.4923254\n\n" "@Article{ZLi2015_JCP,\n" - " author = {Li, Z. and Yazdani, A. and Tartakovsky, A. and Karniadakis, G.E.},\n" - " title = {Transport dissipative particle dynamics model for mesoscopic advection-diffusion-reaction problems},\n" + " author = {Li, Z. and Yazdani, A. and Tartakovsky, A. and Karniadakis, G. E.},\n" + " title = {Transport Dissipative Particle Dynamics Model for Mesoscopic Advection-Diffusion-Reaction Problems},\n" " journal = {The Journal of Chemical Physics},\n" " year = {2015},\n" " volume = {143},\n" diff --git a/src/DPD-REACT/fix_shardlow.cpp b/src/DPD-REACT/fix_shardlow.cpp index 7ab8c6f857..41239c9058 100644 --- a/src/DPD-REACT/fix_shardlow.cpp +++ b/src/DPD-REACT/fix_shardlow.cpp @@ -63,21 +63,22 @@ using namespace random_external_state; #define EPSILON_SQUARED ((EPSILON) * (EPSILON)) static const char cite_fix_shardlow[] = - "fix shardlow command:\n\n" + "fix shardlow command: doi:10.1016/j.cpc.2014.03.029, doi:10.1063/1.3660209\n\n" "@Article{Larentzos14,\n" - " author = {J. P. Larentzos, J. K. Brennan, J. D. Moore, M. Lisal, W. D. Mattson},\n" - " title = {Parallel implementation of isothermal and isoenergetic Dissipative Particle Dynamics using Shardlow-like splitting algorithms},\n" - " journal = {Computer Physics Communications},\n" + " author = {J. P. Larentzos and J. K. Brennan and J. D. Moore and M. Lisal and W. D. Mattson},\n" + " title = {Parallel Implementation of Isothermal and Isoenergetic Dissipative Particle Dynamics Using {S}hardlow-Like Splitting Algorithms},\n" + " journal = {Comput.\\ Phys.\\ Commun.},\n" " year = 2014,\n" " volume = 185\n" " pages = {1987--1998}\n" "}\n\n" "@Article{Lisal11,\n" - " author = {M. Lisal, J. K. Brennan, J. Bonet Avalos},\n" - " title = {Dissipative particle dynamics at isothermal, isobaric, isoenergetic, and isoenthalpic conditions using Shardlow-like splitting algorithms},\n" - " journal = {Journal of Chemical Physics},\n" + " author = {M. Lisal and J. K. Brennan and J. Bonet Avalos},\n" + " title = {Dissipative Particle Dynamics at Isothermal, Isobaric, Isoenergetic, and Isoenthalpic Conditions Using {S}hardlow-Like Splitting Algorithms},\n" + " journal = {J.~Chem.\\ Phys.},\n" " year = 2011,\n" - " volume = 135\n" + " volume = 135,\n" + " number = 20,\n" " pages = {204105}\n" "}\n\n"; diff --git a/src/DPD-REACT/pair_multi_lucy.cpp b/src/DPD-REACT/pair_multi_lucy.cpp index 009ebfc21f..bb6792da74 100644 --- a/src/DPD-REACT/pair_multi_lucy.cpp +++ b/src/DPD-REACT/pair_multi_lucy.cpp @@ -44,13 +44,14 @@ enum{NONE,RLINEAR,RSQ}; #define MAXLINE 1024 static const char cite_pair_multi_lucy[] = - "pair_style multi/lucy command:\n\n" + "pair_style multi/lucy command: doi:10.1063/1.4942520\n\n" "@Article{Moore16,\n" - " author = {J.D. Moore, B.C. Barnes, S. Izvekov, M. Lisal, M.S. Sellers, D.E. Taylor and J. K. Brennan},\n" - " title = {A coarse-grain force field for RDX: Density dependent and energy conserving},\n" - " journal = {J. Chem. Phys.},\n" + " author = {J. D. Moore and B. C. Barnes and S. Izvekov and M. Lisal and M. S. Sellers and D. E. Taylor and J. K. Brennan},\n" + " title = {A Coarse-Grain Force Field for {RDX}: Density Dependent and Energy Conserving},\n" + " journal = {J.~Chem.\\ Phys.},\n" " year = 2016,\n" " volume = 144\n" + " number = 10,\n" " pages = {104501}\n" "}\n\n"; diff --git a/src/DPD-REACT/pair_multi_lucy_rx.cpp b/src/DPD-REACT/pair_multi_lucy_rx.cpp index bd508707dd..c2a3f1a55e 100644 --- a/src/DPD-REACT/pair_multi_lucy_rx.cpp +++ b/src/DPD-REACT/pair_multi_lucy_rx.cpp @@ -55,11 +55,11 @@ enum{NONE,RLINEAR,RSQ}; #define isOneFluid(_site) ( (_site) == oneFluidParameter ) static const char cite_pair_multi_lucy_rx[] = - "pair_style multi/lucy/rx command:\n\n" + "pair_style multi/lucy/rx command: doi:10.1063/1.4942520\n\n" "@Article{Moore16,\n" - " author = {J.D. Moore, B.C. Barnes, S. Izvekov, M. Lisal, M.S. Sellers, D.E. Taylor and J. K. Brennan},\n" - " title = {A coarse-grain force field for RDX: Density dependent and energy conserving},\n" - " journal = {J. Chem. Phys.},\n" + " author = {J. D. Moore and B. C. Barnes and S. Izvekov and M. Lisal and M. S. Sellers and D. E. Taylor and J. K. Brennan},\n" + " title = {A Coarse-Grain Force Field for {RDX}: {D}ensity Dependent and Energy Conserving},\n" + " journal = {J.~Chem.\\ Phys.},\n" " year = 2016,\n" " volume = 144\n" " pages = {104501}\n" diff --git a/src/EFF/atom_vec_electron.cpp b/src/EFF/atom_vec_electron.cpp index 1f9d1f3e65..76d6a98bcd 100644 --- a/src/EFF/atom_vec_electron.cpp +++ b/src/EFF/atom_vec_electron.cpp @@ -23,14 +23,15 @@ using namespace LAMMPS_NS; static const char cite_user_eff_package[] = - "EFF package:\n\n" + "EFF package: doi:10.1002/jcc.21637\n\n" "@Article{Jaramillo-Botero11,\n" - " author = {A. Jaramillo-Botero, J. Su, A. Qi, W. A. Goddard III},\n" + " author = {A. Jaramillo-Botero and J. Su and A. Qi and Goddard, III, W. A.},\n" " title = {Large-Scale, Long-Term Nonadiabatic Electron Molecular Dynamics for Describing " "Material Properties and Phenomena in Extreme Environments},\n" " journal = {J.~Comp.~Chem.},\n" " year = 2011,\n" " volume = 32,\n" + " number = 3,\n" " pages = {497--512}\n" "}\n\n"; diff --git a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp index 2dde2397db..257dcb4f51 100644 --- a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp @@ -37,10 +37,10 @@ using namespace LAMMPS_NS; ------------------------------------------------------------------------------------*/ static const char cite_compute_stress_cartesian[] = - "compute stress/cartesian:\n\n" + "compute stress/cartesian: doi:10.3390/nano11010165\n\n" "@article{galteland2021nanothermodynamic,\n" - "title={Nanothermodynamic description and molecular simulation of a single-phase fluid in a " - "slit pore},\n" + "title={Nanothermodynamic Description and Molecular Simulation of a Single-Phase Fluid in a " + "Slit Pore},\n" "author={Galteland, Olav and Bedeaux, Dick and Kjelstrup, Signe},\n" "journal={Nanomaterials},\n" "volume={11},\n" diff --git a/src/EXTRA-COMPUTE/compute_stress_cylinder.cpp b/src/EXTRA-COMPUTE/compute_stress_cylinder.cpp index e4c246b469..6304744ba1 100644 --- a/src/EXTRA-COMPUTE/compute_stress_cylinder.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_cylinder.cpp @@ -43,13 +43,14 @@ using MathSpecial::square; ------------------------------------------------------------------------------------*/ static const char cite_compute_stress_cylinder[] = - "compute stress/cylinder:\n\n" + "compute stress/cylinder: doi:10.1063/1.5037054\n\n" "@Article{Addington,\n" - " author = {C. K. Addington, Y. Long, K. E. Gubbins},\n" - " title = {The pressure in interfaces having cylindrical geometry},\n" - " journal = {J.~Chem.~Phys.},\n" + " author = {C. K. Addington and Y. Long and K. E. Gubbins},\n" + " title = {The Pressure in Interfaces Having Cylindrical Geometry},\n" + " journal = {J.~Chem.\\ Phys.},\n" " year = 2018,\n" " volume = 149,\n" + " number = 8,\n" " pages = {084109}\n" "}\n\n"; diff --git a/src/EXTRA-COMPUTE/compute_stress_spherical.cpp b/src/EXTRA-COMPUTE/compute_stress_spherical.cpp index 18165513f9..c893d21f51 100644 --- a/src/EXTRA-COMPUTE/compute_stress_spherical.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_spherical.cpp @@ -46,11 +46,11 @@ using MathSpecial::square; ------------------------------------------------------------------------------------*/ static const char cite_compute_stress_sphere[] = - "compute stress/spherical:\n\n" + "compute stress/spherical: doi:10.48550/arXiv.2201.13060\n\n" "@article{galteland2022defining,\n" - "title={Defining the pressures of a fluid in a nanoporous, heterogeneous medium},\n" + "title={Defining the Pressures of a Fluid in a Nanoporous, Heterogeneous Medium},\n" "author={Galteland, Olav and Rauter, Michael T and Varughese, Kevin K and Bedeaux, Dick and " - "Kjelstrup, Signe},\n" + " Kjelstrup, Signe},\n" "journal={arXiv preprint arXiv:2201.13060},\n" "year={2022}\n" "}\n\n"; diff --git a/src/EXTRA-FIX/fix_ave_correlate_long.cpp b/src/EXTRA-FIX/fix_ave_correlate_long.cpp index c51ff7f3bd..9ed8a1e466 100644 --- a/src/EXTRA-FIX/fix_ave_correlate_long.cpp +++ b/src/EXTRA-FIX/fix_ave_correlate_long.cpp @@ -43,13 +43,14 @@ using namespace FixConst; enum{AUTO,UPPER,LOWER,AUTOUPPER,AUTOLOWER,FULL}; static const char cite_fix_ave_correlate_long[] = -"fix ave/correlate/long command:\n\n" +"fix ave/correlate/long command: doi:10.1063/1.3491098\n\n" "@Article{Ramirez10,\n" " author = {Jorge Rami{\'}rez and Sathish K. Sukumaran and Bart Vorselaars and Alexei E. Likhtman},\n" -" title = {Efficient on the fly calculation of time correlation functions in computer simulations}," -" journal = {J.~Chem.~Phys.},\n" +" title = {Efficient on the Fly Calculation of Time Correlation Functions in Computer Simulations}," +" journal = {J.~Chem.\\ Phys.},\n" " year = 2010,\n" " volume = 133,\n" +" number = 15,\n" " pages = {154103}\n" "}\n\n"; diff --git a/src/EXTRA-FIX/fix_electron_stopping_fit.cpp b/src/EXTRA-FIX/fix_electron_stopping_fit.cpp index 0e0ccc0ebb..f35f4ce0dd 100644 --- a/src/EXTRA-FIX/fix_electron_stopping_fit.cpp +++ b/src/EXTRA-FIX/fix_electron_stopping_fit.cpp @@ -35,15 +35,15 @@ using namespace FixConst; // --------------------------------------------------------------------- static const char cite_fix_electron_stopping_fit_c[] = - "fix electron/stopping/fit command:\n\n" + "fix electron/stopping/fit command: doi:10.1063/1.5022471\n\n" "@Article{Stewart2018,\n" - " author = { J.A. Stewart and G. Brookman and P. Price and M. Franco and W. Ji and K. Hattar and R. Dingreville },\n" - " title = { Characterizing single isolated radiation-damage events from molecular dynamics via virtual diffraction methods },\n" - " journal = { Journal of Applied Physics },\n" - " year = { 2018 },\n" - " volume = { 123 },\n" - " number = { 16 },\n" - " pages = { 165902 }\n" + " author = { J. A. Stewart and G. Brookman and P. Price and M. Franco and W. Ji and K. Hattar and R. Dingreville },\n" + " title = { Characterizing Single Isolated Radiation-Damage Events from Molecular Dynamics via Virtual Diffraction Methods },\n" + " journal = {Journal of Applied Physics},\n" + " year = {2018},\n" + " volume = {123},\n" + " number = {16},\n" + " pages = {165902}\n" "}\n\n" "@Article{Lee2020,\n" " author = { C.W. Lee and J.A. Stewart and S.M. Foiles and R. Dingreville and A. Schleife },\n" diff --git a/src/EXTRA-FIX/fix_filter_corotate.cpp b/src/EXTRA-FIX/fix_filter_corotate.cpp index e2bd982617..06eefd9ebd 100644 --- a/src/EXTRA-FIX/fix_filter_corotate.cpp +++ b/src/EXTRA-FIX/fix_filter_corotate.cpp @@ -46,14 +46,14 @@ using namespace FixConst; #define MASSDELTA 0.1 static const char cite_filter_corotate[] = - "Mollified Impulse Method with Corotational Filter:\n\n" + "Mollified Impulse Method with Corotational Filter: doi:10.1016/j.jcp.2016.12.024\n\n" "@Article{Fath2017,\n" " Title =" - "{A fast mollified impulse method for biomolecular atomistic simulations},\n" - " Author = {L. Fath and M. Hochbruck and C.V. Singh},\n" + "{A Fast Mollified Impulse Method for Biomolecular Atomistic Simulations},\n" + " Author = {L. Fath and M. Hochbruck and C. V. Singh},\n" " Journal = {Journal of Computational Physics},\n" " Year = {2017},\n" - " Pages = {180 - 198},\n" + " Pages = {180--198},\n" " Volume = {333},\n\n" " Doi = {https://doi.org/10.1016/j.jcp.2016.12.024},\n" " ISSN = {0021-9991},\n" diff --git a/src/EXTRA-FIX/fix_flow_gauss.cpp b/src/EXTRA-FIX/fix_flow_gauss.cpp index a1238ea748..8b9d9dca8f 100644 --- a/src/EXTRA-FIX/fix_flow_gauss.cpp +++ b/src/EXTRA-FIX/fix_flow_gauss.cpp @@ -33,7 +33,7 @@ using namespace LAMMPS_NS; using namespace FixConst; static const char cite_flow_gauss[] = - "Gaussian dynamics package:\n\n" + "Gaussian dynamics package: doi:10.1021/acs.jpcb.6b09387\n\n" "@Article{strong_water_2017,\n" "title = {The Dynamics of Water in Porous Two-Dimensional Crystals},\n" "volume = {121},\n" @@ -41,7 +41,7 @@ static const char cite_flow_gauss[] = "url = {https://doi.org/10.1021/acs.jpcb.6b09387},\n" "doi = {10.1021/acs.jpcb.6b09387},\n" "urldate = {2016-12-07},\n" - "journal = {J. Phys. Chem. B},\n" + "journal = {J.~Phys.\\ Chem.~B},\n" "author = {Strong, Steven E. and Eaves, Joel D.},\n" "year = {2017},\n" "pages = {189--207}\n" diff --git a/src/EXTRA-FIX/fix_pafi.cpp b/src/EXTRA-FIX/fix_pafi.cpp index d6ee4627c9..f0932c94ff 100644 --- a/src/EXTRA-FIX/fix_pafi.cpp +++ b/src/EXTRA-FIX/fix_pafi.cpp @@ -40,11 +40,11 @@ using namespace LAMMPS_NS; static const char cite_fix_pafi_package[] = - "citation for fix pafi:\n\n" + "citation for fix pafi: doi:10.1103/PhysRevLett.120.135503\n\n" "@article{SwinburneMarinica2018,\n" "author={T. D. Swinburne and M. C. Marinica},\n" - "title={Unsupervised calculation of free energy barriers in large " - "crystalline systems},\n" + "title={Unsupervised Calculation of Free Energy Barriers in Large " + "Crystalline Systems},\n" "journal={Physical Review Letters},\n" "volume={120},\n" "number={13},\n" diff --git a/src/EXTRA-FIX/fix_rhok.cpp b/src/EXTRA-FIX/fix_rhok.cpp index 9bdf940a7b..077dad7f25 100644 --- a/src/EXTRA-FIX/fix_rhok.cpp +++ b/src/EXTRA-FIX/fix_rhok.cpp @@ -31,15 +31,15 @@ using namespace FixConst; using namespace MathConst; static const char cite_fix_rhok[] = - "Bias on the collective density field (fix rhok):\n\n" + "Bias on the collective density field (fix rhok): doi:10.1063/1.4818747\n\n" "@Article{pedersen_jcp139_104102_2013,\n" - "title = {Direct calculation of the solid-liquid Gibbs free energy difference in a single equilibrium simulation},\n" + "title = {Direct Calculation of the Solid-Liquid {G}ibbs Free Energy Difference in a Single Equilibrium Simulation},\n" "volume = {139},\n" "number = {10},\n" "url = {https://aip.scitation.org/doi/10.1063/1.4818747},\n" "doi = {10.1063/1.4818747},\n" "urldate = {2017-10-03},\n" - "journal = {J. Chem. Phys.},\n" + "journal = {J.~Chem.\\ Phys.},\n" "author = {Pedersen, Ulf R.},\n" "year = {2013},\n" "pages = {104102}\n" diff --git a/src/EXTRA-FIX/fix_ti_spring.cpp b/src/EXTRA-FIX/fix_ti_spring.cpp index b332c18148..48babd57a2 100644 --- a/src/EXTRA-FIX/fix_ti_spring.cpp +++ b/src/EXTRA-FIX/fix_ti_spring.cpp @@ -38,7 +38,7 @@ static const char cite_fix_ti_spring[] = "ti/spring command:\n\n" "@article{freitas2016,\n" " author={Freitas, Rodrigo and Asta, Mark and de Koning, Maurice},\n" - " title={Nonequilibrium free-energy calculation of solids using LAMMPS},\n" + " title={Nonequilibrium Free-Energy Calculation of Solids Using {LAMMPS}},\n" " journal={Computational Materials Science},\n" " volume={112},\n" " pages={333--341},\n" diff --git a/src/EXTRA-FIX/fix_ttm_mod.cpp b/src/EXTRA-FIX/fix_ttm_mod.cpp index 8979a30bf4..d09dcf28b5 100644 --- a/src/EXTRA-FIX/fix_ttm_mod.cpp +++ b/src/EXTRA-FIX/fix_ttm_mod.cpp @@ -48,11 +48,11 @@ using namespace MathConst; // to spatially average consistent with the TTM grid static const char cite_fix_ttm_mod[] = - "fix ttm/mod command:\n\n" + "fix ttm/mod command: doi:10.1088/0953-8984/26/47/475401, doi:10.1002/ctpp.201310025\n\n" "@article{Pisarev2014,\n" "author = {Pisarev, V. V. and Starikov, S. V.},\n" - "title = {{Atomistic simulation of ion track formation in UO2.}},\n" - "journal = {J.~Phys.:~Condens.~Matter},\n" + "title = {{Atomistic Simulation of Ion Track Formation in {UO$_2$}.}},\n" + "journal = {J.~Phys.\\ Condens.\\ Matter},\n" "volume = {26},\n" "number = {47},\n" "pages = {475401},\n" @@ -60,7 +60,7 @@ static const char cite_fix_ttm_mod[] = "}\n\n" "@article{Norman2013,\n" "author = {Norman, G. E. and Starikov, S. V. and Stegailov, V. V. and Saitov, I. M. and Zhilyaev, P. A.},\n" - "title = {{Atomistic Modeling of Warm Dense Matter in the Two-Temperature State}},\n" + "title = {Atomistic Modeling of Warm Dense Matter in the Two-Temperature State},\n" "journal = {Contrib.~Plasm.~Phys.},\n" "number = {2},\n" "volume = {53},\n" diff --git a/src/EXTRA-MOLECULE/dihedral_table_cut.cpp b/src/EXTRA-MOLECULE/dihedral_table_cut.cpp index 5ac3ab6ebb..986d9f1773 100644 --- a/src/EXTRA-MOLECULE/dihedral_table_cut.cpp +++ b/src/EXTRA-MOLECULE/dihedral_table_cut.cpp @@ -36,13 +36,13 @@ using namespace LAMMPS_NS; using namespace MathConst; static const char cite_dihedral_tablecut[] = - "dihedral_style table/cut command:\n\n" + "dihedral_style table/cut command: doi:10.1021/acs.jctc.7b01229\n\n" "@Article{Salerno17,\n" " author = {K. M. Salerno and N. Bernstein},\n" " title = {Persistence Length, End-to-End Distance, and Structure of Coarse-Grained Polymers},\n" - " journal = {J.~Chem.~Theory Comput.},\n" + " journal = {J.~Chem.\\ Theory Comput.},\n" " year = 2018,\n" - " DOI = 10.1021/acs.jctc.7b01229" + " DOI = \"10.1021/acs.jctc.7b01229\"\n" "}\n\n"; /* ---------------------------------------------------------------------- */ diff --git a/src/EXTRA-PAIR/pair_e3b.cpp b/src/EXTRA-PAIR/pair_e3b.cpp index 5011cc01e0..ab68b5c729 100644 --- a/src/EXTRA-PAIR/pair_e3b.cpp +++ b/src/EXTRA-PAIR/pair_e3b.cpp @@ -468,40 +468,40 @@ void PairE3B::init_style() } static const char cite_E3B1[] = - "Explicit Three-Body (E3B) potential for water:\n\n" + "Explicit Three-Body (E3B) potential for water: doi:10.1021/jp8009468\n\n" "@article{kumar_water_2008,\n" "title = {Water Simulation Model with Explicit Three-Molecule Interactions},\n" "volume = {112},\n" - "doi = {10.1021/jp8009468},\n" "number = {28},\n" - "journal = {J Phys. Chem. B},\n" + "doi = {10.1021/jp8009468},\n" + "journal = {J.~Phys.\\ Chem.~B},\n" "author = {Kumar, R. and Skinner, J. L.},\n" "year = {2008},\n" "pages = {8311--8318}\n" "}\n\n"; static const char cite_E3B2[] = - "Explicit Three-Body (E3B) potential for water:\n\n" + "Explicit Three-Body (E3B) potential for water: doi:10.1063/1.3587053\n\n" "@article{tainter_robust_2011,\n" - "title = {Robust three-body water simulation model},\n" + "title = {Robust Three-Body Water Simulation Model},\n" "volume = {134},\n" "doi = {10.1063/1.3587053},\n" "number = {18},\n" - "journal = {J. Chem. Phys},\n" + "journal = {J.~Chem.\\ Phys},\n" "author = {Tainter, C. J. and Pieniazek, P. A. and Lin, Y.-S. and Skinner, J. L.},\n" "year = {2011},\n" "pages = {184501}\n" "}\n\n"; static const char cite_E3B3[] = - "Explicit Three-Body (E3B) potential for water:\n\n" + "Explicit Three-Body (E3B) potential for water: doi:10.1021/acs.jctc.5b00117\n\n" "@article{tainter_reparametrized_2015,\n" "title = {Reparametrized {E3B} (Explicit Three-Body) Water Model Using the {TIP4P/2005} Model " "as a Reference},\n" "volume = {11},\n" "doi = {10.1021/acs.jctc.5b00117},\n" "number = {5},\n" - "journal = {J. Chem. Theory Comput.},\n" + "journal = {J.~Chem.\\ Theory Comput.},\n" "author = {Tainter, Craig J. and Shi, Liang and Skinner, James L.},\n" "year = {2015},\n" "pages = {2268--2277}\n" diff --git a/src/EXTRA-PAIR/pair_lj_relres.cpp b/src/EXTRA-PAIR/pair_lj_relres.cpp index 5d1ed4fdf0..88621fe54a 100644 --- a/src/EXTRA-PAIR/pair_lj_relres.cpp +++ b/src/EXTRA-PAIR/pair_lj_relres.cpp @@ -31,18 +31,18 @@ using namespace LAMMPS_NS; static const char cite_relres[] = - "Pair style lj/relres: doi:10.1021/acs.jctc.0c01003\n\n" + "Pair style lj/relres: doi:10.1021/acs.jctc.0c01003, doi:10.1021/acs.jctc.0c01003\n\n" "@Article{Chaimovich1,\n" " author = {A. Chaimovich, C. Peter, K. Kremer},\n" - " title = {Relative resolution: A hybrid formalism for fluid mixtures},\n" - " journal = {J.~Chem.~Phys.},\n" + " title = {Relative Resolution: {A} Hybrid Formalism for Fluid Mixtures},\n" + " journal = {J.~Chem.\\ Phys.},\n" " year = 2015,\n" " volume = 143,\n" " pages = {243107}\n" "@Article{Chaimovich2,\n" - " author = {M. Chaimovich, A. Chaimovich},\n" + " author = {M. Chaimovich and A. Chaimovich},\n" " title = {Relative Resolution: A Computationally Efficient Implementation in LAMMPS},\n" - " journal = {J.~Chem.~Theory~Comput.},\n" + " journal = {J.~Chem.\\ Theory Comput.},\n" " year = 2021,\n" " volume = 17,\n" " pages = {1045--1059}\n" diff --git a/src/EXTRA-PAIR/pair_momb.cpp b/src/EXTRA-PAIR/pair_momb.cpp index 2adb206308..5ace279621 100644 --- a/src/EXTRA-PAIR/pair_momb.cpp +++ b/src/EXTRA-PAIR/pair_momb.cpp @@ -32,16 +32,16 @@ using namespace LAMMPS_NS; static const char cite_momb[] = - "Pair style momb:\n\n" + "Pair style momb: doi:10.1021/jp412098n\n\n" "@Article{pair_momb_2015,\n" - "title = {A force field for describing the polyvinylpyrrolidone-mediated" - " solution-phase synthesis of shape-selective Ag nanoparticles.},\n" + "title = {A Force Field for Describing the Polyvinylpyrrolidone-Mediated" + " Solution-Phase Synthesis of Shape-Selective {Ag} Nanoparticles.},\n" "volume = {118},\n" "number = {6},\n" "url = {https://doi.org/10.1021/jp412098n},\n" "doi = {10.1021/jp412098n},\n" - "journal = {J. Phys. Chem. C},\n" - "author = {Zhou, Ya, Wissam A. Saidi, and Kristen A. Fichthorn},\n" + "journal = {J.~Phys.\ Chem.~C},\n" + "author = {Zhou, Ya and Wissam A. Saidi and Kristen A. Fichthorn},\n" "year = {2014},\n" "pages = {3366--3374}\n" "}\n\n"; diff --git a/src/GPU/fix_gpu.cpp b/src/GPU/fix_gpu.cpp index e6f682a2a3..4a3b79ce51 100644 --- a/src/GPU/fix_gpu.cpp +++ b/src/GPU/fix_gpu.cpp @@ -53,51 +53,57 @@ extern double lmp_gpu_update_bin_size(const double subx, const double suby, cons const int nlocal, const double cut); static const char cite_gpu_package[] = - "GPU package (short-range, long-range and three-body potentials): doi:10.1016/j.cpc.2010.12.021\n\n" + "GPU package (short-range, long-range and three-body potentials): doi:10.1016/j.cpc.2010.12.021, doi:10.1016/j.cpc.2011.10.012, doi:10.1016/j.cpc.2013.08.002, doi:10.1016/j.commatsci.2014.10.068, doi:10.1016/j.cpc.2016.10.020, doi:10.3233/APC200086\n\n" "@Article{Brown11,\n" - " author = {W. M. Brown, P. Wang, S. J. Plimpton, A. N. Tharrington},\n" - " title = {Implementing Molecular Dynamics on Hybrid High Performance Computers - Short Range Forces},\n" - " journal = {Comp.~Phys.~Comm.},\n" + " author = {W. M. Brown and P. Wang and S. J. Plimpton and A. N. Tharrington},\n" + " title = {Implementing Molecular Dynamics on Hybrid High Performance Computers---Short Range Forces},\n" + " journal = {Comput.\\ Phys.\\ Commun.},\n" " year = 2011,\n" " volume = 182,\n" - " pages = {898--911}\n" + " pages = {898--911},\n" + " doi = {10.1016/j.cpc.2010.12.021}\n" "}\n\n" "@Article{Brown12,\n" " author = {W. M. Brown, A. Kohlmeyer, S. J. Plimpton, A. N. Tharrington},\n" " title = {Implementing Molecular Dynamics on Hybrid High Performance Computers - Particle-Particle Particle-Mesh},\n" - " journal = {Comp.~Phys.~Comm.},\n" + " journal = {Comput.\\ Phys.\\ Commun.},\n" " year = 2012,\n" " volume = 183,\n" + " doi = {10.1016/j.cpc.2011.10.012},\n" " pages = {449--459}\n" "}\n\n" "@Article{Brown13,\n" " author = {W. M. Brown, Y. Masako},\n" - " title = {Implementing Molecular Dynamics on Hybrid High Performance Computers – Three-Body Potentials},\n" - " journal = {Comp.~Phys.~Comm.},\n" + " title = {Implementing Molecular Dynamics on Hybrid High Performance Computers---Three-Body Potentials},\n" + " journal = {Comput.\\ Phys.\\ Commun.},\n" " year = 2013,\n" " volume = 184,\n" - " pages = {2785--2793}\n" + " pages = {2785--2793},\n" + " doi = {10.1016/j.cpc.2013.08.002},\n" "}\n\n" "@Article{Trung15,\n" " author = {T. D. Nguyen, S. J. Plimpton},\n" - " title = {Accelerating dissipative particle dynamics simulations for soft matter systems},\n" - " journal = {Comput.~Mater.~Sci.},\n" + " title = {Accelerating Dissipative Particle Dynamics Simulations for Soft Matter Systems},\n" + " journal = {Comput.\\ Mater.\\ Sci.},\n" " year = 2015,\n" + " doi = {10.1016/j.commatsci.2014.10.068},\n" " volume = 100,\n" " pages = {173--180}\n" "}\n\n" "@Article{Trung17,\n" " author = {T. D. Nguyen},\n" - " title = {GPU-accelerated Tersoff potentials for massively parallel Molecular Dynamics simulations},\n" - " journal = {Comp.~Phys.~Comm.},\n" + " title = {{GPU}-Accelerated {T}ersoff Potentials for Massively Parallel Molecular Dynamics Simulations},\n" + " journal = {Comput.\ Phys.\ Commun.},\n" " year = 2017,\n" + " doi = {10.1016/j.cpc.2016.10.020},\n" " volume = 212,\n" " pages = {113--122}\n" "}\n\n" - "@Article{Nikolskiy19,\n" + "@inproceedings{Nikolskiy19,\n" " author = {V. Nikolskiy, V. Stegailov},\n" - " title = {GPU acceleration of four-site water models in LAMMPS},\n" - " journal = {Proceeding of the International Conference on Parallel Computing (ParCo 2019), Prague, Czech Republic},\n" + " title = {{GPU} Acceleration of Four-Site Water Models in {LAMMPS}},\n" + " booktitle = {Proceedings of the International Conference on Parallel Computing (ParCo 2019), Prague, Czech Republic},\n" + " doi = {10.3233/APC200086}\n" " year = 2019\n" "}\n\n"; diff --git a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp index 49b2adbd33..fbcadbd94f 100644 --- a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp +++ b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp @@ -47,11 +47,11 @@ using namespace InterLayer; static const char cite_ilp[] = "ilp/graphene/hbn potential doi:10.1021/acs.nanolett.8b02848\n" "@Article{Ouyang2018\n" - " author = {W. Ouyang, D. Mandelli, M. Urbakh, and O. Hod},\n" + " author = {W. Ouyang and D. Mandelli and M. Urbakh and O. Hod},\n" " title = {Nanoserpents: Graphene Nanoribbon Motion on Two-Dimensional Hexagonal Materials},\n" " journal = {Nano Letters},\n" " volume = 18,\n" - " pages = {6009}\n" + " pages = 6009\n" " year = 2018,\n" "}\n\n"; diff --git a/src/INTERLAYER/pair_ilp_tmd.cpp b/src/INTERLAYER/pair_ilp_tmd.cpp index 52119cbf12..e15b93de0e 100644 --- a/src/INTERLAYER/pair_ilp_tmd.cpp +++ b/src/INTERLAYER/pair_ilp_tmd.cpp @@ -42,17 +42,18 @@ using namespace InterLayer; #define DELTA 4 #define PGDELTA 1 -static const char cite_ilp_tmd[] = "ilp/tmd potential doi/10.1021/acs.jctc.1c00782\n" - "@Article{Ouyang2021\n" - " author = {W. Ouyang, R. Sofer, X. Gao, J. Hermann, A. " - "Tkatchenko, L. Kronik, M. Urbakh, and O. Hod},\n" - " title = {Anisotropic Interlayer Force Field for Transition " - "Metal Dichalcogenides: The Case of Molybdenum Disulfide},\n" - " journal = {J. Chem. Theory Comput.},\n" - " volume = 17,\n" - " pages = {7237–7245}\n" - " year = 2021,\n" - "}\n\n"; +static const char cite_ilp_tmd[] = +"ilp/tmd potential doi:10.1021/acs.jctc.1c00782\n" + "@Article{Ouyang2021\n" + " author = {W. Ouyang and R. Sofer and X. Gao and J. Hermann and\n" + " A. Tkatchenko and L. Kronik and M. Urbakh and O. Hod},\n" + " title = {Anisotropic Interlayer Force Field for Transition " + " Metal Dichalcogenides: The Case of Molybdenum Disulfide},\n" + " journal = {J.~Chem.\\ Theory Comput.},\n" + " volume = 17,\n" + " pages = {7237--7245}\n" + " year = 2021,\n" + "}\n\n"; /* ---------------------------------------------------------------------- */ diff --git a/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp b/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp index 116018f18a..0f9dd9ec47 100644 --- a/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp +++ b/src/INTERLAYER/pair_kolmogorov_crespi_full.cpp @@ -47,7 +47,7 @@ using namespace InterLayer; static const char cite_kc[] = "kolmogorov/crespi/full potential doi:10.1021/acs.nanolett.8b02848\n" "@Article{Ouyang2018\n" - " author = {W. Ouyang, D. Mandelli, M. Urbakh, and O. Hod},\n" + " author = {W. Ouyang and D. Mandelli and M. Urbakh and O. Hod},\n" " title = {Nanoserpents: Graphene Nanoribbon Motion on Two-Dimensional Hexagonal Materials},\n" " journal = {Nano Letters},\n" " volume = 18,\n" diff --git a/src/INTERLAYER/pair_saip_metal.cpp b/src/INTERLAYER/pair_saip_metal.cpp index bb23cad840..4e768a9168 100644 --- a/src/INTERLAYER/pair_saip_metal.cpp +++ b/src/INTERLAYER/pair_saip_metal.cpp @@ -40,13 +40,13 @@ using namespace InterLayer; #define PGDELTA 1 static const char cite_saip[] = - "saip/metal potential doi.org/10.1021/acs.jctc.1c00622\n" + "saip/metal potential: doi:10.1021/acs.jctc.1c00622\n\n" "@Article{Ouyang2021\n" - " author = {W. Ouyang, O. Hod, and R. Guerra},\n" + " author = {W. Ouyang and O. Hod and R. Guerra},\n" " title = {Registry-Dependent Potential for Interfaces of Gold with Graphitic Systems},\n" - " journal = {J. Chem. Theory Comput.},\n" + " journal = {J.~Chem.\\ Theory Comput.},\n" " volume = 17,\n" - " pages = {7215-7223}\n" + " pages = {7215--7223}\n" " year = 2021,\n" "}\n\n"; diff --git a/src/LATBOLTZ/fix_lb_fluid.cpp b/src/LATBOLTZ/fix_lb_fluid.cpp index e3662b338b..049d9ce44e 100644 --- a/src/LATBOLTZ/fix_lb_fluid.cpp +++ b/src/LATBOLTZ/fix_lb_fluid.cpp @@ -45,11 +45,11 @@ using namespace FixConst; static const char cite_fix_lbfluid[] = "fix lb/fluid command: doi:10.1016/j.cpc.2022.108318\n\n" "@Article{Denniston et al.,\n" - " author = {C. Denniston, N. Afrasiabian, M.G. Cole-Andre," - "F.E. Mackay, S.T.T. Ollila, T. Whitehead},\n" - " title = {LAMMPS lb/fluid fix version 2: Improved Hydrodynamic " - "Forces Implemented into LAMMPS through a lattice-Boltzmann fluid}," - " journal = {Comp.~Phys.~Comm.},\n" + " author = {C. Denniston and N. Afrasiabian and M. G. Cole-Andre," + " F. E. Mackay and S. T. T. Ollila and T. Whitehead},\n" + " title = {{LAMMPS} lb/fluid fix version 2: Improved Hydrodynamic " + " Forces Implemented into {LAMMPS} Through a Lattice-{B}oltzmann Fluid}," + " journal = {Comput.\\ Phys.\\ Commun.},\n" " year = 2022,\n" " volume = 275,\n" " pages = {108318}\n" diff --git a/src/MANYBODY/pair_atm.cpp b/src/MANYBODY/pair_atm.cpp index 1d1432c330..9e125c3403 100644 --- a/src/MANYBODY/pair_atm.cpp +++ b/src/MANYBODY/pair_atm.cpp @@ -35,8 +35,8 @@ static const char cite_atm_package[] = "ATM package: doi:10.1063/1.4704930\n\n" "@Article{Lishchuk:2012:164501,\n" " author = {S. V. Lishchuk},\n" - " title = {Role of three-body interactions in formation of bulk viscosity in liquid argon},\n" - " journal = {J.~Chem.~Phys.},\n" + " title = {Role of Three-Body Interactions in Formation of Bulk Viscosity in Liquid Argon},\n" + " journal = {J.~Chem.\\ Phys.},\n" " year = 2012,\n" " volume = 136,\n" " number = 16,\n" diff --git a/src/MANYBODY/pair_edip_multi.cpp b/src/MANYBODY/pair_edip_multi.cpp index cb50426033..07b265ba48 100644 --- a/src/MANYBODY/pair_edip_multi.cpp +++ b/src/MANYBODY/pair_edip_multi.cpp @@ -42,18 +42,20 @@ using namespace MathExtra; #define DELTA 4 static const char cite_pair_edip[] = + "pair edip/multi: doi:10.1103/PhysRevB.86.144118, doi:10.1088/0953-8984/22/3/035802\n\n" "@article{cjiang2012\n" " author = {Jian, Chao and Morgan, Dane, and Szlufarska, Izabella},\n" - " title = {Carbon tri-interstitial defect: A model for DII center},\n" - " journal = {Physical Review B},\n" + " title = {Carbon Tri-Interstitial Defect: {A} Model for {D$_{\mathrm{II}}$} Center},\n" + " journal = {Phys.\ Rev.~B},\n" " volume = {86},\n" " pages = {144118},\n" " year = {2012},\n" "}\n\n" "@article{lpizzagalli2010,\n" " author = {G. Lucas, M. Bertolus, and L. Pizzagalli},\n" - " journal = {J. Phys. : Condens. Matter 22},\n" + " journal = {J.~Phys.\ Condens.\ Matter},\n" " volume = {22},\n" + " number = 3,\n" " pages = {035802},\n" " year = {2010},\n" "}\n\n"; diff --git a/src/MANYBODY/pair_local_density.cpp b/src/MANYBODY/pair_local_density.cpp index d8bfd9d03a..c9fe782eb8 100644 --- a/src/MANYBODY/pair_local_density.cpp +++ b/src/MANYBODY/pair_local_density.cpp @@ -37,20 +37,20 @@ using namespace LAMMPS_NS; #define MAXLINE 1024 static const char cite_pair_local_density[] = - "pair_style local/density command:\n\n" + "pair_style local/density command: doi:10.1063/1.4958629, doi:10.1021/acs.jpcb.7b12446\n\n" "@Article{Sanyal16,\n" - " author = {T.Sanyal and M.Scott Shell},\n" - " title = {Coarse-grained models using local-density potentials optimized with the relative entropy: Application to implicit solvation},\n" - " journal = {J.~Chem.~Phys.},\n" + " author = {T. Sanyal and M. Scott Shell},\n" + " title = {Coarse-Grained Models Using Local-Density Potentials Optimized With the Relative Entropy: {A}pplication to Implicit Solvation},\n" + " journal = {J.~Chem.\\ Phys.},\n" " year = 2016,\n" - " DOI = doi.org/10.1063/1.4958629" + " DOI = {10.1063/1.4958629}" "}\n\n" "@Article{Sanyal18,\n" - " author = {T.Sanyal and M.Scott Shell},\n" - " title = {Transferable coarse-grained models of liquid-liquid equilibrium using local density potentials optimized with the relative entropy},\n" - " journal = {J.~Phys.~Chem. B},\n" + " author = {T. Sanyal and M. Scott Shell},\n" + " title = {Transferable Coarse-Grained Models of Liquid-Liquid Equilibrium Using Local Density Potentials Optimized with the Relative Entropy},\n" + " journal = {J.~Phys.\\ Chem.~B},\n" " year = 2018,\n" - " DOI = doi.org/10.1021/acs.jpcb.7b12446" + " DOI = {10.1021/acs.jpcb.7b12446}" "}\n\n"; /* ---------------------------------------------------------------------- */ diff --git a/src/MC/fix_bond_swap.cpp b/src/MC/fix_bond_swap.cpp index 59fabc8ffe..6a7ab6dbb7 100644 --- a/src/MC/fix_bond_swap.cpp +++ b/src/MC/fix_bond_swap.cpp @@ -39,13 +39,14 @@ using namespace LAMMPS_NS; using namespace FixConst; static const char cite_fix_bond_swap[] = - "fix bond/swap command:\n\n" + "fix bond/swap command: doi:10.1063/1.1628670\n\n" "@Article{Auhl03,\n" - " author = {R. Auhl, R. Everaers, G. S. Grest, K. Kremer, S. J. Plimpton},\n" - " title = {Equilibration of long chain polymer melts in computer simulations},\n" - " journal = {J.~Chem.~Phys.},\n" + " author = {R. Auhl and R. Everaers and G. S. Grest and K. Kremer and S. J. Plimpton},\n" + " title = {Equilibration of Long Chain Polymer Melts in Computer Simulations},\n" + " journal = {J.~Chem.\\ Phys.},\n" " year = 2003,\n" " volume = 119,\n" + " number = 12,\n" " pages = {12718--12728}\n" "}\n\n"; diff --git a/src/MC/fix_charge_regulation.cpp b/src/MC/fix_charge_regulation.cpp index 81f722bb6c..795ccb75d1 100644 --- a/src/MC/fix_charge_regulation.cpp +++ b/src/MC/fix_charge_regulation.cpp @@ -54,11 +54,11 @@ using namespace MathConst; using namespace MathSpecial; static const char cite_fix_charge_regulation[] = - "fix charge/regulation: \n\n" + "fix charge/regulation: doi:10.1063/5.0066432\n\n" "@Article{Curk22,\n" - " author = {T. Curk, J. Yuan, E. Luijten},\n" - " title = {Accelerated simulation method for charge regulation effects},\n" - " journal = {The Journal of Chemical Physics},\n" + " author = {T. Curk and J. Yuan and E. Luijten},\n" + " title = {Accelerated Simulation Method for Charge Regulation Effects},\n" + " journal = {Journal of Chemical Physics},\n" " year = 2022,\n" " volume = 156\n" "}\n\n"; diff --git a/src/MISC/pair_agni.cpp b/src/MISC/pair_agni.cpp index ee744173fc..3c309d578b 100644 --- a/src/MISC/pair_agni.cpp +++ b/src/MISC/pair_agni.cpp @@ -37,13 +37,13 @@ using namespace LAMMPS_NS; using namespace MathSpecial; static const char cite_pair_agni[] = - "pair agni command:\n\n" + "pair agni command: doi:10.1021/acs.jpcc.9b04207\n\n" "@article{huan2019jpc,\n" " author = {Huan, T. and Batra, R. and Chapman, J. and Kim, C. and Chandrasekaran, A. and Ramprasad, Rampi},\n" - " journal = {J. Phys. Chem. C},\n" - " volume = {121},\n" + " journal = {J.~Phys.\\ Chem.~C},\n" + " volume = {123},\n" " number = {34},\n" - " pages = {20715},\n" + " pages = {20715--20722},\n" " year = {2019},\n" "}\n\n"; diff --git a/src/MISC/pair_srp.cpp b/src/MISC/pair_srp.cpp index bb731cdc32..1c95caadc2 100644 --- a/src/MISC/pair_srp.cpp +++ b/src/MISC/pair_srp.cpp @@ -52,10 +52,11 @@ using namespace LAMMPS_NS; #define ONETWOBIT 0x40000000 static const char cite_srp[] = + "pair srp command: doi:10.1063/1.3698476\n\n" "@Article{Sirk2012\n" - " author = {T. Sirk and Y. Sliozberg and J. Brennan and M. Lisal and J. Andzelm},\n" - " title = {An enhanced entangled polymer model for dissipative particle dynamics},\n" - " journal = {J.~Chem.~Phys.},\n" + " author = {T. W. Sirk and Y. R. Sliozberg and J. K. Brennan and M. Lisal and J. W. Andzelm},\n" + " title = {An Enhanced Entangled Polymer Model for Dissipative Particle Dynamics},\n" + " journal = {J.~Chem.\\ Phys.},\n" " year = 2012,\n" " volume = 136,\n" " pages = {134903}\n" diff --git a/src/MISC/pair_srp_react.cpp b/src/MISC/pair_srp_react.cpp index f486aa33b7..25975c7fb0 100644 --- a/src/MISC/pair_srp_react.cpp +++ b/src/MISC/pair_srp_react.cpp @@ -47,13 +47,15 @@ There is an example script for this package in examples/PACKAGES/srp_react/. using namespace LAMMPS_NS; static const char cite_srpreact[] = + "pair srp/react style: doi:10.1021/acs.jpcb.1c09570\n\n" "@Article{palkar2022\n" " author = {Palkar, Vaibhav and Kuksenok, Olga},\n" " title = {Controlling Degradation and Erosion of Polymer Networks: Insights from Mesoscale Modeling},\n" - " journal = {J. Phys. Chem. B},\n" - " year = {2022},\n" - " volume = {126},\n" - " pages = {336-346}\n" + " journal = {J.~Phys.\\ Chem.~B},\n" + " year = 2022,\n" + " volume = 126,\n" + " number = 1,\n" + " pages = {336--346}\n" "}\n\n"; static int srp_instance = 0; diff --git a/src/ML-HDNNP/pair_hdnnp.cpp b/src/ML-HDNNP/pair_hdnnp.cpp index eb79a396b2..6873f76779 100644 --- a/src/ML-HDNNP/pair_hdnnp.cpp +++ b/src/ML-HDNNP/pair_hdnnp.cpp @@ -36,17 +36,17 @@ using namespace LAMMPS_NS; static const char cite_user_hdnnp_package[] = - "ML-HDNNP package: 10.1021/acs.jctc.8b00770\n\n" + "ML-HDNNP package: doi:10.1021/acs.jctc.8b00770\n\n" "@Article{Singraber19,\n" " author = {Singraber, Andreas and Behler, J{\"o}rg and Dellago, Christoph},\n" - " title = {Library-{{Based LAMMPS Implementation}} of {{High}}-{{Dimensional Neural Network " - "Potentials}}},\n" + " title = {Library-Based {LAMMPS} Implementation of High-Dimensional\n" + " Neural Network Potentials},\n" " year = {2019},\n" " month = mar,\n" " volume = {15},\n" " pages = {1827--1840},\n" " doi = {10.1021/acs.jctc.8b00770},\n" - " journal = {J.~Chem.~Theory~Comput.},\n" + " journal = {J.~Chem.\\ Theory Comput.},\n" " number = {3}\n" "}\n\n"; diff --git a/src/ML-RANN/pair_rann.cpp b/src/ML-RANN/pair_rann.cpp index d20a750ff8..8eb95f6dfb 100644 --- a/src/ML-RANN/pair_rann.cpp +++ b/src/ML-RANN/pair_rann.cpp @@ -60,14 +60,14 @@ DISTRIBUTION A. Approved for public release; distribution unlimited. OPSEC#4918 using namespace LAMMPS_NS; static const char cite_ml_rann_package[] = - "ML-RANN package:\n\n" + "ML-RANN package: doi:10.1016/j.commatsci.2020.110207\n\n" "@Article{Nitol2021,\n" " author = {Nitol, Mashroor S and Dickel, Doyl E and Barrett, Christopher D},\n" - " title = {Artificial neural network potential for pure zinc},\n" + " title = {Artificial Neural Network Potential for Pure Zinc},\n" " journal = {Computational Materials Science},\n" " year = 2021,\n" " volume = 188,\n" - " pages = {110207}\n" + " pages = 110207\n" "}\n\n"; diff --git a/src/OPENMP/pair_reaxff_omp.cpp b/src/OPENMP/pair_reaxff_omp.cpp index f10f5885bd..7112681b06 100644 --- a/src/OPENMP/pair_reaxff_omp.cpp +++ b/src/OPENMP/pair_reaxff_omp.cpp @@ -63,12 +63,14 @@ using namespace LAMMPS_NS; using namespace ReaxFF; static const char cite_pair_reaxff_omp[] = - "pair reaxff/omp and fix qeq/reaxff/omp command:\n\n" + "pair reaxff/omp and fix qeq/reaxff/omp command: doi:10.1177/1094342017746221\n\n" "@Article{Aktulga17,\n" - " author = {H. M. Aktulga, C. Knight, P. Coffman, K. A. OHearn, T. R. Shan, W. Jiang},\n" - " title = {Optimizing the performance of reactive molecular dynamics simulations for multi-core architectures},\n" + " author = {H. M. Aktulga and C. Knight and P. Coffman and\n" + " K. A. O'Hearn and T. R. Shan and W. Jiang},\n" + " title = {Optimizing the Performance of Reactive Molecular Dynamics\n" + " Simulations for Multi-Core Architectures},\n" " journal = {International Journal of High Performance Computing Applications},\n" - " year = to appear\n" + " year = 2018\n" "}\n\n"; /* ---------------------------------------------------------------------- */ diff --git a/src/OPT/pair_ilp_graphene_hbn_opt.cpp b/src/OPT/pair_ilp_graphene_hbn_opt.cpp index 36fac54f52..d0ed0f917e 100644 --- a/src/OPT/pair_ilp_graphene_hbn_opt.cpp +++ b/src/OPT/pair_ilp_graphene_hbn_opt.cpp @@ -42,7 +42,7 @@ static const char cite_ilp_cur[] = "ilp/graphene/hbn/opt potential doi:10.1145/3458817.3476137\n" "@inproceedings{gao2021lmff\n" " author = {Gao, Ping and Duan, Xiaohui and Others},\n" - " title = {LMFF: Efficient and Scalable Layered Materials Force Field on Heterogeneous " + " title = {{LMFF}: Efficient and Scalable Layered Materials Force Field on Heterogeneous " "Many-Core Processors},\n" " year = {2021},\n" " isbn = {9781450384421},\n" @@ -54,7 +54,7 @@ static const char cite_ilp_cur[] = "Networking, Storage and Analysis},\n" " articleno = {42},\n" " numpages = {14},\n" - " location = {St. Louis, Missouri},\n" + " location = {St.\\ Louis, Missouri},\n" " series = {SC'21},\n" "}\n\n"; diff --git a/src/ORIENT/fix_orient_bcc.cpp b/src/ORIENT/fix_orient_bcc.cpp index 919927ea07..c8979794e8 100644 --- a/src/ORIENT/fix_orient_bcc.cpp +++ b/src/ORIENT/fix_orient_bcc.cpp @@ -41,14 +41,15 @@ using namespace MathConst; #define BIG 1000000000 static const char cite_fix_orient_bcc[] = - "fix orient/bcc command:\n\n" + "fix orient/bcc command: doi:10.1016/j.commatsci.2016.02.016\n\n" "@Article{Wicaksono16,\n" - " author = {A. T. Wicaksono, C. W. Sinclair, M. Militzer},\n" - " title = {An atomistic study of the correlation between the migration of planar and curved grain boundaries},\n" - " journal = {Computational Materials Science},\n" - " year = 2016,\n" - " volume = 117,\n" - " pages = {397--405}\n" + " author = {A. T. Wicaksono and C. W. Sinclair and M. Militzer},\n" + " title = {An Atomistic Study of the Correlation Between the Migration\n" + " of Planar and Curved Grain Boundaries},\n" + " journal = {Computational Materials Science},\n" + " year = 2016,\n" + " volume = 117,\n" + " pages = {397--405}\n" "}\n\n"; /* ---------------------------------------------------------------------- */ diff --git a/src/ORIENT/fix_orient_eco.cpp b/src/ORIENT/fix_orient_eco.cpp index 7c8ff1f6aa..5f725a9e06 100644 --- a/src/ORIENT/fix_orient_eco.cpp +++ b/src/ORIENT/fix_orient_eco.cpp @@ -38,10 +38,10 @@ using namespace FixConst; using namespace MathConst; static const char cite_fix_orient_eco[] = - "fix orient/eco command:\n\n" + "fix orient/eco command: doi:j.commatsci.2020.109774\n\n" "@Article{Schratt20,\n" - " author = {A. A. Schratt, V. Mohles},\n" - " title = {Efficient calculation of the ECO driving force for atomistic simulations of grain boundary motion},\n" + " author = {A. A. Schratt and V. Mohles},\n" + " title = {Efficient Calculation of the {ECO} Driving Force for Atomistic Simulations of Grain Boundary Motion},\n" " journal = {Computational Materials Science},\n" " volume = {182},\n" " year = {2020},\n" diff --git a/src/ORIENT/fix_orient_fcc.cpp b/src/ORIENT/fix_orient_fcc.cpp index f64889d141..069d4b58fc 100644 --- a/src/ORIENT/fix_orient_fcc.cpp +++ b/src/ORIENT/fix_orient_fcc.cpp @@ -38,7 +38,7 @@ using namespace MathConst; #define BIG 1000000000 static const char cite_fix_orient_fcc[] = - "fix orient/fcc command:\n\n" + "fix orient/fcc command: doi:10.1038/nmat1559\n\n" "@Article{Janssens06,\n" " author = {K. G. F. Janssens, D. Olmsted, E.A. Holm, S. M. Foiles, S. J. Plimpton, and P. M. Derlet},\n" " title = {Computing the Mobility of Grain Boundaries},\n" diff --git a/src/PERI/atom_vec_peri.cpp b/src/PERI/atom_vec_peri.cpp index fd6b47990a..20eeef3042 100644 --- a/src/PERI/atom_vec_peri.cpp +++ b/src/PERI/atom_vec_peri.cpp @@ -26,13 +26,14 @@ using namespace LAMMPS_NS; static const char cite_peri_package[] = - "PERI package for Peridynamics:\n\n" + "PERI package for Peridynamics: doi:10.1016/j.cpc.2008.06.011\n\n" "@Article{Parks08,\n" - " author = {M. L. Parks, R. B. Lehoucq, S. J. Plimpton, S. A. Silling},\n" - " title = {Implementing peridynamics within a molecular dynamics code},\n" - " journal = {Comp.~Phys.~Comm.},\n" + " author = {M. L. Parks and R. B. Lehoucq and S. J. Plimpton and S. A. Silling},\n" + " title = {Implementing Peridynamics Within a Molecular Dynamics Code},\n" + " journal = {Comput.\\ Phys.\\ Commun.},\n" " year = 2008,\n" " volume = 179,\n" + " number = 11,\n" " pages = {777--783}\n" "}\n\n"; diff --git a/src/PHONON/fix_phonon.cpp b/src/PHONON/fix_phonon.cpp index b5774ad97c..3b4f182a16 100644 --- a/src/PHONON/fix_phonon.cpp +++ b/src/PHONON/fix_phonon.cpp @@ -50,11 +50,11 @@ using namespace FixConst; enum{FORWARD=-1,BACKWARD=1}; static const char cite_fix_phonon[] = - "fix phonon command:\n\n" + "fix phonon command: doi:10.1016/j.cpc.2011.04.019\n\n" "@Article{Kong11,\n" " author = {L. T. Kong},\n" - " title = {Phonon dispersion measured directly from molecular dynamics simulations},\n" - " journal = {Comp.~Phys.~Comm.},\n" + " title = {Phonon Dispersion Measured Directly from Molecular Dynamics Simulations},\n" + " journal = {Comput.\\ Phys.\\ Commun.},\n" " year = 2011,\n" " volume = 182,\n" " pages = {2201--2207}\n" diff --git a/src/POEMS/fix_poems.cpp b/src/POEMS/fix_poems.cpp index 20e0b7cc6b..b2b0366b9e 100644 --- a/src/POEMS/fix_poems.cpp +++ b/src/POEMS/fix_poems.cpp @@ -47,14 +47,15 @@ using namespace FixConst; #define EPSILON 1.0e-7 static const char cite_fix_poems[] = - "fix poems command:\n\n" + "fix poems command: doi:10.1016/j.ijnonlinmec.2008.04.003\n\n" "@Article{Mukherjee08,\n" - " author = {R. M. Mukherjee, P. S. Crozier, S. J. Plimpton, K. S. Anderson},\n" - " title = {Substructured molecular dynamics using multibody dynamics algorithms},\n" - " journal = {Intl.~J.~Non-linear Mechanics},\n" + " author = {R. M. Mukherjee and P. S. Crozier and S. J. Plimpton and K. S. Anderson},\n" + " title = {Substructured Molecular Dynamics Using Multibody Dynamics Algorithms},\n" + " journal = {Intl.\\ J.\\ Non-Linear Mechanics},\n" " year = 2008,\n" " volume = 43,\n" - " pages = {1045--1055}\n" + " number = 10,\n" + " pages = {1040--1055}\n" "}\n\n"; /* ---------------------------------------------------------------------- diff --git a/src/PTM/compute_ptm_atom.cpp b/src/PTM/compute_ptm_atom.cpp index 10341d3cd0..5ad2c6c043 100644 --- a/src/PTM/compute_ptm_atom.cpp +++ b/src/PTM/compute_ptm_atom.cpp @@ -47,13 +47,13 @@ under using namespace LAMMPS_NS; static const char cite_user_ptm_package[] = - "PTM package:\n\n" + "PTM package: doi:10.1088/0965-0393/24/5/055007\n\n" "@Article{larsen2016ptm,\n" " author={Larsen, Peter Mahler and Schmidt, S{\\o}ren and Schi{\\o}tz, " "Jakob},\n" - " title={Robust structural identification via polyhedral template " + " title={Robust Structural Identification via Polyhedral Template " "matching},\n" - " journal={Modelling~Simul.~Mater.~Sci.~Eng.},\n" + " journal={Model.\\ Simulat.\\ Mater.\\ Sci.\\ Eng.},\n" " year={2016},\n" " number={5},\n" " volume={24},\n" diff --git a/src/REACTION/fix_bond_react.cpp b/src/REACTION/fix_bond_react.cpp index 0383449bbd..35cb239d62 100644 --- a/src/REACTION/fix_bond_react.cpp +++ b/src/REACTION/fix_bond_react.cpp @@ -57,10 +57,10 @@ using namespace FixConst; using namespace MathConst; static const char cite_fix_bond_react[] = - "fix bond/react: reacter.org\n\n" + "fix bond/react: reacter.org doi:10.1016/j.polymer.2017.09.038 doi:10.1021/acs.macromol.0c02012\n\n" "@Article{Gissinger17,\n" - " author = {J. R. Gissinger, B. D. Jensen, K. E. Wise},\n" - " title = {Modeling chemical reactions in classical molecular dynamics simulations},\n" + " author = {J. R. Gissinger and B. D. Jensen and K. E. Wise},\n" + " title = {Modeling Chemical Reactions in Classical Molecular Dynamics Simulations},\n" " journal = {Polymer},\n" " year = 2017,\n" " volume = 128,\n" @@ -68,10 +68,11 @@ static const char cite_fix_bond_react[] = "}\n\n" "@Article{Gissinger20,\n" " author = {J. R. Gissinger, B. D. Jensen, K. E. Wise},\n" - " title = {REACTER: A Heuristic Method for Reactive Molecular Dynamics},\n" + " title = {{REACTER}: A Heuristic Method for Reactive Molecular Dynamics},\n" " journal = {Macromolecules},\n" " year = 2020,\n" " volume = 53,\n" + " number = 22,\n" " pages = {9953--9961}\n" "}\n\n"; diff --git a/src/REAXFF/fix_acks2_reaxff.cpp b/src/REAXFF/fix_acks2_reaxff.cpp index be71bc761f..9d1775c272 100644 --- a/src/REAXFF/fix_acks2_reaxff.cpp +++ b/src/REAXFF/fix_acks2_reaxff.cpp @@ -38,13 +38,14 @@ using namespace LAMMPS_NS; using namespace FixConst; static const char cite_fix_acks2_reax[] = - "fix acks2/reaxff command:\n\n" + "fix acks2/reaxff command: doi:10.1137/18M1224684\n\n" "@Article{O'Hearn2020,\n" - " author = {K. A. O'Hearn, A. Alperen, and H. M. Aktulga},\n" + " author = {K. A. {O'Hearn} and A. Alperen and H. M. Aktulga},\n" " title = {Fast Solvers for Charge Distribution Models on Shared Memory Platforms},\n" - " journal = {SIAM J. Sci. Comput.},\n" + " journal = {SIAM J.\\ Sci.\\ Comput.},\n" " year = 2020,\n" " volume = 42,\n" + " number = 1,\n" " pages = {1--22}\n" "}\n\n"; diff --git a/src/REAXFF/fix_qeq_reaxff.cpp b/src/REAXFF/fix_qeq_reaxff.cpp index 48e93f682a..6c03683518 100644 --- a/src/REAXFF/fix_qeq_reaxff.cpp +++ b/src/REAXFF/fix_qeq_reaxff.cpp @@ -54,10 +54,10 @@ static constexpr double SMALL = 1.0e-14; static constexpr double QSUMSMALL = 0.00001; static const char cite_fix_qeq_reaxff[] = - "fix qeq/reaxff command:\n\n" + "fix qeq/reaxff command: doi:10.1016/j.parco.2011.08.005\n\n" "@Article{Aktulga12,\n" - " author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama},\n" - " title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques},\n" + " author = {H. M. Aktulga and J. C. Fogarty and S. A. Pandit and A. Y. Grama},\n" + " title = {Parallel Reactive Molecular Dynamics: {N}umerical Methods and Algorithmic Techniques},\n" " journal = {Parallel Computing},\n" " year = 2012,\n" " volume = 38,\n" diff --git a/src/REAXFF/pair_reaxff.cpp b/src/REAXFF/pair_reaxff.cpp index e78edea9a9..3af6ad77d0 100644 --- a/src/REAXFF/pair_reaxff.cpp +++ b/src/REAXFF/pair_reaxff.cpp @@ -46,13 +46,14 @@ using namespace LAMMPS_NS; using namespace ReaxFF; static const char cite_pair_reax_c[] = - "pair reaxff command:\n\n" + "pair reaxff command: doi:10.1016/j.parco.2011.08.005\n\n" "@Article{Aktulga12,\n" - " author = {H. M. Aktulga, J. C. Fogarty, S. A. Pandit, A. Y. Grama},\n" - " title = {Parallel reactive molecular dynamics: Numerical methods and algorithmic techniques},\n" + " author = {H. M. Aktulga and J. C. Fogarty and S. A. Pandit and A. Y. Grama},\n" + " title = {Parallel Reactive Molecular Dynamics: {N}umerical Methods and Algorithmic Techniques},\n" " journal = {Parallel Computing},\n" " year = 2012,\n" " volume = 38,\n" + " number = {4--5}\n" " pages = {245--259}\n" "}\n\n"; diff --git a/src/SPIN/fix_nve_spin.cpp b/src/SPIN/fix_nve_spin.cpp index 062f3c1b00..b075c2f88b 100644 --- a/src/SPIN/fix_nve_spin.cpp +++ b/src/SPIN/fix_nve_spin.cpp @@ -45,14 +45,14 @@ using namespace LAMMPS_NS; using namespace FixConst; static const char cite_fix_nve_spin[] = - "fix nve/spin command:\n\n" + "fix nve/spin command: doi:10.1016/j.jcp.2018.06.042\n\n" "@article{tranchida2018massively,\n" - "title={Massively parallel symplectic algorithm for coupled magnetic spin " - "dynamics and molecular dynamics},\n" - "author={Tranchida, J and Plimpton, SJ and Thibaudeau, P and Thompson, AP},\n" + "title={Massively Parallel Symplectic Algorithm for Coupled Magnetic Spin " + " Dynamics and Molecular Dynamics},\n" + "author={Tranchida, J and Plimpton, S J and Thibaudeau, P and Thompson, A P},\n" "journal={Journal of Computational Physics},\n" "volume={372},\n" - "pages={406-425},\n" + "pages={406--425},\n" "year={2018},\n" "publisher={Elsevier}\n" "doi={10.1016/j.jcp.2018.06.042}\n" diff --git a/src/SPIN/min_spin_cg.cpp b/src/SPIN/min_spin_cg.cpp index 9867f7aab5..84540a4a7f 100644 --- a/src/SPIN/min_spin_cg.cpp +++ b/src/SPIN/min_spin_cg.cpp @@ -43,7 +43,7 @@ using namespace LAMMPS_NS; using namespace MathConst; static const char cite_minstyle_spin_cg[] = - "min_style spin/cg command:\n\n" + "min_style spin/cg command: doi:10.48550/arXiv.1904.02669\n\n" "@article{ivanov2019fast,\n" "title={Fast and Robust Algorithm for the Minimisation of the Energy of " "Spin Systems},\n" diff --git a/src/SPIN/min_spin_lbfgs.cpp b/src/SPIN/min_spin_lbfgs.cpp index de3b70f01f..ad019efa56 100644 --- a/src/SPIN/min_spin_lbfgs.cpp +++ b/src/SPIN/min_spin_lbfgs.cpp @@ -46,7 +46,7 @@ static const char cite_minstyle_spin_lbfgs[] = "min_style spin/lbfgs command:\n\n" "@article{ivanov2019fast,\n" "title={Fast and Robust Algorithm for the Minimisation of the Energy of " - "Spin Systems},\n" + " Spin Systems},\n" "author={Ivanov, A. V and Uzdin, V. M. and J{\'o}nsson, H.},\n" "journal={arXiv preprint arXiv:1904.02669},\n" "year={2019}\n" diff --git a/src/SPIN/neb_spin.cpp b/src/SPIN/neb_spin.cpp index 692883fc0a..eea9baecf8 100644 --- a/src/SPIN/neb_spin.cpp +++ b/src/SPIN/neb_spin.cpp @@ -48,12 +48,12 @@ using namespace LAMMPS_NS; static const char cite_neb_spin[] = - "neb/spin command:\n\n" + "neb/spin command: doi:10.1016/j.cpc.2015.07.001\n\n" "@article{bessarab2015method,\n" "title={Method for finding mechanism and activation energy of " - "magnetic transitions, applied to skyrmion and antivortex " - "annihilation},\n" - "author={Bessarab, P.F. and Uzdin, V.M. and J{\'o}nsson, H.},\n" + " magnetic transitions, applied to skyrmion and antivortex " + " annihilation},\n" + "author={Bessarab, P. F. and Uzdin, V. M. and J{\'o}nsson, H.},\n" "journal={Computer Physics Communications},\n" "volume={196},\n" "pages={335--347},\n" diff --git a/src/SRD/fix_srd.cpp b/src/SRD/fix_srd.cpp index 76c5237f2d..cb6afaf082 100644 --- a/src/SRD/fix_srd.cpp +++ b/src/SRD/fix_srd.cpp @@ -60,17 +60,18 @@ enum { SHIFT_NO, SHIFT_YES, SHIFT_POSSIBLE }; #define TOLERANCE 0.00001 #define MAXITER 20 -static const char cite_fix_srd[] = "fix srd command:\n\n" - "@Article{Petersen10,\n" - " author = {M. K. Petersen, J. B. Lechman, S. J. Plimpton, G. " - "S. Grest, P. J. in 't Veld, P. R. Schunk},\n" - " title = {Mesoscale Hydrodynamics via Stochastic Rotation " - "Dynamics: Comparison with Lennard-Jones Fluid}," - " journal = {J.~Chem.~Phys.},\n" - " year = 2010,\n" - " volume = 132,\n" - " pages = {174106}\n" - "}\n\n"; +static const char cite_fix_srd[] = + "fix srd command: doi:10.1063/1.3419070\n\n" + "@Article{Petersen10,\n" + " author = {M. K. Petersen and J. B. Lechman and S. J. Plimpton and\n" + " G. S. Grest and in 't Veld, P. J. and P. R. Schunk},\n" + " title = {Mesoscale Hydrodynamics via Stochastic Rotation\n" + " Dynamics: Comparison with Lennard-Jones Fluid},\n" + " journal = {J.~Chem.\\ Phys.},\n" + " year = 2010,\n" + " volume = 132,\n" + " pages = 174106\n" + "}\n\n"; //#define SRD_DEBUG 1 //#define SRD_DEBUG_ATOMID 58 diff --git a/src/UEF/fix_nh_uef.cpp b/src/UEF/fix_nh_uef.cpp index 720c960252..06cb611893 100644 --- a/src/UEF/fix_nh_uef.cpp +++ b/src/UEF/fix_nh_uef.cpp @@ -44,14 +44,16 @@ enum{ISO,ANISO,TRICLINIC}; // citation info static const char cite_user_uef_package[] = - "UEF package:\n\n" + "UEF package: src:10.1063/1.4972894\n\n" "@Article{NicholsonRutledge16,\n" "author = {David A. Nicholson and Gregory C. Rutledge},\n" - "title = {Molecular simulation of flow-enhanced nucleation in n-eicosane melts under steady shear and uniaxial extension},\n" + "title = {Molecular Simulation of Flow-Enhanced Nucleation in\n", + " {$n$}-Eicosane Melts Under Steady Shear and Uniaxial Extension},\n" "journal = {The Journal of Chemical Physics},\n" "volume = {145},\n" "number = {24},\n" "pages = {244903},\n" + "doi = {10.1063/1.4972894},\n", "year = {2016}\n" "}\n\n"; diff --git a/src/compute_centroid_stress_atom.cpp b/src/compute_centroid_stress_atom.cpp index ee362927cf..1c8fee08c7 100644 --- a/src/compute_centroid_stress_atom.cpp +++ b/src/compute_centroid_stress_atom.cpp @@ -38,10 +38,10 @@ enum { NOBIAS, BIAS }; static const char cite_centroid_angle_improper_dihedral[] = "compute centroid/stress/atom for angles, impropers and dihedrals:\n\n" "@article{PhysRevE.99.051301,\n" - " title = {Application of atomic stress to compute heat flux via molecular dynamics for " - "systems with many-body interactions},\n" + " title = {Application of Atomic Stress to Compute Heat Flux via Molecular Dynamics for " + "Systems With Many-Body Interactions},\n" " author = {Surblys, Donatas and Matsubara, Hiroki and Kikugawa, Gota and Ohara, Taku},\n" - " journal = {Physical Review E},\n" + " journal = {Physical Review~E},\n" " volume = {99},\n" " issue = {5},\n" " pages = {051301},\n" diff --git a/src/neighbor.cpp b/src/neighbor.cpp index b6b095ddf4..9ff7ce0df2 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -68,24 +68,23 @@ enum{NONE,ALL,PARTIAL,TEMPLATE}; static const char cite_neigh_multi_old[] = "neighbor multi/old command: doi:10.1016/j.cpc.2008.03.005\n\n" "@Article{Intveld08,\n" - " author = {P.{\\,}J.~in{\\,}'t~Veld and S.{\\,}J.~Plimpton" - " and G.{\\,}S.~Grest},\n" + " author = {in 't Veld, P. J. and S. J. Plimpton and G. S. Grest},\n" " title = {Accurate and Efficient Methods for Modeling Colloidal\n" " Mixtures in an Explicit Solvent using Molecular Dynamics},\n" - " journal = {Comp.~Phys.~Comm.},\n" + " journal = {Comput.\\ Phys.\\ Commun.},\n" " year = 2008,\n" " volume = 179,\n" + " number = 5,\n" " pages = {320--329}\n" "}\n\n"; static const char cite_neigh_multi[] = "neighbor multi command: doi:10.1016/j.cpc.2008.03.005, doi:10.1007/s40571-020-00361-2\n\n" "@Article{Intveld08,\n" - " author = {P.{\\,}J.~in{\\,}'t~Veld and S.{\\,}J.~Plimpton" - " and G.{\\,}S.~Grest},\n" + " author = {in 't Veld, P. J. and S. J.~Plimpton and G. S. Grest},\n" " title = {Accurate and Efficient Methods for Modeling Colloidal\n" " Mixtures in an Explicit Solvent using Molecular Dynamics},\n" - " journal = {Comp.~Phys.~Comm.},\n" + " journal = {Comput.\\ Phys.\\ Commut.},\n" " year = 2008,\n" " volume = 179,\n" " pages = {320--329}\n" @@ -97,8 +96,8 @@ static const char cite_neigh_multi[] = "}\n\n" "@article{Shire2020,\n" " author = {Shire, Tom and Hanley, Kevin J. and Stratford, Kevin},\n" - " title = {DEM simulations of polydisperse media: efficient contact\n" - " detection applied to investigate the quasi-static limit},\n" + " title = {{DEM} Simulations of Polydisperse Media: Efficient Contact\n" + " Detection Applied to Investigate the Quasi-Static Limit},\n" " journal = {Computational Particle Mechanics},\n" " year = {2020}\n" "}\n\n"; From 1473f760f88d098f5437475e0ea0a4df59af1288 Mon Sep 17 00:00:00 2001 From: Karl Hammond Date: Sat, 13 Aug 2022 13:07:31 -0500 Subject: [PATCH 31/59] Fixed a few oversights and typos --- src/DIELECTRIC/atom_vec_dielectric.cpp | 4 ++-- src/EXTRA-COMPUTE/compute_stress_cartesian.cpp | 4 ++-- src/EXTRA-FIX/fix_ttm_mod.cpp | 2 +- src/EXTRA-PAIR/pair_momb.cpp | 4 ++-- src/INTERLAYER/pair_ilp_graphene_hbn.cpp | 2 +- src/OPT/pair_ilp_graphene_hbn_opt.cpp | 8 ++++---- src/REAXFF/pair_reaxff.cpp | 2 +- src/SPIN/min_spin_lbfgs.cpp | 2 +- src/SRD/fix_srd.cpp | 2 +- src/compute_centroid_stress_atom.cpp | 12 ++++++------ 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/DIELECTRIC/atom_vec_dielectric.cpp b/src/DIELECTRIC/atom_vec_dielectric.cpp index d43c9ec6eb..f1126d8d7a 100644 --- a/src/DIELECTRIC/atom_vec_dielectric.cpp +++ b/src/DIELECTRIC/atom_vec_dielectric.cpp @@ -25,8 +25,8 @@ static const char cite_user_dielectric_package[] = "@Article{TrungCPC19,\n" " author = {Trung Dac Nguyen and Honghao Li and Debarshee Bagchi and" " Francisco J. Solis and Olvera de la Cruz, Monica}\n" - " title = {Incorporating Surface Polarization Effects Into Large-Scale" - " Coarse-Grained Molecular Dynamics Simulation},\n" + " title = {Incorporating Surface Polarization Effects Into Large-Scale\n" + " Coarse-Grained Molecular Dynamics Simulation},\n" " journal = {Comput.\\ Phys.\\ Commun.},\n" " year = 2019,\n" " volume = 241,\n" diff --git a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp index 257dcb4f51..1e942627bb 100644 --- a/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp +++ b/src/EXTRA-COMPUTE/compute_stress_cartesian.cpp @@ -39,8 +39,8 @@ using namespace LAMMPS_NS; static const char cite_compute_stress_cartesian[] = "compute stress/cartesian: doi:10.3390/nano11010165\n\n" "@article{galteland2021nanothermodynamic,\n" - "title={Nanothermodynamic Description and Molecular Simulation of a Single-Phase Fluid in a " - "Slit Pore},\n" + "title={Nanothermodynamic Description and Molecular Simulation of a\n" + " Single-Phase Fluid in a Slit Pore},\n" "author={Galteland, Olav and Bedeaux, Dick and Kjelstrup, Signe},\n" "journal={Nanomaterials},\n" "volume={11},\n" diff --git a/src/EXTRA-FIX/fix_ttm_mod.cpp b/src/EXTRA-FIX/fix_ttm_mod.cpp index d09dcf28b5..8c6919d400 100644 --- a/src/EXTRA-FIX/fix_ttm_mod.cpp +++ b/src/EXTRA-FIX/fix_ttm_mod.cpp @@ -61,7 +61,7 @@ static const char cite_fix_ttm_mod[] = "@article{Norman2013,\n" "author = {Norman, G. E. and Starikov, S. V. and Stegailov, V. V. and Saitov, I. M. and Zhilyaev, P. A.},\n" "title = {Atomistic Modeling of Warm Dense Matter in the Two-Temperature State},\n" - "journal = {Contrib.~Plasm.~Phys.},\n" + "journal = {Contrib.\\ Plasma Phys.},\n" "number = {2},\n" "volume = {53},\n" "pages = {129--139},\n" diff --git a/src/EXTRA-PAIR/pair_momb.cpp b/src/EXTRA-PAIR/pair_momb.cpp index 5ace279621..fb18508c1a 100644 --- a/src/EXTRA-PAIR/pair_momb.cpp +++ b/src/EXTRA-PAIR/pair_momb.cpp @@ -35,12 +35,12 @@ static const char cite_momb[] = "Pair style momb: doi:10.1021/jp412098n\n\n" "@Article{pair_momb_2015,\n" "title = {A Force Field for Describing the Polyvinylpyrrolidone-Mediated" - " Solution-Phase Synthesis of Shape-Selective {Ag} Nanoparticles.},\n" + " Solution-Phase Synthesis of Shape-Selective {Ag} Nanoparticles},\n" "volume = {118},\n" "number = {6},\n" "url = {https://doi.org/10.1021/jp412098n},\n" "doi = {10.1021/jp412098n},\n" - "journal = {J.~Phys.\ Chem.~C},\n" + "journal = {J.~Phys.\\ Chem.~C},\n" "author = {Zhou, Ya and Wissam A. Saidi and Kristen A. Fichthorn},\n" "year = {2014},\n" "pages = {3366--3374}\n" diff --git a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp index fbcadbd94f..17f2260af4 100644 --- a/src/INTERLAYER/pair_ilp_graphene_hbn.cpp +++ b/src/INTERLAYER/pair_ilp_graphene_hbn.cpp @@ -51,7 +51,7 @@ static const char cite_ilp[] = " title = {Nanoserpents: Graphene Nanoribbon Motion on Two-Dimensional Hexagonal Materials},\n" " journal = {Nano Letters},\n" " volume = 18,\n" - " pages = 6009\n" + " pages = 6009,\n" " year = 2018,\n" "}\n\n"; diff --git a/src/OPT/pair_ilp_graphene_hbn_opt.cpp b/src/OPT/pair_ilp_graphene_hbn_opt.cpp index d0ed0f917e..953340ff5d 100644 --- a/src/OPT/pair_ilp_graphene_hbn_opt.cpp +++ b/src/OPT/pair_ilp_graphene_hbn_opt.cpp @@ -39,9 +39,9 @@ using namespace LAMMPS_NS; using namespace InterLayer; static const char cite_ilp_cur[] = - "ilp/graphene/hbn/opt potential doi:10.1145/3458817.3476137\n" + "ilp/graphene/hbn/opt potential: doi:10.1145/3458817.3476137\n" "@inproceedings{gao2021lmff\n" - " author = {Gao, Ping and Duan, Xiaohui and Others},\n" + " author = {Gao, Ping and Duan, Xiaohui and others},\n" " title = {{LMFF}: Efficient and Scalable Layered Materials Force Field on Heterogeneous " "Many-Core Processors},\n" " year = {2021},\n" @@ -52,9 +52,9 @@ static const char cite_ilp_cur[] = " doi = {10.1145/3458817.3476137},\n" " booktitle = {Proceedings of the International Conference for High Performance Computing, " "Networking, Storage and Analysis},\n" - " articleno = {42},\n" + " pages = {42},\n" " numpages = {14},\n" - " location = {St.\\ Louis, Missouri},\n" + " location = {St.~Louis, Missouri},\n" " series = {SC'21},\n" "}\n\n"; diff --git a/src/REAXFF/pair_reaxff.cpp b/src/REAXFF/pair_reaxff.cpp index 3af6ad77d0..b08a167431 100644 --- a/src/REAXFF/pair_reaxff.cpp +++ b/src/REAXFF/pair_reaxff.cpp @@ -53,7 +53,7 @@ static const char cite_pair_reax_c[] = " journal = {Parallel Computing},\n" " year = 2012,\n" " volume = 38,\n" - " number = {4--5}\n" + " number = {4--5},\n" " pages = {245--259}\n" "}\n\n"; diff --git a/src/SPIN/min_spin_lbfgs.cpp b/src/SPIN/min_spin_lbfgs.cpp index ad019efa56..9497c13fea 100644 --- a/src/SPIN/min_spin_lbfgs.cpp +++ b/src/SPIN/min_spin_lbfgs.cpp @@ -45,7 +45,7 @@ using namespace MathConst; static const char cite_minstyle_spin_lbfgs[] = "min_style spin/lbfgs command:\n\n" "@article{ivanov2019fast,\n" - "title={Fast and Robust Algorithm for the Minimisation of the Energy of " + "title={Fast and Robust Algorithm for the Minimisation of the Energy of\n" " Spin Systems},\n" "author={Ivanov, A. V and Uzdin, V. M. and J{\'o}nsson, H.},\n" "journal={arXiv preprint arXiv:1904.02669},\n" diff --git a/src/SRD/fix_srd.cpp b/src/SRD/fix_srd.cpp index cb6afaf082..0cec6fd794 100644 --- a/src/SRD/fix_srd.cpp +++ b/src/SRD/fix_srd.cpp @@ -66,7 +66,7 @@ static const char cite_fix_srd[] = " author = {M. K. Petersen and J. B. Lechman and S. J. Plimpton and\n" " G. S. Grest and in 't Veld, P. J. and P. R. Schunk},\n" " title = {Mesoscale Hydrodynamics via Stochastic Rotation\n" - " Dynamics: Comparison with Lennard-Jones Fluid},\n" + " Dynamics: Comparison with {L}ennard-{J}ones Fluid},\n" " journal = {J.~Chem.\\ Phys.},\n" " year = 2010,\n" " volume = 132,\n" diff --git a/src/compute_centroid_stress_atom.cpp b/src/compute_centroid_stress_atom.cpp index 1c8fee08c7..929b7007ff 100644 --- a/src/compute_centroid_stress_atom.cpp +++ b/src/compute_centroid_stress_atom.cpp @@ -36,10 +36,10 @@ using namespace LAMMPS_NS; enum { NOBIAS, BIAS }; static const char cite_centroid_angle_improper_dihedral[] = - "compute centroid/stress/atom for angles, impropers and dihedrals:\n\n" + "compute centroid/stress/atom for angles, impropers and dihedrals: doi:10.1103/PhysRevE.99.051301\n\n" "@article{PhysRevE.99.051301,\n" - " title = {Application of Atomic Stress to Compute Heat Flux via Molecular Dynamics for " - "Systems With Many-Body Interactions},\n" + " title = {Application of Atomic Stress to Compute Heat Flux via Molecular\n" + " Dynamics for Systems With Many-Body Interactions},\n" " author = {Surblys, Donatas and Matsubara, Hiroki and Kikugawa, Gota and Ohara, Taku},\n" " journal = {Physical Review~E},\n" " volume = {99},\n" @@ -51,12 +51,12 @@ static const char cite_centroid_angle_improper_dihedral[] = "}\n\n"; static const char cite_centroid_shake_rigid[] = - "compute centroid/stress/atom for constrained dynamics:\n\n" + "compute centroid/stress/atom for constrained dynamics: doi:10.1063/5.0070930\n\n" "@article{doi:10.1063/5.0070930,\n" " author = {Surblys, Donatas and Matsubara, Hiroki and Kikugawa, Gota and Ohara, Taku},\n" " journal = {Journal of Applied Physics},\n" - " title = {Methodology and meaning of computing heat flux via atomic stress in systems with " - "constraint dynamics},\n" + " title = {Methodology and Meaning of Computing Heat Flux via Atomic Stress in Systems with\n" + " Constraint Dynamics},\n" " volume = {130},\n" " number = {21},\n" " pages = {215104},\n" From 1d89c3f5d7bb541979caa3c8e64fcf304e5503c2 Mon Sep 17 00:00:00 2001 From: Karl Hammond Date: Sat, 13 Aug 2022 13:45:39 -0500 Subject: [PATCH 32/59] Fixed remaining BibTeX entries, checked all entries in issue #2597 --- src/EFF/atom_vec_electron.cpp | 2 +- src/EXTRA-FIX/fix_electron_stopping_fit.cpp | 20 ++++++++++---------- src/EXTRA-FIX/fix_pafi.cpp | 4 ++-- src/EXTRA-FIX/fix_ti_spring.cpp | 2 +- src/EXTRA-FIX/fix_ttm_mod.cpp | 2 +- src/EXTRA-MOLECULE/dihedral_table_cut.cpp | 2 +- src/EXTRA-PAIR/pair_momb.cpp | 4 ++-- src/MANIFOLD/fix_nve_manifold_rattle.cpp | 2 +- src/MANIFOLD/fix_nvt_manifold_rattle.cpp | 2 +- src/MANYBODY/pair_edip_multi.cpp | 6 +++--- src/MANYBODY/pair_local_density.cpp | 2 +- src/PTM/compute_ptm_atom.cpp | 8 ++++---- src/REACTION/fix_bond_react.cpp | 2 +- src/SPIN/min_spin_lbfgs.cpp | 2 +- src/SPIN/neb_spin.cpp | 6 +++--- 15 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/EFF/atom_vec_electron.cpp b/src/EFF/atom_vec_electron.cpp index 76d6a98bcd..5d600b5037 100644 --- a/src/EFF/atom_vec_electron.cpp +++ b/src/EFF/atom_vec_electron.cpp @@ -28,7 +28,7 @@ static const char cite_user_eff_package[] = " author = {A. Jaramillo-Botero and J. Su and A. Qi and Goddard, III, W. A.},\n" " title = {Large-Scale, Long-Term Nonadiabatic Electron Molecular Dynamics for Describing " "Material Properties and Phenomena in Extreme Environments},\n" - " journal = {J.~Comp.~Chem.},\n" + " journal = {J.~Comp.\\ Chem.},\n" " year = 2011,\n" " volume = 32,\n" " number = 3,\n" diff --git a/src/EXTRA-FIX/fix_electron_stopping_fit.cpp b/src/EXTRA-FIX/fix_electron_stopping_fit.cpp index f35f4ce0dd..aa3e7fc867 100644 --- a/src/EXTRA-FIX/fix_electron_stopping_fit.cpp +++ b/src/EXTRA-FIX/fix_electron_stopping_fit.cpp @@ -35,10 +35,10 @@ using namespace FixConst; // --------------------------------------------------------------------- static const char cite_fix_electron_stopping_fit_c[] = - "fix electron/stopping/fit command: doi:10.1063/1.5022471\n\n" + "fix electron/stopping/fit command: doi:10.1063/1.5022471, doi:10.1103/PhysRevB.102.024107\n\n" "@Article{Stewart2018,\n" - " author = { J. A. Stewart and G. Brookman and P. Price and M. Franco and W. Ji and K. Hattar and R. Dingreville },\n" - " title = { Characterizing Single Isolated Radiation-Damage Events from Molecular Dynamics via Virtual Diffraction Methods },\n" + " author = {J. A. Stewart and G. Brookman and P. Price and M. Franco and W. Ji and K. Hattar and R. Dingreville},\n" + " title = {Characterizing Single Isolated Radiation-Damage Events from Molecular Dynamics via Virtual Diffraction Methods},\n" " journal = {Journal of Applied Physics},\n" " year = {2018},\n" " volume = {123},\n" @@ -46,13 +46,13 @@ static const char cite_fix_electron_stopping_fit_c[] = " pages = {165902}\n" "}\n\n" "@Article{Lee2020,\n" - " author = { C.W. Lee and J.A. Stewart and S.M. Foiles and R. Dingreville and A. Schleife },\n" - " title = { Multiscale simulations of electron and ion dynamics in self-irradiated silicon },\n" - " journal = { Physical Review B },\n" - " year = { 2020 },\n" - " volume = { 102 },\n" - " number = { 2 },\n" - " pages = { 024107 }\n" + " author = {C. W. Lee and J. A. Stewart and S. M. Foiles and R. Dingreville and A. Schleife },\n" + " title = {Multiscale Simulations of Electron and Ion Dynamics in Self-Irradiated Silicon},\n" + " journal = {Physical Review~B},\n" + " year = {2020},\n" + " volume = {102},\n" + " number = {2},\n" + " pages = {024107}\n" "}\n\n"; // --------------------------------------------------------------------- diff --git a/src/EXTRA-FIX/fix_pafi.cpp b/src/EXTRA-FIX/fix_pafi.cpp index f0932c94ff..1326dcc44a 100644 --- a/src/EXTRA-FIX/fix_pafi.cpp +++ b/src/EXTRA-FIX/fix_pafi.cpp @@ -43,8 +43,8 @@ static const char cite_fix_pafi_package[] = "citation for fix pafi: doi:10.1103/PhysRevLett.120.135503\n\n" "@article{SwinburneMarinica2018,\n" "author={T. D. Swinburne and M. C. Marinica},\n" - "title={Unsupervised Calculation of Free Energy Barriers in Large " - "Crystalline Systems},\n" + "title={Unsupervised Calculation of Free Energy Barriers in Large\n" + " Crystalline Systems},\n" "journal={Physical Review Letters},\n" "volume={120},\n" "number={13},\n" diff --git a/src/EXTRA-FIX/fix_ti_spring.cpp b/src/EXTRA-FIX/fix_ti_spring.cpp index 48babd57a2..e44afdba01 100644 --- a/src/EXTRA-FIX/fix_ti_spring.cpp +++ b/src/EXTRA-FIX/fix_ti_spring.cpp @@ -35,7 +35,7 @@ using namespace LAMMPS_NS; using namespace FixConst; static const char cite_fix_ti_spring[] = - "ti/spring command:\n\n" + "ti/spring command: doi:10.1016/j.commatsci.2015.10.050\n\n" "@article{freitas2016,\n" " author={Freitas, Rodrigo and Asta, Mark and de Koning, Maurice},\n" " title={Nonequilibrium Free-Energy Calculation of Solids Using {LAMMPS}},\n" diff --git a/src/EXTRA-FIX/fix_ttm_mod.cpp b/src/EXTRA-FIX/fix_ttm_mod.cpp index 8c6919d400..539b7e1c19 100644 --- a/src/EXTRA-FIX/fix_ttm_mod.cpp +++ b/src/EXTRA-FIX/fix_ttm_mod.cpp @@ -51,7 +51,7 @@ static const char cite_fix_ttm_mod[] = "fix ttm/mod command: doi:10.1088/0953-8984/26/47/475401, doi:10.1002/ctpp.201310025\n\n" "@article{Pisarev2014,\n" "author = {Pisarev, V. V. and Starikov, S. V.},\n" - "title = {{Atomistic Simulation of Ion Track Formation in {UO$_2$}.}},\n" + "title = {Atomistic Simulation of Ion Track Formation in {UO$_2$}.},\n" "journal = {J.~Phys.\\ Condens.\\ Matter},\n" "volume = {26},\n" "number = {47},\n" diff --git a/src/EXTRA-MOLECULE/dihedral_table_cut.cpp b/src/EXTRA-MOLECULE/dihedral_table_cut.cpp index 986d9f1773..4830516b1d 100644 --- a/src/EXTRA-MOLECULE/dihedral_table_cut.cpp +++ b/src/EXTRA-MOLECULE/dihedral_table_cut.cpp @@ -36,7 +36,7 @@ using namespace LAMMPS_NS; using namespace MathConst; static const char cite_dihedral_tablecut[] = - "dihedral_style table/cut command: doi:10.1021/acs.jctc.7b01229\n\n" + "dihedral_style table/cut command: doi:10.1021/acs.jctc.7b01229\n\n" "@Article{Salerno17,\n" " author = {K. M. Salerno and N. Bernstein},\n" " title = {Persistence Length, End-to-End Distance, and Structure of Coarse-Grained Polymers},\n" diff --git a/src/EXTRA-PAIR/pair_momb.cpp b/src/EXTRA-PAIR/pair_momb.cpp index fb18508c1a..d8b6e04d11 100644 --- a/src/EXTRA-PAIR/pair_momb.cpp +++ b/src/EXTRA-PAIR/pair_momb.cpp @@ -34,8 +34,8 @@ using namespace LAMMPS_NS; static const char cite_momb[] = "Pair style momb: doi:10.1021/jp412098n\n\n" "@Article{pair_momb_2015,\n" - "title = {A Force Field for Describing the Polyvinylpyrrolidone-Mediated" - " Solution-Phase Synthesis of Shape-Selective {Ag} Nanoparticles},\n" + "title = {A Force Field for Describing the Polyvinylpyrrolidone-Mediated\n" + " Solution-Phase Synthesis of Shape-Selective {Ag} Nanoparticles},\n" "volume = {118},\n" "number = {6},\n" "url = {https://doi.org/10.1021/jp412098n},\n" diff --git a/src/MANIFOLD/fix_nve_manifold_rattle.cpp b/src/MANIFOLD/fix_nve_manifold_rattle.cpp index f9a728cb73..1ccf7c2e04 100644 --- a/src/MANIFOLD/fix_nve_manifold_rattle.cpp +++ b/src/MANIFOLD/fix_nve_manifold_rattle.cpp @@ -55,7 +55,7 @@ using namespace user_manifold; enum { CONST, EQUAL }; // For treating the variables. static const char* cite_fix_nve_manifold_rattle = - "fix nve/manifold/rattle command:\n\n" + "fix nve/manifold/rattle command: doi:10.1016/j.bpj.2016.02.017\n\n" "@article{paquay-2016,\n" " author = {Paquay, Stefan and Kusters, Remy},\n" " doi = {10.1016/j.bpj.2016.02.017},\n" diff --git a/src/MANIFOLD/fix_nvt_manifold_rattle.cpp b/src/MANIFOLD/fix_nvt_manifold_rattle.cpp index 6dbd211042..a7b2c5ed37 100644 --- a/src/MANIFOLD/fix_nvt_manifold_rattle.cpp +++ b/src/MANIFOLD/fix_nvt_manifold_rattle.cpp @@ -59,7 +59,7 @@ enum {NOBIAS,BIAS}; static const char* cite_fix_nvt_manifold_rattle = - "fix nvt/manifold/rattle command:\n\n" + "fix nvt/manifold/rattle command: doi:10.1016/j.bpj.2016.02.017\n\n" "@article{paquay-2016,\n" " author = {Paquay, Stefan and Kusters, Remy},\n" " doi = {10.1016/j.bpj.2016.02.017},\n" diff --git a/src/MANYBODY/pair_edip_multi.cpp b/src/MANYBODY/pair_edip_multi.cpp index 07b265ba48..f1b7200c25 100644 --- a/src/MANYBODY/pair_edip_multi.cpp +++ b/src/MANYBODY/pair_edip_multi.cpp @@ -46,14 +46,14 @@ static const char cite_pair_edip[] = "@article{cjiang2012\n" " author = {Jian, Chao and Morgan, Dane, and Szlufarska, Izabella},\n" " title = {Carbon Tri-Interstitial Defect: {A} Model for {D$_{\mathrm{II}}$} Center},\n" - " journal = {Phys.\ Rev.~B},\n" + " journal = {Phys.\\ Rev.~B},\n" " volume = {86},\n" " pages = {144118},\n" " year = {2012},\n" "}\n\n" "@article{lpizzagalli2010,\n" - " author = {G. Lucas, M. Bertolus, and L. Pizzagalli},\n" - " journal = {J.~Phys.\ Condens.\ Matter},\n" + " author = {G. Lucas and M. Bertolus and L. Pizzagalli},\n" + " journal = {J.~Phys.\\ Condens.\\ Matter},\n" " volume = {22},\n" " number = 3,\n" " pages = {035802},\n" diff --git a/src/MANYBODY/pair_local_density.cpp b/src/MANYBODY/pair_local_density.cpp index c9fe782eb8..789b1ddad9 100644 --- a/src/MANYBODY/pair_local_density.cpp +++ b/src/MANYBODY/pair_local_density.cpp @@ -37,7 +37,7 @@ using namespace LAMMPS_NS; #define MAXLINE 1024 static const char cite_pair_local_density[] = - "pair_style local/density command: doi:10.1063/1.4958629, doi:10.1021/acs.jpcb.7b12446\n\n" + "pair_style local/density command: doi:10.1063/1.4958629, doi:10.1021/acs.jpcb.7b12446\n\n" "@Article{Sanyal16,\n" " author = {T. Sanyal and M. Scott Shell},\n" " title = {Coarse-Grained Models Using Local-Density Potentials Optimized With the Relative Entropy: {A}pplication to Implicit Solvation},\n" diff --git a/src/PTM/compute_ptm_atom.cpp b/src/PTM/compute_ptm_atom.cpp index 5ad2c6c043..676144eb42 100644 --- a/src/PTM/compute_ptm_atom.cpp +++ b/src/PTM/compute_ptm_atom.cpp @@ -49,10 +49,10 @@ using namespace LAMMPS_NS; static const char cite_user_ptm_package[] = "PTM package: doi:10.1088/0965-0393/24/5/055007\n\n" "@Article{larsen2016ptm,\n" - " author={Larsen, Peter Mahler and Schmidt, S{\\o}ren and Schi{\\o}tz, " - "Jakob},\n" - " title={Robust Structural Identification via Polyhedral Template " - "matching},\n" + " author={Larsen, Peter Mahler and Schmidt, S{\\o}ren and\n" + " Schi{\\o}tz, Jakob},\n" + " title={Robust Structural Identification via Polyhedral Template\n" + " Matching},\n" " journal={Model.\\ Simulat.\\ Mater.\\ Sci.\\ Eng.},\n" " year={2016},\n" " number={5},\n" diff --git a/src/REACTION/fix_bond_react.cpp b/src/REACTION/fix_bond_react.cpp index 35cb239d62..14223eed5b 100644 --- a/src/REACTION/fix_bond_react.cpp +++ b/src/REACTION/fix_bond_react.cpp @@ -57,7 +57,7 @@ using namespace FixConst; using namespace MathConst; static const char cite_fix_bond_react[] = - "fix bond/react: reacter.org doi:10.1016/j.polymer.2017.09.038 doi:10.1021/acs.macromol.0c02012\n\n" + "fix bond/react: reacter.org doi:10.1016/j.polymer.2017.09.038, doi:10.1021/acs.macromol.0c02012\n\n" "@Article{Gissinger17,\n" " author = {J. R. Gissinger and B. D. Jensen and K. E. Wise},\n" " title = {Modeling Chemical Reactions in Classical Molecular Dynamics Simulations},\n" diff --git a/src/SPIN/min_spin_lbfgs.cpp b/src/SPIN/min_spin_lbfgs.cpp index 9497c13fea..9972af0a7a 100644 --- a/src/SPIN/min_spin_lbfgs.cpp +++ b/src/SPIN/min_spin_lbfgs.cpp @@ -43,7 +43,7 @@ using namespace LAMMPS_NS; using namespace MathConst; static const char cite_minstyle_spin_lbfgs[] = - "min_style spin/lbfgs command:\n\n" + "min_style spin/lbfgs command: doi:10.48550/arXiv.1904.02669\n\n" "@article{ivanov2019fast,\n" "title={Fast and Robust Algorithm for the Minimisation of the Energy of\n" " Spin Systems},\n" diff --git a/src/SPIN/neb_spin.cpp b/src/SPIN/neb_spin.cpp index eea9baecf8..381d1827b3 100644 --- a/src/SPIN/neb_spin.cpp +++ b/src/SPIN/neb_spin.cpp @@ -50,9 +50,9 @@ using namespace LAMMPS_NS; static const char cite_neb_spin[] = "neb/spin command: doi:10.1016/j.cpc.2015.07.001\n\n" "@article{bessarab2015method,\n" - "title={Method for finding mechanism and activation energy of " - " magnetic transitions, applied to skyrmion and antivortex " - " annihilation},\n" + "title={Method for Finding Mechanism and Activation Energy of\n" + " Magnetic Transitions, Applied to Skyrmion and Antivortex\n" + " Annihilation},\n" "author={Bessarab, P. F. and Uzdin, V. M. and J{\'o}nsson, H.},\n" "journal={Computer Physics Communications},\n" "volume={196},\n" From 3c744772b82a069fc6fad7e205c1a0a655b75a2c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 13 Aug 2022 15:34:48 -0400 Subject: [PATCH 33/59] add new api to access molecules. --- src/atom.cpp | 21 +++++++++++++++------ src/atom.h | 1 + 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/atom.cpp b/src/atom.cpp index 91b72841f0..3b9a47918d 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -1900,6 +1900,18 @@ int Atom::find_molecule(char *id) return -1; } +/* ---------------------------------------------------------------------- + return vector of molecules which match template ID +------------------------------------------------------------------------- */ + +std::vectorAtom::get_molecule_by_id(const std::string &id) +{ + std::vector result; + for (int imol = 0; imol < nmolecule; ++imol) + if (id == molecules[imol]->id) result.push_back(molecules[imol]); + return result; +} + /* ---------------------------------------------------------------------- add info to current atom ilocal from molecule template onemol and its iatom offset = atom ID preceding IDs of atoms in this molecule @@ -1912,8 +1924,7 @@ void Atom::add_molecule_atom(Molecule *onemol, int iatom, int ilocal, tagint off if (onemol->radiusflag && radius_flag) radius[ilocal] = onemol->radius[iatom]; if (onemol->rmassflag && rmass_flag) rmass[ilocal] = onemol->rmass[iatom]; else if (rmass_flag) - rmass[ilocal] = 4.0*MY_PI/3.0 * - radius[ilocal]*radius[ilocal]*radius[ilocal]; + rmass[ilocal] = 4.0*MY_PI/3.0 * radius[ilocal]*radius[ilocal]*radius[ilocal]; if (onemol->bodyflag) { body[ilocal] = 0; // as if a body read from data file onemol->avec_body->data_body(ilocal,onemol->nibody,onemol->ndbody, @@ -1923,10 +1934,8 @@ void Atom::add_molecule_atom(Molecule *onemol, int iatom, int ilocal, tagint off // initialize custom per-atom properties to zero if present - for (int i = 0; i < nivector; ++i) - ivector[i][ilocal] = 0; - for (int i = 0; i < ndvector; ++i) - dvector[i][ilocal] = 0.0; + for (int i = 0; i < nivector; ++i) ivector[i][ilocal] = 0; + for (int i = 0; i < ndvector; ++i) dvector[i][ilocal] = 0.0; for (int i = 0; i < niarray; ++i) for (int j = 0; j < icols[i]; ++j) iarray[i][ilocal][j] = 0; diff --git a/src/atom.h b/src/atom.h index df43898dbf..b5b52d7421 100644 --- a/src/atom.h +++ b/src/atom.h @@ -345,6 +345,7 @@ class Atom : protected Pointers { void add_molecule(int, char **); int find_molecule(char *); + std::vectorget_molecule_by_id(const std::string &); void add_molecule_atom(class Molecule *, int, int, tagint); void first_reorder(); From 1de66a82de19ff66f66d0d70be7a65038f2200b9 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 13 Aug 2022 15:42:32 -0400 Subject: [PATCH 34/59] add tests for new API --- unittest/formats/test_molecule_file.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/unittest/formats/test_molecule_file.cpp b/unittest/formats/test_molecule_file.cpp index 17bd30a349..d84aa1c960 100644 --- a/unittest/formats/test_molecule_file.cpp +++ b/unittest/formats/test_molecule_file.cpp @@ -216,6 +216,9 @@ TEST_F(MoleculeFileTest, twomols) auto output = END_CAPTURE_OUTPUT(); ASSERT_THAT(output, ContainsRegex(".*Read molecule template.*\n.*2 molecules.*\n" ".*0 fragments.*\n.*2 atoms with max type 2.*\n.*0 bonds.*")); + ASSERT_EQ(lmp->atom->nmolecule, 1); + auto mols = lmp->atom->get_molecule_by_id(test_name); + ASSERT_EQ(mols.size(), 1); } TEST_F(MoleculeFileTest, twofiles) @@ -231,6 +234,17 @@ TEST_F(MoleculeFileTest, twofiles) ".*Read molecule template twomols:.*\n.*1 molecules.*\n" ".*0 fragments.*\n.*3 atoms with max type 4.*\n.*2 bonds with max type 2.*\n" ".*1 angles with max type 2.*\n.*0 dihedrals.*")); + BEGIN_CAPTURE_OUTPUT(); + command("molecule h2o moltest.h2o.mol"); + command("molecule co2 moltest.co2.mol"); + output = END_CAPTURE_OUTPUT(); + ASSERT_EQ(lmp->atom->nmolecule, 4); + auto mols = lmp->atom->get_molecule_by_id("twomols"); + ASSERT_EQ(mols.size(), 2); + mols = lmp->atom->get_molecule_by_id("h2o"); + ASSERT_EQ(mols.size(), 1); + mols = lmp->atom->get_molecule_by_id("co2"); + ASSERT_EQ(mols.size(), 1); } TEST_F(MoleculeFileTest, bonds) From f592e3184e1e906120c5184c853731ea08b3d45c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 13 Aug 2022 16:56:53 -0400 Subject: [PATCH 35/59] simplify `Molecule::check_attributes()` --- src/GRANULAR/fix_pour.cpp | 2 +- src/MC/fix_gcmc.cpp | 2 +- src/MC/fix_widom.cpp | 2 +- src/REACTION/fix_bond_react.cpp | 4 +- src/create_atoms.cpp | 2 +- src/fix_deposit.cpp | 2 +- src/molecule.cpp | 76 +++++++++++++-------------------- src/molecule.h | 2 +- src/read_data.cpp | 5 ++- 9 files changed, 42 insertions(+), 55 deletions(-) diff --git a/src/GRANULAR/fix_pour.cpp b/src/GRANULAR/fix_pour.cpp index 7a8bf630df..00455096f8 100644 --- a/src/GRANULAR/fix_pour.cpp +++ b/src/GRANULAR/fix_pour.cpp @@ -131,7 +131,7 @@ FixPour::FixPour(LAMMPS *lmp, int narg, char **arg) : if (atom->molecular == Atom::TEMPLATE && onemols != atom->avec->onemols) error->all(FLERR, "Fix pour molecule template ID must be same as atom style template ID"); - onemols[i]->check_attributes(0); + onemols[i]->check_attributes(); // fix pour uses geoemetric center of molecule for insertion diff --git a/src/MC/fix_gcmc.cpp b/src/MC/fix_gcmc.cpp index 835d049bc6..0cc6590d5a 100644 --- a/src/MC/fix_gcmc.cpp +++ b/src/MC/fix_gcmc.cpp @@ -177,7 +177,7 @@ FixGCMC::FixGCMC(LAMMPS *lmp, int narg, char **arg) : if (atom->molecular == Atom::TEMPLATE && onemols != atom->avec->onemols) error->all(FLERR,"Fix gcmc molecule template ID must be same " "as atom_style template ID"); - onemols[imol]->check_attributes(0); + onemols[imol]->check_attributes(); } if (charge_flag && atom->q == nullptr) diff --git a/src/MC/fix_widom.cpp b/src/MC/fix_widom.cpp index 0a20e7adf3..d1bc5dfa58 100644 --- a/src/MC/fix_widom.cpp +++ b/src/MC/fix_widom.cpp @@ -153,7 +153,7 @@ FixWidom::FixWidom(LAMMPS *lmp, int narg, char **arg) : if (atom->molecular == Atom::TEMPLATE && onemols != atom->avec->onemols) error->all(FLERR,"Fix widom molecule template ID must be same " "as atom_style template ID"); - onemols[imol]->check_attributes(0); + onemols[imol]->check_attributes(); } if (charge_flag && atom->q == nullptr) diff --git a/src/REACTION/fix_bond_react.cpp b/src/REACTION/fix_bond_react.cpp index 0383449bbd..036959b14a 100644 --- a/src/REACTION/fix_bond_react.cpp +++ b/src/REACTION/fix_bond_react.cpp @@ -471,8 +471,8 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : open(files[i]); onemol = atom->molecules[unreacted_mol[i]]; twomol = atom->molecules[reacted_mol[i]]; - onemol->check_attributes(0); - twomol->check_attributes(0); + onemol->check_attributes(); + twomol->check_attributes(); get_molxspecials(); read(i); fclose(fp); diff --git a/src/create_atoms.cpp b/src/create_atoms.cpp index da352e3ae5..85e83d694f 100644 --- a/src/create_atoms.cpp +++ b/src/create_atoms.cpp @@ -299,7 +299,7 @@ void CreateAtoms::command(int narg, char **arg) if (onemol->tag_require && !atom->tag_enable) error->all(FLERR, "Create_atoms molecule has atom IDs, but system does not"); - onemol->check_attributes(0); + onemol->check_attributes(); // use geometric center of molecule for insertion // molecule random number generator, different for each proc diff --git a/src/fix_deposit.cpp b/src/fix_deposit.cpp index fd6eb3e36a..be30fbc97b 100644 --- a/src/fix_deposit.cpp +++ b/src/fix_deposit.cpp @@ -117,7 +117,7 @@ FixDeposit::FixDeposit(LAMMPS *lmp, int narg, char **arg) : if (atom->molecular == Atom::TEMPLATE && onemols != atom->avec->onemols) error->all(FLERR,"Fix deposit molecule template ID must be same " "as atom_style template ID"); - onemols[i]->check_attributes(0); + onemols[i]->check_attributes(); // fix deposit uses geoemetric center of molecule for insertion diff --git a/src/molecule.cpp b/src/molecule.cpp index 816b2686ab..702bee45af 100644 --- a/src/molecule.cpp +++ b/src/molecule.cpp @@ -1671,64 +1671,48 @@ int Molecule::findfragment(const char *name) /* ---------------------------------------------------------------------- error check molecule attributes and topology against system settings - flag = 0, just check this molecule - flag = 1, check all molecules in set, this is 1st molecule in set ------------------------------------------------------------------------- */ -void Molecule::check_attributes(int flag) +void Molecule::check_attributes() { - int n = 1; - if (flag) n = nset; - int imol = atom->find_molecule(id); + // check per-atom attributes of molecule + // warn if not a match - for (int i = imol; i < imol+n; i++) { - Molecule *onemol = atom->molecules[imol]; + int mismatch = 0; + if (qflag && !atom->q_flag) mismatch = 1; + if (radiusflag && !atom->radius_flag) mismatch = 1; + if (rmassflag && !atom->rmass_flag) mismatch = 1; - // check per-atom attributes of molecule - // warn if not a match + if (mismatch && me == 0) + error->warning(FLERR,"Molecule attributes do not match system attributes"); - int mismatch = 0; - if (onemol->qflag && !atom->q_flag) mismatch = 1; - if (onemol->radiusflag && !atom->radius_flag) mismatch = 1; - if (onemol->rmassflag && !atom->rmass_flag) mismatch = 1; + // for all atom styles, check nbondtype,etc - if (mismatch && me == 0) - error->warning(FLERR,"Molecule attributes do not match system attributes"); + mismatch = 0; + if (atom->nbondtypes < nbondtypes) mismatch = 1; + if (atom->nangletypes < nangletypes) mismatch = 1; + if (atom->ndihedraltypes < ndihedraltypes) mismatch = 1; + if (atom->nimpropertypes < nimpropertypes) mismatch = 1; - // for all atom styles, check nbondtype,etc + if (mismatch) error->all(FLERR,"Molecule topology type exceeds system topology type"); - mismatch = 0; - if (atom->nbondtypes < onemol->nbondtypes) mismatch = 1; - if (atom->nangletypes < onemol->nangletypes) mismatch = 1; - if (atom->ndihedraltypes < onemol->ndihedraltypes) mismatch = 1; - if (atom->nimpropertypes < onemol->nimpropertypes) mismatch = 1; + // for molecular atom styles, check bond_per_atom,etc + maxspecial + // do not check for atom style template, since nothing stored per atom - if (mismatch) - error->all(FLERR,"Molecule topology type exceeds system topology type"); + if (atom->molecular == Atom::MOLECULAR) { + if (atom->avec->bonds_allow && atom->bond_per_atom < bond_per_atom) mismatch = 1; + if (atom->avec->angles_allow && atom->angle_per_atom < angle_per_atom) mismatch = 1; + if (atom->avec->dihedrals_allow && atom->dihedral_per_atom < dihedral_per_atom) mismatch = 1; + if (atom->avec->impropers_allow && atom->improper_per_atom < improper_per_atom) mismatch = 1; + if (atom->maxspecial < maxspecial) mismatch = 1; - // for molecular atom styles, check bond_per_atom,etc + maxspecial - // do not check for atom style template, since nothing stored per atom - - if (atom->molecular == Atom::MOLECULAR) { - if (atom->avec->bonds_allow && - atom->bond_per_atom < onemol->bond_per_atom) mismatch = 1; - if (atom->avec->angles_allow && - atom->angle_per_atom < onemol->angle_per_atom) mismatch = 1; - if (atom->avec->dihedrals_allow && - atom->dihedral_per_atom < onemol->dihedral_per_atom) mismatch = 1; - if (atom->avec->impropers_allow && - atom->improper_per_atom < onemol->improper_per_atom) mismatch = 1; - if (atom->maxspecial < onemol->maxspecial) mismatch = 1; - - if (mismatch) - error->all(FLERR,"Molecule topology/atom exceeds system topology/atom"); - } - - // warn if molecule topology defined but no special settings - - if (onemol->bondflag && !onemol->specialflag) - if (me == 0) error->warning(FLERR,"Molecule has bond topology but no special bond settings"); + if (mismatch) error->all(FLERR,"Molecule topology/atom exceeds system topology/atom"); } + + // warn if molecule topology defined but no special settings + + if (bondflag && !specialflag) + if (me == 0) error->warning(FLERR,"Molecule has bond topology but no special bond settings"); } /* ---------------------------------------------------------------------- diff --git a/src/molecule.h b/src/molecule.h index 69106e5a34..b4a8e642cc 100644 --- a/src/molecule.h +++ b/src/molecule.h @@ -125,7 +125,7 @@ class Molecule : protected Pointers { void compute_com(); void compute_inertia(); int findfragment(const char *); - void check_attributes(int); + void check_attributes(); private: int me; diff --git a/src/read_data.cpp b/src/read_data.cpp index 1ec8210e5e..74bb7e73d3 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -866,7 +866,10 @@ void ReadData::command(int narg, char **arg) // insure nbondtypes,etc are still consistent with template molecules, // in case data file re-defined them - if (atom->molecular == Atom::TEMPLATE) atom->avec->onemols[0]->check_attributes(1); + if (atom->molecular == Atom::TEMPLATE) { + int nset = MAX(1, atom->avec->onemols[0]->nset); + for (int i = 0; i < nset; ++i) atom->avec->onemols[i]->check_attributes(); + } // if adding atoms, migrate atoms to new processors // use irregular() b/c box size could have changed dramaticaly From 2b4d6c7bc870de1ad76b4ec601b5ae06384250d6 Mon Sep 17 00:00:00 2001 From: hammondkd <86330827+hammondkd@users.noreply.github.com> Date: Sat, 13 Aug 2022 16:42:57 -0500 Subject: [PATCH 36/59] Update src/UEF/fix_nh_uef.cpp Co-authored-by: Axel Kohlmeyer --- src/UEF/fix_nh_uef.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UEF/fix_nh_uef.cpp b/src/UEF/fix_nh_uef.cpp index 06cb611893..2d4b81d6bf 100644 --- a/src/UEF/fix_nh_uef.cpp +++ b/src/UEF/fix_nh_uef.cpp @@ -44,7 +44,7 @@ enum{ISO,ANISO,TRICLINIC}; // citation info static const char cite_user_uef_package[] = - "UEF package: src:10.1063/1.4972894\n\n" + "UEF package: doi:10.1063/1.4972894\n\n" "@Article{NicholsonRutledge16,\n" "author = {David A. Nicholson and Gregory C. Rutledge},\n" "title = {Molecular Simulation of Flow-Enhanced Nucleation in\n", From ac71c605e3f138208af5ef1d12327c1bce991cd7 Mon Sep 17 00:00:00 2001 From: Karl Hammond Date: Sat, 13 Aug 2022 16:51:44 -0500 Subject: [PATCH 37/59] Fixed two typos --- src/UEF/fix_nh_uef.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/UEF/fix_nh_uef.cpp b/src/UEF/fix_nh_uef.cpp index 06cb611893..c44a049694 100644 --- a/src/UEF/fix_nh_uef.cpp +++ b/src/UEF/fix_nh_uef.cpp @@ -44,10 +44,10 @@ enum{ISO,ANISO,TRICLINIC}; // citation info static const char cite_user_uef_package[] = - "UEF package: src:10.1063/1.4972894\n\n" + "UEF package: doi:10.1063/1.4972894\n\n" "@Article{NicholsonRutledge16,\n" "author = {David A. Nicholson and Gregory C. Rutledge},\n" - "title = {Molecular Simulation of Flow-Enhanced Nucleation in\n", + "title = {Molecular Simulation of Flow-Enhanced Nucleation in\n" " {$n$}-Eicosane Melts Under Steady Shear and Uniaxial Extension},\n" "journal = {The Journal of Chemical Physics},\n" "volume = {145},\n" From a9c68db3acf5ea6f7d02a005fbf8498c383419d8 Mon Sep 17 00:00:00 2001 From: Karl Hammond Date: Sat, 13 Aug 2022 17:31:03 -0500 Subject: [PATCH 38/59] Found three remaining typos; I think we should be OK now --- src/DPD-MESO/pair_edpd.cpp | 4 ++-- src/GPU/fix_gpu.cpp | 12 +++++++----- src/INTERLAYER/pair_ilp_tmd.cpp | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/DPD-MESO/pair_edpd.cpp b/src/DPD-MESO/pair_edpd.cpp index 9050ac9dd7..13cbed2ece 100644 --- a/src/DPD-MESO/pair_edpd.cpp +++ b/src/DPD-MESO/pair_edpd.cpp @@ -43,7 +43,7 @@ using namespace LAMMPS_NS; static const char cite_pair_edpd[] = "pair edpd command: doi:10.1016/j.jcp.2014.02.003\n\n" "@Article{ZLi2014_JCP,\n" - " author = {Li, Z. and Tang, Y.-H. and Lei, H. and Caswell, B. and Karniadakis, G.E.},\n" + " author = {Li, Z. and Tang, Y.-H. and Lei, H. and Caswell, B. and Karniadakis, G. E.},\n" " title = {Energy-Conserving Dissipative Particle Dynamics with Temperature-Dependent Properties},\n" " journal = {Journal of Computational Physics},\n" " year = {2014},\n" @@ -51,7 +51,7 @@ static const char cite_pair_edpd[] = " pages = {113--127}\n" "}\n\n" "@Article{ZLi2015_CC,\n" - " author = {Li, Z. and Tang, Y.-H. and Li, X. and Karniadakis, G.E.},\n" + " author = {Li, Z. and Tang, Y.-H. and Li, X. and Karniadakis, G. E.},\n" " title = {Mesoscale Modeling of Phase Transition Dynamics of Thermoresponsive Polymers},\n" " journal = {Chemical Communications},\n" " year = {2015},\n" diff --git a/src/GPU/fix_gpu.cpp b/src/GPU/fix_gpu.cpp index 4a3b79ce51..b0732bc52c 100644 --- a/src/GPU/fix_gpu.cpp +++ b/src/GPU/fix_gpu.cpp @@ -92,18 +92,20 @@ static const char cite_gpu_package[] = "}\n\n" "@Article{Trung17,\n" " author = {T. D. Nguyen},\n" - " title = {{GPU}-Accelerated {T}ersoff Potentials for Massively Parallel Molecular Dynamics Simulations},\n" - " journal = {Comput.\ Phys.\ Commun.},\n" + " title = {{GPU}-Accelerated {T}ersoff Potentials for Massively Parallel\n" + " Molecular Dynamics Simulations},\n" + " journal = {Comput.\\ Phys.\\ Commun.},\n" " year = 2017,\n" " doi = {10.1016/j.cpc.2016.10.020},\n" " volume = 212,\n" " pages = {113--122}\n" "}\n\n" "@inproceedings{Nikolskiy19,\n" - " author = {V. Nikolskiy, V. Stegailov},\n" + " author = {V. Nikolskiy and V. Stegailov},\n" " title = {{GPU} Acceleration of Four-Site Water Models in {LAMMPS}},\n" - " booktitle = {Proceedings of the International Conference on Parallel Computing (ParCo 2019), Prague, Czech Republic},\n" - " doi = {10.3233/APC200086}\n" + " booktitle = {Proceedings of the International Conference on Parallel\n" + " Computing (ParCo 2019), Prague, Czech Republic},\n" + " doi = {10.3233/APC200086},\n" " year = 2019\n" "}\n\n"; diff --git a/src/INTERLAYER/pair_ilp_tmd.cpp b/src/INTERLAYER/pair_ilp_tmd.cpp index e15b93de0e..93ed8442a9 100644 --- a/src/INTERLAYER/pair_ilp_tmd.cpp +++ b/src/INTERLAYER/pair_ilp_tmd.cpp @@ -47,7 +47,7 @@ static const char cite_ilp_tmd[] = "@Article{Ouyang2021\n" " author = {W. Ouyang and R. Sofer and X. Gao and J. Hermann and\n" " A. Tkatchenko and L. Kronik and M. Urbakh and O. Hod},\n" - " title = {Anisotropic Interlayer Force Field for Transition " + " title = {Anisotropic Interlayer Force Field for Transition\n" " Metal Dichalcogenides: The Case of Molybdenum Disulfide},\n" " journal = {J.~Chem.\\ Theory Comput.},\n" " volume = 17,\n" From a68a63bf776c89146c23442fa1fa59409598b547 Mon Sep 17 00:00:00 2001 From: Karl Hammond Date: Sat, 13 Aug 2022 17:33:50 -0500 Subject: [PATCH 39/59] Fixed pair_edip_multi and whitespace --- src/MANYBODY/pair_edip_multi.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MANYBODY/pair_edip_multi.cpp b/src/MANYBODY/pair_edip_multi.cpp index f1b7200c25..e51e92893d 100644 --- a/src/MANYBODY/pair_edip_multi.cpp +++ b/src/MANYBODY/pair_edip_multi.cpp @@ -45,7 +45,7 @@ static const char cite_pair_edip[] = "pair edip/multi: doi:10.1103/PhysRevB.86.144118, doi:10.1088/0953-8984/22/3/035802\n\n" "@article{cjiang2012\n" " author = {Jian, Chao and Morgan, Dane, and Szlufarska, Izabella},\n" - " title = {Carbon Tri-Interstitial Defect: {A} Model for {D$_{\mathrm{II}}$} Center},\n" + " title = {Carbon Tri-Interstitial Defect: {A} Model for {D$_{\\mathrm{II}}$} Center},\n" " journal = {Phys.\\ Rev.~B},\n" " volume = {86},\n" " pages = {144118},\n" From 7e3a88806afcc39b8b10665b3909e17bb572d6d4 Mon Sep 17 00:00:00 2001 From: Karl Hammond Date: Sat, 13 Aug 2022 17:39:35 -0500 Subject: [PATCH 40/59] For some reason INTERLAYER/pair_ilp_tmd.cpp got missed with the whitespace checker --- src/INTERLAYER/pair_ilp_tmd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/INTERLAYER/pair_ilp_tmd.cpp b/src/INTERLAYER/pair_ilp_tmd.cpp index 93ed8442a9..e80f542716 100644 --- a/src/INTERLAYER/pair_ilp_tmd.cpp +++ b/src/INTERLAYER/pair_ilp_tmd.cpp @@ -42,7 +42,7 @@ using namespace InterLayer; #define DELTA 4 #define PGDELTA 1 -static const char cite_ilp_tmd[] = +static const char cite_ilp_tmd[] = "ilp/tmd potential doi:10.1021/acs.jctc.1c00782\n" "@Article{Ouyang2021\n" " author = {W. Ouyang and R. Sofer and X. Gao and J. Hermann and\n" From 35c7911808302f7bcbb06e8bcf7987c6f49614a1 Mon Sep 17 00:00:00 2001 From: Karl Hammond Date: Sat, 13 Aug 2022 17:49:39 -0500 Subject: [PATCH 41/59] One minor typo in fix_gpu.cpp; still trying to figure out what's tripping the non-compile elsewhere --- src/GPU/fix_gpu.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GPU/fix_gpu.cpp b/src/GPU/fix_gpu.cpp index b0732bc52c..1488900aec 100644 --- a/src/GPU/fix_gpu.cpp +++ b/src/GPU/fix_gpu.cpp @@ -64,7 +64,7 @@ static const char cite_gpu_package[] = " doi = {10.1016/j.cpc.2010.12.021}\n" "}\n\n" "@Article{Brown12,\n" - " author = {W. M. Brown, A. Kohlmeyer, S. J. Plimpton, A. N. Tharrington},\n" + " author = {W. M. Brown and A. Kohlmeyer and S. J. Plimpton and A. N. Tharrington},\n" " title = {Implementing Molecular Dynamics on Hybrid High Performance Computers - Particle-Particle Particle-Mesh},\n" " journal = {Comput.\\ Phys.\\ Commun.},\n" " year = 2012,\n" @@ -73,7 +73,7 @@ static const char cite_gpu_package[] = " pages = {449--459}\n" "}\n\n" "@Article{Brown13,\n" - " author = {W. M. Brown, Y. Masako},\n" + " author = {W. M. Brown and Y. Masako},\n" " title = {Implementing Molecular Dynamics on Hybrid High Performance Computers---Three-Body Potentials},\n" " journal = {Comput.\\ Phys.\\ Commun.},\n" " year = 2013,\n" @@ -82,7 +82,7 @@ static const char cite_gpu_package[] = " doi = {10.1016/j.cpc.2013.08.002},\n" "}\n\n" "@Article{Trung15,\n" - " author = {T. D. Nguyen, S. J. Plimpton},\n" + " author = {T. D. Nguyen and S. J. Plimpton},\n" " title = {Accelerating Dissipative Particle Dynamics Simulations for Soft Matter Systems},\n" " journal = {Comput.\\ Mater.\\ Sci.},\n" " year = 2015,\n" From a5afbefef2a77f3d405e405d2844ebe00df775a2 Mon Sep 17 00:00:00 2001 From: Karl Hammond Date: Sat, 13 Aug 2022 18:37:38 -0500 Subject: [PATCH 42/59] Found another missing comma (or missed fixing the old one?) in fix_nh_uef.cpp --- src/UEF/fix_nh_uef.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UEF/fix_nh_uef.cpp b/src/UEF/fix_nh_uef.cpp index c44a049694..71b076bddb 100644 --- a/src/UEF/fix_nh_uef.cpp +++ b/src/UEF/fix_nh_uef.cpp @@ -53,7 +53,7 @@ static const char cite_user_uef_package[] = "volume = {145},\n" "number = {24},\n" "pages = {244903},\n" - "doi = {10.1063/1.4972894},\n", + "doi = {10.1063/1.4972894},\n" "year = {2016}\n" "}\n\n"; From 29998775f02cead9fef18d961cb6af92e729dde0 Mon Sep 17 00:00:00 2001 From: vpalkar Date: Sun, 14 Aug 2022 22:48:42 -0400 Subject: [PATCH 43/59] Added a test for region clyinder with an open face --- unittest/commands/test_regions.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/unittest/commands/test_regions.cpp b/unittest/commands/test_regions.cpp index 3b614aa6ad..8c3982cc60 100644 --- a/unittest/commands/test_regions.cpp +++ b/unittest/commands/test_regions.cpp @@ -77,9 +77,10 @@ TEST_F(RegionTest, NoBox) command("region reg6 union 3 reg1 reg2 reg3"); command("region reg7 intersect 3 reg1 reg2 reg4"); command("region reg8 ellipsoid 0 0 0 2 1 2"); + command("region reg9 cylinder y 0 0 1 0 1 open 1 units box"); END_HIDE_OUTPUT(); list = domain->get_region_list(); - EXPECT_EQ(list.size(), 8); + EXPECT_EQ(list.size(), 9); auto reg = domain->get_region_by_id("reg1"); EXPECT_EQ(reg->interior, 1); @@ -161,11 +162,22 @@ TEST_F(RegionTest, NoBox) EXPECT_EQ(reg->rotateflag, 0); EXPECT_EQ(reg->openflag, 0); + reg = domain->get_region_by_id("reg9"); + EXPECT_EQ(reg->interior, 1); + EXPECT_EQ(reg->scaleflag, 0); + EXPECT_EQ(reg->bboxflag, 1); + EXPECT_EQ(reg->varshape, 0); + EXPECT_EQ(reg->dynamic, 0); + EXPECT_EQ(reg->moveflag, 0); + EXPECT_EQ(reg->rotateflag, 0); + EXPECT_EQ(reg->openflag, 1); + BEGIN_HIDE_OUTPUT(); command("region reg3 delete"); command("region reg5 delete"); command("region reg6 delete"); command("region reg1 delete"); + command("region reg9 delete"); END_HIDE_OUTPUT(); list = domain->get_region_list(); EXPECT_EQ(list.size(), 4); From bf8ff3a8cadd6301515db7558bfa4f1e67bc452a Mon Sep 17 00:00:00 2001 From: vpalkar Date: Sun, 14 Aug 2022 23:27:55 -0400 Subject: [PATCH 44/59] improved error messages for region cylinder --- src/region_cylinder.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/region_cylinder.cpp b/src/region_cylinder.cpp index c37bcb4be0..f0c39bfca9 100644 --- a/src/region_cylinder.cpp +++ b/src/region_cylinder.cpp @@ -37,11 +37,13 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) : // check open face settings - if (openflag && (open_faces[3] || open_faces[4] || open_faces[5])) - error->all(FLERR,"Invalid region cylinder open setting"); + if (openflag) + for (int i=3; i<6; i++) + if (open_faces[i]) + error->all(FLERR,"Illegal open face {} in region cylinder command", i); - if (strcmp(arg[2],"x") != 0 && strcmp(arg[2],"y") && strcmp(arg[2],"z") != 0) - error->all(FLERR,"Illegal region cylinder command"); + if (strcmp(arg[2],"x") != 0 && strcmp(arg[2],"y") != 0 && strcmp(arg[2],"z") != 0) + error->all(FLERR,"Illegal axis {} in region cylinder command", arg[2]); axis = arg[2][0]; if (axis == 'x') { @@ -170,7 +172,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) : // error check - if (radius <= 0.0) error->all(FLERR,"Illegal region cylinder command"); + if (radius <= 0.0) error->all(FLERR,"Illegal radius {} in region cylinder command", radius); // extent of cylinder // for variable radius, uses initial radius From d9320c61bb91e3831228258352fe4393fa4d471b Mon Sep 17 00:00:00 2001 From: vpalkar Date: Mon, 15 Aug 2022 02:13:05 -0400 Subject: [PATCH 45/59] adding test for fix wall/region --- ...x-timestep-wall_region_harmonic_const.yaml | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 unittest/force-styles/tests/fix-timestep-wall_region_harmonic_const.yaml diff --git a/unittest/force-styles/tests/fix-timestep-wall_region_harmonic_const.yaml b/unittest/force-styles/tests/fix-timestep-wall_region_harmonic_const.yaml new file mode 100644 index 0000000000..3564dabf02 --- /dev/null +++ b/unittest/force-styles/tests/fix-timestep-wall_region_harmonic_const.yaml @@ -0,0 +1,84 @@ +--- +lammps_version: 3 Aug 2022 +tags: generated +date_generated: Mon Aug 15 01:14:02 2022 +epsilon: 4e-14 +skip_tests: +prerequisites: ! | + atom full + fix wall/region +pre_commands: ! | + boundary f f f +post_commands: ! | + fix move all nve + region box block EDGE EDGE EDGE EDGE EDGE EDGE + fix test solute wall/region box harmonic 0.1 1.0 1.0 + fix_modify test virial yes +input_file: in.fourmol +natoms: 29 +run_stress: ! |2- + 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 +global_scalar: 0 +global_vector: ! |- + 3 0 0 0 +run_pos: ! |2 + 1 -2.7045559775384026e-01 2.4912159905679729e+00 -1.6695851791541885e-01 + 2 3.1004029573899528e-01 2.9612354631094391e+00 -8.5466363037021464e-01 + 3 -7.0398551400789466e-01 1.2305509955830618e+00 -6.2777526944456274e-01 + 4 -1.5818159336499285e+00 1.4837407818929933e+00 -1.2538710836062004e+00 + 5 -9.0719763672789266e-01 9.2652103885675297e-01 3.9954210488374786e-01 + 6 2.4831720524855988e-01 2.8313021497871271e-01 -1.2314233331711453e+00 + 7 3.4143527641386412e-01 -2.2646551041391422e-02 -2.5292291414903052e+00 + 8 1.1743552229100009e+00 -4.8863228565853944e-01 -6.3783432910825522e-01 + 9 1.3800524229500313e+00 -2.5274721030406683e-01 2.8353985887095157e-01 + 10 2.0510765220543883e+00 -1.4604063740302866e+00 -9.8323745081712954e-01 + 11 1.7878031944442556e+00 -1.9921863272948861e+00 -1.8890602447625777e+00 + 12 3.0063007039340053e+00 -4.9013350496963298e-01 -1.6231898107386231e+00 + 13 4.0515402959192999e+00 -8.9202011606653986e-01 -1.6400005529924957e+00 + 14 2.6066963345543819e+00 -4.1789253965514156e-01 -2.6634003608794394e+00 + 15 2.9695287185712913e+00 5.5422613165234036e-01 -1.2342022021790127e+00 + 16 2.6747029695228521e+00 -2.4124119054564295e+00 -2.3435746150616152e-02 + 17 2.2153577785283796e+00 -2.0897985186907717e+00 1.1963150794479436e+00 + 18 2.1369701704094664e+00 3.0158507413593139e+00 -3.5179348337135590e+00 + 19 1.5355837135395243e+00 2.6255292354730009e+00 -4.2353987771401354e+00 + 20 2.7727573003748263e+00 3.6923910441179069e+00 -3.9330842453167185e+00 + 21 4.9040128073837339e+00 -4.0752348170758461e+00 -3.6210314709795299e+00 + 22 4.3582355554510048e+00 -4.2126119427061379e+00 -4.4612844196307497e+00 + 23 5.7439382849366911e+00 -3.5821957939240279e+00 -3.8766361295959513e+00 + 24 2.0689243582454213e+00 3.1513346907303501e+00 3.1550389751128463e+00 + 25 1.3045351331414130e+00 3.2665125705869009e+00 2.5111855257365274e+00 + 26 2.5809237402714267e+00 4.0117602605512728e+00 3.2212060528800821e+00 + 27 -1.9611343130357228e+00 -4.3563411931359752e+00 2.1098293115523705e+00 + 28 -2.7473562684513411e+00 -4.0200819932379330e+00 1.5830052163433954e+00 + 29 -1.3126000191359855e+00 -3.5962518039482929e+00 2.2746342468737835e+00 +run_vel: ! |2 + 1 8.1705744183262832e-03 1.6516406176274298e-02 4.7902264318913212e-03 + 2 5.4501493445687828e-03 5.1791699408496412e-03 -1.4372931530376577e-03 + 3 -8.2298292722385591e-03 -1.2926551614621364e-02 -4.0984181178163734e-03 + 4 -3.7699042590093506e-03 -6.5722892098813894e-03 -1.1184640360133316e-03 + 5 -1.1021961004346575e-02 -9.8906780939336039e-03 -2.8410737829284390e-03 + 6 -3.9676663166400027e-02 4.6817061464710263e-02 3.7148491979476131e-02 + 7 9.1033953013898753e-04 -1.0128524411938794e-02 -5.1568251805019748e-02 + 8 7.9064712058855742e-03 -3.3507254552631585e-03 3.4557098492564643e-02 + 9 1.5644176117320938e-03 3.7365546102722208e-03 1.5047408822037651e-02 + 10 2.9201446820573192e-02 -2.9249578745486140e-02 -1.5018077424322544e-02 + 11 -4.7835961513517542e-03 -3.7481385134185211e-03 -2.3464104142290089e-03 + 12 2.2696451841920672e-03 -3.4774154398129641e-04 -3.0640770327796966e-03 + 13 2.7531740451953164e-03 5.8171061612840502e-03 -7.9467454022160669e-04 + 14 3.5246182371994205e-03 -5.7939995585585538e-03 -3.9478431172751361e-03 + 15 -1.8547943640122950e-03 -5.8554729942777778e-03 6.2938485140538675e-03 + 16 1.8681499973445252e-02 -1.3262466204585332e-02 -4.5638651457003250e-02 + 17 -1.2896269981100378e-02 9.7527665265956451e-03 3.7296535360836762e-02 + 18 -8.0065795274987550e-04 -8.6270473974390637e-04 -1.4483040536385791e-03 + 19 1.2452390067376827e-03 -2.5061097800836321e-03 7.2998639311871857e-03 + 20 3.5930058460518109e-03 3.6938852051849871e-03 3.2322738480194727e-03 + 21 -1.4689219756961610e-03 -2.7352107824530291e-04 7.0581625180892197e-04 + 22 -7.0694199165145105e-03 -4.2577148692717545e-03 2.8079117911323598e-04 + 23 6.0446963236685230e-03 -1.4000131545098772e-03 2.5819754799379716e-03 + 24 3.1926368451268083e-04 -9.9445664487428820e-04 1.4999960207062409e-04 + 25 1.3789752933078488e-04 -4.4335894831520756e-03 -8.1808138106080120e-04 + 26 2.0485904023409989e-03 2.7813358660936129e-03 4.3245726853349256e-03 + 27 4.5604120293369840e-04 -1.0305523026921111e-03 2.1188058381358413e-04 + 28 -6.2544520861855151e-03 1.4127711176146879e-03 -1.8429821884794260e-03 + 29 6.4110631534402174e-04 3.1273432719593824e-03 3.7253671105656736e-03 +... From c1f81eb6401f3f63bed7fad22b48bd9a2ec41a0e Mon Sep 17 00:00:00 2001 From: vpalkar Date: Mon, 15 Aug 2022 15:04:18 -0400 Subject: [PATCH 46/59] improved error messages in a bunch of region commands --- src/region_block.cpp | 5 +++-- src/region_cylinder.cpp | 4 ++-- src/region_ellipsoid.cpp | 4 +++- src/region_plane.cpp | 2 +- src/region_prism.cpp | 17 +++++++++-------- src/region_sphere.cpp | 2 +- src/region_union.cpp | 4 ++-- 7 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/region_block.cpp b/src/region_block.cpp index 36dad4ce84..76c27fbd55 100644 --- a/src/region_block.cpp +++ b/src/region_block.cpp @@ -80,8 +80,9 @@ RegBlock::RegBlock(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg) // error check - if (xlo > xhi || ylo > yhi || zlo > zhi) - error->all(FLERR,"Illegal region block command"); + if (xlo > xhi) error->all(FLERR,"Illegal region block xlo: {} >= xhi: {}", xlo, xhi); + if (ylo > yhi) error->all(FLERR,"Illegal region block ylo: {} >= yhi: {}", ylo, yhi); + if (zlo > zhi) error->all(FLERR,"Illegal region block zlo: {} >= zhi: {}", zlo, zhi); // extent of block diff --git a/src/region_cylinder.cpp b/src/region_cylinder.cpp index f0c39bfca9..7024f12f26 100644 --- a/src/region_cylinder.cpp +++ b/src/region_cylinder.cpp @@ -40,10 +40,10 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) : if (openflag) for (int i=3; i<6; i++) if (open_faces[i]) - error->all(FLERR,"Illegal open face {} in region cylinder command", i); + error->all(FLERR,"Illegal region cylinder open face: {}", i); if (strcmp(arg[2],"x") != 0 && strcmp(arg[2],"y") != 0 && strcmp(arg[2],"z") != 0) - error->all(FLERR,"Illegal axis {} in region cylinder command", arg[2]); + error->all(FLERR,"Illegal region cylinder axis: {}", arg[2]); axis = arg[2][0]; if (axis == 'x') { diff --git a/src/region_ellipsoid.cpp b/src/region_ellipsoid.cpp index 13b9736f5a..ee622aad85 100644 --- a/src/region_ellipsoid.cpp +++ b/src/region_ellipsoid.cpp @@ -101,7 +101,9 @@ RegEllipsoid::RegEllipsoid(LAMMPS *lmp, int narg, char **arg) : // error check - if (a < 0.0 || b < 0.0 || c < 0.0) error->all(FLERR, "Illegal region ellipsoid command"); + if (a < 0.0) error->all(FLERR, "Illegal region ellipsoid a: {}", a); + if (b < 0.0) error->all(FLERR, "Illegal region ellipsoid b: {}", b); + if (c < 0.0) error->all(FLERR, "Illegal region ellipsoid c: {}", c); // extent of ellipsoid // for variable axes, uses initial axes and origin for variable center diff --git a/src/region_plane.cpp b/src/region_plane.cpp index 2e99e4a0f9..a5163796d0 100644 --- a/src/region_plane.cpp +++ b/src/region_plane.cpp @@ -37,7 +37,7 @@ RegPlane::RegPlane(LAMMPS *lmp, int narg, char **arg) : // enforce unit normal double rsq = normal[0]*normal[0] + normal[1]*normal[1] + normal[2]*normal[2]; - if (rsq == 0.0) error->all(FLERR,"Illegal region plane command"); + if (rsq == 0.0) error->all(FLERR,"Illegal region plane normal vector: {} {} {}", normal[0], normal[1], normal[2]); normal[0] /= sqrt(rsq); normal[1] /= sqrt(rsq); normal[2] /= sqrt(rsq); diff --git a/src/region_prism.cpp b/src/region_prism.cpp index 375bd5ddab..f83da54e34 100644 --- a/src/region_prism.cpp +++ b/src/region_prism.cpp @@ -84,23 +84,24 @@ RegPrism::RegPrism(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg) // prism cannot be 0 thickness in any dim, else inverse blows up // non-zero tilt values cannot be used if either dim is INF on both ends - if (xlo >= xhi || ylo >= yhi || zlo >= zhi) - error->all(FLERR,"Illegal region prism command"); + if (xlo >= xhi) error->all(FLERR,"Illegal region prism xlo: {} >= xhi: {}", xlo, xhi); + if (ylo >= yhi) error->all(FLERR,"Illegal region prism ylo: {} >= yhi: {}", ylo, yhi); + if (zlo >= zhi) error->all(FLERR,"Illegal region prism zlo: {} >= zhi: {}", zlo ,zhi); if (xy != 0.0 && xlo == -BIG && xhi == BIG) - error->all(FLERR,"Illegal region prism command"); + error->all(FLERR,"Illegal region prism non-zero xy tilt with infinite x size"); if (xy != 0.0 && ylo == -BIG && yhi == BIG) - error->all(FLERR,"Illegal region prism command"); + error->all(FLERR,"Illegal region prism non-zero xy tilt with infinite y size"); if (xz != 0.0 && xlo == -BIG && xhi == BIG) - error->all(FLERR,"Illegal region prism command"); + error->all(FLERR,"Illegal region prism non-zero xz tilt with infinite x size"); if (xz != 0.0 && zlo == -BIG && zhi == BIG) - error->all(FLERR,"Illegal region prism command"); + error->all(FLERR,"Illegal region prism non-zero xz tilt with infinite z size"); if (yz != 0.0 && ylo == -BIG && yhi == BIG) - error->all(FLERR,"Illegal region prism command"); + error->all(FLERR,"Illegal region prism non-zero yz tilt with infinite y size"); if (yz != 0.0 && zlo == -BIG && zhi == BIG) - error->all(FLERR,"Illegal region prism command"); + error->all(FLERR,"Illegal region prism non-zero yz tilt with infinite z size"); // extent of prism diff --git a/src/region_sphere.cpp b/src/region_sphere.cpp index b2c844c986..bbe8400f90 100644 --- a/src/region_sphere.cpp +++ b/src/region_sphere.cpp @@ -79,7 +79,7 @@ RegSphere::RegSphere(LAMMPS *lmp, int narg, char **arg) : // error check - if (radius < 0.0) error->all(FLERR,"Illegal region sphere command"); + if (radius < 0.0) error->all(FLERR,"Illegal region sphere radius: {}", radius); // extent of sphere // for variable radius, uses initial radius and origin for variable center diff --git a/src/region_union.cpp b/src/region_union.cpp index f4b26ade4d..0cf3f10c66 100644 --- a/src/region_union.cpp +++ b/src/region_union.cpp @@ -28,9 +28,9 @@ RegUnion::RegUnion(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg), { nregion = 0; - if (narg < 5) error->all(FLERR, "Illegal region command"); + if (narg < 5) error->all(FLERR, "Illegal region union {} arguments 5 expected"); int n = utils::inumeric(FLERR, arg[2], false, lmp); - if (n < 2) error->all(FLERR, "Illegal region command"); + if (n < 2) error->all(FLERR, "Illegal region union n: {}", n); options(narg - (n + 3), &arg[n + 3]); // build list of region indices to union From 000c63a7ce50c8b326d36136091c74f01c4ee33f Mon Sep 17 00:00:00 2001 From: vpalkar Date: Mon, 15 Aug 2022 15:12:26 -0400 Subject: [PATCH 47/59] improved error messages for some more region commands --- src/region_cone.cpp | 10 ++++++---- src/region_intersect.cpp | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/region_cone.cpp b/src/region_cone.cpp index b838154034..79d22fac39 100644 --- a/src/region_cone.cpp +++ b/src/region_cone.cpp @@ -37,11 +37,13 @@ RegCone::RegCone(LAMMPS *lmp, int narg, char **arg) : // check open face settings - if (openflag && (open_faces[3] || open_faces[4] || open_faces[5])) - error->all(FLERR,"Invalid region cone open setting"); + if (openflag) + for (int i=3; i<6; i++) + if (open_faces[i]) + error->all(FLERR,"Illegal region cone open face: {}", i); - if (strcmp(arg[2],"x") != 0 && strcmp(arg[2],"y") && strcmp(arg[2],"z") != 0) - error->all(FLERR,"Illegal region cylinder command"); + if (strcmp(arg[2],"x") != 0 && strcmp(arg[2],"y") != 0 && strcmp(arg[2],"z") != 0) + error->all(FLERR,"Illegal region cone axis: {}", arg[2]); axis = arg[2][0]; if (axis == 'x') { diff --git a/src/region_intersect.cpp b/src/region_intersect.cpp index 682dd269c0..8d3227ee95 100644 --- a/src/region_intersect.cpp +++ b/src/region_intersect.cpp @@ -27,9 +27,9 @@ RegIntersect::RegIntersect(LAMMPS *lmp, int narg, char **arg) : { nregion = 0; - if (narg < 5) error->all(FLERR, "Illegal region command"); + if (narg < 5) error->all(FLERR, "Illegal region intersect {} arguments 5 expected"); int n = utils::inumeric(FLERR, arg[2], false, lmp); - if (n < 2) error->all(FLERR, "Illegal region command"); + if (n < 2) error->all(FLERR, "Illegal region intersect n: {}", n); options(narg - (n + 3), &arg[n + 3]); // build list of regions to intersect From bec86f3f044a240f53d3e809ea9c5f130db51227 Mon Sep 17 00:00:00 2001 From: vpalkar Date: Mon, 15 Aug 2022 16:16:48 -0400 Subject: [PATCH 48/59] added some death tests and more readable code for some error messages --- src/region_cone.cpp | 3 +-- src/region_cylinder.cpp | 3 +-- unittest/commands/test_regions.cpp | 19 ++++++++++++++++++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/region_cone.cpp b/src/region_cone.cpp index 79d22fac39..fa38db7776 100644 --- a/src/region_cone.cpp +++ b/src/region_cone.cpp @@ -39,8 +39,7 @@ RegCone::RegCone(LAMMPS *lmp, int narg, char **arg) : if (openflag) for (int i=3; i<6; i++) - if (open_faces[i]) - error->all(FLERR,"Illegal region cone open face: {}", i); + if (open_faces[i]) error->all(FLERR,"Illegal region cone open face: {}", i+1); if (strcmp(arg[2],"x") != 0 && strcmp(arg[2],"y") != 0 && strcmp(arg[2],"z") != 0) error->all(FLERR,"Illegal region cone axis: {}", arg[2]); diff --git a/src/region_cylinder.cpp b/src/region_cylinder.cpp index 7024f12f26..739c101428 100644 --- a/src/region_cylinder.cpp +++ b/src/region_cylinder.cpp @@ -39,8 +39,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) : if (openflag) for (int i=3; i<6; i++) - if (open_faces[i]) - error->all(FLERR,"Illegal region cylinder open face: {}", i); + if (open_faces[i]) error->all(FLERR,"Illegal region cylinder open face: {}", i+1); if (strcmp(arg[2],"x") != 0 && strcmp(arg[2],"y") != 0 && strcmp(arg[2],"z") != 0) error->all(FLERR,"Illegal region cylinder axis: {}", arg[2]); diff --git a/unittest/commands/test_regions.cpp b/unittest/commands/test_regions.cpp index 8c3982cc60..a021c6a338 100644 --- a/unittest/commands/test_regions.cpp +++ b/unittest/commands/test_regions.cpp @@ -184,10 +184,27 @@ TEST_F(RegionTest, NoBox) reg = domain->get_region_by_id("reg7"); TEST_FAILURE(".*ERROR: Region intersect region reg1 does not exist.*", reg->init();); + TEST_FAILURE(".*ERROR: Delete region reg3 does not exist.*", command("region reg3 delete");); +} + +TEST_F(RegionTest, DeathTests) +{ + atomic_system(); + + auto list = domain->get_region_list(); + ASSERT_EQ(list.size(), 1); + + TEST_FAILURE(".*ERROR: Illegal region block xlo: 1 >= xhi: 0.*", command("region reg1 block 1 0 0 1 0 1");); + TEST_FAILURE(".*ERROR: Illegal region cone open face: 4.*", command("region reg2 cone x 0 0 2 1 0 1 open 4");); + TEST_FAILURE(".*ERROR: Illegal region plane normal vector: 0 0 0.*", command("region reg3 plane 0 0 0 0 0 0 side out");); + TEST_FAILURE(".*ERROR: Illegal region prism non-zero xy tilt with infinite x size.*", command("region reg4 prism INF INF 0 1 0 1 0.1 0.2 0.3");); + TEST_FAILURE(".*ERROR: Illegal region sphere radius: -1.*", command("region reg5 sphere 0 0 0 -1");); + TEST_FAILURE(".*ERROR: Illegal region ellipsoid c: -2.*", command("region reg8 ellipsoid 0 0 0 2 1 -2");); + TEST_FAILURE(".*ERROR: Illegal region cylinder axis: xx.*", command("region reg9 cylinder xx 0 0 1 0 1 open 1 units box");); TEST_FAILURE(".*ERROR: Unrecognized region style 'xxx'.*", command("region new1 xxx");); TEST_FAILURE(".*ERROR: Illegal region command.*", command("region new1 block 0 1");); - TEST_FAILURE(".*ERROR: Delete region reg3 does not exist.*", command("region reg3 delete");); + TEST_FAILURE(".*ERROR: Delete region new3 does not exist.*", command("region new3 delete");); } TEST_F(RegionTest, Counts) From 3f9daa8608b1301c4402a37c5f1da344bd69fce3 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 15 Aug 2022 21:48:01 -0400 Subject: [PATCH 49/59] whitespace fixes --- src/region_cone.cpp | 2 +- src/region_cylinder.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/region_cone.cpp b/src/region_cone.cpp index fa38db7776..84da1bae56 100644 --- a/src/region_cone.cpp +++ b/src/region_cone.cpp @@ -38,7 +38,7 @@ RegCone::RegCone(LAMMPS *lmp, int narg, char **arg) : // check open face settings if (openflag) - for (int i=3; i<6; i++) + for (int i=3; i<6; i++) if (open_faces[i]) error->all(FLERR,"Illegal region cone open face: {}", i+1); if (strcmp(arg[2],"x") != 0 && strcmp(arg[2],"y") != 0 && strcmp(arg[2],"z") != 0) diff --git a/src/region_cylinder.cpp b/src/region_cylinder.cpp index 739c101428..0f7df1e3af 100644 --- a/src/region_cylinder.cpp +++ b/src/region_cylinder.cpp @@ -38,7 +38,7 @@ RegCylinder::RegCylinder(LAMMPS *lmp, int narg, char **arg) : // check open face settings if (openflag) - for (int i=3; i<6; i++) + for (int i=3; i<6; i++) if (open_faces[i]) error->all(FLERR,"Illegal region cylinder open face: {}", i+1); if (strcmp(arg[2],"x") != 0 && strcmp(arg[2],"y") != 0 && strcmp(arg[2],"z") != 0) From 0b047ba22b73831f1b8e1d6ae4cbf602090a3877 Mon Sep 17 00:00:00 2001 From: Jiancheng Chen <2742581175@qq.com> Date: Tue, 16 Aug 2022 20:33:22 +0800 Subject: [PATCH 50/59] improved error messages in fix_addforce,fix_indent,fix_setforce,fix_temp_rescale,fix_wall_reflect and thermo.cpp --- src/fix_addforce.cpp | 14 +++++++------- src/fix_indent.cpp | 22 +++++++++++----------- src/fix_setforce.cpp | 6 +++--- src/fix_temp_rescale.cpp | 12 ++++++------ src/fix_wall_reflect.cpp | 22 +++++++++++----------- src/thermo.cpp | 38 +++++++++++++++++++------------------- 6 files changed, 57 insertions(+), 57 deletions(-) diff --git a/src/fix_addforce.cpp b/src/fix_addforce.cpp index 48b006eb2d..b4d13ff5fa 100644 --- a/src/fix_addforce.cpp +++ b/src/fix_addforce.cpp @@ -38,7 +38,7 @@ FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), xstr(nullptr), ystr(nullptr), zstr(nullptr), estr(nullptr), idregion(nullptr), region(nullptr), sforce(nullptr) { - if (narg < 6) error->all(FLERR, "Illegal fix addforce command"); + if (narg < 6) utils::missing_cmd_args(FLERR, "fix addforce", error); dynamic_group_allow = 1; scalar_flag = 1; @@ -77,25 +77,25 @@ FixAddForce::FixAddForce(LAMMPS *lmp, int narg, char **arg) : int iarg = 6; while (iarg < narg) { if (strcmp(arg[iarg], "every") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix addforce command"); + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "fix addforce every", error); nevery = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); - if (nevery <= 0) error->all(FLERR, "Illegal fix addforce command"); + if (nevery <= 0) error->all(FLERR, "Invalid fix addforce every argument: {}", nevery); iarg += 2; } else if (strcmp(arg[iarg], "region") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix addforce command"); + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "fix addforce region", error); region = domain->get_region_by_id(arg[iarg + 1]); if (!region) error->all(FLERR, "Region {} for fix addforce does not exist", arg[iarg + 1]); idregion = utils::strdup(arg[iarg + 1]); iarg += 2; } else if (strcmp(arg[iarg], "energy") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix addforce command"); + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "fix addforce energy", error); if (utils::strmatch(arg[iarg + 1], "^v_")) { estr = utils::strdup(arg[iarg + 1] + 2); } else - error->all(FLERR, "Illegal fix addforce command"); + error->all(FLERR, "Invalid fix addforce energy argument: {}", arg[iarg + 1]); iarg += 2; } else - error->all(FLERR, "Illegal fix addforce command"); + error->all(FLERR, "Unknown fix addforce keyword: {}", arg[iarg]); } force_flag = 0; diff --git a/src/fix_indent.cpp b/src/fix_indent.cpp index 766ec88d8e..f38ab5efa6 100644 --- a/src/fix_indent.cpp +++ b/src/fix_indent.cpp @@ -83,7 +83,7 @@ FixIndent::FixIndent(LAMMPS *lmp, int narg, char **arg) : if (cdim == 0 && !pstr) pvalue *= xscale; else if (cdim == 1 && !pstr) pvalue *= yscale; else if (cdim == 2 && !pstr) pvalue *= zscale; - } else error->all(FLERR,"Illegal fix indent command"); + } else error->all(FLERR,"Unknown fix indent keyword: {}", istyle); varflag = 0; if (xstr || ystr || zstr || rstr || pstr) varflag = 1; @@ -121,37 +121,37 @@ void FixIndent::init() if (xstr) { xvar = input->variable->find(xstr); if (xvar < 0) - error->all(FLERR,"Variable name for fix indent does not exist"); + error->all(FLERR,"Variable {} for fix indent does not exist", xstr); if (!input->variable->equalstyle(xvar)) - error->all(FLERR,"Variable for fix indent is invalid style"); + error->all(FLERR,"Variable {} for fix indent is invalid style", xstr); } if (ystr) { yvar = input->variable->find(ystr); if (yvar < 0) - error->all(FLERR,"Variable name for fix indent does not exist"); + error->all(FLERR,"Variable {} for fix indent does not exist", ystr); if (!input->variable->equalstyle(yvar)) - error->all(FLERR,"Variable for fix indent is not equal style"); + error->all(FLERR,"Variable {} for fix indent is invalid style", ystr); } if (zstr) { zvar = input->variable->find(zstr); if (zvar < 0) - error->all(FLERR,"Variable name for fix indent does not exist"); + error->all(FLERR,"Variable {} for fix indent does not exist", zstr); if (!input->variable->equalstyle(zvar)) - error->all(FLERR,"Variable for fix indent is not equal style"); + error->all(FLERR,"Variable {} for fix indent is invalid style", zstr); } if (rstr) { rvar = input->variable->find(rstr); if (rvar < 0) - error->all(FLERR,"Variable name for fix indent does not exist"); + error->all(FLERR,"Variable {} for fix indent does not exist", rstr); if (!input->variable->equalstyle(rvar)) - error->all(FLERR,"Variable for fix indent is not equal style"); + error->all(FLERR,"Variable {} for fix indent is invalid style", rstr); } if (pstr) { pvar = input->variable->find(pstr); if (pvar < 0) - error->all(FLERR,"Variable name for fix indent does not exist"); + error->all(FLERR,"Variable {} for fix indent does not exist", pstr); if (!input->variable->equalstyle(pvar)) - error->all(FLERR,"Variable for fix indent is not equal style"); + error->all(FLERR,"Variable {} for fix indent is invalid style", pstr); } if (utils::strmatch(update->integrate_style,"^respa")) { diff --git a/src/fix_setforce.cpp b/src/fix_setforce.cpp index 6a88e3ab17..8bd5477f76 100644 --- a/src/fix_setforce.cpp +++ b/src/fix_setforce.cpp @@ -37,7 +37,7 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), xstr(nullptr), ystr(nullptr), zstr(nullptr), idregion(nullptr), region(nullptr), sforce(nullptr) { - if (narg < 6) error->all(FLERR, "Illegal fix setforce command"); + if (narg < 6) utils::missing_cmd_args(FLERR, "fix setforce", error); dynamic_group_allow = 1; vector_flag = 1; @@ -77,13 +77,13 @@ FixSetForce::FixSetForce(LAMMPS *lmp, int narg, char **arg) : int iarg = 6; while (iarg < narg) { if (strcmp(arg[iarg], "region") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal fix setforce command"); + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "fix setforce region", error); region = domain->get_region_by_id(arg[iarg + 1]); if (!region) error->all(FLERR, "Region {} for fix setforce does not exist", arg[iarg + 1]); idregion = utils::strdup(arg[iarg + 1]); iarg += 2; } else - error->all(FLERR, "Illegal fix setforce command"); + error->all(FLERR, "Unknown fix setforce keyword: {}", arg[iarg]); } force_flag = 0; diff --git a/src/fix_temp_rescale.cpp b/src/fix_temp_rescale.cpp index 41fb49e3f4..f4f462c968 100644 --- a/src/fix_temp_rescale.cpp +++ b/src/fix_temp_rescale.cpp @@ -40,10 +40,10 @@ FixTempRescale::FixTempRescale(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), tstr(nullptr), id_temp(nullptr), tflag(0) { - if (narg < 8) error->all(FLERR,"Illegal fix temp/rescale command"); + if (narg < 8) utils::missing_cmd_args(FLERR, "fix temp/rescale", error); nevery = utils::inumeric(FLERR,arg[3],false,lmp); - if (nevery <= 0) error->all(FLERR,"Illegal fix temp/rescale command"); + if (nevery <= 0) error->all(FLERR, "Invalid fix temp/rescale argument: {}", nevery); restart_global = 1; scalar_flag = 1; @@ -106,9 +106,9 @@ void FixTempRescale::init() if (tstr) { tvar = input->variable->find(tstr); if (tvar < 0) - error->all(FLERR,"Variable name for fix temp/rescale does not exist"); + error->all(FLERR,"Variable {} for fix temp/rescale does not exist", tstr); if (input->variable->equalstyle(tvar)) tstyle = EQUAL; - else error->all(FLERR,"Variable for fix temp/rescale is invalid style"); + else error->all(FLERR,"Variable {} for fix temp/rescale is invalid style", tstr); } int icompute = modify->find_compute(id_temp); @@ -195,7 +195,7 @@ void FixTempRescale::end_of_step() int FixTempRescale::modify_param(int narg, char **arg) { if (strcmp(arg[0],"temp") == 0) { - if (narg < 2) error->all(FLERR,"Illegal fix_modify command"); + if (narg < 2) utils::missing_cmd_args(FLERR, "fix_modify temp", error); if (tflag) { modify->delete_compute(id_temp); tflag = 0; @@ -205,7 +205,7 @@ int FixTempRescale::modify_param(int narg, char **arg) int icompute = modify->find_compute(id_temp); if (icompute < 0) - error->all(FLERR,"Could not find fix_modify temperature ID"); + error->all(FLERR,"Could not find fix_modify temperature ID {}", arg[1]); temperature = modify->compute[icompute]; if (temperature->tempflag == 0) diff --git a/src/fix_wall_reflect.cpp b/src/fix_wall_reflect.cpp index ac5940c513..6b5b74c4e0 100644 --- a/src/fix_wall_reflect.cpp +++ b/src/fix_wall_reflect.cpp @@ -35,7 +35,7 @@ FixWallReflect::FixWallReflect(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), nwall(0) { - if (narg < 4) error->all(FLERR,"Illegal fix wall/reflect command"); + if (narg < 4) utils::missing_cmd_args(FLERR, "fix wall/reflect", error); // let child class process all args @@ -53,7 +53,7 @@ FixWallReflect::FixWallReflect(LAMMPS *lmp, int narg, char **arg) : if ((strcmp(arg[iarg],"xlo") == 0) || (strcmp(arg[iarg],"xhi") == 0) || (strcmp(arg[iarg],"ylo") == 0) || (strcmp(arg[iarg],"yhi") == 0) || (strcmp(arg[iarg],"zlo") == 0) || (strcmp(arg[iarg],"zhi") == 0)) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix wall/reflect command"); + if (iarg+2 > narg) error->all(FLERR, "Illegal fix wall/reflect {} command: missing argument(s)", arg[iarg]); int newwall; if (strcmp(arg[iarg],"xlo") == 0) newwall = XLO; @@ -86,26 +86,26 @@ FixWallReflect::FixWallReflect(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg],"units") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal wall/reflect command"); + if (iarg+2 > narg) utils::missing_cmd_args(FLERR, "fix wall/reflect units", error); if (strcmp(arg[iarg+1],"box") == 0) scaleflag = 0; else if (strcmp(arg[iarg+1],"lattice") == 0) scaleflag = 1; - else error->all(FLERR,"Illegal fix wall/reflect command"); + else error->all(FLERR,"Unknown fix wall/reflect units argument: {}", arg[iarg+1]); iarg += 2; - } else error->all(FLERR,"Illegal fix wall/reflect command"); + } else error->all(FLERR,"Unknown fix wall/reflect keyword: {}", arg[iarg]); } // error check - if (nwall == 0) error->all(FLERR,"Illegal fix wall command"); + if (nwall == 0) utils::missing_cmd_args(FLERR, "fix wall/reflect", error); for (int m = 0; m < nwall; m++) { if ((wallwhich[m] == XLO || wallwhich[m] == XHI) && domain->xperiodic) - error->all(FLERR,"Cannot use fix wall/reflect in periodic dimension"); + error->all(FLERR,"Cannot use fix wall/reflect in xperiodic dimension"); if ((wallwhich[m] == YLO || wallwhich[m] == YHI) && domain->yperiodic) - error->all(FLERR,"Cannot use fix wall/reflect in periodic dimension"); + error->all(FLERR,"Cannot use fix wall/reflect in yperiodic dimension"); if ((wallwhich[m] == ZLO || wallwhich[m] == ZHI) && domain->zperiodic) - error->all(FLERR,"Cannot use fix wall/reflect in periodic dimension"); + error->all(FLERR,"Cannot use fix wall/reflect in zperiodic dimension"); } for (int m = 0; m < nwall; m++) @@ -170,9 +170,9 @@ void FixWallReflect::init() if (wallstyle[m] != VARIABLE) continue; varindex[m] = input->variable->find(varstr[m]); if (varindex[m] < 0) - error->all(FLERR,"Variable name for fix wall/reflect does not exist"); + error->all(FLERR,"Variable {} for fix wall/reflect does not exist", varstr[m]); if (!input->variable->equalstyle(varindex[m])) - error->all(FLERR,"Variable for fix wall/reflect is invalid style"); + error->all(FLERR,"Variable {} for fix wall/reflect is invalid style", varstr[m]); } int nrigid = 0; diff --git a/src/thermo.cpp b/src/thermo.cpp index c3cd5adcf5..c4a914e3a3 100644 --- a/src/thermo.cpp +++ b/src/thermo.cpp @@ -498,14 +498,14 @@ bigint Thermo::lost_check() void Thermo::modify_params(int narg, char **arg) { - if (narg == 0) error->all(FLERR, "Illegal thermo_modify command"); + if (narg == 0) utils::missing_cmd_args(FLERR, "thermo_modify", error); modified = 1; int iarg = 0; while (iarg < narg) { if (strcmp(arg[iarg], "temp") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal thermo_modify command"); + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "thermo_modify temp", error); if (index_temp < 0) error->all(FLERR, "Thermo style does not use temp"); delete[] id_compute[index_temp]; id_compute[index_temp] = utils::strdup(arg[iarg + 1]); @@ -540,7 +540,7 @@ void Thermo::modify_params(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg], "press") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal thermo_modify command"); + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "thermo_modify press", error); if (index_press_scalar < 0 && index_press_vector < 0) error->all(FLERR, "Thermo style does not use press"); @@ -563,7 +563,7 @@ void Thermo::modify_params(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg], "lost") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal thermo_modify command"); + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "thermo_modify lost", error); if (strcmp(arg[iarg + 1], "ignore") == 0) lostflag = Thermo::IGNORE; else if (strcmp(arg[iarg + 1], "warn") == 0) @@ -571,11 +571,11 @@ void Thermo::modify_params(int narg, char **arg) else if (strcmp(arg[iarg + 1], "error") == 0) lostflag = Thermo::ERROR; else - error->all(FLERR, "Illegal thermo_modify command"); + error->all(FLERR, "Unknown thermo_modify lost argument: {}", arg[iarg + 1]); iarg += 2; } else if (strcmp(arg[iarg], "lost/bond") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal thermo_modify command"); + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "thermo_modify lost/bond", error); if (strcmp(arg[iarg + 1], "ignore") == 0) lostbond = Thermo::IGNORE; else if (strcmp(arg[iarg + 1], "warn") == 0) @@ -583,11 +583,11 @@ void Thermo::modify_params(int narg, char **arg) else if (strcmp(arg[iarg + 1], "error") == 0) lostbond = Thermo::ERROR; else - error->all(FLERR, "Illegal thermo_modify command"); + error->all(FLERR, "Unknown thermo_modify lost/bond argument: {}", arg[iarg + 1]); iarg += 2; } else if (strcmp(arg[iarg], "warn") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal thermo_modify command"); + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "thermo_modify warn", error); if (strcmp(arg[iarg + 1], "ignore") == 0) error->set_maxwarn(-1); else if (strcmp(arg[iarg + 1], "always") == 0) @@ -604,18 +604,18 @@ void Thermo::modify_params(int narg, char **arg) iarg += 2; } else if (strcmp(arg[iarg], "norm") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal thermo_modify command"); + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "thermo_modify norm", error); normuserflag = 1; normuser = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; } else if (strcmp(arg[iarg], "flush") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal thermo_modify command"); + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "thermo_modify flush", error); flushflag = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; } else if (strcmp(arg[iarg], "line") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal thermo_modify command"); + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "thermo_modify line", error); if (strcmp(arg[iarg + 1], "one") == 0) lineflag = ONELINE; else if (strcmp(arg[iarg + 1], "multi") == 0) @@ -623,16 +623,16 @@ void Thermo::modify_params(int narg, char **arg) else if (strcmp(arg[iarg + 1], "yaml") == 0) lineflag = YAMLLINE; else - error->all(FLERR, "Illegal thermo_modify command"); + error->all(FLERR, "Unknown thermo_modify line argument: {}", arg[iarg + 1]); iarg += 2; } else if (strcmp(arg[iarg], "colname") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal thermo_modify command"); + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "thermo_modify colname", error); if (strcmp(arg[iarg + 1], "default") == 0) { for (auto item : keyword_user) item.clear(); iarg += 2; } else { - if (iarg + 3 > narg) error->all(FLERR, "Illegal thermo_modify command"); + if (iarg + 3 > narg) utils::missing_cmd_args(FLERR, "thermo_modify colname", error); int icol = -1; if (utils::is_integer(arg[iarg + 1])) { icol = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); @@ -646,12 +646,12 @@ void Thermo::modify_params(int narg, char **arg) } } if ((icol < 0) || (icol >= nfield_initial)) - error->all(FLERR, "Illegal thermo_modify command"); + error->all(FLERR, "Invalid thermo_modify colname argument: {}", arg[iarg + 1]); keyword_user[icol] = arg[iarg + 2]; iarg += 3; } } else if (strcmp(arg[iarg], "format") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal thermo_modify command"); + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "thermo_modify format", error); if (strcmp(arg[iarg + 1], "none") == 0) { format_line_user.clear(); @@ -663,7 +663,7 @@ void Thermo::modify_params(int narg, char **arg) continue; } - if (iarg + 3 > narg) error->all(FLERR, "Illegal thermo_modify command"); + if (iarg + 3 > narg) utils::missing_cmd_args(FLERR, "thermo_modify format", error); if (strcmp(arg[iarg + 1], "line") == 0) { format_line_user = arg[iarg + 2]; @@ -692,13 +692,13 @@ void Thermo::modify_params(int narg, char **arg) } } if (icol < 0 || icol >= nfield_initial + 1) - error->all(FLERR, "Illegal thermo_modify command"); + error->all(FLERR, "Invalid thermo_modify format argument: {}", arg[iarg + 1]); format_column_user[icol] = arg[iarg + 2]; } iarg += 3; } else - error->all(FLERR, "Illegal thermo_modify command"); + error->all(FLERR, "Unknown thermo_modify keyword: {}", arg[iarg]); } } From 559ced986944bc92f57d8dd405b804c65792751d Mon Sep 17 00:00:00 2001 From: vpalkar Date: Tue, 16 Aug 2022 16:52:19 -0400 Subject: [PATCH 51/59] updated error messages and test for region.cpp --- src/region.cpp | 27 +++++++++++++-------------- unittest/commands/test_regions.cpp | 3 ++- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/region.cpp b/src/region.cpp index b533d45ea7..b61a5f8905 100644 --- a/src/region.cpp +++ b/src/region.cpp @@ -302,7 +302,7 @@ void Region::rotate(double &x, double &y, double &z, double angle) void Region::options(int narg, char **arg) { - if (narg < 0) error->all(FLERR, "Illegal region command"); + if (narg < 0) utils::missing_cmd_args(FLERR, "region", error); // option defaults @@ -316,46 +316,46 @@ void Region::options(int narg, char **arg) int iarg = 0; while (iarg < narg) { if (strcmp(arg[iarg], "units") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal region command"); + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "region units", error); if (strcmp(arg[iarg + 1], "box") == 0) scaleflag = 0; else if (strcmp(arg[iarg + 1], "lattice") == 0) scaleflag = 1; else - error->all(FLERR, "Illegal region command"); + error->all(FLERR, "Illegal region units: {}", arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg], "side") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal region command"); + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "region side", error); if (strcmp(arg[iarg + 1], "in") == 0) interior = 1; else if (strcmp(arg[iarg + 1], "out") == 0) interior = 0; else - error->all(FLERR, "Illegal region command"); + error->all(FLERR, "Illegal region side: {}", arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg], "move") == 0) { - if (iarg + 4 > narg) error->all(FLERR, "Illegal region command"); + if (iarg + 4 > narg) utils::missing_cmd_args(FLERR, "region move", error); if (strcmp(arg[iarg + 1], "NULL") != 0) { if (strstr(arg[iarg + 1], "v_") != arg[iarg + 1]) - error->all(FLERR, "Illegal region command"); + error->all(FLERR, "Illegal region move x displacement variable: {}", arg[iarg+1]); xstr = utils::strdup(&arg[iarg + 1][2]); } if (strcmp(arg[iarg + 2], "NULL") != 0) { if (strstr(arg[iarg + 2], "v_") != arg[iarg + 2]) - error->all(FLERR, "Illegal region command"); + error->all(FLERR, "Illegal region move y displacement variable: {}", arg[iarg+2]); ystr = utils::strdup(&arg[iarg + 2][2]); } if (strcmp(arg[iarg + 3], "NULL") != 0) { if (strstr(arg[iarg + 3], "v_") != arg[iarg + 3]) - error->all(FLERR, "Illegal region command"); + error->all(FLERR, "Illegal region move z displacement variable: {}", arg[iarg+3]); zstr = utils::strdup(&arg[iarg + 3][2]); } moveflag = 1; iarg += 4; } else if (strcmp(arg[iarg], "rotate") == 0) { - if (iarg + 8 > narg) error->all(FLERR, "Illegal region command"); + if (iarg + 8 > narg) utils::missing_cmd_args(FLERR, "region rotate", error); if (strstr(arg[iarg + 1], "v_") != arg[iarg + 1]) error->all(FLERR, "Illegal region command"); tstr = utils::strdup(&arg[iarg + 1][2]); point[0] = utils::numeric(FLERR, arg[iarg + 2], false, lmp); @@ -368,15 +368,14 @@ void Region::options(int narg, char **arg) iarg += 8; } else if (strcmp(arg[iarg], "open") == 0) { - if (iarg + 2 > narg) error->all(FLERR, "Illegal region command"); + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "region open", error); int iface = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); - if (iface < 1 || iface > 6) error->all(FLERR, "Illegal region command"); + if (iface < 1 || iface > 6) error->all(FLERR, "Illegal region open face index: {}", iface); // additional checks on valid face index are done by region classes open_faces[iface - 1] = 1; openflag = 1; iarg += 2; - } else - error->all(FLERR, "Illegal region command"); + } else error->all(FLERR, "Illegal region command argument: {}", arg[iarg]); } // error check diff --git a/unittest/commands/test_regions.cpp b/unittest/commands/test_regions.cpp index a021c6a338..36d251e542 100644 --- a/unittest/commands/test_regions.cpp +++ b/unittest/commands/test_regions.cpp @@ -203,7 +203,8 @@ TEST_F(RegionTest, DeathTests) TEST_FAILURE(".*ERROR: Illegal region cylinder axis: xx.*", command("region reg9 cylinder xx 0 0 1 0 1 open 1 units box");); TEST_FAILURE(".*ERROR: Unrecognized region style 'xxx'.*", command("region new1 xxx");); - TEST_FAILURE(".*ERROR: Illegal region command.*", command("region new1 block 0 1");); + //TEST_FAILURE(".*ERROR: Illegal region command.*", command("region new1 block 0 1");); + TEST_FAILURE(".*ERROR: Illegal region command: missing argument\\(s\\).*", command("region new1 block 0 1");); TEST_FAILURE(".*ERROR: Delete region new3 does not exist.*", command("region new3 delete");); } From 5cdc09d9c770c47dc659a6b26508e3444011f888 Mon Sep 17 00:00:00 2001 From: vpalkar Date: Tue, 16 Aug 2022 16:59:12 -0400 Subject: [PATCH 52/59] updated region_intersect and region_union to use utils missing cmd args --- src/region_intersect.cpp | 2 +- src/region_union.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/region_intersect.cpp b/src/region_intersect.cpp index 8d3227ee95..9dd624e7be 100644 --- a/src/region_intersect.cpp +++ b/src/region_intersect.cpp @@ -27,7 +27,7 @@ RegIntersect::RegIntersect(LAMMPS *lmp, int narg, char **arg) : { nregion = 0; - if (narg < 5) error->all(FLERR, "Illegal region intersect {} arguments 5 expected"); + if (narg < 5) utils::missing_cmd_args(FLERR, "region intersect", error);; int n = utils::inumeric(FLERR, arg[2], false, lmp); if (n < 2) error->all(FLERR, "Illegal region intersect n: {}", n); options(narg - (n + 3), &arg[n + 3]); diff --git a/src/region_union.cpp b/src/region_union.cpp index 0cf3f10c66..ebd1197d86 100644 --- a/src/region_union.cpp +++ b/src/region_union.cpp @@ -28,7 +28,7 @@ RegUnion::RegUnion(LAMMPS *lmp, int narg, char **arg) : Region(lmp, narg, arg), { nregion = 0; - if (narg < 5) error->all(FLERR, "Illegal region union {} arguments 5 expected"); + if (narg < 5) utils::missing_cmd_args(FLERR, "region union", error);; int n = utils::inumeric(FLERR, arg[2], false, lmp); if (n < 2) error->all(FLERR, "Illegal region union n: {}", n); options(narg - (n + 3), &arg[n + 3]); From 0cac041ad40d18ac652c00809c8ce29ebb6d0a38 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 16 Aug 2022 18:03:07 -0400 Subject: [PATCH 53/59] avoid segfault when using a custom format with too many format specifiers --- src/MPIIO/dump_custom_mpiio.cpp | 4 +++- src/dump_custom.cpp | 3 ++- src/dump_local.cpp | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/MPIIO/dump_custom_mpiio.cpp b/src/MPIIO/dump_custom_mpiio.cpp index f07c1e19d6..678ee3dadd 100644 --- a/src/MPIIO/dump_custom_mpiio.cpp +++ b/src/MPIIO/dump_custom_mpiio.cpp @@ -231,10 +231,12 @@ void DumpCustomMPIIO::init_style() // lo priority = line, medium priority = int/float, hi priority = column auto words = utils::split_words(format); - if ((int) words.size() < nfield) error->all(FLERR, "Dump_modify format line is too short"); + if ((int) words.size() < nfield) + error->all(FLERR, "Dump_modify format line is too short: {}", format); int i = 0; for (const auto &word : words) { + if (i >= nfield) break; delete[] vformat[i]; if (format_column_user[i]) diff --git a/src/dump_custom.cpp b/src/dump_custom.cpp index 9389839aca..cd85671578 100644 --- a/src/dump_custom.cpp +++ b/src/dump_custom.cpp @@ -262,10 +262,11 @@ void DumpCustom::init_style() auto words = utils::split_words(format); if ((int) words.size() < nfield) - error->all(FLERR,"Dump_modify format line is too short"); + error->all(FLERR,"Dump_modify format line is too short: {}", format); int i=0; for (const auto &word : words) { + if (i >= nfield) break; delete[] vformat[i]; if (format_column_user[i]) diff --git a/src/dump_local.cpp b/src/dump_local.cpp index 5fad243e74..bf26890b05 100644 --- a/src/dump_local.cpp +++ b/src/dump_local.cpp @@ -185,10 +185,11 @@ void DumpLocal::init_style() auto words = utils::split_words(format); if ((int) words.size() < size_one) - error->all(FLERR,"Dump_modify format line is too short"); + error->all(FLERR,"Dump_modify format line is too short: {}", format); int i=0; for (const auto &word : words) { + if (i >= size_one) break; delete[] vformat[i]; if (format_column_user[i]) From 180e0125ce8a23812a1c5bbbf7b373b194d2fc5b Mon Sep 17 00:00:00 2001 From: Jiancheng Chen <2742581175@qq.com> Date: Wed, 17 Aug 2022 08:38:43 +0800 Subject: [PATCH 54/59] Improved fix wall/reflect changes --- src/fix_wall_reflect.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fix_wall_reflect.cpp b/src/fix_wall_reflect.cpp index 6b5b74c4e0..27f3b41f8b 100644 --- a/src/fix_wall_reflect.cpp +++ b/src/fix_wall_reflect.cpp @@ -101,11 +101,11 @@ FixWallReflect::FixWallReflect(LAMMPS *lmp, int narg, char **arg) : for (int m = 0; m < nwall; m++) { if ((wallwhich[m] == XLO || wallwhich[m] == XHI) && domain->xperiodic) - error->all(FLERR,"Cannot use fix wall/reflect in xperiodic dimension"); + error->all(FLERR,"Cannot use fix wall/reflect in periodic dimension x"); if ((wallwhich[m] == YLO || wallwhich[m] == YHI) && domain->yperiodic) - error->all(FLERR,"Cannot use fix wall/reflect in yperiodic dimension"); + error->all(FLERR,"Cannot use fix wall/reflect in periodic dimension y"); if ((wallwhich[m] == ZLO || wallwhich[m] == ZHI) && domain->zperiodic) - error->all(FLERR,"Cannot use fix wall/reflect in zperiodic dimension"); + error->all(FLERR,"Cannot use fix wall/reflect in periodic dimension z"); } for (int m = 0; m < nwall; m++) From 8dbe981a1a51e75fd4f905b3957d776a1febecef Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 16 Aug 2022 22:56:29 -0400 Subject: [PATCH 55/59] modernize fix vector --- src/fix_vector.cpp | 246 +++++++++++++++++++++++---------------------- src/fix_vector.h | 16 ++- 2 files changed, 136 insertions(+), 126 deletions(-) diff --git a/src/fix_vector.cpp b/src/fix_vector.cpp index e916b8e9fe..38169bfcff 100644 --- a/src/fix_vector.cpp +++ b/src/fix_vector.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -26,41 +25,34 @@ using namespace LAMMPS_NS; using namespace FixConst; -enum{ONE,RUNNING,WINDOW}; -enum{SCALAR,VECTOR}; - +enum { ONE, RUNNING, WINDOW }; +enum { SCALAR, VECTOR }; /* ---------------------------------------------------------------------- */ FixVector::FixVector(LAMMPS *lmp, int narg, char **arg) : - Fix(lmp, narg, arg), - nvalues(0), which(nullptr), argindex(nullptr), value2index(nullptr), ids(nullptr), vector(nullptr), array(nullptr) + Fix(lmp, narg, arg), vector(nullptr), array(nullptr) { - if (narg < 5) error->all(FLERR,"Illegal fix vector command"); + if (narg < 5) utils::missing_cmd_args(FLERR, "fix vector", error); - nevery = utils::inumeric(FLERR,arg[3],false,lmp); - if (nevery <= 0) error->all(FLERR,"Illegal fix vector command"); + nevery = utils::inumeric(FLERR, arg[3], false, lmp); + if (nevery <= 0) error->all(FLERR, "Invalid fix vector every argument: {}", nevery); - nvalues = narg-4; - which = new int[nvalues]; - argindex = new int[nvalues]; - value2index = new int[nvalues]; - ids = new char*[nvalues]; - - nvalues = 0; + values.clear(); for (int iarg = 4; iarg < narg; iarg++) { ArgInfo argi(arg[iarg]); - which[nvalues] = argi.get_type(); - argindex[nvalues] = argi.get_index1(); - ids[nvalues] = argi.copy_name(); + value_t val; + val.which = argi.get_type(); + val.argindex = argi.get_index1(); + val.id = argi.get_name(); + val.val.c = nullptr; - if ((argi.get_type() == ArgInfo::UNKNOWN) - || (argi.get_type() == ArgInfo::NONE) - || (argi.get_dim() > 1)) - error->all(FLERR,"Illegal fix vector command"); + if ((argi.get_type() == ArgInfo::UNKNOWN) || (argi.get_type() == ArgInfo::NONE) || + (argi.get_dim() > 1)) + error->all(FLERR, "Invalid fix vector argument: {}", arg[iarg]); - nvalues++; + values.push_back(val); } // setup and error check @@ -68,59 +60,70 @@ FixVector::FixVector(LAMMPS *lmp, int narg, char **arg) : // this fix produces either a global vector or array // intensive/extensive flags set by compute,fix,variable that produces value - int value,finalvalue; - for (int i = 0; i < nvalues; i++) { - if (which[i] == ArgInfo::COMPUTE) { - auto icompute = modify->get_compute_by_id(ids[i]); - if (!icompute) error->all(FLERR,"Compute ID {} for fix vector does not exist",ids[i]); - if (argindex[i] == 0 && icompute->scalar_flag == 0) - error->all(FLERR,"Fix vector compute {} does not calculate a scalar",ids[i]); - if (argindex[i] && icompute->vector_flag == 0) - error->all(FLERR,"Fix vector compute {} does not calculate a vector",ids[i]); - if (argindex[i] && argindex[i] > icompute->size_vector) - error->all(FLERR,"Fix vector compute {} vector is accessed out-of-range",ids[i]); + int value, finalvalue; + bool first = true; + for (auto &val : values) { + if (val.which == ArgInfo::COMPUTE) { + auto icompute = modify->get_compute_by_id(val.id); + if (!icompute) error->all(FLERR, "Compute ID {} for fix vector does not exist", val.id); + if (val.argindex == 0 && icompute->scalar_flag == 0) + error->all(FLERR, "Fix vector compute {} does not calculate a scalar", val.id); + if (val.argindex && icompute->vector_flag == 0) + error->all(FLERR, "Fix vector compute {} does not calculate a vector", val.id); + if (val.argindex && (val.argindex > icompute->size_vector)) + error->all(FLERR, "Fix vector compute {} vector is accessed out-of-range", val.id); - if (argindex[i] == 0) value = icompute->extscalar; - else if (icompute->extvector >= 0) value = icompute->extvector; - else value = icompute->extlist[argindex[i]-1]; + if (val.argindex == 0) + value = icompute->extscalar; + else if (icompute->extvector >= 0) + value = icompute->extvector; + else + value = icompute->extlist[val.argindex - 1]; + val.val.c = icompute; - } else if (which[i] == ArgInfo::FIX) { - auto ifix = modify->get_fix_by_id(ids[i]); - if (!ifix) error->all(FLERR,"Fix ID {} for fix vector does not exist",ids[i]); - if (argindex[i] == 0 && ifix->scalar_flag == 0) - error->all(FLERR,"Fix vector fix {} does not calculate a scalar",ids[i]); - if (argindex[i] && ifix->vector_flag == 0) - error->all(FLERR,"Fix vector fix {} does not calculate a vector",ids[i]); - if (argindex[i] && argindex[i] > ifix->size_vector) - error->all(FLERR,"Fix vector fix {} vector is accessed out-of-range",ids[i]); + } else if (val.which == ArgInfo::FIX) { + auto ifix = modify->get_fix_by_id(val.id); + if (!ifix) error->all(FLERR, "Fix ID {} for fix vector does not exist", val.id); + if (val.argindex == 0 && ifix->scalar_flag == 0) + error->all(FLERR, "Fix vector fix {} does not calculate a scalar", val.id); + if (val.argindex && ifix->vector_flag == 0) + error->all(FLERR, "Fix vector fix {} does not calculate a vector", val.id); + if (val.argindex && val.argindex > ifix->size_vector) + error->all(FLERR, "Fix vector fix {} vector is accessed out-of-range", val.id); if (nevery % ifix->global_freq) - error->all(FLERR,"Fix for fix {} vector not computed at compatible time",ids[i]); + error->all(FLERR, "Fix for fix {} vector not computed at compatible time", val.id); - if (argindex[i] == 0) value = ifix->extvector; - else value = ifix->extarray; + if (val.argindex == 0) + value = ifix->extvector; + else + value = ifix->extarray; + val.val.f = ifix; - } else if (which[i] == ArgInfo::VARIABLE) { - int ivariable = input->variable->find(ids[i]); + } else if (val.which == ArgInfo::VARIABLE) { + int ivariable = input->variable->find(val.id.c_str()); if (ivariable < 0) - error->all(FLERR,"Variable name {} for fix vector does not exist",ids[i]); - if (argindex[i] == 0 && input->variable->equalstyle(ivariable) == 0) - error->all(FLERR,"Fix vector variable {} is not equal-style variable",ids[i]); - if (argindex[i] && input->variable->vectorstyle(ivariable) == 0) - error->all(FLERR,"Fix vector variable {} is not vector-style variable",ids[i]); + error->all(FLERR, "Variable name {} for fix vector does not exist", val.id); + if (val.argindex == 0 && input->variable->equalstyle(ivariable) == 0) + error->all(FLERR, "Fix vector variable {} is not equal-style variable", val.id); + if (val.argindex && input->variable->vectorstyle(ivariable) == 0) + error->all(FLERR, "Fix vector variable {} is not vector-style variable", val.id); value = 0; + val.val.v = ivariable; } - if (i == 0) finalvalue = value; - else if (value != finalvalue) - error->all(FLERR,"Fix vector cannot set output array intensive/extensive from these inputs"); + if (first) { + finalvalue = value; + first = false; + } else if (value != finalvalue) + error->all(FLERR, "Fix vector cannot set output array intensive/extensive from these inputs"); } - if (nvalues == 1) { + if (values.size() == 1) { vector_flag = 1; extvector = finalvalue; } else { array_flag = 1; - size_array_cols = nvalues; + size_array_cols = values.size(); extarray = finalvalue; } @@ -132,15 +135,17 @@ FixVector::FixVector(LAMMPS *lmp, int narg, char **arg) : vector = nullptr; array = nullptr; ncount = ncountmax = 0; - if (nvalues == 1) size_vector = 0; - else size_array_rows = 0; + if (values.size() == 1) + size_vector = 0; + else + size_array_rows = 0; // nextstep = next step on which end_of_step does something // add nextstep to all computes that store invocation times // since don't know a priori which are invoked by this fix // once in end_of_step() can set timestep for ones actually invoked - nextstep = (update->ntimestep/nevery)*nevery; + nextstep = (update->ntimestep / nevery) * nevery; if (nextstep < update->ntimestep) nextstep += nevery; modify->addstep_compute_all(nextstep); @@ -153,12 +158,7 @@ FixVector::FixVector(LAMMPS *lmp, int narg, char **arg) : FixVector::~FixVector() { - delete [] which; - delete [] argindex; - delete [] value2index; - for (int i = 0; i < nvalues; i++) delete [] ids[i]; - delete [] ids; - + values.clear(); memory->destroy(vector); memory->destroy(array); } @@ -178,22 +178,19 @@ void FixVector::init() { // set current indices for all computes,fixes,variables - for (int i = 0; i < nvalues; i++) { - if (which[i] == ArgInfo::COMPUTE) { - int icompute = modify->find_compute(ids[i]); - if (icompute < 0) error->all(FLERR,"Compute ID {} for fix vector does not exist",id[i]); - value2index[i] = icompute; + for (auto &val : values) { + if (val.which == ArgInfo::COMPUTE) { + val.val.c = modify->get_compute_by_id(val.id); + if (!val.val.c) error->all(FLERR, "Compute ID {} for fix vector does not exist", val.id); - } else if (which[i] == ArgInfo::FIX) { - int ifix = modify->find_fix(ids[i]); - if (ifix < 0) error->all(FLERR,"Fix ID {} for fix vector does not exist",id[i]); - value2index[i] = ifix; + } else if (val.which == ArgInfo::FIX) { + val.val.f = modify->get_fix_by_id(val.id); + if (!val.val.f) error->all(FLERR, "Fix ID {} for fix vector does not exist", val.id); - } else if (which[i] == ArgInfo::VARIABLE) { - int ivariable = input->variable->find(ids[i]); - if (ivariable < 0) - error->all(FLERR,"Variable name for fix vector does not exist"); - value2index[i] = ivariable; + } else if (val.which == ArgInfo::VARIABLE) { + int ivariable = input->variable->find(val.id.c_str()); + if (ivariable < 0) error->all(FLERR, "Variable name for fix vector does not exist"); + val.val.v = ivariable; } } @@ -201,11 +198,13 @@ void FixVector::init() // use endstep to allow for subsequent runs with "pre no" // nsize = # of entries from initialstep to finalstep - bigint finalstep = update->endstep/nevery * nevery; + bigint finalstep = update->endstep / nevery * nevery; if (finalstep > update->endstep) finalstep -= nevery; - ncountmax = (finalstep-initialstep)/nevery + 1; - if (nvalues == 1) memory->grow(vector,ncountmax,"vector:vector"); - else memory->grow(array,ncountmax,nvalues,"vector:array"); + ncountmax = (finalstep - initialstep) / nevery + 1; + if (values.size() == 1) + memory->grow(vector, ncountmax, "vector:vector"); + else + memory->grow(array, ncountmax, values.size(), "vector:array"); } /* ---------------------------------------------------------------------- @@ -224,61 +223,64 @@ void FixVector::end_of_step() // skip if not step which requires doing something if (update->ntimestep != nextstep) return; - if (ncount == ncountmax) - error->all(FLERR,"Overflow of allocated fix vector storage"); + if (ncount == ncountmax) error->all(FLERR, "Overflow of allocated fix vector storage"); // accumulate results of computes,fixes,variables to local copy // compute/fix/variable may invoke computes so wrap with clear/add double *result; - if (nvalues == 1) result = &vector[ncount]; - else result = array[ncount]; + if (values.size() == 1) + result = &vector[ncount]; + else + result = array[ncount]; modify->clearstep_compute(); - for (int i = 0; i < nvalues; i++) { - int m = value2index[i]; + int i = 0; + for (auto &val : values) { // invoke compute if not previously invoked - if (which[i] == ArgInfo::COMPUTE) { - auto compute = modify->get_compute_by_index(m); + if (val.which == ArgInfo::COMPUTE) { - if (argindex[i] == 0) { - if (!(compute->invoked_flag & Compute::INVOKED_SCALAR)) { - compute->compute_scalar(); - compute->invoked_flag |= Compute::INVOKED_SCALAR; + if (val.argindex == 0) { + if (!(val.val.c->invoked_flag & Compute::INVOKED_SCALAR)) { + val.val.c->compute_scalar(); + val.val.c->invoked_flag |= Compute::INVOKED_SCALAR; } - result[i] = compute->scalar; + result[i] = val.val.c->scalar; } else { - if (!(compute->invoked_flag & Compute::INVOKED_VECTOR)) { - compute->compute_vector(); - compute->invoked_flag |= Compute::INVOKED_VECTOR; + if (!(val.val.c->invoked_flag & Compute::INVOKED_VECTOR)) { + val.val.c->compute_vector(); + val.val.c->invoked_flag |= Compute::INVOKED_VECTOR; } - result[i] = compute->vector[argindex[i]-1]; + result[i] = val.val.c->vector[val.argindex - 1]; } - // access fix fields, guaranteed to be ready + // access fix fields, guaranteed to be ready - } else if (which[i] == ArgInfo::FIX) { - if (argindex[i] == 0) - result[i] = modify->get_fix_by_index(m)->compute_scalar(); + } else if (val.which == ArgInfo::FIX) { + if (val.argindex == 0) + result[i] = val.val.f->compute_scalar(); else - result[i] = modify->get_fix_by_index(m)->compute_vector(argindex[i]-1); + result[i] = val.val.f->compute_vector(val.argindex - 1); - // evaluate equal-style or vector-style variable + // evaluate equal-style or vector-style variable - } else if (which[i] == ArgInfo::VARIABLE) { - if (argindex[i] == 0) - result[i] = input->variable->compute_equal(m); + } else if (val.which == ArgInfo::VARIABLE) { + if (val.argindex == 0) + result[i] = input->variable->compute_equal(val.val.v); else { double *varvec; - int nvec = input->variable->compute_vector(m,&varvec); - int index = argindex[i]; - if (nvec < index) result[i] = 0.0; - else result[i] = varvec[index-1]; + int nvec = input->variable->compute_vector(val.val.v, &varvec); + int index = val.argindex; + if (nvec < index) + result[i] = 0.0; + else + result[i] = varvec[index - 1]; } } + ++i; } // trigger computes on next needed step @@ -289,8 +291,10 @@ void FixVector::end_of_step() // update size of vector or array ncount++; - if (nvalues == 1) size_vector++; - else size_array_rows++; + if (values.size() == 1) + size_vector++; + else + size_array_rows++; } /* ---------------------------------------------------------------------- diff --git a/src/fix_vector.h b/src/fix_vector.h index 6d0db294c6..3c2f69b21b 100644 --- a/src/fix_vector.h +++ b/src/fix_vector.h @@ -36,9 +36,17 @@ class FixVector : public Fix { double compute_array(int, int) override; private: - int nvalues; - int *which, *argindex, *value2index; - char **ids; + struct value_t { + int which; + int argindex; + std::string id; + union { + class Compute *c; + class Fix *f; + int v; + } val; + }; + std::vector values; bigint nextstep, initialstep; @@ -47,8 +55,6 @@ class FixVector : public Fix { double *vector; double **array; }; - } // namespace LAMMPS_NS - #endif #endif From 8d2fba91975f61c2209fc191d1723740d9161eaa Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 17 Aug 2022 03:33:24 -0400 Subject: [PATCH 56/59] modernize fixes langevin, press/berendsen, temp/berendsen, temp/rescale --- src/fix_langevin.cpp | 300 +++++++++++++++++------------------- src/fix_press_berendsen.cpp | 62 ++++---- src/fix_temp_berendsen.cpp | 46 +++--- src/fix_temp_rescale.cpp | 43 +++--- 4 files changed, 218 insertions(+), 233 deletions(-) diff --git a/src/fix_langevin.cpp b/src/fix_langevin.cpp index 98b8f5274a..84a628eefe 100644 --- a/src/fix_langevin.cpp +++ b/src/fix_langevin.cpp @@ -1,4 +1,3 @@ -// clang-format off /* ---------------------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://www.lammps.org/, Sandia National Laboratories @@ -44,21 +43,20 @@ using namespace LAMMPS_NS; using namespace FixConst; -enum{NOBIAS,BIAS}; -enum{CONSTANT,EQUAL,ATOM}; +enum { NOBIAS, BIAS }; +enum { CONSTANT, EQUAL, ATOM }; -#define SINERTIA 0.4 // moment of inertia prefactor for sphere -#define EINERTIA 0.2 // moment of inertia prefactor for ellipsoid +#define SINERTIA 0.4 // moment of inertia prefactor for sphere +#define EINERTIA 0.2 // moment of inertia prefactor for ellipsoid /* ---------------------------------------------------------------------- */ 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), franprev(nullptr), - lv(nullptr), id_temp(nullptr), random(nullptr) + Fix(lmp, narg, arg), gjfflag(0), gfactor1(nullptr), gfactor2(nullptr), ratio(nullptr), + tstr(nullptr), flangevin(nullptr), tforce(nullptr), franprev(nullptr), lv(nullptr), + id_temp(nullptr), random(nullptr) { - if (narg < 7) error->all(FLERR,"Illegal fix langevin command"); + if (narg < 7) error->all(FLERR, "Illegal fix langevin command"); dynamic_group_allow = 1; scalar_flag = 1; @@ -67,30 +65,30 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) : ecouple_flag = 1; nevery = 1; - if (utils::strmatch(arg[3],"^v_")) { - tstr = utils::strdup(arg[3]+2); + if (utils::strmatch(arg[3], "^v_")) { + tstr = utils::strdup(arg[3] + 2); } else { - t_start = utils::numeric(FLERR,arg[3],false,lmp); + 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); + 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 period must be > 0.0"); - if (seed <= 0) error->all(FLERR,"Illegal fix langevin command"); + if (t_period <= 0.0) error->all(FLERR, "Fix langevin period must be > 0.0"); + if (seed <= 0) error->all(FLERR, "Illegal fix langevin command"); // initialize Marsaglia RNG with processor-unique seed - random = new RanMars(lmp,seed + comm->me); + 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]; + gfactor1 = new double[atom->ntypes + 1]; + gfactor2 = new double[atom->ntypes + 1]; + ratio = new double[atom->ntypes + 1]; // optional args @@ -105,48 +103,48 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) : int iarg = 7; while (iarg < narg) { - if (strcmp(arg[iarg],"angmom") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix langevin command"); - if (strcmp(arg[iarg+1],"no") == 0) ascale = 0.0; - else ascale = utils::numeric(FLERR,arg[iarg+1],false,lmp); + if (strcmp(arg[iarg], "angmom") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix langevin command"); + if (strcmp(arg[iarg + 1], "no") == 0) + ascale = 0.0; + else + ascale = utils::numeric(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else if (strcmp(arg[iarg],"gjf") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix langevin command"); - if (strcmp(arg[iarg+1],"no") == 0) { + } else if (strcmp(arg[iarg], "gjf") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix langevin command"); + if (strcmp(arg[iarg + 1], "no") == 0) { gjfflag = 0; osflag = 0; - } - else if (strcmp(arg[iarg+1],"vfull") == 0) { + } else if (strcmp(arg[iarg + 1], "vfull") == 0) { gjfflag = 1; osflag = 1; - } - else if (strcmp(arg[iarg+1],"vhalf") == 0) { + } else if (strcmp(arg[iarg + 1], "vhalf") == 0) { gjfflag = 1; osflag = 0; - } - else error->all(FLERR,"Illegal fix langevin command"); + } else + error->all(FLERR, "Illegal fix langevin command"); iarg += 2; - } else if (strcmp(arg[iarg],"omega") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix langevin command"); - oflag = utils::logical(FLERR,arg[iarg+1],false,lmp); + } else if (strcmp(arg[iarg], "omega") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix langevin command"); + oflag = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else if (strcmp(arg[iarg],"scale") == 0) { - if (iarg+3 > narg) error->all(FLERR,"Illegal fix langevin command"); - int itype = utils::inumeric(FLERR,arg[iarg+1],false,lmp); - double scale = utils::numeric(FLERR,arg[iarg+2],false,lmp); - if (itype <= 0 || itype > atom->ntypes) - error->all(FLERR,"Illegal fix langevin command"); + } else if (strcmp(arg[iarg], "scale") == 0) { + if (iarg + 3 > narg) error->all(FLERR, "Illegal fix langevin command"); + int itype = utils::inumeric(FLERR, arg[iarg + 1], false, lmp); + double scale = utils::numeric(FLERR, arg[iarg + 2], false, lmp); + if (itype <= 0 || itype > atom->ntypes) error->all(FLERR, "Illegal fix langevin command"); ratio[itype] = scale; iarg += 3; - } else if (strcmp(arg[iarg],"tally") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix langevin command"); - tallyflag = utils::logical(FLERR,arg[iarg+1],false,lmp); + } else if (strcmp(arg[iarg], "tally") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix langevin command"); + tallyflag = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else if (strcmp(arg[iarg],"zero") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix langevin command"); - zeroflag = utils::logical(FLERR,arg[iarg+1],false,lmp); + } else if (strcmp(arg[iarg], "zero") == 0) { + if (iarg + 2 > narg) error->all(FLERR, "Illegal fix langevin command"); + zeroflag = utils::logical(FLERR, arg[iarg + 1], false, lmp); iarg += 2; - } else error->all(FLERR,"Illegal fix langevin command"); + } else + error->all(FLERR, "Illegal fix langevin command"); } // set temperature = nullptr, user can override via fix_modify if wants bias @@ -175,7 +173,7 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) : FixLangevin::grow_arrays(atom->nmax); atom->add_callback(Atom::GROW); - // initialize franprev to zero + // initialize franprev to zero int nlocal = atom->nlocal; for (int i = 0; i < nlocal; i++) { @@ -194,18 +192,18 @@ FixLangevin::FixLangevin(LAMMPS *lmp, int narg, char **arg) : FixLangevin::~FixLangevin() { delete random; - delete [] tstr; - delete [] gfactor1; - delete [] gfactor2; - delete [] ratio; - delete [] id_temp; + delete[] tstr; + delete[] gfactor1; + delete[] gfactor2; + delete[] ratio; + delete[] id_temp; memory->destroy(flangevin); memory->destroy(tforce); if (gjfflag) { memory->destroy(franprev); memory->destroy(lv); - atom->delete_callback(id,Atom::GROW); + atom->delete_callback(id, Atom::GROW); } } @@ -226,34 +224,38 @@ int FixLangevin::setmask() void FixLangevin::init() { if (gjfflag) { - if (t_period*2 == update->dt) - error->all(FLERR,"Fix langevin gjf cannot have t_period equal to dt/2"); + if (t_period * 2 == update->dt) + error->all(FLERR, "Fix langevin gjf cannot have t_period equal to dt/2"); // warn if any integrate fix comes after this one int before = 1; int flag = 0; for (int i = 0; i < modify->nfix; i++) { - if (strcmp(id,modify->fix[i]->id) == 0) before = 0; - else if ((modify->fmask[i] && utils::strmatch(modify->fix[i]->style,"^nve")) && before) flag = 1; + auto ifix = modify->get_fix_by_index(i); + if (strcmp(id, ifix->id) == 0) + before = 0; + else if ((modify->fmask[i] && utils::strmatch(ifix->style, "^nve")) && before) + flag = 1; } - if (flag) - error->all(FLERR,"Fix langevin gjf should come before fix nve"); + if (flag) error->all(FLERR, "Fix langevin gjf should come before fix nve"); } if (oflag && !atom->sphere_flag) - error->all(FLERR,"Fix langevin omega requires atom style sphere"); + error->all(FLERR, "Fix langevin omega requires atom style sphere"); if (ascale && !atom->ellipsoid_flag) - error->all(FLERR,"Fix langevin angmom requires atom style ellipsoid"); + error->all(FLERR, "Fix langevin angmom requires atom style ellipsoid"); // check variable if (tstr) { tvar = input->variable->find(tstr); - if (tvar < 0) - error->all(FLERR,"Variable name for fix langevin does not exist"); - 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"); + 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); } // if oflag or ascale set, check that all group particles are finite-size @@ -265,14 +267,12 @@ void FixLangevin::init() for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) - if (radius[i] == 0.0) - error->one(FLERR,"Fix langevin omega requires extended particles"); + if (radius[i] == 0.0) error->one(FLERR, "Fix langevin omega requires extended particles"); } if (ascale) { - avec = dynamic_cast( atom->style_match("ellipsoid")); - if (!avec) - error->all(FLERR,"Fix langevin angmom requires atom style ellipsoid"); + avec = dynamic_cast(atom->style_match("ellipsoid")); + if (!avec) error->all(FLERR, "Fix langevin angmom requires atom style ellipsoid"); int *ellipsoid = atom->ellipsoid; int *mask = atom->mask; @@ -280,8 +280,7 @@ void FixLangevin::init() for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) - if (ellipsoid[i] < 0) - error->one(FLERR,"Fix langevin angmom requires extended particles"); + if (ellipsoid[i] < 0) error->one(FLERR, "Fix langevin angmom requires extended particles"); } // set force prefactors @@ -289,30 +288,30 @@ void FixLangevin::init() 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; if (gjfflag) - gfactor2[i] = sqrt(atom->mass[i]) * - sqrt(2.0*force->boltz/t_period/update->dt/force->mvv2e) / - force->ftm2v; + gfactor2[i] *= sqrt(2.0 * force->boltz / t_period / update->dt / force->mvv2e); else - gfactor2[i] = sqrt(atom->mass[i]) * - sqrt(24.0*force->boltz/t_period/update->dt/force->mvv2e) / - force->ftm2v; - gfactor1[i] *= 1.0/ratio[i]; - gfactor2[i] *= 1.0/sqrt(ratio[i]); + gfactor2[i] *= sqrt(24.0 * force->boltz / t_period / update->dt / force->mvv2e); + gfactor1[i] *= 1.0 / ratio[i]; + gfactor2[i] *= 1.0 / sqrt(ratio[i]); } } - if (temperature && temperature->tempbias) tbiasflag = BIAS; - else tbiasflag = NOBIAS; + if (temperature && temperature->tempbias) + tbiasflag = BIAS; + else + tbiasflag = NOBIAS; - if (utils::strmatch(update->integrate_style,"^respa")) - nlevels_respa = (dynamic_cast( update->integrate))->nlevels; + 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 (utils::strmatch(update->integrate_style,"^respa") && gjfflag) - error->all(FLERR,"Fix langevin gjf and respa are not compatible"); - - if (gjfflag) gjfa = (1.0-update->dt/2.0/t_period)/(1.0+update->dt/2.0/t_period); - if (gjfflag) gjfsib = sqrt(1.0+update->dt/2.0/t_period); + if (gjfflag) { + gjfa = (1.0 - update->dt / 2.0 / t_period) / (1.0 + update->dt / 2.0 / t_period); + gjfsib = sqrt(1.0 + update->dt / 2.0 / t_period); + } } /* ---------------------------------------------------------------------- */ @@ -336,13 +335,11 @@ void FixLangevin::setup(int vflag) v[i][0] -= dtfm * f[i][0]; v[i][1] -= dtfm * f[i][1]; v[i][2] -= dtfm * f[i][2]; - if (tbiasflag) - temperature->remove_bias(i,v[i]); - v[i][0] /= gjfa*gjfsib*gjfsib; - v[i][1] /= gjfa*gjfsib*gjfsib; - v[i][2] /= gjfa*gjfsib*gjfsib; - if (tbiasflag) - temperature->restore_bias(i,v[i]); + if (tbiasflag) temperature->remove_bias(i, v[i]); + v[i][0] /= gjfa * gjfsib * gjfsib; + v[i][1] /= gjfa * gjfsib * gjfsib; + v[i][2] /= gjfa * gjfsib * gjfsib; + if (tbiasflag) temperature->restore_bias(i, v[i]); } } else { @@ -352,22 +349,21 @@ void FixLangevin::setup(int vflag) v[i][0] -= dtfm * f[i][0]; v[i][1] -= dtfm * f[i][1]; v[i][2] -= dtfm * f[i][2]; - if (tbiasflag) - temperature->remove_bias(i,v[i]); - v[i][0] /= gjfa*gjfsib*gjfsib; - v[i][1] /= gjfa*gjfsib*gjfsib; - v[i][2] /= gjfa*gjfsib*gjfsib; - if (tbiasflag) - temperature->restore_bias(i,v[i]); + if (tbiasflag) temperature->remove_bias(i, v[i]); + v[i][0] /= gjfa * gjfsib * gjfsib; + v[i][1] /= gjfa * gjfsib * gjfsib; + v[i][2] /= gjfa * gjfsib * gjfsib; + if (tbiasflag) temperature->restore_bias(i, v[i]); } } } - if (utils::strmatch(update->integrate_style,"^verlet")) + if (utils::strmatch(update->integrate_style, "^verlet")) post_force(vflag); else { - (dynamic_cast( update->integrate))->copy_flevel_f(nlevels_respa-1); - post_force_respa(vflag,nlevels_respa-1,0); - (dynamic_cast( update->integrate))->copy_f_flevel(nlevels_respa-1); + auto respa = static_cast(update->integrate); + respa->copy_flevel_f(nlevels_respa - 1); + post_force_respa(vflag, nlevels_respa - 1, 0); + respa->copy_f_flevel(nlevels_respa - 1); } if (gjfflag) { double dtfm; @@ -390,7 +386,7 @@ void FixLangevin::setup(int vflag) lv[i][1] = v[i][1]; lv[i][2] = v[i][2]; } -// + // } else { for (int i = 0; i < nlocal; i++) if (mask[i] & groupbit) { @@ -427,6 +423,7 @@ void FixLangevin::initial_integrate(int /* vflag */) } /* ---------------------------------------------------------------------- */ +// clang-format off void FixLangevin::post_force(int /*vflag*/) { @@ -575,8 +572,7 @@ void FixLangevin::post_force_respa(int vflag, int ilevel, int /*iloop*/) modify forces using one of the many Langevin styles ------------------------------------------------------------------------- */ -template < int Tp_TSTYLEATOM, int Tp_GJF, int Tp_TALLY, - int Tp_BIAS, int Tp_RMASS, int Tp_ZERO > +template void FixLangevin::post_force_templated() { double gamma1,gamma2; @@ -988,6 +984,7 @@ void FixLangevin::end_of_step() energy += energy_onestep*update->dt; } +// clang-format on /* ---------------------------------------------------------------------- */ void FixLangevin::reset_target(double t_new) @@ -1001,20 +998,17 @@ 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(atom->mass[i]) * - sqrt(2.0*force->boltz/t_period/update->dt/force->mvv2e) / - force->ftm2v; + gfactor2[i] *= sqrt(2.0 * force->boltz / t_period / update->dt / force->mvv2e); else - gfactor2[i] = sqrt(atom->mass[i]) * - sqrt(24.0*force->boltz/t_period/update->dt/force->mvv2e) / - force->ftm2v; - gfactor2[i] *= 1.0/sqrt(ratio[i]); + gfactor2[i] *= sqrt(24.0 * force->boltz / t_period / update->dt / force->mvv2e); + gfactor2[i] *= 1.0 / sqrt(ratio[i]); } } if (gjfflag) { - gjfa = (1.0-update->dt/2.0/t_period)/(1.0+update->dt/2.0/t_period); - gjfsib = sqrt(1.0+update->dt/2.0/t_period); + gjfa = (1.0 - update->dt / 2.0 / t_period) / (1.0 + update->dt / 2.0 / t_period); + gjfsib = sqrt(1.0 + update->dt / 2.0 / t_period); } } @@ -1022,21 +1016,19 @@ void FixLangevin::reset_dt() int FixLangevin::modify_param(int narg, char **arg) { - if (strcmp(arg[0],"temp") == 0) { - if (narg < 2) error->all(FLERR,"Illegal fix_modify command"); - delete [] id_temp; + 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]); - - int icompute = modify->find_compute(id_temp); - if (icompute < 0) - error->all(FLERR,"Could not find fix_modify temperature ID"); - temperature = modify->compute[icompute]; + 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 ID does not compute temperature"); + 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"); + error->warning(FLERR, "Group for fix_modify temp != fix group: {} vs {}", + group->names[igroup], group->names[temperature->igroup]); return 2; } return 0; @@ -1059,29 +1051,27 @@ double FixLangevin::compute_scalar() 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; + 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]); + 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; + 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_me = energy - 0.5 * energy_onestep * update->dt; double energy_all; - MPI_Allreduce(&energy_me,&energy_all,1,MPI_DOUBLE,MPI_SUM,world); + MPI_Allreduce(&energy_me, &energy_all, 1, MPI_DOUBLE, MPI_SUM, world); return -energy_all; } @@ -1092,9 +1082,7 @@ double FixLangevin::compute_scalar() void *FixLangevin::extract(const char *str, int &dim) { dim = 0; - if (strcmp(str,"t_target") == 0) { - return &t_target; - } + if (strcmp(str, "t_target") == 0) { return &t_target; } return nullptr; } @@ -1105,9 +1093,9 @@ void *FixLangevin::extract(const char *str, int &dim) double FixLangevin::memory_usage() { double bytes = 0.0; - if (gjfflag) bytes += (double)atom->nmax*6 * sizeof(double); - if (tallyflag || osflag) bytes += (double)atom->nmax*3 * sizeof(double); - if (tforce) bytes += (double)atom->nmax * sizeof(double); + if (gjfflag) bytes += (double) atom->nmax * 6 * sizeof(double); + if (tallyflag || osflag) bytes += (double) atom->nmax * 3 * sizeof(double); + if (tforce) bytes += (double) atom->nmax * sizeof(double); return bytes; } @@ -1117,8 +1105,8 @@ double FixLangevin::memory_usage() void FixLangevin::grow_arrays(int nmax) { - memory->grow(franprev,nmax,3,"fix_langevin:franprev"); - memory->grow(lv,nmax,3,"fix_langevin:lv"); + memory->grow(franprev, nmax, 3, "fix_langevin:franprev"); + memory->grow(lv, nmax, 3, "fix_langevin:lv"); } /* ---------------------------------------------------------------------- diff --git a/src/fix_press_berendsen.cpp b/src/fix_press_berendsen.cpp index f80acce8c4..67802654ba 100644 --- a/src/fix_press_berendsen.cpp +++ b/src/fix_press_berendsen.cpp @@ -21,6 +21,7 @@ #include "error.h" #include "fix_deform.h" #include "force.h" +#include "group.h" #include "kspace.h" #include "modify.h" #include "update.h" @@ -240,14 +241,14 @@ FixPressBerendsen::FixPressBerendsen(LAMMPS *lmp, int narg, char **arg) : FixPressBerendsen::~FixPressBerendsen() { - delete [] rfix; + delete[] rfix; // delete temperature and pressure if fix created them if (tflag) modify->delete_compute(id_temp); if (pflag) modify->delete_compute(id_press); - delete [] id_temp; - delete [] id_press; + delete[] id_temp; + delete[] id_press; } /* ---------------------------------------------------------------------- */ @@ -268,9 +269,9 @@ void FixPressBerendsen::init() // insure no conflict with fix deform - for (int i = 0; i < modify->nfix; i++) - if (strcmp(modify->fix[i]->style,"deform") == 0) { - int *dimflag = (dynamic_cast( modify->fix[i]))->dimflag; + for (const auto &ifix : modify->get_fix_list()) + if (strcmp(ifix->style, "^deform") == 0) { + int *dimflag = static_cast(ifix)->dimflag; if ((p_flag[0] && dimflag[0]) || (p_flag[1] && dimflag[1]) || (p_flag[2] && dimflag[2])) error->all(FLERR,"Cannot use fix press/berendsen and " @@ -279,18 +280,16 @@ void FixPressBerendsen::init() // set temperature and pressure ptrs - int icompute = modify->find_compute(id_temp); - if (icompute < 0) - error->all(FLERR,"Temperature ID for fix press/berendsen does not exist"); - temperature = modify->compute[icompute]; + temperature = modify->get_compute_by_id(id_temp); + if (!temperature) + error->all(FLERR, "Temperature compute ID {} for fix press/berendsen does not exist", id_temp); if (temperature->tempbias) which = BIAS; else which = NOBIAS; - icompute = modify->find_compute(id_press); - if (icompute < 0) - error->all(FLERR,"Pressure ID for fix press/berendsen does not exist"); - pressure = modify->compute[icompute]; + pressure = modify->get_compute_by_id(id_press); + if (!pressure) + error->all(FLERR, "Pressure compute ID {} for fix press/berendsen does not exist", id_press); // Kspace setting @@ -300,13 +299,13 @@ void FixPressBerendsen::init() // detect if any rigid fixes exist so rigid bodies move when box is remapped // rfix[] = indices to each fix rigid - delete [] rfix; + delete[] rfix; nrigid = 0; rfix = nullptr; for (int i = 0; i < modify->nfix; i++) if (modify->fix[i]->rigid_flag) nrigid++; - if (nrigid) { + if (nrigid > 0) { rfix = new int[nrigid]; nrigid = 0; for (int i = 0; i < modify->nfix; i++) @@ -460,24 +459,25 @@ int FixPressBerendsen::modify_param(int narg, char **arg) modify->delete_compute(id_temp); tflag = 0; } - delete [] id_temp; + delete[] id_temp; id_temp = utils::strdup(arg[1]); - int icompute = modify->find_compute(arg[1]); - if (icompute < 0) error->all(FLERR,"Could not find fix_modify temperature ID"); - temperature = modify->compute[icompute]; + temperature = modify->get_compute_by_id(arg[1]); + if (!temperature) + error->all(FLERR,"Could not find fix_modify temperature compute ID: ", arg[1]); if (temperature->tempflag == 0) - error->all(FLERR,"Fix_modify temperature ID does not compute temperature"); + error->all(FLERR,"Fix_modify temperature compute {} does not compute temperature", arg[1]); if (temperature->igroup != 0 && comm->me == 0) - error->warning(FLERR,"Temperature for NPT is not for group all"); + error->warning(FLERR,"Temperature compute {} for fix {} is not for group all: {}", + arg[1], style, group->names[temperature->igroup]); // reset id_temp of pressure to new temperature ID - icompute = modify->find_compute(id_press); - if (icompute < 0) - error->all(FLERR,"Pressure ID for fix press/berendsen does not exist"); - modify->compute[icompute]->reset_extra_compute_fix(id_temp); + auto icompute = modify->get_compute_by_id(id_press); + if (!icompute) + error->all(FLERR,"Pressure compute ID {} for fix {} does not exist", id_press, style); + icompute->reset_extra_compute_fix(id_temp); return 2; @@ -487,15 +487,13 @@ int FixPressBerendsen::modify_param(int narg, char **arg) modify->delete_compute(id_press); pflag = 0; } - delete [] id_press; + delete[] id_press; id_press = utils::strdup(arg[1]); - int icompute = modify->find_compute(arg[1]); - if (icompute < 0) error->all(FLERR,"Could not find fix_modify pressure ID"); - pressure = modify->compute[icompute]; - + pressure = modify->get_compute_by_id(arg[1]); + if (pressure) error->all(FLERR,"Could not find fix_modify pressure compute ID: {}", arg[1]); if (pressure->pressflag == 0) - error->all(FLERR,"Fix_modify pressure ID does not compute pressure"); + error->all(FLERR,"Fix_modify pressure compute {} does not compute pressure", arg[1]); return 2; } return 0; diff --git a/src/fix_temp_berendsen.cpp b/src/fix_temp_berendsen.cpp index 26c14e842d..07ad556943 100644 --- a/src/fix_temp_berendsen.cpp +++ b/src/fix_temp_berendsen.cpp @@ -40,7 +40,8 @@ FixTempBerendsen::FixTempBerendsen(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), tstr(nullptr), id_temp(nullptr), tflag(0) { - if (narg != 6) error->all(FLERR,"Illegal fix temp/berendsen command"); + if (narg != 6) + error->all(FLERR,"Illegal fix {} command: expected 6 arguments but found {}", style, narg); // Berendsen thermostat should be applied every step @@ -68,7 +69,7 @@ FixTempBerendsen::FixTempBerendsen(LAMMPS *lmp, int narg, char **arg) : // error checks if (t_period <= 0.0) - error->all(FLERR,"Fix temp/berendsen period must be > 0.0"); + error->all(FLERR,"Fix temp/berendsen Tdamp period must be > 0.0"); // create a new compute temp style // id = fix-ID + temp, compute group = fix group @@ -84,12 +85,12 @@ FixTempBerendsen::FixTempBerendsen(LAMMPS *lmp, int narg, char **arg) : FixTempBerendsen::~FixTempBerendsen() { - delete [] tstr; + delete[] tstr; // delete temperature if fix created it if (tflag) modify->delete_compute(id_temp); - delete [] id_temp; + delete[] id_temp; } /* ---------------------------------------------------------------------- */ @@ -110,18 +111,17 @@ void FixTempBerendsen::init() if (tstr) { tvar = input->variable->find(tstr); if (tvar < 0) - error->all(FLERR,"Variable name for fix temp/berendsen does not exist"); + error->all(FLERR,"Variable name {} for fix temp/berendsen does not exist", tstr); if (input->variable->equalstyle(tvar)) tstyle = EQUAL; - else error->all(FLERR,"Variable for fix temp/berendsen is invalid style"); + else error->all(FLERR,"Variable {} for fix temp/berendsen is invalid style", tstr); } - int icompute = modify->find_compute(id_temp); - if (icompute < 0) - error->all(FLERR,"Temperature ID for fix temp/berendsen does not exist"); - temperature = modify->compute[icompute]; + temperature = modify->get_compute_by_id(id_temp); + if (!temperature) + error->all(FLERR,"Temperature compute ID {} for fix {} does not exist", id_temp, style); if (modify->check_rigid_group_overlap(groupbit)) - error->warning(FLERR,"Cannot thermostat atoms in rigid bodies"); + error->warning(FLERR,"Cannot thermostat atoms in rigid bodies with fix {}", style); if (temperature->tempbias) which = BIAS; else which = NOBIAS; @@ -139,8 +139,7 @@ void FixTempBerendsen::end_of_step() if (tdof < 1) return; if (t_current == 0.0) - error->all(FLERR, - "Computed temperature for fix temp/berendsen cannot be 0.0"); + error->all(FLERR, "Computed current temperature for fix temp/berendsen must not be 0.0"); double delta = update->ntimestep - update->beginstep; if (delta != 0.0) delta /= update->endstep - update->beginstep; @@ -154,8 +153,8 @@ void FixTempBerendsen::end_of_step() modify->clearstep_compute(); t_target = input->variable->compute_equal(tvar); if (t_target < 0.0) - error->one(FLERR, - "Fix temp/berendsen variable returned negative temperature"); + error->one(FLERR, "Fix temp/berendsen variable {} returned negative temperature", + input->variable->names[tvar]); modify->addstep_compute(update->ntimestep + nevery); } @@ -198,24 +197,23 @@ void FixTempBerendsen::end_of_step() int FixTempBerendsen::modify_param(int narg, char **arg) { if (strcmp(arg[0],"temp") == 0) { - if (narg < 2) error->all(FLERR,"Illegal fix_modify command"); + if (narg < 2) utils::missing_cmd_args(FLERR, "fix_modify", error); if (tflag) { modify->delete_compute(id_temp); tflag = 0; } - delete [] id_temp; + delete[] id_temp; id_temp = utils::strdup(arg[1]); - int icompute = modify->find_compute(id_temp); - if (icompute < 0) - error->all(FLERR,"Could not find fix_modify temperature ID"); - temperature = modify->compute[icompute]; + temperature = modify->get_compute_by_id(id_temp); + if (!temperature) + error->all(FLERR,"Could not find fix_modify temperature compute {}", id_temp); if (temperature->tempflag == 0) - error->all(FLERR, - "Fix_modify temperature ID does not compute temperature"); + 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"); + error->warning(FLERR, "Group for fix_modify temp != fix group: {} vs {}", + group->names[igroup], group->names[temperature->igroup]); return 2; } return 0; diff --git a/src/fix_temp_rescale.cpp b/src/fix_temp_rescale.cpp index 41fb49e3f4..b3528190a8 100644 --- a/src/fix_temp_rescale.cpp +++ b/src/fix_temp_rescale.cpp @@ -40,10 +40,10 @@ FixTempRescale::FixTempRescale(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg), tstr(nullptr), id_temp(nullptr), tflag(0) { - if (narg < 8) error->all(FLERR,"Illegal fix temp/rescale command"); + if (narg < 8) utils::missing_cmd_args(FLERR, "fix temp/rescale", error); nevery = utils::inumeric(FLERR,arg[3],false,lmp); - if (nevery <= 0) error->all(FLERR,"Illegal fix temp/rescale command"); + if (nevery <= 0) error->all(FLERR, "Invalid fix temp/rescale every argument: {}", nevery); restart_global = 1; scalar_flag = 1; @@ -66,6 +66,10 @@ FixTempRescale::FixTempRescale(LAMMPS *lmp, int narg, char **arg) : t_window = utils::numeric(FLERR,arg[6],false,lmp); fraction = utils::numeric(FLERR,arg[7],false,lmp); + if (t_stop < 0) error->all(FLERR, "Invalid fix temp/rescale Tstop argument: {}", t_stop); + if (t_window < 0) error->all(FLERR, "Invalid fix temp/rescale window argument: {}", t_window); + if (fraction <= 0) error->all(FLERR, "Invalid fix temp/rescale fraction argument: {}", fraction); + // create a new compute temp // id = fix-ID + temp, compute group = fix group @@ -80,12 +84,12 @@ FixTempRescale::FixTempRescale(LAMMPS *lmp, int narg, char **arg) : FixTempRescale::~FixTempRescale() { - delete [] tstr; + delete[] tstr; // delete temperature if fix created it if (tflag) modify->delete_compute(id_temp); - delete [] id_temp; + delete[] id_temp; } /* ---------------------------------------------------------------------- */ @@ -106,15 +110,14 @@ void FixTempRescale::init() if (tstr) { tvar = input->variable->find(tstr); if (tvar < 0) - error->all(FLERR,"Variable name for fix temp/rescale does not exist"); + error->all(FLERR,"Variable name {} for fix temp/rescale does not exist", tstr); if (input->variable->equalstyle(tvar)) tstyle = EQUAL; - else error->all(FLERR,"Variable for fix temp/rescale is invalid style"); + else error->all(FLERR,"Variable {} for fix temp/rescale is invalid style", tstr); } - int icompute = modify->find_compute(id_temp); - if (icompute < 0) - error->all(FLERR,"Temperature ID for fix temp/rescale does not exist"); - temperature = modify->compute[icompute]; + temperature = modify->get_compute_by_id(id_temp); + if (!temperature) + error->all(FLERR,"Temperature ID {} for fix temp/rescale does not exist", id_temp); if (temperature->tempbias) which = BIAS; else which = NOBIAS; @@ -147,8 +150,7 @@ void FixTempRescale::end_of_step() modify->clearstep_compute(); t_target = input->variable->compute_equal(tvar); if (t_target < 0.0) - error->one(FLERR, - "Fix temp/rescale variable returned negative temperature"); + error->one(FLERR, "Fix temp/rescale variable returned negative temperature"); modify->addstep_compute(update->ntimestep + nevery); } @@ -195,24 +197,23 @@ void FixTempRescale::end_of_step() int FixTempRescale::modify_param(int narg, char **arg) { if (strcmp(arg[0],"temp") == 0) { - if (narg < 2) error->all(FLERR,"Illegal fix_modify command"); + if (narg < 2) utils::missing_cmd_args(FLERR, "fix_modify", error); if (tflag) { modify->delete_compute(id_temp); tflag = 0; } - delete [] id_temp; + delete[] id_temp; id_temp = utils::strdup(arg[1]); - int icompute = modify->find_compute(id_temp); - if (icompute < 0) - error->all(FLERR,"Could not find fix_modify temperature ID"); - temperature = modify->compute[icompute]; + temperature = modify->get_compute_by_id(id_temp); + if (!temperature) + error->all(FLERR,"Could not find fix_modify temperature compute {}", id_temp); if (temperature->tempflag == 0) - error->all(FLERR, - "Fix_modify temperature ID does not compute temperature"); + 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"); + error->warning(FLERR, "Group for fix_modify temp != fix group: {} vs {}", + group->names[igroup], group->names[temperature->igroup]); return 2; } return 0; From daa6b78c43af7f32291a7f7c9629ecb69e829b83 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 17 Aug 2022 15:22:59 -0400 Subject: [PATCH 57/59] update documentation --- doc/src/fix_shake.rst | 100 ++++++++++++++++++++++-------------------- 1 file changed, 53 insertions(+), 47 deletions(-) diff --git a/doc/src/fix_shake.rst b/doc/src/fix_shake.rst index b53f8602ec..f5742b8f9f 100644 --- a/doc/src/fix_shake.rst +++ b/doc/src/fix_shake.rst @@ -58,9 +58,10 @@ Description Apply bond and angle constraints to specified bonds and angles in the simulation by either the SHAKE or RATTLE algorithms. This typically -enables a longer timestep. This SHAKE or RATTLE algorithms can *only* -be applied during molecular dynamics runs. When this fix is used during -a minimization, the constraints are replaced by strong harmonic restraints. +enables a longer timestep. The SHAKE or RATTLE algorithms, however, can +*only* be applied during molecular dynamics runs. When this fix is used +during a minimization, the constraints are *approximated* by strong +harmonic restraints. **SHAKE vs RATTLE:** @@ -94,7 +95,7 @@ The SHAKE algorithm satisfies the first condition, i.e. the sites at time *n+1* will have the desired separations Dij immediately after the coordinates are integrated. If we also enforce the second condition, the velocity components along the bonds will vanish. RATTLE satisfies -both conditions. As implemented in LAMMPS, fix rattle uses fix shake +both conditions. As implemented in LAMMPS, *fix rattle* uses fix shake for satisfying the coordinate constraints. Therefore the settings and optional keywords are the same for both fixes, and all the information below about SHAKE is also relevant for RATTLE. @@ -143,16 +144,16 @@ for. .. note:: - This command works by using the current forces on atoms to - calculate an additional constraint force which when added will leave - the atoms in positions that satisfy the SHAKE constraints (e.g. bond - length) after the next time integration step. If you define fixes - (e.g. :doc:`fix efield `) that add additional force to the - atoms after fix shake operates, then this fix will not take them into - account and the time integration will typically not satisfy the SHAKE - constraints. The solution for this is to make sure that fix shake is - defined in your input script after any other fixes which add or change - forces (to atoms that fix shake operates on). + This command works by using the current forces on atoms to calculate + an additional constraint force which when added will leave the atoms + in positions that satisfy the SHAKE constraints (e.g. bond length) + after the next time integration step. If you define fixes + (e.g. :doc:`fix efield `) that add additional force to + the atoms after *fix shake* operates, then this fix will not take them + into account and the time integration will typically not satisfy the + SHAKE constraints. The solution for this is to make sure that fix + shake is defined in your input script after any other fixes which add + or change forces (to atoms that *fix shake* operates on). ---------- @@ -168,17 +169,21 @@ See the :doc:`molecule ` command for details. The only settings required to be in this file (by this command) are the SHAKE info of atoms in the molecule. -The *kbond* keyword sets the restraint force constant when fix shake or -fix rattle are used during minimization. In that case the constraint +The *kbond* keyword sets the restraint force constant when *fix shake* +or fix rattle are used during minimization. In that case the constraint algorithms are *not* applied and restraint forces are used instead to maintain the geometries similar to the constraints. How well the geometries are maintained and how quickly a minimization converges, -depends on the force constant *kbond*: larger values will reduce the -deviation from the desired geometry, but can also lead to slower +depends largely on the force constant *kbond*: larger values will reduce +the deviation from the desired geometry, but can also lead to slower convergence of the minimization or lead to instabilities depending on the minimization algorithm requiring to reduce the value of -:doc:`timestep `. The default value for *kbond* depends on -the :doc:`units ` setting and is 1.0e6*k_B. +:doc:`timestep `. Even though the restraints will not +preserve the bond lengths and angles as closely as the constraints +during the MD, they are generally close enough so that the constraints +will be fulfilled to the desired accuracy within a few MD steps +following the minimization. The default value for *kbond* depends on the +:doc:`units ` setting and is 1.0e6*k_B. ---------- @@ -197,7 +202,7 @@ LAMMPS closely follows (:ref:`Andersen (1983) `). The *fix rattle* command modifies forces and velocities and thus should be defined after all other integration fixes in your input script. If you define other fixes that modify velocities or forces - after fix rattle operates, then fix rattle will not take them into + after *fix rattle* operates, then *fix rattle* will not take them into account and the overall time integration will typically not satisfy the RATTLE constraints. You can check whether the constraints work correctly by setting the value of RATTLE_DEBUG in src/fix_rattle.cpp @@ -211,30 +216,31 @@ Restart, fix_modify, output, run start/stop, minimize info No information about these fixes is written to :doc:`binary restart files `. -Fix *shake* and *rattle* behave differently during minimization and -during a molecular dynamics run. +Both fix *shake* and fix *rattle* behave differently during a minimization +in comparison to a molecular dynamics run: -When used during minimization, the SHAKE or RATTLE algorithms are -**not** applied. The constraints are replaced by restraint forces -instead. The energy and virial contributions due to the restraint -forces are tallied into global and per-atom accumulators. The total -restraint energy is also accessible as a global scalar property of the -fix. +- When used during a minimization, the SHAKE or RATTLE constraint + algorithms themselves are **not** applied. Instead the constraints + are replaced by harmonic restraint forces. The energy and virial + contributions due to the restraint forces are tallied into global and + per-atom accumulators. The total restraint energy is also accessible + as a global scalar property of the fix. -During molecular dynamics runs, the fixes apply the requested -constraints. +- During molecular dynamics runs, however, the fixes do apply the + requested SHAKE or RATTLE constraint algorithms. -The :doc:`fix_modify ` *virial* option is supported by these -fixes to add the contribution due to the added constraint forces on -atoms to both the global pressure and per-atom stress of the system via -the :doc:`compute pressure ` and :doc:`compute -stress/atom ` commands. The former can be accessed -by :doc:`thermodynamic output `. The default setting for -this fix is :doc:`fix_modify virial yes `. No global or -per-atom quantities are stored by these fixes for access by various -:doc:`output commands ` during an MD run. No parameter of -these fixes can be used with the *start/stop* keywords of the :doc:`run -` command. + The :doc:`fix_modify ` *virial* option is supported by + these fixes to add the contribution due to the added constraint forces + on atoms to both the global pressure and per-atom stress of the system + via the :doc:`compute pressure ` and :doc:`compute + stress/atom ` commands. The former can be + accessed by :doc:`thermodynamic output `. + + The default setting for this fix is :doc:`fix_modify virial yes + `. No global or per-atom quantities are stored by these + fixes for access by various :doc:`output commands ` during + an MD run. No parameter of these fixes can be used with the + *start/stop* keywords of the :doc:`run ` command. Restrictions @@ -253,13 +259,13 @@ which can lead to poor energy conservation. You can test for this in your system by running a constant NVE simulation with a particular set of SHAKE parameters and monitoring the energy versus time. -SHAKE or RATTLE should not be used to constrain an angle at 180 -degrees (e.g. linear CO2 molecule). This causes numeric difficulties. -You can use :doc:`fix rigid or fix rigid/small ` instead to -make a linear molecule rigid. +SHAKE or RATTLE should not be used to constrain an angle at 180 degrees +(e.g. a linear CO2 molecule). This causes a divergence when solving the +constraint equations numerically. You can use :doc:`fix rigid or fix +rigid/small ` instead to make a linear molecule rigid. When used during minimization choosing a too large value of the *kbond* -can make minimization very inefficent and also cause stability problems +can make minimization very inefficient and also cause stability problems with some minimization algorithms. Sometimes those can be avoided by reducing the :doc:`timestep `. From da0bc7e0e9943f652055d286f19e629eeccc515f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 17 Aug 2022 15:48:47 -0400 Subject: [PATCH 58/59] whitespace --- src/region.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/region.cpp b/src/region.cpp index b61a5f8905..307513add6 100644 --- a/src/region.cpp +++ b/src/region.cpp @@ -325,7 +325,7 @@ void Region::options(int narg, char **arg) error->all(FLERR, "Illegal region units: {}", arg[iarg+1]); iarg += 2; } else if (strcmp(arg[iarg], "side") == 0) { - if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "region side", error); + if (iarg + 2 > narg) utils::missing_cmd_args(FLERR, "region side", error); if (strcmp(arg[iarg + 1], "in") == 0) interior = 1; else if (strcmp(arg[iarg + 1], "out") == 0) From d1e0af7ef519c22d6920ca858f64abe97c965bef Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 17 Aug 2022 16:00:00 -0400 Subject: [PATCH 59/59] discuss why one would want to use `check = no` during minimization --- doc/src/minimize.rst | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/doc/src/minimize.rst b/doc/src/minimize.rst index cd546d7f68..5143cab5d5 100644 --- a/doc/src/minimize.rst +++ b/doc/src/minimize.rst @@ -50,15 +50,17 @@ and forces) by pushing the atoms off of each other. The distance that atoms can move during individual minimization steps can be quite large, especially at the beginning of a minimization. Thus `neighbor list settings ` of *every = 1* and - *delay = 0* are **required**. This may be combined with *check = no* - (always update the neighbor list) or *check = yes* (only update the - neighbor list if at least one atom has moved more than half the - `neighbor list skin ` distance since the last + *delay = 0* are **required**. This may be combined with either + *check = no* (always update the neighbor list) or *check = yes* (only + update the neighbor list if at least one atom has moved more than + half the `neighbor list skin ` distance since the last reneighboring). Using *check = yes* is recommended since it avoids unneeded reneighboring steps when the system is closer to the minimum - and thus atoms move only small distances. + and thus atoms move only small distances. Using *check = no* may + be required for debugging or when coupling LAMMPS with external + codes that require a predictable sequence of neighbor list updates. - If if the settings are **not** *every = 1* and *delay = 0*, LAMMPS + If the settings are **not** *every = 1* and *delay = 0*, LAMMPS will temporarily apply a `neigh_modify every 1 delay 0 check yes ` setting during the minimization and restore the original setting at the end of the minimization. A corresponding