I want to convert the OUTCAR file to a file of xyz (not extxyz) format.

The informaiton of lattice (or cell) is stored in the comment line (like extxyz format).

Can this be done with the help of ase ?



1 Answer 1


You can do this by writing an ".extxyz" file but forcing the name to be ".xyz". In this way, the cell information is stored as comment. To remove the extra columns, you need to specify write_results=False.

from ase.io import read, write

atoms = read('OUTCAR')
write('structure.xyz', atoms, format='extxyz', write_results=False)

Note that ase.io.write writes to an ".extxyz" file by default, no matter you specify the filename to be ".xyz" or ".extxyz". So you will get the same result simply by

write('structure.xyz', atoms, write_results=False)

It only writes to a plain ".xyz" file if you do ase.io.xyz.write_xyz() or ase.io.write(..., format='xyz')


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .