From f4d0aa33936f036f21473ec03035e91e45c562be Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 27 Oct 2017 11:25:57 -0400 Subject: [PATCH 1/8] correct cut-n-paste bug reported by Massimo Pica Ciamarra on lammps-users --- src/dump_image.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dump_image.cpp b/src/dump_image.cpp index eedfb89992..0e5f57be6b 100644 --- a/src/dump_image.cpp +++ b/src/dump_image.cpp @@ -1345,7 +1345,7 @@ int DumpImage::modify_param(int narg, char **arg) if (atom->nbondtypes == 0) error->all(FLERR,"Dump modify bdiam not allowed with no bond types"); int nlo,nhi; - force->bounds(FLERR,arg[1],atom->ntypes,nlo,nhi); + force->bounds(FLERR,arg[1],atom->nbondtypes,nlo,nhi); double diam = force->numeric(FLERR,arg[2]); if (diam <= 0.0) error->all(FLERR,"Illegal dump_modify command"); for (int i = nlo; i <= nhi; i++) bdiamtype[i] = diam; From f6658d10b78e10022089b1f52005f0f70ea27e65 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 30 Oct 2017 23:33:26 -0400 Subject: [PATCH 2/8] fix incorrect create_atoms example for selecting created atoms with a variable --- doc/src/create_atoms.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/src/create_atoms.txt b/doc/src/create_atoms.txt index 98c3c24a0b..e14dd8c85e 100644 --- a/doc/src/create_atoms.txt +++ b/doc/src/create_atoms.txt @@ -227,16 +227,18 @@ the sinusoid would appear to be "smoother". Also note the use of the converts lattice spacings to distance. Click on the image for a larger version. +dimension 2 variable x equal 100 variable y equal 25 lattice hex 0.8442 region box block 0 $x 0 $y -0.5 0.5 create_box 1 box :pre -variable xx equal 0.0 -variable yy equal 0.0 +variable xx internal 0.0 +variable yy internal 0.0 variable v equal "(0.2*v_y*ylat * cos(v_xx/xlat * 2.0*PI*4.0/v_x) + 0.5*v_y*ylat - v_yy) > 0.0" -create_atoms 1 box var v set x xx set y yy :pre +create_atoms 1 box var v set x xx set y yy +write_dump all atom sinusoid.lammpstrj :pre :c,image(JPG/sinusoid_small.jpg,JPG/sinusoid.jpg) From 65b77230fddb6fdaa293aec8ee5b8d30239184b7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Thu, 2 Nov 2017 15:04:04 -0400 Subject: [PATCH 3/8] added missing "dihedral" in compute dihedral/local docs --- doc/src/compute_dihedral_local.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/compute_dihedral_local.txt b/doc/src/compute_dihedral_local.txt index 91370a947a..865e86fddb 100644 --- a/doc/src/compute_dihedral_local.txt +++ b/doc/src/compute_dihedral_local.txt @@ -27,8 +27,8 @@ compute 1 all dihedral/local phi :pre Define a computation that calculates properties of individual dihedral interactions. The number of datums generated, aggregated across all -processors, equals the number of angles in the system, modified by the -group parameter as explained below. +processors, equals the number of dihedral angles in the system, modified +by the group parameter as explained below. The value {phi} is the dihedral angle, as defined in the diagram on the "dihedral_style"_dihedral_style.html doc page. From b34000a5e16525eaf17d12ad718431bc57c7cf31 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sat, 4 Nov 2017 02:49:22 -0400 Subject: [PATCH 4/8] make *_gpu_reinit() functions consistent in returning void. correct prototypes in src/GPU, too. this supersedes and closes #719 --- lib/gpu/lal_lj_expand_ext.cpp | 2 +- src/GPU/pair_gauss_gpu.cpp | 2 +- src/GPU/pair_lj_cut_coul_long_gpu.cpp | 2 +- src/GPU/pair_lj_cut_gpu.cpp | 2 +- src/GPU/pair_lj_expand_gpu.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/gpu/lal_lj_expand_ext.cpp b/lib/gpu/lal_lj_expand_ext.cpp index 94a57192b9..a9c791803b 100644 --- a/lib/gpu/lal_lj_expand_ext.cpp +++ b/lib/gpu/lal_lj_expand_ext.cpp @@ -92,7 +92,7 @@ int lje_gpu_init(const int ntypes, double **cutsq, double **host_lj1, // --------------------------------------------------------------------------- // Copy updated coeffs from host to device // --------------------------------------------------------------------------- -int lje_gpu_reinit(const int ntypes, double **cutsq, double **host_lj1, +void lje_gpu_reinit(const int ntypes, double **cutsq, double **host_lj1, double **host_lj2, double **host_lj3, double **host_lj4, double **offset, double **shift) { int world_me=LJEMF.device->world_me(); diff --git a/src/GPU/pair_gauss_gpu.cpp b/src/GPU/pair_gauss_gpu.cpp index a8cb695b3a..01cc63a9f9 100644 --- a/src/GPU/pair_gauss_gpu.cpp +++ b/src/GPU/pair_gauss_gpu.cpp @@ -43,7 +43,7 @@ int gauss_gpu_init(const int ntypes, double **cutsq, double **host_a, double **b, double **offset, double *special_lj, const int nlocal, const int nall, const int max_nbors, const int maxspecial, const double cell_size, int &gpu_mode, FILE *screen); -int gauss_gpu_reinit(const int ntypes, double **cutsq, double **host_a, +void gauss_gpu_reinit(const int ntypes, double **cutsq, double **host_a, double **b, double **offset); void gauss_gpu_clear(); int ** gauss_gpu_compute_n(const int ago, const int inum, diff --git a/src/GPU/pair_lj_cut_coul_long_gpu.cpp b/src/GPU/pair_lj_cut_coul_long_gpu.cpp index 8ea7a7f07b..0c09cb1d51 100644 --- a/src/GPU/pair_lj_cut_coul_long_gpu.cpp +++ b/src/GPU/pair_lj_cut_coul_long_gpu.cpp @@ -56,7 +56,7 @@ int ljcl_gpu_init(const int ntypes, double **cutsq, double **host_lj1, double **host_cut_ljsq, double host_cut_coulsq, double *host_special_coul, const double qqrd2e, const double g_ewald); -int ljcl_gpu_reinit(const int ntypes, double **cutsq, double **host_lj1, +void ljcl_gpu_reinit(const int ntypes, double **cutsq, double **host_lj1, double **host_lj2, double **host_lj3, double **host_lj4, double **offset, double **host_lj_cutsq); void ljcl_gpu_clear(); diff --git a/src/GPU/pair_lj_cut_gpu.cpp b/src/GPU/pair_lj_cut_gpu.cpp index ef97269772..feba9ed88b 100644 --- a/src/GPU/pair_lj_cut_gpu.cpp +++ b/src/GPU/pair_lj_cut_gpu.cpp @@ -45,7 +45,7 @@ int ljl_gpu_init(const int ntypes, double **cutsq, double **host_lj1, const int nall, const int max_nbors, const int maxspecial, const double cell_size, int &gpu_mode, FILE *screen); -int ljl_gpu_reinit(const int ntypes, double **cutsq, double **host_lj1, +void ljl_gpu_reinit(const int ntypes, double **cutsq, double **host_lj1, double **host_lj2, double **host_lj3, double **host_lj4, double **offset); diff --git a/src/GPU/pair_lj_expand_gpu.cpp b/src/GPU/pair_lj_expand_gpu.cpp index 33bbf60600..43ec1ec45a 100644 --- a/src/GPU/pair_lj_expand_gpu.cpp +++ b/src/GPU/pair_lj_expand_gpu.cpp @@ -45,7 +45,7 @@ int lje_gpu_init(const int ntypes, double **cutsq, double **host_lj1, const int nlocal, const int nall, const int max_nbors, const int maxspecial, const double cell_size, int &gpu_mode, FILE *screen); -int lje_gpu_reinit(const int ntypes, double **cutsq, double **host_lj1, +void lje_gpu_reinit(const int ntypes, double **cutsq, double **host_lj1, double **host_lj2, double **host_lj3, double **host_lj4, double **offset, double **shift); void lje_gpu_clear(); From 5a8c5eb4791677526d8f20a6c36077b78e9e6f4a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 6 Nov 2017 10:41:01 -0500 Subject: [PATCH 5/8] provide last input command line with error->one() output --- src/error.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/error.cpp b/src/error.cpp index 0969507fc9..9193314fc8 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -115,10 +115,10 @@ void Error::all(const char *file, int line, const char *str) if (me == 0) { if (input && input->line) lastcmd = input->line; if (screen) fprintf(screen,"ERROR: %s (%s:%d)\n" - "Last command: %s\n", + "Last command: %s\n", str,file,line,lastcmd); if (logfile) fprintf(logfile,"ERROR: %s (%s:%d)\n" - "Last command: %s\n", + "Last command: %s\n", str,file,line,lastcmd); } @@ -152,9 +152,17 @@ void Error::all(const char *file, int line, const char *str) void Error::one(const char *file, int line, const char *str) { int me; + const char *lastcmd = (const char*)"(unknown)"; MPI_Comm_rank(world,&me); - if (screen) fprintf(screen,"ERROR on proc %d: %s (%s:%d)\n", - me,str,file,line); + + if (input && input->line) lastcmd = input->line; + if (screen) fprintf(screen,"ERROR on proc %d: %s (%s:%d)\n" + "Last command: %s\n", + me,str,file,line,lastcmd); + if (logfile) fprintf(logfile,"ERROR on proc %d: %s (%s:%d)\n" + "Last command: %s\n", + me,str,file,line,lastcmd); + if (universe->nworlds > 1) if (universe->uscreen) fprintf(universe->uscreen,"ERROR on proc %d: %s (%s:%d)\n", From 0f971bf07caa346222d842a78f42f71eb68a0926 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 6 Nov 2017 10:41:32 -0500 Subject: [PATCH 6/8] print name of unknown or incorrect variable in error message --- src/input.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/input.cpp b/src/input.cpp index 23b89d3040..3d287771b8 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -530,8 +530,11 @@ void Input::substitute(char *&str, char *&str2, int &max, int &max2, int flag) value = variable->retrieve(var); } - if (value == NULL) error->one(FLERR,"Substitution for illegal variable"); - + if (value == NULL) { + char str[128]; + sprintf(str,"Substitution for illegal variable %s",var); + error->one(FLERR,str); + } // check if storage in str2 needs to be expanded // re-initialize ptr and ptr2 to the point beyond the variable. From 09c61ca5981b0d5f81f2c6b2fae8f0ab7d69ff61 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Mon, 6 Nov 2017 13:29:59 -0500 Subject: [PATCH 7/8] correct listing of USER-OMP variants of fix rigid styles --- doc/src/Section_commands.txt | 8 ++++---- doc/src/fix_rigid.txt | 10 ++++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/doc/src/Section_commands.txt b/doc/src/Section_commands.txt index e816c8831b..62d3bf3d71 100644 --- a/doc/src/Section_commands.txt +++ b/doc/src/Section_commands.txt @@ -637,10 +637,10 @@ USER-INTEL, k = KOKKOS, o = USER-OMP, t = OPT. "rigid/nve (o)"_fix_rigid.html, "rigid/nvt (o)"_fix_rigid.html, "rigid/small (o)"_fix_rigid.html, -"rigid/small/nph (o)"_fix_rigid.html, -"rigid/small/npt (o)"_fix_rigid.html, -"rigid/small/nve (o)"_fix_rigid.html, -"rigid/small/nvt (o)"_fix_rigid.html, +"rigid/small/nph"_fix_rigid.html, +"rigid/small/npt"_fix_rigid.html, +"rigid/small/nve"_fix_rigid.html, +"rigid/small/nvt"_fix_rigid.html, "setforce (k)"_fix_setforce.html, "shake"_fix_shake.html, "spring"_fix_spring.html, diff --git a/doc/src/fix_rigid.txt b/doc/src/fix_rigid.txt index a5a631bd38..eced602c4b 100644 --- a/doc/src/fix_rigid.txt +++ b/doc/src/fix_rigid.txt @@ -7,11 +7,17 @@ :line fix rigid command :h3 +fix rigid/omp command :h3 fix rigid/nve command :h3 +fix rigid/nve/omp command :h3 fix rigid/nvt command :h3 +fix rigid/nvt/omp command :h3 fix rigid/npt command :h3 +fix rigid/npt/omp command :h3 fix rigid/nph command :h3 +fix rigid/nph/omp command :h3 fix rigid/small command :h3 +fix rigid/small/omp command :h3 fix rigid/nve/small command :h3 fix rigid/nvt/small command :h3 fix rigid/npt/small command :h3 @@ -28,7 +34,7 @@ bodystyle = {single} or {molecule} or {group} :l {molecule} args = none {custom} args = {i_propname} or {v_varname} i_propname = an integer property defined via fix property/atom - v_varname = an atom-style or atomfile-style variable + v_varname = an atom-style or atomfile-style variable {group} args = N groupID1 groupID2 ... N = # of groups groupID1, groupID2, ... = list of N group IDs :pre @@ -93,7 +99,7 @@ fix 1 clump rigid custom v_bodyid :pre fix 0 all property/atom i_bodyid read_restart data.rigid fix 0 NULL Bodies fix 1 clump rigid/small custom i_bodyid :pre - + [Description:] Treat one or more sets of atoms as independent rigid bodies. This From 2e40c00995a1591d7d57567aaa3112cecb43dd32 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 7 Nov 2017 10:00:57 -0500 Subject: [PATCH 8/8] add option to the print command to also print to the global universe screen and logfile --- doc/src/print.txt | 13 ++++++++++--- src/input.cpp | 11 +++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/doc/src/print.txt b/doc/src/print.txt index 4c9e5b4d76..77e0c7cfd3 100644 --- a/doc/src/print.txt +++ b/doc/src/print.txt @@ -14,10 +14,11 @@ print string keyword value :pre string = text string to print, which may contain variables :ulb,l zero or more keyword/value pairs may be appended :l -keyword = {file} or {append} or {screen} :l +keyword = {file} or {append} or {screen} or {universe} :l {file} value = filename {append} value = filename - {screen} value = {yes} or {no} :pre + {screen} value = {yes} or {no} + {universe} value = {yes} or {no} :pre :ule [Examples:] @@ -26,6 +27,7 @@ print "Done with equilibration" file info.dat print Vol=$v append info.dat screen no print "The system volume is now $v" print 'The system volume is now $v' +print "NEB calculation 1 complete" screen no universe yes print """ System volume = $v System temperature = $t @@ -49,6 +51,11 @@ it does not exist. If the {screen} keyword is used, output to the screen and logfile can be turned on or off as desired. +If the {universe} keyword is used, output to the global screen and +logfile can be turned on or off as desired. In multi-partition +calculations, the {screen} option and the corresponding output only +apply to the screen and logfile of the individual partition. + If you want the print command to be executed multiple times (with changing variable values), there are 3 options. First, consider using the "fix print"_fix_print.html command, which will print a string @@ -74,4 +81,4 @@ thermodynamic properties, global values calculated by a [Default:] -The option defaults are no file output and screen = yes. +The option defaults are no file output, screen = yes, and universe = no. diff --git a/src/input.cpp b/src/input.cpp index 3d287771b8..d18be498fd 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -1175,6 +1175,7 @@ void Input::print() FILE *fp = NULL; int screenflag = 1; + int universeflag = 0; int iarg = 1; while (iarg < narg) { @@ -1197,6 +1198,12 @@ void Input::print() else if (strcmp(arg[iarg+1],"no") == 0) screenflag = 0; else error->all(FLERR,"Illegal print command"); iarg += 2; + } else if (strcmp(arg[iarg],"universe") == 0) { + if (iarg+2 > narg) error->all(FLERR,"Illegal print command"); + if (strcmp(arg[iarg+1],"yes") == 0) universeflag = 1; + else if (strcmp(arg[iarg+1],"no") == 0) universeflag = 0; + else error->all(FLERR,"Illegal print command"); + iarg += 2; } else error->all(FLERR,"Illegal print command"); } @@ -1208,6 +1215,10 @@ void Input::print() fclose(fp); } } + if (universeflag && (universe->me == 0)) { + if (universe->uscreen) fprintf(universe->uscreen, "%s\n",line); + if (universe->ulogfile) fprintf(universe->ulogfile,"%s\n",line); + } } /* ---------------------------------------------------------------------- */