I built a supercell of a molecular crystal and wish to write an .xyz file in ASE. How do I do that? The molecule has three different types of elements, C, H, and N.
2 Answers
Assuming you have an atoms object, all you need to do is call the "write" function.
from ase import Atoms
supercell = Atoms()
supercell.write("supercell.xyz")
I recommend using the underlying function ase.io.write()
import ase.io
from ase.build import bulk
atoms = bulk('Ag')
ase.io.write('ag.xyz', atoms)
Using the function is more general because one could write a series of geometries to one file by providing a list of Atoms objects
ase.io.write('ag.xyz', [atoms, atoms])