Cannot extract quaternions with python

You are mistaken on using “extract_atom” for the quaternion property from ellipsoids.
It is a bit confusing, but the property you are trying to access is part of the BPM package.

The quaternions for ellipsoids are stored differently and cannot be directly accessed this way. Instead, you have to use compute property/atom and then extract its data. For example with:

units           lj
dimension       3
boundary        p p p
atom_style hybrid bond ellipsoid oxdna
read_data       data.oxdna

compute quat all property/atom quatw quati quatj quatk

run 0 post no

and

from lammps import lammps
from lammps.constants import LMP_STYLE_ATOM, LMP_TYPE_ARRAY
if __name__ == "__main__":

    args = ["-log", "log.lammps", "-screen", "none"]

    lmp = lammps(cmdargs=args)
    lmp.file("in.quat")

    # extract positions
    x = lmp.numpy.extract_atom("x", 3)
    print('x', x)

    f = lmp.numpy.extract_atom("f", 3)
    print('f', f)

    torque = lmp.numpy.extract_atom("torque", 3)
    print('torque', torque)

    # extract quaternions
    q = lmp.numpy.extract_compute("quat", LMP_STYLE_ATOM, LMP_TYPE_ARRAY)
    print('q', q)