diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index c572d6f27a..911b6f0f15 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -322,7 +322,7 @@ find_package(OpenMP QUIET) # where we assume older GCC semantics. For the time being, we disable OpenMP by default # for GCC 9.x and beyond. People may manually turn it on, but need to run the script # src/USER-OMP/hack_openmp_for_pgi_gcc9.sh on all sources to make it compatible with gcc 9. -if ((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9.0.0)) +if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.99.9)) option(BUILD_OMP "Build with OpenMP support" OFF) else() option(BUILD_OMP "Build with OpenMP support" ${OpenMP_FOUND}) @@ -1134,6 +1134,12 @@ if(PKG_OPT) endif() if(PKG_USER-INTEL) + include(CheckIncludeFile) + check_include_file(immintrin.h FOUND_IMMINTRIN) + if(NOT FOUND_IMMINTRIN) + message(FATAL_ERROR "immintrin.h header not found, Intel package won't work without it") + endif() + add_definitions(-DLMP_USER_INTEL) set(INTEL_ARCH "cpu" CACHE STRING "Architectures used by USER-INTEL (cpu or knl)") diff --git a/doc/lammps.1 b/doc/lammps.1 index 8517abcdd5..f4a801779a 100644 --- a/doc/lammps.1 +++ b/doc/lammps.1 @@ -1,4 +1,4 @@ -.TH LAMMPS "31 May 2019" "2019-05-31" +.TH LAMMPS "5 June 2019" "2019-06-05" .SH NAME .B LAMMPS \- Molecular Dynamics Simulator. diff --git a/doc/src/Commands.txt b/doc/src/Commands.txt index bb3fab3683..bcbbe524a8 100644 --- a/doc/src/Commands.txt +++ b/doc/src/Commands.txt @@ -33,6 +33,11 @@ commands in it are used to define a LAMMPS simulation. Commands_bond Commands_kspace +.. toctree:: + :maxdepth: 1 + + Commands_removed + END_RST --> @@ -49,5 +54,7 @@ END_RST --> "Bond, angle, dihedral, improper commands"_Commands_bond.html "KSpace solvers"_Commands_kspace.html :all(b) +"Removed commands and packages"_Commands_removed.html :all(b) + diff --git a/doc/src/Commands_bond.txt b/doc/src/Commands_bond.txt index 3d889ac08e..40c2d0283a 100644 --- a/doc/src/Commands_bond.txt +++ b/doc/src/Commands_bond.txt @@ -28,8 +28,12 @@ OPT. "none"_bond_none.html, "zero"_bond_zero.html, -"hybrid"_bond_hybrid.html :tb(c=3,ea=c) - +"hybrid"_bond_hybrid.html, +, +, +, +, +, "class2 (ko)"_bond_class2.html, "fene (iko)"_bond_fene.html, "fene/expand (o)"_bond_fene_expand.html, @@ -56,8 +60,12 @@ OPT. "none"_angle_none.html, "zero"_angle_zero.html, -"hybrid"_angle_hybrid.html :tb(c=3,ea=c) - +"hybrid"_angle_hybrid.html, +, +, +, +, +, "charmm (iko)"_angle_charmm.html, "class2 (ko)"_angle_class2.html, "class2/p6"_angle_class2.html, @@ -89,8 +97,12 @@ OPT. "none"_dihedral_none.html, "zero"_dihedral_zero.html, -"hybrid"_dihedral_hybrid.html :tb(c=3,ea=c) - +"hybrid"_dihedral_hybrid.html, +, +, +, +, +, "charmm (iko)"_dihedral_charmm.html, "charmmfsw"_dihedral_charmm.html, "class2 (ko)"_dihedral_class2.html, @@ -117,8 +129,12 @@ OPT. "none"_improper_none.html, "zero"_improper_zero.html, -"hybrid"_improper_hybrid.html :tb(c=3,ea=c) - +"hybrid"_improper_hybrid.html, +, +, +, +, +, "class2 (ko)"_improper_class2.html, "cossq (o)"_improper_cossq.html, "cvff (io)"_improper_cvff.html, diff --git a/doc/src/Commands_pair.txt b/doc/src/Commands_pair.txt index e9925b0e0b..fea085b4ed 100644 --- a/doc/src/Commands_pair.txt +++ b/doc/src/Commands_pair.txt @@ -27,8 +27,11 @@ OPT. "none"_pair_none.html, "zero"_pair_zero.html, "hybrid (k)"_pair_hybrid.html, -"hybrid/overlay (k)"_pair_hybrid.html :tb(c=4,ea=c) - +"hybrid/overlay (k)"_pair_hybrid.html, +, +, +, +, "adp (o)"_pair_adp.html, "agni (o)"_pair_agni.html, "airebo (io)"_pair_airebo.html, diff --git a/doc/src/Commands_removed.txt b/doc/src/Commands_removed.txt new file mode 100644 index 0000000000..1eee6e45e0 --- /dev/null +++ b/doc/src/Commands_removed.txt @@ -0,0 +1,66 @@ +"Higher level section"_Commands.html - "LAMMPS WWW Site"_lws - "LAMMPS +Documentation"_ld - "LAMMPS Commands"_lc :c + +:link(lws,http://lammps.sandia.gov) +:link(ld,Manual.html) +:link(lc,Commands.html) + +:line + +Removed commands and packages :h3 + +This page lists LAMMPS commands and packages that have been removed from +the distribution and provides suggestions for alternatives or replacements. +LAMMPS has special dummy styles implemented, that will stop LAMMPS and +print a suitable error message in most cases, when a style/command is used +that has been removed. + +Fix ave/spatial and fix ave/spatial/sphere :h4 + +The fixes ave/spatial and ave/spatial/sphere have been removed from LAMMPS +since they were superseded by the more general and extensible "chunk +infrastructure". Here the system is partitioned in one of many possible +ways through the "compute chunk/atom"_compute_chunk_atom.html command +and then averaging is done using "fix ave/chunk"_fix_ave_chunk.html. +Please refer to the "chunk HOWTO"_Howto_chunk.html section for an overview. + +MEAM package :h4 + +The MEAM package has been removed since it was superseded by the +"USER-MEAMC package"_Package_details.html#PKG-USER-MEAMC. The code in +the USER-MEAMC package is a translation of the Fortran code of MEAM into C++, +which removes several restrictions (e.g. there can be multiple instances +in hybrid pair styles) and allows for some optimizations leading +to better performance. The new pair style "meam/c"_pair_meamc.html has +the exact same syntax as the old "meam" pair style and thus pair style +"meam"_pair_meamc.html is an alias to the new style and backward +compatibility of old inputs is preserved. + +REAX package :h4 + +The REAX package has been removed since it was superseded by the +"USER-REAXC package"_Package_details.html#PKG-USER-REAXC. The USER-REAXC +package has been tested to yield equivalent results to the REAX package, +offers better performance, supports OpenMP multi-threading via USER-OMP, +and GPU and threading parallelization through KOKKOS. The new pair styles +are not syntax compatible with the removed reax pair style, so input +files will have to be adapted. + +USER-CUDA package :h4 + +The USER-CUDA package had been removed, since it had been unmaintained +for a long time and had known bugs and problems. Significant parts of +the design were transferred to the +"KOKKOS package"_Package_details.html#PKG-KOKKOS, which has similar +performance characteristics on Nvidia GPUs. Both, the KOKKOS +and the "GPU package"_Package_details.html#PKG-GPU are maintained +and allow running LAMMPS with GPU acceleration. + +restart2data tool :h4 + +The functionality of the restart2data tool has been folded into the +LAMMPS executable directly instead of having a separate tool. A +combination of the commands "read_restart"_read_restart.html and +"write_data"_write_data.html can be used to the same effect. For added +convenience this conversion can also be triggered by "command line +flags"_Run_options.html diff --git a/doc/src/Errors_messages.txt b/doc/src/Errors_messages.txt index 28bf3ab9b9..7249bfddfd 100644 --- a/doc/src/Errors_messages.txt +++ b/doc/src/Errors_messages.txt @@ -610,6 +610,62 @@ This means there is something invalid about the topology definitions. :dd The data file header lists bonds but no bond types. :dd +{Bond/react: Cannot use fix bond/react with non-molecular systems} :dt + +Only systems with bonds that can be changed can be used. Atom_style +template does not qualify. :dd + +{Bond/react: Rmax cutoff is longer than pairwise cutoff} :dt + +This is not allowed because bond creation is done using the pairwise +neighbor list. :dd + +{Bond/react: Molecule template ID for fix bond/react does not exist} :dt + +A valid molecule template must have been created with the molecule +command. :dd + +{Bond/react: Reaction templates must contain the same number of atoms} :dt + +There should be a one-to-one correspondence between atoms in the +pre-reacted and post-reacted templates, as specified by the map file. :dd + +{Bond/react: Unknown section in map file} :dt + +Please ensure reaction map files are properly formatted. :dd + +{Bond/react: Atom affected by reaction too close to template edge} :dt + +This means an atom which changes type during the reaction is too close +to an 'edge' atom defined in the superimpose file. This could cause +incorrect assignment of bonds, angle, etc. Generally, this means you +must include more atoms in your templates, such that there are at +least two atoms between each atom involved in the reaction and an edge +atom. :dd + +{Bond/react: Fix bond/react needs ghost atoms from farther away} :dt + +This is because a processor needs to superimpose the entire unreacted +molecule template onto simulation atoms it knows about. The +comm_modify cutoff command can be used to extend the communication +range. :dd + +{Bond/react: A deleted atom cannot remain bonded to an atom that is not deleted} :dt + +Self-explanatory. :dd + +{Bond/react special bond generation overflow} :dt + +The number of special bonds per-atom created by a reaction exceeds the +system setting. See the read_data or create_box command for how to +specify this value. :dd + +{Bond/react topology/atom exceed system topology/atom} :dt + +The number of bonds, angles etc per-atom created by a reaction exceeds +the system setting. See the read_data or create_box command for how to +specify this value. :dd + {Both restart files must use % or neither} :dt Self-explanatory. :dd @@ -7041,6 +7097,18 @@ Self-explanatory. :dd One or more GPUs must be used when Kokkos is compiled for CUDA. :dd +{Kspace_modify mesh parameter must be all zero or all positive} :dt + +Valid kspace mesh parameters are >0. The code will try to auto-detect +suitable values when all three mesh sizes are set to zero (the default). :dd + +{Kspace_modify mesh/disp parameter must be all zero or all positive} :dt + +Valid kspace mesh/disp parameters are >0. The code will try to auto-detect +suitable values when all three mesh sizes are set to zero [and] +the required accuracy via {force/disp/real} as well as +{force/disp/kspace} is set. :dd + {Kspace style does not support compute group/group} :dt Self-explanatory. :dd diff --git a/doc/src/Errors_warnings.txt b/doc/src/Errors_warnings.txt index 47dd597af8..164a29e21d 100644 --- a/doc/src/Errors_warnings.txt +++ b/doc/src/Errors_warnings.txt @@ -82,6 +82,11 @@ bond/angle/dihedral. LAMMPS computes this by taking the maximum bond length, multiplying by the number of bonds in the interaction (e.g. 3 for a dihedral) and adding a small amount of stretch. :dd +{Bond/react: An atom in 'react #%d' changes bond connectivity but not atom type} :dt + +You may want to double-check that all atom types are properly assigned +in the post-reaction template. :dd + {Both groups in compute group/group have a net charge; the Kspace boundary correction to energy will be non-zero} :dt Self-explanatory. :dd diff --git a/doc/src/Manual.txt b/doc/src/Manual.txt index 0fb707746c..2fa9623f36 100644 --- a/doc/src/Manual.txt +++ b/doc/src/Manual.txt @@ -1,7 +1,7 @@ LAMMPS Users Manual - + @@ -21,7 +21,7 @@ :line LAMMPS Documentation :c,h1 -31 May 2019 version :c,h2 +5 Jun 2019 version :c,h2 "What is a LAMMPS version?"_Manual_version.html diff --git a/doc/src/fix_bond_react.txt b/doc/src/fix_bond_react.txt index af443ede92..34f0e6daf7 100644 --- a/doc/src/fix_bond_react.txt +++ b/doc/src/fix_bond_react.txt @@ -18,8 +18,8 @@ fix ID group-ID bond/react common_keyword values ... ID, group-ID are documented in "fix"_fix.html command. Group-ID is ignored. :ulb,l bond/react = style name of this fix command :l -zero or more common keyword/value pairs may be appended directly after 'bond/react' :l -these apply to all reaction specifications (below) :l +the common keyword/values may be appended directly after 'bond/react' :l +this applies to all reaction specifications (below) :l common_keyword = {stabilization} :l {stabilization} values = {no} or {yes} {group-ID} {xmax} {no} = no reaction site stabilization @@ -136,10 +136,12 @@ words, can be customized for each reaction, or reaction step): A check for possible new reaction sites is performed every {Nevery} timesteps. -Two conditions must be met for a reaction to occur. First a bonding -atom pair must be identified. Second, the topology surrounding the -bonding atom pair must match the topology of the pre-reaction -template. If both these conditions are met, the reaction site is +Three physical conditions must be met for a reaction to occur. First, +a bonding atom pair must be identified within the reaction distance +cutoffs. Second, the topology surrounding the bonding atom pair must +match the topology of the pre-reaction template. Finally, any reaction +constraints listed in the map file (see below) must be satisfied. If +all of these conditions are met, the reaction site is eligible to be modified to match the post-reaction template. A bonding atom pair will be identified if several conditions are met. @@ -203,14 +205,24 @@ new types must also be defined during the setup of a given simulation. A discussion of correctly handling this is also provided on the "molecule"_molecule.html command page. +NOTE: When a reaction occurs, it is possible that the resulting +topology/atom (e.g. special bonds, dihedrals, etc.) exceeds that of +the existing system and reaction templates. As when inserting +molecules, enough space for this increased topology/atom must be +reserved by using the relevant "extra" keywords to the +"read_data"_read_data.html or "create_box"_create_box.html commands. + The map file is a text document with the following format: A map file has a header and a body. The header of map file the -contains one mandatory keyword and three optional keywords. The -mandatory keyword is 'equivalences' and the optional keywords are -'edgeIDs' and 'deleteIDs' and 'customIDs': +contains one mandatory keyword and four optional keywords. The +mandatory keyword is 'equivalences': + +N {equivalences} = # of atoms N in the reaction molecule templates :pre + +The optional keywords are 'edgeIDs', 'deleteIDs', 'customIDs' and +'constraints': -N {equivalences} = # of atoms N in the reaction molecule templates N {edgeIDs} = # of edge atoms N in the pre-reacted molecule template N {deleteIDs} = # of atoms N that are specified for deletion N {customIDs} = # of atoms N that are specified for a custom update @@ -244,8 +256,8 @@ A sample map file is given below: # this is a map file :pre -2 edgeIDs -7 equivalences :pre +7 equivalences +2 edgeIDs :pre BondingIDs :pre @@ -297,26 +309,25 @@ can allow for the possibility of one or more reverse reactions. The optional keywords deal with the probability of a given reaction occurring as well as the stable equilibration of each reaction site as -it occurs. +it occurs: -The {prob} keyword can affect whether an eligible reaction actually -occurs. The fraction setting must be a value between 0.0 and 1.0. A -uniform random number between 0.0 and 1.0 is generated and the +The {prob} keyword can affect whether or not an eligible reaction +actually occurs. The fraction setting must be a value between 0.0 and +1.0. A uniform random number between 0.0 and 1.0 is generated and the eligible reaction only occurs if the random number is less than the fraction. Up to N reactions are permitted to occur, as optionally specified by the {max_rxn} keyword. The {stabilize_steps} keyword allows for the specification of how many timesteps a reaction site is stabilized before being returned to the -overall system thermostat. - -In order to produce the most physical behavior, this 'reaction site -equilibration time' should be tuned to be as small as possible while -retaining stability for a given system or reaction step. After a -limited number of case studies, this number has been set to a default -of 60 timesteps. Ideally, it should be individually tuned for each fix -reaction step. Note that in some situations, decreasing rather than -increasing this parameter will result in an increase in stability. +overall system thermostat. In order to produce the most physical +behavior, this 'reaction site equilibration time' should be tuned to +be as small as possible while retaining stability for a given system +or reaction step. After a limited number of case studies, this number +has been set to a default of 60 timesteps. Ideally, it should be +individually tuned for each fix reaction step. Note that in some +situations, decreasing rather than increasing this parameter will +result in an increase in stability. The {update_edges} keyword can increase the number of atoms whose atomic charges are updated, when the pre-reaction template contains @@ -324,11 +335,11 @@ edge atoms. When the value is set to 'charges,' all atoms' atomic charges are updated to those specified by the post-reaction template, including atoms near the edge of reaction templates. When the value is set to 'custom,' an additional section must be included in the map -file that specifies whether to update charges, on a per-atom basis. -The format of this section is detailed above. Listing a pre-reaction -atom ID with a value of 'charges' will force the update of the atom's -charge, even if it is near a template edge. Atoms not near a template -edge are unaffected by this setting. +file that specifies whether or not to update charges, on a per-atom +basis. The format of this section is detailed above. Listing a +pre-reaction atom ID with a value of 'charges' will force the update +of the atom's charge, even if it is near a template edge. Atoms not +near a template edge are unaffected by this setting. A few other considerations: diff --git a/doc/src/pair_e3b.txt b/doc/src/pair_e3b.txt index fe4349a57d..6d1f992ca1 100644 --- a/doc/src/pair_e3b.txt +++ b/doc/src/pair_e3b.txt @@ -99,7 +99,7 @@ This pair style does not support the "pair_modify"_pair_modify.html shift, table, and tail options. This pair style does not write its information to "binary restart -files"_restart.html, since it is stored in potential files. Thus, you +files"_restart.html. Thus, you need to re-specify the pair_style and pair_coeff commands in an input script that reads a restart file. diff --git a/doc/src/variable.txt b/doc/src/variable.txt index 7951ecfb86..b545f6cee2 100644 --- a/doc/src/variable.txt +++ b/doc/src/variable.txt @@ -875,7 +875,7 @@ The {is_active()} function allows to query for active settings which are grouped by categories. Currently supported categories and arguments are: -{package} (argument = {cuda} or {gpu} or {intel} or {kokkos} or {omp}) +{package} (argument = {gpu} or {intel} or {kokkos} or {omp}) {newton} (argument = {pair} or {bond} or {any}) {pair} (argument = {single} or {respa} or {manybody} or {tail} or {shift}) {comm_style} (argument = {brick} or {tiled}) @@ -904,7 +904,7 @@ kspace_style pppm :pre Example 2: use r-RESPA with inner/outer cutoff, if supported by pair style, otherwise fall back to using pair and reducing the outer time step -timestep $(2.0*(1.0+*is_active(pair,respa)) +timestep $(2.0*(1.0+2.0*is_active(pair,respa)) if $(is_active(pair,respa)) then "run_style respa 4 3 2 2 improper 1 inner 2 5.5 7.0 outer 3 kspace 4" else "run_style respa 3 3 2 improper 1 pair 2 kspace 3" :pre The {is_defined()} function allows to query categories like {compute}, diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index 867d3028c6..7b7c4d11b2 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -2844,6 +2844,7 @@ unoptimized unpadded unphysical unphysically +unreacted unscaled unsets unsmoothed diff --git a/src/Makefile b/src/Makefile index 2e6ad9a89f..d611adc404 100644 --- a/src/Makefile +++ b/src/Makefile @@ -154,7 +154,6 @@ help: lmpinstalledpkgs.h: $(SRC) $(INC) - @echo 'Gathering installed package information (may take a little while)' @echo '#ifndef LMP_INSTALLED_PKGS_H' > ${TMPNAME}.lmpinstalled @echo '#define LMP_INSTALLED_PKGS_H' >> ${TMPNAME}.lmpinstalled @echo 'const char * LAMMPS_NS::LAMMPS::installed_packages[] = {' >> ${TMPNAME}.lmpinstalled @@ -204,6 +203,7 @@ gitversion: @test -f MAKE/Makefile.$@ -o -f MAKE/OPTIONS/Makefile.$@ -o \ -f MAKE/MACHINES/Makefile.$@ -o -f MAKE/MINE/Makefile.$@ @if [ ! -d $(objdir) ]; then mkdir $(objdir); fi + @echo 'Gathering installed package information (may take a little while)' @$(SHELL) Make.sh style @$(SHELL) Make.sh packages @$(MAKE) $(MFLAGS) lmpinstalledpkgs.h gitversion diff --git a/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp b/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp index 6410f83fa1..275486d1e2 100644 --- a/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp +++ b/src/USER-FEP/pair_lj_class2_coul_long_soft.cpp @@ -74,7 +74,6 @@ void PairLJClass2CoulLongSoft::compute(int eflag, int vflag) { int i,j,ii,jj,inum,jnum,itype,jtype; double qtmp,xtmp,ytmp,ztmp,delx,dely,delz,evdwl,ecoul,fpair; - double fraction; double rsq,r,forcecoul,forcelj; double grij,expm2,prefactor,t,erfc; double factor_coul,factor_lj; @@ -490,7 +489,7 @@ double PairLJClass2CoulLongSoft::single(int i, int j, int itype, int jtype, double &fforce) { double denc,r,denlj,r4sig6,grij,expm2,t,erfc,prefactor; - double fraction,forcecoul,forcelj,phicoul,philj; + double forcecoul,forcelj,phicoul,philj; if (rsq < cut_coulsq) { r = sqrt(rsq); diff --git a/src/USER-MISC/fix_bond_react.cpp b/src/USER-MISC/fix_bond_react.cpp index 5d624ad7f4..7e2a228992 100644 --- a/src/USER-MISC/fix_bond_react.cpp +++ b/src/USER-MISC/fix_bond_react.cpp @@ -308,8 +308,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : onemol->check_attributes(0); twomol->check_attributes(0); if (onemol->natoms != twomol->natoms) - error->all(FLERR,"Post-reacted template must contain the same " - "number of atoms as the pre-reacted template"); + error->all(FLERR,"Bond/react: Reaction templates must contain the same number of atoms"); get_molxspecials(); read(i); fclose(fp); @@ -324,7 +323,7 @@ FixBondReact::FixBondReact(LAMMPS *lmp, int narg, char **arg) : delete [] files; if (atom->molecular != 1) - error->all(FLERR,"Cannot use fix bond/react with non-molecular systems"); + error->all(FLERR,"Bond/react: Cannot use fix bond/react with non-molecular systems"); // check if bonding atoms are 1-2, 1-3, or 1-4 bonded neighbors // if so, we don't need non-bonded neighbor list @@ -472,17 +471,19 @@ FixBondReact::~FixBondReact() delete [] guess_branch; delete [] pioneer_count; - char **newarg; - newarg = new char*[2]; - newarg[0] = master_group; - newarg[1] = (char *) "delete"; - group->assign(2,newarg); - if (stabilization_flag == 1) { - newarg[0] = exclude_group; + if (group) { + char **newarg; + newarg = new char*[2]; + newarg[0] = master_group; + newarg[1] = (char *) "delete"; group->assign(2,newarg); - delete [] exclude_group; + if (stabilization_flag == 1) { + newarg[0] = exclude_group; + group->assign(2,newarg); + delete [] exclude_group; + } + delete [] newarg; } - delete [] newarg; } /* ---------------------------------------------------------------------- */ @@ -663,7 +664,7 @@ void FixBondReact::init() // check cutoff for iatomtype,jatomtype for (int i = 0; i < nreacts; i++) { if (force->pair == NULL || cutsq[i][1] > force->pair->cutsq[iatomtype[i]][jatomtype[i]]) - error->all(FLERR,"Fix bond/react cutoff is longer than pairwise cutoff"); + error->all(FLERR,"Bond/react: Fix bond/react cutoff is longer than pairwise cutoff"); } // need a half neighbor list, built every Nevery steps @@ -1172,7 +1173,7 @@ void FixBondReact::superimpose_algorithm() // let's go ahead and catch the simplest of hangs //if (hang_catch > onemol->natoms*4) if (hang_catch > atom->nlocal*30) { - error->one(FLERR,"Excessive iteration of superimpose algorithm"); + error->one(FLERR,"Bond/react: Excessive iteration of superimpose algorithm"); } } } @@ -1285,7 +1286,7 @@ void FixBondReact::make_a_guess() for (int i = 0; i < nxspecial[atom->map(glove[pion][1])][0]; i++) { if (atom->map(xspecial[atom->map(glove[pion][1])][i]) < 0) { - error->all(FLERR,"Fix bond/react needs ghost atoms from further away1"); // parallel issues. + error->all(FLERR,"Bond/react: Fix bond/react needs ghost atoms from further away1"); // parallel issues. } if (i_limit_tags[(int)atom->map(xspecial[atom->map(glove[pion][1])][i])] != 0) { status = GUESSFAIL; @@ -1396,7 +1397,7 @@ void FixBondReact::check_a_neighbor() //another check for ghost atoms. perhaps remove the one in make_a_guess if (atom->map(glove[(int)onemol_xspecial[pion][neigh]-1][1]) < 0) { - error->all(FLERR,"Fix bond/react needs ghost atoms from further away2"); + error->all(FLERR,"Bond/react: Fix bond/react needs ghost atoms from further away2"); } for (int j = 0; j < onemol_nxspecial[onemol_xspecial[pion][neigh]-1][0]; j++) { @@ -1448,7 +1449,7 @@ void FixBondReact::check_a_neighbor() //another check for ghost atoms. perhaps remove the one in make_a_guess if (atom->map(glove[(int)onemol_xspecial[pion][neigh]-1][1]) < 0) { - error->all(FLERR,"Fix bond/react needs ghost atoms from further away3"); + error->all(FLERR,"Bond/react: Fix bond/react needs ghost atoms from further away3"); } for (int ii = 0; ii < onemol_nxspecial[onemol_xspecial[pion][neigh]-1][0]; ii++) { @@ -1490,7 +1491,7 @@ void FixBondReact::crosscheck_the_neighbor() glove[onemol_xspecial[pion][trace]-1][0] == 0) { if (avail_guesses == MAXGUESS) { - error->warning(FLERR,"Fix bond/react failed because MAXGUESS set too small. ask developer for info"); + error->warning(FLERR,"Bond/react: Fix bond/react failed because MAXGUESS set too small. ask developer for info"); status = GUESSFAIL; return; } @@ -1559,7 +1560,7 @@ void FixBondReact::inner_crosscheck_loop() //another check for ghost atoms. perhaps remove the one in make_a_guess if (atom->map(glove[(int)onemol_xspecial[pion][neigh]-1][1]) < 0) { - error->all(FLERR,"Fix bond/react needs ghost atoms from further away4"); + error->all(FLERR,"Bond/react: Fix bond/react needs ghost atoms from further away4"); } if (guess_branch[avail_guesses-1] == 0) avail_guesses--; @@ -1720,7 +1721,7 @@ void FixBondReact::find_landlocked_atoms(int myrxn) // if atoms change types, but aren't landlocked, that's bad for (int i = 0; i < twomol->natoms; i++) { if (twomol->type[i] != onemol->type[equivalences[i][1][myrxn]-1] && landlocked_atoms[i][myrxn] == 0) - error->one(FLERR,"Atom affected by reaction too close to template edge"); + error->one(FLERR,"Bond/react: Atom affected by reaction too close to template edge"); } // additionally, if a bond changes type, but neither involved atom is landlocked, bad @@ -1736,7 +1737,7 @@ void FixBondReact::find_landlocked_atoms(int myrxn) onemol_batom = onemol->bond_atom[onemol_atomi-1][m]; if (onemol_batom == equivalences[twomol_atomj-1][1][myrxn]) { if (twomol->bond_type[i][j] != onemol->bond_type[onemol_atomi-1][m]) { - error->one(FLERR,"Bond type affected by reaction too close to template edge"); + error->one(FLERR,"Bond/react: Bond type affected by reaction too close to template edge"); } } } @@ -1746,7 +1747,7 @@ void FixBondReact::find_landlocked_atoms(int myrxn) onemol_batom = onemol->bond_atom[onemol_atomj-1][m]; if (onemol_batom == equivalences[i][1][myrxn]) { if (twomol->bond_type[i][j] != onemol->bond_type[onemol_atomj-1][m]) { - error->one(FLERR,"Bond type affected by reaction too close to template edge"); + error->one(FLERR,"Bond/react: Bond type affected by reaction too close to template edge"); } } } @@ -1762,7 +1763,7 @@ void FixBondReact::find_landlocked_atoms(int myrxn) int ii = reverse_equiv[i][1][myrxn] - 1; for (int j = 0; j < twomol_nxspecial[ii][0]; j++) { if (delete_atoms[equivalences[twomol_xspecial[ii][j]-1][1][myrxn]-1][myrxn] == 0) { - error->one(FLERR,"A deleted atom cannot remain bonded to an atom that is not deleted"); + error->one(FLERR,"Bond/react: A deleted atom cannot remain bonded to an atom that is not deleted"); } } } @@ -1773,7 +1774,7 @@ void FixBondReact::find_landlocked_atoms(int myrxn) for (int i = 0; i < twomol->natoms; i++) { if (twomol_nxspecial[i][0] != onemol_nxspecial[equivalences[i][1][myrxn]-1][0] && landlocked_atoms[i][myrxn] == 0) { char str[128]; - sprintf(str,"An atom in 'react #%d' changes bond connectivity but not atom type",myrxn+1); + sprintf(str,"Bond/react: An atom in 'react #%d' changes bond connectivity but not atom type",myrxn+1); error->warning(FLERR,str); break; } @@ -2261,7 +2262,7 @@ void FixBondReact::update_everything() if (landlocked_atoms[j][rxnID] == 1) { for (int k = 0; k < nspecial[atom->map(update_mega_glove[jj+1][i])][2]; k++) { if (atom->map(special[atom->map(update_mega_glove[jj+1][i])][k]) < 0) { - error->all(FLERR,"Fix bond/react needs ghost atoms from further away - most likely too many processors"); + error->all(FLERR,"Bond/react: Fix bond/react needs ghost atoms from further away - most likely too many processors"); } } } @@ -2322,6 +2323,8 @@ void FixBondReact::update_everything() nspecial[atom->map(update_mega_glove[jj+1][i])][1]++; nspecial[atom->map(update_mega_glove[jj+1][i])][2]++; } + if (nspecial[atom->map(update_mega_glove[jj+1][i])][2] > atom->maxspecial) + error->one(FLERR,"Bond/react special bond generation overflow"); for (int n = nspecial[atom->map(update_mega_glove[jj+1][i])][2]-1; n > insert_num; n--) { special[atom->map(update_mega_glove[jj+1][i])][n] = special[atom->map(update_mega_glove[jj+1][i])][n-1]; } @@ -2383,6 +2386,8 @@ void FixBondReact::update_everything() bond_type[atom->map(update_mega_glove[jj+1][i])][insert_num] = twomol->bond_type[j][p]; bond_atom[atom->map(update_mega_glove[jj+1][i])][insert_num] = update_mega_glove[equivalences[twomol->bond_atom[j][p]-1][1][rxnID]][i]; num_bond[atom->map(update_mega_glove[jj+1][i])]++; + if (num_bond[atom->map(update_mega_glove[jj+1][i])] > atom->bond_per_atom) + error->one(FLERR,"Bond/react topology/atom exceed system topology/atom"); delta_bonds++; } } @@ -2457,6 +2462,8 @@ void FixBondReact::update_everything() angle_atom2[atom->map(update_mega_glove[jj+1][i])][insert_num] = update_mega_glove[equivalences[twomol->angle_atom2[j][p]-1][1][rxnID]][i]; angle_atom3[atom->map(update_mega_glove[jj+1][i])][insert_num] = update_mega_glove[equivalences[twomol->angle_atom3[j][p]-1][1][rxnID]][i]; num_angle[atom->map(update_mega_glove[jj+1][i])]++; + if (num_angle[atom->map(update_mega_glove[jj+1][i])] > atom->angle_per_atom) + error->one(FLERR,"Bond/react topology/atom exceed system topology/atom"); delta_angle++; } } @@ -2538,6 +2545,8 @@ void FixBondReact::update_everything() dihedral_atom3[atom->map(update_mega_glove[jj+1][i])][insert_num] = update_mega_glove[equivalences[twomol->dihedral_atom3[j][p]-1][1][rxnID]][i]; dihedral_atom4[atom->map(update_mega_glove[jj+1][i])][insert_num] = update_mega_glove[equivalences[twomol->dihedral_atom4[j][p]-1][1][rxnID]][i]; num_dihedral[atom->map(update_mega_glove[jj+1][i])]++; + if (num_dihedral[atom->map(update_mega_glove[jj+1][i])] > atom->dihedral_per_atom) + error->one(FLERR,"Bond/react topology/atom exceed system topology/atom"); delta_dihed++; } } @@ -2619,6 +2628,8 @@ void FixBondReact::update_everything() improper_atom3[atom->map(update_mega_glove[jj+1][i])][insert_num] = update_mega_glove[equivalences[twomol->improper_atom3[j][p]-1][1][rxnID]][i]; improper_atom4[atom->map(update_mega_glove[jj+1][i])][insert_num] = update_mega_glove[equivalences[twomol->improper_atom4[j][p]-1][1][rxnID]][i]; num_improper[atom->map(update_mega_glove[jj+1][i])]++; + if (num_improper[atom->map(update_mega_glove[jj+1][i])] > atom->improper_per_atom) + error->one(FLERR,"Bond/react topology/atom exceed system topology/atom"); delta_imprp++; } } @@ -2716,7 +2727,7 @@ void FixBondReact::read(int myrxn) // skip 1st line of file eof = fgets(line,MAXLINE,fp); - if (eof == NULL) error->one(FLERR,"Unexpected end of superimpose file"); + if (eof == NULL) error->one(FLERR,"Bond/react: Unexpected end of superimpose file"); // read header lines // skip blank lines or lines that start with "#" @@ -2770,7 +2781,7 @@ void FixBondReact::read(int myrxn) DeleteAtoms(line, myrxn); } else if (strcmp(keyword,"Constraints") == 0) { Constraints(line, myrxn); - } else error->one(FLERR,"Unknown section in superimpose file"); + } else error->one(FLERR,"Bond/react: Unknown section in map file"); parse_keyword(1,line,keyword); @@ -2778,13 +2789,13 @@ void FixBondReact::read(int myrxn) // error check if (bondflag == 0 || equivflag == 0) - error->all(FLERR,"Superimpose file missing BondingIDs or Equivalences section\n"); + error->all(FLERR,"Bond/react: Map file missing BondingIDs or Equivalences section\n"); if (update_edges_flag[myrxn] == 2 && customedgesflag == 0) - error->all(FLERR,"Map file must have a Custom Edges section when using 'update_edges custom'\n"); + error->all(FLERR,"Bond/react: Map file must have a Custom Edges section when using 'update_edges custom'\n"); if (update_edges_flag[myrxn] != 2 && customedgesflag == 1) - error->all(FLERR,"Specify 'update_edges custom' to include Custom Edges section in map file\n"); + error->all(FLERR,"Bond/react: Specify 'update_edges custom' to include Custom Edges section in map file\n"); } void FixBondReact::EdgeIDs(char *line, int myrxn) @@ -2830,7 +2841,7 @@ void FixBondReact::CustomEdges(char *line, int myrxn) else if (strcmp(edgemode,"charges") == 0) custom_edges[tmp-1][myrxn] = 1; else - error->one(FLERR,"Illegal value in 'Custom Edges' section of map file"); + error->one(FLERR,"Bond/react: Illegal value in 'Custom Edges' section of map file"); } delete [] edgemode; } @@ -2861,7 +2872,7 @@ void FixBondReact::Constraints(char *line, int myrxn) constraints[myrxn][3] = tmp[2]*tmp[2]; // using square of distance constraints[myrxn][4] = tmp[3]*tmp[3]; } else - error->one(FLERR,"Illegal constraint type in 'Constraints' section of map file"); + error->one(FLERR,"Bond/react: Illegal constraint type in 'Constraints' section of map file"); } delete [] constraint_type; } @@ -2871,7 +2882,7 @@ void FixBondReact::open(char *file) fp = fopen(file,"r"); if (fp == NULL) { char str[128]; - snprintf(str,128,"Cannot open superimpose file %s",file); + snprintf(str,128,"Bond/react: Cannot open map file %s",file); error->one(FLERR,str); } } @@ -2884,7 +2895,7 @@ void FixBondReact::readline(char *line) else n = strlen(line) + 1; } MPI_Bcast(&n,1,MPI_INT,0,world); - if (n == 0) error->all(FLERR,"Unexpected end of superimpose file"); + if (n == 0) error->all(FLERR,"Bond/react: Unexpected end of map file"); MPI_Bcast(line,n,MPI_CHAR,0,world); } diff --git a/src/USER-MISC/fix_bond_react.h b/src/USER-MISC/fix_bond_react.h index 74d53b8f21..36fc13ae21 100644 --- a/src/USER-MISC/fix_bond_react.h +++ b/src/USER-MISC/fix_bond_react.h @@ -189,47 +189,65 @@ Self-explanatory. Check the input script syntax and compare to the documentation for the command. You can use -echo screen as a command-line option when running LAMMPS to see the offending line. -E: Invalid exclude group name +E: Bond/react: Cannot use fix bond/react with non-molecular systems -Exclude group name should not previously be defined. - -E: Cannot use fix bond/react with non-molecular systems - -Only systems with bonds that can be changed can be used. Atom_style +Only systems with bonds that can be changed can be used. Atom_style template does not qualify. -E: Fix bond/react cutoff is longer than pairwise cutoff +E: Bond/react: Rmax cutoff is longer than pairwise cutoff -This is not allowed because bond creation is done using the -pairwise neighbor list. +This is not allowed because bond creation is done using the pairwise +neighbor list. -E: Molecule template ID for fix bond/react does not exist +E: Bond/react: Molecule template ID for fix bond/react does not exist -A valid molecule template must have been created with the molecule command. +A valid molecule template must have been created with the molecule +command. -E: Superimpose file errors: +E: Bond/react: Reaction templates must contain the same number of atoms -Please ensure superimpose file is properly formatted. +There should be a one-to-one correspondence between atoms in the +pre-reacted and post-reacted templates, as specified by the map file. -E: Atom affected by reaction too close to template edge +E: Bond/react: Unknown section in map file + +Please ensure reaction map files are properly formatted. + +E: Bond/react: Atom affected by reaction too close to template edge This means an atom which changes type during the reaction is too close -to an 'edge' atom defined in the superimpose file. This could cause incorrect -assignment of bonds, angle, etc. Generally, this means you must include -more atoms in your templates, such that there are at least two atoms -between each atom involved in the reaction and an edge atom. +to an 'edge' atom defined in the superimpose file. This could cause +incorrect assignment of bonds, angle, etc. Generally, this means you +must include more atoms in your templates, such that there are at +least two atoms between each atom involved in the reaction and an edge +atom. -E: Fix bond/react needs ghost atoms from farther away +E: Bond/react: Fix bond/react needs ghost atoms from farther away This is because a processor needs to superimpose the entire unreacted -molecule template onto simulation atoms it can 'see.' The comm_modify cutoff -command can be used to extend the communication range. +molecule template onto simulation atoms it knows about. The +comm_modify cutoff command can be used to extend the communication +range. -E: Excessive iteration of superimpose algorithm +E: Bond/react: A deleted atom cannot remain bonded to an atom that is not deleted -You may have discovered a bug! But first, please double check that your -molecule template atom types, bond types, etc. are consistent with your simulation, -and that all atoms affected by a reaction are sufficently separated from edge atoms. -If this issue persists, please contact the developer. +Self-explanatory. + +W: Bond/react: An atom in 'react #%d' changes bond connectivity but not atom type + +You may want to double-check that all atom types are properly assigned +in the post-reaction template. + +E: Bond/react special bond generation overflow + +The number of special bonds per-atom created by a reaction exceeds the +system setting. See the read_data or create_box command for how to +specify this value. + +E: Bond/react topology/atom exceed system topology/atom + +The number of bonds, angles etc per-atom created by a reaction exceeds +the system setting. See the read_data or create_box command for how to +specify this value. */ diff --git a/src/USER-PLUMED/fix_plumed.cpp b/src/USER-PLUMED/fix_plumed.cpp index 635d08c573..9921747b22 100644 --- a/src/USER-PLUMED/fix_plumed.cpp +++ b/src/USER-PLUMED/fix_plumed.cpp @@ -33,6 +33,7 @@ #include "compute.h" #include "modify.h" #include "pair.h" +#include "utils.h" #include "plumed/wrapper/Plumed.h" @@ -250,15 +251,15 @@ FixPlumed::FixPlumed(LAMMPS *lmp, int narg, char **arg) : // Avoid conflict with fixes that define internal pressure computes. // See comment in the setup method - if ((strncmp(check_style,"nph",3) == 0) || - (strncmp(check_style,"npt",3) == 0) || - (strncmp(check_style,"rigid/nph",9) == 0) || - (strncmp(check_style,"rigid/npt",9) == 0) || - (strncmp(check_style,"msst",4) == 0) || - (strncmp(check_style,"nphug",5) == 0) || - (strncmp(check_style,"ipi",3) == 0) || - (strncmp(check_style,"press/berendsen",15) == 0) || - (strncmp(check_style,"qbmsst",6) == 0)) + if (utils::strmatch(check_style,"^nph") || + utils::strmatch(check_style,"^npt") || + utils::strmatch(check_style,"^rigid/nph") || + utils::strmatch(check_style,"^rigid/npt") || + utils::strmatch(check_style,"^msst") || + utils::strmatch(check_style,"^nphug") || + utils::strmatch(check_style,"^ipi") || + utils::strmatch(check_style,"^press/berendsen") || + utils::strmatch(check_style,"^qbmsst")) error->all(FLERR,"Fix plumed must be defined before any other fixes, " "that compute pressure internally"); } @@ -289,7 +290,7 @@ int FixPlumed::setmask() void FixPlumed::init() { - if (strcmp(update->integrate_style,"respa") == 0) + if (utils::strmatch(update->integrate_style,"^respa")) nlevels_respa = ((Respa *) update->integrate)->nlevels; // This avoids nan pressure if compute_pressure is called @@ -309,12 +310,12 @@ void FixPlumed::setup(int vflag) // has to be executed first. This creates a race condition with the // setup method of fix_nh. This is why in the constructor I check if // nh fixes have already been called. - if (strcmp(update->integrate_style,"verlet") == 0) - post_force(vflag); - else { + if (utils::strmatch(update->integrate_style,"^respa")) { ((Respa *) update->integrate)->copy_flevel_f(nlevels_respa-1); post_force_respa(vflag,nlevels_respa-1,0); ((Respa *) update->integrate)->copy_f_flevel(nlevels_respa-1); + } else { + post_force(vflag); } } diff --git a/src/USER-QTB/fix_qbmsst.cpp b/src/USER-QTB/fix_qbmsst.cpp index e8a4f85eaa..b9b07664d2 100644 --- a/src/USER-QTB/fix_qbmsst.cpp +++ b/src/USER-QTB/fix_qbmsst.cpp @@ -41,6 +41,7 @@ #include "group.h" #include "kspace.h" #include "thermo.h" +#include "utils.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -410,14 +411,14 @@ void FixQBMSST::init() // rfix[] = indices to each fix rigid nrigid = 0; for (int i = 0; i < modify->nfix; i++) - if (strcmp(modify->fix[i]->style,"rigid") == 0 || - strcmp(modify->fix[i]->style,"poems") == 0) nrigid++; - if (nrigid) { + if (utils::strmatch(modify->fix[i]->style,"^rigid") || + (strcmp(modify->fix[i]->style,"poems") == 0)) nrigid++; + if (nrigid > 0) { rfix = new int[nrigid]; nrigid = 0; for (int i = 0; i < modify->nfix; i++) - if (strcmp(modify->fix[i]->style,"rigid") == 0 || - strcmp(modify->fix[i]->style,"poems") == 0) rfix[nrigid++] = i; + if (utils::strmatch(modify->fix[i]->style,"^rigid") || + (strcmp(modify->fix[i]->style,"poems") == 0)) rfix[nrigid++] = i; } } diff --git a/src/fix_adapt.cpp b/src/fix_adapt.cpp index 950bc24253..9a5b528747 100644 --- a/src/fix_adapt.cpp +++ b/src/fix_adapt.cpp @@ -31,6 +31,7 @@ #include "math_const.h" #include "memory.h" #include "error.h" +#include "utils.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -375,8 +376,7 @@ void FixAdapt::init() // if pair hybrid, test that ilo,ihi,jlo,jhi are valid for sub-style - if (strcmp(force->pair_style,"hybrid") == 0 || - strcmp(force->pair_style,"hybrid/overlay") == 0) { + if (utils::strmatch(force->pair_style,"^hybrid")) { PairHybrid *pair = (PairHybrid *) force->pair; for (i = ad->ilo; i <= ad->ihi; i++) for (j = MAX(ad->jlo,i); j <= ad->jhi; j++) @@ -416,8 +416,7 @@ void FixAdapt::init() if (ad->bdim == 1) ad->vector = (double *) ptr; - if (strcmp(force->bond_style,"hybrid") == 0 || - strcmp(force->bond_style,"hybrid_overlay") == 0) + if (utils::strmatch(force->bond_style,"^hybrid")) error->all(FLERR,"Fix adapt does not support bond_style hybrid"); delete [] bstyle; diff --git a/src/fix_nve_limit.cpp b/src/fix_nve_limit.cpp index b4fb43e56f..68ff0665a1 100644 --- a/src/fix_nve_limit.cpp +++ b/src/fix_nve_limit.cpp @@ -23,6 +23,7 @@ #include "modify.h" #include "comm.h" #include "error.h" +#include "utils.h" using namespace LAMMPS_NS; using namespace FixConst; @@ -72,8 +73,8 @@ void FixNVELimit::init() // warn if using fix shake, which will lead to invalid constraint forces for (int i = 0; i < modify->nfix; i++) - if ((strcmp(modify->fix[i]->style,"shake") == 0) - || (strcmp(modify->fix[i]->style,"rattle") == 0)) { + if (utils::strmatch(modify->fix[i]->style,"^shake") + || utils::strmatch(modify->fix[i]->style,"^rattle")) { if (comm->me == 0) error->warning(FLERR,"Should not use fix nve/limit with fix shake or fix rattle"); } diff --git a/src/force.cpp b/src/force.cpp index 2691cb3fd8..ed27df1215 100644 --- a/src/force.cpp +++ b/src/force.cpp @@ -80,7 +80,11 @@ Force::Force(LAMMPS *lmp) : Pointers(lmp) strcpy(kspace_style,str); pair_restart = NULL; + create_factories(); +} +void _noopt Force::create_factories() +{ // fill pair map with pair styles listed in style_pair.h pair_map = new PairCreatorMap(); diff --git a/src/force.h b/src/force.h index 2b4298d049..227b9427c0 100644 --- a/src/force.h +++ b/src/force.h @@ -143,6 +143,7 @@ class Force : protected Pointers { bigint memory_usage(); private: + void create_factories(); template static Pair *pair_creator(LAMMPS *); template static Bond *bond_creator(LAMMPS *); template static Angle *angle_creator(LAMMPS *); diff --git a/src/kspace.cpp b/src/kspace.cpp index 0144ea59a3..64a769fa51 100644 --- a/src/kspace.cpp +++ b/src/kspace.cpp @@ -443,7 +443,11 @@ void KSpace::modify_params(int narg, char **arg) nx_pppm = nx_msm_max = force->inumeric(FLERR,arg[iarg+1]); ny_pppm = ny_msm_max = force->inumeric(FLERR,arg[iarg+2]); nz_pppm = nz_msm_max = force->inumeric(FLERR,arg[iarg+3]); - if (nx_pppm == 0 && ny_pppm == 0 && nz_pppm == 0) gridflag = 0; + if (nx_pppm == 0 && ny_pppm == 0 && nz_pppm == 0) + gridflag = 0; + else if (nx_pppm <= 0 || ny_pppm <= 0 || nz_pppm <= 0) + error->all(FLERR,"Kspace_modify mesh parameters must be all " + "zero or all positive"); else gridflag = 1; iarg += 4; } else if (strcmp(arg[iarg],"mesh/disp") == 0) { @@ -451,7 +455,11 @@ void KSpace::modify_params(int narg, char **arg) nx_pppm_6 = force->inumeric(FLERR,arg[iarg+1]); ny_pppm_6 = force->inumeric(FLERR,arg[iarg+2]); nz_pppm_6 = force->inumeric(FLERR,arg[iarg+3]); - if (nx_pppm_6 == 0 || ny_pppm_6 == 0 || nz_pppm_6 == 0) gridflag_6 = 0; + if (nx_pppm_6 == 0 && ny_pppm_6 == 0 && nz_pppm_6 == 0) + gridflag_6 = 0; + else if (nx_pppm_6 <= 0 || ny_pppm_6 <= 0 || nz_pppm_6 == 0) + error->all(FLERR,"Kspace_modify mesh/disp parameters must be all " + "zero or all positive"); else gridflag_6 = 1; iarg += 4; } else if (strcmp(arg[iarg],"order") == 0) { diff --git a/src/kspace.h b/src/kspace.h index 2345cebf24..4fd260e186 100644 --- a/src/kspace.h +++ b/src/kspace.h @@ -251,6 +251,18 @@ E: Bad kspace_modify slab parameter Kspace_modify value for the slab/volume keyword must be >= 2.0. +E: Kspace_modify mesh parameter must be all zero or all positive + +Valid kspace mesh parameters are >0. The code will try to auto-detect +suitable values when all three mesh sizes are set to zero (the default). + +E: Kspace_modify mesh/disp parameter must be all zero or all positive + +Valid kspace mesh/disp parameters are >0. The code will try to auto-detect +suitable values when all three mesh sizes are set to zero [and] +the required accuracy via {force/disp/real} as well as +{force/disp/kspace} is set. + W: Kspace_modify slab param < 2.0 may cause unphysical behavior The kspace_modify slab parameter should be larger to insure periodic diff --git a/src/lammps.cpp b/src/lammps.cpp index 24012c0f18..f8d04c9323 100644 --- a/src/lammps.cpp +++ b/src/lammps.cpp @@ -108,7 +108,7 @@ LAMMPS::LAMMPS(int narg, char **arg, MPI_Comm communicator) : initclock = MPI_Wtime(); init_pkg_lists(); - + // check if -mpi is first arg // if so, then 2 apps were launched with one mpirun command // this means passed communicator (e.g. MPI_COMM_WORLD) is bigger than LAMMPS @@ -896,7 +896,7 @@ void LAMMPS::destroy() initialize lists of styles in packages ------------------------------------------------------------------------- */ -void LAMMPS::init_pkg_lists() +void _noopt LAMMPS::init_pkg_lists() { pkg_lists = new package_styles_lists; #define PACKAGE "UNKNOWN" @@ -996,7 +996,7 @@ void LAMMPS::init_pkg_lists() #include "packages_region.h" #undef RegionStyle #undef REGION_CLASS -} +} bool LAMMPS::is_installed_pkg(const char *pkg) { @@ -1039,7 +1039,7 @@ const char *LAMMPS::match_style(const char *style, const char *name) help message for command line options and styles present in executable ------------------------------------------------------------------------- */ -void LAMMPS::help() +void _noopt LAMMPS::help() { FILE *fp = screen; const char *pager = NULL; diff --git a/src/lmptype.h b/src/lmptype.h index 4743a38837..20d29880ed 100644 --- a/src/lmptype.h +++ b/src/lmptype.h @@ -179,6 +179,9 @@ typedef int bigint; #ifdef _noalias #undef _noalias #endif +#ifdef _noopt +#undef _noopt +#endif // define stack variable alignment @@ -200,6 +203,23 @@ typedef int bigint; #define _noalias #endif +// declaration to turn off optimization for specific functions +// and avoid compiler warnings about variable tracking + +#if defined(__clang__) +# define _noopt __attribute__((optnone)) +#elif defined(__INTEL_COMPILER) +# define _noopt +#elif defined(__GNUC__) +# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) +# define _noopt __attribute__((optimize("O0","no-var-tracking-assignments"))) +# else +# define _noopt __attribute__((optimize("O0"))) +# endif +#else +# define _noopt +#endif + // settings to enable LAMMPS to build under Windows #ifdef _WIN32 diff --git a/src/modify.cpp b/src/modify.cpp index 69cdb424b2..3f034bf034 100644 --- a/src/modify.cpp +++ b/src/modify.cpp @@ -81,6 +81,11 @@ Modify::Modify(LAMMPS *lmp) : Pointers(lmp) ncompute = maxcompute = 0; compute = NULL; + create_factories(); +} + +void _noopt Modify::create_factories() +{ // fill map with fixes listed in style_fix.h fix_map = new FixCreatorMap(); diff --git a/src/modify.h b/src/modify.h index 537ff81543..5ff81855fe 100644 --- a/src/modify.h +++ b/src/modify.h @@ -172,6 +172,7 @@ class Modify : protected Pointers { FixCreatorMap *fix_map; protected: + void create_factories(); template static Compute *compute_creator(LAMMPS *, int, char **); template static Fix *fix_creator(LAMMPS *, int, char **); }; diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 2dc65541e4..0382624198 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -46,6 +46,7 @@ #include "citeme.h" #include "memory.h" #include "error.h" +#include "utils.h" #include @@ -1282,8 +1283,8 @@ void Neighbor::init_topology() int bond_off = 0; int angle_off = 0; for (i = 0; i < modify->nfix; i++) - if ((strcmp(modify->fix[i]->style,"shake") == 0) - || (strcmp(modify->fix[i]->style,"rattle") == 0)) + if (utils::strmatch(modify->fix[i]->style,"^shake") + || utils::strmatch(modify->fix[i]->style,"^rattle")) bond_off = angle_off = 1; if (force->bond && force->bond_match("quartic")) bond_off = 1; diff --git a/src/pair_coul_streitz.cpp b/src/pair_coul_streitz.cpp index 244dccda12..282c855249 100644 --- a/src/pair_coul_streitz.cpp +++ b/src/pair_coul_streitz.cpp @@ -219,12 +219,6 @@ void PairCoulStreitz::init_style() error->all(FLERR,"Pair style requires a KSpace style"); g_ewald = force->kspace->g_ewald; } - - // ptr to QEQ fix - //for (i = 0; i < modify->nfix; i++) - // if (strcmp(modify->fix[i]->style,"qeq") == 0) break; - //if (i < modify->nfix) fixqeq = (FixQEQ *) modify->fix[i]; - //else fixqeq = NULL; } /* ---------------------------------------------------------------------- diff --git a/src/velocity.cpp b/src/velocity.cpp index 32b08708cf..95d820cc22 100644 --- a/src/velocity.cpp +++ b/src/velocity.cpp @@ -112,7 +112,7 @@ void Velocity::command(int narg, char **arg) int initcomm = 0; if (style == ZERO && rfix >= 0 && - strcmp(modify->fix[rfix]->style,"rigid/small") == 0) initcomm = 1; + utils::strmatch(modify->fix[rfix]->style,"^rigid/small")) initcomm = 1; if ((style == CREATE || style == SET) && temperature && strcmp(temperature->style,"temp/cs") == 0) initcomm = 1; diff --git a/src/version.h b/src/version.h index 312c87bd0c..06ee8ab8f4 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define LAMMPS_VERSION "31 May 2019" +#define LAMMPS_VERSION "5 Jun 2019"