Atom

struct Atom : public Element

Container to represent atom properties

Usage example:

# create an empty atom object - all attributes are left uninitialised
Atom atom;

# set atom symbol
atom.symbol="Ti"

# set atom name, atomic number... see Element class for attributes

# set atom position to (1.1, 2.2, 3.3)
atom.position(0) = 1.1;
atom.position(1) = 2.2;
atom.position(2) = 3.3;

# set force
atom.force(0)= 0.1;
atom.force(1)= -0.2;
atom.force(2)= 0.3;
Usage example:
# Use constructor to fully initialise this object
# with the position and force as in the example above
Element element = PeriodicTable().find_by_symbol("Ti");
Atom atom(element, 1.1, 2.2, 3.3, 0.1, -0.2, 0.3);
Usage example:
# Print atom object using streams:
std::cout << atom;

# Print position only
std::cout << atom.position

See also

Structure

Public Functions

Atom()

Create an empty atom object. All class attributes are left uninitialised.

Atom(const Element &element, const double px, const double py, const double pz, const double fx, const double fy, const double fz)

This constructor fully initialise this object

Parameters:
  • element[in] Chemical Element

  • px, py, pz[in] Atomic coordinates

  • fx, fy, fz[in] Force acting on the atom

bool operator==(const Atom&) const

Return true if both atoms are the same.

This operator compares chemical type, position and force.

Public Members

Eigen::Vector3d position

Hold position of the atom.

Eigen::Vector3d force

Hold force on the atom.

Friends

friend std::ostream &operator<<(std::ostream &os, const Atom &atom)

Print object summary to the stream