> I'm interested in converting to 3D only the 2D molecules in a batch where 2D
…
> using obabel in a python script. Could you help me please?

If you're looking through molecules using Pybel, you can do something like this:

https://gist.github.com/ghutchis/0766478cc9bc1c00f623ce560954b8c1

    for mol in pybel.readfile(extension[1:], argument):

        if mol.OBMol.GetDimension() == 3:
            print("Nothing to do for", mol.title)
            continue

        pybel._builder.Build(mol.OBMol)
        mol.addh()


Hope that helps,
-Geoff

_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to