[lammps-users] lammps_gather

Hello,

i am trying to extract my atom coordinates with:

coords = lmp.gather_atoms("x",1,3)
import_position = list(zip(*(iter(list(coords)),) * 3))

But my coordinates are all 0.

I was able to read in a data file and extract the bos size, atom numbers, potential energy:

lmp = lammps(cmdargs=["-screen","none"])
lmp.file("C:/Users/Documents/LAMMPS/Lammps/reaxx_296.in")
natoms = lmp.get_natoms()
boxlo,boxhi,xy,yz,xz,periodicity,box_change = lmp.extract_box()
cubic_size = boxhi[0]-boxlo[0]
print(natoms,boxlo,boxhi,cubic_size)

#Set potential energy calculation
lmp.command("compute 1 all pe")
lmp.command("variable pe equal pe")

#calculate potenEn
lmp.command("run 0 pre no post no")
potenEn = lmp.extract_variable('pe','all',0)

there was a bug in the library interface code for gather_atoms in the 29 October 2020 version that has been fixed since.
https://github.com/lammps/lammps/releases/tag/patch_30Nov2020

axel.

Thank you. Updating to dec 2020 fixed it.

Best regards