OBMol

OBMol Molecule Class
OBMol.atoms List of the atomsOBAtom.
OBMol.bonds List of the bondsOBBond.
OBMol.residues List of the residues - OBResidue.

Documentation

class OBMol

Molecule Class

The most important class in Open Babel is OBMol, or the molecule class. The OBMol class is designed to store all the basic information associated with a molecule, to make manipulations on the connection table of a molecule facile, and to provide member functions which automatically perceive information about a molecule. A guided tour of the OBMol class is a good place to start.

Example

import pyOBabel as ob

# An OBMol class can be instantiated by
mol = OBMol()

conv = ob.OBConversion()
conv.SetInFormat("MOL2")
conv.ReadFile(mol, filename)

# Print index and atomic number
for atom in mol.atoms:
    print(atom.GetIndex(), atom.GetAtomicNum())

# Print bond order, first atom index and second atom index
for bond in mol.bonds:
    print(bond.GetBondOrder(), bond.GetBeginAtom().GetIndex(),
        bond.GetEndAtom().GetIndex())
AddAtom(self: pyOBabel.pyOBabel.OBMol, atom: OpenBabel::OBAtom, forceNewId: bool=False) → bool
AddBond(self: pyOBabel.pyOBabel.OBMol, arg0: OpenBabel::OBBond) → bool
AddBondBetweenAtoms(self: pyOBabel.pyOBabel.OBMol, beginIdx: int, endIdx: int, order: int, flags: int=0, insertpos: int=-1) → bool
AddConformerCoords(self: pyOBabel.pyOBabel.OBMol, arg0: list) → None
AddHydrogens(*args, **kwargs)

Overloaded function.

  1. AddHydrogens(self: pyOBabel.pyOBabel.OBMol, polaronly: bool=False, correctForPH: bool=False, pH: float=7.4) -> bool
  2. AddHydrogens(self: pyOBabel.pyOBabel.OBMol, arg0: OpenBabel::OBAtom) -> bool
AddNewHydrogens(self: pyOBabel.pyOBabel.OBMol, whichHydrogen: pyOBabel.pyOBabel.HydrogenType, correctForPH: bool=False, pH: float=7.4) → bool
AddNonPolarHydrogens(self: pyOBabel.pyOBabel.OBMol) → bool
AddPolarHydrogens(self: pyOBabel.pyOBabel.OBMol) → bool
AddResidue(self: pyOBabel.pyOBabel.OBMol, arg0: OpenBabel::OBResidue) → bool
Align(self: pyOBabel.pyOBabel.OBMol, arg0: OpenBabel::OBAtom, arg1: OpenBabel::OBAtom, arg2: pyOBabel.pyOBabel.vector3, arg3: pyOBabel.pyOBabel.vector3) → None
AreInSameRing(self: pyOBabel.pyOBabel.OBMol, arg0: OpenBabel::OBAtom, arg1: OpenBabel::OBAtom) → int
AssignSpinMultiplicity(self: pyOBabel.pyOBabel.OBMol, NoImplicitH: bool=False) → bool
AssignTotalChargeToAtoms(self: pyOBabel.pyOBabel.OBMol, arg0: int) → bool
AutomaticFormalCharge(self: pyOBabel.pyOBabel.OBMol) → bool
AutomaticPartialCharge(self: pyOBabel.pyOBabel.OBMol) → bool
BeginModify(self: pyOBabel.pyOBabel.OBMol) → None
Center(self: pyOBabel.pyOBabel.OBMol) → None
CenterOfConformer(self: pyOBabel.pyOBabel.OBMol, arg0: int) → pyOBabel.pyOBabel.vector3
Clear(self: pyOBabel.pyOBabel.OBMol) → bool
ConnectTheDots(self: pyOBabel.pyOBabel.OBMol) → None
ContigFragList(self: pyOBabel.pyOBabel.OBMol, arg0: List[List[int]]) → None
ConvertDativeBonds(self: pyOBabel.pyOBabel.OBMol) → bool
ConvertZeroBonds(self: pyOBabel.pyOBabel.OBMol) → bool
CorrectForPH(self: pyOBabel.pyOBabel.OBMol, pH: float=7.4) → bool
DeleteAtom(self: pyOBabel.pyOBabel.OBMol, atom: OpenBabel::OBAtom, destroyAtom: bool=False) → bool
DeleteBond(self: pyOBabel.pyOBabel.OBMol, bond: OpenBabel::OBBond, destroyBond: bool=False) → bool
DeleteConformerByIndex(self: pyOBabel.pyOBabel.OBMol, arg0: int) → None
DeleteHydrogen(self: pyOBabel.pyOBabel.OBMol, arg0: OpenBabel::OBAtom) → bool
DeleteHydrogensAll(self: pyOBabel.pyOBabel.OBMol) → bool
DeleteHydrogensFromAtom(self: pyOBabel.pyOBabel.OBMol, arg0: OpenBabel::OBAtom) → bool
DeleteNonPolarHydrogens(self: pyOBabel.pyOBabel.OBMol) → bool
DeletePolarHydrogens(self: pyOBabel.pyOBabel.OBMol) → bool
DeleteResidue(self: pyOBabel.pyOBabel.OBMol, residue: OpenBabel::OBResidue, destroyResidue: bool=False) → bool
Empty(self: pyOBabel.pyOBabel.OBMol) → bool
EndModify(self: pyOBabel.pyOBabel.OBMol, nukePerceivedData: bool=True) → None
FindAngles(self: pyOBabel.pyOBabel.OBMol) → None
FindChiralCenters(self: pyOBabel.pyOBabel.OBMol) → None
FindLSSR(self: pyOBabel.pyOBabel.OBMol) → None
FindRingAtomsAndBonds(self: pyOBabel.pyOBabel.OBMol) → None
FindSSSR(self: pyOBabel.pyOBabel.OBMol) → None
FindTorsions(self: pyOBabel.pyOBabel.OBMol) → None
GetAngle(self: pyOBabel.pyOBabel.OBMol, arg0: OpenBabel::OBAtom, arg1: OpenBabel::OBAtom, arg2: OpenBabel::OBAtom) → float
GetConformerCoordsByIndex(self: pyOBabel.pyOBabel.OBMol, arg0: int) → list
GetConformerEnergies(self: pyOBabel.pyOBabel.OBMol) → List[float]
GetConformerEnergy(self: pyOBabel.pyOBabel.OBMol, arg0: int) → float
GetConformersAllCoords(self: pyOBabel.pyOBabel.OBMol) → list
GetCoordinates(self: pyOBabel.pyOBabel.OBMol) → list
GetDimension(self: pyOBabel.pyOBabel.OBMol) → int
GetExactMass(self: pyOBabel.pyOBabel.OBMol, arg0: bool) → float
GetFormula(self: pyOBabel.pyOBabel.OBMol) → str
GetHeatFormation(self: pyOBabel.pyOBabel.OBMol) → float
GetMolWt(self: pyOBabel.pyOBabel.OBMol, implicitH: bool=True) → float
GetSpacedFormula(self: pyOBabel.pyOBabel.OBMol, ones: int=0, sp: str=' ', implicitH: bool=True) → str
GetTitle(self: pyOBabel.pyOBabel.OBMol, replaceNewlines: bool=True) → str
GetTorsionByAtoms(self: pyOBabel.pyOBabel.OBMol, arg0: OpenBabel::OBAtom, arg1: OpenBabel::OBAtom, arg2: OpenBabel::OBAtom, arg3: OpenBabel::OBAtom) → float
GetTorsionByIndex(self: pyOBabel.pyOBabel.OBMol, arg0: int, arg1: int, arg2: int, arg3: int) → float
GetTotalCharge(self: pyOBabel.pyOBabel.OBMol) → int
GetTotalSpinMultiplicity(self: pyOBabel.pyOBabel.OBMol) → int
Has2D(self: pyOBabel.pyOBabel.OBMol, Not3D: bool=False) → bool
Has3D(self: pyOBabel.pyOBabel.OBMol) → bool
HasAromaticPerceived(self: pyOBabel.pyOBabel.OBMol) → bool
HasAtomTypesPerceived(self: pyOBabel.pyOBabel.OBMol) → bool
HasChainsPerceived(self: pyOBabel.pyOBabel.OBMol) → bool
HasChiralityPerceived(self: pyOBabel.pyOBabel.OBMol) → bool
HasClosureBondsPerceived(self: pyOBabel.pyOBabel.OBMol) → bool
HasHybridizationPerceived(self: pyOBabel.pyOBabel.OBMol) → bool
HasHydrogensAdded(self: pyOBabel.pyOBabel.OBMol) → bool
HasLSSRPerceived(self: pyOBabel.pyOBabel.OBMol) → bool
HasNonZeroCoords(self: pyOBabel.pyOBabel.OBMol) → bool
HasPartialChargesPerceived(self: pyOBabel.pyOBabel.OBMol) → bool
HasRingAtomsAndBondsPerceived(self: pyOBabel.pyOBabel.OBMol) → bool
HasRingTypesPerceived(self: pyOBabel.pyOBabel.OBMol) → bool
HasSSSRPerceived(self: pyOBabel.pyOBabel.OBMol) → bool
HasSpinMultiplicityAssigned(self: pyOBabel.pyOBabel.OBMol) → bool
InsertAtom(self: pyOBabel.pyOBabel.OBMol, arg0: OpenBabel::OBAtom) → bool
IsChiral(self: pyOBabel.pyOBabel.OBMol) → bool
IsCorrectedForPH(self: pyOBabel.pyOBabel.OBMol) → bool
MakeDativeBonds(self: pyOBabel.pyOBabel.OBMol) → bool
NewAtom(self: pyOBabel.pyOBabel.OBMol) → OpenBabel::OBAtom
NewAtomById(self: pyOBabel.pyOBabel.OBMol, arg0: int) → OpenBabel::OBAtom
NewBond(self: pyOBabel.pyOBabel.OBMol) → OpenBabel::OBBond
NewBondById(self: pyOBabel.pyOBabel.OBMol, arg0: int) → OpenBabel::OBBond
NewResidue(self: pyOBabel.pyOBabel.OBMol) → OpenBabel::OBResidue
NumAtoms(self: pyOBabel.pyOBabel.OBMol) → int
NumBonds(self: pyOBabel.pyOBabel.OBMol) → int
NumConformers(self: pyOBabel.pyOBabel.OBMol) → int
NumHvyAtoms(self: pyOBabel.pyOBabel.OBMol) → int
NumResidues(self: pyOBabel.pyOBabel.OBMol) → int
NumRotors(self: pyOBabel.pyOBabel.OBMol, sampleRingBonds: bool=False) → int
PerceiveBondOrders(self: pyOBabel.pyOBabel.OBMol) → None
RenumberAtomsByAtoms(self: pyOBabel.pyOBabel.OBMol, arg0: List[OpenBabel::OBAtom]) → None
RenumberAtomsByIndex(self: pyOBabel.pyOBabel.OBMol, arg0: List[int]) → None
ReserveAtoms(self: pyOBabel.pyOBabel.OBMol, arg0: int) → None
Separate(self: pyOBabel.pyOBabel.OBMol, StartIndex: int=1) → List[pyOBabel.pyOBabel.OBMol]
SetAromaticPerceived(self: pyOBabel.pyOBabel.OBMol) → None
SetAtomTypesPerceived(self: pyOBabel.pyOBabel.OBMol) → None
SetAutomaticFormalCharge(self: pyOBabel.pyOBabel.OBMol, arg0: bool) → None
SetAutomaticPartialCharge(self: pyOBabel.pyOBabel.OBMol, arg0: bool) → None
SetChainsPerceived(self: pyOBabel.pyOBabel.OBMol, arg0: bool) → None
SetChiralityPerceived(self: pyOBabel.pyOBabel.OBMol) → None
SetClosureBondsPerceived(self: pyOBabel.pyOBabel.OBMol) → None
SetConformerByIndex(self: pyOBabel.pyOBabel.OBMol, arg0: int) → None
SetConformerEnergies(self: pyOBabel.pyOBabel.OBMol, arg0: List[float]) → None
SetConformersCoords(self: pyOBabel.pyOBabel.OBMol, arg0: list) → None
SetCoordinates(self: pyOBabel.pyOBabel.OBMol, arg0: list) → None
SetCorrectedForPH(self: pyOBabel.pyOBabel.OBMol) → None
SetDimension(self: pyOBabel.pyOBabel.OBMol, arg0: int) → None
SetFlags(self: pyOBabel.pyOBabel.OBMol, arg0: int) → None
SetFormula(self: pyOBabel.pyOBabel.OBMol, arg0: str) → None
SetHeatFormation(self: pyOBabel.pyOBabel.OBMol, arg0: float) → None
SetHybridizationPerceived(self: pyOBabel.pyOBabel.OBMol) → None
SetHydrogensAdded(self: pyOBabel.pyOBabel.OBMol) → None
SetIsPatternStructure(self: pyOBabel.pyOBabel.OBMol) → None
SetLSSRPerceived(self: pyOBabel.pyOBabel.OBMol) → None
SetPartialChargesPerceived(self: pyOBabel.pyOBabel.OBMol) → None
SetRingAtomsAndBondsPerceived(self: pyOBabel.pyOBabel.OBMol) → None
SetRingTypesPerceived(self: pyOBabel.pyOBabel.OBMol) → None
SetSSSRPerceived(self: pyOBabel.pyOBabel.OBMol) → None
SetSpinMultiplicityAssigned(self: pyOBabel.pyOBabel.OBMol) → None
SetTitle(self: pyOBabel.pyOBabel.OBMol, arg0: str) → None
SetTorsion(self: pyOBabel.pyOBabel.OBMol, arg0: OpenBabel::OBAtom, arg1: OpenBabel::OBAtom, arg2: OpenBabel::OBAtom, arg3: OpenBabel::OBAtom, arg4: float) → None
SetTotalCharge(self: pyOBabel.pyOBabel.OBMol, arg0: int) → None
SetTotalSpinMultiplicity(self: pyOBabel.pyOBabel.OBMol, arg0: int) → None
StripSalts(self: pyOBabel.pyOBabel.OBMol, threshold: int=0) → bool
ToInertialFrameForAllConformers(self: pyOBabel.pyOBabel.OBMol) → None
ToInertialFrameForOneConformer(self: pyOBabel.pyOBabel.OBMol, arg0: int, arg1: float) → None
TranslateAllConformers(self: pyOBabel.pyOBabel.OBMol, arg0: pyOBabel.pyOBabel.vector3) → None
TranslateOneConformer(self: pyOBabel.pyOBabel.OBMol, arg0: pyOBabel.pyOBabel.vector3, arg1: int) → None
UnsetAromaticPerceived(self: pyOBabel.pyOBabel.OBMol) → None
UnsetFlag(self: pyOBabel.pyOBabel.OBMol, arg0: int) → None
UnsetHydrogensAdded(self: pyOBabel.pyOBabel.OBMol) → None
UnsetLSSRPerceived(self: pyOBabel.pyOBabel.OBMol) → None
UnsetPartialChargesPerceived(self: pyOBabel.pyOBabel.OBMol) → None
UnsetRingTypesPerceived(self: pyOBabel.pyOBabel.OBMol) → None
UnsetSSSRPerceived(self: pyOBabel.pyOBabel.OBMol) → None
atoms

List of the atomsOBAtom. It yields a read-only list.

Example

# Print index and atomic number
for atom in mol.atoms:
    print(atom.GetIndex(), atom.GetAtomicNum())
bonds

List of the bondsOBBond. It yields a read-only list.

Example

# Print bond order, first atom index and second atom index
for bond in mol.bonds:
    print(bond.GetBondOrder(), bond.GetBeginAtom().GetIndex(),
            bond.GetEndAtom().GetIndex())
copy(self: pyOBabel.pyOBabel.OBMol) → pyOBabel.pyOBabel.OBMol
residues

List of the residues - OBResidue.

Example

# Print Residue name
for residue in mol.residues:
    print(residue.GetName())