AutoPas  3.0.0
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | List of all members
mdLib::LJMultisiteFunctor< Particle_T, applyShift, useMixing, useNewton3, calculateGlobals, countFLOPs, relevantForTuning > Class Template Reference

A functor to handle Lennard-Jones interactions between two Multisite Molecules. More...

#include <LJMultisiteFunctor.h>

Inheritance diagram for mdLib::LJMultisiteFunctor< Particle_T, applyShift, useMixing, useNewton3, calculateGlobals, countFLOPs, relevantForTuning >:
Inheritance graph
[legend]
Collaboration diagram for mdLib::LJMultisiteFunctor< Particle_T, applyShift, useMixing, useNewton3, calculateGlobals, countFLOPs, relevantForTuning >:
Collaboration graph
[legend]

Public Member Functions

 LJMultisiteFunctor ()=delete
 Delete Default constructor.
 
 LJMultisiteFunctor (double cutoff)
 Constructor for Functor with particle mixing disabled.
 
 LJMultisiteFunctor (double cutoff, ParticlePropertiesLibrary< double, size_t > &particlePropertiesLibrary)
 Constructor for Functor with particle mixing enabled.
 
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 &particleA, Particle_T &particleB, bool newton3) final
 Functor for arrays of structures (AoS).
 
void SoAFunctorSingle (autopas::SoAView< SoAArraysType > soa, bool newton3) final
 PairwiseFunctor for structure of arrays (SoA)
 
void SoAFunctorPair (autopas::SoAView< SoAArraysType > soa1, autopas::SoAView< SoAArraysType > soa2, const bool newton3) final
 PairwiseFunctor for structure of arrays (SoA)
 
void SoAFunctorVerlet (autopas::SoAView< SoAArraysType > soa, const size_t indexFirst, const std::vector< size_t, autopas::AlignedAllocator< size_t > > &neighborList, bool newton3) final
 PairwiseFunctor for structure of arrays (SoA) for neighbor lists.
 
void setParticleProperties (SoAFloatPrecision epsilon24, SoAFloatPrecision sigmaSquared, std::vector< std::array< SoAFloatPrecision, 3 > > sitePositionsLJ)
 Sets the molecule properties constants for this functor.
 
unsigned long getNumFlopsPerKernelCall (size_t molAType, size_t molBType, bool newton3)
 Get the number of flops used per kernel call - i.e.
 
void initTraversal () final
 Reset the global values.
 
void endTraversal (bool newton3) final
 Postprocesses global values, e.g.
 
double getPotentialEnergy ()
 Get the potential energy.
 
double getVirial ()
 Get the virial.
 
- Public Member Functions inherited from autopas::PairwiseFunctor< Particle_T, CRTP_T >
 PairwiseFunctor (double cutoff)
 Constructor.
 
virtual void AoSFunctor (Particle_T &i, Particle_T &j, bool newton3)
 PairwiseFunctor for arrays of structures (AoS).
 
virtual void SoAFunctorSingle (SoAView< SoAArraysType > soa, bool newton3)
 PairwiseFunctor 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)
 PairwiseFunctor for structure of arrays (SoA) for neighbor lists.
 
virtual void SoAFunctorPair (SoAView< SoAArraysType > soa1, SoAView< SoAArraysType > soa2, bool newton3)
 PairwiseFunctor for structure of arrays (SoA)
 
- Public Member Functions inherited from autopas::Functor< Particle_T, CRTP_T >
 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 Public Member Functions inherited from autopas::Functor< Particle_T, CRTP_T >
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

- Public Types inherited from autopas::PairwiseFunctor< Particle_T, CRTP_T >
using SoAArraysType = typename Particle_T::SoAArraysType
 Structure of the SoAs defined by the particle.
 
- Public Types inherited from autopas::Functor< Particle_T, CRTP_T >
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.
 

Detailed Description

template<class Particle_T, bool applyShift = false, bool useMixing = false, autopas::FunctorN3Modes useNewton3 = autopas::FunctorN3Modes::Both, bool calculateGlobals = false, bool countFLOPs = false, bool relevantForTuning = true>
class mdLib::LJMultisiteFunctor< Particle_T, applyShift, useMixing, useNewton3, calculateGlobals, countFLOPs, relevantForTuning >

A functor to handle Lennard-Jones interactions between two Multisite Molecules.

Template Parameters
Particle_TThe type of particle.
applyShiftFlag for the LJ potential to have a truncated shift.
useMixingFlag for if the functor is 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.
Warning
: Whilst this class allows for mixing to be disabled, this feature is not of much value in real applications and as such is experimental only and untested!
Template Parameters
useNewton3Switch for the functor to support newton3 on, off, or both. See FunctorN3Nodes for possible values.
calculateGlobalsDefines whether the global values are to be calculated (energy, virial).
relevantForTuningWhether or not the auto-tuner should consider this functor.
countFLOPscounts FLOPs and hitrate. Currently not implemented as this functor is problematically bad and will be replaced.

Constructor & Destructor Documentation

◆ LJMultisiteFunctor() [1/2]

template<class Particle_T , bool applyShift = false, bool useMixing = false, autopas::FunctorN3Modes useNewton3 = autopas::FunctorN3Modes::Both, bool calculateGlobals = false, bool countFLOPs = false, bool relevantForTuning = true>
mdLib::LJMultisiteFunctor< Particle_T, applyShift, useMixing, useNewton3, calculateGlobals, countFLOPs, relevantForTuning >::LJMultisiteFunctor ( double  cutoff)
inlineexplicit

Constructor for Functor with particle mixing disabled.

setParticleProperties() must be called.

Note
Only to be used with mixing == false
Parameters
cutoff

◆ LJMultisiteFunctor() [2/2]

template<class Particle_T , bool applyShift = false, bool useMixing = false, autopas::FunctorN3Modes useNewton3 = autopas::FunctorN3Modes::Both, bool calculateGlobals = false, bool countFLOPs = false, bool relevantForTuning = true>
mdLib::LJMultisiteFunctor< Particle_T, applyShift, useMixing, useNewton3, calculateGlobals, countFLOPs, relevantForTuning >::LJMultisiteFunctor ( double  cutoff,
ParticlePropertiesLibrary< double, size_t > &  particlePropertiesLibrary 
)
inlineexplicit

Constructor for Functor with particle mixing enabled.

Calculating global attributes is done with the center of mass and overall forces applied

Parameters
cutoff
particlePropertiesLibraryLibrary used to look up the properties of each type of particle e.g. sigma, epsilon, shift.

Member Function Documentation

◆ allowsNewton3()

template<class Particle_T , bool applyShift = false, bool useMixing = false, autopas::FunctorN3Modes useNewton3 = autopas::FunctorN3Modes::Both, bool calculateGlobals = false, bool countFLOPs = false, bool relevantForTuning = true>
bool mdLib::LJMultisiteFunctor< Particle_T, applyShift, useMixing, useNewton3, calculateGlobals, countFLOPs, relevantForTuning >::allowsNewton3 ( )
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.

Returns
true if and only if this functor provides an interface to Newton3-like functions.

Implements autopas::Functor< Particle_T, CRTP_T >.

◆ allowsNonNewton3()

template<class Particle_T , bool applyShift = false, bool useMixing = false, autopas::FunctorN3Modes useNewton3 = autopas::FunctorN3Modes::Both, bool calculateGlobals = false, bool countFLOPs = false, bool relevantForTuning = true>
bool mdLib::LJMultisiteFunctor< Particle_T, applyShift, useMixing, useNewton3, calculateGlobals, countFLOPs, relevantForTuning >::allowsNonNewton3 ( )
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.

Returns
true if and only if this functor provides an interface to functions that do not utilize Newton3.

Implements autopas::Functor< Particle_T, CRTP_T >.

◆ AoSFunctor()

template<class Particle_T , bool applyShift = false, bool useMixing = false, autopas::FunctorN3Modes useNewton3 = autopas::FunctorN3Modes::Both, bool calculateGlobals = false, bool countFLOPs = false, bool relevantForTuning = true>
void mdLib::LJMultisiteFunctor< Particle_T, applyShift, useMixing, useNewton3, calculateGlobals, countFLOPs, relevantForTuning >::AoSFunctor ( Particle_T &  particleA,
Particle_T &  particleB,
bool  newton3 
)
inlinefinalvirtual

Functor for arrays of structures (AoS).

Parameters
particleAParticle A
particleBParticle B
newton3Flag for if newton3 is used.

Reimplemented from autopas::PairwiseFunctor< Particle_T, CRTP_T >.

◆ endTraversal()

template<class Particle_T , bool applyShift = false, bool useMixing = false, autopas::FunctorN3Modes useNewton3 = autopas::FunctorN3Modes::Both, bool calculateGlobals = false, bool countFLOPs = false, bool relevantForTuning = true>
void mdLib::LJMultisiteFunctor< Particle_T, applyShift, useMixing, useNewton3, calculateGlobals, countFLOPs, relevantForTuning >::endTraversal ( bool  newton3)
inlinefinalvirtual

Postprocesses global values, e.g.

potential energy & virial

Parameters
newton3

Reimplemented from autopas::Functor< Particle_T, CRTP_T >.

◆ getComputedAttr()

template<class Particle_T , bool applyShift = false, bool useMixing = false, autopas::FunctorN3Modes useNewton3 = autopas::FunctorN3Modes::Both, bool calculateGlobals = false, bool countFLOPs = false, bool relevantForTuning = true>
static constexpr auto mdLib::LJMultisiteFunctor< Particle_T, applyShift, useMixing, useNewton3, calculateGlobals, countFLOPs, relevantForTuning >::getComputedAttr ( )
inlinestaticconstexpr

Get attributes computed by this functor.

Returns
Attributes computed by this functor.
Todo:
C++20: make this function virtual

◆ getMixing()

template<class Particle_T , bool applyShift = false, bool useMixing = false, autopas::FunctorN3Modes useNewton3 = autopas::FunctorN3Modes::Both, bool calculateGlobals = false, bool countFLOPs = false, bool relevantForTuning = true>
static constexpr bool mdLib::LJMultisiteFunctor< Particle_T, applyShift, useMixing, useNewton3, calculateGlobals, countFLOPs, relevantForTuning >::getMixing ( )
inlinestaticconstexpr
Returns
useMixing

◆ getName()

template<class Particle_T , bool applyShift = false, bool useMixing = false, autopas::FunctorN3Modes useNewton3 = autopas::FunctorN3Modes::Both, bool calculateGlobals = false, bool countFLOPs = false, bool relevantForTuning = true>
std::string mdLib::LJMultisiteFunctor< Particle_T, applyShift, useMixing, useNewton3, calculateGlobals, countFLOPs, relevantForTuning >::getName ( )
inlinefinalvirtual

Returns name of functor.

Intended for use with the iteration logger, to differentiate between calls to computeInteractions using different functors in the logs.

Returns
name of functor.

Implements autopas::Functor< Particle_T, CRTP_T >.

◆ getNeededAttr() [1/2]

template<class Particle_T , bool applyShift = false, bool useMixing = false, autopas::FunctorN3Modes useNewton3 = autopas::FunctorN3Modes::Both, bool calculateGlobals = false, bool countFLOPs = false, bool relevantForTuning = true>
static constexpr auto mdLib::LJMultisiteFunctor< Particle_T, applyShift, useMixing, useNewton3, calculateGlobals, countFLOPs, relevantForTuning >::getNeededAttr ( )
inlinestaticconstexpr

Get attributes needed for computation.

Returns
Attributes needed for computation.
Todo:
C++20: make this function virtual

◆ getNeededAttr() [2/2]

template<class Particle_T , bool applyShift = false, bool useMixing = false, autopas::FunctorN3Modes useNewton3 = autopas::FunctorN3Modes::Both, bool calculateGlobals = false, bool countFLOPs = false, bool relevantForTuning = true>
static constexpr auto mdLib::LJMultisiteFunctor< Particle_T, applyShift, useMixing, useNewton3, calculateGlobals, countFLOPs, relevantForTuning >::getNeededAttr ( std::false_type  )
inlinestaticconstexpr

Get attributes needed for computation without N3 optimization.

Returns
Attributes needed for computation.
Todo:
C++20: make this function virtual

◆ getNumFlopsPerKernelCall()

template<class Particle_T , bool applyShift = false, bool useMixing = false, autopas::FunctorN3Modes useNewton3 = autopas::FunctorN3Modes::Both, bool calculateGlobals = false, bool countFLOPs = false, bool relevantForTuning = true>
unsigned long mdLib::LJMultisiteFunctor< Particle_T, applyShift, useMixing, useNewton3, calculateGlobals, countFLOPs, relevantForTuning >::getNumFlopsPerKernelCall ( size_t  molAType,
size_t  molBType,
bool  newton3 
)
inline

Get the number of flops used per kernel call - i.e.

number of flops to calculate kernel given the two particles lie within the cutoff (i.e. distance^2 / cutoff has been already been calculated). Note: there is currently a large difference between AoS & SoA number of flops. This function returns the AoS number of flops.

Parameters
molATypemolecule A's type id
molBTypemolecule B's type id
newton3true if newton3 optimizations enabled
Returns
Number of FLOPs

◆ getPotentialEnergy()

template<class Particle_T , bool applyShift = false, bool useMixing = false, autopas::FunctorN3Modes useNewton3 = autopas::FunctorN3Modes::Both, bool calculateGlobals = false, bool countFLOPs = false, bool relevantForTuning = true>
double mdLib::LJMultisiteFunctor< Particle_T, applyShift, useMixing, useNewton3, calculateGlobals, countFLOPs, relevantForTuning >::getPotentialEnergy ( )
inline

Get the potential energy.

Returns
the potential energy

◆ getVirial()

template<class Particle_T , bool applyShift = false, bool useMixing = false, autopas::FunctorN3Modes useNewton3 = autopas::FunctorN3Modes::Both, bool calculateGlobals = false, bool countFLOPs = false, bool relevantForTuning = true>
double mdLib::LJMultisiteFunctor< Particle_T, applyShift, useMixing, useNewton3, calculateGlobals, countFLOPs, relevantForTuning >::getVirial ( )
inline

Get the virial.

Returns
the virial

◆ initTraversal()

template<class Particle_T , bool applyShift = false, bool useMixing = false, autopas::FunctorN3Modes useNewton3 = autopas::FunctorN3Modes::Both, bool calculateGlobals = false, bool countFLOPs = false, bool relevantForTuning = true>
void mdLib::LJMultisiteFunctor< Particle_T, applyShift, useMixing, useNewton3, calculateGlobals, countFLOPs, relevantForTuning >::initTraversal ( )
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 >.

◆ isRelevantForTuning()

template<class Particle_T , bool applyShift = false, bool useMixing = false, autopas::FunctorN3Modes useNewton3 = autopas::FunctorN3Modes::Both, bool calculateGlobals = false, bool countFLOPs = false, bool relevantForTuning = true>
bool mdLib::LJMultisiteFunctor< Particle_T, applyShift, useMixing, useNewton3, calculateGlobals, countFLOPs, relevantForTuning >::isRelevantForTuning ( )
inlinefinalvirtual

Specifies whether the functor should be considered for the auto-tuning process.

Returns
true if and only if this functor is relevant for auto-tuning.

Implements autopas::Functor< Particle_T, CRTP_T >.

◆ setParticleProperties()

template<class Particle_T , bool applyShift = false, bool useMixing = false, autopas::FunctorN3Modes useNewton3 = autopas::FunctorN3Modes::Both, bool calculateGlobals = false, bool countFLOPs = false, bool relevantForTuning = true>
void mdLib::LJMultisiteFunctor< Particle_T, applyShift, useMixing, useNewton3, calculateGlobals, countFLOPs, relevantForTuning >::setParticleProperties ( SoAFloatPrecision  epsilon24,
SoAFloatPrecision  sigmaSquared,
std::vector< std::array< SoAFloatPrecision, 3 > >  sitePositionsLJ 
)
inline

Sets the molecule properties constants for this functor.

This is only necessary if no particlePropertiesLibrary is used.

Parameters
epsilon24epsilon * 24
sigmaSquaredsigma^2
sitePositionsLJvector of 3D relative unrotated untranslated site positions

◆ SoAFunctorPair()

template<class Particle_T , bool applyShift = false, bool useMixing = false, autopas::FunctorN3Modes useNewton3 = autopas::FunctorN3Modes::Both, bool calculateGlobals = false, bool countFLOPs = false, bool relevantForTuning = true>
void mdLib::LJMultisiteFunctor< Particle_T, applyShift, useMixing, useNewton3, calculateGlobals, countFLOPs, relevantForTuning >::SoAFunctorPair ( autopas::SoAView< SoAArraysType >  soa1,
autopas::SoAView< SoAArraysType >  soa2,
const bool  newton3 
)
inlinefinalvirtual

PairwiseFunctor for structure of arrays (SoA)

This functor should calculate the forces or any other pair-wise interaction between all particles of soa1 and soa2. This should include a cutoff check if needed!

Parameters
soa1First structure of arrays.
soa2Second structure of arrays.
newton3defines whether or whether not to use newton 3

Reimplemented from autopas::PairwiseFunctor< Particle_T, CRTP_T >.

◆ SoAFunctorSingle()

template<class Particle_T , bool applyShift = false, bool useMixing = false, autopas::FunctorN3Modes useNewton3 = autopas::FunctorN3Modes::Both, bool calculateGlobals = false, bool countFLOPs = false, bool relevantForTuning = true>
void mdLib::LJMultisiteFunctor< Particle_T, applyShift, useMixing, useNewton3, calculateGlobals, countFLOPs, relevantForTuning >::SoAFunctorSingle ( autopas::SoAView< SoAArraysType >  soa,
bool  newton3 
)
inlinefinalvirtual

PairwiseFunctor for structure of arrays (SoA)

This functor should calculate the forces or any other pair-wise interaction between all particles in an soa. This should include a cutoff check if needed!

Parameters
soaStructure of arrays
newton3defines whether or whether not to use newton 3 This functor will always use a newton3 like traversing of the soa, however, it still needs to know about newton3 to use it correctly for the global values.

Reimplemented from autopas::PairwiseFunctor< Particle_T, CRTP_T >.

◆ SoAFunctorVerlet()

template<class Particle_T , bool applyShift = false, bool useMixing = false, autopas::FunctorN3Modes useNewton3 = autopas::FunctorN3Modes::Both, bool calculateGlobals = false, bool countFLOPs = false, bool relevantForTuning = true>
void mdLib::LJMultisiteFunctor< Particle_T, applyShift, useMixing, useNewton3, calculateGlobals, countFLOPs, relevantForTuning >::SoAFunctorVerlet ( autopas::SoAView< SoAArraysType >  soa,
const size_t  indexFirst,
const std::vector< size_t, autopas::AlignedAllocator< size_t > > &  neighborList,
bool  newton3 
)
inlinefinalvirtual

PairwiseFunctor for structure of arrays (SoA) for neighbor lists.

This functor should calculate the forces or any other pair-wise interaction between the particle in the SoA with index indexFirst and all particles with indices in the neighborList. This should include a cutoff check if needed!

Parameters
soaStructure of arrays
indexFirstThe index of the first particle for each interaction
neighborListThe list of neighbors
newton3defines whether or whether not to use newton 3

Reimplemented from autopas::PairwiseFunctor< Particle_T, CRTP_T >.


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