Hi Matthew,
could it be that your code fails to provide the connectivity information, i.e.
which atoms are connected by bonds ? Trying to generate a smiles/inchi on
disconnected atoms makes no sense, which would explain the nan-values ?
OBabel should be able to guess / generate this information from the provided 3D
coordinates using functions like OBMol::ConnectTheDots and
OBMol::PerceiveBondOrders but this is not trivial.
In case you have the connectivity information on your molecules it seems easier
to use it, e.g. generating the OBMol entities by reading a smiles-string and
then add the coordinates ?
regards,
Rafel
> -------- Original Message --------
> Subject: [Open Babel] Pybel calcdesc
> Local Time: 13 August 2017 5:47 PM
> UTC Time: 13 August 2017 15:47
> From: matthew.kenned...@gmail.com
> To: openbabel-disc...@lists.sf.net
>
> I am attempting to begin using pybel/openbabel to calculate inchi strings on
> the fly without having to write temporary files and use command line
> openbabel. When I use the pybel.Molecule function calcdesc() I get many
> descriptors back, but the InChI/Smiles/Smarts descriptors are all 'nan'.
> I've copied some of the code below, followed by its output.
>
> You can mostly ignore the stuff unrelated to pybel, it is related to my
> personal molecule class that I use.
>
> a,b = db_read_tooltip()
> b.printxyz()
>
> mol = openbabel.OBMol()
>
> for atom in b.system:
> a = mol.NewAtom()
> a.SetAtomicNum(atom.element)
> a.SetVector(atom.X,atom.Y,atom.Z)
>
> pybelmol = pybel.Molecule(mol)
> print(pybelmol.formula)
> print(pybelmol.calcdesc())
>
> The pybelmol.calcdesc() produces the following:
>
> {'TPSA': 36.92, 'smarts': nan, 'HBD': 6.0, 'nF': 0.0, 'logP':
> 5.6061000000000005, 'title': nan, 'MW': 329.4691799999999, 'tbonds': 0.0,
> 'cansmi': nan, 'InChI': nan, 'formula': nan, 'InChIKey': nan, 'bonds': 0.0,
> 'atoms': 27.0, 'L5': nan, 'HBA1': 18.0, 'HBA2': 4.0, 'sbonds': 0.0,
> 'cansmiNS': nan, 'dbonds': 0.0, 's': nan, 'MP': -173.67049999999998, 'MR':
> 94.88419999999998, 'abonds': 0.0}
>
> Thanks for your help.
>
> Matthew Kennedy
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss