RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
RDKit::Bond Class Reference

class for representing a bond More...

#include <Bond.h>

Inheritance diagram for RDKit::Bond:
RDKit::RDProps RDKit::QueryBond

Public Types

enum  BondType {
  UNSPECIFIED = 0 , SINGLE , DOUBLE , TRIPLE ,
  QUADRUPLE , QUINTUPLE , HEXTUPLE , ONEANDAHALF ,
  TWOANDAHALF , THREEANDAHALF , FOURANDAHALF , FIVEANDAHALF ,
  AROMATIC , IONIC , HYDROGEN , THREECENTER ,
  DATIVEONE , DATIVE , DATIVEL , DATIVER ,
  OTHER , ZERO
}
 the type of Bond More...
 
enum  BondDir {
  NONE = 0 , BEGINWEDGE , BEGINDASH , ENDDOWNRIGHT ,
  ENDUPRIGHT , EITHERDOUBLE , UNKNOWN
}
 the bond's direction (for chirality) More...
 
enum  BondStereo {
  STEREONONE = 0 , STEREOANY , STEREOZ , STEREOE ,
  STEREOCIS , STEREOTRANS , STEREOATROPCW , STEREOATROPCCW
}
 the nature of the bond's stereochem (for cis/trans) More...
 
typedef Queries::Query< int, Bond const *, true > QUERYBOND_QUERY
 

Public Member Functions

 Bond ()
 
 Bond (BondType bT)
 construct with a particular BondType
 
 Bond (const Bond &other)
 
virtual ~Bond ()
 
Bondoperator= (const Bond &other)
 
 Bond (Bond &&o) noexcept
 
Bondoperator= (Bond &&o) noexcept
 
virtual Bondcopy () const
 returns a copy
 
BondType getBondType () const
 returns our bondType
 
void setBondType (BondType bT)
 sets our bondType
 
double getBondTypeAsDouble () const
 returns our bondType as a double (e.g. SINGLE->1.0, AROMATIC->1.5, etc.)
 
virtual double getValenceContrib (const Atom *at) const
 returns our contribution to the explicit valence of an Atom
 
void setIsAromatic (bool what)
 sets our isAromatic flag
 
bool getIsAromatic () const
 returns the status of our isAromatic flag
 
void setIsConjugated (bool what)
 sets our isConjugated flag
 
bool getIsConjugated () const
 returns the status of our isConjugated flag
 
bool hasOwningMol () const
 returns whether or not this instance belongs to a molecule
 
ROMolgetOwningMol () const
 returns a reference to the ROMol that owns this instance
 
void setOwningMol (ROMol *other)
 sets our owning molecule
 
void setOwningMol (ROMol &other)
 sets our owning molecule
 
bool invertChirality ()
 
unsigned int getIdx () const
 returns our index within the ROMol
 
void setIdx (unsigned int index)
 sets our index within the ROMol
 
unsigned int getBeginAtomIdx () const
 returns the index of our begin Atom
 
unsigned int getEndAtomIdx () const
 returns the index of our end Atom
 
unsigned int getOtherAtomIdx (unsigned int thisIdx) const
 given the index of one Atom, returns the index of the other
 
void setBeginAtomIdx (unsigned int what)
 sets the index of our begin Atom
 
void setEndAtomIdx (unsigned int what)
 sets the index of our end Atom
 
void setBeginAtom (Atom *at)
 sets our begin Atom
 
void setEndAtom (Atom *at)
 sets our end Atom
 
AtomgetBeginAtom () const
 returns a pointer to our begin Atom
 
AtomgetEndAtom () const
 returns a pointer to our end Atom
 
AtomgetOtherAtom (Atom const *what) const
 returns a pointer to the other Atom
 
virtual bool hasQuery () const
 
virtual void setQuery (QUERYBOND_QUERY *what)
 NOT CALLABLE.
 
virtual QUERYBOND_QUERYgetQuery () const
 NOT CALLABLE.
 
virtual void expandQuery (QUERYBOND_QUERY *what, Queries::CompositeQueryType how=Queries::COMPOSITE_AND, bool maintainOrder=true)
 NOT CALLABLE.
 
virtual bool Match (Bond const *what) const
 returns whether or not we match the argument
 
void setBondDir (BondDir what)
 sets our direction
 
BondDir getBondDir () const
 returns our direction
 
void setStereo (BondStereo what)
 sets our stereo code
 
BondStereo getStereo () const
 returns our stereo code
 
void setStereoAtoms (unsigned int bgnIdx, unsigned int endIdx)
 sets the atoms to be considered as reference points for bond stereo
 
const INT_VECTgetStereoAtoms () const
 returns the indices of our stereo atoms
 
INT_VECTgetStereoAtoms ()
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void updatePropertyCache (bool strict=true)
 calculates any of our lazy properties
 
void setFlags (std::uint64_t flags)
 
std::uint64_t getFlags () const
 
std::uint64_t & getFlags ()
 
- Public Member Functions inherited from RDKit::RDProps
 RDProps ()
 
 RDProps (const RDProps &rhs)
 
RDPropsoperator= (const RDProps &rhs)
 
 RDProps (RDProps &&o) noexcept=default
 
RDPropsoperator= (RDProps &&rhs) noexcept=default
 
void clear ()
 
const DictgetDict () const
 gets the underlying Dictionary
 
DictgetDict ()
 
STR_VECT getPropList (bool includePrivate=true, bool includeComputed=true) const
 returns a list with the names of our properties
 
template<typename T>
void setProp (const std::string &key, T val, bool computed=false) const
 sets a property value
 
template<typename T>
void getProp (const std::string &key, T &res) const
 allows retrieval of a particular property value
 
template<typename T>
getProp (const std::string &key) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T>
bool getPropIfPresent (const std::string &key, T &res) const
 
bool hasProp (const std::string &key) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
void clearProp (const std::string &key) const
 clears the value of a property
 
void clearComputedProps () const
 clears all of our computed properties
 
void updateProps (const RDProps &source, bool preserveExisting=false)
 update the properties from another
 

Protected Member Functions

void initBond ()
 

Protected Attributes

ROMoldp_mol
 
INT_VECTdp_stereoAtoms
 
atomindex_t d_index
 
atomindex_t d_beginAtomIdx
 
atomindex_t d_endAtomIdx
 
bool df_isAromatic
 
bool df_isConjugated
 
std::uint8_t d_bondType
 
std::uint8_t d_dirTag
 
std::uint8_t d_stereo
 
std::uint64_t d_flags = 0
 
- Protected Attributes inherited from RDKit::RDProps
Dict d_props
 

Friends

class RWMol
 
class ROMol
 

Detailed Description

class for representing a bond

Notes:

  • many of the methods of Atom require that the Atom be associated with a molecule (an ROMol).
  • each Bond maintains a Dict of properties:
    • Each property is keyed by name and can store an arbitrary type.
    • Properties can be marked as calculated, in which case they will be cleared when the clearComputedProps() method is called.
    • Because they have no impact upon chemistry, all property operations are const, this allows extra flexibility for clients who need to store extra data on Bond objects.

Definition at line 46 of file Bond.h.

Member Typedef Documentation

◆ QUERYBOND_QUERY

typedef Queries::Query<int, Bond const *, true> RDKit::Bond::QUERYBOND_QUERY

Definition at line 52 of file Bond.h.

Member Enumeration Documentation

◆ BondDir

the bond's direction (for chirality)

Enumerator
NONE 

no special style

BEGINWEDGE 

wedged: narrow at begin

BEGINDASH 

dashed: narrow at begin

ENDDOWNRIGHT 

for cis/trans

ENDUPRIGHT 

ditto

EITHERDOUBLE 

a "crossed" double bond

UNKNOWN 

intentionally unspecified stereochemistry

Definition at line 82 of file Bond.h.

◆ BondStereo

the nature of the bond's stereochem (for cis/trans)

Enumerator
STEREONONE 
STEREOANY 
STEREOZ 
STEREOE 
STEREOCIS 
STEREOTRANS 
STEREOATROPCW 
STEREOATROPCCW 

Definition at line 94 of file Bond.h.

◆ BondType

the type of Bond

Enumerator
UNSPECIFIED 
SINGLE 
DOUBLE 
TRIPLE 
QUADRUPLE 
QUINTUPLE 
HEXTUPLE 
ONEANDAHALF 
TWOANDAHALF 
THREEANDAHALF 
FOURANDAHALF 
FIVEANDAHALF 
AROMATIC 
IONIC 
HYDROGEN 
THREECENTER 
DATIVEONE 

one-electron dative (e.g. from a C in a Cp ring to a metal)

DATIVE 

standard two-electron dative

DATIVEL 

standard two-electron dative

DATIVER 

standard two-electron dative

OTHER 
ZERO 

Zero-order bond (from.

Definition at line 55 of file Bond.h.

Constructor & Destructor Documentation

◆ Bond() [1/4]

◆ Bond() [2/4]

RDKit::Bond::Bond ( BondType bT)
explicit

construct with a particular BondType

◆ Bond() [3/4]

RDKit::Bond::Bond ( const Bond & other)

References Bond().

◆ ~Bond()

virtual RDKit::Bond::~Bond ( )
virtual

◆ Bond() [4/4]

RDKit::Bond::Bond ( Bond && o)
inlinenoexcept

Member Function Documentation

◆ copy()

virtual Bond * RDKit::Bond::copy ( ) const
virtual

returns a copy

Note: the caller is responsible for deleteing the returned pointer.

Reimplemented in RDKit::QueryBond.

References Bond().

◆ expandQuery()

virtual void RDKit::Bond::expandQuery ( QUERYBOND_QUERY * what,
Queries::CompositeQueryType how = Queries::COMPOSITE_AND,
bool maintainOrder = true )
virtual

NOT CALLABLE.

Reimplemented in RDKit::QueryBond.

References Queries::COMPOSITE_AND.

◆ getBeginAtom()

Atom * RDKit::Bond::getBeginAtom ( ) const

returns a pointer to our begin Atom

Notes:

  • requires an owning molecule

◆ getBeginAtomIdx()

unsigned int RDKit::Bond::getBeginAtomIdx ( ) const
inline

returns the index of our begin Atom

Notes:

  • this makes no sense if we do not have an owning molecule

Definition at line 219 of file Bond.h.

References d_beginAtomIdx.

◆ getBondDir()

BondDir RDKit::Bond::getBondDir ( ) const
inline

returns our direction

Definition at line 312 of file Bond.h.

References d_dirTag.

Referenced by RDKit::queryBondDir().

◆ getBondType()

◆ getBondTypeAsDouble()

double RDKit::Bond::getBondTypeAsDouble ( ) const

returns our bondType as a double (e.g. SINGLE->1.0, AROMATIC->1.5, etc.)

◆ getEndAtom()

Atom * RDKit::Bond::getEndAtom ( ) const

returns a pointer to our end Atom

Notes:

  • requires an owning molecule

◆ getEndAtomIdx()

unsigned int RDKit::Bond::getEndAtomIdx ( ) const
inline

returns the index of our end Atom

Notes:

  • this makes no sense if we do not have an owning molecule

Definition at line 226 of file Bond.h.

References d_endAtomIdx.

Referenced by RDKit::SLNParse::addBranchToMol().

◆ getFlags() [1/2]

std::uint64_t & RDKit::Bond::getFlags ( )
inline

Definition at line 378 of file Bond.h.

References d_flags.

◆ getFlags() [2/2]

std::uint64_t RDKit::Bond::getFlags ( ) const
inline

Definition at line 377 of file Bond.h.

References d_flags.

◆ getIdx()

unsigned int RDKit::Bond::getIdx ( ) const
inline

returns our index within the ROMol

Notes:

  • this makes no sense if we do not have an owning molecule

Definition at line 205 of file Bond.h.

References d_index.

Referenced by RDKit::queryBondIsInRingOfSize(), RDKit::queryBondMinRingSize(), RDKit::queryIsBondInNRings(), and RDKit::queryIsBondInRing().

◆ getIsAromatic()

bool RDKit::Bond::getIsAromatic ( ) const
inline

returns the status of our isAromatic flag

Definition at line 176 of file Bond.h.

References df_isAromatic.

◆ getIsConjugated()

bool RDKit::Bond::getIsConjugated ( ) const
inline

returns the status of our isConjugated flag

Definition at line 181 of file Bond.h.

References df_isConjugated.

◆ getOtherAtom()

Atom * RDKit::Bond::getOtherAtom ( Atom const * what) const

returns a pointer to the other Atom

Notes:

  • requires an owning molecule

◆ getOtherAtomIdx()

unsigned int RDKit::Bond::getOtherAtomIdx ( unsigned int thisIdx) const

given the index of one Atom, returns the index of the other

Notes:

  • this makes no sense if we do not have an owning molecule

◆ getOwningMol()

ROMol & RDKit::Bond::getOwningMol ( ) const
inline

returns a reference to the ROMol that owns this instance

Definition at line 187 of file Bond.h.

References dp_mol, PRECONDITION, and ROMol.

Referenced by RDKit::queryBondIsInRingOfSize(), RDKit::queryBondMinRingSize(), RDKit::queryIsBondInNRings(), and RDKit::queryIsBondInRing().

◆ getQuery()

virtual QUERYBOND_QUERY * RDKit::Bond::getQuery ( ) const
virtual

◆ getStereo()

BondStereo RDKit::Bond::getStereo ( ) const
inline

returns our stereo code

Definition at line 334 of file Bond.h.

References d_stereo.

Referenced by RDKit::queryBondHasStereo().

◆ getStereoAtoms() [1/2]

INT_VECT & RDKit::Bond::getStereoAtoms ( )
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 358 of file Bond.h.

References dp_stereoAtoms.

◆ getStereoAtoms() [2/2]

const INT_VECT & RDKit::Bond::getStereoAtoms ( ) const
inline

returns the indices of our stereo atoms

Definition at line 351 of file Bond.h.

References Bond(), and dp_stereoAtoms.

Referenced by setStereo().

◆ getValenceContrib()

virtual double RDKit::Bond::getValenceContrib ( const Atom * at) const
virtual

returns our contribution to the explicit valence of an Atom

Notes:

  • requires an owning molecule

Reimplemented in RDKit::QueryBond.

◆ hasOwningMol()

bool RDKit::Bond::hasOwningMol ( ) const
inline

returns whether or not this instance belongs to a molecule

Definition at line 184 of file Bond.h.

References dp_mol.

◆ hasQuery()

virtual bool RDKit::Bond::hasQuery ( ) const
inlinevirtual

◆ initBond()

void RDKit::Bond::initBond ( )
protected

◆ invertChirality()

bool RDKit::Bond::invertChirality ( )

◆ Match()

virtual bool RDKit::Bond::Match ( Bond const * what) const
virtual

returns whether or not we match the argument

Notes:

  • for Bond objects, "match" means that either one of the Bonds has bondType Bond::UNSPECIFIED or both Bonds have the same bondType.

Reimplemented in RDKit::QueryBond.

References Bond().

◆ operator=() [1/2]

Bond & RDKit::Bond::operator= ( Bond && o)
inlinenoexcept

◆ operator=() [2/2]

Bond & RDKit::Bond::operator= ( const Bond & other)

References Bond().

◆ setBeginAtom()

void RDKit::Bond::setBeginAtom ( Atom * at)

sets our begin Atom

Notes:

  • requires an owning molecule

◆ setBeginAtomIdx()

void RDKit::Bond::setBeginAtomIdx ( unsigned int what)

sets the index of our begin Atom

Notes:

  • requires an owning molecule

◆ setBondDir()

void RDKit::Bond::setBondDir ( BondDir what)
inline

sets our direction

Definition at line 310 of file Bond.h.

References d_dirTag.

◆ setBondType()

void RDKit::Bond::setBondType ( BondType bT)
inline

sets our bondType

Definition at line 161 of file Bond.h.

References d_bondType.

◆ setEndAtom()

void RDKit::Bond::setEndAtom ( Atom * at)

sets our end Atom

Notes:

  • requires an owning molecule

◆ setEndAtomIdx()

void RDKit::Bond::setEndAtomIdx ( unsigned int what)

sets the index of our end Atom

Notes:

  • requires an owning molecule

Referenced by RDKit::SLNParse::addBranchToMol().

◆ setFlags()

void RDKit::Bond::setFlags ( std::uint64_t flags)
inline

Flags that can be used by to store information on bonds. These are not serialized and should be treated as temporary values. No guarantees are made about preserving these flags across library calls.

Definition at line 376 of file Bond.h.

References d_flags.

◆ setIdx()

void RDKit::Bond::setIdx ( unsigned int index)
inline

sets our index within the ROMol

Notes:

  • this makes no sense if we do not have an owning molecule
  • the index should be < this->getOwningMol()->getNumBonds()

Definition at line 212 of file Bond.h.

References d_index.

◆ setIsAromatic()

void RDKit::Bond::setIsAromatic ( bool what)
inline

sets our isAromatic flag

Definition at line 174 of file Bond.h.

References df_isAromatic.

◆ setIsConjugated()

void RDKit::Bond::setIsConjugated ( bool what)
inline

sets our isConjugated flag

Definition at line 179 of file Bond.h.

References df_isConjugated.

◆ setOwningMol() [1/2]

void RDKit::Bond::setOwningMol ( ROMol & other)
inline

sets our owning molecule

Definition at line 194 of file Bond.h.

References ROMol, and setOwningMol().

Referenced by setOwningMol().

◆ setOwningMol() [2/2]

void RDKit::Bond::setOwningMol ( ROMol * other)

sets our owning molecule

References ROMol.

Referenced by RDKit::SLNParse::addBranchToMol().

◆ setQuery()

virtual void RDKit::Bond::setQuery ( QUERYBOND_QUERY * what)
virtual

NOT CALLABLE.

Reimplemented in RDKit::QueryBond.

◆ setStereo()

void RDKit::Bond::setStereo ( BondStereo what)
inline

sets our stereo code

STEREONONE, STEREOANY, STEREOE and STEREOZ can be set without neighboring atoms specified in getStereoAtoms since they are defined by the topology of the molecular graph. In order to set STEREOCIS or STEREOTRANS the neighboring atoms must be set first (using setStereoBonds()) to know what atoms are being considered.

Notes:

Definition at line 326 of file Bond.h.

References d_stereo, getStereoAtoms(), PRECONDITION, STEREOCIS, and STEREOTRANS.

◆ setStereoAtoms()

void RDKit::Bond::setStereoAtoms ( unsigned int bgnIdx,
unsigned int endIdx )

sets the atoms to be considered as reference points for bond stereo

These do not necessarily need to be the highest 'ranking' atoms like CIP stereo requires. They can be any arbitrary atoms neighboring the begin and end atoms of this bond respectively. STEREOCIS or STEREOTRANS is then set relative to only these atoms.

If CIP rankings are desired, use MolOps::findPotentialStereoBonds, but this is a more costly function as it takes the whole molecule topology into account.

◆ updatePropertyCache()

void RDKit::Bond::updatePropertyCache ( bool strict = true)
inline

calculates any of our lazy properties

Notes:

  • requires an owning molecule

Definition at line 370 of file Bond.h.

Friends And Related Symbol Documentation

◆ ROMol

friend class ROMol
friend

Definition at line 48 of file Bond.h.

References ROMol.

Referenced by getOwningMol(), ROMol, setOwningMol(), and setOwningMol().

◆ RWMol

friend class RWMol
friend

Definition at line 47 of file Bond.h.

References RWMol.

Referenced by RWMol.

Member Data Documentation

◆ d_beginAtomIdx

atomindex_t RDKit::Bond::d_beginAtomIdx
protected

Definition at line 388 of file Bond.h.

Referenced by Bond(), getBeginAtomIdx(), and operator=().

◆ d_bondType

std::uint8_t RDKit::Bond::d_bondType
protected

Definition at line 391 of file Bond.h.

Referenced by Bond(), getBondType(), operator=(), and setBondType().

◆ d_dirTag

std::uint8_t RDKit::Bond::d_dirTag
protected

Definition at line 392 of file Bond.h.

Referenced by Bond(), getBondDir(), operator=(), and setBondDir().

◆ d_endAtomIdx

atomindex_t RDKit::Bond::d_endAtomIdx
protected

Definition at line 388 of file Bond.h.

Referenced by Bond(), getEndAtomIdx(), and operator=().

◆ d_flags

std::uint64_t RDKit::Bond::d_flags = 0
protected

Definition at line 394 of file Bond.h.

Referenced by Bond(), getFlags(), getFlags(), operator=(), and setFlags().

◆ d_index

atomindex_t RDKit::Bond::d_index
protected

Definition at line 387 of file Bond.h.

Referenced by Bond(), getIdx(), operator=(), and setIdx().

◆ d_stereo

std::uint8_t RDKit::Bond::d_stereo
protected

Definition at line 393 of file Bond.h.

Referenced by Bond(), getStereo(), operator=(), and setStereo().

◆ df_isAromatic

bool RDKit::Bond::df_isAromatic
protected

Definition at line 389 of file Bond.h.

Referenced by Bond(), getIsAromatic(), operator=(), and setIsAromatic().

◆ df_isConjugated

bool RDKit::Bond::df_isConjugated
protected

Definition at line 390 of file Bond.h.

Referenced by Bond(), getIsConjugated(), operator=(), and setIsConjugated().

◆ dp_mol

ROMol* RDKit::Bond::dp_mol
protected

sets our owning molecule void setOwningMol(ROMol *other); sets our owning molecule void setOwningMol(ROMol &other) { setOwningMol(&other); }

Definition at line 385 of file Bond.h.

Referenced by Bond(), getOwningMol(), hasOwningMol(), and operator=().

◆ dp_stereoAtoms

INT_VECT* RDKit::Bond::dp_stereoAtoms
protected

Definition at line 386 of file Bond.h.

Referenced by Bond(), getStereoAtoms(), getStereoAtoms(), and operator=().


The documentation for this class was generated from the following file: