7
$\begingroup$

Here is my code:

import ase
from ase.io import read, write
bec = ase.io.read("bec_replaced.vasp")
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?

$\endgroup$
4
  • 1
    $\begingroup$ 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 $\endgroup$
    – Cody Aldaz
    Sep 3 at 17:39
  • $\begingroup$ 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 ....` $\endgroup$
    – Saha_1994
    Sep 3 at 17:56
  • $\begingroup$ @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. $\endgroup$ Sep 3 at 19:06
  • $\begingroup$ Related, but not exactly the same: mattermodeling.stackexchange.com/q/4615/5 $\endgroup$ Sep 3 at 19:20
7
$\begingroup$

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

from ase.io import read
bec = read("bec_replaced.vasp").write("bec_replaced.xyz")

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
$\endgroup$
5
$\begingroup$

You should do something like this instead:

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

according to the documentation page.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.