Correlation 4.10.0
An Analysis Tool for Liquids and for Amorphous Solids
Loading...
Searching...
No Matches
correlation::core::Atom Class Reference

Represents an atom in the simulation cell. More...

#include <Atom.hpp>

Collaboration diagram for correlation::core::Atom:

Public Member Functions

Constructors
 Atom () noexcept=default
 Atom (const Element &element, const math::Vector3< real_t > &pos, AtomID atom_id)
 Parameterized constructor.
 Atom (const Element *element_ptr, const math::Vector3< real_t > &pos, AtomID atom_id)
 Pointer-based flyweight constructor.
Accessors
AtomID id () const noexcept
 Gets the unique ID of the atom.
void setID (std::uint32_t num) noexcept
 Sets the unique ID of the atom.
const math::Vector3< real_t > & position () const noexcept
 Gets the position of the atom.
void setPosition (const math::Vector3< real_t > &pos) noexcept
 Sets the position of the atom.
const Element & element () const noexcept
 Gets the element type of the atom.
void setElement (const Element &ele)
 Sets the element type of the atom.
std::int32_t elementId () const noexcept
 Gets the integer ID of the element type.

Private Attributes

math::Vector3< real_t > position_
 Cartesian coordinates in Angstroms.
AtomID id_ {0}
 Unique identification number.
std::uint16_t element_pool_idx_ {0}
 Compact index into ElementPool.
std::int16_t element_id_ {-1}
 Cached integer element ID (-1 if unassigned).

Detailed Description

Represents an atom in the simulation cell.

Compact 20-byte (float) / 32-byte (double) layout storing Cartesian position, unique ID, and a lock-free 16-bit ElementPool index. Velocities are stored lazily in Cell::velocities_.

Constructor & Destructor Documentation

◆ Atom() [1/3]

correlation::core::Atom::Atom ( )
explicitdefaultnoexcept
Here is the caller graph for this function:

◆ Atom() [2/3]

correlation::core::Atom::Atom ( const Element & element,
const math::Vector3< real_t > & pos,
AtomID atom_id )
inlineexplicit

Parameterized constructor.

Parameters
[in]elementThe element type of the atom.
[in]posThe position vector of the atom.
[in]atom_idThe unique ID of the atom.
Here is the call graph for this function:

◆ Atom() [3/3]

correlation::core::Atom::Atom ( const Element * element_ptr,
const math::Vector3< real_t > & pos,
AtomID atom_id )
inlineexplicit

Pointer-based flyweight constructor.

Parameters
[in]element_ptrPointer to the interned element.
[in]posThe position vector of the atom.
[in]atom_idThe unique ID of the atom.
Here is the call graph for this function:

Member Function Documentation

◆ element()

const Element & correlation::core::Atom::element ( ) const
inlinenodiscardnoexcept

Gets the element type of the atom.

Returns
A const reference to the Element struct.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ elementId()

std::int32_t correlation::core::Atom::elementId ( ) const
inlinenodiscardnoexcept

Gets the integer ID of the element type.

Returns
The element ID value.

◆ id()

AtomID correlation::core::Atom::id ( ) const
inlinenodiscardnoexcept

Gets the unique ID of the atom.

Returns
The atom ID.
Here is the caller graph for this function:

◆ position()

const math::Vector3< real_t > & correlation::core::Atom::position ( ) const
inlinenodiscardnoexcept

Gets the position of the atom.

Returns
A const reference to the position vector.

◆ setElement()

void correlation::core::Atom::setElement ( const Element & ele)
inline

Sets the element type of the atom.

Parameters
[in]eleThe new Element struct.
Here is the call graph for this function:

◆ setID()

void correlation::core::Atom::setID ( std::uint32_t num)
inlinenoexcept

Sets the unique ID of the atom.

Parameters
[in]numThe new atom ID.

◆ setPosition()

void correlation::core::Atom::setPosition ( const math::Vector3< real_t > & pos)
inlinenoexcept

Sets the position of the atom.

Parameters
[in]posThe new position vector.

Member Data Documentation

◆ element_id_

std::int16_t correlation::core::Atom::element_id_ {-1}
private

Cached integer element ID (-1 if unassigned).

◆ element_pool_idx_

std::uint16_t correlation::core::Atom::element_pool_idx_ {0}
private

Compact index into ElementPool.

◆ id_

AtomID correlation::core::Atom::id_ {0}
private

Unique identification number.

◆ position_

math::Vector3<real_t> correlation::core::Atom::position_
private

Cartesian coordinates in Angstroms.


The documentation for this class was generated from the following file: