gather_atoms after evaporation

Hi,

I’ve run into trouble with the lammps model I have been running through the python library interface, where lmp.gather_atoms seems to stop operating properly after running an evaporate atoms fix.

I use gather_atoms such to create a numpy array of all the atoms in my group “bilayer” (being atoms with type 1 and 2), via a function as follows:

def gather_atoms():
gath_pos = lmp.gather_atoms(“x”, 1, 3)
gath_pos = np.array(gath_pos).reshape(-1,3)
gath_type = lmp.gather_atoms(“type”, 0, 1)
gath_id = lmp.gather_atoms(“id”, 0, 1)
gath = np.column_stack((gath_id, gath_type, gath_pos))

return gath

My code runs absolutely fine up until I use an evaporate fix as follows:

lmp.command(‘fix 4 water_in evaporate 10 9 rsphere 38277 molecule no’)
lmp.command(‘run 1000’)
lmp.command(‘unfix 4’)

Which seems to work correctly, reducing the number of particles in my water_in group by about 10% which is what I wanted. However, after this fix my lmp.gather_atoms function fails, just creating a (correctly sized array) of zeros. Lammps seems to correctly recognize that the total number of atoms in the simulation has reduced, but gather_atoms only returns zeros for any of the atom properties I want to extract.

Thanks,

Paul

If you look at the gather_atoms function(s) in src/library.cpp
you will see that gather_atoms() requires that atom IDs
be consecutive. They probably aren’t after you evaporate.
So it should be returning a warning message and no data
(see the first few lines of the function).

See the gather_atoms_concat() method for an alternitive
that does not try to order the (missing) atoms, it
does not require consecutive IDs.

Steve