Reading coordinates from a file is a very simple task with ASE. The following code reads the three different file types into an Atoms
object:
from ase import io
lammps = io.read('mos2.pos',format='lammps-data')
cif = io.read('mos2.cif')
xyz = io.read('mos2.xyz')
ASE can detect certain file formats from the ending, like in the case of .cif and .xyz. For the lammps file the format needs to be set explicitly.
The formats that ASE natively supports are documented here:
https://wiki.fysik.dtu.dk/ase/ase/io/io.html
And some format specific options are listed here:
https://wiki.fysik.dtu.dk/ase/ase/io/formatoptions.html
If the file contains multiple sets of coordinates index
can be used to select a certain one or a selection.
from ase import io
xyz_last = io.read('mos2.xyz',index='-1')
xyz_all = io.read('mos2.xyz',index=':')