Thanks,

I realized the atom types in OpenBabel are not enough for what I want,
hence what I did was to ask openbabel for several atom properties and use
those properties to assign the atom types I need.

Cheers,
Osvaldo

On Thu, Jul 30, 2015 at 1:55 PM, Geoffrey Hutchison <
geoff.hutchi...@gmail.com> wrote:

> > I need to get the atom types from molecules. I am using a Python/PyMOL
> script. I have the following code
>
> Sorry, I realized no one got back to you. Here's code that should work
>
> http://openbabel.org/api/2.3/classOpenBabel_1_1OBForceField.shtml#aa41fd7cce6a9cf2e56ca603de7fbc507
>
> def get_atom_type(selection):
>     pdb_string = cmd.get_pdbstr(selection)
>     mol = ob.OBMol()
>     obconversion = ob.OBConversion()
>     obconversion.SetInAndOutFormats('pdb', 'pdb')
>     obconversion.ReadString(mol, pdb_string)
>     ff = ob.OBForceField.FindForceField('GAFF')
>     ff.Setup(mol)
>     ff.GetAtomTypes(mol)
>     for at in ob.OBMolAtomIter(mol):
>         type = at.GetData("FFAtomType") # an OBPairData object
>         print at->GetValue()
>
> 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