Getting the atom coordinates in a bulk system


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, 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!


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

from import vasp

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 import read
atoms = read('CONTCAR')