From da77dde04de70a75a215a7bd0044e757d189352a Mon Sep 17 00:00:00 2001 From: Risto Toijala Date: Thu, 4 Apr 2019 14:32:49 +0300 Subject: [PATCH 01/22] MC/fix_bond_break: Use TAGINT_FORMAT where appropriate --- src/MC/fix_bond_break.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) 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"); } From 66794692201d4345cde7aaa5573b4cf4f06cdea7 Mon Sep 17 00:00:00 2001 From: Risto Toijala Date: Thu, 4 Apr 2019 15:35:44 +0300 Subject: [PATCH 02/22] USER-MANIFOLD: Use TAGINT_FORMAT where appropriate --- src/USER-MANIFOLD/fix_nve_manifold_rattle.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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); } From 2aa7a150b48fbbf080087000d9f7096d8d449e42 Mon Sep 17 00:00:00 2001 From: Risto Toijala Date: Thu, 4 Apr 2019 15:38:53 +0300 Subject: [PATCH 03/22] USER-SMD: Use TAGINT_FORMAT where appropriate --- src/USER-SMD/pair_smd_tlsph.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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]); From 81dd96f970250616d4663a0f824bf100a1008f47 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 4 Apr 2019 12:42:54 -0400 Subject: [PATCH 04/22] print more meaningful error message when trying to access individual data from a local array produced by a compute */local --- src/variable.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/variable.cpp b/src/variable.cpp index c0e4dae7d0..ed3b41bd00 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); From 265ad4512dfa6f8be1cb0f28abfb4b9d3ffbf4d4 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 4 Apr 2019 13:18:27 -0400 Subject: [PATCH 05/22] add sanity check on plumed pre-installed path location --- lib/plumed/Install.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/plumed/Install.py b/lib/plumed/Install.py index 70296b35d3..2ae5aadd03 100644 --- a/lib/plumed/Install.py +++ b/lib/plumed/Install.py @@ -75,6 +75,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 From c52a330a79b674c28cced21879a562fb180c896f Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 4 Apr 2019 14:04:12 -0400 Subject: [PATCH 06/22] update USER-PLUMED support for version 2.5.1 and fix bug in Install.py script --- cmake/CMakeLists.txt | 11 +++++------ lib/plumed/Install.py | 6 ++++-- 2 files changed, 9 insertions(+), 8 deletions(-) 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/lib/plumed/Install.py b/lib/plumed/Install.py index 2ae5aadd03..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) @@ -129,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: From 78bab6ee395f39fad5374dfdd90d4953353b7c8c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 4 Apr 2019 16:36:57 -0400 Subject: [PATCH 07/22] make format macros in USER-REAXC compatible with -DLAMMPS_BIGBIG --- src/USER-REAXC/reaxc_traj.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/USER-REAXC/reaxc_traj.h b/src/USER-REAXC/reaxc_traj.h index 72c56637eb..b04a190965 100644 --- a/src/USER-REAXC/reaxc_traj.h +++ b/src/USER-REAXC/reaxc_traj.h @@ -42,7 +42,7 @@ #define SCI_LINE "%-37s%-24g\n" #define REAL3_LINE "%-32s%9.3f,%9.3f,%9.3f\n" -#define INIT_DESC "%9d%3d%9s%10.3f\n" //AtomID - AtomType, AtomName, AtomMass +#define INIT_DESC TAGINT_FORMAT "%3d%9s%10.3f\n" //AtomID - AtomType, AtomName, AtomMass #define INIT_DESC_LEN 32 #define SIZE_INFO_LINE2 "%-10d%-10d\n" @@ -51,21 +51,21 @@ #define SIZE_INFO_LINE3 "%-10d%-10d%-10d\n" #define SIZE_INFO_LEN3 31 -#define ATOM_BASIC "%9d%10.3f%10.3f%10.3f%10.3f\n" //AtomID AtomType (X Y Z) Charge +#define ATOM_BASIC TAGINT_FORMAT " %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 TAGINT_FORMAT " %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 TAGINT_FORMAT " %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 +#define ATOM_FULL TAGINT_FORMAT " %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 #define ATOM_FULL_LEN 110 -#define BOND_BASIC "%9d%9d%10.3f%10.3f\n" // Atom1 Atom2 Dist Total_BO +#define BOND_BASIC TAGINT_FORMAT " " TAGINT_FORMAT " %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 TAGINT_FORMAT " " TAGINT_FORMAT " %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 +#define ANGLE_BASIC TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " %10.3f\n" // Atom1 Atom2 Atom3 Theta #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 }; From ab5c3b038623b2e77a24470fc3eca9e3eb53eff4 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 4 Apr 2019 16:51:37 -0400 Subject: [PATCH 08/22] protect against possible buffer overflow --- src/KSPACE/fix_tune_kspace.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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; From 4003387fb10e73badd1709fd709fe182d5991999 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 4 Apr 2019 16:51:59 -0400 Subject: [PATCH 09/22] dead code removal --- src/REPLICA/fix_hyper_global.cpp | 2 -- src/REPLICA/fix_hyper_local.cpp | 8 ++------ src/REPLICA/hyper.cpp | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) 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); From df94e80bb1be510b9c6df8a73059719ae30f8c35 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 4 Apr 2019 16:52:08 -0400 Subject: [PATCH 10/22] silence compiler warnings --- src/USER-COLVARS/fix_colvars.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); From dbbf198edb4edf36a06550ea20a1a3bf02784864 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 4 Apr 2019 17:10:27 -0400 Subject: [PATCH 11/22] more accurate matching of styles using utils::strmatch() --- src/info.cpp | 3 ++- src/respa.cpp | 3 ++- src/velocity.cpp | 9 +++++---- 3 files changed, 9 insertions(+), 6 deletions(-) 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/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"); From e359e80118890a6330bb3c3c93e1d6637e16d5ed Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 4 Apr 2019 22:39:58 -0400 Subject: [PATCH 12/22] fix bug reported in issue #1410 --- src/variable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/variable.cpp b/src/variable.cpp index ed3b41bd00..56b66cad0d 100644 --- a/src/variable.cpp +++ b/src/variable.cpp @@ -2181,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; From f4159ff5929b1d5ce62a75fd4afe315271160266 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 5 Apr 2019 05:53:19 -0400 Subject: [PATCH 13/22] implement different -DLAMMPS_BIGBIG workaround without breaking format --- src/USER-REAXC/reaxc_traj.h | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/src/USER-REAXC/reaxc_traj.h b/src/USER-REAXC/reaxc_traj.h index b04a190965..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" -#define INIT_DESC TAGINT_FORMAT "%3d%9s%10.3f\n" //AtomID - AtomType, AtomName, AtomMass +#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 -#define ATOM_BASIC TAGINT_FORMAT " %10.3f%10.3f%10.3f%10.3f\n" //AtomID AtomType (X Y Z) Charge +#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_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_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_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 TAGINT_FORMAT " %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 TAGINT_FORMAT " %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 TAGINT_FORMAT " %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 #define ATOM_FULL_LEN 110 -#define BOND_BASIC TAGINT_FORMAT " " TAGINT_FORMAT " %10.3f%10.3f\n" // Atom1 Atom2 Dist Total_BO +#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_FULL "%9d%9d%10.3f%10.3f%10.3f%10.3f%10.3f\n" // Atom1 Atom2 Dist Total_BO BOs BOpi BOpi2 +#define ANGLE_BASIC "%9d%9d%9d%10.3f\n" // Atom1 Atom2 Atom3 Theta +#endif #define BOND_BASIC_LEN 39 -#define BOND_FULL TAGINT_FORMAT " " TAGINT_FORMAT " %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 TAGINT_FORMAT " " TAGINT_FORMAT " " TAGINT_FORMAT " %10.3f\n" // Atom1 Atom2 Atom3 Theta #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 }; From 4f026b9b3830afdbf2ede14fe9d6001be56e5604 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 5 Apr 2019 06:11:06 -0400 Subject: [PATCH 14/22] remove trailing whitespace --- src/USER-REAXC/fix_reaxc.cpp | 2 +- src/USER-REAXC/reaxc_ffield.cpp | 4 ++-- src/USER-REAXC/reaxc_init_md.cpp | 8 ++++---- src/USER-REAXC/reaxc_reset_tools.cpp | 4 ++-- src/USER-REAXC/reaxc_types.h | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) 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/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_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_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; From 42e8a7613e144e86b8ce0eac302b5fc87323779e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 5 Apr 2019 06:29:38 -0400 Subject: [PATCH 15/22] stop with error or print a warning when the system or atom ids get to large for reax/c pair styles --- src/USER-OMP/pair_reaxc_omp.cpp | 9 +++++++++ src/USER-REAXC/pair_reaxc.cpp | 11 +++++++++-- src/USER-REAXC/reaxc_io_tools.cpp | 6 ++---- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/USER-OMP/pair_reaxc_omp.cpp b/src/USER-OMP/pair_reaxc_omp.cpp index 92ba31048d..81e890538a 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_max_tag > 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/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index 6bb2b9a197..3164280872 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_max_tag > 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_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; } From 8b2a8ad08bd1a2cb22ff3465db810c4735025753 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 5 Apr 2019 06:32:59 -0400 Subject: [PATCH 16/22] fix stupid typo --- src/USER-OMP/pair_reaxc_omp.cpp | 2 +- src/USER-REAXC/pair_reaxc.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/USER-OMP/pair_reaxc_omp.cpp b/src/USER-OMP/pair_reaxc_omp.cpp index 81e890538a..a98f7c89d9 100644 --- a/src/USER-OMP/pair_reaxc_omp.cpp +++ b/src/USER-OMP/pair_reaxc_omp.cpp @@ -343,7 +343,7 @@ void PairReaxCOMP::init_style( ) if (force->newton_pair == 0) error->all(FLERR,"Pair style reax/c/omp requires newton pair on"); - if ((atom->map_max_tag > 99999999) && (comm->me == 0)) + 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"); diff --git a/src/USER-REAXC/pair_reaxc.cpp b/src/USER-REAXC/pair_reaxc.cpp index 3164280872..a65c738766 100644 --- a/src/USER-REAXC/pair_reaxc.cpp +++ b/src/USER-REAXC/pair_reaxc.cpp @@ -382,7 +382,7 @@ 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_max_tag > 99999999) && (comm->me == 0)) + 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"); From 383e206cc22fd91f0ed30318b9c8cd0055b8ab42 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 5 Apr 2019 08:00:04 -0400 Subject: [PATCH 17/22] the GCC folks did it again. :-( --- src/hashlittle.cpp | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) 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; From 5d3801cb1259ffc50b39a27e08842c9f0488b9de Mon Sep 17 00:00:00 2001 From: Evangelos Voyiatzis Date: Fri, 5 Apr 2019 15:50:58 +0200 Subject: [PATCH 18/22] Include info for COMPASS in the Howto section --- doc/src/Howto_bioFF.txt | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/doc/src/Howto_bioFF.txt b/doc/src/Howto_bioFF.txt index deb5b31441..ee53420723 100644 --- a/doc/src/Howto_bioFF.txt +++ b/doc/src/Howto_bioFF.txt @@ -7,12 +7,12 @@ 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 +used in the CHARMM, AMBER, COMPASS 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 commands like "pair_coeff"_pair_coeff.html or @@ -50,6 +50,28 @@ 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 parametrization techniques. +See the "Tools"_Tools.html doc page for the msi2lmp tool for creating +LAMMPS template input and data files from BIOVIA’s Materias Studio files. +See "(Sun)"_#howto-Sun for a description of the COMPASS force field. + +These style choices 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 @@ -100,6 +122,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). From 85a0461a48b16c1f383b7cfeb6fc1a69fa9a8bc2 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 5 Apr 2019 10:53:23 -0400 Subject: [PATCH 19/22] reword and reformat text in Howto_bioFF.txt a little bit. add warnings about msi2lmp's age and lack of maintenance --- doc/src/Howto_bioFF.txt | 78 ++++++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 36 deletions(-) diff --git a/doc/src/Howto_bioFF.txt b/doc/src/Howto_bioFF.txt index ee53420723..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, COMPASS 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, COMPASS 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,21 +46,26 @@ 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 parametrization techniques. -See the "Tools"_Tools.html doc page for the msi2lmp tool for creating -LAMMPS template input and data files from BIOVIA’s Materias Studio files. -See "(Sun)"_#howto-Sun for a description of the COMPASS force field. +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 style choices compute force field formulas that are consistent -with the COMPASS force field. See each command's +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 @@ -74,20 +81,19 @@ documentation for the formula it computes. 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 From 2757e4e6e6e6ffb61493ae439f2a90efcdac8ae5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 5 Apr 2019 10:53:41 -0400 Subject: [PATCH 20/22] two more false positives --- doc/utils/sphinx-config/false_positives.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/utils/sphinx-config/false_positives.txt b/doc/utils/sphinx-config/false_positives.txt index 8c2ff43c3c..91ae3d6a6c 100644 --- a/doc/utils/sphinx-config/false_positives.txt +++ b/doc/utils/sphinx-config/false_positives.txt @@ -1134,6 +1134,7 @@ infty inhomogeneities inhomogeneous init +initio initializations InP inregion @@ -2809,6 +2810,7 @@ unimodal unitless Universite unix +unmaintained unoptimized unpadded unphysical From 2e1da2958da1cf362a2185ed51db8902607a1218 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 5 Apr 2019 11:04:11 -0400 Subject: [PATCH 21/22] resolve toctree and paper anchor issues --- doc/src/Howto.txt | 2 +- doc/src/Howto_tip3p.txt | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) 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_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). From 175f3ee648bf805e233c327eff93a402495e1b80 Mon Sep 17 00:00:00 2001 From: "Ryan S. Elliott" Date: Fri, 5 Apr 2019 10:14:45 -0500 Subject: [PATCH 22/22] Fix pointer assignment in pair_kim Bug only affects cases where neighbor list needs to be stripped. Thanks to Mingjian Wen (@mjwen) for finding and reporting this. --- src/KIM/pair_kim.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)]); } }