Chemical Data Processing Library C++ API - Version 1.4.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
CDPL::Chem::AtomDictionary Class Reference

A global dictionary for the lookup of data associated with the atom types defined in namespace Chem::AtomType. More...

#include <AtomDictionary.hpp>

Classes

class  Entry
 A single dictionary entry describing the properties of an (atom type, isotope) pair. More...
 

Public Types

typedef std::shared_ptr< AtomDictionarySharedPointer
 A reference-counted smart pointer [SHPTR] for dynamically allocated AtomDictionary instances. More...
 
typedef boost::transform_iterator< std::function< const Entry &(const EntryLookupTable::value_type &)>, EntryLookupTable::const_iterator > ConstEntryIterator
 A constant iterator over the entries of the dictionary. More...
 

Public Member Functions

void addEntry (const Entry &entry)
 Adds the given entry to the dictionary. Any pre-existing entry for the same (type, isotope) is replaced. More...
 
bool containsEntry (unsigned int type, std::size_t isotope) const
 Tells whether the dictionary contains an entry for the given (type, isotope) pair. More...
 
void removeEntry (unsigned int type, std::size_t isotope)
 Removes the entry for the given (type, isotope) pair, if present. More...
 
const EntrygetEntry (unsigned int type, std::size_t isotope) const
 Returns the entry for the given (type, isotope) pair. More...
 
void clear ()
 Removes all entries from the dictionary. More...
 
std::size_t getNumEntries () const
 Returns the number of entries stored in the dictionary. More...
 
ConstEntryIterator getEntriesBegin () const
 Returns a constant iterator pointing to the first entry. More...
 
ConstEntryIterator getEntriesEnd () const
 Returns a constant iterator pointing one past the last entry. More...
 
ConstEntryIterator begin () const
 Returns a constant iterator pointing to the first entry (range-based for support). More...
 
ConstEntryIterator end () const
 Returns a constant iterator pointing one past the last entry (range-based for support). More...
 
void loadDefaults ()
 Loads the default atom dictionary bundled with CDPKit. More...
 

Static Public Member Functions

static void set (const SharedPointer &dict)
 Sets the process-wide default atom dictionary used by the static accessor methods. More...
 
static const SharedPointerget ()
 Returns the process-wide default atom dictionary. More...
 
static const std::string & getSymbol (unsigned int type, std::size_t isotope=0)
 Returns the symbol that is associated with the specified atom type and isotope. More...
 
static const std::string & getName (unsigned int type, std::size_t isotope=0)
 Returns the name of the chemical element that is associated with the specified atom type and isotope. More...
 
static unsigned int getType (const std::string &symbol, bool strict=false)
 Returns the numeric atom type that is associated with the specified atom type symbol. More...
 
static std::size_t getMostAbundantIsotope (unsigned int type)
 Returns the mass number of the most abundant isotope of the chemical element specified by type. More...
 
static std::size_t getIUPACGroup (unsigned int type)
 Returns the IUPAC group of the chemical element specified by type. More...
 
static std::size_t getPeriod (unsigned int type)
 Returns the period number of the chemical element specified by type. More...
 
static std::size_t getNumValenceElectrons (unsigned int type)
 Returns the number of valence electrons of the chemical element specified by type. More...
 
static double getAtomicWeight (unsigned int type, std::size_t isotope=0)
 Returns the standard atomic weight or the relative isotopic mass of an isotope of the chemical element specified by type. More...
 
static double getVdWRadius (unsigned int type)
 Returns the Van der Waals radius of the chemical element specified by type. More...
 
static double getCovalentRadius (unsigned int type, std::size_t order=1)
 Returns the covalent radius of the chemical element specified by type for the given bond order. More...
 
static double getAllredRochowElectronegativity (unsigned int type)
 Returns the Allred-Rochow electronegativity of the chemical element specified by type. More...
 
static const Util::STArraygetValenceStates (unsigned int type)
 Returns an array with the valence states of the chemical element specified by type. More...
 
static bool isChemicalElement (unsigned int type)
 Tells whether the specified atom type represents a chemical element. More...
 
static bool isMainGroupElement (unsigned int type)
 Tells whether the chemical element specified by type is a main group element. More...
 
static bool isTransitionMetal (unsigned int type)
 Tells whether the chemical element specified by type is a transition metal. More...
 
static bool isMetal (unsigned int type)
 Tells whether the chemical element specified by type is a metal. More...
 
static bool isSemiMetal (unsigned int type)
 Tells whether the chemical element specified by type is a semi-metal. More...
 
static bool isNonMetal (unsigned int type)
 Tells whether the chemical element specified by type is a non-metal. More...
 
static bool isHalogen (unsigned int type)
 Tells whether the chemical element specified by type is a halogen. More...
 
static bool isNobleGas (unsigned int type)
 Tells whether the chemical element specified by type is a noble gas. More...
 

Detailed Description

A global dictionary for the lookup of data associated with the atom types defined in namespace Chem::AtomType.

Member Typedef Documentation

◆ SharedPointer

A reference-counted smart pointer [SHPTR] for dynamically allocated AtomDictionary instances.

◆ ConstEntryIterator

typedef boost::transform_iterator<std::function<const Entry&(const EntryLookupTable::value_type&)>, EntryLookupTable::const_iterator> CDPL::Chem::AtomDictionary::ConstEntryIterator

A constant iterator over the entries of the dictionary.

Member Function Documentation

◆ addEntry()

void CDPL::Chem::AtomDictionary::addEntry ( const Entry entry)

Adds the given entry to the dictionary. Any pre-existing entry for the same (type, isotope) is replaced.

Parameters
entryThe entry to add.

◆ containsEntry()

bool CDPL::Chem::AtomDictionary::containsEntry ( unsigned int  type,
std::size_t  isotope 
) const

Tells whether the dictionary contains an entry for the given (type, isotope) pair.

Parameters
typeThe atom type.
isotopeThe isotope mass number.
Returns
true if the entry exists, and false otherwise.

◆ removeEntry()

void CDPL::Chem::AtomDictionary::removeEntry ( unsigned int  type,
std::size_t  isotope 
)

Removes the entry for the given (type, isotope) pair, if present.

Parameters
typeThe atom type.
isotopeThe isotope mass number.

◆ getEntry()

const Entry& CDPL::Chem::AtomDictionary::getEntry ( unsigned int  type,
std::size_t  isotope 
) const

Returns the entry for the given (type, isotope) pair.

Parameters
typeThe atom type.
isotopeThe isotope mass number.
Returns
A const reference to the matching entry, or to an empty entry if no matching entry exists.

◆ clear()

void CDPL::Chem::AtomDictionary::clear ( )

Removes all entries from the dictionary.

◆ getNumEntries()

std::size_t CDPL::Chem::AtomDictionary::getNumEntries ( ) const

Returns the number of entries stored in the dictionary.

Returns
The number of entries.

◆ getEntriesBegin()

ConstEntryIterator CDPL::Chem::AtomDictionary::getEntriesBegin ( ) const

Returns a constant iterator pointing to the first entry.

Returns
A constant iterator pointing to the first entry.

◆ getEntriesEnd()

ConstEntryIterator CDPL::Chem::AtomDictionary::getEntriesEnd ( ) const

Returns a constant iterator pointing one past the last entry.

Returns
A constant iterator pointing one past the last entry.

◆ begin()

ConstEntryIterator CDPL::Chem::AtomDictionary::begin ( ) const

Returns a constant iterator pointing to the first entry (range-based for support).

Returns
A constant iterator pointing to the first entry.

◆ end()

ConstEntryIterator CDPL::Chem::AtomDictionary::end ( ) const

Returns a constant iterator pointing one past the last entry (range-based for support).

Returns
A constant iterator pointing one past the last entry.

◆ loadDefaults()

void CDPL::Chem::AtomDictionary::loadDefaults ( )

Loads the default atom dictionary bundled with CDPKit.

◆ set()

static void CDPL::Chem::AtomDictionary::set ( const SharedPointer dict)
static

Sets the process-wide default atom dictionary used by the static accessor methods.

Parameters
dictThe new default atom dictionary.

◆ get()

static const SharedPointer& CDPL::Chem::AtomDictionary::get ( )
static

Returns the process-wide default atom dictionary.

Returns
The current default atom dictionary.

◆ getSymbol()

static const std::string& CDPL::Chem::AtomDictionary::getSymbol ( unsigned int  type,
std::size_t  isotope = 0 
)
static

Returns the symbol that is associated with the specified atom type and isotope.

The isotope argument has only an effect for hydrogen whose isotopes have different symbols (D for Deuterium and T for Tritium).

Parameters
typeThe atom type.
isotopeThe mass number of the isotope, or 0 if not specified.
Returns
The atom type symbol, or an empty string if the symbol for the specified type and isotope is not available.

◆ getName()

static const std::string& CDPL::Chem::AtomDictionary::getName ( unsigned int  type,
std::size_t  isotope = 0 
)
static

Returns the name of the chemical element that is associated with the specified atom type and isotope.

The isotope argument has only an effect for hydrogen whose isotopes are named differently (Deuterium and Tritium).

Parameters
typeThe atom type specifying the chemical element.
isotopeThe mass number of the element's isotope, or 0 if not specified.
Returns
The name of the element isotope, or an empty string if type does not specify a supported chemical element.

◆ getType()

static unsigned int CDPL::Chem::AtomDictionary::getType ( const std::string &  symbol,
bool  strict = false 
)
static

Returns the numeric atom type that is associated with the specified atom type symbol.

Parameters
symbolThe atom type symbol.
strictIf true, dictionary symbols strictly have to match the argument symbol. Otherwise, the symbols will be converted to upper-case before their comparison.
Returns
The numeric atom type, or AtomType::UNKNOWN if symbol does not specify a supported atom type.

◆ getMostAbundantIsotope()

static std::size_t CDPL::Chem::AtomDictionary::getMostAbundantIsotope ( unsigned int  type)
static

Returns the mass number of the most abundant isotope of the chemical element specified by type.

Parameters
typeThe atom type specifying the chemical element.
Returns
The mass number of the most abundant isotope of the element, or 0 if type does not specify a supported chemical element.

◆ getIUPACGroup()

static std::size_t CDPL::Chem::AtomDictionary::getIUPACGroup ( unsigned int  type)
static

Returns the IUPAC group of the chemical element specified by type.

Parameters
typeThe atom type specifying the chemical element.
Returns
The IUPAC group of the element, or 0 if type does not specify a supported chemical element.

◆ getPeriod()

static std::size_t CDPL::Chem::AtomDictionary::getPeriod ( unsigned int  type)
static

Returns the period number of the chemical element specified by type.

Parameters
typeThe atom type specifying the chemical element.
Returns
The period of the element, or 0 if type does not specify a supported chemical element.

◆ getNumValenceElectrons()

static std::size_t CDPL::Chem::AtomDictionary::getNumValenceElectrons ( unsigned int  type)
static

Returns the number of valence electrons of the chemical element specified by type.

Parameters
typeThe atom type specifying the chemical element.
Returns
The number of valence electrons, or 0 if type does not specify a supported chemical element.

◆ getAtomicWeight()

static double CDPL::Chem::AtomDictionary::getAtomicWeight ( unsigned int  type,
std::size_t  isotope = 0 
)
static

Returns the standard atomic weight or the relative isotopic mass of an isotope of the chemical element specified by type.

If the element isotope is left unspecified, i.e. the argument isotope is zero, then the standard atomic weight of the chemical element will be returned. If an isotope is specified and the exact relative isotopic mass of the specified isotope is not available, the relative isotopic mass is approximated by the provided mass number of the isotope.

Parameters
typeThe atom type specifying the chemical element.
isotopeThe mass number of the element's isotope, or 0 if not specified.
Returns
The relative isotopic mass of the specified element isotope, or the standard atomic weight of the element if isotope is zero.

◆ getVdWRadius()

static double CDPL::Chem::AtomDictionary::getVdWRadius ( unsigned int  type)
static

Returns the Van der Waals radius of the chemical element specified by type.

Parameters
typeThe atom type specifying the chemical element.
Returns
The Van der Waals radius, or 0.0 if type does not specify a supported chemical element.

◆ getCovalentRadius()

static double CDPL::Chem::AtomDictionary::getCovalentRadius ( unsigned int  type,
std::size_t  order = 1 
)
static

Returns the covalent radius of the chemical element specified by type for the given bond order.

Parameters
typeThe atom type specifying the chemical element.
orderThe bond order.
Returns
The covalent radius for the specified bond order, or 0.0 if type does not specify a supported chemical element, order is not valid or the radius is unknown.

◆ getAllredRochowElectronegativity()

static double CDPL::Chem::AtomDictionary::getAllredRochowElectronegativity ( unsigned int  type)
static

Returns the Allred-Rochow electronegativity of the chemical element specified by type.

Parameters
typeThe atom type specifying the chemical element.
Returns
The Allred-Rochow electronegativity, or 0.0 if the electronegativity of the specified element is not available.

◆ getValenceStates()

static const Util::STArray& CDPL::Chem::AtomDictionary::getValenceStates ( unsigned int  type)
static

Returns an array with the valence states of the chemical element specified by type.

Parameters
typeThe atom type specifying the chemical element.
Returns
An array with the valence states of the specified chemical element.

◆ isChemicalElement()

static bool CDPL::Chem::AtomDictionary::isChemicalElement ( unsigned int  type)
static

Tells whether the specified atom type represents a chemical element.

Parameters
typeThe atom type.
Returns
true if type specifies a chemical element, and false otherwise.

◆ isMainGroupElement()

static bool CDPL::Chem::AtomDictionary::isMainGroupElement ( unsigned int  type)
static

Tells whether the chemical element specified by type is a main group element.

Parameters
typeThe atom type specifying the chemical element.
Returns
true if type specifies a main group element, and false otherwise.

◆ isTransitionMetal()

static bool CDPL::Chem::AtomDictionary::isTransitionMetal ( unsigned int  type)
static

Tells whether the chemical element specified by type is a transition metal.

Parameters
typeThe atom type specifying the chemical element.
Returns
true if type specifies a transition metal, and false otherwise.

◆ isMetal()

static bool CDPL::Chem::AtomDictionary::isMetal ( unsigned int  type)
static

Tells whether the chemical element specified by type is a metal.

Parameters
typeThe atom type specifying the chemical element.
Returns
true if type specifies a metal, and false otherwise.

◆ isSemiMetal()

static bool CDPL::Chem::AtomDictionary::isSemiMetal ( unsigned int  type)
static

Tells whether the chemical element specified by type is a semi-metal.

Parameters
typeThe atom type specifying the chemical element.
Returns
true if type specifies a semi-metal, and false otherwise.

◆ isNonMetal()

static bool CDPL::Chem::AtomDictionary::isNonMetal ( unsigned int  type)
static

Tells whether the chemical element specified by type is a non-metal.

Parameters
typeThe atom type specifying the chemical element.
Returns
true if type specifies a non-metal, and false otherwise.

◆ isHalogen()

static bool CDPL::Chem::AtomDictionary::isHalogen ( unsigned int  type)
static

Tells whether the chemical element specified by type is a halogen.

Parameters
typeThe atom type specifying the chemical element.
Returns
true if type specifies a halogen, and false otherwise.

◆ isNobleGas()

static bool CDPL::Chem::AtomDictionary::isNobleGas ( unsigned int  type)
static

Tells whether the chemical element specified by type is a noble gas.

Parameters
typeThe atom type specifying the chemical element.
Returns
true if type specifies a noble gas, and false otherwise.

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