2.2.1. Chem.h

2.2.1.1. Class AtomId

class AtomId

Representation of the chemical element of an atom.

2.2.1.1.1. Synopsis

struct AtomId {
    constexpr AtomId();
    explicit constexpr AtomId(unsigned char id);
    constexpr operator unsigned char() const;
    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.

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

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

2.2.1.2. Class Charge

class Charge

Representation of the charge of an atom.

2.2.1.2.1. Synopsis

struct Charge {
    constexpr Charge();
    explicit constexpr Charge(signed char c);
    constexpr operator signed char() const;
    friend std::ostream &operator<<(std::ostream &s, Charge charge);
private:
    signed char c;
};

2.2.1.2.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.

2.2.1.3. Class AtomData

class AtomData

Representation of basic data of an atom.

2.2.1.3.1. Synopsis

struct AtomData {
    constexpr AtomData();
    constexpr explicit AtomData(AtomId atomId);
    constexpr AtomData(AtomId atomId, Charge charge, bool radical);
    constexpr AtomId getAtomId() const;
    constexpr Charge getCharge() const;
    constexpr bool getRadical() const;
    friend constexpr bool operator==(const AtomData &a1, const AtomData &a2);
    friend std::ostream &operator<<(std::ostream &s, const AtomData &data);
private:
    AtomId atomId;
    Charge charge;
    bool radical;
};

2.2.1.3.2. Details

constexpr AtomData()

Construct atom data with AtomIds::Invalid atom id and neutral charge.

explicit constexpr AtomData(AtomId atomId)

Construct atom data with neutral charge, no radical, and the given atom id.

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

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

constexpr AtomId getAtomId() const

Retrieve the atom id.

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.

2.2.1.4. 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.

2.2.1.5. 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.