Getting the atom coordinates in a bulk system

Hello,

I just started learning how to use ASE. I’m wondering can I get every atoms coordinates after a bulk system is generated? say I have
from ase.spacegroup import crystal

a = 5.64
nacl = crystal([‘Na’, ‘Cl’], [(0, 0, 0), (0.5, 0.5, 0.5)], spacegroup=225,
cellpar=[a, a, a, 90, 90, 90])

What command should use to get Na Cl coordinates.
Any help would be greatly appreciated!

nacl will be an Atoms object, so be sure to look up the documentation for the Atoms object.

A good starting point is to click on “Modules” on wiki.fysik.dtu.dk/ase, and then find it in the list.

To also answer the question, nacl.get_positions() returns the positions as an array.

Thank you so much for quick reply. It helps a lot!

Hello,

May I ask another question?
I was trying to read vasp input as the following way

from ase.io import vasp
vasp.read_vasp(filename=‘CONTCAR’)

And it reports an error says
iofunc() missing 1 required positional argument: ‘file’

I’m not sure what it means and I’ve checked the working directory and file name are correct.
Any help would be greatly appreciated!

Hi Qi,
file is a positional argument, so the syntax would look like this:

atoms = vasp.read_vasp('CONTCAR')

Or, generally:

from ase.io import read
atoms = read('CONTCAR')