Loading...
Searching...
No Matches
Atoms Class Reference

The main list of atoms class. More...

#include <Atoms.h>

Inheritance diagram for Atoms:

Public Member Functions

 Atoms (const Vec *p, int n, SuperCell *s)
 Construct Atoms from array of positions, number of elements and a SuperCell.
virtual ~Atoms ()
 Deletes the atoms. Does not delete Potential or SuperCell.
virtual SuperCellGetSuperCell () const
 Return a pointer to the SuperCell object.
virtual const VecGetUnitCell () const
 Return the unitcell vectors.
virtual void SetUnitCell (const Vec newbasis[3], bool fix)
 Set a new unit cell, rescaling the positions unless fix is true.
virtual void SetCalculator (AsapPotential *potential)
 Set a Potential. An eventual old Potential is not deallocated.
AsapPotentialGetPotential () const
 Get a pointer to the Potential.
void MarkChanged ()
 Update the change pointer.
int GetChangeCounter () const
 Get the change counter.
virtual void SetCartesianPositions (const Vec *p)
 Set the Cartesian positions.
virtual void GetCartesianPositions (Vec *p) const
 Return a copy of the Cartesian positions.
virtual const VecGetCartesianPositions () const
 Return a const pointer to the Cartesian positions.
VecGetPositionsPtr ()
 Return a non-const pointer to the Cartesian positions. DANGEROUS!
virtual void GetUnwrappedPositions (vector< Vec > &p) const
 Return the positions, hiding that they may have been wrapped due to the boundary conditions.
virtual void SetUnwrappedPositions (const Vec *p)
 Set the positions from an array of positions not taking any wrapping into account.
virtual void NormalizeDifferences (Vec *diff) const
 Apply periodic boundary conditions to differences in positions.
virtual void NormalizeDifference (Vec &diff) const
 Apply periodic boundary conditions to difference in positions.
virtual void NormalizePositions ()
 Apply periodic boundary conditions to the positions.
virtual void NormalizePosition (Vec &pos) const
 Normalize a position which is not owned by the atoms.
virtual void NormalizePosition (Vec &pos, Vec &scaled_translation) const
 Normalize a position which is not owned by the atoms.
virtual void ReNormalizePosition (Vec &pos, Vec &scaled_translation) const
 Repeat a normalization. See NormalizePosition(a,b).
virtual void SetAtomicNumbers (const int *z)
 Set the atomic numbers. Should be done right after construction.
virtual const int * GetAtomicNumbers () const
 Return a const pointer to the atomic numbers.
int * GetAtomicNumbersPtr ()
 Return a non-const pointer to the atomic numbers. DANGEROUS!
virtual void GetListOfElements (set< int > &elements) const
 Get a set of all elements present in the simulations.
void SetNumberOfImages (int i)
 Set the number of images. Used by the neighbor list.
int GetNumberOfImages () const
 Get the number of images. Used by the neighbor list.
virtual int GetNumberOfAtoms () const
 Get the number of atoms (including nodes in a QC simulation).
int GetNumberOfRealAtoms () const
 Get the number of atoms (excluding nodes in a QC simulation).
virtual void SetNumberOfAtoms (int n)
 Change the number of atoms.

Protected Attributes

AsapPotentialpotential
 A pointer to the potential.
SuperCellsuperCell
 A pointer to the supercell.
vector< Vecpositions
 Contains the Cartesian positions.
vector< Vecpos_translations
 Translations applied to the positions to conform with the periodic boundary conditions.
vector< int > types
 Contains the atomic numbers.
int nAtoms
 The number of atoms in the list.
int nImages
 The number of image atoms used by NeighborList.
int counter
 Used to track changes.

Detailed Description

The main list of atoms class.

The Atoms class stores the coordinates and atomic numbers of the atoms. Coordinates are stored as Cartesian coordinates. Atoms has a reference to a SuperCell object containing the unitcell of the simulation, and a pointer to a Potential object responsible of force calculations. Other information about atoms (such as velocities and forces) are not stored in the C++ code but live in Python.

Definition at line 36 of file Atoms.h.

Constructor & Destructor Documentation

◆ Atoms()

Atoms::Atoms ( const Vec * p,
int n,
SuperCell * s )

Construct Atoms from array of positions, number of elements and a SuperCell.

◆ ~Atoms()

virtual Atoms::~Atoms ( )
inlinevirtual

Deletes the atoms. Does not delete Potential or SuperCell.

Definition at line 43 of file Atoms.h.

43{};

Member Function Documentation

◆ GetAtomicNumbers()

virtual const int * Atoms::GetAtomicNumbers ( ) const
inlinevirtual

Return a const pointer to the atomic numbers.

Definition at line 165 of file Atoms.h.

165{ return &types[0]; }
vector< int > types
Contains the atomic numbers.
Definition Atoms.h:208

◆ GetAtomicNumbersPtr()

int * Atoms::GetAtomicNumbersPtr ( )
inline

Return a non-const pointer to the atomic numbers. DANGEROUS!

GetAtomicNumbersPtr returns a pointer allowing modification of the atomic numbers. Use with care, and call MarkChanged manually!

Definition at line 171 of file Atoms.h.

171{ return &types[0]; }

◆ GetCartesianPositions() [1/2]

virtual const Vec * Atoms::GetCartesianPositions ( ) const
inlinevirtual

Return a const pointer to the Cartesian positions.

This version returns a pointer to the coordinates of all atoms. If ghost atoms are present, they are at the end of the array. It is up to the caller to know if ghost atoms are present, and to access them (or not) according to the need. Non-atomistic degrees of freedom, such as nodes in QC simulations, are not returned by this version.

Bug
The difference in semantics between the two versions of GetCartesianPositions is most unfortunate: one of them should be renamed.

Definition at line 100 of file Atoms.h.

100{ return &positions[0]; }
vector< Vec > positions
Contains the Cartesian positions.
Definition Atoms.h:204

◆ GetCartesianPositions() [2/2]

virtual void Atoms::GetCartesianPositions ( Vec * p) const
virtual

Return a copy of the Cartesian positions.

This version returns all degrees of freedom, i.e. both atoms and nodes in a quasicontinuum simulation. It does not return ghost atoms.

Warning
When atoms.GetCartesianPositions() is called from Python, that is translated into a call to GetUwrappedPositions(), not to a call to this method.

◆ GetChangeCounter()

int Atoms::GetChangeCounter ( ) const
inline

Get the change counter.

Definition at line 68 of file Atoms.h.

68{ return counter; }
int counter
Used to track changes.
Definition Atoms.h:211

◆ GetListOfElements()

virtual void Atoms::GetListOfElements ( set< int > & elements) const
virtual

Get a set of all elements present in the simulations.

◆ GetNumberOfAtoms()

virtual int Atoms::GetNumberOfAtoms ( ) const
inlinevirtual

Get the number of atoms (including nodes in a QC simulation).

In a QuasiContinuum calculation we have real atoms and node atoms. GetNumberOfAtoms() is a virtual function: For a QCAtoms class it will return the number of real atoms plus the number of node atoms. This number is needed by SWIG to get the size of arrays. The method GetNumberOfRealAtoms() is needed by potentials and the Neighbor List object (they only deal with the real atoms).

Definition at line 190 of file Atoms.h.

190{ return nAtoms; }
int nAtoms
The number of atoms in the list.
Definition Atoms.h:209

◆ GetNumberOfImages()

int Atoms::GetNumberOfImages ( ) const
inline

Get the number of images. Used by the neighbor list.

Definition at line 180 of file Atoms.h.

180{ return nImages; }
int nImages
The number of image atoms used by NeighborList.
Definition Atoms.h:210

◆ GetNumberOfRealAtoms()

int Atoms::GetNumberOfRealAtoms ( ) const
inline

Get the number of atoms (excluding nodes in a QC simulation).

See also the documentation of GetNumberOfAtoms().

Definition at line 196 of file Atoms.h.

196{ return nAtoms; }

◆ GetPositionsPtr()

Vec * Atoms::GetPositionsPtr ( )
inline

Return a non-const pointer to the Cartesian positions. DANGEROUS!

GetPositionsPtr returns a pointer allowing modification of the positions. Be sure to call MarkChanged if this is done.

Definition at line 106 of file Atoms.h.

106{ return &positions[0]; }

◆ GetPotential()

AsapPotential * Atoms::GetPotential ( ) const
inline

Get a pointer to the Potential.

Definition at line 58 of file Atoms.h.

58{ return potential; }
AsapPotential * potential
A pointer to the potential.
Definition Atoms.h:202

◆ GetSuperCell()

virtual SuperCell * Atoms::GetSuperCell ( ) const
inlinevirtual

Return a pointer to the SuperCell object.

Definition at line 46 of file Atoms.h.

46{ return superCell; }
SuperCell * superCell
A pointer to the supercell.
Definition Atoms.h:203

◆ GetUnitCell()

virtual const Vec * Atoms::GetUnitCell ( ) const
virtual

Return the unitcell vectors.

◆ GetUnwrappedPositions()

virtual void Atoms::GetUnwrappedPositions ( vector< Vec > & p) const
virtual

Return the positions, hiding that they may have been wrapped due to the boundary conditions.

This is the function used by Python when GetCartesianPositions is called.

◆ MarkChanged()

void Atoms::MarkChanged ( )
inline

Update the change pointer.

The change counter is updated whenever the atoms are changed. It is used to decide if e.g. forces should be recalculated. Methods such as SetCartesianPositions() increment the counter.

Definition at line 65 of file Atoms.h.

65{ ++counter; }

◆ NormalizeDifference()

virtual void Atoms::NormalizeDifference ( Vec & diff) const
virtual

Apply periodic boundary conditions to difference in positions.

◆ NormalizeDifferences()

virtual void Atoms::NormalizeDifferences ( Vec * diff) const
virtual

Apply periodic boundary conditions to differences in positions.

◆ NormalizePosition() [1/2]

virtual void Atoms::NormalizePosition ( Vec & pos) const
virtual

Normalize a position which is not owned by the atoms.

If another object holds a position needing to be normalized, this function should be called. It exists in two versions, one just normalizing the position, and one also returning the scaled space correction applied.

◆ NormalizePosition() [2/2]

virtual void Atoms::NormalizePosition ( Vec & pos,
Vec & scaled_translation ) const
virtual

Normalize a position which is not owned by the atoms.

This version of the call reports the translation in scaled_translation, so the same translation can be obtained later (by calling ReNormalizePosition) without redoing the decision on whether to wrap. This is useful if positions need to be normalized between neighborlist updates, and is currently used by the Quasicontinuum code.

◆ NormalizePositions()

virtual void Atoms::NormalizePositions ( )
virtual

Apply periodic boundary conditions to the positions.

Does NOT call MarkChanged ! Normalize the positions, i.e. translate the atoms back into the supercell if there are periodic boundary conditions. This does not count as changing the atoms, so the change counter is NOT updated. The actual work is done by the SuperCell. This method should be called by the Potential, which may (should?) delegate it to the NeighborList.

◆ ReNormalizePosition()

virtual void Atoms::ReNormalizePosition ( Vec & pos,
Vec & scaled_translation ) const
virtual

Repeat a normalization. See NormalizePosition(a,b).

◆ SetAtomicNumbers()

virtual void Atoms::SetAtomicNumbers ( const int * z)
virtual

Set the atomic numbers. Should be done right after construction.

◆ SetCalculator()

virtual void Atoms::SetCalculator ( AsapPotential * potential)
virtual

Set a Potential. An eventual old Potential is not deallocated.

◆ SetCartesianPositions()

virtual void Atoms::SetCartesianPositions ( const Vec * p)
virtual

Set the Cartesian positions.

Warning
When atoms.SetCartesianPositions() is called from Python, that is translated into a call to SetUwrappedPositions(), not to a call to this method.

◆ SetNumberOfAtoms()

virtual void Atoms::SetNumberOfAtoms ( int n)
virtual

Change the number of atoms.

◆ SetNumberOfImages()

void Atoms::SetNumberOfImages ( int i)

Set the number of images. Used by the neighbor list.

◆ SetUnitCell()

virtual void Atoms::SetUnitCell ( const Vec newbasis[3],
bool fix )
virtual

Set a new unit cell, rescaling the positions unless fix is true.

◆ SetUnwrappedPositions()

virtual void Atoms::SetUnwrappedPositions ( const Vec * p)
virtual

Set the positions from an array of positions not taking any wrapping into account.

The already existing offset (caused by wrapping through periodic boundaries) is applied to the atoms. This is the function used by Python when SetCartesianPositions is called.

Member Data Documentation

◆ counter

int Atoms::counter
protected

Used to track changes.

Definition at line 211 of file Atoms.h.

◆ nAtoms

int Atoms::nAtoms
protected

The number of atoms in the list.

Definition at line 209 of file Atoms.h.

◆ nImages

int Atoms::nImages
protected

The number of image atoms used by NeighborList.

Definition at line 210 of file Atoms.h.

◆ pos_translations

vector<Vec> Atoms::pos_translations
protected

Translations applied to the positions to conform with the periodic boundary conditions.

Definition at line 205 of file Atoms.h.

◆ positions

vector<Vec> Atoms::positions
protected

Contains the Cartesian positions.

Definition at line 204 of file Atoms.h.

◆ potential

AsapPotential* Atoms::potential
protected

A pointer to the potential.

Definition at line 202 of file Atoms.h.

◆ superCell

SuperCell* Atoms::superCell
protected

A pointer to the supercell.

Definition at line 203 of file Atoms.h.

◆ types

vector<int> Atoms::types
protected

Contains the atomic numbers.

Definition at line 208 of file Atoms.h.


The documentation for this class was generated from the following file:
  • /home/runner/work/eOn/eOn/include/eon/potentials/EMT/Asap/Atoms.h