qzhu2017 / PyXtal_ml

a Python3 library for ML modeling materials properties
MIT License
11 stars 1 forks source link

PRDF returning NAN for some structures #36

Closed David-Zagaceta closed 6 years ago

David-Zagaceta commented 6 years ago

@qzhu2017

This is troublesome during learning, this is causing main to crash. I need to find these structures in order to determine the reasoning for this issue.

David-Zagaceta commented 6 years ago

found and fixed issue

David-Zagaceta commented 6 years ago

the issue was empty lists in the distances dictionary, this occurs when the cutoff distance isnt large enough. We now have a condition that doesn't allow computation of the RDF's when the lists are empty.

qzhu2017 commented 6 years ago

@qzhu2017 I updated the code to enable the test run. However, I think you code has some bugs in a loop.

qiangzhu@Qiangs-MacBook-Pro:~/Desktop/github/PyXtal_ml/pyxtal_ml/descriptors$ python prdf.py -c POSCARs/POSCAR-NaCl
Traceback (most recent call last):
  File "prdf.py", line 224, in <module>
    f2 = PRDF(test, symmetrize=False, R_max=options.Rmax, R_bin=options.delta).PRDF
  File "prdf.py", line 55, in __init__
    self.compute_PRDF()
  File "prdf.py", line 151, in compute_PRDF
    ele_2 = neighbors[i][j][0].species_string 
IndexError: list index out of range
David-Zagaceta commented 6 years ago

@qzhu2017 The loop should have been for j, neighbor in enumerate(neighbors[i])

what I had initially was for j, neighbor in enumerate(neighbors)

david@DESKTOP-I6PJBIV MINGW64 ~/Users/david/Desktop/CMS_Work/PyXtal-ml/pyxtal_ml/descriptors (master)
$ python prdf.py -c POSCARs/POSCAR-NaCl
4560
[]
David-Zagaceta commented 6 years ago

@qzhu2017

Should we increase the default R_max?

qzhu2017 commented 6 years ago

I think the default value is very reasonable.