Atom class

class Atom

An Atom is a particle in the current Frame.

An atom stores atomic properties such as the atom name and type, the mass and the charge. It also stores arbitrary property unsing the Property class. Position and velocity are not stored in the Atom class, but in separated arrays in the Frame class.

The atom name is usually an unique identifier (“H1”, “C_a”) while the atom type will be shared between all particles of the same type: “H”, “Ow”, “CH3”.

Public Functions

Atom(std::string name = "")

Create an atom with the given name and set the atom type to be the same as name.

If the atom type exists in the periodic table, the atom mass is set to the matching value. This check is executed with case-insensitive atom type: Na, NA, nA and na all get the Na mass.

Parameters
  • name: atomic name for the new atom

Atom(std::string name, std::string type)

Create an atom from the given name and type

If the atom type exists in the periodic table, the atom mass is set to the matching value. This check is executed with case-insensitive atom type: Na, NA, nA and na all get the Na mass.

Parameters
  • name: atomic name for the new atom
  • type: atomic type for the new atom

const std::string &name() const

Get the atom name.

const std::string &type() const

Get the atom type.

double mass() const

Get the atom mass.

double charge() const

Get the atom charge.

void set_name(std::string name)

Set the atom name to name.

void set_type(std::string type)

Set the atom type to type.

void set_mass(double mass)

Set the atom mass to mass.

void set_charge(double charge)

Set the atom charge to charge.

optional<std::string> full_name() const

Try to get the full atomic name from the atom type.

This function tries to get the full name corresponding to the current atom type: for example, the full name for He is "Helium". If no name can be found, this function returns nullopt. This check is executed with case-insensitive atom type: Na, NA, nA and na all get the Na full name.

This function returna an chemfiles::optional value that is close to C++17 std::optional.

optional<double> vdw_radius() const

Try to get the Van der Waals radius from the atom type.

This function tries to get the Van der Waals radius corresponding to the current atom type: for example, the radius for He is 1.4 A. If no radius can be found, this function returns nullopt. This check is executed with case-insensitive atom type: Na, NA, nA and na all get the Na radius.

This function returna an chemfiles::optional value that is close to C++17 std::optional.

optional<double> covalent_radius() const

Try to get the covalent radius from the atom type.

This function tries to get the covalent radius corresponding to the current atom type: for example, the radius for He is 0.32 A. If no radius can be found, this function returns nullopt. This check is executed with case-insensitive atom type: Na, NA, nA and na all get the Na radius.

This function returna an chemfiles::optional value that is close to C++17 std::optional.

optional<uint64_t> atomic_number() const

Try to get the atomic number from the atom type.

This function tries to get the atomic number corresponding to the current atom type: for example, the atomic number for He is 2. If no atomic number can be found, this function returns nullopt. This check is executed with case-insensitive atom type: Na, NA, nA and na all get the Na atomic number.

This function returna an chemfiles::optional value that is close to C++17 std::optional.

void set(std::string name, Property value)

Set an arbitrary Property for this atom with the given name and value. If a property with this name already exist, it is replaced with the new value.

optional<const Property&> get(const std::string &name) const

Get the Property with the given name for this atom if it exists.

If no property with the given name is found, this function returns nullopt.

This function returna an chemfiles::optional value that is close to C++17 std::optional.