15
$\begingroup$

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.

$\endgroup$

2 Answers 2

14
$\begingroup$

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")
$\endgroup$
3
$\begingroup$

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])
$\endgroup$
0

You must log in to answer this question.