zotko/xyz2graph

Error while loading xyz file

minhtriet opened this issue · 1 comments

I cannot read the xyz file in the zip file attached.

The error log is

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-21-50342b599ab0> in <module>
      3 
      4 # Read the data from the .xyz file
----> 5 mg.read_xyz('train/99/geometry.xyz')

~/miniconda3/envs/chem/lib/python3.7/site-packages/xyz2graph/xyz2graph.py in read_xyz(self, file_path)
     37                 self.y.append(float(y))
     38                 self.z.append(float(z))
---> 39         self.atomic_radii = [atomic_radii[element] for element in self.elements]
     40         self._generate_adjacency_list()
     41 

~/miniconda3/envs/chem/lib/python3.7/site-packages/xyz2graph/xyz2graph.py in <listcomp>(.0)
     37                 self.y.append(float(y))
     38                 self.z.append(float(z))
---> 39         self.atomic_radii = [atomic_radii[element] for element in self.elements]
     40         self._generate_adjacency_list()
     41 

KeyError: 'tor'

Archive.zip

I however, can convert that xyz file to .aims file and read with ASE using

from ase.io import read
import nglview as nv

slab = read("geometry.aims")
nv.show_ase(slab)
zotko commented

Your xyz file doesn't have a proper format. See folder with examples.