A functor to handle Axilrod-Teller(-Muto) interactions between three particles (molecules). More...
#include <AxilrodTellerFunctor.h>
Public Member Functions | |
AxilrodTellerFunctor ()=delete | |
Deleted default constructor. | |
AxilrodTellerFunctor (double cutoff) | |
Constructor for Functor with mixing disabled. | |
AxilrodTellerFunctor (double cutoff, ParticlePropertiesLibrary< double, size_t > &particlePropertiesLibrary) | |
Constructor for Functor with mixing active. | |
std::string | getName () final |
Returns name of functor. | |
bool | isRelevantForTuning () final |
Specifies whether the functor should be considered for the auto-tuning process. | |
bool | allowsNewton3 () final |
Specifies whether the functor is capable of Newton3-like functors. | |
bool | allowsNonNewton3 () final |
Specifies whether the functor is capable of non-Newton3-like functors. | |
void | AoSFunctor (Particle_T &i, Particle_T &j, Particle_T &k, bool newton3) final |
TriwiseFunctor for arrays of structures (AoS). | |
void | setParticleProperties (SoAFloatPrecision nu) |
Sets the particle properties constants for this functor. | |
void | initTraversal () final |
Reset the global values. | |
void | endTraversal (bool newton3) final |
Accumulates global values, e.g. | |
double | getPotentialEnergy () |
Get the potential Energy. | |
double | getVirial () |
Get the virial. | |
size_t | getNumFLOPs () const override |
Gets the number of useful FLOPs. | |
double | getHitRate () const override |
Get the hit rate. | |
![]() | |
TriwiseFunctor (double cutoff) | |
Constructor. | |
virtual void | AoSFunctor (Particle_T &i, Particle_T &j, Particle_T &k, bool newton3) |
TriwiseFunctor for arrays of structures (AoS). | |
virtual void | SoAFunctorSingle (SoAView< SoAArraysType > soa, bool newton3) |
TriwiseFunctor for structure of arrays (SoA) | |
virtual void | SoAFunctorPair (SoAView< SoAArraysType > soa1, SoAView< SoAArraysType > soa2, bool newton3) |
TriwiseFunctor for structure of arrays (SoA) | |
virtual void | SoAFunctorTriple (SoAView< SoAArraysType > soa1, SoAView< SoAArraysType > soa2, SoAView< SoAArraysType > soa3, bool newton3) |
TriwiseFunctor for structure of arrays (SoA) | |
virtual void | SoAFunctorVerlet (SoAView< SoAArraysType > soa, const size_t indexFirst, const std::vector< size_t, AlignedAllocator< size_t > > &neighborList, bool newton3) |
TriwiseFunctor for structure of arrays (SoA) for neighbor lists. | |
![]() | |
Functor (double cutoff) | |
Constructor. | |
virtual void | initTraversal () |
This function is called at the start of each traversal. | |
virtual void | endTraversal (bool newton3) |
This function is called at the end of each traversal. | |
template<class ParticleCell > | |
void | SoALoader (ParticleCell &cell, SoA< SoAArraysType > &soa, size_t offset, bool skipSoAResize) |
Copies the AoS data of the given cell in the given soa. | |
template<typename ParticleCell > | |
void | SoAExtractor (ParticleCell &cell, SoA< SoAArraysType > &soa, size_t offset) |
Copies the data stored in the soa back into the cell. | |
virtual bool | allowsNewton3 ()=0 |
Specifies whether the functor is capable of Newton3-like functors. | |
virtual bool | allowsNonNewton3 ()=0 |
Specifies whether the functor is capable of non-Newton3-like functors. | |
virtual bool | isRelevantForTuning ()=0 |
Specifies whether the functor should be considered for the auto-tuning process. | |
virtual std::string | getName ()=0 |
Returns name of functor. | |
double | getCutoff () const |
Getter for the functor's cutoff. | |
virtual size_t | getNumFLOPs () const |
Get the number of FLOPs. | |
virtual double | getHitRate () const |
Get the hit rate. | |
Static Public Member Functions | |
static constexpr auto | getNeededAttr () |
Get attributes needed for computation. | |
static constexpr auto | getNeededAttr (std::false_type) |
Get attributes needed for computation without N3 optimization. | |
static constexpr auto | getComputedAttr () |
Get attributes computed by this functor. | |
static constexpr bool | getMixing () |
![]() | |
static constexpr std::array< typename Particle_T::AttributeNames, 0 > | getNeededAttr () |
Get attributes needed for computation. | |
static constexpr std::array< typename Particle_T::AttributeNames, 0 > | getNeededAttr (std::false_type) |
Get attributes needed for computation without N3 optimization. | |
static constexpr std::array< typename Particle_T::AttributeNames, 0 > | getComputedAttr () |
Get attributes computed by this functor. | |
Additional Inherited Members | |
![]() | |
using | SoAArraysType = typename Particle_T::SoAArraysType |
Structure of the SoAs defined by the particle. | |
![]() | |
using | SoAArraysType = typename Particle_T::SoAArraysType |
Structure of the SoAs defined by the particle. | |
using | Functor_T = CRTP_T |
Make the Implementation type template publicly available. | |
A functor to handle Axilrod-Teller(-Muto) interactions between three particles (molecules).
The reference paper of Axilrod and Teller can be found here: https://doi.org/10.1063/1.1723844
The Axilrod-Teller potential is a model for the interactions of three molecules which appear when the van der Waals forces are approximated to the third order. It is usually combined with a model for pairwise interaction as e.g. the Lennard-Jones potential.
\[ U_{AT} = \nu \frac{3 \cos\gamma_1 \cos\gamma_2 \cos\gamma_3 + 1}{r_{12}^3 r_{23}^3 r_{31}^3} \]
, where \(r_{ij}\) is the distance between particles \(i\) and \(j\) and \(\gamma_i\) is the angle between the sides \(r_{ij}\) and \(r_{ik}\). \(\nu\) is a material dependent parameter of the order \(V\alpha^3\), where \(V\) is the ionization energy and \(\alpha\) the polarizability.
The cosines can also be expressed as:
\[ \cos\gamma_1 = \frac{ \vec{r}_{12} \cdot \vec{r}_{13}}{|\vec{r}_{12}||\vec{r}_{13}|} \]
, where \(\vec{r}_{ij}\) is the vector from particle \(i\) to particle \(j\) ( \(i \longrightarrow j\) ). It is calculated as \(\vec{x}_j - \vec{x}_i\), where \(\vec{x}_i\) is the position of particle \(i\).
Therefore, the potential can also be expressed as:
\[ U_{AT} = \nu\frac{-3 (\vec{r}_{12} \cdot \vec{r}_{31}) (\vec{r}_{12} \cdot \vec{r}_{23}) (\vec{r}_{31} \cdot \vec{r}_{23}) + r_{12}^2 r_{23}^2 r_{31}^2}{r_{12}^5 r_{23}^5 r_{31}^5} \]
Note that we have \(-3\) because we use the circular vectors \(\vec{r}_ {12}, \vec{r}_ {23}, \vec{r}_ {31}\).
The derivative can be calculated by applying the chain rule and leads to a resulting Force exerted on particle \(1\):
\[ \vec{F}_ {1} = - \frac{\partial U_ {AT}}{\partial \vec{x}_ 1} \]
\[ \vec{F}_ {1} = \frac{3}{r_ {12}^5 r_ {23}^5 r_ {31}^5}\cdot \left[ \left( -5\frac{<>_ 1<>_ 2<>_ 3}{r_ {12}^2} - <>_ 1<>_ 3 + r_ {23}^2r_ {31}^2\right)\cdot \vec{r}_ {12} +\left( 5\frac{<>_ 1<>_ 2<>_ 3}{r_ {23}^2} + <>_ 1<>_ 3 - r_ {12}^2r_ {31}^2\right)\cdot\vec{r}_ {23} +\left( <>_ 2<>_ 3 - <>_ 2<>_ 1 \right)\cdot \vec{r}_ {31} \right] \]
, where \(<>_ 1=\vec{r}_ {12}\cdot\vec{r}_ {31}\) and so on. The terms are already ordered to show the contribution from all three distance vectors.
Newton's third law
To apply Newton's third law, the force on particle \(2\) needs to be calculated in a similar fashion as for particle \(1\). The force on particle \(3\) can then be written as the negative sum of the other two forces:
\[ \vec{F}_3 = -(\vec{F}_1 + \vec{F}_2) \]
This functor assumes that duplicated calculations are always happening, which is characteristic for a Full-Shell scheme.
Particle_T | The type of particle. |
useMixing | Switch for the functor to be used with multiple particle types. If set to false, _epsilon and _sigma need to be set and the constructor with PPL can be omitted. |
useNewton3 | Switch for the functor to support newton3 on, off or both. See FunctorN3Modes for possible values. |
calculateGlobals | Defines whether the global values are to be calculated (energy, virial). |
countFLOPs | counts FLOPs and hitrate |
|
inlineexplicit |
Constructor for Functor with mixing disabled.
When using this functor it is necessary to call setParticleProperties() to set internal constants because it does not use a particle properties library.
cutoff |
|
inlineexplicit |
Constructor for Functor with mixing active.
This functor takes a ParticlePropertiesLibrary to look up (mixed) properties like nu.
cutoff | |
particlePropertiesLibrary |
|
inlinefinalvirtual |
Specifies whether the functor is capable of Newton3-like functors.
If the functor provides an interface to soa or aos functions that utilize Newton's third law of motion (actio = reactio) to reduce the computational complexity this function should return true. If this is not the case this function should return false.
Implements autopas::Functor< Particle_T, CRTP_T >.
|
inlinefinalvirtual |
Specifies whether the functor is capable of non-Newton3-like functors.
If the functor provides an interface to soa or aos functions that do not utilize Newton's third law of motion (actio = reactio) this function should return true. If this is not the case this function should return false.
Implements autopas::Functor< Particle_T, CRTP_T >.
|
inlinefinalvirtual |
TriwiseFunctor for arrays of structures (AoS).
This functor should calculate the forces or any triwise interaction between three particles. This should include a cutoff check if needed!
i | Particle i |
j | Particle j |
k | Particle k |
newton3 | defines whether or whether not to use newton 3 |
Reimplemented from autopas::TriwiseFunctor< Particle_T, CRTP_T >.
|
inlinefinalvirtual |
Accumulates global values, e.g.
potential energy and virial.
newton3 |
Reimplemented from autopas::Functor< Particle_T, CRTP_T >.
|
inlinestaticconstexpr |
Get attributes computed by this functor.
|
inlineoverridevirtual |
Get the hit rate.
Implementation required if FLOPLogger used.
If derived class provides no implementation, the FLOPLogger interprets the default NaN output as invalid and leaves "Not Implemented" in the log.
Reimplemented from autopas::Functor< Particle_T, CRTP_T >.
|
inlinestaticconstexpr |
|
inlinefinalvirtual |
Returns name of functor.
Intended for use with the iteration logger, to differentiate between calls to computeInteractions using different functors in the logs.
Implements autopas::Functor< Particle_T, CRTP_T >.
|
inlinestaticconstexpr |
Get attributes needed for computation.
|
inlinestaticconstexpr |
Get attributes needed for computation without N3 optimization.
|
inlineoverridevirtual |
Gets the number of useful FLOPs.
For the three distance squared calculations, this is:
For the force kernel, this is:
For the globals calculation, this is:
Reimplemented from autopas::Functor< Particle_T, CRTP_T >.
|
inline |
Get the potential Energy.
|
inline |
Get the virial.
|
inlinefinalvirtual |
Reset the global values.
Will set the global values to zero to prepare for the next iteration.
Reimplemented from autopas::Functor< Particle_T, CRTP_T >.
|
inlinefinalvirtual |
Specifies whether the functor should be considered for the auto-tuning process.
Implements autopas::Functor< Particle_T, CRTP_T >.
|
inline |
Sets the particle properties constants for this functor.
This is only necessary if no particlePropertiesLibrary is used.
nu | The Axilrod-Teller potential parameter |