[lammps-users] bond style hybrid and restart

Hi, all. I found something which is not a “bug”, but at least a pitfall which could be addressed through a error message or strong note in the documentation. I have developed a bond style called fene/MC which I use together with regular FENE bonds using bond_style hybrid. I get the following issue with restarting simulations from restart files:

If, in my input script, I put the “read_restart” command before the “bond_style hybrid” command, like

read_restart ramph.res.500000
bond_style hybrid fene fene/MC

the run fails in an avalanche of seg faults. If, however, I just reverse these two commands, like

bond_style hybrid fene fene/MC
read_restart ramph.res.500000

the run restarts with no problem. Now, in hindsight, looking at the documentation, I am not surprised by this, but a simple “BOND_STYLE HYBRID MUST BE DECLARED BEFORE ANY READ_RESTART COMMAND” warning (sorry for shouting) could have saved me a lot of time spent on fruitless “debugging”. Now it may be that I am wrong here, and that this problem in fact means there is something wrong with my modified code, but as mentioned above switching the order of the two commands seems to fix it.


I modified bench/in.chain to use bond_style hybrid fene harmonic with
a few harmonic bonds and I do not see the problem you indicate.

You can put the commands in this order:

read_restart tmp.restart.100
bond_style hybrid fene harmonic

or this order:

bond_style hybrid fene harmonic
read_restart tmp.restart.100

or leave out the bond_style command altogether.
This makes sense b/c the restart file actually defines
the bond style hybrid, so if you use a bond_style command
explicitly then the 2nd command is just
deleting what has already been defined and re-defining it.

The one thing you have to do in all 3 cases is use
bond_coeff commands to define the coeffs for fene
and harmonic. These are not stored in the restart file.

If you don't do this you just get an error message, no crash.


Did find one issue that would cause a problem
if you defined a bond_style hybrid command with
N sub-styles, then your restart file was written with M
sub-styles and M > N. But I assume you're not doing
that. It also caused a small memory leak which I
just patched - 11Oct08.

Rob - I suggest you use that fully-patched version and
see if you still have problems.