# Converting input file into XYZ format using ASE

Here is my code:

import ase
from ase.io import read, write
bec_new = ase.io.write("bec_replaced.xyz", format="xyz")
TypeError: write() missing 1 required positional argument: 'images'


What am I supposed to put for images?

• Did you see the API manual? wiki.fysik.dtu.dk/ase/ase/io/io.html it says images: Atoms object or list of Atoms objects Sep 3 at 17:39
• I put bec_atoms = Atoms('Al8Ge16O64Si8') as image, but it creates the xyz file without co-ordinates. Like,  96 Al 0.000000000000000 0.000000000000000 0.000000000000000 Al 0.000000000000000 0.000000000000000 0.000000000000000 Al 0.000000000000000 0.000000000000000 0.000000000000000 Al 0.000000000000000 0.000000000000000 0.000000000000000 Al 0.000000000000000 0.000000000000000 0.000000000000000 .... Sep 3 at 17:56
• @Saha_1994 Welcome to our new community, and thank you for contributing your question here! We hope to see much more of you in the future!!! Perhaps you can give us the input you were trying, and the output it gave you. That would be the most appropriate way to ask this question. Sep 3 at 19:06
• Related, but not exactly the same: mattermodeling.stackexchange.com/q/4615/5 Sep 3 at 19:20

Here is a more concise way of doing the same thing.

from ase.io import read


It is not needed to import ase and import the functions, you want to do one or the other (This is a python thing not ASE). read also returns an atoms object with a write function built in, so there is no need to import a write function. ASE will also assume the file format from the file extension, however you might need to use the format argument when it detects things incorrectly.

Optionally, use the command line instead

ase convert bec_replaced.vasp bec_replaced.xyz


You should do something like this instead:

import ase
from ase.io import read, write
bec_new = ase.io.write("bec_replaced.xyz", bec, format="xyz")


according to the documentation page.