Why “ase.io.read()” can't read the lammps data

from ase import Atoms
from ase.calculators.emt import EMT
from ase.optimize import BFGS
from ase.vibrations import Vibrations
import ase.io

with open(“[email protected]”) as lammps_fileobj:
atoms = ase.io.read(lammps_fileobj, ‘lj’, “atomic”, format=“lammps-data”)

view(atoms)

Traceback (most recent call last):
File “G:/2023/ASE/main.py”, line 8, in
atoms = ase.io.read(lammps_fileobj, ‘lj’, “atomic”, format=“lammps-data”)
TypeError: read() got multiple values for argument ‘format’

If we look at the function signature of ase.io.read:

def read(
        filename: NameOrFile,
        index: Any = None,
        format: str = None,
        parallel: bool = True,
        do_not_split_by_at_sign: bool = False,
        **kwargs
) -> Union[Atoms, List[Atoms]]:

We see that there is only one positional argument (filename). You have given three positional arguments so the remaining ones will be assigned to the named arguments in order: index='lj', format="atomic" and then the named argument is passed format="lammps-data". So the function sees format=... twice and complains.

I don’t think the 'lj' or "atomic" arguments will do what you expected here. What did you expect them to do?