Dear LAMMPS users,
I'm following up on the old post on the list.
Trying to get all coordinates for a given
type, e.g. 2, I put this in my LAMMPS script:
group MYGRP type 2
variable MYCOORDS atom x
variable MYCOUNT equal count(MYGRP)
Using the functions from library.cpp by
double* pnatoms = (double*) lammps_extract_variable(lmp, "MYCOUNT", NULL);
int natoms = (int)(*pnatoms);
double* coords = (double*)
lammps_extract_variable(lmp, "MYCOORDS", "MYGRP");
However, coords contains only zeros, e.g. 0.0, 0.0, 0.0.
Apparently I'm doing something wrong, but I'm not sure what.
Maybe somebody can point me in the right direction.