From 2e6a928aa3150c608151ccebe8a3414da1a80530 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 18 Aug 2017 19:23:33 -0400 Subject: [PATCH 1/9] ignore file recently added to USER-INTEL --- src/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/src/.gitignore b/src/.gitignore index 80166e260e..3a97524c82 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -57,6 +57,7 @@ /intel_buffers.cpp /intel_buffers.h /intel_intrinsics.h +/intel_intrinsics_airebo.h /intel_preprocess.h /intel_simd.h From 44ccdb86df24ec1d8299ea198d0ce0c6e01a7b48 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 18 Aug 2017 19:24:39 -0400 Subject: [PATCH 2/9] add checks when reading QEQ parameter file to avoid segfaults and memory corruption on incorrect files --- src/QEQ/fix_qeq.cpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index c5b566eef7..38bfec8b96 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -747,18 +747,26 @@ void FixQEq::read_file(char *file) nwords = atom->count_words(line); if (nwords == 0) continue; - // words = ptrs to all words in line + // must have 6 parameters per line. - nwords = 0; - words[nwords++] = strtok(line," \t\n\r\f"); - while ((words[nwords++] = strtok(NULL," \t\n\r\f"))) continue; + if (nwords < 6) + error->all(FLERR,"Invalid fix qeq parameter file"); - itype = atoi(words[0]); - chi[itype] = atof(words[1]); - eta[itype] = atof(words[2]); - gamma[itype] = atof(words[3]); - zeta[itype] = atof(words[4]); - zcore[itype] = atof(words[5]); + + // words = ptrs to first 6 words in line + + for (n=0, words[n] = strtok(line," \t\n\r\f"); + n < 6; + words[++n] = strtok(NULL," \t\n\r\f")); + + itype = force->inumeric(FLERR,words[0]); + if ((itype < 1) || (itype > atom->ntypes)) + error->all(FLERR,"Invalid fix qeq parameter file"); + chi[itype] = force->numeric(FLERR,words[1]); + eta[itype] = force->numeric(FLERR,words[2]); + gamma[itype] = force->numeric(FLERR,words[3]); + zeta[itype] = force->numeric(FLERR,words[4]); + zcore[itype] = force->numeric(FLERR,words[5]); } delete [] words; } From aa1ce09b126414f3292a00992420511a8777fde7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 18 Aug 2017 20:03:47 -0400 Subject: [PATCH 3/9] more cleanup, checks and generalization of QEQ parameter file parsing --- src/QEQ/fix_qeq.cpp | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/src/QEQ/fix_qeq.cpp b/src/QEQ/fix_qeq.cpp index 38bfec8b96..757eae5dd2 100644 --- a/src/QEQ/fix_qeq.cpp +++ b/src/QEQ/fix_qeq.cpp @@ -692,11 +692,13 @@ void FixQEq::vector_add( double* dest, double c, double* v, int k ) void FixQEq::read_file(char *file) { - int itype,ntypes; + int i; int params_per_line = 6; char **words = new char*[params_per_line+1]; - ntypes = atom->ntypes; + int ntypes = atom->ntypes; + int *setflag = new int[ntypes+1]; + for (i=0; i < params_per_line; ++i) setflag[i] = 0; memory->create(chi,ntypes+1,"qeq:chi"); memory->create(eta,ntypes+1,"qeq:eta"); @@ -719,10 +721,10 @@ void FixQEq::read_file(char *file) // read each line out of file, skipping blank lines or leading '#' // store line of params if all 3 element tags are in element list - int n,nwords,ielement,eof; + int n,nwords,eof,nlo,nhi; char line[MAXLINE],*ptr; - eof = ielement = 0; + eof = 0; while (1) { if (comm->me == 0) { @@ -737,10 +739,6 @@ void FixQEq::read_file(char *file) MPI_Bcast(&n,1,MPI_INT,0,world); MPI_Bcast(line,n,MPI_CHAR,0,world); - ielement ++; - if (ielement > ntypes) - error->all(FLERR,"Invalid fix qeq parameter file"); - // strip comment, skip line if blank if ((ptr = strchr(line,'#'))) *ptr = '\0'; @@ -752,21 +750,28 @@ void FixQEq::read_file(char *file) if (nwords < 6) error->all(FLERR,"Invalid fix qeq parameter file"); - // words = ptrs to first 6 words in line for (n=0, words[n] = strtok(line," \t\n\r\f"); n < 6; words[++n] = strtok(NULL," \t\n\r\f")); - itype = force->inumeric(FLERR,words[0]); - if ((itype < 1) || (itype > atom->ntypes)) - error->all(FLERR,"Invalid fix qeq parameter file"); - chi[itype] = force->numeric(FLERR,words[1]); - eta[itype] = force->numeric(FLERR,words[2]); - gamma[itype] = force->numeric(FLERR,words[3]); - zeta[itype] = force->numeric(FLERR,words[4]); - zcore[itype] = force->numeric(FLERR,words[5]); + force->bounds(FLERR,words[0],ntypes,nlo,nhi); + for (n=nlo; n <=nhi; ++n) { + chi[n] = force->numeric(FLERR,words[1]); + eta[n] = force->numeric(FLERR,words[2]); + gamma[n] = force->numeric(FLERR,words[3]); + zeta[n] = force->numeric(FLERR,words[4]); + zcore[n] = force->numeric(FLERR,words[5]); + setflag[n] = 1; + } } + + // check if all types are set + for (n=1; n <= ntypes; ++n) + if (setflag[n] == 0) + error->all(FLERR,"Invalid fix qeq parameter file"); + delete [] words; + delete [] setflag; } From 39e51df2c0045078591fc58d7ac6364ed06eaa6b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 20 Aug 2017 10:02:11 -0400 Subject: [PATCH 4/9] add missing entry in pdf manual --- doc/src/lammps.book | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/src/lammps.book b/doc/src/lammps.book index 76b6743657..c444a6bb69 100644 --- a/doc/src/lammps.book +++ b/doc/src/lammps.book @@ -21,6 +21,7 @@ Section_python.html Section_errors.html Section_history.html +tutorial_bash_on_windows.html tutorial_drude.html tutorial_github.html tutorial_pylammps.html From f5b8f722eee363909877e0120529520ace068e5d Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 20 Aug 2017 10:09:21 -0400 Subject: [PATCH 5/9] remove non-portable non-ascii blanks from fix wall/ees docs --- doc/src/fix_wall_ees.txt | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/doc/src/fix_wall_ees.txt b/doc/src/fix_wall_ees.txt index a8688e8e41..f141a19405 100644 --- a/doc/src/fix_wall_ees.txt +++ b/doc/src/fix_wall_ees.txt @@ -50,17 +50,17 @@ fix ees_cube all wall/region/ees myCube 1.0 1.0 2.5 :pre Fix {wall/ees} bounds the simulation domain on one or more of its faces with a flat wall that interacts with the ellipsoidal atoms in the group by generating a force on the atom in a direction perpendicular to -the wall and a torque parallel with the wall.  The energy of +the wall and a torque parallel with the wall. The energy of wall-particle interactions E is given by: :c,image(Eqs/fix_wall_ees.jpg) Introduced by Babadi and Ejtehadi in "(Babadi)"_#BabadiEjtehadi. Here, {r} is the distance from the particle to the wall at position {coord}, -and Rc is the {cutoff} distance at which the  particle and wall no -longer interact. Also,  sigma_n is the distance between center of -ellipsoid and the nearest point of its surface to the wall  The energy -of the wall (see the image below). +and Rc is the {cutoff} distance at which the particle and wall no +longer interact. Also, sigma_n is the distance between center of +ellipsoid and the nearest point of its surface to the wall. The energy +of the wall is: :c,image(JPG/fix_wall_ees_image.jpg) @@ -68,21 +68,22 @@ Details of using this command and specifications are the same as fix/wall command. You can also find an example in USER/ees/ under examples/ directory. -The prefactor {epsilon} can be thought of as an -effective Hamaker constant with energy units for the strength of the -ellipsoid-wall interaction.  More specifically, the {epsilon} pre-factor -= 8 * pi^2 * rho_wall * rho_ellipsoid * epsilon -* sigma_a * sigma_b * sigma_c, where epsilon is the LJ parameters for -the constituent LJ particles and sigma_a, sigma_b, and sigma_c are radii -of ellipsoidal particles. Rho_wall and rho_ellipsoid are the number +The prefactor {epsilon} can be thought of as an +effective Hamaker constant with energy units for the strength of the +ellipsoid-wall interaction. More specifically, the {epsilon} pre-factor += 8 * pi^2 * rho_wall * rho_ellipsoid * epsilon +* sigma_a * sigma_b * sigma_c, where epsilon is the LJ parameters for +the constituent LJ particles and sigma_a, sigma_b, and sigma_c are radii +of ellipsoidal particles. Rho_wall and rho_ellipsoid are the number density of the constituent particles, in the wall and ellipsoid respectively, in units of 1/volume. NOTE: You must insure that r is always bigger than sigma_n for -all particles in the group, or LAMMPS will generate an error.  This +all particles in the group, or LAMMPS will generate an error. This means you cannot start your simulation with particles touching the wall -position {coord} (r = sigma_n) or with particles penetrating the wall (0 =< r < sigma_n) or with particles on the wrong side of the -wall (r < 0). +position {coord} (r = sigma_n) or with particles penetrating the wall +(0 =< r < sigma_n) or with particles on the wrong side of the +wall (r < 0). Fix {wall/region/ees} treats the surface of the geometric region defined @@ -93,7 +94,7 @@ Other details of this command are the same as for the "fix wall/region"_fix_wall_region.html command. One may also find an example of using this fix in the examples/USER/misc/ees/ directory. -[Restrictions:] +[Restrictions:] This fix is part of the USER-MISC package. It is only enabled if LAMMPS was built with that package. See the "Making From d1a0c040c9f8cb9da218cfe5ae11fea15ac9fcf5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 20 Aug 2017 23:28:13 -0400 Subject: [PATCH 6/9] add initializers for nmatch/nwant variables in molecule file parser --- src/molecule.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/molecule.cpp b/src/molecule.cpp index b0fec4bcbc..ff209fda21 100644 --- a/src/molecule.cpp +++ b/src/molecule.cpp @@ -1219,7 +1219,7 @@ void Molecule::shakeflag_read(char *line) void Molecule::shakeatom_read(char *line) { - int tmp, nmatch, nwant; + int tmp, nmatch=0, nwant=0; for (int i = 0; i < natoms; i++) { readline(line); if (shake_flag[i] == 1) { @@ -1262,7 +1262,7 @@ void Molecule::shakeatom_read(char *line) void Molecule::shaketype_read(char *line) { - int tmp,nmatch,nwant; + int tmp, nmatch=0, nwant=0; for (int i = 0; i < natoms; i++) { readline(line); if (shake_flag[i] == 1) { From 97edf90a7389be656565e4698741a75339e3e2b5 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 23 Aug 2017 11:22:09 -0400 Subject: [PATCH 7/9] update fix qeq docs for the new, more flexible parameter file format --- doc/src/fix_qeq.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/src/fix_qeq.txt b/doc/src/fix_qeq.txt index 22f4766896..194361e990 100644 --- a/doc/src/fix_qeq.txt +++ b/doc/src/fix_qeq.txt @@ -90,9 +90,14 @@ file specified by {qfile}. The file has the following format ... Ntype chi eta gamma zeta qcore :pre -There is one line per atom type with the following parameters. +There have to be parameters given for every atom type. Wildcard entries +are possible using the same syntax as elsewhere in LAMMPS +(i.e., n*m, n*, *m, *). Later entries will overwrite previous ones. +Empty lines or any text following the pound sign (#) are ignored. +Each line starts with the atom type followed by five parameters. Only a subset of the parameters is used by each QEq style as described -below, thus the others can be set to 0.0 if desired. +below, thus the others can be set to 0.0 if desired, but all five +entries per line are required. {chi} = electronegativity in energy units {eta} = self-Coulomb potential in energy units From e88ff8d6f932b2113c1f985020961f8fffe960f3 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 23 Aug 2017 15:20:30 -0400 Subject: [PATCH 8/9] correct embedded help for GPU lib Install.py --- lib/gpu/Install.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/gpu/Install.py b/lib/gpu/Install.py index 6ea2159de5..13d7ad157e 100644 --- a/lib/gpu/Install.py +++ b/lib/gpu/Install.py @@ -9,8 +9,8 @@ import sys,os,subprocess # help message help = """ -Syntax from src dir: make lib-gpu args="-m machine -h hdir -a arch -p precision -e esuffix -m -o osuffix" -Syntax from lib dir: python Install.py -m machine -h hdir -a arch -p precision -e esuffix -m -o osuffix +Syntax from src dir: make lib-gpu args="-m machine -h hdir -a arch -p precision -e esuffix -b -o osuffix" +Syntax from lib dir: python Install.py -m machine -h hdir -a arch -p precision -e esuffix -b -o osuffix specify one or more options, order does not matter From b52efa28507ff088213e94337a43020ff61b0377 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 23 Aug 2017 15:28:27 -0400 Subject: [PATCH 9/9] add compatibility to NetCDF 4.3.3 as bundled with RHEL 7.x --- src/USER-NETCDF/dump_netcdf.cpp | 3 +++ src/USER-NETCDF/dump_netcdf_mpiio.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/USER-NETCDF/dump_netcdf.cpp b/src/USER-NETCDF/dump_netcdf.cpp index b45794126d..971f69f7cc 100644 --- a/src/USER-NETCDF/dump_netcdf.cpp +++ b/src/USER-NETCDF/dump_netcdf.cpp @@ -70,6 +70,9 @@ const int THIS_IS_A_BIGINT = -4; #define NCERR(x) ncerr(x, NULL, __LINE__) #define NCERRX(x, descr) ncerr(x, descr, __LINE__) +#if !defined(NC_64BIT_DATA) +#define NC_64BIT_DATA NC_64BIT_OFFSET +#endif /* ---------------------------------------------------------------------- */ diff --git a/src/USER-NETCDF/dump_netcdf_mpiio.cpp b/src/USER-NETCDF/dump_netcdf_mpiio.cpp index c5b87b178e..3b753b1b04 100644 --- a/src/USER-NETCDF/dump_netcdf_mpiio.cpp +++ b/src/USER-NETCDF/dump_netcdf_mpiio.cpp @@ -70,6 +70,9 @@ const int THIS_IS_A_BIGINT = -4; #define NCERR(x) ncerr(x, NULL, __LINE__) #define NCERRX(x, descr) ncerr(x, descr, __LINE__) +#if !defined(NC_64BIT_DATA) +#define NC_64BIT_DATA NC_64BIT_OFFSET +#endif /* ---------------------------------------------------------------------- */