AttributeError: Specie using CrystalNNFingerprint

File "Dataloader.py", line 158, in <module>
    print(CNNF_Test[1].shape)
  File "Dataloader.py", line 124, in __getitem__
    return np.array([self.featurizer.featurize(self.CifLoader[idx],i) for i in range(len(self.CifLoader[idx]))])
  File "Dataloader.py", line 124, in <listcomp>
    return np.array([self.featurizer.featurize(self.CifLoader[idx],i) for i in range(len(self.CifLoader[idx]))])
  File "/home/michael/anaconda3/envs/pytorch3d/lib/python3.7/site-packages/matminer/featurizers/site.py", line 479, in featurize
    nndata = self.cnn.get_nn_data(struct, idx)
  File "/home/michael/anaconda3/envs/pytorch3d/lib/python3.7/site-packages/pymatgen/analysis/local_env.py", line 3348, in get_nn_data
    X1 = structure[n].specie.X
  File "/home/michael/anaconda3/envs/pytorch3d/lib/python3.7/site-packages/pymatgen/core/sites.py", line 79, in __getattr__
    raise AttributeError(a)
AttributeError: specie

When attempting to use the CrystalNNFingerprint site feauturizer there’s a consistent error where the script fails due to the the structures apparently not having species for given members. Is this a known issue?

Hello Michael,

Interesting, I have not seen this error before.

Not knowing much about what you’re trying to do (e.g., if the structure not having a species is also a problem), you could skip CrystalNN from using the electronegativities of the species by setting “ x_diff_weight=None” for your CrystalNNSiteFeaturizer.