From 87a5a35bad564f50e9fbf7d04c7529c79e55e4c0 Mon Sep 17 00:00:00 2001 From: Michele Ceriotti <michele.ceriotti@gmail.com> Date: Sun, 20 Nov 2016 00:44:23 +0100 Subject: [PATCH] A tiny bugfix for the reset flag, and a brief explanation of the changes --- doc/src/fix_ipi.txt | 16 +++++++++++++--- src/USER-MISC/fix_ipi.cpp | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/doc/src/fix_ipi.txt b/doc/src/fix_ipi.txt index 3899f50529..b1533830bc 100644 --- a/doc/src/fix_ipi.txt +++ b/doc/src/fix_ipi.txt @@ -10,18 +10,19 @@ fix ipi command :h3 [Syntax:] -fix ID group-ID ipi address port \[unix\] :pre +fix ID group-ID ipi address port \[unix\] \[reset\] :pre ID, group-ID are documented in "fix"_fix.html command ipi = style name of this fix command address = internet address (FQDN or IP), or UNIX socket name port = port number (ignored for UNIX sockets) -optional keyword = {unix}, if present uses a unix socket :ul +optional keyword = {unix}, if present uses a unix socket +optional keyword = {reset}, if present reset electrostatics at each call :ul [Examples:] fix 1 all ipi my.server.com 12345 -fix 1 all ipi mysocket 666 unix +fix 1 all ipi mysocket 666 unix reset [Description:] @@ -57,6 +58,15 @@ input are listed in the same order as in the data file of LAMMPS. The initial configuration is ignored, as it will be substituted with the coordinates received from i-PI before forces are ever evaluated. +A note of caution when using potentials that contain long-range +electrostatics, or that contain parameters that depend on box size: +all of these options will be initialized based on the cell size in the +LAMMPS-side initial configuration and kept constant during the run. +This is required to e.g. obtain reproducible and conserved forces. +If the cell varies too wildly, it may be advisable to reinitialize +these interactions at each call. This behavior can be requested by +setting the {reset} switch. + [Restart, fix_modify, output, run start/stop, minimize info:] There is no restart information associated with this fix, since all diff --git a/src/USER-MISC/fix_ipi.cpp b/src/USER-MISC/fix_ipi.cpp index 20b3c90f8a..67c9cc8ee2 100644 --- a/src/USER-MISC/fix_ipi.cpp +++ b/src/USER-MISC/fix_ipi.cpp @@ -195,7 +195,7 @@ FixIPI::FixIPI(LAMMPS *lmp, int narg, char **arg) : inet = ((narg > 5) && (strcmp(arg[5],"unix") == 0) ) ? 0 : 1; master = (comm->me==0) ? 1 : 0; // check if forces should be reinitialized and set flag - reset_flag = ((narg > 6) || (strcmp(arg[5],"reset") == 0) ) ? 1 : 0; + reset_flag = ((narg > 6 && (strcmp(arg[5],"reset") == 0 )) || ((narg > 5) && (strcmp(arg[5],"reset") == 0)) ) ? 1 : 0; hasdata = bsize = 0; -- GitLab