![]() |
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, SP3D, SP3D2, OTHER } |
| store hybridization More... | |
| enum | ChiralType { CHI_UNSPECIFIED = 0, CHI_TETRAHEDRAL_CW, CHI_TETRAHEDRAL_CCW, CHI_OTHER } |
| store type of chirality More... | |
| typedef boost::shared_ptr< Atom > | ATOM_SPTR |
| typedef boost::shared_ptr< const Atom > | C_ATOM_SPTR |
| 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 More... | |
| Atom (const std::string &what) | |
| construct an Atom with a particular symbol (looked up in the More... | |
| Atom (const Atom &other) | |
| virtual | ~Atom () |
| virtual Atom * | copy () const |
| makes a copy of this Atom and returns a pointer to it. More... | |
| int | getAtomicNum () const |
| returns our atomic number More... | |
| void | setAtomicNum (int newNum) |
| sets our atomic number More... | |
| std::string | getSymbol () const |
| returns our symbol (determined by our atomic number) More... | |
| ROMol & | getOwningMol () const |
| returns a reference to the ROMol that owns this Atom More... | |
| unsigned int | getIdx () const |
| returns our index within the ROMol More... | |
| void | setIdx (unsigned int index) |
| sets our index within the ROMol More... | |
| template<class U > | |
| void | setIdx (const U index) |
| overload More... | |
| 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 More... | |
| unsigned int | getTotalValence () const |
| returns the total valence (implicit and explicit) for an atom More... | |
| unsigned int | getNumImplicitHs () const |
| returns the number of implicit Hs this Atom is bound to More... | |
| int | getExplicitValence () const |
| returns the explicit valence (including Hs) of this atom More... | |
| int | getImplicitValence () const |
| returns the implicit valence for this Atom More... | |
| unsigned int | getNumRadicalElectrons () const |
| returns the number of radical electrons for this Atom More... | |
| void | setNumRadicalElectrons (unsigned int num) |
| int | getFormalCharge () const |
| returns the formal charge of this atom More... | |
| void | setFormalCharge (int what) |
| set's the formal charge of this atom More... | |
| void | setNoImplicit (bool what) |
sets our noImplicit flag, indicating whether or not we are allowed to have implicit Hs More... | |
| bool | getNoImplicit () const |
returns the noImplicit flag More... | |
| void | setNumExplicitHs (unsigned int what) |
| sets our number of explict Hs More... | |
| unsigned int | getNumExplicitHs () const |
| returns our number of explict Hs More... | |
| void | setIsAromatic (bool what) |
sets our isAromatic flag, indicating whether or not we are aromatic More... | |
| bool | getIsAromatic () const |
returns our isAromatic flag More... | |
| double | getMass () const |
| returns our mass More... | |
| void | setIsotope (unsigned int what) |
| sets our isotope number More... | |
| unsigned int | getIsotope () const |
| returns our isotope number More... | |
| void | setChiralTag (ChiralType what) |
sets our chiralTag More... | |
| void | invertChirality () |
inverts our chiralTag More... | |
| ChiralType | getChiralTag () const |
returns our chiralTag More... | |
| void | setHybridization (HybridizationType what) |
| sets our hybridization More... | |
| HybridizationType | getHybridization () const |
| returns our hybridization More... | |
| virtual bool | hasQuery () const |
| virtual void | setQuery (QUERYATOM_QUERY *what) |
| NOT CALLABLE. More... | |
| virtual QUERYATOM_QUERY * | getQuery () const |
| NOT CALLABLE. More... | |
| virtual void | expandQuery (QUERYATOM_QUERY *what, Queries::CompositeQueryType how=Queries::COMPOSITE_AND, bool maintainOrder=true) |
| NOT CALLABLE. More... | |
| virtual bool | Match (Atom const *what) const |
| returns whether or not we match the argument More... | |
| virtual bool | Match (const ATOM_SPTR &what) const |
| STR_VECT | getPropList () const |
returns a list with the names of our properties More... | |
| template<typename T > | |
| void | setProp (const char *key, T val, bool computed=false) const |
sets a property value More... | |
| template<typename T > | |
| void | setProp (const std::string &key, T val, bool computed=false) const |
| template<typename T > | |
| void | getProp (const char *key, T &res) const |
| allows retrieval of a particular property value More... | |
| template<typename T > | |
| void | getProp (const std::string &key, T &res) const |
| template<typename T > | |
| T | getProp (const char *key) const |
| template<typename T > | |
| T | getProp (const std::string &key) const |
| template<typename T > | |
| bool | getPropIfPresent (const char *key, T &res) const |
| template<typename T > | |
| bool | getPropIfPresent (const std::string &key, T &res) const |
| bool | hasProp (const char *key) const |
returns whether or not we have a property with name key More... | |
| bool | hasProp (const std::string &key) const |
| void | clearProp (const char *key) const |
clears the value of a property More... | |
| void | clearProp (const std::string &key) const |
| void | clearComputedProps () const |
clears all of our computed properties More... | |
| int | getPerturbationOrder (INT_LIST probe) const |
| returns the perturbation order for a list of integers More... | |
| void | updatePropertyCache (bool strict=true) |
calculates any of our lazy properties More... | |
| bool | needsUpdatePropertyCache () const |
| int | calcExplicitValence (bool strict=true) |
| calculates and returns our explicit valence More... | |
| int | calcImplicitValence (bool strict=true) |
| calculates and returns our implicit valence More... | |
| AtomMonomerInfo * | getMonomerInfo () |
| const AtomMonomerInfo * | getMonomerInfo () const |
| void | setMonomerInfo (AtomMonomerInfo *info) |
| takes ownership of the pointer More... | |
Protected Member Functions | |
| void | setOwningMol (ROMol *other) |
| sets our owning molecule More... | |
| void | setOwningMol (ROMol &other) |
| sets our owning molecule More... | |
| void | initAtom () |
Protected Attributes | |
| bool | df_isAromatic |
| bool | df_noImplicit |
| boost::uint8_t | d_numExplicitHs |
| boost::int8_t | d_formalCharge |
| boost::uint8_t | d_atomicNum |
| boost::int8_t | d_implicitValence |
| boost::int8_t | d_explicitValence |
| boost::uint8_t | d_numRadicalElectrons |
| boost::uint8_t | d_chiralTag |
| boost::uint8_t | d_hybrid |
| atomindex_t | d_index |
| boost::uint16_t | d_isotope |
| ROMol * | dp_mol |
| Dict * | dp_props |
| AtomMonomerInfo * | dp_monomerInfo |
Friends | |
| class | MolPickler |
| the pickler needs access to our privates More... | |
| class | ROMol |
| class | RWMol |
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.Chirality:
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.
| typedef boost::shared_ptr<Atom> RDKit::Atom::ATOM_SPTR |
| typedef boost::shared_ptr<const Atom> RDKit::Atom::C_ATOM_SPTR |
| typedef Queries::Query<int, Atom const *, true> RDKit::Atom::QUERYATOM_QUERY |
| RDKit::Atom::Atom | ( | ) |
|
explicit |
construct an Atom with a particular atomic number
|
explicit |
construct an Atom with a particular symbol (looked up in the
| RDKit::Atom::Atom | ( | const Atom & | other | ) |
|
virtual |
| int RDKit::Atom::calcExplicitValence | ( | bool | strict = true | ) |
calculates and returns our explicit valence
Notes:
Referenced by clearComputedProps().
| int RDKit::Atom::calcImplicitValence | ( | bool | strict = true | ) |
calculates and returns our implicit valence
Notes:
Referenced by clearComputedProps().
|
inline |
clears all of our computed properties
Definition at line 432 of file Atom.h.
References calcExplicitValence(), calcImplicitValence(), RDKit::Dict::clearVal(), detail::computedPropName, dp_props, getPerturbationOrder(), getPropIfPresent(), needsUpdatePropertyCache(), RDKit::Dict::setVal(), and updatePropertyCache().
|
inline |
clears the value of a property
Notes:
property with name key exists, a KeyErrorException will be thrown.property is marked as computed, it will also be removed from our list of computedProperties
|
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 419 of file Atom.h.
References RDKit::Dict::clearVal(), detail::computedPropName, dp_props, getPropIfPresent(), and RDKit::Dict::setVal().
|
virtual |
makes a copy of this Atom and returns a pointer to it.
Note: the caller is responsible for deleteing the result
Reimplemented in RDKit::QueryAtom.
|
virtual |
|
inline |
returns our atomic number
Definition at line 115 of file Atom.h.
References d_atomicNum.
Referenced by RDKit::Drawing::DrawMol(), RDDepict::getAtomDepictRank(), RDKit::Drawing::detail::getAtomSymbolAndOrientation(), and RDKit::queryAtomNum().
|
inline |
| unsigned int RDKit::Atom::getDegree | ( | ) | const |
returns the explicit degree of the Atom (number of bonded neighbors in the graph)
Notes:
Referenced by RDDepict::getAtomDepictRank(), RDKit::Drawing::detail::getAtomSymbolAndOrientation(), RDKit::queryAtomExplicitDegree(), RDKit::queryAtomUnsaturated(), and setIdx().
| int RDKit::Atom::getExplicitValence | ( | ) | const |
returns the explicit valence (including Hs) of this atom
Referenced by RDKit::queryAtomExplicitValence(), RDKit::queryAtomTotalValence(), RDKit::queryAtomUnsaturated(), and setIdx().
|
inline |
returns the formal charge of this atom
Definition at line 199 of file Atom.h.
References d_formalCharge.
Referenced by RDKit::Drawing::detail::getAtomSymbolAndOrientation(), and RDKit::queryAtomFormalCharge().
|
inline |
returns our hybridization
Definition at line 239 of file Atom.h.
References d_hybrid.
Referenced by RDKit::queryAtomHybridization().
|
inline |
returns our index within the ROMol
Definition at line 126 of file Atom.h.
References d_index.
Referenced by RDKit::SLNParse::addAtomToMol(), RDKit::FMCS::RingMatchTableSet::computeRingMatchTable(), 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(), RDKit::queryAtomTotalValence(), and setIdx().
|
inline |
returns our isAromatic flag
Definition at line 217 of file Atom.h.
References df_isAromatic, getMass(), and setIsotope().
Referenced by RDKit::queryAtomAliphatic(), and RDKit::queryAtomAromatic().
|
inline |
returns our isotope number
Definition at line 225 of file Atom.h.
References d_isotope.
Referenced by RDKit::Drawing::detail::getAtomSymbolAndOrientation(), and RDKit::queryAtomIsotope().
| double RDKit::Atom::getMass | ( | ) | const |
returns our mass
Referenced by getIsAromatic(), and RDKit::queryAtomMass().
|
inline |
Definition at line 491 of file Atom.h.
References dp_monomerInfo.
|
inline |
Definition at line 492 of file Atom.h.
References dp_monomerInfo.
|
inline |
|
inline |
returns our number of explict Hs
Definition at line 212 of file Atom.h.
References d_numExplicitHs.
Referenced by RDKit::queryAtomExplicitValence().
| unsigned int RDKit::Atom::getNumImplicitHs | ( | ) | const |
|
inline |
returns the number of radical electrons for this Atom
Notes:
Definition at line 193 of file Atom.h.
References d_numRadicalElectrons.
Referenced by RDKit::Drawing::detail::getAtomSymbolAndOrientation().
|
inline |
returns a reference to the ROMol that owns this Atom
Definition at line 123 of file Atom.h.
References dp_mol.
Referenced by RDKit::queryAtomHasRingBond(), RDKit::queryAtomIsInRingOfSize(), RDKit::queryAtomMinRingSize(), RDKit::queryAtomRingBondCount(), RDKit::queryAtomRingMembership(), RDKit::queryIsAtomInNRings(), and RDKit::queryIsAtomInRing().
| int RDKit::Atom::getPerturbationOrder | ( | INT_LIST | probe | ) | const |
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:
Referenced by clearComputedProps().
|
inline |
allows retrieval of a particular property value
| key | the name under which the property should be stored. If a property is already stored under this name, it will be replaced. |
| res | a reference to the storage location for the value. |
Notes:
property with name key exists, a KeyErrorException will be thrown.boost::lexical_cast machinery is used to attempt type conversions. If this fails, a boost::bad_lexical_cast exception will be thrown. Definition at line 363 of file Atom.h.
References dp_props, and RDKit::Dict::getVal().
Referenced by RDKit::Drawing::detail::getAtomSymbolAndOrientation().
|
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 368 of file Atom.h.
References dp_props, and RDKit::Dict::getVal().
|
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 374 of file Atom.h.
References dp_props, and RDKit::Dict::getVal().
|
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 379 of file Atom.h.
References dp_props, and RDKit::Dict::getVal().
|
inline |
returns whether or not we have a property with name key and assigns the value if we do
Definition at line 386 of file Atom.h.
References dp_props, and RDKit::Dict::getValIfPresent().
Referenced by clearComputedProps(), clearProp(), and setProp().
|
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 391 of file Atom.h.
References dp_props, and RDKit::Dict::getValIfPresent().
|
inline |
returns a list with the names of our properties
Definition at line 313 of file Atom.h.
References dp_props, and RDKit::Dict::keys().
|
virtual |
| std::string RDKit::Atom::getSymbol | ( | ) | const |
returns our symbol (determined by our atomic number)
Referenced by RDKit::Drawing::detail::getAtomSymbolAndOrientation(), and setAtomicNum().
| unsigned int RDKit::Atom::getTotalDegree | ( | ) | const |
returns the total degree of the Atom (number of bonded neighbors + number of Hs)
Notes:
Referenced by RDKit::queryAtomHeavyAtomDegree(), RDKit::queryAtomTotalDegree(), and setIdx().
| unsigned int RDKit::Atom::getTotalNumHs | ( | bool | includeNeighbors = false | ) | const |
returns the total number of Hs (implicit and explicit) that this Atom is bound to
Notes:
Referenced by RDKit::Drawing::detail::getAtomSymbolAndOrientation(), RDKit::queryAtomHasImplicitH(), RDKit::queryAtomHCount(), RDKit::queryAtomHeavyAtomDegree(), RDKit::queryAtomImplicitHCount(), and setIdx().
| unsigned int RDKit::Atom::getTotalValence | ( | ) | const |
returns the total valence (implicit and explicit) for an atom
Notes:
Referenced by setIdx().
|
inline |
returns whether or not we have a property with name key
Definition at line 396 of file Atom.h.
References dp_props, and RDKit::Dict::hasVal().
Referenced by RDKit::Drawing::detail::getAtomSymbolAndOrientation().
|
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 401 of file Atom.h.
References dp_props, and RDKit::Dict::hasVal().
|
inlinevirtual |
Reimplemented in RDKit::QueryAtom.
Definition at line 256 of file Atom.h.
References Queries::COMPOSITE_AND, expandQuery(), getQuery(), Match(), and setQuery().
|
protected |
| void RDKit::Atom::invertChirality | ( | ) |
inverts our chiralTag
Referenced by setChiralTag().
|
virtual |
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.
Referenced by hasQuery(), and Match().
|
inlinevirtual |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Reimplemented in RDKit::QueryAtom.
Definition at line 303 of file Atom.h.
References Match().
| bool RDKit::Atom::needsUpdatePropertyCache | ( | ) | const |
Referenced by clearComputedProps().
|
inline |
sets our atomic number
Definition at line 117 of file Atom.h.
References d_atomicNum, and getSymbol().
|
inline |
sets our chiralTag
Definition at line 228 of file Atom.h.
References d_chiralTag, and invertChirality().
|
inline |
set's the formal charge of this atom
Definition at line 201 of file Atom.h.
References d_formalCharge.
|
inline |
|
inline |
|
inline |
overload
Definition at line 136 of file Atom.h.
References getDegree(), getExplicitValence(), getImplicitValence(), getNumImplicitHs(), getTotalDegree(), getTotalNumHs(), getTotalValence(), and setIdx().
|
inline |
sets our isAromatic flag, indicating whether or not we are aromatic
Definition at line 215 of file Atom.h.
References df_isAromatic.
| void RDKit::Atom::setIsotope | ( | unsigned int | what | ) |
sets our isotope number
Referenced by getIsAromatic().
|
inline |
takes ownership of the pointer
Definition at line 494 of file Atom.h.
References dp_monomerInfo, and setOwningMol().
|
inline |
sets our noImplicit flag, indicating whether or not we are allowed to have implicit Hs
Definition at line 205 of file Atom.h.
References df_noImplicit.
|
inline |
|
inline |
Definition at line 194 of file Atom.h.
References d_numRadicalElectrons.
|
protected |
sets our owning molecule
Referenced by RDKit::SLNParse::closeRingBond(), and setMonomerInfo().
|
inlineprotected |
sets our owning molecule
Definition at line 500 of file Atom.h.
References df_isAromatic, and setOwningMol().
Referenced by setOwningMol().
|
inline |
|
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 333 of file Atom.h.
References detail::computedPropName, dp_props, getPropIfPresent(), and RDKit::Dict::setVal().
|
virtual |
| void RDKit::Atom::updatePropertyCache | ( | bool | strict = true | ) |
calculates any of our lazy properties
Notes:
properties are implicit and explicit valence Referenced by clearComputedProps().
|
friend |
|
protected |
Definition at line 506 of file Atom.h.
Referenced by getAtomicNum(), and setAtomicNum().
|
protected |
Definition at line 512 of file Atom.h.
Referenced by getChiralTag(), and setChiralTag().
|
protected |
Definition at line 505 of file Atom.h.
Referenced by getFormalCharge(), and setFormalCharge().
|
protected |
Definition at line 513 of file Atom.h.
Referenced by getHybridization(), and setHybridization().
|
protected |
|
protected |
Definition at line 516 of file Atom.h.
Referenced by getIsotope().
|
protected |
Definition at line 504 of file Atom.h.
Referenced by getNumExplicitHs(), and setNumExplicitHs().
|
protected |
Definition at line 511 of file Atom.h.
Referenced by getNumRadicalElectrons(), and setNumRadicalElectrons().
|
protected |
Definition at line 500 of file Atom.h.
Referenced by getIsAromatic(), setIsAromatic(), and setOwningMol().
|
protected |
Definition at line 503 of file Atom.h.
Referenced by getNoImplicit(), and setNoImplicit().
|
protected |
Definition at line 518 of file Atom.h.
Referenced by getOwningMol().
|
protected |
Definition at line 520 of file Atom.h.
Referenced by getMonomerInfo(), and setMonomerInfo().
|
protected |
Definition at line 519 of file Atom.h.
Referenced by clearComputedProps(), clearProp(), getProp(), getPropIfPresent(), getPropList(), hasProp(), and setProp().