[lammps-users] Atom numbers using lammps as library

All,

When using the custom method below in library.cpp, I get different atoms when referring to the same index using LAMMPS-4Jan10 and LAMMPS-16Apr10. The atoms are numbered and positioned via a datafile.

16Apr10: Atom276 (-10.6394, -10.084, -5.6575)
4Jan10: Atom1152 (-10.6394, -10.084, -5.6575)

*** Simulation Details ***

1151 Species 2
1 Species 1
ppp boundary

Data file:
1 2 xyz
2 2 xyz
3 2 xyz

1152 2 xyz
1153 1 xyz

The only thing that is different between the two is the form of “fix npt” I’m using in the input script.

#4Jan fix int1 all npt 300.0 300.0 0.1 xyz 0.0 0.0 0.1 drag 1.0
#16Apr fix int1 all npt temp 300.0 300.0 0.1 iso 0.0 0.0 0.1 drag 1.0

*** METHOD ***

/*---------------------------------------------------------------------- */

void lammps_get_atom_coords(void *ptr, int *idx, double *coords) {
LAMMPS *lammps = (LAMMPS *) ptr;
coords[0] = lammps->atom->x[*idx][0];
coords[1] = lammps->atom->x[*idx][1];
coords[2] = lammps->atom->x[*idx][2];
}

/*---------------------------------------------------------------------- */

Michael Sellers

Graduate Student, Chemical and Biological Engineering
University at Buffalo, The State University of New York

Atoms are now spatially sorted (for performance) via the atom_modify sort
option (which is on by default). You can turn this off if you wish.
Sorting just means that the local index of an atom may change; the
atom ID associated with a particular atom will not change. So you
must be printing local indices below, not the global ID.

Steve