How to get custom properties from read_lammps_dump_text

Hi I have a lammps dump file, created by OVITO, with the following data fields:
ITEM: ATOMS id type Coordination x y z AtomicVolume VoronoiIndex3 VoronoiIndex4 VoronoiIndex5 VoronoiIndex6

I can read the file using code such as: atoms=read_lammps_dump_text(fileobj=open(‘voro.dump’,‘r’), index=-1)

while it’s easy to get positions using atoms.get_positions(), I don’t know how to get the property such as AtomicVolume of the atoms. Thanks for your help.

Looking at the source code: ase/io/lammpsrun.py · master · ase / ase · GitLab

It seems that columns that start with “f_”, “v_” or “c_” will be added to the atoms.arrays . If the column name doesn’t include one of those tokens I think it is probably ignored, but I don’t have a sample file to check.

Thanks for your reply. A short sample file (test.dump) could be like this:

ITEM: TIMESTEP
0
ITEM: NUMBER OF ATOMS
3
ITEM: BOX BOUNDS pp pp pp
0.0 13.0916136302
0.0 196.3742044536
0.0 392.7484089072
ITEM: ATOMS id type Coordination x y z AtomicVolume VoronoiIndex3 VoronoiIndex4 VoronoiIndex5 VoronoiIndex6
1 1 14 6.69539 26.6197 58.7555 16.1455153879 0 4 4 6
2 2 14 5.14103 59.586 56.974 18.6337034538 0 2 8 4
3 1 13 8.41804 64.0469 100.471 15.6944167356 1 4 2 5

It’s a big cell but I removed most of the atoms. I can read it by command atoms=read_lammps_dump_text(fileobj=open(‘test.dump’,‘r’), index=-1)

It looks like a simple hack that works is to edit the column name to “f_AtomicVolume”. Then in the resulting Atoms object(s) we can get the data as atoms.arrays['f_AtomicVolume'].

I don’t know enough about LAMMPS to say whether it would make sense for ASE to handle this differently, but perhaps this workaround will suit you? It is quick to make this edit to the file with sed.

Thanks a lot. It does the trick indeed.