jhrmnn / pyberny

Molecular structure optimizer
Mozilla Public License 2.0
113 stars 21 forks source link

Generation of internal coordinates when covalent radii are missing #33

Open kjelljorner opened 5 years ago

kjelljorner commented 5 years ago

When parsing a geometry with atoms for which there are no covalent radii, the program will crash. Here is an example with the xyz attached:

geom = berny.geomlib.readfile("xtb.xyz")
intcoords = berny.coords.InternalCoords(geom)

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-22-ae455e514a9f> in <module>
----> 1 intcoords = berny.coords.InternalCoords(geom)

~\AppData\Local\Continuum\miniconda3\envs\rdkit-env\lib\site-packages\berny\coords.py in __init__(self, geom, allowed, dihedral, superweakdih)
    229         dist = geom.dist(geom)
    230         radii = np.array([get_property(sp, 'covalent_radius') for sp in geom.species])
--> 231         bondmatrix = dist < 1.3 * (radii[None, :] + radii[:, None])
    232         self.fragments, C = get_clusters(bondmatrix)
    233         radii = np.array([get_property(sp, 'vdw_radius') for sp in geom.species])

TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('<U32') dtype('<U32') dtype('<U32')

xtb.zip

akakcolin commented 4 years ago

In the species-data.csv, the At element's covalent radius is not provided

jhrmnn commented 4 years ago

Indeed, the covalent radius for astatine is missing. Pyberny is not very user-friendly in terms of user errors. I think I originally took the data from wikipedia. I'll be happy to add more radii if you point me to a good source.

eljost commented 4 years ago

Hi, for my code I took the CR from the periodictable package. You can find it https://github.com/eljost/pysisyphus/blob/master/pysisyphus/elem_data.py.