uncompute (chunk/atom) error: FIX id not found???

Dear lammps users:

I am attaching (and copying at the end) a simple script that generates a water box (using a H2O molecule file also attached).
Running lammps from 1Jul16 I found segmentation fault after the “uncompute” of last line.

Running the last version to date (9Jan17) and the last stable version (17Nov16) I obtained a weird error message: “ERROR: Could not find fix ID to delete (…/modify.cpp:906)” … I am trying to uncompute the previous compute, but the error is about a fix ID. I don’t understand.

This is a simplified version of my original input script. I am interested to calculate msd from a chunk of atoms and redefine the chunks every 10 or 50 ps (include compute chunk/atom and uncompute in a loop)

Here is the input file:

units metal
dimension 3
boundary p p p
atom_style full

lattice sc 3.104 ### density of water 1 g/cm3
region bulto block -5 5 -5 5 -5 5
create_box 2 bulto bond/types 1 angle/types 1 extra/bond/per/atom 2 extra/angle/per/atom 2 extra/special/per/atom 2

bond_style harmonic
angle_style harmonic
molecule 1 H2O_mol.txt ## Read H2O molecule
create_atoms 0 region bulto mol 1 27236

bond_coeff 1 24.029 1
angle_coeff 1 1.985 109.47

mass 1 15.9994
mass 2 1.0008

group O type 1
group H type 2

pair_style lj/cut/coul/long 9
pair_modify mix arithmetic ##sigma es promedio aritmetico, epsilon promedio geometrico

pair_coeff 1 1 0.00673878 3.16554132
pair_coeff 2 2 0 0

kspace_style pppm 1.0e-4

thermo 10

thermo_style custom step temp ke pe etotal press pxx pyy pzz vol lx ly lz

timestep 0.001 # 1 fs
run_style respa 2 2 pair 1 kspace 2

special_bonds lj/coul 0.0 0.0 1.0

fix nvt all nvt temp 298 298 0.1

compute 10 O chunk/atom bin/cylinder z lower 50.0 0.0 0.0 5 14 3 nchunk once units box
run 100
uncompute 10

The H2O_mol.txt is:

Molecule H2O
3 atoms
2 bonds
1 angles

Coords

1 0 0 0
2 0.8164904 0.00000 0.5773590
3 -0.8164904 0.00000 0.5773590

Types

1 1
2 2
3 2

Charges

1 -0.82
2 0.41
3 0.41

Bonds

1 1 1 2
2 1 1 3

Angles

1 1 2 1 3

H2O_mol.txt (214 Bytes)

in.water_box (1.17 KB)

Dear lammps users:

I am attaching (and copying at the end) a simple script that generates a
water box (using a H2O molecule file also attached).
Running lammps from 1Jul16 I found segmentation fault after the "uncompute"
of last line.

Running the last version to date (9Jan17) and the last stable version
(17Nov16) I obtained a weird error message: "ERROR: Could not find fix ID
to delete (../modify.cpp:906)" ... I am trying to uncompute the previous
compute, but the error is about a fix ID. I don't understand.

yes, this is a bit confusing. however, it is easy to explain.
depending on the options used, compute chunk/atom may create a fix for
storing data internally. however, in your case this does not happen
and when the compute it deleted, it tries to delete a fix that isn't
there; hence the error message. the segfault in the older version is
due to the same reason, but that code is missing one test, that avoids
the segfault.

this whole thing is easily remedied with a change like this:

commit 2f13365cf5f3ef8cbb3cf1302d960c6f1062d9f0
Author: Axel Kohlmeyer <[email protected]>

    avoid spurious error message, when no storage fix is active/used

diff --git a/src/compute_chunk_atom.cpp b/src/compute_chunk_atom.cpp
index fafcf7a..925c5fb 100644
--- a/src/compute_chunk_atom.cpp
+++ b/src/compute_chunk_atom.cpp
@@ -493,7 +493,7 @@ ComputeChunkAtom::~ComputeChunkAtom()
{
   // check nfix in case all fixes have already been deleted

- if (modify->nfix) modify->delete_fix(id_fix);
+ if (id_fix && modify->nfix) modify->delete_fix(id_fix);
   delete [] id_fix;

   memory->destroy(chunk);

axel

Thank very much,
It works perfect.

Rafael.