|From:||Axel Kohlmeyer <akohlmey@...24...>|
|Date:||Thu, 31 Aug 2017 21:46:53 -0400|
Dear LAMMPS users,
dear Steve and Axel,
I'm following up on this 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.
Am 13/04/16 um 17:00 schrieb Steve Plimpton:
> Just see the variable doc page for all the syntax.
> My email was just meant to be an idea, not
> all the details of the correct syntax. Ditto
> for the lib interface function you need to use
> to eval a variable.
> On Tue, Apr 12, 2016 at 9:50 AM, Stephan Grein
> Dear Steve,
> thanks so much!
> Am 12/04/16 um 17:27 schrieb Steve Plimpton:
> > variable equal x x[id]
> This sounds interesting.
> I'm not sure how to define this
> in my script, sorry!
> Would I do like that:
> myAtomNameToTrack equal x x[myAtomId]
> Then using:
> lammps_extract_variable(lmp, "myAtomNameToTrack", NULL);
> Right? TIA.