faunus
Public Member Functions | Public Attributes | List of all members
Faunus::pairpotential::CombinedPairPotential< T1, T2 > Struct Template Reference

Statically combines two pair potentials at compile-time. More...

#include <potentials_base.h>

Inheritance diagram for Faunus::pairpotential::CombinedPairPotential< T1, T2 >:
Inheritance graph
[legend]
Collaboration diagram for Faunus::pairpotential::CombinedPairPotential< T1, T2 >:
Collaboration graph
[legend]

Public Member Functions

 CombinedPairPotential (const std::string &name="")
 
double operator() (const Particle &particle_a, const Particle &particle_b, const double squared_distance, const Point &b_towards_a={0, 0, 0}) const override
 Combine pair energy.
 
Point force (const Particle &particle_a, const Particle &particle_b, const double squared_distance, const Point &b_towards_a) const override
 Calculates force on particle a due to another particle, b. More...
 
void from_json (const json &j) override
 
void to_json (json &j) const override
 

Public Attributes

T1 first
 First pair potential of type T1.
 
T2 second
 Second pair potential of type T2.
 
- Public Attributes inherited from Faunus::pairpotential::PairPotential
std::string name
 unique name per polymorphic call; used in FunctorPotential::combinePairPotentials
 
std::string cite
 Typically a short-doi litterature reference.
 
bool isotropic = true
 true if pair-potential is independent of particle orientation
 
std::function< double(const Particle &)> selfEnergy = nullptr
 self energy of particle (kT)
 

Additional Inherited Members

- Protected Member Functions inherited from Faunus::pairpotential::PairPotential
 PairPotential (std::string name=std::string(), std::string cite=std::string(), bool isotropic=true)
 

Detailed Description

template<RequirePairPotential T1, RequirePairPotential T2>
struct Faunus::pairpotential::CombinedPairPotential< T1, T2 >

Statically combines two pair potentials at compile-time.

This is the most efficient way to combining pair-potentials due to the possibility for compile-time optimisation.

Member Function Documentation

◆ force()

template<RequirePairPotential T1, RequirePairPotential T2>
Point Faunus::pairpotential::CombinedPairPotential< T1, T2 >::force ( const Particle particle_a,
const Particle particle_b,
const double  squared_distance,
const Point b_towards_a 
) const
inlineoverridevirtual

Calculates force on particle a due to another particle, b.

Parameters
particle_aParticle a
particle_bParticle b
squared_distanceSquared norm |𝐚-𝐛|²
b_towards_aDistance vector 𝐛 -> 𝐚 = 𝐚 - 𝐛
Returns
Force on particle a due to particle bCombine force

Reimplemented from Faunus::pairpotential::PairPotential.


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