2.2.1. Chem.hpp¶
2.2.1.1. Class AtomId
¶
-
class
AtomId
¶ Representation of the chemical element of an atom.
2.2.1.1.1. Synopsis¶
struct MOD_DECL AtomId {
constexpr AtomId();
explicit constexpr AtomId(unsigned char id);
constexpr operator unsigned char() const;
std::string symbol() const;
MOD_DECL friend std::ostream &operator<<(std::ostream &s, AtomId atomId);
private:
unsigned char id;
};
2.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.
2.2.1.2. Class Isotope
¶
-
class
Isotope
¶ Representation of the isotope of an atom.
2.2.1.2.1. Synopsis¶
struct MOD_DECL Isotope {
constexpr Isotope();
explicit constexpr Isotope(int i);
constexpr operator int() const;
MOD_DECL friend std::ostream &operator<<(std::ostream &s, Isotope iso);
private:
int i;
};
2.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.
2.2.1.3. Class Charge
¶
-
class
Charge
¶ Representation of the charge of an atom.
2.2.1.3.1. Synopsis¶
struct MOD_DECL Charge {
constexpr Charge();
explicit constexpr Charge(signed char c);
constexpr operator signed char() const;
MOD_DECL friend std::ostream &operator<<(std::ostream &s, Charge charge);
private:
signed char c;
};
2.2.1.4. Class AtomData
¶
-
class
AtomData
¶ Representation of basic data of an atom.
2.2.1.4.1. Synopsis¶
struct MOD_DECL AtomData {
constexpr AtomData() = default;
constexpr explicit 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 constexpr bool operator==(const AtomData &a1, const AtomData &a2);
MOD_DECL friend std::ostream &operator<<(std::ostream &s, const AtomData &data);
private:
AtomId atomId;
Isotope isotope;
Charge charge;
bool radical = false;
};
2.2.1.4.2. Details¶
-
constexpr
AtomData
()¶ Construct atom data with default values:
AtomIds::Invalid
atom id,Isotope()
as isotope,neutral charge, and
no radical.
-
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 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 isAtomIds::Invalid
.
2.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
¶
-
enumerator
-
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 isBondType::Invalid
.
2.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.