3.2.1. Chem.hpp

3.2.1.1. Class AtomId

class AtomId

Representation of the chemical element of an atom.

3.2.1.1.1. Synopsis

constexpr AtomId()
explicit constexpr AtomId(unsigned int id)
constexpr operator unsigned char() const
std::string symbol() const
friend std::ostream &operator<<(std::ostream &s, AtomId atomId)

3.2.1.1.2. Details

constexpr AtomId()

Construct an AtomIds::Invalid atom id.

explicit constexpr AtomId(unsigned int id)

Construct a specific atom id. Pre-condition: the id must be at most that of AtomIds::Max.

constexpr operator unsigned char() const

Implicit conversion to an integer type.

std::string symbol() const
Returns:

the symbol represented by the atom id.

Raises:

LogicError if the id is invalid.

friend std::ostream &operator<<(std::ostream &s, AtomId atomId)

Inserts the int value of the atom id into the stream.

3.2.1.2. Class Isotope

class Isotope

Representation of the isotope of an atom.

3.2.1.2.1. Synopsis

constexpr Isotope()
explicit constexpr Isotope(int i)
constexpr operator int() const
friend std::ostream &operator<<(std::ostream &s, Isotope iso)

3.2.1.2.2. Details

constexpr Isotope()

Construct a representation of the most abundant isotope.

Note

This is different from explicitly specifying the isotope that is the most abundant one.

explicit constexpr Isotope(int i)

Construct a specific isotope. Pre-condition: the isotope must either be at least 1 or be -1. Passing -1 is equivalent to default-construction.

constexpr operator int() const

Implicit conversion to an integer type.

friend std::ostream &operator<<(std::ostream &s, Isotope iso)

Inserts the integer value of the isotope into the stream.

3.2.1.3. Class Charge

class Charge

Representation of the charge of an atom.

3.2.1.3.1. Synopsis

constexpr Charge()
explicit constexpr Charge(signed char c)
constexpr operator signed char() const
friend std::ostream &operator<<(std::ostream &s, Charge charge)

3.2.1.3.2. Details

constexpr Charge()

Construct a neutral charge.

explicit constexpr Charge(signed char c)

Construct a specific charge. Pre-condition: the charge must be in the range \([-9, 9]\).

constexpr operator signed char() const

Implicit conversion to an integer type.

friend std::ostream &operator<<(std::ostream &s, Charge charge)

Inserts the int value of the charge into the stream.

3.2.1.4. Class AtomData

class AtomData

Representation of basic data of an atom.

3.2.1.4.1. Synopsis

constexpr AtomData()
explicit constexpr AtomData(AtomId atomId)
constexpr AtomData(AtomId atomId, Charge charge, bool radical)
constexpr AtomData(AtomId atomId, Isotope isotope, Charge charge, bool radical)
constexpr AtomId getAtomId() const
constexpr Isotope getIsotope() const
constexpr Charge getCharge() const
constexpr bool getRadical() const
friend std::ostream &operator<<(std::ostream &s, const AtomData &data)

3.2.1.4.2. Details

constexpr AtomData()

Construct atom data with default values:

explicit constexpr AtomData(AtomId atomId)

Construct atom data the given atom id, and otherwise default values (see above).

constexpr AtomData(AtomId atomId, Charge charge, bool radical)

Construct atom data with given atom id, charge, and radical, but with default isotope.

constexpr AtomData(AtomId atomId, Isotope isotope, Charge charge, bool radical)

Construct atom data with given atom id, isotope, charge, and radical.

constexpr AtomId getAtomId() const

Retrieve the atom id.

constexpr Isotope getIsotope() const

Retrieve the isotope.

constexpr Charge getCharge() const

Retrieve the charge.

constexpr bool getRadical() const

Retrieve the radical status.

friend std::ostream &operator<<(std::ostream &s, const AtomData &data)

Format the atom data adhering to the string encoding of atoms (see Molecule Encoding).

Throws:

LogicError if the atom id is AtomIds::Invalid.

3.2.1.5. Enum BondType

enum struct BondType

Representation of a bond type (see Molecule Encoding).

enumerator Invalid
enumerator Single
enumerator Aromatic
enumerator Double
enumerator Triple
std::ostream &operator<<(std::ostream &s, BondType bt)

Format the bond type adhering to the string encoding of bonds (see Molecule Encoding).

Throws:

LogicError if the bond type is BondType::Invalid.

3.2.1.6. Namespace AtomIds

This namespace contains constants for each chemical element, both as their abbreviations and their full names. Two additional constants are provided for convenience.

AtomId AtomIds::Invalid

Constant for the invalid atom id.

AtomId AtomIds::Max

An atom id equal to the atom id with the maximum valid id.