SINGROUP / dscribe

DScribe is a python package for creating machine learning descriptors for atomistic systems.

Home Page:https://singroup.github.io/dscribe/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue when initializing SOAP instance

rajathsalegame opened this issue · comments

Hitting this strange error when trying to initialize a SOAP instance:

File "/home/rajathsalegame/src/data.py", line 84, in <redacted>
    soap_generator = SOAP(species=unique_species, rcut=rcut, nmax=nmax, lmax=lmax)
  File "/home/rajathsalegame/miniconda3/envs/<redacted>/lib/python3.8/site-packages/dscribe/descriptors/soap.py", line 108, in __init__
    self.species = species
  File "/home/rajathsalegame/miniconda3/envs/<redacted>/lib/python3.8/site-packages/dscribe/descriptors/soap.py", line 366, in species
    self._set_species(value)
  File "/home/rajathsalegame/miniconda3/envs/<redacted>/lib/python3.8/site-packages/dscribe/descriptors/descriptor.py", line 140, in _set_species
    atomic_numbers = get_atomic_numbers(species)
  File "/home/rajathsalegame/miniconda3/envs/<redacted>/lib/python3.8/site-packages/dscribe/utils/species.py", line 65, in get_atomic_numbers
    if not np.all(np.array(species) >= 0):
TypeError: '>=' not supported between instances of 'set' and 'int'

I think this might be because I passed into SOAP a set rather than a list, and it seems like SOAP is setting species using this? Might be good to allow for flexibility and allow for any sort of Collection to be passed into the function? Or, this might be an issue on my end somehow--just thought I would bring it up in case!

Hi @rajathsalegame,

Any Iterable should definitely be OK. For some reason numpy does not iterate through the set, but makes it into an array with dtype=object. I will include a fix to this in 1.0.0. Thanks for the report!

Now fixed in 1.0.0.