2
$\begingroup$

The format of xyz file is as follow.

1st line:66

2nd line:Atoms. Timestep: 18424000

3rd line:C  5.41744 2.36649 8.39936

4th line:O  5.39564 2.39851 9.67522

5th line:Pt -0.0287758 0.341863 -0.0621366

....."

With the help of ase.io.read, I want to load this xyz file by the following command.

all_atoms = read('accum.xyz', format='xyz',index=":")

If I print the all_atoms, the coordinate was absent.

"
[Atoms(symbols='COPt64', pbc=False), 
Atoms(symbols='COPt64', pbc=False), 
Atoms(symbols='COPt64', pbc=False), 
Atoms(symbols='COPt64', pbc=False), 
Atoms(symbols='COPt64', pbc=False), 
Atoms(symbols='COPt64', pbc=False), 
...."

Hence, I wonder what is wrong?

thanks.

$\endgroup$

1 Answer 1

3
$\begingroup$

There are couple things I want to address.

First, the coordinates are not lost. It just doesn't show up when you print the ase.Atoms object. To print out the coordinates, you should do

print(atoms.positions)

Second, I want to notice you that there is no unit cell information in your xyz file so ASE thinks your system is non-periodic. However, based on your description, I think you are modelling a Pt surface slab with a CO* adsorbate. In this case, you must include the unit cell information to make it a reasonable structure. Suppose your unit cell is

cell = [[10.0, 0.0, 0.0], 
        [0.0, 10.0, 0.0], 
        [0.0, 0.0, 20.0]]

You can do the following

for atoms in all_atoms:
    atoms.cell = cell
    atoms.pbc = True
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .