unfix gcmc -> segfault

hi LAMMPS users,

i’m encountering a segmentation fault with LAMMPS when unfixing gcmc. everything else (writing restart files, etc) seems fine.
i use LAMMPS from march 09 2013, the serial verison compiled with g++ 4.6.2 on openSUSE 12.1. the parallel (openMPI) version of LAMMPS runs into the same issue.

gdb spits out that the trouble happens in free():

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff60dad24 in free () from /lib64/libc.so.6

however, i guess this can mean a lot of things…

attached to this mail is an archive with input that produces the error on my machine.

the error also persists if the fix does not add any particles to the system, so i guess it’s really the unfixing. previously i also got this in my output: http://pastebin.com/gPumPsMJ from LAMMPS (also serial), but this was with a more complex topology. in the very beginning i had it running in parallel and there i was able to unfix gcmc a couple times but it crashed after some three times unfixing.

did i oversee something when using the fix or did i run into a bug here?



gcmcTest.tar.gz (39.9 KB)

Paul can look at this ... thanks for sending an example.


There were a couple of deletes of uninitialized variables in the destructor. They've been fixed in the attached and in the repository. The segfault only shows up in special circumstances as in your example, so thanks for pointing out the segfault and sending an example.


fix_gcmc.cpp (40.9 KB)

fix_gcmc.h (6.11 KB)

hi paul,

thank you very much! works perfectly now.