Bond class. More...
#include <openbabel/bond.h>
Public Types | |
enum | Flag { Aromatic = (1<<1), Ring = (1<<4), Closure = (1<<10) } |
enum | StereoFlag { Wedge = (1<<2), Hash = (1<<3), WedgeOrHash = (1<<11), CisOrTrans = (1<<12) } |
Public Member Functions | |
OBBond () | |
virtual | ~OBBond () |
virtual bool | Clear () |
virtual OBBase * | DoTransformations (const std::map< std::string, std::string > *, OBConversion *) |
template<class T > | |
T * | CastAndClear (bool clear=true) |
virtual const char * | GetTitle (bool replaceNewlines=true) const |
virtual void | SetTitle (const char *) |
Bond modification methods | |
void | SetIdx (int idx) |
void | SetId (unsigned long id) |
void | SetBO (int order) |
void | SetBondOrder (int order) |
void | SetBegin (OBAtom *begin) |
void | SetEnd (OBAtom *end) |
void | SetParent (OBMol *ptr) |
void | SetLength (OBAtom *fixed, double length) |
void | SetLength (double length) |
void | Set (int index, OBAtom *begin, OBAtom *end, int order, int flags) |
void | SetKSingle () |
void | SetKDouble () |
void | SetKTriple () |
void | SetAromatic () |
void | SetWedge () |
void | SetHash () |
void | SetWedgeOrHash () |
void | SetUp () |
void | SetDown () |
void | SetInRing (bool set=true) |
void | SetClosure () |
void | UnsetHash () |
void | UnsetWedge () |
void | UnsetUp () |
void | UnsetDown () |
void | UnsetAromatic () |
void | UnsetKekule () |
Bond data request methods | |
unsigned int | GetIdx () const |
unsigned long | GetId () const |
unsigned int | GetBO () const |
unsigned int | GetBondOrder () const |
unsigned int | GetFlags () const |
unsigned int | GetBeginAtomIdx () const |
unsigned int | GetEndAtomIdx () const |
OBAtom * | GetBeginAtom () |
const OBAtom * | GetBeginAtom () const |
OBAtom * | GetEndAtom () |
const OBAtom * | GetEndAtom () const |
OBAtom * | GetNbrAtom (OBAtom *ptr) |
OBMol * | GetParent () |
double | GetEquibLength () const |
double | GetLength () const |
unsigned int | GetNbrAtomIdx (OBAtom *ptr) |
OBRing * | FindSmallestRing () const |
property request methods | |
bool | IsAromatic () const |
bool | IsInRing () const |
bool | IsRotor () |
bool | IsAmide () |
bool | IsPrimaryAmide () |
bool | IsSecondaryAmide () |
bool | IsTertiaryAmide () |
bool | IsEster () |
bool | IsCarbonyl () |
bool | IsSingle () |
bool | IsDouble () |
bool | IsTriple () |
bool | IsKSingle () |
bool | IsKDouble () |
bool | IsKTriple () |
bool | IsClosure () |
bool | IsUp () |
bool | IsDown () |
bool | IsWedge () |
bool | IsHash () |
bool | IsWedgeOrHash () const |
bool | IsCisOrTrans () const |
bool | IsDoubleBondGeometry () |
Generic data handling methods (via OBGenericData) | |
bool | HasData (const std::string &) |
bool | HasData (const char *) |
bool | HasData (const unsigned int type) |
void | DeleteData (unsigned int type) |
void | DeleteData (OBGenericData *) |
void | DeleteData (std::vector< OBGenericData * > &) |
bool | DeleteData (const std::string &s) |
void | SetData (OBGenericData *d) |
void | CloneData (OBGenericData *d) |
size_t | DataSize () const |
OBGenericData * | GetData (const unsigned int type) |
OBGenericData * | GetData (const std::string &) |
OBGenericData * | GetData (const char *) |
std::vector< OBGenericData * > & | GetData () |
std::vector< OBGenericData * > | GetData (DataOrigin source) |
std::vector< OBGenericData * > | GetAllData (const unsigned int type) |
OBDataIterator | BeginData () |
OBDataIterator | EndData () |
Static Public Member Functions | |
static const char * | ClassDescription () |
Public Attributes | |
bool | Visit |
Protected Member Functions | |
bool | HasFlag (int flag) const |
void | SetFlag (int flag) |
void | UnsetFlag (int flag) |
Protected Attributes | |
unsigned int | _idx |
OBMol * | _parent |
OBAtom * | _bgn |
OBAtom * | _end |
char | _order |
unsigned short int | _flags |
unsigned long | _id |
std::vector< OBGenericData * > | _vdata |
Bond class.
The OBBond class is straightforward in its data access and modification methods. OBBonds store pointers to the atoms on each end of the bond. In storing pointers to atoms instead of integer indices, the necessity of having to reorder bonds when atoms are shuffled, added, or delete is obviated.
While methods indicate "begin" and "end" atoms in the bond, all methods are designed to be independent of atom ordering, with the exception of stereochemically aware properties such as IsUp(), IsDown(), IsWedge, or IsHash().
enum Flag |
enum StereoFlag |
OBBond | ( | ) |
Constructor.
~OBBond | ( | ) | [virtual] |
Destructor.
bool HasFlag | ( | int | flag ) | const [inline, protected] |
flag
is set. void SetFlag | ( | int | flag ) | [inline, protected] |
Sets the bitwise flag
void UnsetFlag | ( | int | flag ) | [inline, protected] |
Unsets the bitwise flag
void SetIdx | ( | int | idx ) | [inline] |
Set the internal bond index.
Referenced by OBMol::DeleteBond(), and OBMol::NewBond().
void SetId | ( | unsigned long | id ) | [inline] |
Referenced by OBMol::AddBond(), OBMol::NewBond(), and OBMol::operator+=().
void SetBO | ( | int | order ) |
Set the bond order to order
(i.e., 1 = single, 2 = double, 5 = aromatic)
Referenced by OBChemTsfm::Apply(), OBBondTyper::AssignFunctionalGroupBonds(), OBMol::ConvertDativeBonds(), OBMol::Kekulize(), OBMol::NewPerceiveKekuleBonds(), and OBMol::start_kekulize().
void SetBondOrder | ( | int | order ) |
Set the bond order to order
(i.e., 1 = single, 2 = double, 5 = aromatic)
Referenced by OpenBabel::alternate(), and OBBuilder::Connect().
void SetBegin | ( | OBAtom * | begin ) | [inline] |
Set the beginning atom of this bond to begin
. Does not update begin
.
Referenced by OBBuilder::Connect().
void SetEnd | ( | OBAtom * | end ) | [inline] |
Set the ending atom of this bond to end
. Does not update end
.
Referenced by OBBuilder::Connect().
void SetParent | ( | OBMol * | ptr ) | [inline] |
Set the parent molecule to ptr
. Does not update parent.
Referenced by OBMol::AddBond(), and OBMol::NewBond().
void SetLength | ( | OBAtom * | fixed, |
double | length | ||
) |
Change the bond length to length
, while keeping fixed
stationary.
Referenced by OBAtom::HtoMethyl().
void SetLength | ( | double | length ) |
Change the bond length to length
, moving both atoms halfway
Set the main bond information (i.e., when creating a bond)
Mark the main information for a bond
idx | The unique bond index for this bond (inside an OBMol) |
begin | The 'beginning' atom for the bond |
end | The 'end' atom for the bond |
order | The bond order (i.e., 1 = single, 2 = double... 5 = aromatic) |
flags | Any initial property flags |
Referenced by OBMol::AddBond().
void SetKSingle | ( | ) |
Referenced by OpenBabel::CorrectBadResonanceForm(), OBMol::NewPerceiveKekuleBonds(), and OBMol::PerceiveKekuleBonds().
void SetKDouble | ( | ) |
Referenced by OpenBabel::CorrectBadResonanceForm(), OBMol::PerceiveKekuleBonds(), and OBMol::start_kekulize().
void SetKTriple | ( | ) |
Referenced by OBMol::PerceiveKekuleBonds().
void SetAromatic | ( | ) | [inline] |
Mark that this bond is aromatic. Does not update atoms or validate.
Referenced by OBMol::AddBond().
void SetWedge | ( | ) | [inline] |
Mark that this bond has 2D "wedge" notation (i.e., goes in a positive Z direction from the beginning to end atoms)
void SetHash | ( | ) | [inline] |
Mark that this bond has 2D "hash" notation (i.e., goes in a negative Z direction from the beginning to end atoms)
void SetWedgeOrHash | ( | ) | [inline] |
Mark that this bond has 2D "wedge" notation (i.e., goes in a positive Z direction from the beginning to end atoms)
void SetUp | ( | ) | [inline] |
Mark that this bond has an "up" torsion for double-bond stereochem (i.e., "/" in SMILES notation.
void SetDown | ( | ) | [inline] |
Mark that this bond has an "down" torsion for double-bond stereochem (i.e., "\" in SMILES notation.
void SetInRing | ( | bool | set = true ) |
[inline] |
Mark that this bond is in a ring. Primarily for internal use.
Referenced by OBMol::EndModify(), and OpenBabel::FindRings().
void SetClosure | ( | ) | [inline] |
Mark that this bond indicates a ring closure when walking the molecule.
Referenced by OBBond::IsClosure().
void UnsetHash | ( | ) | [inline] |
Clear any indication of 2D "hash" notation from SetHash()
void UnsetWedge | ( | ) | [inline] |
Clear any indication of 2D "wedge" notation from SetWedge()
void UnsetUp | ( | ) | [inline] |
Clear any indication of "/" double bond stereochemistry from SetUp()
void UnsetDown | ( | ) | [inline] |
Clear any indication of "\" double bond stereochemistry from SetDown()
void UnsetAromatic | ( | ) | [inline] |
Clear all aromaticity information for the bond.
Referenced by OBAromaticTyper::AssignAromaticFlags().
void UnsetKekule | ( | ) | [inline] |
Clear all Kekule information for the bond.
unsigned int GetIdx | ( | ) | const [inline] |
Referenced by OpenBabel::atomRingToBondRing(), OBMolBondBFSIter::CurrentDepth(), OBMol::DeleteBond(), OpenBabel::expand_kekulize_lssr(), OpenBabel::FindRings(), OBResidue::GetBonds(), OBBond::IsClosure(), OBRotorList::IsFixedBond(), OpenBabel::KekulePropagate(), OBMolBondBFSIter::OBMolBondBFSIter(), OBMolBondBFSIter::operator++(), and OpenBabel::potentialAromaticBonds().
unsigned long GetId | ( | ) | const [inline] |
Referenced by OBBuilder::CorrectStereoBonds(), OBMol::DeleteBond(), and OBDepict::DrawMolecule().
unsigned int GetBO | ( | ) | const [inline] |
Referenced by OBMol::AddBond(), OBResidueData::AssignBonds(), OBAtom::BOSum(), OBBuilder::Build(), OBMol::ConvertDativeBonds(), OBAtom::CountBondsOfOrder(), OBDepict::DrawMolecule(), OBSmartsMatcher::EvalBondExpr(), OpenBabel::ExpandKekule(), OBAtom::HasBondOfOrder(), OBAtom::HasNonSingleBond(), OBAtom::IsAmideNitrogen(), OBMol::operator+=(), OBMol::PerceiveKekuleBonds(), and OBMol::start_kekulize().
unsigned int GetBondOrder | ( | ) | const [inline] |
Referenced by OBBuilder::Build(), OpenBabel::isFerroceneBond(), OBQueryBond::Matches(), and OBBuilder::Swap().
unsigned int GetFlags | ( | ) | const [inline] |
Referenced by OBMol::AddBond(), and OBMol::operator+=().
unsigned int GetBeginAtomIdx | ( | ) | const [inline] |
Referenced by OBMol::AddBond(), OBRingSearch::AddRingFromClosure(), OpenBabel::alternate(), OpenBabel::DetermineFRJ(), OpenBabel::FindRings(), OBRotorRules::GetRotorIncrements(), OBRing::IsMember(), OBMol::operator+=(), OBMol::PerceiveKekuleBonds(), OBRotorList::RemoveSymVals(), OBAromaticTyper::SelectRootAtoms(), OBRotorList::SetEvalAtoms(), and OBMol::start_kekulize().
unsigned int GetEndAtomIdx | ( | ) | const [inline] |
Referenced by OBMol::AddBond(), OBRingSearch::AddRingFromClosure(), OpenBabel::alternate(), OpenBabel::DetermineFRJ(), OBRotorRules::GetRotorIncrements(), OBRing::IsMember(), OBMol::operator+=(), OBMol::PerceiveKekuleBonds(), OBRotorList::RemoveSymVals(), OBRotorList::SetEvalAtoms(), and OBMol::start_kekulize().
OBAtom* GetBeginAtom | ( | ) | [inline] |
Referenced by OBRingSearch::AddRingFromClosure(), OBGastChrg::AssignPartialCharges(), OpenBabel::CalcSignedVolume(), OBMol::DeleteBond(), OpenBabel::expand_kekulize_lssr(), OpenBabel::expandKekulize(), OpenBabel::FindRings(), OBMol::FindTorsions(), OBBuilder::GetNewBondVector(), OBRotorRules::GetRotorIncrements(), OBAtom::IsConnected(), OpenBabel::isFerroceneBond(), OBRotorList::IsFixedBond(), OBMolBondBFSIter::OBMolBondBFSIter(), OBMolBondBFSIter::operator++(), and OBMol::start_kekulize().
const OBAtom* GetBeginAtom | ( | ) | const [inline] |
OBAtom* GetEndAtom | ( | ) | [inline] |
Referenced by OBRingSearch::AddRingFromClosure(), OBGastChrg::AssignPartialCharges(), OpenBabel::CalcSignedVolume(), OBMol::DeleteBond(), OpenBabel::expand_kekulize_lssr(), OpenBabel::expandKekulize(), OpenBabel::FindRings(), OBMol::FindTorsions(), OBRotorRules::GetRotorIncrements(), OBAtom::IsConnected(), OpenBabel::isFerroceneBond(), OBRotorList::IsFixedBond(), OBMolBondBFSIter::OBMolBondBFSIter(), OBMolBondBFSIter::operator++(), and OBMol::start_kekulize().
const OBAtom* GetEndAtom | ( | ) | const [inline] |
ptr
(i.e., the end if ptr
is the start) ptr
is not part of the bond, the beginning atom will always be returned Referenced by OBMol::ConvertDativeBonds(), OBAtom::CountFreeOxygens(), OBAtom::GetBond(), OBResidue::GetBonds(), OpenBabel::GetDFFVector(), OBMol::GetGTDVector(), OBAtom::GetHeteroValence(), OBAtom::GetHvyValence(), OBBuilder::GetNewBondVector(), OBAtom::IsAmideNitrogen(), OBAtom::IsCarboxylOxygen(), OBAtom::IsHbondDonorH(), OBAtom::IsNitroOxygen(), OBAtom::IsNonPolarHydrogen(), OBAtom::IsOneFour(), OBAtom::IsOneThree(), OBAtom::IsPhosphateOxygen(), OBAtom::IsPolarHydrogen(), OBAtom::IsSulfateOxygen(), and OBMol::NewPerceiveKekuleBonds().
OBMol* GetParent | ( | ) | [inline] |
double GetEquibLength | ( | ) | const |
double GetLength | ( | ) | const |
Referenced by OBMol::ConnectTheDots(), and OBBuilder::CorrectStereoAtoms().
unsigned int GetNbrAtomIdx | ( | OBAtom * | ptr ) | [inline] |
ptr
(i.e., the end if ptr
is the start) ptr
is not part of the bond, the beginning atom index will always be returned Referenced by OBMol::ContigFragList(), OBMol::FindLargestFragment(), OpenBabel::FindRings(), OpenBabel::GetDFFVector(), and OBMol::GetGTDVector().
OBRing * FindSmallestRing | ( | ) | const |
Find the smallest ring containing this bond (returns a NULL pointer if none exists)
bool IsAromatic | ( | ) | const |
Referenced by OBBuilder::Build(), OBSmartsMatcher::EvalBondExpr(), and OBQueryBond::Matches().
bool IsInRing | ( | ) | const |
Referenced by OBAtom::CountRingBonds(), OBSmartsMatcher::EvalBondExpr(), OBMol::NewPerceiveKekuleBonds(), OBMol::PerceiveKekuleBonds(), OBBuilder::Swap(), and OBAromaticTyper::TraverseCycle().
bool IsRotor | ( | ) |
Referenced by OBMol::NumRotors().
bool IsAmide | ( | ) |
bool IsPrimaryAmide | ( | ) |
bool IsSecondaryAmide | ( | ) |
bool IsTertiaryAmide | ( | ) |
bool IsEster | ( | ) |
bool IsCarbonyl | ( | ) |
Referenced by OBBond::IsAmide(), OBBond::IsEster(), OBBond::IsPrimaryAmide(), OBBond::IsSecondaryAmide(), and OBBond::IsTertiaryAmide().
bool IsSingle | ( | ) |
bool IsDouble | ( | ) |
Referenced by OBMol::NewPerceiveKekuleBonds().
bool IsTriple | ( | ) |
bool IsKSingle | ( | ) |
Referenced by OBMol::Kekulize().
bool IsKDouble | ( | ) |
Referenced by OpenBabel::GetCurrentValence(), OBAtom::KBOSum(), OBMol::Kekulize(), and OpenBabel::ValenceSum().
bool IsKTriple | ( | ) |
Referenced by OpenBabel::GetCurrentValence(), OBAtom::KBOSum(), and OBMol::Kekulize().
bool IsClosure | ( | ) |
Referenced by OBMol::FindLSSR(), OBMol::FindSSSR(), and OBAromaticTyper::SelectRootAtoms().
bool IsUp | ( | ) | [inline] |
Referenced by OBSmartsMatcher::EvalBondExpr().
bool IsDown | ( | ) | [inline] |
Referenced by OBSmartsMatcher::EvalBondExpr().
bool IsWedge | ( | ) | [inline] |
Referenced by OpenBabel::CalcSignedVolume(), and OBBuilder::GetNewBondVector().
bool IsHash | ( | ) | [inline] |
Referenced by OpenBabel::CalcSignedVolume(), and OBBuilder::GetNewBondVector().
bool IsWedgeOrHash | ( | ) | const [inline] |
bool IsCisOrTrans | ( | ) | const [inline] |
bool IsDoubleBondGeometry | ( | ) |
This method checks if the geometry around this bond looks unsaturated by measuring the torsion angles formed by all connected atoms X-start=end-Y and checking that they are close to 0 or 180 degrees
bool Clear | ( | void | ) | [virtual, inherited] |
Clear any and all data associated with this object.
This method can be called by OBConversion::Read() before reading data. Derived classes should be sure to call OBBase::Clear() to remove inherited generic data.
Reimplemented in OBAtom, OBMol, OBReaction, and OBResidue.
Referenced by OBResidue::Clear().
virtual OBBase* DoTransformations | ( | const std::map< std::string, std::string > * | , |
OBConversion * | |||
) | [inline, virtual, inherited] |
Perform a set of transformations specified by the user
Typically these are program options to filter or modify an object For example, see OBMol::DoTransformations() and OBMol::ClassDescription() Base type does nothing
Reimplemented in OBMol.
static const char* ClassDescription | ( | ) | [inline, static, inherited] |
Reimplemented in OBMol, and OBReaction.
T* CastAndClear | ( | bool | clear = true ) |
[inline, inherited] |
By default clears the object. Called from ReadMolecule of most format classes.
virtual const char* GetTitle | ( | bool | replaceNewlines = true ) |
const [inline, virtual, inherited] |
Base type does nothing Made virtual around r3535 to simplify code which passes around OBBase*.
Reimplemented in OBMol.
Referenced by OBMoleculeFormat::DoOutputOptions().
virtual void SetTitle | ( | const char * | ) | [inline, virtual, inherited] |
Reimplemented in OBMol.
Referenced by OBMoleculeFormat::DoOutputOptions().
bool HasData | ( | const std::string & | s ) | [inherited] |
Referenced by OBDepict::DrawMolecule(), OBForceField::GetAtomTypes(), OBForceField::GetConformers(), OBForceField::GetCoordinates(), OBMol::GetEnergies(), OBMol::GetEnergy(), OBForceField::GetPartialCharges(), OBDescriptor::MatchPairData(), OBMol::operator=(), and OBMol::SetEnergies().
bool HasData | ( | const char * | s ) | [inherited] |
bool HasData | ( | const unsigned int | type ) | [inherited] |
void DeleteData | ( | unsigned int | type ) | [inherited] |
Delete any data matching the given OBGenericDataType.
Referenced by OpenBabel::CanonicalLabels(), OBDescriptor::DeleteProperties(), and OBMol::RenumberAtoms().
void DeleteData | ( | OBGenericData * | gd ) | [inherited] |
Delete the given generic data from this object.
void DeleteData | ( | std::vector< OBGenericData * > & | vg ) | [inherited] |
Delete all of the given generic data from this object.
bool DeleteData | ( | const std::string & | s ) | [inherited] |
Deletes the generic data with the specified attribute, returning false if not found.
void SetData | ( | OBGenericData * | d ) | [inline, inherited] |
Adds a data object; does nothing if d==NULL.
Referenced by OBGastChrg::AssignPartialCharges(), OpenBabel::CalcSignedVolume(), OBForceField::GetAtomTypes(), OBForceField::GetConformers(), OBForceField::GetCoordinates(), OBMol::GetEnergies(), OBMol::GetEnergy(), OBMol::GetNextFragment(), OBForceField::GetPartialCharges(), OBMoleculeFormat::MakeCombinedMolecule(), OBDescriptor::PredictAndSave(), and OBMol::SetEnergies().
void CloneData | ( | OBGenericData * | d ) | [inherited] |
Adds a copy of a data object; does nothing if d == NULL
size_t DataSize | ( | ) | const [inline, inherited] |
OBGenericData * GetData | ( | const unsigned int | type ) | [inherited] |
Referenced by OpenBabel::CalcSignedVolume(), OpenBabel::CorrectChirality(), OBDepict::DrawMolecule(), OBDescriptor::FilterCompare(), OpenBabel::GetAtomSymClass(), OBForceField::GetAtomTypes(), OBForceField::GetConformers(), OBForceField::GetCoordinates(), OBMol::GetNextFragment(), OBForceField::GetPartialCharges(), OBDescriptor::GetValues(), OBMoleculeFormat::MakeCombinedMolecule(), OBMolAngleIter::OBMolAngleIter(), OBMolRingIter::OBMolRingIter(), OBMolTorsionIter::OBMolTorsionIter(), OBMol::operator=(), and OBDescriptor::PredictAndSave().
OBGenericData * GetData | ( | const std::string & | s ) | [inherited] |
OBGenericData * GetData | ( | const char * | s ) | [inherited] |
std::vector<OBGenericData*>& GetData | ( | ) | [inline, inherited] |
Referenced by OBMol::GetEnergies(), OBMol::GetEnergy(), and OBMol::SetEnergies().
std::vector< OBGenericData * > GetData | ( | DataOrigin | source ) | [inherited] |
std::vector< OBGenericData * > GetAllData | ( | const unsigned int | type ) | [inherited] |
Referenced by OpenBabel::CanonicalLabels(), OBBuilder::CorrectStereoAtoms(), and OBBuilder::CorrectStereoBonds().
OBDataIterator BeginData | ( | ) | [inline, inherited] |
Referenced by OBAtom::Duplicate(), OBMoleculeFormat::MakeCombinedMolecule(), and OBMol::operator=().
OBDataIterator EndData | ( | ) | [inline, inherited] |
Referenced by OBAtom::Duplicate(), OBMoleculeFormat::MakeCombinedMolecule(), and OBMol::operator=().
char _order [protected] |
Bond order (1, 2, 3, 5=aromatic)
unsigned short int _flags [protected] |
Any flags for this bond.
unsigned long _id [protected] |
unique id
bool Visit |
Whether this bond has been visited by a graph algorithm.
std::vector<OBGenericData*> _vdata [protected, inherited] |
Custom data.
Referenced by OBMol::OBMol().