how to get a list of atoms in group into python [SEC=UNCLASSIFIED]

Hello lammps-users,

I am using the lammps Python interface. I was wanting to apply some
displacements to a group of atoms defined in lammps using a python file.
Is there a way of getting the atoms that are defined in a group in the
lammps file back to the python side ?


IMPORTANT: This email remains the property of the Department of Defence and is subject to the jurisdiction of section 70 of the Crimes Act 1914. If you have received this email in error, you are requested to contact the sender and delete the email.

The Python interface is a wrapper on src/library.cpp and .h.
So you can add any method you like to library.cpp
and a wrapper on it to python/

The lammps_get_coords is already similar to what
you want. You could add a variant that takes a group
name. You can also use lammps_extract_atom
to get a pointer to the per-atom mask array which
is what stores all the group flags for every atom.
With that and a list of coords you could easily identify
which are in a particular group.