class OEBondBase : public OESystem::OEBase
The OEBondBase class is the abstract interface for representing
bonds within OEChem. OEBondBases are created by calling the
OEMolBase::NewBond method on the parent molecule.
virtual OEAtomBase *GetBgn() const
Return the ``begin'' (or ``source'') atom of a bond. The begin atom of a
bond is defined either when the bond is created with
OEMolBase::NewBond, or possibly by a call to the
OEBondBase::SetBgn method. If the begin atom was specified as the
NULL pointer, (OEAtomBase*)0, when the bond was created, this
method may return a NULL pointer.
virtual unsigned int GetBgnIdx() const
Return the atom index of the ``begin'' (or ``source'') atom of a bond.
This method is equivalent to OEBondBase::GetBgn()->GetIdx(). See
OEAtomBase::GetIdx for the caveats and restrictions on using atom
indices.
virtual OEAtomBase *GetEnd() const
Return the ``end'' (or ``destination'') atom of a bond. The end atom
of a bond is defined either when the bond is created with
OEMolBase::NewBond, or possibly by a call to the
OEBondBase::SetEnd method. If the end atoms was specified as
the NULL pointer, (OEAtomBase*)0, when the bond was created, this
method may return a NULL pointer.
virtual unsigned int GetEndIdx() const
Return the atom index of the ``end'' (or ``destination'') atom of a bond.
This method is equivalent to OEBondBase::GetEnd()->GetIdx(). See
OEAtomBase::GetIdx for the caveats and restrictions on using atom
indices.
virtual unsigned int GetIdx() const
Return the bond index of an bond. This value is assigned by OEChem
when a bond is created. The bond index is unique for the bonds of a
given molecule, and is stable (not reused) for the lifetime of that
OEMolBase. These values may not be assigned sequentially, and may
contain gaps. Bond indices are guaranteed to be less than
OEMolBase::GetMaxBondIdx. Bond indices are typically only used
for efficiently storing data in arrays (or vectors) externally to the
OEMolBase. They arrays can be conveniently index via
OEBondBase::GetIdx(). For iterating across the bonds of a
molecule, use OEMolBase::GetBonds() and for keeping track of a
particular bond use its OEBondBase*.
virtual unsigned int GetIntType() const
Return the integer bond type of a bond. The default value is zero.
The ``integer bond type'' property may be set using the
OEBondBase::SetIntType method.
virtual OEAtomBase *GetNbr(const OEAtomBase *src) const
Return the atom across the bond from the specified atom. If the ``src''
argument represents the begin atom of the bond,
i.e. OEBondBase::GetBgn, this method returns the end atom,
i.e. OEBondBase::GetEnd, and if the ``src'' argument is the end
atom, this function returns the begin atom. If passed an atom other
than the begin or end atoms, this function returns a NULL pointer,
(OEAtomBase*)0. This function is often used for traversing the
atoms of a molecule.
virtual unsigned int GetOrder() const
Return the bond order of a bond. The bond order property is one, for
single bonds, two for double bonds, three for triple bonds and four
for quadruple bonds. The default value is specified when a bond is
created using OEMolBase::NewBond. The bond order property of
a bond may be set using the OEBondBase::SetOrder method.
virtual OEMolBase *GetParent() const
Return the parent molecule of a bond. All OEBondBases are created as a component of an OEMolBase, this method can be used to determine the molecule of which an bond is part. The ``parent molecule'' property of a bond cannot be assigned, as its determined at the point the bond is created.
virtual unsigned int GetStereo(const std::vector<OEAtomBase*> &v,
unsigned int c)
Return the chirality (or stereochemistry) annotation of the current
bond. This method takes a STL vector of adjacent atoms, v,
and a specific stereochemistry class, c, and returns whether that
stereochemisty is specified at this bond, and if so, what that
specified value is. The chiral annotation of an bond may be set
using the OEBondBase::SetStereo method. This function returns
the value OEBondStereo::Undefined if the stereo chemistry
for the given stereochemistry class is unspecified, if the stereo
chemistry class is invalid or if the vector of adjacent atoms is
invalid.
In the current version of OEChem, the only class of stereochemistry
supported for bonds is OEBondStereo::CisTrans which corresponds
to conjugated E/Z chirality. Valid return values for the
OEBondStereo::CisTrans stereochemistry class are
OEBondStereo::Cis and OEBondStereo::Trans.
virtual const const char *GetType() const
Return the ``bond type name'' string of an bond. This value is
typically used when reading and writing molecular formats. For
example, in Sybyl mol2 file, the bond type name ``am'' means that the
bond should be treated as an amide bond. The default value is the
empty string. The bond type name property may be set using the
OEBondBase::SetType method.
virtual bool HasStereoSpecified(unsigned int c=OEBondStereo::All) const
Determine whether the given bond has specified stereochemistry. The
optional argument specifies the class of stereochemisty to check for.
The default value, OEBondStereo::All, checks whether any class
of stereochemistry is specified for the current bond.
In the current version of OEChem, the only class of stereochemistry
supported for bonds is OEBondStereo::CisTrans which corresponds
to conjugated E/Z chirality. If a chiral bond has unspecified
stereochemistry, and this function returns false, the molecule is
assumed to represent either a racemic mixture or an undetermined isomer
of this compound. If this function returns true, this bond has an
explicit stereochemistry which may be retrieved using the
OEBondBase::GetStereo method.
This method initially returns false for a newly created bond. The
stereochemistry of an bond may be set by calling the
OEBondBase::SetStereo method with the appropriate stereochemistry
class, c, and any value other than OEBondStereo::Undefined.
The bond stereochemistry may subsequently be cleared by calling the
same method, with the appropriate stereochemistry class, but specifying
the value OEBondStereo::Undefined.
virtual bool IsAromatic() const
Return the Boolean aromatic property of a bond. The default value is
false. The aromatic property of a bond can be set using the
OEBondBase::SetAromatic method. The aromatic properties of bonds
and atoms in a molecule are typically set by calling either the OEChem
OEAssignAromaticFlags function, or possibly the
OEClearAromaticFlags function.
virtual bool IsChiral() const
Determine whether the current bond is a stereogenic center. If this method returns true, the bond is a chiral center and the cis and trans forms of this bond represent two distinct isomers. If this function returns false, this bond is not a chiral stereocenter.
This method/value is independent of the current
OEBondBase::HasStereoSpecified setting which records whether
a particular cis- or trans- configuration is specified
at a particular bond.
virtual bool IsInRing()
Return the Boolean ``in ring'' property of a bond. The default value is
false. The ``in ring'' property of an bond may be set using the
OEBondBase::SetInRing method. The ``in ring'' properties of bonds
and atoms are typically set by calling OEChem's
OEFindRingAtomsAndBonds function. This is a stored, not a computed,
property.
virtual bool IsRotor() const
Determine whether a bond is freely rotatable. The definition of a
freely rotatable bond is that it is a single, non-ring bond between
two non-terminal, non-triple-bonded atoms. An atom is considered
non-terminal if it is connected to two or more non-hydrogen atoms,
i.e. OEAtomBase::GetHvyDegree >= 2. Note that the
``in ring'' property of the bond must have previously been set using the
OEBondBase::SetInRing method, typically by calling the function
OEFindRingAtomsAndBonds.
virtual bool SetAromatic(bool arom)
Set the Boolean aromatic property of a bond. This value is false by
default. The aromatic property of a bond may be retrieved using the
OEBondBase::IsAromatic method. This function is normally only
used by the functions OEClearAromaticity and
OEAssignAromaticFlags.
virtual bool SetBgn(OEAtomBase*bgn)
Define the ``begin'' (or ``source'') atom of a bond. Normally, the begin
atom of a bond is defined when the bond is created with
OEMolBase::NewBond. However, it is occasionally useful to defer
this decision, by passing the NULL pointer, (OEAtomBase*)0, as the
begin atom to OEMolBase::NewBond. The begin atom should then later
be specified by calling this method, OEBondBase::SetBgn, to resolve the
begin atom before the molecule is used. Note that it is not possible
to set/change the begin atom of a bond, once it has been defined. To
achieve the same behavior call the OEMolBase::DeleteBond method,
followed by OEMolBase::NewBond, to first destroy the original and
replace it with a new bond.
virtual bool SetEnd(OEAtomBase *end)
Define the ``end'' (or ``destination'') atom of a bond. Normally, the end
atom of a bond is defined when the bond is created with
OEMolBase::NewBond. However, it is occasionally useful to defer
this decision, by passing the NULL pointer, (OEAtomBase*)0, as the
end atom to OEMolBase::NewBond. The end atom should then later be
specified by calling this method, OEBondBase::SetEnd, to resolve
the end atom before the molecule is used. Note that it is not possible to
set/change the end atom of a bond, once it has been defined. To
achieve the same behavior call the OEMolBase::DeleteBond method,
followed by OEMolBase::NewBond, to first destroy the original and
replace it with a new bond.
virtual bool SetType(unsigned int typ)
Set the integer bond type of a bond. The default value is zero. The
``integer bond type'' property may be retrieved using the
OEBondBase::GetIntType method.
virtual bool SetInRing(bool inring)
Set the Boolean ``in ring'' property of an bond. This property is
usually set by the OEChem function OEFindRingAtomsAndBonds. The
default value is false. The ``in ring'' property of a bond may be
retrieved using the OEBondBase::IsInRing method.
virtual bool SetOrder(unsigned int bo)
Set the bond order of a bond. The bond order property is one, for
single bonds, two for double bonds, three for triple bonds and four
for quadruple bonds. The default value is specified when a bond is
created using OEMolBase::NewBond. The bond order property of
a bond may be retrieved using the OEBondBase::GetOrder method.
virtual bool SetStereo(const std::vector<OEAtomBase*> &v,
unsigned int c, unsigned int p)
Set the chirality (or stereochemistry) annotation of the current
bond. This method takes a STL vector of adjacent atoms, v,
and a specific stereochemisty class, c and the value for that
chirality to be set to. This function returns true if the bond
chirality was correctly set, and false if the stereochemistry
class is invalid, the stereochemistry value is invalid for the
stereochemistry class, or the vector of adjacent atoms is invalid.
The chiral annotation of a bond may be retrieved using the
OEBondBase::GetStereo.
If set sucessfully, to a value other than OEBondStereo::Undefined,
future calls to OEBondBase::HasStereoSpecified with the given
stereochemistry class (or OEBondStereo::All) will return true. If
sucessfully set to the value OEBondStereo::Undefined, future
calls to OEBondBase::HasStereoSpecified will return false.
In the current version of OEChem, the only class of stereochemistry
supported for bonds is OEBondStereo::CisTrans which corresponds
to conjugated E/Z chirality. Valid values for the
OEBondStereo::CisTrans stereochemistry class are
OEBondStereo::Cis and OEBondStereo::Trans.
virtual bool SetType(const std::string &typ) virtual bool SetType(const char *typ)
Set the ``bond type name'' string of an bond. This value is typically
used when reading and writing molecular formats. For example, in
Sybyl mol2 file, the bond type name ``am'' means that the bond should be
treated as an amide bond. The default value is the empty string. The
bond type name property may be retrieved using the
OEBondBase::GetType method.
virtual bool SwapEnds()
This method swaps the begin and end atoms of a bond. The lists of
bonds contained in each of the two atoms are not altered. After
calling the SwapEnds method, the atoms returned by the
OEBondBase::GetBgn and OEBondBase::GetEnd methods will
be interchanged.