[lammps-users] lammps_gather


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"])
natoms = lmp.get_natoms()
boxlo,boxhi,xy,yz,xz,periodicity,box_change = lmp.extract_box()
cubic_size = boxhi[0]-boxlo[0]

#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.


Thank you. Updating to dec 2020 fixed it.

Best regards