RDKit
Open-source cheminformatics and machine learning.
|
The class for representing atoms. More...
#include <Atom.h>
Public Types | |
enum | HybridizationType { UNSPECIFIED = 0 , S , SP , SP2 , SP3 , SP2D , SP3D , SP3D2 , OTHER } |
store hybridization More... | |
enum | ChiralType { CHI_UNSPECIFIED = 0 , CHI_TETRAHEDRAL_CW , CHI_TETRAHEDRAL_CCW , CHI_OTHER , CHI_TETRAHEDRAL , CHI_ALLENE , CHI_SQUAREPLANAR , CHI_TRIGONALBIPYRAMIDAL , CHI_OCTAHEDRAL } |
store type of chirality More... | |
typedef Queries::Query< int, Atom const *, true > | QUERYATOM_QUERY |
Public Member Functions | |
Atom () | |
Atom (unsigned int num) | |
construct an Atom with a particular atomic number | |
Atom (const std::string &what) | |
Atom (const Atom &other) | |
Atom & | operator= (const Atom &other) |
Atom (Atom &&other)=default | |
Atom & | operator= (Atom &&other)=default |
virtual | ~Atom () |
virtual Atom * | copy () const |
makes a copy of this Atom and returns a pointer to it. | |
int | getAtomicNum () const |
returns our atomic number | |
void | setAtomicNum (int newNum) |
sets our atomic number | |
std::string | getSymbol () const |
returns our symbol (determined by our atomic number) | |
bool | hasOwningMol () const |
returns whether or not this instance belongs to a molecule | |
ROMol & | getOwningMol () const |
returns a reference to the ROMol that owns this instance | |
unsigned int | getIdx () const |
returns our index within the ROMol | |
void | setIdx (unsigned int index) |
sets our index within the ROMol | |
template<class U > | |
void | setIdx (const U index) |
overload | |
unsigned int | getDegree () const |
unsigned int | getTotalDegree () const |
unsigned int | getTotalNumHs (bool includeNeighbors=false) const |
returns the total number of Hs (implicit and explicit) that this Atom is bound to | |
unsigned int | getTotalValence () const |
returns the total valence (implicit and explicit) for an atom | |
unsigned int | getNumImplicitHs () const |
returns the number of implicit Hs this Atom is bound to | |
int | getExplicitValence () const |
returns the explicit valence (including Hs) of this atom | |
int | getImplicitValence () const |
returns the implicit valence for this Atom | |
bool | hasValenceViolation () const |
returns whether the atom has a valency violation or not | |
unsigned int | getNumRadicalElectrons () const |
returns the number of radical electrons for this Atom | |
void | setNumRadicalElectrons (unsigned int num) |
int | getFormalCharge () const |
returns the formal charge of this atom | |
void | setFormalCharge (int what) |
set's the formal charge of this atom | |
void | setNoImplicit (bool what) |
sets our noImplicit flag, indicating whether or not we are allowed to have implicit Hs | |
bool | getNoImplicit () const |
returns the noImplicit flag | |
void | setNumExplicitHs (unsigned int what) |
sets our number of explicit Hs | |
unsigned int | getNumExplicitHs () const |
returns our number of explicit Hs | |
void | setIsAromatic (bool what) |
sets our isAromatic flag, indicating whether or not we are aromatic | |
bool | getIsAromatic () const |
returns our isAromatic flag | |
double | getMass () const |
returns our mass | |
void | setIsotope (unsigned int what) |
sets our isotope number | |
unsigned int | getIsotope () const |
returns our isotope number | |
void | setChiralTag (ChiralType what) |
sets our chiralTag | |
bool | invertChirality () |
inverts our chiralTag , returns whether or not a change was made | |
ChiralType | getChiralTag () const |
returns our chiralTag | |
void | setHybridization (HybridizationType what) |
sets our hybridization | |
HybridizationType | getHybridization () const |
returns our hybridization | |
virtual bool | hasQuery () const |
virtual std::string | getQueryType () const |
virtual void | setQuery (QUERYATOM_QUERY *what) |
NOT CALLABLE. | |
virtual QUERYATOM_QUERY * | getQuery () const |
NOT CALLABLE. | |
virtual void | expandQuery (QUERYATOM_QUERY *what, Queries::CompositeQueryType how=Queries::COMPOSITE_AND, bool maintainOrder=true) |
NOT CALLABLE. | |
virtual bool | Match (Atom const *what) const |
returns whether or not we match the argument | |
int | getPerturbationOrder (const INT_LIST &probe) const |
returns the perturbation order for a list of integers | |
void | updatePropertyCache (bool strict=true) |
calculates any of our lazy properties | |
bool | needsUpdatePropertyCache () const |
int | calcExplicitValence (bool strict=true) |
calculates and returns our explicit valence | |
int | calcImplicitValence (bool strict=true) |
calculates and returns our implicit valence | |
AtomMonomerInfo * | getMonomerInfo () |
const AtomMonomerInfo * | getMonomerInfo () const |
void | setMonomerInfo (AtomMonomerInfo *info) |
takes ownership of the pointer | |
void | setAtomMapNum (int mapno, bool strict=true) |
Set the atom map Number of the atom. | |
int | getAtomMapNum () const |
Public Member Functions inherited from RDKit::RDProps | |
RDProps () | |
RDProps (const RDProps &rhs) | |
RDProps & | operator= (const RDProps &rhs) |
RDProps (RDProps &&o) noexcept=default | |
RDProps & | operator= (RDProps &&rhs) noexcept=default |
void | clear () |
const Dict & | getDict () const |
gets the underlying Dictionary | |
Dict & | getDict () |
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 > | |
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 | setOwningMol (ROMol *other) |
sets our owning molecule | |
void | setOwningMol (ROMol &other) |
sets our owning molecule | |
void | initAtom () |
void | initFromOther (const Atom &other) |
Protected Attributes | |
bool | df_isAromatic |
bool | df_noImplicit |
std::uint8_t | d_numExplicitHs |
std::int8_t | d_formalCharge |
std::uint8_t | d_atomicNum |
std::int8_t | d_implicitValence |
std::int8_t | d_explicitValence |
std::uint8_t | d_numRadicalElectrons |
std::uint8_t | d_chiralTag |
std::uint8_t | d_hybrid |
std::uint16_t | d_isotope |
atomindex_t | d_index |
ROMol * | dp_mol |
AtomMonomerInfo * | dp_monomerInfo |
Protected Attributes inherited from RDKit::RDProps | |
Dict | d_props |
Friends | |
class | MolPickler |
the pickler needs access to our privates | |
class | ROMol |
class | RWMol |
std::ostream & | operator<<) (std::ostream &target, const Atom &at) |
The class for representing atoms.
Notes:
properties:
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.property
operations are const
, this allows extra flexibility for clients who need to store extra data on Atom objects.The chirality of an Atom is determined by two things:
chiralTag
For tetrahedral coordination, the chiralTag
tells you what direction you have to rotate to get from bond 2 to bond 3 while looking down bond 1. This is pretty much identical to the SMILES representation of chirality.
NOTE: if an atom has an implicit H, the bond to that H is considered to be at the end of the list of other bonds.
store type of chirality
RDKit::Atom::Atom | ( | ) |
|
explicit |
construct an Atom with a particular symbol (looked up in the PeriodicTable)
|
default |
|
virtual |
calculates and returns our explicit valence
Notes:
calculates and returns our implicit valence
Notes:
makes a copy of this Atom and returns a pointer to it.
Note: the caller is responsible for delete
ing the result
Reimplemented in RDKit::QueryAtom.
|
virtual |
NOT CALLABLE.
Reimplemented in RDKit::QueryAtom.
|
inline |
returns our atomic number
Definition at line 134 of file Atom.h.
Referenced by RDDepict::getAtomDepictRank(), RDKit::isAnyAtomWithMultipleNeighborsOrNotUserRLabel(), RDKit::isAtomDummy(), RDKit::queryAtomNum(), and RDKit::queryAtomType().
|
inline |
|
inline |
returns our chiralTag
Definition at line 262 of file Atom.h.
Referenced by RDKit::queryAtomHasChiralTag(), and RDKit::queryAtomMissingChiralTag().
returns the explicit degree of the Atom (number of bonded neighbors in the graph)
Notes:
Referenced by RDDepict::getAtomDepictRank(), and RDKit::queryAtomExplicitDegree().
int RDKit::Atom::getExplicitValence | ( | ) | const |
returns the explicit valence (including Hs) of this atom
Referenced by RDKit::queryAtomExplicitValence().
|
inline |
returns the formal charge of this atom
Definition at line 229 of file Atom.h.
Referenced by RDKit::QueryAtom::QueryAtom(), RDKit::queryAtomFormalCharge(), and RDKit::queryAtomNegativeFormalCharge().
|
inline |
returns our hybridization
Definition at line 269 of file Atom.h.
Referenced by RDKit::queryAtomHybridization().
returns our index within the ROMol
Definition at line 151 of file Atom.h.
Referenced by RDKit::SLNParse::addAtomToMol(), RDKit::RecursiveStructureQuery::getAtIdx(), RDKit::queryAtomIsInRingOfSize(), RDKit::queryAtomMinRingSize(), RDKit::queryAtomRingMembership(), RDKit::queryIsAtomInNRings(), and RDKit::queryIsAtomInRing().
int RDKit::Atom::getImplicitValence | ( | ) | const |
returns the implicit valence for this Atom
Notes:
Referenced by RDKit::queryAtomImplicitValence().
|
inline |
returns our isAromatic
flag
Definition at line 247 of file Atom.h.
Referenced by RDKit::queryAtomAliphatic(), RDKit::queryAtomAromatic(), and RDKit::queryAtomType().
returns our isotope number
Definition at line 255 of file Atom.h.
Referenced by RDKit::QueryAtom::QueryAtom(), and RDKit::queryAtomIsotope().
double RDKit::Atom::getMass | ( | ) | const |
returns our mass
Referenced by RDKit::queryAtomMass().
|
inline |
|
inline |
|
inline |
returns our number of explicit Hs
Definition at line 242 of file Atom.h.
Referenced by RDKit::queryAtomExplicitValence().
returns the number of radical electrons for this Atom
Notes:
Definition at line 225 of file Atom.h.
Referenced by RDKit::QueryAtom::QueryAtom(), and RDKit::queryAtomNumRadicalElectrons().
|
inline |
returns a reference to the ROMol that owns this instance
Definition at line 145 of file Atom.h.
References PRECONDITION.
Referenced by RDKit::queryAtomHasAliphaticHeteroatomNbrs(), RDKit::queryAtomHasHeteroatomNbrs(), RDKit::queryAtomHasRingBond(), RDKit::queryAtomHeavyAtomDegree(), RDKit::queryAtomIsInRingOfSize(), RDKit::queryAtomMinRingSize(), RDKit::queryAtomNonHydrogenDegree(), RDKit::queryAtomNumAliphaticHeteroatomNbrs(), RDKit::queryAtomNumHeteroatomNbrs(), RDKit::queryAtomRingBondCount(), RDKit::queryAtomRingMembership(), RDKit::queryIsAtomInNRings(), and RDKit::queryIsAtomInRing().
returns the perturbation order for a list of integers
This value is associated with chirality.
probe | a list of bond indices. This must be the same length as our number of incoming bonds (our degree). |
[0,1,2,3]
getPerturbationOrder([1,0,2,3]) = 1 getPerturbationOrder([1,2,3,0]) = 3 getPerturbationOrder([1,2,0,3]) = 2
See the class documentation for a more detailed description of our representation of chirality.
Notes:
|
virtual |
NOT CALLABLE.
Reimplemented in RDKit::QueryAtom.
Referenced by RDKit::describeQuery(), and RDKit::isAtomDummy().
|
inlinevirtual |
Reimplemented in RDKit::QueryAtom.
std::string RDKit::Atom::getSymbol | ( | ) | const |
returns our symbol (determined by our atomic number)
returns the total degree of the Atom (number of bonded neighbors + number of Hs)
Notes:
Referenced by RDKit::queryAtomTotalDegree(), and RDKit::queryAtomUnsaturated().
returns the total number of Hs (implicit and explicit) that this Atom is bound to
Notes:
Referenced by RDKit::queryAtomHasImplicitH(), RDKit::queryAtomHCount(), and RDKit::queryAtomImplicitHCount().
returns the total valence (implicit and explicit) for an atom
Notes:
Referenced by RDKit::queryAtomTotalValence(), and RDKit::queryAtomUnsaturated().
|
inline |
Reimplemented in RDKit::QueryAtom.
Definition at line 286 of file Atom.h.
Referenced by RDKit::describeQuery(), and RDKit::isAtomDummy().
bool RDKit::Atom::hasValenceViolation | ( | ) | const |
returns whether the atom has a valency violation or not
Notes:
|
protected |
bool RDKit::Atom::invertChirality | ( | ) |
inverts our chiralTag
, returns whether or not a change was made
returns whether or not we match the argument
Notes: The general rule is that if a property on this atom has a non-default value, the property on the other atom must have the same value. The exception to this is H counts, which are ignored. These turns out to be impossible to handle generally, so rather than having odd and hard-to-explain exceptions, we ignore them entirely.
Here are the rules for atom-atom matching: | This | Other | Match | Reason | CCO | CCO | Yes | | CCO | CC[O-] | Yes | | CC[O-] | CCO | No | Charge | CC[O-] | CC[O-] | Yes | | CC[OH] | CC[O-] | Yes | | CC[OH] | CCOC | Yes | | CCO | CCOC | Yes | | CCC | CCC | Yes | | CCC | CC[14C] | Yes | | CC[14C] | CCC | No | Isotope | CC[14C] | CC[14C] | Yes | | C | OCO | Yes | | [CH] | OCO | Yes | | [CH2] | OCO | Yes | | [CH3] | OCO | No | Radical | C | O[CH2]O | Yes | | [CH2] | O[CH2]O | Yes |
Reimplemented in RDKit::QueryAtom.
bool RDKit::Atom::needsUpdatePropertyCache | ( | ) | const |
Set the atom map Number of the atom.
Definition at line 391 of file Atom.h.
References PRECONDITION.
|
inline |
|
inline |
sets our index within the ROMol
Notes:
< this->getOwningMol()->getNumAtoms()
void RDKit::Atom::setMonomerInfo | ( | AtomMonomerInfo * | info | ) |
takes ownership of the pointer
sets our owning molecule
Definition at line 413 of file Atom.h.
References setOwningMol().
Referenced by setOwningMol().
sets our owning molecule
Referenced by RDKit::SLNParse::closeRingBond().
|
virtual |
NOT CALLABLE.
Reimplemented in RDKit::QueryAtom.
calculates any of our lazy properties
Notes:
properties
are implicit and explicit valence
|
friend |
|
protected |
|
protected |