RDKit::Atom Class Reference

The class for representing atoms. More...

#include <Atom.h>

Inheritance diagram for RDKit::Atom:

RDKit::QueryAtom

List of all members.

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< AtomATOM_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
 Atom (std::string what)
 construct an Atom with a particular symbol (looked up in the PeriodicTable)
 Atom (const Atom &other)
virtual ~Atom ()
virtual Atomcopy () const
 makes a copy of this Atom and returns a pointer to it.
const 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)
ROMolgetOwningMol () const
 returns a reference to the ROMol that owns this Atom
const unsigned int getIdx () const
 returns our index within the ROMol
void setIdx (unsigned int index)
 sets our index within the ROMol
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 getNumImplicitHs () const
 returns the number of implicit Hs this Atom is bound to
int getExplicitValence () const
 returns the number of explicit Hs this Atom is bound to
int getImplicitValence () const
 returns the implicit valence for this Atom
unsigned int getNumRadicalElectrons () const
 returns the number of radical electrons for this Atom
void setNumRadicalElectrons (unsigned int num)
const 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 explict Hs
unsigned int getNumExplicitHs () const
 returns our number of explict Hs
void setIsAromatic (bool what)
 sets our isAromatic flag, indicating whether or not we are aromatic
bool getIsAromatic () const
 returns our isAromatic flag
void setMass (double what)
 sets our mass (for isotopes)
double getMass () const
 returns our mass
void setDativeFlag (int what)
 sets our dativeFlag
int getDativeFlag () const
 returns our dativeFlag
bool hasDativeFlag (int what) const
void clearDativeFlag ()
 clears our dativeFlag
void setChiralTag (ChiralType what)
 sets our chiralTag
void invertChirality ()
 inverts our chiralTag
ChiralType getChiralTag () const
 returns our chiralTag
void setHybridization (HybridizationType what)
 sets our hybridization
HybridizationType getHybridization () const
 returns our hybridization
virtual bool hasQuery () const
virtual void setQuery (QUERYATOM_QUERY *what)
 NOT CALLABLE.
virtual QUERYATOM_QUERYgetQuery () 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
virtual bool Match (const ATOM_SPTR what) const
STR_VECT getPropList () const
 returns a list with the names of our properties
template<typename T>
void setProp (const char *key, T val, bool computed=false) const
 sets a property value
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
template<typename T>
void getProp (const std::string key, T &res) const
bool hasProp (const char *key) const
 returns whether or not we have a property with name key
bool hasProp (const std::string key) const
void clearProp (const char *key) const
 clears the value of a property
void clearProp (const std::string key) const
void clearComputedProps () const
 clears all of our computed properties
int getPerturbationOrder (INT_LIST probe) const
 returns the perturbation order for a list of integers
void updatePropertyCache (bool strict=true)
 calculates any of our lazy properties
int calcExplicitValence (bool strict=true)
 calculates and returns our explicit valence
int calcImplicitValence (bool strict=true)
 calculates and returns our implicit valence

Protected Member Functions

void setOwningMol (ROMol *other)
 sets our owning molecule
void setOwningMol (ROMol &other)
 sets our owning molecule
void initAtom ()

Protected Attributes

bool df_isAromatic
bool df_noImplicit
int d_dativeFlag
unsigned int d_numExplicitHs
int d_formalCharge
unsigned int d_atomicNum
unsigned int d_index
int d_implicitValence
int d_explicitValence
unsigned int d_numRadicalElectrons
ChiralType d_chiralTag
HybridizationType d_hybrid
double d_mass
ROMoldp_mol
Dictdp_props

Friends

class MolPickler
 the pickler needs access to our privates
class ROMol
class RWMol


Detailed Description

The class for representing atoms.

Notes:

Chirality:

The chirality of an Atom is determined by two things:

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 represenation of chirality

Definition at line 56 of file Atom.h.


Member Typedef Documentation

typedef boost::shared_ptr<Atom> RDKit::Atom::ATOM_SPTR

Definition at line 62 of file Atom.h.

typedef boost::shared_ptr<const Atom> RDKit::Atom::C_ATOM_SPTR

Definition at line 63 of file Atom.h.

Reimplemented in RDKit::QueryAtom.

Definition at line 65 of file Atom.h.


Member Enumeration Documentation

store hybridization

Enumerator:
UNSPECIFIED  hybridization that hasn't been specified
S 
SP 
SP2 
SP3 
SP3D 
SP3D2 
OTHER  unrecognized hybridization

Definition at line 68 of file Atom.h.

store type of chirality

Enumerator:
CHI_UNSPECIFIED  chirality that hasn't been specified
CHI_TETRAHEDRAL_CW  tetrahedral: clockwise rotation (SMILES @)
CHI_TETRAHEDRAL_CCW  tetrahedral: counter-clockwise rotation (SMILES @)
CHI_OTHER  some unrecognized type of chirality

Definition at line 80 of file Atom.h.


Constructor & Destructor Documentation

RDKit::Atom::Atom (  ) 

RDKit::Atom::Atom ( unsigned int  num  )  [explicit]

construct an Atom with a particular atomic number

RDKit::Atom::Atom ( std::string  what  )  [explicit]

construct an Atom with a particular symbol (looked up in the PeriodicTable)

RDKit::Atom::Atom ( const Atom other  ) 

virtual RDKit::Atom::~Atom (  )  [virtual]


Member Function Documentation

virtual Atom* RDKit::Atom::copy (  )  const [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.

const int RDKit::Atom::getAtomicNum (  )  const [inline]

returns our atomic number

Definition at line 102 of file Atom.h.

References d_atomicNum.

Referenced by RDKit::queryAtomNum().

void RDKit::Atom::setAtomicNum ( int  newNum  )  [inline]

sets our atomic number

Definition at line 104 of file Atom.h.

References d_atomicNum.

std::string RDKit::Atom::getSymbol (  )  const

returns our symbol (determined by our atomic number)

ROMol& RDKit::Atom::getOwningMol (  )  const [inline]

const unsigned int RDKit::Atom::getIdx (  )  const [inline]

void RDKit::Atom::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()->getNumAtoms()

Definition at line 120 of file Atom.h.

References d_index.

unsigned int RDKit::Atom::getDegree (  )  const

returns the explicit degree of the Atom (number of bonded neighbors in the graph)

Notes:

  • requires an owning molecule

Referenced by RDKit::queryAtomExplicitDegree(), RDKit::queryAtomHeavyAtomDegree(), RDKit::queryAtomTotalDegree(), and RDKit::queryAtomUnsaturated().

unsigned int RDKit::Atom::getTotalDegree (  )  const

returns the total degree of the Atom (number of bonded neighbors + number of Hs)

Notes:

  • requires an owning molecule

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:

  • requires an owning molecule

Referenced by RDKit::queryAtomHCount().

unsigned int RDKit::Atom::getNumImplicitHs (  )  const

returns the number of implicit Hs this Atom is bound to

Notes:

  • requires an owning molecule

int RDKit::Atom::getExplicitValence (  )  const

returns the number of explicit Hs this Atom is bound to

Referenced by RDKit::queryAtomExplicitValence(), RDKit::queryAtomTotalValence(), and RDKit::queryAtomUnsaturated().

int RDKit::Atom::getImplicitValence (  )  const

returns the implicit valence for this Atom

Notes:

  • requires an owning molecule

Referenced by RDKit::queryAtomImplicitValence(), RDKit::queryAtomTotalDegree(), and RDKit::queryAtomTotalValence().

unsigned int RDKit::Atom::getNumRadicalElectrons (  )  const [inline]

returns the number of radical electrons for this Atom

Notes:

  • requires an owning molecule

Definition at line 168 of file Atom.h.

References d_numRadicalElectrons.

void RDKit::Atom::setNumRadicalElectrons ( unsigned int  num  )  [inline]

Definition at line 169 of file Atom.h.

References d_numRadicalElectrons.

const int RDKit::Atom::getFormalCharge (  )  const [inline]

returns the formal charge of this atom

Definition at line 173 of file Atom.h.

References d_formalCharge.

Referenced by RDKit::queryAtomFormalCharge().

void RDKit::Atom::setFormalCharge ( int  what  )  [inline]

set's the formal charge of this atom

Definition at line 175 of file Atom.h.

References d_formalCharge.

void RDKit::Atom::setNoImplicit ( bool  what  )  [inline]

sets our noImplicit flag, indicating whether or not we are allowed to have implicit Hs

Definition at line 179 of file Atom.h.

References df_noImplicit.

bool RDKit::Atom::getNoImplicit (  )  const [inline]

returns the noImplicit flag

Definition at line 181 of file Atom.h.

References df_noImplicit.

void RDKit::Atom::setNumExplicitHs ( unsigned int  what  )  [inline]

sets our number of explict Hs

Definition at line 184 of file Atom.h.

References d_numExplicitHs.

unsigned int RDKit::Atom::getNumExplicitHs (  )  const [inline]

returns our number of explict Hs

Definition at line 186 of file Atom.h.

References d_numExplicitHs.

Referenced by RDKit::queryAtomExplicitValence().

void RDKit::Atom::setIsAromatic ( bool  what  )  [inline]

sets our isAromatic flag, indicating whether or not we are aromatic

Definition at line 189 of file Atom.h.

References df_isAromatic.

bool RDKit::Atom::getIsAromatic (  )  const [inline]

returns our isAromatic flag

Definition at line 191 of file Atom.h.

References df_isAromatic.

Referenced by RDKit::queryAtomAliphatic(), and RDKit::queryAtomAromatic().

void RDKit::Atom::setMass ( double  what  )  [inline]

sets our mass (for isotopes)

Definition at line 194 of file Atom.h.

References d_mass.

double RDKit::Atom::getMass (  )  const [inline]

returns our mass

Definition at line 196 of file Atom.h.

References d_mass.

Referenced by RDKit::queryAtomMass().

void RDKit::Atom::setDativeFlag ( int  what  )  [inline]

sets our dativeFlag

Definition at line 201 of file Atom.h.

References d_dativeFlag.

int RDKit::Atom::getDativeFlag (  )  const [inline]

returns our dativeFlag

Definition at line 206 of file Atom.h.

References d_dativeFlag.

bool RDKit::Atom::hasDativeFlag ( int  what  )  const [inline]

Definition at line 209 of file Atom.h.

References d_dativeFlag.

void RDKit::Atom::clearDativeFlag (  )  [inline]

clears our dativeFlag

Definition at line 214 of file Atom.h.

References d_dativeFlag.

void RDKit::Atom::setChiralTag ( ChiralType  what  )  [inline]

sets our chiralTag

Definition at line 217 of file Atom.h.

References d_chiralTag.

void RDKit::Atom::invertChirality (  ) 

inverts our chiralTag

ChiralType RDKit::Atom::getChiralTag (  )  const [inline]

returns our chiralTag

Definition at line 221 of file Atom.h.

References d_chiralTag.

void RDKit::Atom::setHybridization ( HybridizationType  what  )  [inline]

sets our hybridization

Definition at line 224 of file Atom.h.

References d_hybrid.

HybridizationType RDKit::Atom::getHybridization (  )  const [inline]

returns our hybridization

Definition at line 226 of file Atom.h.

References d_hybrid.

Referenced by RDKit::queryAtomHybridization().

virtual bool RDKit::Atom::hasQuery (  )  const [inline, virtual]

Reimplemented in RDKit::QueryAtom.

Definition at line 241 of file Atom.h.

virtual void RDKit::Atom::setQuery ( QUERYATOM_QUERY what  )  [virtual]

NOT CALLABLE.

Reimplemented in RDKit::QueryAtom.

virtual QUERYATOM_QUERY* RDKit::Atom::getQuery (  )  const [virtual]

NOT CALLABLE.

Reimplemented in RDKit::QueryAtom.

virtual void RDKit::Atom::expandQuery ( QUERYATOM_QUERY what,
Queries::CompositeQueryType  how = Queries::COMPOSITE_AND,
bool  maintainOrder = true 
) [virtual]

NOT CALLABLE.

Reimplemented in RDKit::QueryAtom.

virtual bool RDKit::Atom::Match ( Atom const *  what  )  const [virtual]

returns whether or not we match the argument

Notes:

  • for Atom objects, "match" means that atomic numbers are the same.

Reimplemented in RDKit::QueryAtom.

virtual bool RDKit::Atom::Match ( const ATOM_SPTR  what  )  const [virtual]

Reimplemented in RDKit::QueryAtom.

STR_VECT RDKit::Atom::getPropList (  )  const [inline]

returns a list with the names of our properties

Definition at line 269 of file Atom.h.

References dp_props, and RDKit::Dict::keys().

template<typename T>
void RDKit::Atom::setProp ( const char *  key,
val,
bool  computed = false 
) const [inline]

sets a property value

Parameters:
key the name under which the property should be stored. If a property is already stored under this name, it will be replaced.
val the value to be stored
computed (optional) allows the property to be flagged computed.

Definition at line 283 of file Atom.h.

template<typename T>
void RDKit::Atom::setProp ( const std::string  key,
val,
bool  computed = false 
) const [inline]

Definition at line 292 of file Atom.h.

References dp_props, getProp(), hasProp(), and RDKit::Dict::setVal().

template<typename T>
void RDKit::Atom::getProp ( const char *  key,
T &  res 
) const [inline]

allows retrieval of a particular property value

Parameters:
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:
  • if no property with name key exists, a KeyErrorException will be thrown.
  • the 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 320 of file Atom.h.

References dp_props, and RDKit::Dict::getVal().

Referenced by RDKit::SLNParse::bookmarkAtomID(), clearComputedProps(), clearProp(), and setProp().

template<typename T>
void RDKit::Atom::getProp ( const std::string  key,
T &  res 
) const [inline]

Definition at line 326 of file Atom.h.

References dp_props, and RDKit::Dict::getVal().

bool RDKit::Atom::hasProp ( const char *  key  )  const [inline]

returns whether or not we have a property with name key

Definition at line 332 of file Atom.h.

References dp_props, and RDKit::Dict::hasVal().

Referenced by RDKit::SLNParse::bookmarkAtomID(), clearComputedProps(), clearProp(), and setProp().

bool RDKit::Atom::hasProp ( const std::string  key  )  const [inline]

Definition at line 337 of file Atom.h.

References dp_props, and RDKit::Dict::hasVal().

void RDKit::Atom::clearProp ( const char *  key  )  const [inline]

clears the value of a property

Notes:

  • if no property with name key exists, a KeyErrorException will be thrown.
  • if the property is marked as computed, it will also be removed from our list of computedProperties

Definition at line 351 of file Atom.h.

void RDKit::Atom::clearProp ( const std::string  key  )  const [inline]

Definition at line 356 of file Atom.h.

References RDKit::Dict::clearVal(), dp_props, getProp(), hasProp(), and RDKit::Dict::setVal().

void RDKit::Atom::clearComputedProps (  )  const [inline]

clears all of our computed properties

Definition at line 370 of file Atom.h.

References RDKit::Dict::clearVal(), dp_props, getProp(), hasProp(), and RDKit::Dict::setVal().

int RDKit::Atom::getPerturbationOrder ( INT_LIST  probe  )  const

returns the perturbation order for a list of integers

This value is associated with chirality.

Parameters:
probe a list of bond indices. This must be the same length as our number of incoming bonds (our degree).
Returns:
the number of swaps required to convert the ordering of the probe list to match the order of our incoming bonds: e.g. if our incoming bond order is: [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:

  • requires an owning molecule

void RDKit::Atom::updatePropertyCache ( bool  strict = true  ) 

calculates any of our lazy properties

Notes:

  • requires an owning molecule
  • the current lazy properties are implicit and explicit valence

int RDKit::Atom::calcExplicitValence ( bool  strict = true  ) 

calculates and returns our explicit valence

Notes:

  • requires an owning molecule

int RDKit::Atom::calcImplicitValence ( bool  strict = true  ) 

calculates and returns our implicit valence

Notes:

  • requires an owning molecule

void RDKit::Atom::setOwningMol ( ROMol other  )  [protected]

sets our owning molecule

Referenced by setOwningMol().

void RDKit::Atom::setOwningMol ( ROMol other  )  [inline, protected]

sets our owning molecule

Definition at line 434 of file Atom.h.

References setOwningMol().

void RDKit::Atom::initAtom (  )  [protected]


Friends And Related Function Documentation

friend class MolPickler [friend]

the pickler needs access to our privates

Definition at line 57 of file Atom.h.

friend class ROMol [friend]

Definition at line 58 of file Atom.h.

friend class RWMol [friend]

Definition at line 59 of file Atom.h.


Member Data Documentation

bool RDKit::Atom::df_isAromatic [protected]

Definition at line 434 of file Atom.h.

Referenced by getIsAromatic(), and setIsAromatic().

bool RDKit::Atom::df_noImplicit [protected]

Definition at line 437 of file Atom.h.

Referenced by getNoImplicit(), and setNoImplicit().

int RDKit::Atom::d_dativeFlag [protected]

Definition at line 438 of file Atom.h.

Referenced by clearDativeFlag(), getDativeFlag(), hasDativeFlag(), and setDativeFlag().

unsigned int RDKit::Atom::d_numExplicitHs [protected]

Definition at line 439 of file Atom.h.

Referenced by getNumExplicitHs(), and setNumExplicitHs().

int RDKit::Atom::d_formalCharge [protected]

Definition at line 440 of file Atom.h.

Referenced by getFormalCharge(), and setFormalCharge().

unsigned int RDKit::Atom::d_atomicNum [protected]

Definition at line 441 of file Atom.h.

Referenced by getAtomicNum(), and setAtomicNum().

unsigned int RDKit::Atom::d_index [protected]

Definition at line 442 of file Atom.h.

Referenced by getIdx(), and setIdx().

Definition at line 446 of file Atom.h.

Definition at line 446 of file Atom.h.

unsigned int RDKit::Atom::d_numRadicalElectrons [protected]

Definition at line 447 of file Atom.h.

Referenced by getNumRadicalElectrons(), and setNumRadicalElectrons().

Definition at line 448 of file Atom.h.

Referenced by getChiralTag(), and setChiralTag().

Definition at line 449 of file Atom.h.

Referenced by getHybridization(), and setHybridization().

double RDKit::Atom::d_mass [protected]

Definition at line 450 of file Atom.h.

Referenced by getMass(), and setMass().

ROMol* RDKit::Atom::dp_mol [protected]

Definition at line 451 of file Atom.h.

Referenced by getOwningMol().

Definition at line 452 of file Atom.h.

Referenced by clearComputedProps(), clearProp(), getProp(), getPropList(), hasProp(), and setProp().


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

Generated on Fri Apr 3 06:03:03 2009 for RDCode by  doxygen 1.5.6