diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index fd93814574..b9a93a110e 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -367,7 +367,7 @@ if(PKG_KSPACE) endif() endif() -if(PKG_MSCG OR PKG_USER-ATC OR PKG_USER-AWPMD OR PKG_USER-QUIP OR PKG_LATTE) +if(PKG_MSCG OR PKG_USER-ATC OR PKG_USER-AWPMD OR PKG_USER-PLUMED OR PKG_USER-QUIP OR PKG_LATTE) find_package(LAPACK) find_package(BLAS) if(NOT LAPACK_FOUND OR NOT BLAS_FOUND) @@ -577,8 +577,8 @@ if(PKG_USER-PLUMED) message(STATUS "PLUMED download requested - we will build our own") include(ExternalProject) ExternalProject_Add(plumed_build - URL https://github.com/plumed/plumed2/releases/download/v2.4.4/plumed-src-2.4.4.tgz - URL_MD5 71ed465bdc7c2059e282dbda8d564e71 + URL https://github.com/plumed/plumed2/releases/download/v2.5.1/plumed-src-2.5.1.tgz + URL_MD5 c2a7b519e32197a120cdf47e0f194f81 BUILD_IN_SOURCE 1 CONFIGURE_COMMAND /configure --prefix= ${CONFIGURE_REQUEST_PIC} @@ -593,10 +593,9 @@ if(PKG_USER-PLUMED) list(APPEND LAMMPS_DEPS plumed_build) if(PLUMED_MODE STREQUAL "STATIC") add_definitions(-D__PLUMED_WRAPPER_CXX=1) - list(APPEND LAMMPS_LINK_LIBS ${PLUMED_INSTALL_DIR}/lib/plumed/obj/kernel.o - "${PLUMED_INSTALL_DIR}/lib/plumed/obj/PlumedStatic.o" ${GSL_LIBRARIES} ${CMAKE_DL_LIBS}) + list(APPEND LAMMPS_LINK_LIBS ${PLUMED_INSTALL_DIR}/lib/libplumed.a ${GSL_LIBRARIES} ${LAPACK_LIBRARIES} ${CMAKE_DL_LIBS}) elseif(PLUMED_MODE STREQUAL "SHARED") - list(APPEND LAMMPS_LINK_LIBS ${PLUMED_INSTALL_DIR}/lib/libplumed.so ${CMAKE_DL_LIBS}) + list(APPEND LAMMPS_LINK_LIBS ${PLUMED_INSTALL_DIR}/lib/libplumed.so ${PLUMED_INSTALL_DIR}/lib/libplumedKernel.so ${CMAKE_DL_LIBS}) elseif(PLUMED_MODE STREQUAL "RUNTIME") add_definitions(-D__PLUMED_HAS_DLOPEN=1 -D__PLUMED_DEFAULT_KERNEL=${PLUMED_INSTALL_DIR}/lib/libplumedKernel.so) list(APPEND LAMMPS_LINK_LIBS ${PLUMED_INSTALL_DIR}/lib/libplumedWrapper.a -rdynamic ${CMAKE_DL_LIBS}) diff --git a/doc/src/Howto.txt b/doc/src/Howto.txt index 36f6be7194..0df417af75 100644 --- a/doc/src/Howto.txt +++ b/doc/src/Howto.txt @@ -148,7 +148,7 @@ END_RST --> -"CHARMM, AMBER, and DREIDING force fields"_Howto_bioFF.html +"CHARMM, AMBER, COMPASS, and DREIDING force fields"_Howto_bioFF.html "TIP3P water model"_Howto_tip3p.html "TIP4P water model"_Howto_tip4p.html "SPC water model"_Howto_spc.html :all(b) diff --git a/doc/src/Howto_bioFF.txt b/doc/src/Howto_bioFF.txt index deb5b31441..b6995920ae 100644 --- a/doc/src/Howto_bioFF.txt +++ b/doc/src/Howto_bioFF.txt @@ -7,29 +7,31 @@ Documentation"_ld - "LAMMPS Commands"_lc :c :line -CHARMM, AMBER, and DREIDING force fields :h3 +CHARMM, AMBER, COMPASS, and DREIDING force fields :h3 A force field has 2 parts: the formulas that define it and the coefficients used for a particular system. Here we only discuss formulas implemented in LAMMPS that correspond to formulas commonly -used in the CHARMM, AMBER, and DREIDING force fields. Setting -coefficients is done in the input data file via the -"read_data"_read_data.html command or in the input script with +used in the CHARMM, AMBER, COMPASS, and DREIDING force fields. Setting +coefficients is done either from special sections in an input data file +via the "read_data"_read_data.html command or in the input script with commands like "pair_coeff"_pair_coeff.html or -"bond_coeff"_bond_coeff.html. See the "Tools"_Tools.html doc page for -additional tools that can use CHARMM or AMBER to assign force field -coefficients and convert their output into LAMMPS input. +"bond_coeff"_bond_coeff.html and so on. See the "Tools"_Tools.html doc +page for additional tools that can use CHARMM, AMBER, or Materials +Studio generated files to assign force field coefficients and convert +their output into LAMMPS input. See "(MacKerell)"_#howto-MacKerell for a description of the CHARMM force -field. See "(Cornell)"_#howto-Cornell for a description of the AMBER force -field. +field. See "(Cornell)"_#howto-Cornell for a description of the AMBER +force field. See "(Sun)"_#howto-Sun for a description of the COMPASS +force field. :link(charmm,http://www.scripps.edu/brooks) :link(amber,http://amber.scripps.edu) -These style choices compute force field formulas that are consistent -with common options in CHARMM or AMBER. See each command's -documentation for the formula it computes. +The interaction styles listed below compute force field formulas that +are consistent with common options in CHARMM or AMBER. See each +command's documentation for the formula it computes. "bond_style"_bond_harmonic.html harmonic "angle_style"_angle_charmm.html charmm @@ -44,28 +46,54 @@ documentation for the formula it computes. "special_bonds"_special_bonds.html charmm "special_bonds"_special_bonds.html amber :ul -NOTE: For CHARMM, newer {charmmfsw} or {charmmfsh} styles were -released in March 2017. We recommend they be used instead of the -older {charmm} styles. See discussion of the differences on the "pair -charmm"_pair_charmm.html and "dihedral charmm"_dihedral_charmm.html -doc pages. +NOTE: For CHARMM, newer {charmmfsw} or {charmmfsh} styles were released +in March 2017. We recommend they be used instead of the older {charmm} +styles. See discussion of the differences on the "pair +charmm"_pair_charmm.html and "dihedral charmm"_dihedral_charmm.html doc +pages. + +COMPASS is a general force field for atomistic simulation of common +organic molecules, inorganic small molecules, and polymers which was +developed using ab initio and empirical parameterization techniques. +See the "Tools"_Tools.html doc page for the msi2lmp tool for creating +LAMMPS template input and data files from BIOVIA’s Materials Studio +files. Please note that the msi2lmp tool is very old and largely +unmaintained, so it does not support all features of Materials Studio +provided force field files, especially additions during the last decade. +You should watch the output carefully and compare results, where +possible. See "(Sun)"_#howto-Sun for a description of the COMPASS force +field. + +These interaction styles listed below compute force field formulas that +are consistent with the COMPASS force field. See each command's +documentation for the formula it computes. + +"bond_style"_bond_class2.html class2 +"angle_style"_angle_class2.html class2 +"dihedral_style"_dihedral_class2.html class2 +"improper_style"_improper_class2.html class2 :ul + +"pair_style"_pair_class2.html lj/class2 +"pair_style"_pair_class2.html lj/class2/coul/cut +"pair_style"_pair_class2.html lj/class2/coul/long :ul + +"special_bonds"_special_bonds.html lj/coul 0 0 1 :ul DREIDING is a generic force field developed by the "Goddard group"_http://www.wag.caltech.edu at Caltech and is useful for -predicting structures and dynamics of organic, biological and -main-group inorganic molecules. The philosophy in DREIDING is to use -general force constants and geometry parameters based on simple -hybridization considerations, rather than individual force constants -and geometric parameters that depend on the particular combinations of -atoms involved in the bond, angle, or torsion terms. DREIDING has an -"explicit hydrogen bond term"_pair_hbond_dreiding.html to describe -interactions involving a hydrogen atom on very electronegative atoms -(N, O, F). +predicting structures and dynamics of organic, biological and main-group +inorganic molecules. The philosophy in DREIDING is to use general force +constants and geometry parameters based on simple hybridization +considerations, rather than individual force constants and geometric +parameters that depend on the particular combinations of atoms involved +in the bond, angle, or torsion terms. DREIDING has an "explicit hydrogen +bond term"_pair_hbond_dreiding.html to describe interactions involving a +hydrogen atom on very electronegative atoms (N, O, F). See "(Mayo)"_#howto-Mayo for a description of the DREIDING force field -These style choices compute force field formulas that are consistent -with the DREIDING force field. See each command's +The interaction styles listed below compute force field formulas that +are consistent with the DREIDING force field. See each command's documentation for the formula it computes. "bond_style"_bond_harmonic.html harmonic @@ -100,6 +128,9 @@ Fischer, Gao, Guo, Ha, et al, J Phys Chem, 102, 3586 (1998). [(Cornell)] Cornell, Cieplak, Bayly, Gould, Merz, Ferguson, Spellmeyer, Fox, Caldwell, Kollman, JACS 117, 5179-5197 (1995). +:link(howto-Sun) +[(Sun)] Sun, J. Phys. Chem. B, 102, 7338–7364 (1998). + :link(howto-Mayo) [(Mayo)] Mayo, Olfason, Goddard III, J Phys Chem, 94, 8897-8909 (1990). diff --git a/doc/src/Howto_tip3p.txt b/doc/src/Howto_tip3p.txt index 942b42aea1..a34577c5e1 100644 --- a/doc/src/Howto_tip3p.txt +++ b/doc/src/Howto_tip3p.txt @@ -10,7 +10,7 @@ Documentation"_ld - "LAMMPS Commands"_lc :c TIP3P water model :h3 The TIP3P water model as implemented in CHARMM -"(MacKerell)"_#howto-MacKerell specifies a 3-site rigid water molecule with +"(MacKerell)"_#howto-tip3p specifies a 3-site rigid water molecule with charges and Lennard-Jones parameters assigned to each of the 3 atoms. In LAMMPS the "fix shake"_fix_shake.html command can be used to hold the two O-H bonds and the H-O-H angle rigid. A bond style of @@ -60,6 +60,10 @@ models"_http://en.wikipedia.org/wiki/Water_model. :line +:link(howto-tip3p) +[(MacKerell)] MacKerell, Bashford, Bellott, Dunbrack, Evanseck, Field, +Fischer, Gao, Guo, Ha, et al, J Phys Chem, 102, 3586 (1998). + :link(Jorgensen1) [(Jorgensen)] Jorgensen, Chandrasekhar, Madura, Impey, Klein, J Chem Phys, 79, 926 (1983). diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index 0ca2c469f1..0596179daa 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -1136,6 +1136,7 @@ infty inhomogeneities inhomogeneous init +initio initializations InP inregion @@ -2814,6 +2815,7 @@ unimodal unitless Universite unix +unmaintained unoptimized unpadded unphysical diff --git a/lib/plumed/Install.py b/lib/plumed/Install.py index 70296b35d3..3623a8cff0 100644 --- a/lib/plumed/Install.py +++ b/lib/plumed/Install.py @@ -17,7 +17,7 @@ parser = ArgumentParser(prog='Install.py', # settings -version = "2.4.4" +version = "2.5.1" mode = "static" # help message @@ -43,6 +43,7 @@ checksums = { \ '2.4.3' : 'b1be7c48971627febc11c61b70767fc5', \ '2.4.4' : '71ed465bdc7c2059e282dbda8d564e71', \ '2.5.0' : '6224cd089493661e19ceacccd35cf911', \ + '2.5.1' : 'c2a7b519e32197a120cdf47e0f194f81', \ } # parse and process arguments @@ -67,6 +68,7 @@ if not args.build and not args.path: buildflag = args.build pathflag = args.path is not None plumedpath = args.path +mode = args.mode homepath = fullpath('.') homedir = "%s/plumed2" % (homepath) @@ -75,6 +77,8 @@ if pathflag: if not os.path.isdir(plumedpath): sys.exit("Plumed2 path %s does not exist" % plumedpath) homedir = fullpath(plumedpath) + if not os.path.isdir(os.path.join(homedir, 'include', 'plumed', 'core')): + sys.exit("No Plumed2 installation found at %s" % plumedpath) # download and unpack plumed2 tarball @@ -127,7 +131,7 @@ if os.path.isfile("Makefile.lammps.%s" % mode): lines1 = open(plumedinc, 'r').readlines() lines2 = open("Makefile.lammps.%s" % mode, 'r').readlines() fp = open("Makefile.lammps", 'w') - fp.write(os.path.join("PLUMED_LIBDIR=", homedir, "lib\n")) + fp.write("PLUMED_LIBDIR=" + os.path.join(homedir, "lib\n")) for line in lines1: fp.write(line) for line in lines2: diff --git a/src/KIM/pair_kim.cpp b/src/KIM/pair_kim.cpp index 84842f87cc..ea5f24a67e 100644 --- a/src/KIM/pair_kim.cpp +++ b/src/KIM/pair_kim.cpp @@ -481,7 +481,7 @@ void PairKIM::init_style() for (int i = 0; i < kim_number_of_neighbor_lists; ++i) { lmps_stripped_neigh_ptr[i] - = &(lmps_stripped_neigh_list[(i-1)*(neighbor->oneatom)]); + = &(lmps_stripped_neigh_list[i*(neighbor->oneatom)]); } } diff --git a/src/KSPACE/fix_tune_kspace.cpp b/src/KSPACE/fix_tune_kspace.cpp index 3e90988cba..0c726985dc 100644 --- a/src/KSPACE/fix_tune_kspace.cpp +++ b/src/KSPACE/fix_tune_kspace.cpp @@ -99,8 +99,8 @@ void FixTuneKspace::init() error->all(FLERR,"Cannot use fix tune/kspace with dipole long-range solver"); double old_acc = force->kspace->accuracy/force->kspace->two_charge_force; - char old_acc_str[12]; - sprintf(old_acc_str,"%g",old_acc); + char old_acc_str[16]; + snprintf(old_acc_str,16,"%g",old_acc); strcpy(new_acc_str,old_acc_str); int itmp; @@ -210,8 +210,8 @@ void FixTuneKspace::store_old_kspace_settings() strcpy(old_kspace_style,force->kspace_style); strcpy(new_kspace_style,old_kspace_style); double old_acc = force->kspace->accuracy_relative; - char old_acc_str[12]; - sprintf(old_acc_str,"%g",old_acc); + char old_acc_str[16]; + snprintf(old_acc_str,16,"%g",old_acc); strcpy(new_pair_style,force->pair_style); strcpy(base_pair_style,force->pair_style); char *trunc; diff --git a/src/MC/fix_bond_break.cpp b/src/MC/fix_bond_break.cpp index a1c9bb3ab0..05edc0509e 100644 --- a/src/MC/fix_bond_break.cpp +++ b/src/MC/fix_bond_break.cpp @@ -800,26 +800,27 @@ void FixBondBreak::print_bb() for (int i = 0; i < atom->nlocal; i++) { printf("TAG " TAGINT_FORMAT ": %d nbonds: ",atom->tag[i],atom->num_bond[i]); for (int j = 0; j < atom->num_bond[i]; j++) { - printf(" %d",atom->bond_atom[i][j]); + printf(" " TAGINT_FORMAT, atom->bond_atom[i][j]); } printf("\n"); printf("TAG " TAGINT_FORMAT ": %d nangles: ",atom->tag[i],atom->num_angle[i]); for (int j = 0; j < atom->num_angle[i]; j++) { - printf(" %d %d %d,",atom->angle_atom1[i][j], - atom->angle_atom2[i][j],atom->angle_atom3[i][j]); + printf(" " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT ",", + atom->angle_atom1[i][j],atom->angle_atom2[i][j], + atom->angle_atom3[i][j]); } printf("\n"); printf("TAG " TAGINT_FORMAT ": %d ndihedrals: ",atom->tag[i],atom->num_dihedral[i]); for (int j = 0; j < atom->num_dihedral[i]; j++) { - printf(" %d %d %d %d,",atom->dihedral_atom1[i][j], - atom->dihedral_atom2[i][j],atom->dihedral_atom3[i][j], - atom->dihedral_atom4[i][j]); + printf(" " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT ",", + atom->dihedral_atom1[i][j],atom->dihedral_atom2[i][j], + atom->dihedral_atom3[i][j],atom->dihedral_atom4[i][j]); } printf("\n"); printf("TAG " TAGINT_FORMAT ": %d %d %d nspecial: ",atom->tag[i], atom->nspecial[i][0],atom->nspecial[i][1],atom->nspecial[i][2]); for (int j = 0; j < atom->nspecial[i][2]; j++) { - printf(" %d",atom->special[i][j]); + printf(" " TAGINT_FORMAT, atom->special[i][j]); } printf("\n"); } @@ -830,7 +831,7 @@ void FixBondBreak::print_bb() void FixBondBreak::print_copy(const char *str, tagint m, int n1, int n2, int n3, int *v) { - printf("%s %i: %d %d %d nspecial: ",str,m,n1,n2,n3); + printf("%s " TAGINT_FORMAT ": %d %d %d nspecial: ",str,m,n1,n2,n3); for (int j = 0; j < n3; j++) printf(" %d",v[j]); printf("\n"); } diff --git a/src/REPLICA/fix_hyper_global.cpp b/src/REPLICA/fix_hyper_global.cpp index 6924fe2d93..0c76b29911 100644 --- a/src/REPLICA/fix_hyper_global.cpp +++ b/src/REPLICA/fix_hyper_global.cpp @@ -191,8 +191,6 @@ void FixHyperGlobal::pre_neighbor() for (i = 0; i < nall_old; i++) old2now[i] = -1; - double **x = atom->x; - for (m = 0; m < nblocal; m++) { iold = blist[m].iold; jold = blist[m].jold; diff --git a/src/REPLICA/fix_hyper_local.cpp b/src/REPLICA/fix_hyper_local.cpp index dc7a0b94b9..a6db4419f0 100644 --- a/src/REPLICA/fix_hyper_local.cpp +++ b/src/REPLICA/fix_hyper_local.cpp @@ -353,8 +353,6 @@ void FixHyperLocal::pre_neighbor() for (i = 0; i < nall_old; i++) old2now[i] = -1; - double **x = atom->x; - for (m = 0; m < nblocal; m++) { iold = blist[m].iold; jold = blist[m].jold; @@ -407,7 +405,7 @@ void FixHyperLocal::pre_neighbor() void FixHyperLocal::pre_reverse(int /* eflag */, int /* vflag */) { int i,j,m,ii,jj,inum,jnum,iold,jold,ibond,nbond,ijhalf,ncount; - double xtmp,ytmp,ztmp,delx,dely,delz; + double delx,dely,delz; double r,r0,estrain,emax,ebias,vbias,fbias,fbiasr; double halfstrain,selfstrain; int *ilist,*jlist,*numneigh,**firstneigh; @@ -811,7 +809,7 @@ void FixHyperLocal::min_pre_neighbor() void FixHyperLocal::build_bond_list(int natom) { int i,j,ii,jj,m,n,iold,jold,ilocal,jlocal,inum,jnum,nbond; - tagint itag,jtag; + tagint jtag; double xtmp,ytmp,ztmp,delx,dely,delz,rsq,distsq,oldcoeff; int *ilist,*jlist,*numneigh,**firstneigh; @@ -1006,7 +1004,6 @@ void FixHyperLocal::build_bond_list(int natom) ytmp = x[i][1]; ztmp = x[i][2]; - itag = tag[i]; tagold[i] = tag[i]; jlist = firstneigh[i]; @@ -1420,7 +1417,6 @@ double FixHyperLocal::compute_vector(int i) } if (i == 4) { - const int nlocal = atom->nlocal; bigint allneigh,thisneigh; thisneigh = listfull->ipage->ndatum; MPI_Allreduce(&thisneigh,&allneigh,1,MPI_LMP_BIGINT,MPI_SUM,world); diff --git a/src/REPLICA/hyper.cpp b/src/REPLICA/hyper.cpp index 5d820b2e27..00b91684e9 100644 --- a/src/REPLICA/hyper.cpp +++ b/src/REPLICA/hyper.cpp @@ -268,7 +268,7 @@ void Hyper::command(int narg, char **arg) double nnewbond,avenbias,avebiascoeff,minbiascoeff,maxbiascoeff; double maxbondperatom,neighbondperbond,avebiasnow; double tbondbuild,rmaxever,rmaxeverbig,allghost_toofar; - double lostbond,lostbondcoeff,biasoverlap; + double biasoverlap; if (hyperenable) { t_hyper = fix_hyper->query(1); diff --git a/src/USER-COLVARS/fix_colvars.cpp b/src/USER-COLVARS/fix_colvars.cpp index 0e4e151c3d..545ceb7b0e 100644 --- a/src/USER-COLVARS/fix_colvars.cpp +++ b/src/USER-COLVARS/fix_colvars.cpp @@ -645,7 +645,7 @@ void FixColvars::setup(int vflag) /* ---------------------------------------------------------------------- */ /* Main colvars handler: * Send coodinates and add colvar forces to atoms. */ -void FixColvars::post_force(int vflag) +void FixColvars::post_force(int /*vflag*/) { // some housekeeping: update status of the proxy as needed. if (me == 0) { @@ -816,7 +816,7 @@ void FixColvars::min_post_force(int vflag) } /* ---------------------------------------------------------------------- */ -void FixColvars::post_force_respa(int vflag, int ilevel, int iloop) +void FixColvars::post_force_respa(int vflag, int ilevel, int /*iloop*/) { /* only process colvar forces on the outmost RESPA level. */ if (ilevel == nlevels_respa-1) post_force(vflag); diff --git a/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp b/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp index 794a324f03..de134e32ed 100644 --- a/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp +++ b/src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp @@ -559,7 +559,8 @@ void FixNVEManifoldRattle::rattle_manifold_x(double *x, double *v, if (iters >= max_iter && res > tolerance) { char msg[2048]; - sprintf(msg,"Failed to constrain atom %d (x = (%f, %f, %f)! res = %e, iters = %d\n", + sprintf(msg,"Failed to constrain atom " TAGINT_FORMAT + " (x = (%f, %f, %f)! res = %e, iters = %d\n", tagi, x[0], x[1], x[2], res, iters); error->one(FLERR,msg); } @@ -652,7 +653,8 @@ void FixNVEManifoldRattle::rattle_manifold_v(double *v, double *f, if (iters >= max_iter && res >= tolerance) { char msg[2048]; - sprintf(msg,"Failed to constrain atom %d (x = (%f, %f, %f)! res = %e, iters = %d\n", + sprintf(msg,"Failed to constrain atom " TAGINT_FORMAT + " (x = (%f, %f, %f)! res = %e, iters = %d\n", tagi, x[0], x[1], x[2], res, iters); error->all(FLERR,msg); } diff --git a/src/USER-OMP/pair_reaxc_omp.cpp b/src/USER-OMP/pair_reaxc_omp.cpp index 92ba31048d..a98f7c89d9 100644 --- a/src/USER-OMP/pair_reaxc_omp.cpp +++ b/src/USER-OMP/pair_reaxc_omp.cpp @@ -343,6 +343,15 @@ void PairReaxCOMP::init_style( ) if (force->newton_pair == 0) error->all(FLERR,"Pair style reax/c/omp requires newton pair on"); + if ((atom->map_tag_max > 99999999) && (comm->me == 0)) + error->warning(FLERR,"Some Atom-IDs are too large. Pair style reax/c/omp " + "native output files may get misformatted or corrupted"); + + // because system->bigN is an int, we cannot have more atoms than MAXSMALLINT + + if (atom->natoms > MAXSMALLINT) + error->all(FLERR,"Too many atoms for pair style reax/c/omp"); + // need a half neighbor list w/ Newton off and ghost neighbors // built whenever re-neighboring occurs diff --git a/src/USER-REAXC/fix_reaxc.cpp b/src/USER-REAXC/fix_reaxc.cpp index 361733f3ca..dc67ad6ffb 100644 --- a/src/USER-REAXC/fix_reaxc.cpp +++ b/src/USER-REAXC/fix_reaxc.cpp @@ -41,7 +41,7 @@ FixReaxC::FixReaxC(LAMMPS *lmp,int narg, char **arg) : { // perform initial allocation of atom-based arrays // register with atom class - + oldnmax = 0; num_bonds = NULL; num_hbonds = NULL; diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index 6bb2b9a197..a65c738766 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -90,8 +90,7 @@ PairReaxC::PairReaxC(LAMMPS *lmp) : Pair(lmp) mpi_data = (mpi_datatypes *) memory->smalloc(sizeof(mpi_datatypes),"reax:mpi"); - MPI_Comm_rank(world,&system->my_rank); - control->me = system->my_rank; + control->me = system->my_rank = comm->me; system->my_coords[0] = 0; system->my_coords[1] = 0; @@ -383,6 +382,14 @@ void PairReaxC::init_style( ) error->all(FLERR,"Pair style reax/c requires atom IDs"); if (force->newton_pair == 0) error->all(FLERR,"Pair style reax/c requires newton pair on"); + if ((atom->map_tag_max > 99999999) && (comm->me == 0)) + error->warning(FLERR,"Some Atom-IDs are too large. Pair style reax/c " + "native output files may get misformatted or corrupted"); + + // because system->bigN is an int, we cannot have more atoms than MAXSMALLINT + + if (atom->natoms > MAXSMALLINT) + error->all(FLERR,"Too many atoms for pair style reax/c"); // need a half neighbor list w/ Newton off and ghost neighbors // built whenever re-neighboring occurs diff --git a/src/USER-REAXC/reaxc_ffield.cpp b/src/USER-REAXC/reaxc_ffield.cpp index 13e928ad08..9534637645 100644 --- a/src/USER-REAXC/reaxc_ffield.cpp +++ b/src/USER-REAXC/reaxc_ffield.cpp @@ -151,7 +151,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, /* Sanity checks */ if (c == 2 && !lgflag) control->error_ptr->all(FLERR, "Force field file requires using 'lgvdw yes'"); - + if (c < 9) { snprintf (errmsg, 1024, "Missing parameter(s) in line %s", s); control->error_ptr->all(FLERR, errmsg); @@ -320,7 +320,7 @@ char Read_Force_Field( FILE *fp, reax_interaction *reax, if (c == 2 && !lgflag) { control->error_ptr->all(FLERR, "Force field file requires using 'lgvdw yes'"); } - + l = atoi(tmp[0]); /* a line of comments */ diff --git a/src/USER-REAXC/reaxc_init_md.cpp b/src/USER-REAXC/reaxc_init_md.cpp index c1239e0cbb..39b31c38b5 100644 --- a/src/USER-REAXC/reaxc_init_md.cpp +++ b/src/USER-REAXC/reaxc_init_md.cpp @@ -236,21 +236,21 @@ void Initialize( reax_system *system, control_params *control, if (Init_Workspace( system, control, workspace, msg ) == FAILURE) { - control->error_ptr->one(FLERR,"Workspace could not be initialized"); + control->error_ptr->one(FLERR,"Workspace could not be initialized"); } if (Init_Lists( system, control, data, workspace, lists, mpi_data, msg ) == FAILURE) { - control->error_ptr->one(FLERR,"Lists could not be initialized"); + control->error_ptr->one(FLERR,"Lists could not be initialized"); } if (Init_Output_Files(system,control,out_control,mpi_data,msg)== FAILURE) { - control->error_ptr->one(FLERR,"Could not open output files"); + control->error_ptr->one(FLERR,"Could not open output files"); } if (control->tabulate) { if (Init_Lookup_Tables( system, control, workspace, mpi_data, msg ) == FAILURE) { - control->error_ptr->one(FLERR,"Lookup table could not be created"); + control->error_ptr->one(FLERR,"Lookup table could not be created"); } } diff --git a/src/USER-REAXC/reaxc_io_tools.cpp b/src/USER-REAXC/reaxc_io_tools.cpp index f71fcbec8e..a4f0db7c7d 100644 --- a/src/USER-REAXC/reaxc_io_tools.cpp +++ b/src/USER-REAXC/reaxc_io_tools.cpp @@ -55,8 +55,7 @@ int Init_Output_Files( reax_system *system, control_params *control, sprintf( temp, "%s.pot", control->sim_name ); if ((out_control->pot = fopen( temp, "w" )) != NULL) { fflush( out_control->pot ); - } - else { + } else { strcpy( msg, "init_out_controls: .pot file could not be opened\n" ); return FAILURE; } @@ -74,8 +73,7 @@ int Init_Output_Files( reax_system *system, control_params *control, "step", "Pint/norm[x]", "Pint/norm[y]", "Pint/norm[z]", "Pext/Ptot[x]", "Pext/Ptot[y]", "Pext/Ptot[z]", "Pkin/V" ); fflush( out_control->prs ); - } - else { + } else { strcpy(msg,"init_out_controls: .prs file couldn't be opened\n"); return FAILURE; } diff --git a/src/USER-REAXC/reaxc_reset_tools.cpp b/src/USER-REAXC/reaxc_reset_tools.cpp index 5439ee33a4..e00656694c 100644 --- a/src/USER-REAXC/reaxc_reset_tools.cpp +++ b/src/USER-REAXC/reaxc_reset_tools.cpp @@ -144,7 +144,7 @@ void Reset_Neighbor_Lists( reax_system *system, control_params *control, if (total_bonds >= bonds->num_intrs * DANGER_ZONE) { workspace->realloc.bonds = 1; if (total_bonds >= bonds->num_intrs) { - char errmsg[256]; + char errmsg[256]; snprintf(errmsg, 256, "Not enough space for bonds! total=%d allocated=%d\n", total_bonds, bonds->num_intrs); control->error_ptr->one(FLERR, errmsg); @@ -170,7 +170,7 @@ void Reset_Neighbor_Lists( reax_system *system, control_params *control, if (total_hbonds >= hbonds->num_intrs * 0.90/*DANGER_ZONE*/) { workspace->realloc.hbonds = 1; if (total_hbonds >= hbonds->num_intrs) { - char errmsg[256]; + char errmsg[256]; snprintf(errmsg, 256, "Not enough space for hbonds! total=%d allocated=%d\n", total_hbonds, hbonds->num_intrs); control->error_ptr->one(FLERR, errmsg); diff --git a/src/USER-REAXC/reaxc_traj.h b/src/USER-REAXC/reaxc_traj.h index 72c56637eb..4966bf11d8 100644 --- a/src/USER-REAXC/reaxc_traj.h +++ b/src/USER-REAXC/reaxc_traj.h @@ -42,7 +42,11 @@ #define SCI_LINE "%-37s%-24g\n" #define REAL3_LINE "%-32s%9.3f,%9.3f,%9.3f\n" +#if defined(LAMMPS_BIGBIG) +#define INIT_DESC "%9ld%3d%9s%10.3f\n" //AtomID - AtomType, AtomName, AtomMass +#else #define INIT_DESC "%9d%3d%9s%10.3f\n" //AtomID - AtomType, AtomName, AtomMass +#endif #define INIT_DESC_LEN 32 #define SIZE_INFO_LINE2 "%-10d%-10d\n" @@ -51,21 +55,33 @@ #define SIZE_INFO_LINE3 "%-10d%-10d%-10d\n" #define SIZE_INFO_LEN3 31 +#if defined(LAMMPS_BIGBIG) +#define ATOM_BASIC "%9ld%10.3f%10.3f%10.3f%10.3f\n" //AtomID AtomType (X Y Z) Charge +#define ATOM_wV "%9ld%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f\n" //AtomID (X Y Z) (Vx Vy Vz) Charge +#define ATOM_wF "%9ld%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f\n" //AtomID (X Y Z) (Fx Fy Fz) Charge +#define ATOM_FULL "%9ld%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f\n" //AtomID (X Y Z) (Vx Vy Vz) (Fx Fy Fz) Charge +#else #define ATOM_BASIC "%9d%10.3f%10.3f%10.3f%10.3f\n" //AtomID AtomType (X Y Z) Charge -#define ATOM_BASIC_LEN 50 #define ATOM_wV "%9d%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f\n" //AtomID (X Y Z) (Vx Vy Vz) Charge -#define ATOM_wV_LEN 80 #define ATOM_wF "%9d%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f\n" //AtomID (X Y Z) (Fx Fy Fz) Charge -#define ATOM_wF_LEN 80 #define ATOM_FULL "%9d%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f%10.3f\n" //AtomID (X Y Z) (Vx Vy Vz) (Fx Fy Fz) Charge +#endif +#define ATOM_BASIC_LEN 50 +#define ATOM_wV_LEN 80 +#define ATOM_wF_LEN 80 #define ATOM_FULL_LEN 110 +#if defined(LAMMPS_BIGBIG) +#define BOND_BASIC "%9ld%9ld%10.3f%10.3f\n" // Atom1 Atom2 Dist Total_BO +#define BOND_FULL "%9ld%9ld%10.3f%10.3f%10.3f%10.3f%10.3f\n" // Atom1 Atom2 Dist Total_BO BOs BOpi BOpi2 +#define ANGLE_BASIC "%9ld%9ld%9ld%10.3f\n" // Atom1 Atom2 Atom3 Theta +#else #define BOND_BASIC "%9d%9d%10.3f%10.3f\n" // Atom1 Atom2 Dist Total_BO -#define BOND_BASIC_LEN 39 #define BOND_FULL "%9d%9d%10.3f%10.3f%10.3f%10.3f%10.3f\n" // Atom1 Atom2 Dist Total_BO BOs BOpi BOpi2 -#define BOND_FULL_LEN 69 - #define ANGLE_BASIC "%9d%9d%9d%10.3f\n" // Atom1 Atom2 Atom3 Theta +#endif +#define BOND_BASIC_LEN 39 +#define BOND_FULL_LEN 69 #define ANGLE_BASIC_LEN 38 enum ATOM_LINE_OPTS { OPT_NOATOM = 0, OPT_ATOM_BASIC = 4, OPT_ATOM_wF = 5, OPT_ATOM_wV = 6, OPT_ATOM_FULL = 7, NR_OPT_ATOM = 8 }; diff --git a/src/USER-REAXC/reaxc_types.h b/src/USER-REAXC/reaxc_types.h index cdc2916a66..b05f655040 100644 --- a/src/USER-REAXC/reaxc_types.h +++ b/src/USER-REAXC/reaxc_types.h @@ -491,7 +491,7 @@ typedef struct int lgflag; int enobondsflag; class LAMMPS_NS::Error *error_ptr; - int me; + int me; } control_params; diff --git a/src/USER-SMD/pair_smd_tlsph.cpp b/src/USER-SMD/pair_smd_tlsph.cpp index ac67a3279a..1d7bbca780 100644 --- a/src/USER-SMD/pair_smd_tlsph.cpp +++ b/src/USER-SMD/pair_smd_tlsph.cpp @@ -308,7 +308,7 @@ void PairTlsph::PreCompute() { */ if ((detF[i] < DETF_MIN) || (detF[i] > DETF_MAX) || (numNeighsRefConfig[i] == 0)) { - printf("deleting particle [%d] because det(F)=%f is outside stable range %f -- %f \n", tag[i], + printf("deleting particle [" TAGINT_FORMAT "] because det(F)=%f is outside stable range %f -- %f \n", tag[i], Fincr[i].determinant(), DETF_MIN, DETF_MAX); printf("nn = %d, damage=%f\n", numNeighsRefConfig[i], damage[i]); diff --git a/src/hashlittle.cpp b/src/hashlittle.cpp index 38f192ad76..f612be9eeb 100644 --- a/src/hashlittle.cpp +++ b/src/hashlittle.cpp @@ -23,16 +23,6 @@ # endif #endif -// declaration to indicate intended fallthrough cases in switch statements -// and thus silence the warnings produced by g++ -Wextra - -#if defined(__GNUC__) -#define _fallthrough __attribute__ ((fallthrough)) -#else -#define _fallthrough -#endif - - #define rot(x,k) (((x)<<(k)) | ((x)>>(32-(k)))) /* @@ -301,17 +291,17 @@ uint32_t hashlittle( const void *key, size_t length, uint32_t initval) /*-------------------------------- last block: affect all 32 bits of (c) */ switch(length) /* all the case statements fall through */ { - case 12: c+=((uint32_t)k[11])<<24; _fallthrough; - case 11: c+=((uint32_t)k[10])<<16; _fallthrough; - case 10: c+=((uint32_t)k[9])<<8; _fallthrough; - case 9 : c+=k[8]; _fallthrough; - case 8 : b+=((uint32_t)k[7])<<24; _fallthrough; - case 7 : b+=((uint32_t)k[6])<<16; _fallthrough; - case 6 : b+=((uint32_t)k[5])<<8; _fallthrough; - case 5 : b+=k[4]; _fallthrough; - case 4 : a+=((uint32_t)k[3])<<24; _fallthrough; - case 3 : a+=((uint32_t)k[2])<<16; _fallthrough; - case 2 : a+=((uint32_t)k[1])<<8; _fallthrough; + case 12: c+=((uint32_t)k[11])<<24; /* fall through */ + case 11: c+=((uint32_t)k[10])<<16; /* fall through */ + case 10: c+=((uint32_t)k[9])<<8; /* fall through */ + case 9 : c+=k[8]; /* fall through */ + case 8 : b+=((uint32_t)k[7])<<24; /* fall through */ + case 7 : b+=((uint32_t)k[6])<<16; /* fall through */ + case 6 : b+=((uint32_t)k[5])<<8; /* fall through */ + case 5 : b+=k[4]; /* fall through */ + case 4 : a+=((uint32_t)k[3])<<24; /* fall through */ + case 3 : a+=((uint32_t)k[2])<<16; /* fall through */ + case 2 : a+=((uint32_t)k[1])<<8; /* fall through */ case 1 : a+=k[0]; break; case 0 : return c; diff --git a/src/info.cpp b/src/info.cpp index 3d8a8d7b9e..ac2ee4a96d 100644 --- a/src/info.cpp +++ b/src/info.cpp @@ -42,6 +42,7 @@ #include "variable.h" #include "update.h" #include "error.h" +#include "utils.h" #include #include @@ -397,7 +398,7 @@ void Info::command(int narg, char **arg) fprintf(out,"Atoms = " BIGINT_FORMAT ", types = %d, style = %s\n", atom->natoms, atom->ntypes, force->pair_style); - if (force->pair && strstr(force->pair_style,"hybrid")) { + if (force->pair && utils::strmatch(force->pair_style,"^hybrid")) { PairHybrid *hybrid = (PairHybrid *)force->pair; fprintf(out,"Hybrid sub-styles:"); for (int i=0; i < hybrid->nstyles; ++i) diff --git a/src/respa.cpp b/src/respa.cpp index 26bae5a1cb..6fa9959d78 100644 --- a/src/respa.cpp +++ b/src/respa.cpp @@ -38,6 +38,7 @@ #include "timer.h" #include "memory.h" #include "error.h" +#include "utils.h" #include "pair_hybrid.h" using namespace LAMMPS_NS; @@ -120,7 +121,7 @@ Respa::Respa(LAMMPS *lmp, int narg, char **arg) : iarg += 2; } else if (strcmp(arg[iarg],"hybrid") == 0) { // the hybrid keyword requires a hybrid pair style - if (!strstr(force->pair_style,"hybrid")) + if (!utils::strmatch(force->pair_style,"^hybrid")) error->all(FLERR,"Illegal run_style respa command"); PairHybrid *hybrid = (PairHybrid *) force->pair; nhybrid_styles = hybrid->nstyles; diff --git a/src/variable.cpp b/src/variable.cpp index c0e4dae7d0..56b66cad0d 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -1578,6 +1578,8 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) newtree->nextra = 0; treestack[ntreestack++] = newtree; + } else if (nbracket == 1 && compute->local_flag) { + print_var_error(FLERR,"Cannot access local data via indexing",ivar); } else print_var_error(FLERR, "Mismatched compute in variable formula",ivar); @@ -2179,7 +2181,7 @@ double Variable::evaluate(char *str, Tree **tree, int ivar) if (tree) { Tree *newtree = new Tree(); newtree->type = opprevious; - if (opprevious == UNARY) { + if ((opprevious == UNARY) || (opprevious == NOT)) { newtree->first = treestack[--ntreestack]; newtree->second = NULL; newtree->nextra = 0; diff --git a/src/velocity.cpp b/src/velocity.cpp index 6d6027cc3c..32b08708cf 100644 --- a/src/velocity.cpp +++ b/src/velocity.cpp @@ -33,6 +33,7 @@ #include "comm.h" #include "memory.h" #include "error.h" +#include "utils.h" using namespace LAMMPS_NS; @@ -709,19 +710,19 @@ void Velocity::zero(int /*narg*/, char **arg) { if (strcmp(arg[0],"linear") == 0) { if (rfix < 0) zero_momentum(); - else if (strcmp(modify->fix[rfix]->style,"rigid/small") == 0) { + else if (utils::strmatch(modify->fix[rfix]->style,"^rigid/small")) { modify->fix[rfix]->setup_pre_neighbor(); modify->fix[rfix]->zero_momentum(); - } else if (strstr(modify->fix[rfix]->style,"rigid")) { + } else if (utils::strmatch(modify->fix[rfix]->style,"^rigid")) { modify->fix[rfix]->zero_momentum(); } else error->all(FLERR,"Velocity rigid used with non-rigid fix-ID"); } else if (strcmp(arg[0],"angular") == 0) { if (rfix < 0) zero_rotation(); - else if (strcmp(modify->fix[rfix]->style,"rigid/small") == 0) { + else if (utils::strmatch(modify->fix[rfix]->style,"^rigid/small")) { modify->fix[rfix]->setup_pre_neighbor(); modify->fix[rfix]->zero_rotation(); - } else if (strstr(modify->fix[rfix]->style,"rigid")) { + } else if (utils::strmatch(modify->fix[rfix]->style,"^rigid")) { modify->fix[rfix]->zero_rotation(); } else error->all(FLERR,"Velocity rigid used with non-rigid fix-ID");