[lammps-users] fix evaporate and dump xyz

I am trying to write a Lammps script where I want to add and remove particles. To do that, I use the following fixes:

fix 4 o deposit 20 2 100 29494 region rdep near 2.0 vz -0.005 -0.005 units box
fix 5 o evaporate 100 100 reva 49892

where the regions are defined earlier on (essentially I remove particles that cross a z threshold). In my script, I also have a dump command:

dump 1 all xyz 100 pt_o_deposit.xyz

I have noticed that everything goes well as long as particles are added. However, as soon as one is removed via fix evaporate, I get a segmentation fault: e.g.,

free(): invalid pointer 0x40d3a73b!
600 286.27749 329.67952 -53505.866 363.52234 -53142.344 427
Segmentation fault

This does not happen when the dump command is removed (in fact the error occurs when the dump is invoked, i.e., every 100 steps).

I know the xyz format is not very flexible when it comes to varying number of atoms. So, I could get rid of it.
However, I have some scripts that use xyz files with varying N to postprocess them so I can visualize the system with VMD.

Any help would be appreciated. Thanks.

Paolo Valentini

My guess is that it's a bug with particle deletion/insertion, not
with dump xyz. If you have a simple (small problem) script that
reproduces the problem quickly, please post it and I'll take a look.


The 15Apr10 patch fixes this. it was a bug in dump xyz. It wasn't
checking for bounded atom IDs in the special case when atoms
were both created and destroyed, so that the atom count hadn't changed
but the IDs were actually invalid.

So the bottom line is you really can't use dump xyz all when you are
creating/destroying atoms, as your model does.

Thanks for sending the test problem,