Crashes when restarting a simulation that is using both fix atom/swap and fix bond/create

Dear all,

In my research, I am performing non-equilibrium simulations in which a species (type 1) is converted (via fix atom/swap) to another species (type 2), which then can form bonds (via fix bond/create).

This requires some extra space in the topology lists, which I am providing via the "extra/*/per/atom" options of the read_data or create_box command.

When restarting a simulation (with read_restart) in which the conversion process is not finished, the system crashes and LAMMPS complains about "number of special bonds exceeded".

The LAMMPS version I am using is "29 Jun 2018".

I have created a MWE based on the in.lj example provided in examples/accelerate and append it here.

First, I run "in.swap_initial.lmp", to create a restart file in which conversion is not finished. This input file runs stable for arbitrary times (t >> 1000).

However, when I stop the simulation after e.g. 100 steps and restart it then with "in.swap_restart.lmp", it soon crashes with the error message "ERROR on proc 0: New bond exceeded special list size in fix bond/create (../fix_bond_create.cpp:508)".

To my understanding, this seems to be related to the extra/*/per/atom information not being included in restart files, combined with the read_restart command not offering an option to add this.

I would like to hear your thoughts on whether my assessment of the problem is correct and, if so, whether there is an easy way to fix it.

Best wishes,

Svenja Wagner

First file: in.swap_initial.lmp

in.swap_initial.lmp (950 Bytes)

in.swap_restart.lmp (390 Bytes)

​svenja,

your observation is correct. i am working on adding those extra flags to the restart.
as a workaround, please consider using write_data instead. this is not a perfect restart, but allows to continue your calculations.

axel.​

FYI, restart support for extra/XXX/per/atom settings has been submitted for inclusion into the next LAMMPS patch has been submitted: https://github.com/lammps/lammps/pull/1003
i’ve tested it with your provided input examples and restarting works.

axel.

Dear all,

The same problem I described in the mail below reappeared again in LAMMPS_VERSION “18 Sep 2018” (unstable). It was working in some versions before, but I am not sure anymore about up until when it did.

When running the restart script (see below), it prints “1 = max # of special neighbors”, which should in fact be 37 as “extra/special/per/atom 36” was defined initially and then crashes during simulation with the same error message “ERROR on proc 0: New bond exceeded special list size in fix bond/create (…/fix_bond_create.cpp:508)”.

Checking the source code, I think it is related to l.581 in special.cpp, where force->special_extra is set to 0 in the function Special::combine(), which is called by Special::build().

Special::build() is called by both read_data and create_atoms on initialization.

This leads to force->special_extra being always 0 when it is written into restart files (write_restart.cpp, l.536), such that read_restart.cpp reads always 0 for force->special_extra (read_restart.cpp, l.928).

I could actually fix the problem by setting "force->special_extra = 36; " before special.build() in l.563 of read_restart.cpp.

To solve it cleanly, I guess one could store the initial value of force->special_extra in force.cpp and write this to restart files. However, I am not familiar enough with the internal workings of force, special, etc. to know if this would induce other unwanted side effects or if there is a nicer way to fix it.

Best regards,

Svenja

Dear all,

The same problem I described in the mail below reappeared again in LAMMPS_VERSION "18 Sep 2018" (unstable). It was working in some versions before, but I am not sure anymore about up until when it did.

When running the restart script (see below), it prints "1 = max # of special neighbors", which should in fact be 37 as "extra/special/per/atom 36" was defined initially and then crashes during simulation with the same error message "ERROR on proc 0: New bond exceeded special list size in fix bond/create (../fix_bond_create.cpp:508)".

it does not appear for me. please see the partial log output below.

Reading restart file ...
  restart file = 18 Sep 2018, LAMMPS = 18 Sep 2018
  restoring atom style molecular from restart
  orthogonal box = (0 0 0) to (33.5919 33.5919 33.5919)
  1 by 1 by 1 MPI processor grid
  restoring pair style lj/cut from restart
  restoring bond style harmonic from restart
  32000 atoms
  1 bonds
Finding 1-2 1-3 1-4 neighbors ...
  special bond factors lj: 0 0 0
  special bond factors coul: 0 0 0
  1 = max # of 1-2 neighbors
  0 = max # of 1-3 neighbors
  0 = max # of 1-4 neighbors
  37 = max # of special neighbors
499 atoms in group group2
Resetting global fix info from restart file:
  fix style: atom/swap, fix ID: swap_atoms
All restart file global fix info was re-assigned
Neighbor list info ...
  update every 1 steps, delay 10 steps, check yes
  max neighbors/atom: 2000, page size: 100000
  master list distance cutoff = 2.8
  ghost atom cutoff = 2.8
  binsize = 1.4, bins = 24 24 24
  2 neighbor lists, perpetual/occasional/extra = 1 1 0
  (1) pair lj/cut, perpetual
      attributes: half, newton on
      pair build: half/bin/newton
      stencil: half/bin/3d/newton
      bin: standard
  (2) fix bond/create, occasional, copy from (1)
      attributes: half, newton on
      pair build: copy
      stencil: none
      bin: none
Setting up Verlet run ...

axel.

this has been a recurring issue for me as well. I agree with Svenja’s assessment. you may see this issue by, for example, running the bond/react nylon melt example without the bond/react command, writing a restart, and then attempting to run the restart file while including the bond/react command

current code treats force->special_extra as a ‘disposable’ value, writing it value once to atom->maxspecial and then zeroing it out. as such, it may make more sense to instead write atom->maxspecial to restart files. essentially PRs #611 and #1003 are clashing.

another interesting thought, since the deprecation of special_bonds ‘extra’ keyword, it may not be possible to increase atom->maxspecial when reading from a restart (though may never have been possible)

pull request #1146 https://github.com/lammps/lammps/pull/1146 , which
resolves this issue is now waiting for approval and should be included
in the next patch release.

axel.