[lammps-users] read_restart Error: charge/regulation fix

Hi all,

I am using LAMMPS version 29 September 2021 to simulate multiple coarse-grained polymer chains in a cubic box with PBCs in constant NVE + Langevin thermostat. The atom style is full and forces are computed using lj/cut/coulomb/debye and harmonic springs for covalent bonds.

In addition to this, I am using charge/regulation fixes for acid/base protonation/deprotonation.

The simnulations are running nicely except when I am restarting them using the read_restart command. I have tried using simple restart and mpiio options and both of them are giving different errors; the input script is attached. I have checked the remap option while read_restart but couldn’t get any help.

With MPIIO:

Reading restart file …

restart file = 29 Sep 2021, LAMMPS = 29 Sep 2021

restoring atom style full from restart

orthogonal box = (-250.00000 -250.00000 -250.00000) to (250.00000 250.00000 250.00000)

2 by 3 by 4 MPI processor grid

restoring pair style lj/cut/coul/debye from restart

restoring bond style harmonic from restart

ERROR on proc 0: Unexpected end of file while reading file ‘rst.mpiio.5000000’ (src/modify.cpp: 1540)

Without MPIIO:

Reading restart file …

restart file = 29 Sep 2021, LAMMPS = 29 Sep 2021

restoring atom style full from restart

orthogonal box = (-250.00000 -250.00000 -250.00000) to (250.00000 250.00000 250.00000)

2 by 3 by 4 MPI processor grid

restoring pair style lj/cut/coul/debye from restart

restoring bond style harmonic from restart

libc++abi: terminating with uncaught exception of type std::bad_alloc: std::bad_alloc

libc++abi: terminating with uncaught exception of type std::bad_alloc: std::bad_alloc

[] *** Process received signal ***

[] Signal: Aborted (6)

[] Signal code: (-6)

[] [ 0] libc++abi: terminating with uncaught exception of type std::bad_alloc: std::bad_alloc

The command for running simulations is given below:

mpirun -np $NCPUS lmp_mpi -log my.log -in in.poly

Here, $NCPUS is supplied from the submission script. Each MPI process is using 1 OpenMP thread.

Without charge/regulation without and with MPIIO, simulations are restarting without any error.

Any help is appreciated.

Sincerely,

Piyush

in.poly (1.71 KB)

Thanks for your report.

From looking at the source code of fix charge/regulation, it appears that it does not support restarting, but had by accident a flag for triggering a restart set.
However, only changing that does not resolve problems restarting runs, so some time debugging effort is needed.
I will report here if a solution was found.

please try recompiling with the following patch added.
I recommend against using the mpiio restart format, too.
The change should apply to both variants and resolve either issue, though.

commit f7d049ac2dee42dcd077fe07fec1d0e21e8cc733 (HEAD -> maintenance-2021-09-29, akohlmey/maintenance-2021-09-29)
gpg: Signature made Wed 24 Nov 2021 03:36:16 PM EST
gpg: using RSA key EEA103764C6C633EDC8AC428D9B44E93BF0C375A
gpg: Good signature from "Axel Kohlmeyer <[[email protected]](mailto:[email protected])>" [ultimate]
Author: Axel Kohlmeyer <[[email protected]](mailto:[email protected])>

generate atom tags for newly created atoms, if tags are enabled. triclinic support.

diff --git a/src/MC/fix_charge_regulation.cpp b/src/MC/fix_charge_regulation.cpp
index 2497b3d976..626a2e389d 100644
--- a/src/MC/fix_charge_regulation.cpp
+++ b/src/MC/fix_charge_regulation.cpp
@@ -75,7 +75,7 @@ FixChargeRegulation::FixChargeRegulation(LAMMPS *lmp, int narg, char **arg) :
size_vector = 8;
global_freq = 1;
extvector = 0;
- restart_global = 1;
+ restart_global = 0;
time_depend = 1;
cr_nmax = 0;
overlap_flag = 0;
@@ -985,9 +985,17 @@ int FixChargeRegulation::insert_particle(int ptype, double charge, double rd, do
modify->create_attribute(m);

}
+ atom->natoms++;
atom->nghost = 0;
+ if (atom->tag_enable) {
+ if (atom->tag_enable) {
+ atom->tag_extend();
+ if (atom->map_style != Atom::MAP_NONE) atom->map_init();
+ }
+ }
+ if (triclinic) domain->x2lamda(atom->nlocal);
comm->borders();
- atom->natoms++;
+ if (triclinic) domain->lamda2x(atom->nlocal+atom->nghost);
return m;
}

Hi Axel,

Thank you so much for the quick response and modifying the source code. I have checked this new patch. Unfortunately, I am still encountering error shown below:

read_restart rst.mpiio.* remap
Reading restart file …
ERROR: Incomplete or corrupted LAMMPS restart file (src/read_restart.cpp:1160)
Last command: read_restart rst.mpiio.* remap

Best regards,
Piyush

don’t use mpiio.

also, you cannot read only restarts.
both, reading and writing restarts had problems with fix charge/regulation

that was supposed to old restarts.

Hi Axel,

It is working now without mpiio (“old restarts”), despite a warning shown below.