Segfault with chunk/atom and write_restart

Hi,

I noticed that if compute chunk/atom has been defined, LAMMPS segfaults when writing a restart file. I’m running LAMMPS version from April 16th 2015. The attached input script “input.lmp” illustrates the problem.

Best regards,

Kimmo

input.lmp (705 Bytes)

datafile.dat (14.7 KB)

Hi,

I noticed that if compute chunk/atom has been defined, LAMMPS segfaults when
writing a restart file. I'm running LAMMPS version from April 16th 2015. The
attached input script "input.lmp" illustrates the problem.

thanks for the easy to use input example. the following one line
change should correct the code and remove the issue.

axel.

diff --git a/src/compute_chunk_atom.cpp b/src/compute_chunk_atom.cpp
index 5b3b452..22483c0 100644
--- a/src/compute_chunk_atom.cpp
+++ b/src/compute_chunk_atom.cpp
@@ -499,7 +499,7 @@ void ComputeChunkAtom::init()
   }

   if ((idsflag != ONCE && !lockcount) && fixstore) {
- delete fixstore;
+ modify->delete_fix(fixstore->id);
     fixstore = NULL;
   }
}

correction. the proposed change still has a - rare to expose -
problem. this one should work better:

diff --git a/src/compute_chunk_atom.cpp b/src/compute_chunk_atom.cpp
index 5b3b452..5696032 100644
--- a/src/compute_chunk_atom.cpp
+++ b/src/compute_chunk_atom.cpp
@@ -499,7 +499,7 @@ void ComputeChunkAtom::init()
   }

   if ((idsflag != ONCE && !lockcount) && fixstore) {
- delete fixstore;
+ (modify->nfix) modify->delete_fix(fixstore->id);
     fixstore = NULL;
   }
}

not my day today. now i made a cut-n-paste error. here is another
corrected version.

diff --git a/src/compute_chunk_atom.cpp b/src/compute_chunk_atom.cpp
index 5b3b452..dd23f7e 100644
--- a/src/compute_chunk_atom.cpp
+++ b/src/compute_chunk_atom.cpp
@@ -499,7 +499,7 @@ void ComputeChunkAtom::init()
   }

   if ((idsflag != ONCE && !lockcount) && fixstore) {
- delete fixstore;
+ if (modify->nfix) modify->delete_fix(fixstore->id);
     fixstore = NULL;
   }
}

Already fixed this one, will be in next patch.

Don’t think the modify->nfix test is needed.

Steve

Already fixed this one, will be in next patch.
Don't think the modify->nfix test is needed.

all the other computes that create a fix do it, though.

I think they only do it in the destructor, when LAMMPS may be

shutting down. Compute chunk/atom is doing it in

init(), when it’s not necessary to check.

Steve