ghost atom molecule id

Hello,

I am attempting to implement a custom fix and I need a way to determine
which atoms belong to a particular molecule. In my simulation, all type 2
atoms are molecule atoms. When I loop over all type 2 atoms (ghost included),

and count the number of molecules using atom->molecule, the number I find is

less than nall_type2/atoms_per_molecule but equal to
nlocal_type2/atoms_per_molecule (I did this in serial btw).

The above tells me that the molecule id associated with a ghost atom is not unique,
in the sense that ghost atoms carry the mol-id of the “real atom” they are
associated with. This obviously messes up calculating properties of molecules
on the fly, like the COM.

I was thinking the easiest way to fix this would be to change the mol-id
assigned to a ghost atom when it is created. Can someone point me to the
appropriate portion of the source, where the ghost atoms are created and
the mol-ids are assigned to them? Or maybe this is a bad idea and there is
an easier solution?

By the way this only needs to work in serial, since I will run be running monte carlo
sims independently in the embarrassingly parallel sense. Also, the reason I need to

be able to do this is my fix is going to use a molecule based cutoff to calculate

interactions.

-CBL

Hello,

I am attempting to implement a custom fix and I need a way to determine
which atoms belong to a particular molecule. In my simulation, all type 2
atoms are molecule atoms. When I loop over all type 2 atoms (ghost
included),
and count the number of molecules using atom->molecule, the number I find is
less than nall_type2/atoms_per_molecule but equal to
nlocal_type2/atoms_per_molecule (I did this in serial btw).

The above tells me that the molecule id associated with a ghost atom is not
unique,
in the sense that ghost atoms carry the mol-id of the "real atom" they are
associated with. This obviously messes up calculating properties of
molecules
on the fly, like the COM.

not really. check out:
http://lammps.sandia.gov/doc/compute_com_chunk.html the trick is:
a) use unwrapped coordinates and
b) create an array of the dimension of the number of molecules (or
chunks) times the number of dimensions for the COM, and
c) a second with only the dimension of the number of molecules for the
total mass.
d) fill the arrays with the information for the respective local atoms
call MPI_Allreduce on them so that you have the resulting lists on all
processors.

through using unwrapped coordinates and only local atoms, you have no
need to mess with ghost atoms. after all, it is impossible to know how
long a molecule is and whether it is fully contained in the ghost atom
zone.

I was thinking the easiest way to fix this would be to change the mol-id
assigned to a ghost atom when it is created. Can someone point me to the
appropriate portion of the source, where the ghost atoms are created and
the mol-ids are assigned to them? Or maybe this is a bad idea and there is
an easier solution?

it is a bad idea. ghost atoms are not different atoms, but just
periodic images of the same atom and thus the same molecule.

By the way this only needs to work in serial, since I will run be running

there is no difference between how LAMMPS handles ghost atoms in
serial or in parallel.

axel.

Axel,

Thanks for your reply, it helps a lot.

-CBL