While running CGCNN over a cif file pymatgen throws the following attribute error.
Traceback (most recent call last):
File "C:\Users\fes33\Documents\GIK - R&D\Personal - Papers and Reports\17 - MOF Database and Review\Personal - DB Codes\cgcnn\main.py", line 514, in <module>
main()
File "C:\Users\fes33\Documents\GIK - R&D\Personal - Papers and Reports\17 - MOF Database and Review\Personal - DB Codes\cgcnn\main.py", line 119, in main
sample_data_list = [dataset[i] for i in range(len(dataset))]
File "C:\Users\fes33\Documents\GIK - R&D\Personal - Papers and Reports\17 - MOF Database and Review\Personal - DB Codes\cgcnn\main.py", line 119, in <listcomp>
sample_data_list = [dataset[i] for i in range(len(dataset))]
File "C:\Users\fes33\Documents\GIK - R&D\Personal - Papers and Reports\17 - MOF Database and Review\Personal - DB Codes\cgcnn\cgcnn\data.py", line 330, in __getitem__
print("Specie: ", crystal[i].specie.name)
File "C:\Users\fes33\anaconda3\envs\cgcnn\lib\site-packages\pymatgen\core\sites.py", line 79, in __getattr__
raise AttributeError(a)
AttributeError: specie. Did you mean: 'species'?
This is the code (from CGCNN) which I’ve modified slightly to print the specie causing the error:
cif_id, target = self.id_prop_data[idx]
crystal = Structure.from_file(os.path.join(self.root_dir,
cif_id+'.cif'))
temp = []
for i in range(len(crystal)):
print("Specie: ", crystal[i].specie.name)
temp.append(self.ari.get_atom_fea(crystal[i].specie.number))
#atom_fea = np.vstack([self.ari.get_atom_fea(crystal[i].specie.number)
# for i in range(len(crystal))])
atom_fea = np.vstack(temp)
The output shows that it works fine for several sites (i.e. I get list of element symbols) before one hydrogen throws this error. Can anyone explain why this happens?