Loading...
Searching...
No Matches
PLMD::vatom::ActionWithVirtualAtom Class Reference

Inherit from here if you are calculating the position of a virtual atom (eg a center of mass) More...

#include <ActionWithVirtualAtom.h>

Inheritance diagram for PLMD::vatom::ActionWithVirtualAtom:

Public Member Functions

 ActionWithVirtualAtom (const ActionOptions &ao)
 
 ~ActionWithVirtualAtom ()
 
const std::map< AtomNumber, Tensor > & getGradients () const
 
AtomNumber getIndex () const
 Return the atom id of the corresponding virtual atom.
 
void setGradients ()
 
void setGradientsIfNeeded ()
 

Static Public Member Functions

static void registerKeywords (Keywords &keys)
 

Protected Member Functions

void requestAtoms (const std::vector< AtomNumber > &a)
 Request atoms on which the calculation depends.
 
void setAtomsDerivatives (const std::vector< Tensor > &d)
 Set the derivatives of virtual atom coordinate wrt atoms on which it dependes.
 
void setBoxDerivatives (const std::array< Tensor, 3 > &d)
 Set the box derivatives.
 
void setBoxDerivativesNoPbc ()
 Set box derivatives automatically.
 
void setCharge (double)
 Set its charge.
 
void setMass (double)
 Set its mass.
 
void setPosition (const Vector &)
 Set position of the virtual atom.
 

Private Member Functions

void apply () override
 Apply an Action.
 

Private Attributes

std::array< Tensor, 3 > boxDerivatives
 
std::vector< Tensorderivatives
 
std::map< AtomNumber, Tensorgradients
 
const AtomNumber index
 

Detailed Description

Inherit from here if you are calculating the position of a virtual atom (eg a center of mass)

Class to add a single virtual atom to the system. (it might be extended to add multiple virtual atoms).

Constructor & Destructor Documentation

◆ ActionWithVirtualAtom()

PLMD::ActionWithVirtualAtom::ActionWithVirtualAtom ( const ActionOptions & ao)
explicit

◆ ~ActionWithVirtualAtom()

PLMD::ActionWithVirtualAtom::~ActionWithVirtualAtom ( )

Member Function Documentation

◆ apply()

void PLMD::ActionWithVirtualAtom::apply ( )
overrideprivatevirtual

Apply an Action.

This method is called one time per step. The set of all Actions is applied in backward order.

Implements PLMD::Action.

◆ getGradients()

const std::map< AtomNumber, Tensor > & PLMD::ActionWithVirtualAtom::getGradients ( ) const
inline

◆ getIndex()

AtomNumber PLMD::ActionWithVirtualAtom::getIndex ( ) const
inline

Return the atom id of the corresponding virtual atom.

◆ registerKeywords()

void PLMD::ActionWithVirtualAtom::registerKeywords ( Keywords & keys)
static

◆ requestAtoms()

void PLMD::ActionWithVirtualAtom::requestAtoms ( const std::vector< AtomNumber > & a)
protected

Request atoms on which the calculation depends.

◆ setAtomsDerivatives()

void PLMD::ActionWithVirtualAtom::setAtomsDerivatives ( const std::vector< Tensor > & d)
inlineprotected

Set the derivatives of virtual atom coordinate wrt atoms on which it dependes.

◆ setBoxDerivatives()

void PLMD::ActionWithVirtualAtom::setBoxDerivatives ( const std::array< Tensor, 3 > & d)
protected

Set the box derivatives.

This should be an array of size 3. First index corresponds to the components of the virtual atom. Notice that this routine subtract the trivial term coming from cell deformation since this term is already implicitly included. Indeed, if the vatom position is a linear function of atomic coordinates it is not necessary to call this function (implicit term is fine) (e.g. vatom::COM and vatom::Center). On the other hand if the vatom position is a non-linear function of atomic coordinates this should be called (see vatom::Ghost).

◆ setBoxDerivativesNoPbc()

void PLMD::ActionWithVirtualAtom::setBoxDerivativesNoPbc ( )
protected

Set box derivatives automatically.

It should be called after the settomsDerivatives has been used for all single atoms.

Warning
It only works for virtual atoms NOT using PBCs! This implies that all atoms used + the new virtual atom should be in the same periodic image.

◆ setCharge()

void PLMD::ActionWithVirtualAtom::setCharge ( double c)
inlineprotected

Set its charge.

◆ setGradients()

void PLMD::ActionWithVirtualAtom::setGradients ( )

◆ setGradientsIfNeeded()

void PLMD::ActionWithVirtualAtom::setGradientsIfNeeded ( )

◆ setMass()

void PLMD::ActionWithVirtualAtom::setMass ( double m)
inlineprotected

Set its mass.

◆ setPosition()

void PLMD::ActionWithVirtualAtom::setPosition ( const Vector & pos)
inlineprotected

Set position of the virtual atom.

Member Data Documentation

◆ boxDerivatives

std::array<Tensor,3> PLMD::ActionWithVirtualAtom::boxDerivatives
private

◆ derivatives

std::vector<Tensor> PLMD::ActionWithVirtualAtom::derivatives
private

◆ gradients

std::map<AtomNumber,Tensor> PLMD::ActionWithVirtualAtom::gradients
private

◆ index

const AtomNumber PLMD::ActionWithVirtualAtom::index
private

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