diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index b61a753518..60fe82d86c 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -67,6 +67,7 @@ How quickly your contribution will be integrated depends largely on how much eff Here is a checklist of steps you need to follow to submit a single file or user package for our consideration. Following these steps will save both you and us time. See existing files in packages in the source directory for examples. If you are uncertain, please ask on the lammps-users mailing list. +* C++ source code must be compatible with the C++-11 standard. Packages may require a later standard, if justified. * All source files you provide must compile with the most current version of LAMMPS with multiple configurations. In particular you need to test compiling LAMMPS from scratch with `-DLAMMPS_BIGBIG` set in addition to the default `-DLAMMPS_SMALLBIG` setting. Your code will need to work correctly in serial and in parallel using MPI. * For consistency with the rest of LAMMPS and especially, if you want your contribution(s) to be added to main LAMMPS code or one of its standard packages, it needs to be written in a style compatible with other LAMMPS source files. This means: 2-character indentation per level, no tabs, no trailing whitespace, no lines over 80 characters. I/O is done via the C-style stdio library, style class header files should not import any system headers, STL containers should be avoided in headers, and forward declarations used where possible or needed. All added code should be placed into the LAMMPS_NS namespace or a sub-namespace; global or static variables should be avoided, as they conflict with the modular nature of LAMMPS and the C++ class structure. There MUST NOT be any "using namespace XXX;" statements in headers. In the implementation file (.cpp) system includes should be placed in angular brackets (<>) and for c-library functions the C++ style header files should be included ( instead of , or instead of ). This all is so the developers can more easily understand, integrate, and maintain your contribution and reduce conflicts with other parts of LAMMPS. This basically means that the code accesses data structures, performs its operations, and is formatted similar to other LAMMPS source files, including the use of the error class for error and warning messages. * Source, style name, and documentation file should follow the following naming convention: style names should be lowercase and words separated by a forward slash; for a new fix style 'foo/bar', the class should be named FixFooBar, the name of the source files should be 'fix_foo_bar.h' and 'fix_foo_bar.cpp' and the corresponding documentation should be in a file 'fix_foo_bar.rst'. diff --git a/doc/Makefile b/doc/Makefile index d96b523915..61875cbaae 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -41,7 +41,10 @@ HAS_PDFLATEX = YES endif -SPHINXEXTRA = -j $(shell $(PYTHON) -c 'import multiprocessing;print(multiprocessing.cpu_count())') $(shell test -f $(BUILDDIR)/doxygen/xml/run.stamp && printf -- "-E") +#SPHINXEXTRA = -j $(shell $(PYTHON) -c 'import multiprocessing;print(multiprocessing.cpu_count())') $(shell test -f $(BUILDDIR)/doxygen/xml/run.stamp && printf -- "-E") + +# temporarily disable caching so that the hack for the sphinx-tabs extensions to get proper non-html output works +SPHINXEXTRA = -E -j $(shell $(PYTHON) -c 'import multiprocessing;print(multiprocessing.cpu_count())') # grab list of sources from doxygen config file. # we only want to use explicitly listed files. diff --git a/doc/github-development-workflow.md b/doc/github-development-workflow.md index fd38c983a2..a7d41dd32a 100644 --- a/doc/github-development-workflow.md +++ b/doc/github-development-workflow.md @@ -136,7 +136,8 @@ Here are some items to check: * string.h -> cstring * time.h -> ctime * Do NOT replace (as they are C++-11): `inttypes.h` and `stdint.h`. - * Code should follow the C++-98 standard. C++-11 is only accepted + * Code must follow the C++-11 standard. C++98-only is no longer accepted + * Code should use `nullptr` instead of `NULL` where applicable. in individual special purpose packages * indentation is 2 spaces per level * there should be NO tabs and no trailing whitespace (review the "checkstyle" test on pull requests) @@ -145,6 +146,8 @@ Here are some items to check: Forward declarations should be used instead when possible. * iostreams should be avoided. LAMMPS uses stdio from the C-library. * use of STL in headers and class definitions should be avoided. + exception is , but it won't need to be explicitly included + since pointers.h already includes it. so std::string can be used directly. * there MUST NOT be any "using namespace XXX;" statements in headers. * static class members should be avoided at all cost. * anything storing atom IDs should be using `tagint` and not `int`. @@ -152,6 +155,8 @@ Here are some items to check: compiling LAMMPS with `-DLAMMPS_BIGBIG`. * when including both `lmptype.h` (and using defines or macros from it) and `mpi.h`, `lmptype.h` must be included first. + * see https://github.com/lammps/lammps/blob/master/doc/include-file-conventions.md + for general include file conventions and best practices * when pair styles are added, check if settings for flags like `single_enable`, `writedata`, `reinitflag`, `manybody_flag` and others are correctly set and supported. diff --git a/doc/src/Build_extras.rst b/doc/src/Build_extras.rst index 79e38ab2b4..7d778ada3d 100644 --- a/doc/src/Build_extras.rst +++ b/doc/src/Build_extras.rst @@ -373,8 +373,8 @@ More information on Kokkos can be found on the Available Architecture settings ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -These are the possible choices for the Kokkos architecture ID as of -version 3.2 of the Kokkos library. They must be specified in uppercase. +These are the possible choices for the Kokkos architecture ID. +They must be specified in uppercase. .. list-table:: :header-rows: 0 @@ -486,6 +486,8 @@ version 3.2 of the Kokkos library. They must be specified in uppercase. - GPU - Intel GPUs Gen9+ +This list was last updated for version 3.2 of the Kokkos library. + .. tabs:: .. tab:: Basic CMake build settings: diff --git a/doc/src/Build_settings.rst b/doc/src/Build_settings.rst index d8ac39a0c1..600bd084ec 100644 --- a/doc/src/Build_settings.rst +++ b/doc/src/Build_settings.rst @@ -228,9 +228,9 @@ LAMMPS system size restrictions - :math:`2^{63}` steps (= :math:`9.223 \cdot 10^{18}`) - :math:`2^{31}` steps (= :math:`2.147 \cdot 10^9`) * - Atom ID values - - :math:`1 \le i \le 2^{31} (= 2.147 \dot 10^9)` + - :math:`1 \le i \le 2^{31} (= 2.147 \cdot 10^9)` - :math:`1 \le i \le 2^{63} (= 9.223 \cdot 10^{18})` - - :math:`1 \le i \le 2^{31} (= 2.147 \dot 10^9)` + - :math:`1 \le i \le 2^{31} (= 2.147 \cdot 10^9)` * - Image flag values - :math:`-512 \le i \le 511` - :math:`- 1\,048\,576 \le i \le 1\,048\,575` diff --git a/doc/src/compute_reduce.rst b/doc/src/compute_reduce.rst index c7815305c0..660ef87042 100644 --- a/doc/src/compute_reduce.rst +++ b/doc/src/compute_reduce.rst @@ -53,7 +53,7 @@ Examples compute 1 all reduce sum c_force compute 1 all reduce/region subbox sum c_force compute 2 all reduce min c_press[2] f_ave v_myKE - compute 2 all reduce min c_press[\*] f_ave v_myKE + compute 2 all reduce min c_press[*] f_ave v_myKE compute 3 fluid reduce max c_index[1] c_index[2] c_dist replace 1 3 replace 2 3 Description diff --git a/doc/src/compute_stress_mop.rst b/doc/src/compute_stress_mop.rst index f164a33c26..d68bafa48b 100644 --- a/doc/src/compute_stress_mop.rst +++ b/doc/src/compute_stress_mop.rst @@ -28,14 +28,16 @@ Syntax origin = *lower* or *center* or *upper* or coordinate value (distance units) is the position of the first plane delta = value (distance units) is the distance between planes +.. code-block:: LAMMPS + compute 1 all stress/mop x lower total compute 1 liquid stress/mop z 0.0 kin conf - fix 1 all ave/time 10 1000 10000 c_1[\*] file mop.time + fix 1 all ave/time 10 1000 10000 c_1[*] file mop.time fix 1 all ave/time 10 1000 10000 c_1[2] file mop.time compute 1 all stress/mop/profile x lower 0.1 total compute 1 liquid stress/mop/profile z 0.0 0.25 kin conf - fix 1 all ave/time 500 20 10000 c_1[\*] ave running overwrite file mopp.time mode vector + fix 1 all ave/time 500 20 10000 c_1[*] ave running overwrite file mopp.time mode vector Description """"""""""" diff --git a/doc/src/dump.rst b/doc/src/dump.rst index 3f6a8812c3..c94d9a8007 100644 --- a/doc/src/dump.rst +++ b/doc/src/dump.rst @@ -36,8 +36,7 @@ Syntax * ID = user-assigned name for the dump * group-ID = ID of the group of atoms to be dumped -* style = *atom* or *atom/gz* or *atom/mpiio* or *cfg* or *cfg/gz* or - *cfg/mpiio* or *custom* or *custom/gz* or *custom/mpiio* or *dcd* or *h5md* or *image* or *local* or *local/gz* or *molfile* or *movie* or *netcdf* or *netcdf/mpiio* or *vtk* or *xtc* or *xyz* or *xyz/gz* or *xyz/mpiio* +* style = *atom* or *atom/gz* or *atom/zstd or *atom/mpiio* or *cfg* or *cfg/gz* or *cfg/zstd* or *cfg/mpiio* or *custom* or *custom/gz* or *custom/zstd* or *custom/mpiio* or *dcd* or *h5md* or *image* or *local* or *local/gz* or *local/zstd* or *molfile* or *movie* or *netcdf* or *netcdf/mpiio* or *vtk* or *xtc* or *xyz* or *xyz/gz* or *xyz/zstd* or *xyz/mpiio* * N = dump every this many timesteps * file = name of file to write dump info to * args = list of arguments for a particular style @@ -138,7 +137,7 @@ Examples dump 2 subgroup atom 50 dump.run.mpiio.bin dump 4a all custom 100 dump.myforce.* id type x y vx fx dump 4b flow custom 100 dump.%.myforce id type c_myF[3] v_ke - dump 4b flow custom 100 dump.%.myforce id type c_myF[\*] v_ke + dump 4b flow custom 100 dump.%.myforce id type c_myF[*] v_ke dump 2 inner cfg 10 dump.snap.*.cfg mass type xs ys zs vx vy vz dump snap all cfg 100 dump.config.*.cfg mass type xs ys zs id type c_Stress[2] dump 1 all xtc 1000 file.xtc @@ -204,8 +203,9 @@ of the required filename suffix. Similarly, the *atom/zstd*\ , *cfg/zstd*\ , *custom/zstd*\ , *local/zstd*, and *xyz/zstd* styles are identical to the gz styles, but use the Zstd -compression library instead. See the :doc:`dump_modify ` doc -page for details on how to control the compression level in both variants. +compression library instead and require the ".zst" suffix. See the +:doc:`dump_modify ` doc page for details on how to control +the compression level in both variants. As explained below, the *atom/mpiio*\ , *cfg/mpiio*\ , *custom/mpiio*\ , and *xyz/mpiio* styles are identical in command syntax and in the format diff --git a/doc/src/fix_nh.rst b/doc/src/fix_nh.rst index 84b497dc3f..988a147abe 100644 --- a/doc/src/fix_nh.rst +++ b/doc/src/fix_nh.rst @@ -51,7 +51,7 @@ Syntax *couple* = *none* or *xyz* or *xy* or *yz* or *xz* *tchain* value = N N = length of thermostat chain (1 = single thermostat) - *pchain* values = N + *pchain* value = N N length of thermostat chain on barostat (0 = no thermostat) *mtk* value = *yes* or *no* = add in MTK adjustment term or not *tloop* value = M diff --git a/doc/src/min_modify.rst b/doc/src/min_modify.rst index e541571b7b..731d2ace62 100644 --- a/doc/src/min_modify.rst +++ b/doc/src/min_modify.rst @@ -19,7 +19,7 @@ Syntax max = maximum distance for line search to move (distance units) *line* value = *backtrack* or *quadratic* or *forcezero* or *spin_cubic* or *spin_none* backtrack,quadratic,forcezero,spin_cubic,spin_none = style of linesearch to use - *norm* value = *two* or *max* + *norm* value = *two* or *inf* or *max* two = Euclidean two-norm (length of 3N vector) inf = max force component across all 3-vectors max = max force norm across all 3-vectors diff --git a/doc/utils/sphinx-config/_static/css/lammps.css b/doc/utils/sphinx-config/_static/css/lammps.css index d2aa8a975d..2efb1246b3 100644 --- a/doc/utils/sphinx-config/_static/css/lammps.css +++ b/doc/utils/sphinx-config/_static/css/lammps.css @@ -14,3 +14,7 @@ display: block; margin-bottom: 0.405em; } + +.versionmodified { + font-weight: bold; +} diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index e3cf7b78ce..5046316ec8 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -1003,6 +1003,7 @@ formatarg formulae Forschungszentrum Fortran +fortran Fosado fourier fp @@ -3454,6 +3455,7 @@ zmin zmq zN zs +zst zsu zu zx diff --git a/src/KSPACE/msm.cpp b/src/KSPACE/msm.cpp index d0f4d38686..2634b7633c 100644 --- a/src/KSPACE/msm.cpp +++ b/src/KSPACE/msm.cpp @@ -206,9 +206,9 @@ void MSM::init() if (me == 0) { std::string mesg = fmt::format(" 3d grid size/proc = {}\n", ngrid_max); - mesg += fmt::format(" estimated absolute RMS force accuracy = {:.8g}\n", + mesg += fmt::format(" estimated absolute RMS force accuracy = {:.8}\n", estimated_error); - mesg += fmt::format(" estimated relative force accuracy = {:.8g}\n", + mesg += fmt::format(" estimated relative force accuracy = {:.8}\n", estimated_error/two_charge_force); mesg += fmt::format(" grid = {} {} {}\n",nx_msm[0],ny_msm[0],nz_msm[0]); mesg += fmt::format(" order = {}\n",order); @@ -1028,6 +1028,7 @@ void MSM::set_grid_global() int flag = 0; int xlevels,ylevels,zlevels; + xlevels = ylevels = zlevels = 1; while (!factorable(nx_max,flag,xlevels)) { double k = log(nx_max)/log(2.0); @@ -1077,7 +1078,7 @@ void MSM::set_grid_global() if (me == 0) error->warning(FLERR,fmt::format("Adjusting Coulombic cutoff for " - "MSM, new cutoff = {}", cutoff)); + "MSM, new cutoff = {:.8}", cutoff)); } if (triclinic == 0) { @@ -1432,16 +1433,15 @@ void MSM::setup_grid() return 1 if yes, 0 if no ------------------------------------------------------------------------- */ -int MSM::factorable(int n, int &flag, int &levels) +int MSM::factorable(int n, int &flag, int &nlevels) { int i; - levels = 1; while (n > 1) { for (i = 0; i < nfactors; i++) { if (n % factors[i] == 0) { n /= factors[i]; - levels++; + nlevels++; break; } } diff --git a/src/KSPACE/msm_cg.cpp b/src/KSPACE/msm_cg.cpp index 79d33b869d..bbd940f762 100644 --- a/src/KSPACE/msm_cg.cpp +++ b/src/KSPACE/msm_cg.cpp @@ -133,7 +133,7 @@ void MSMCG::compute(int eflag, int vflag) / static_cast(atom->natoms); if (me == 0) - utils::logmesg(lmp,fmt::format(" MSM/cg optimization cutoff: {:.8g}\n" + utils::logmesg(lmp,fmt::format(" MSM/cg optimization cutoff: {:.8}\n" " Total charged atoms: {:.1f}%\n" " Min/max charged atoms/proc: {:.1f}%" " {:.1f}%\n",smallq, diff --git a/src/MC/fix_widom.cpp b/src/MC/fix_widom.cpp index 94b2481742..6055ae8442 100644 --- a/src/MC/fix_widom.cpp +++ b/src/MC/fix_widom.cpp @@ -62,10 +62,10 @@ FixWidom::FixWidom(LAMMPS *lmp, int narg, char **arg) : local_gas_list(NULL), molcoords(NULL), molq(NULL), molimage(NULL), random_equal(NULL) { - if (narg < 8) error->all(FLERR,"Illegal fix Widom command"); + if (narg < 8) error->all(FLERR,"Illegal fix widom command"); if (atom->molecular == 2) - error->all(FLERR,"Fix Widom does not (yet) work with atom_style template"); + error->all(FLERR,"Fix widom does not (yet) work with atom_style template"); dynamic_group_allow = 1; @@ -86,11 +86,11 @@ FixWidom::FixWidom(LAMMPS *lmp, int narg, char **arg) : seed = utils::inumeric(FLERR,arg[6],false,lmp); insertion_temperature = utils::numeric(FLERR,arg[7],false,lmp); - if (nevery <= 0) error->all(FLERR,"Illegal fix Widom command"); - if (ninsertions < 0) error->all(FLERR,"Illegal fix Widom command"); - if (seed <= 0) error->all(FLERR,"Illegal fix Widom command"); + if (nevery <= 0) error->all(FLERR,"Illegal fix widom command"); + if (ninsertions < 0) error->all(FLERR,"Illegal fix widom command"); + if (seed <= 0) error->all(FLERR,"Illegal fix widom command"); if (insertion_temperature < 0.0) - error->all(FLERR,"Illegal fix Widom command"); + error->all(FLERR,"Illegal fix widom command"); // read options from end of input line @@ -106,9 +106,9 @@ FixWidom::FixWidom(LAMMPS *lmp, int narg, char **arg) : region_zlo = region_zhi = 0.0; if (regionflag) { if (domain->regions[iregion]->bboxflag == 0) - error->all(FLERR,"Fix Widom region does not support a bounding box"); + error->all(FLERR,"Fix widom region does not support a bounding box"); if (domain->regions[iregion]->dynamic_check()) - error->all(FLERR,"Fix Widom region cannot be dynamic"); + error->all(FLERR,"Fix widom region cannot be dynamic"); region_xlo = domain->regions[iregion]->extent_xlo; region_xhi = domain->regions[iregion]->extent_xhi; @@ -120,7 +120,7 @@ FixWidom::FixWidom(LAMMPS *lmp, int narg, char **arg) : if (region_xlo < domain->boxlo[0] || region_xhi > domain->boxhi[0] || region_ylo < domain->boxlo[1] || region_yhi > domain->boxhi[1] || region_zlo < domain->boxlo[2] || region_zhi > domain->boxhi[2]) - error->all(FLERR,"Fix Widom region extends outside simulation box"); + error->all(FLERR,"Fix widom region extends outside simulation box"); // estimate region volume using MC trials @@ -146,22 +146,22 @@ FixWidom::FixWidom(LAMMPS *lmp, int narg, char **arg) : if (exchmode == EXCHMOL) { if (onemols[imol]->xflag == 0) - error->all(FLERR,"Fix Widom molecule must have coordinates"); + error->all(FLERR,"Fix widom molecule must have coordinates"); if (onemols[imol]->typeflag == 0) - error->all(FLERR,"Fix Widom molecule must have atom types"); + error->all(FLERR,"Fix widom molecule must have atom types"); if (nwidom_type != 0) - error->all(FLERR,"Atom type must be zero in fix Widom mol command"); + error->all(FLERR,"Atom type must be zero in fix widom mol command"); if (onemols[imol]->qflag == 1 && atom->q == NULL) - error->all(FLERR,"Fix Widom molecule has charges, but atom style does not"); + error->all(FLERR,"Fix widom molecule has charges, but atom style does not"); if (atom->molecular == 2 && onemols != atom->avec->onemols) - error->all(FLERR,"Fix Widom molecule template ID must be same " + error->all(FLERR,"Fix widom molecule template ID must be same " "as atom_style template ID"); onemols[imol]->check_attributes(0); } if (charge_flag && atom->q == NULL) - error->all(FLERR,"Fix Widom atom has charge, but atom style does not"); + error->all(FLERR,"Fix widom atom has charge, but atom style does not"); // setup of array of coordinates for molecule insertion @@ -186,7 +186,7 @@ FixWidom::FixWidom(LAMMPS *lmp, int narg, char **arg) : void FixWidom::options(int narg, char **arg) { - if (narg < 0) error->all(FLERR,"Illegal fix Widom command"); + if (narg < 0) error->all(FLERR,"Illegal fix widom command"); // defaults @@ -208,29 +208,29 @@ void FixWidom::options(int narg, char **arg) int iarg = 0; while (iarg < narg) { if (strcmp(arg[iarg],"mol") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix Widom command"); + if (iarg+2 > narg) error->all(FLERR,"Illegal fix widom command"); imol = atom->find_molecule(arg[iarg+1]); if (imol == -1) - error->all(FLERR,"Molecule template ID for fix Widom does not exist"); + error->all(FLERR,"Molecule template ID for fix widom does not exist"); if (atom->molecules[imol]->nset > 1 && comm->me == 0) error->warning(FLERR,"Molecule template for " - "fix Widom has multiple molecules"); + "fix widom has multiple molecules"); exchmode = EXCHMOL; onemols = atom->molecules; nmol = onemols[imol]->nset; iarg += 2; } else if (strcmp(arg[iarg],"region") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix Widom command"); + if (iarg+2 > narg) error->all(FLERR,"Illegal fix widom command"); iregion = domain->find_region(arg[iarg+1]); if (iregion == -1) - error->all(FLERR,"Region ID for fix Widom does not exist"); + error->all(FLERR,"Region ID for fix widom does not exist"); int n = strlen(arg[iarg+1]) + 1; idregion = new char[n]; strcpy(idregion,arg[iarg+1]); regionflag = 1; iarg += 2; } else if (strcmp(arg[iarg],"charge") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix Widom command"); + if (iarg+2 > narg) error->all(FLERR,"Illegal fix widom command"); charge = utils::numeric(FLERR,arg[iarg+1],false,lmp); charge_flag = true; iarg += 2; @@ -238,10 +238,10 @@ void FixWidom::options(int narg, char **arg) full_flag = true; iarg += 1; } else if (strcmp(arg[iarg],"intra_energy") == 0) { - if (iarg+2 > narg) error->all(FLERR,"Illegal fix Widom command"); + if (iarg+2 > narg) error->all(FLERR,"Illegal fix widom command"); energy_intra = utils::numeric(FLERR,arg[iarg+1],false,lmp); iarg += 2; - } else error->all(FLERR,"Illegal fix Widom command"); + } else error->all(FLERR,"Illegal fix widom command"); } } @@ -291,7 +291,7 @@ void FixWidom::init() ) { full_flag = true; if (comm->me == 0) - error->warning(FLERR,"Fix Widom using full_energy option"); + error->warning(FLERR,"Fix widom using full_energy option"); } } @@ -299,7 +299,7 @@ void FixWidom::init() if (exchmode == EXCHATOM) { if (nwidom_type <= 0 || nwidom_type > atom->ntypes) - error->all(FLERR,"Invalid atom type in fix Widom command"); + error->all(FLERR,"Invalid atom type in fix widom command"); } // if molecules are exchanged or moved, check for unset mol IDs @@ -314,17 +314,17 @@ void FixWidom::init() MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world); if (flagall && comm->me == 0) error->all(FLERR, - "All mol IDs should be set for fix Widom group atoms"); + "All mol IDs should be set for fix widom group atoms"); } if (exchmode == EXCHMOL) if (atom->molecule_flag == 0 || !atom->tag_enable || !atom->map_style) error->all(FLERR, - "Fix Widom molecule command requires that " + "Fix widom molecule command requires that " "atoms have molecule attributes"); if (domain->dimension == 2) - error->all(FLERR,"Cannot use fix Widom in a 2d simulation"); + error->all(FLERR,"Cannot use fix widom in a 2d simulation"); // create a new group for interaction exclusions // used for attempted atom or molecule deletions @@ -387,7 +387,7 @@ void FixWidom::init() } else gas_mass = atom->mass[nwidom_type]; if (gas_mass <= 0.0) - error->all(FLERR,"Illegal fix Widom gas mass <= 0"); + error->all(FLERR,"Illegal fix widom gas mass <= 0"); // check that no deletable atoms are in atom->firstgroup // deleting such an atom would not leave firstgroup atoms first @@ -404,7 +404,7 @@ void FixWidom::init() MPI_Allreduce(&flag,&flagall,1,MPI_INT,MPI_SUM,world); if (flagall) - error->all(FLERR,"Cannot do Widom on atoms in atom_modify first group"); + error->all(FLERR,"Cannot use fix widom on atoms in atom_modify first group"); } // compute beta @@ -417,7 +417,7 @@ void FixWidom::init() // full_flag on molecules on more than one processor. // Print error if this is the current mode if (full_flag && (exchmode == EXCHMOL) && comm->nprocs > 1) - error->all(FLERR,"fix Widom does currently not support full_energy option with molecules on more than 1 MPI process."); + error->all(FLERR,"fix widom does currently not support full_energy option with molecules on more than 1 MPI process."); } @@ -535,7 +535,7 @@ void FixWidom::attempt_atomic_insertion() if (triclinic == 0) { domain->remap(coord); if (!domain->inside(coord)) - error->one(FLERR,"Fix Widom put atom outside box"); + error->one(FLERR,"Fix widom put atom outside box"); if (coord[0] >= sublo[0] && coord[0] < subhi[0] && coord[1] >= sublo[1] && coord[1] < subhi[1] && coord[2] >= sublo[2] && coord[2] < subhi[2]) proc_flag = 1; @@ -648,7 +648,7 @@ void FixWidom::attempt_molecule_insertion() xtmp[2] = molcoords[i][2]; domain->remap(xtmp); if (!domain->inside(xtmp)) - error->one(FLERR,"Fix Widom put atom outside box"); + error->one(FLERR,"Fix widom put atom outside box"); procflag[i] = false; if (triclinic == 0) { @@ -737,7 +737,7 @@ void FixWidom::attempt_atomic_insertion_full() if (triclinic == 0) { domain->remap(coord); if (!domain->inside(coord)) - error->one(FLERR,"Fix Widom put atom outside box"); + error->one(FLERR,"Fix widom put atom outside box"); if (coord[0] >= sublo[0] && coord[0] < subhi[0] && coord[1] >= sublo[1] && coord[1] < subhi[1] && coord[2] >= sublo[2] && coord[2] < subhi[2]) proc_flag = 1; @@ -803,7 +803,7 @@ void FixWidom::attempt_molecule_insertion_full() MPI_Allreduce(&maxmol,&maxmol_all,1,MPI_LMP_TAGINT,MPI_MAX,world); maxmol_all++; if (maxmol_all >= MAXTAGINT) - error->all(FLERR,"Fix Widom ran out of available molecule IDs"); + error->all(FLERR,"Fix widom ran out of available molecule IDs"); int insertion_molecule = maxmol_all; tagint maxtag = 0; @@ -883,7 +883,7 @@ void FixWidom::attempt_molecule_insertion_full() imageint imagetmp = imagezero; domain->remap(xtmp,imagetmp); if (!domain->inside(xtmp)) - error->one(FLERR,"Fix Widom put atom outside box"); + error->one(FLERR,"Fix widom put atom outside box"); int proc_flag = 0; if (triclinic == 0) { @@ -904,7 +904,7 @@ void FixWidom::attempt_molecule_insertion_full() atom->image[m] = imagetmp; atom->molecule[m] = insertion_molecule; if (maxtag_all+i+1 >= MAXTAGINT) - error->all(FLERR,"Fix Widom ran out of available atom IDs"); + error->all(FLERR,"Fix widom ran out of available atom IDs"); atom->tag[m] = maxtag_all + i + 1; atom->v[m][0] = 0; atom->v[m][1] = 0; diff --git a/src/USER-EFF/pair_eff_cut.cpp b/src/USER-EFF/pair_eff_cut.cpp index f4e7af6584..72281c4a50 100644 --- a/src/USER-EFF/pair_eff_cut.cpp +++ b/src/USER-EFF/pair_eff_cut.cpp @@ -869,7 +869,7 @@ void PairEffCut::init_style() // make sure to use the appropriate timestep when using real units if (update->whichflag == 1) { - if (force->qqr2e == 332.06371 && update->dt == 1.0) + if (utils::strmatch(update->unit_style,"^real") && update->dt_default) error->all(FLERR,"Must lower the default real units timestep for pEFF "); } diff --git a/src/USER-OMP/msm_cg_omp.cpp b/src/USER-OMP/msm_cg_omp.cpp index c42aa8e0c1..976ea83610 100644 --- a/src/USER-OMP/msm_cg_omp.cpp +++ b/src/USER-OMP/msm_cg_omp.cpp @@ -137,7 +137,7 @@ void MSMCGOMP::compute(int eflag, int vflag) / static_cast(atom->natoms); if (me == 0) - utils::logmesg(MSM::lmp,fmt::format(" MSM/cg optimization cutoff: {:.8g}\n" + utils::logmesg(MSM::lmp,fmt::format(" MSM/cg optimization cutoff: {:.8}\n" " Total charged atoms: {:.1f}%\n" " Min/max charged atoms/proc: {:.1f}%" " {:.1f}%\n",smallq, diff --git a/src/USER-SMD/fix_smd_adjust_dt.cpp b/src/USER-SMD/fix_smd_adjust_dt.cpp index b5dab3d3a1..2acf6bd3ec 100644 --- a/src/USER-SMD/fix_smd_adjust_dt.cpp +++ b/src/USER-SMD/fix_smd_adjust_dt.cpp @@ -186,6 +186,7 @@ void FixSMDTlsphDtReset::end_of_step() { update->dt = dt; + update->dt_default = 0; if (force->pair) force->pair->reset_dt(); for (int i = 0; i < modify->nfix; i++) diff --git a/src/finish.cpp b/src/finish.cpp index 3bfe3a7bbf..c48027feaf 100644 --- a/src/finish.cpp +++ b/src/finish.cpp @@ -202,12 +202,12 @@ void Finish::end(int flag) update->minimize->einitial, update->minimize->eprevious, update->minimize->efinal); - mesg += fmt::format(" Force two-norm initial, final = {} {}\n", + mesg += fmt::format(" Force two-norm initial, final = {:.8} {:.8}\n", update->minimize->fnorm2_init,update->minimize->fnorm2_final); - mesg += fmt::format(" Force max component initial, final = {} {}\n", + mesg += fmt::format(" Force max component initial, final = {:.8} {:.8}\n", update->minimize->fnorminf_init, update->minimize->fnorminf_final); - mesg += fmt::format(" Final line search alpha, max atom move = {} {}\n", + mesg += fmt::format(" Final line search alpha, max atom move = {:.8} {:.8}\n", update->minimize->alpha_final, update->minimize->alpha_final* update->minimize->fnorminf_final); diff --git a/src/fix_dt_reset.cpp b/src/fix_dt_reset.cpp index 360f0d2998..4a9465e696 100644 --- a/src/fix_dt_reset.cpp +++ b/src/fix_dt_reset.cpp @@ -190,6 +190,7 @@ void FixDtReset::end_of_step() update->update_time(); update->dt = dt; + update->dt_default = 0; if (respaflag) update->integrate->reset_dt(); if (force->pair) force->pair->reset_dt(); for (int i = 0; i < modify->nfix; i++) modify->fix[i]->reset_dt(); diff --git a/src/input.cpp b/src/input.cpp index 6456f6c229..3a136cd44b 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -1871,6 +1871,7 @@ void Input::timestep() { if (narg != 1) error->all(FLERR,"Illegal timestep command"); update->dt = utils::numeric(FLERR,arg[0],false,lmp); + update->dt_default = 0; } /* ---------------------------------------------------------------------- */ diff --git a/src/read_data.cpp b/src/read_data.cpp index 2a6801b3a5..c80432f098 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -294,8 +294,11 @@ void ReadData::command(int narg, char **arg) // error checks - if (domain->dimension == 2 && domain->zperiodic == 0) + if ((domain->dimension == 2) && (domain->zperiodic == 0)) error->all(FLERR,"Cannot run 2d simulation with nonperiodic Z dimension"); + if ((domain->nonperiodic == 2) && utils::strmatch(force->kspace_style,"^msm")) + error->all(FLERR,"Reading a data file with shrinkwrap boundaries is " + "not compatible with a MSM KSpace style"); if (domain->box_exist && !addflag) error->all(FLERR,"Cannot read_data without add keyword " "after simulation box is defined"); diff --git a/src/update.cpp b/src/update.cpp index 399584473c..d591e05131 100644 --- a/src/update.cpp +++ b/src/update.cpp @@ -12,18 +12,22 @@ ------------------------------------------------------------------------- */ #include "update.h" -#include -#include "integrate.h" -#include "min.h" + #include "style_integrate.h" // IWYU pragma: keep #include "style_minimize.h" // IWYU pragma: keep -#include "neighbor.h" -#include "force.h" -#include "modify.h" -#include "fix.h" + +#include "comm.h" #include "compute.h" -#include "output.h" +#include "integrate.h" #include "error.h" +#include "fix.h" +#include "force.h" +#include "min.h" +#include "modify.h" +#include "neighbor.h" +#include "output.h" + +#include using namespace LAMMPS_NS; @@ -48,6 +52,7 @@ Update::Update(LAMMPS *lmp) : Pointers(lmp) eflag_global = vflag_global = -1; + dt_default = 1; unit_style = NULL; set_units("lj"); @@ -121,6 +126,8 @@ void Update::set_units(const char *style) // http://physics.nist.gov/cuu/Constants/Table/allascii.txt // using thermochemical calorie = 4.184 J + double dt_old = dt; + if (strcmp(style,"lj") == 0) { force->boltz = 1.0; force->hplanck = 1.0; @@ -295,6 +302,14 @@ void Update::set_units(const char *style) int n = strlen(style) + 1; unit_style = new char[n]; strcpy(unit_style,style); + + // check if timestep was changed from default value + if (!dt_default && (comm->me == 0)) { + error->warning(FLERR,fmt::format("Changing timestep from {:.6} to {:.6} " + "due to changing units to {}", + dt_old, dt, unit_style)); + } + dt_default = 1; } /* ---------------------------------------------------------------------- */ diff --git a/src/update.h b/src/update.h index 558719f4cc..1d1e04b8bd 100644 --- a/src/update.h +++ b/src/update.h @@ -37,6 +37,7 @@ class Update : protected Pointers { int setupflag; // set when setup() is computing forces int post_integrate; // 1 if now at post_integrate() in timestep int multireplica; // 1 if min across replicas, else 0 + int dt_default; // 1 if dt is at default value, else 0 bigint eflag_global,eflag_atom; // timestep global/peratom eng is tallied on bigint vflag_global,vflag_atom; // ditto for virial diff --git a/unittest/force-styles/tests/kspace-msm_nopbc.yaml b/unittest/force-styles/tests/kspace-msm_nopbc.yaml new file mode 100644 index 0000000000..99bbd2ae97 --- /dev/null +++ b/unittest/force-styles/tests/kspace-msm_nopbc.yaml @@ -0,0 +1,90 @@ +--- +lammps_version: 24 Aug 2020 +date_generated: Sat Sep 12 10:33:36 202 +epsilon: 5e-11 +prerequisites: ! | + atom full + pair coul/msm + kspace msm +pre_commands: ! | + boundary f f f +post_commands: ! | + pair_modify compute no + kspace_style msm 1.0e-4 + kspace_modify cutoff/adjust no + kspace_modify pressure/scalar no # required for USER-OMP with msm +input_file: in.fourmol +pair_style: coul/msm 12.0 +pair_coeff: ! | + * * +extract: ! "" +natoms: 29 +init_vdwl: 0 +init_coul: 0 +init_stress: ! |2- + 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 +init_forces: ! |2 + 1 -1.0766173668302007e-01 3.3042340827626349e-01 -2.9550761278746868e-01 + 2 1.4576263044966863e-02 -2.2187776206184587e-01 2.1317727080129803e-01 + 3 -6.2277085668426338e-03 1.1652138650558974e-02 -1.3297461972937180e-02 + 4 2.8786238443846923e-02 -4.5768542246633188e-02 4.9349101662676420e-02 + 5 4.2979655856763686e-02 -5.4082950850616152e-02 5.4543059350179231e-02 + 6 4.0963202143681071e-02 -2.5177829287287617e-01 4.4685026134973971e-01 + 7 4.3752018459624321e-02 2.0781332786234075e-01 -4.5927449533997905e-01 + 8 1.7902097598623774e-02 2.1086807165304489e-01 -4.6243455927005356e-01 + 9 2.0355019954072114e-03 -1.5827691071752098e-01 2.7862824718724422e-01 + 10 -1.9772220824436811e-02 -2.2139108764682804e-02 7.8260376067917345e-02 + 11 -2.9153388383640691e-02 -2.2889984975802833e-02 1.0317906039578388e-01 + 12 1.2922943535921338e-01 9.7734055402007608e-02 -3.1908212769200051e-01 + 13 -5.4703693507262792e-02 -2.6149394426322036e-02 1.0994484599179440e-01 + 14 -4.2988225876533809e-02 -3.0099007171320122e-02 1.0262933028641755e-01 + 15 -3.7590864461845237e-02 -4.4176544191975885e-02 1.0017383244998040e-01 + 16 -1.9816142648538662e-01 -1.0441860078884198e-01 5.3904854977591932e-01 + 17 1.1181429866686794e-01 1.2719867318944633e-01 -4.3015678280050906e-01 + 18 3.1502200306647382e-01 4.1974825623470402e-01 -6.7479886734843464e-01 + 19 -1.6689905496966348e-01 -1.8680268140244130e-01 3.1219145983138630e-01 + 20 -1.5445789535736368e-01 -1.7976356547462513e-01 3.0246182814337153e-01 + 21 4.5519486932419828e-01 2.3683712353345862e-01 -8.7807403931732608e-01 + 22 -2.2220599724324458e-01 -1.2571032291855247e-01 3.9771867786752363e-01 + 23 -1.9325477274003933e-01 -1.2333786894453987e-01 4.0830652757809321e-01 + 24 -1.8286999844561756e-02 8.1021886775407503e-01 -3.7126337318324748e-01 + 25 5.5726795149239679e-02 -3.9672045025447300e-01 2.0847896698971494e-01 + 26 -2.7814896742372048e-02 -4.2032861857567699e-01 1.8697109800153439e-01 + 27 -5.3163776317893185e-01 2.5116155120314121e-01 -4.1286599443776800e-01 + 28 2.9735002262617338e-01 -1.6009440605268385e-01 2.2070546856483822e-01 + 29 2.5561709605369254e-01 -1.2916627825090182e-01 2.0454030119394306e-01 +run_vdwl: 0 +run_coul: 0 +run_stress: ! |2- + 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 0.0000000000000000e+00 +run_forces: ! |2 + 1 -1.0348864007239668e-01 3.2761800817797082e-01 -2.7223154925249687e-01 + 2 1.1547721105281426e-02 -2.2227221129297944e-01 1.9829831292225819e-01 + 3 -6.1369788686855553e-03 1.1473670690755385e-02 -1.2235119385263003e-02 + 4 2.8809534480886322e-02 -4.5070713784827680e-02 4.5263724656363712e-02 + 5 4.2323185781698226e-02 -5.2976717776467216e-02 4.9736627529403242e-02 + 6 3.8194733647326694e-02 -2.4587855825158134e-01 4.1856615868672892e-01 + 7 4.5246314631942265e-02 2.0099417967365288e-01 -4.3512916657147588e-01 + 8 2.2478550451619471e-02 2.0362301286740869e-01 -4.3516590120465981e-01 + 9 -1.4178329999306901e-03 -1.5368030392367521e-01 2.6080100301013964e-01 + 10 -2.0495450209946312e-02 -2.0851530662446178e-02 7.4319850349891012e-02 + 11 -3.0029358892398838e-02 -2.0702279983167187e-02 9.8520949030575691e-02 + 12 1.3289689675296273e-01 9.3775108342107519e-02 -3.0419584939008770e-01 + 13 -5.5922486140088226e-02 -2.4843666409380370e-02 1.0515381624429042e-01 + 14 -4.4208019862361184e-02 -2.8633675987750289e-02 9.8140924300998925e-02 + 15 -3.8534805055538454e-02 -4.3447767456428393e-02 9.5052177465633700e-02 + 16 -2.0197663776900704e-01 -9.6067608908760441e-02 5.1267317994067874e-01 + 17 1.1536172816123620e-01 1.2150176721849106e-01 -4.0576909205923889e-01 + 18 3.2654836490027450e-01 4.3181659922436294e-01 -6.4631937847140064e-01 + 19 -1.7012391318923387e-01 -1.9294196901436866e-01 3.0171461650625692e-01 + 20 -1.6090393021018687e-01 -1.8797301084913640e-01 2.9016061976069074e-01 + 21 4.6464803590088510e-01 2.0966755173124815e-01 -8.4865286121979111e-01 + 22 -2.2714234064511640e-01 -1.1056430229170305e-01 3.8599855632265567e-01 + 23 -1.9865351580467286e-01 -1.1110079780224448e-01 3.9440435138483038e-01 + 24 -1.1755770692492392e-02 7.9361803570205403e-01 -3.4523386783293764e-01 + 25 5.0411795551073120e-02 -3.8916839645964540e-01 1.9278646898979940e-01 + 26 -2.9733815594164319e-02 -4.1142305819442143e-01 1.7495936527287648e-01 + 27 -5.2243746980854566e-01 2.4806539986837281e-01 -3.8666209074075969e-01 + 28 2.9308687168280761e-01 -1.5702803664966208e-01 2.0612286277862657e-01 + 29 2.5153793410884945e-01 -1.2745488321867574e-01 1.8930202039662150e-01 +...