Atom

struct Atom : public tadah::core::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 tadah::core::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
tadah::core::Element element = tadah::core::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 tadah::core::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 tadah::core::Element

  • px, py, pz[in] Atomic coordinates

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

Atom(const tadah::core::Element &element, const double px, const double py, const double pz)

This constructor fully initialise this object with zero force

Parameters:
  • element[in] Chemical tadah::core::Element

  • px, py, pz[in] Atomic coordinates

bool operator==(const Atom&) const

Return true if both atoms are the same.

This operator compares chemical type, position and force.

bool is_the_same(const Atom&, double thr = 1e-6) const

Return true if both atoms have the same position and type.

This method compares chemical type and position only

Public Members

tadah::core::Vec3d position

Hold position of the atom.

tadah::core::Vec3d force

Hold force on the atom.

Friends

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

Print object summary to the stream