n2p2 - A neural network potential package
nnp::EwaldTruncJackson Class Reference

#include <EwaldTruncJackson.h>

Inheritance diagram for nnp::EwaldTruncJackson:
Collaboration diagram for nnp::EwaldTruncJackson:

Public Member Functions

void calculateParameters (EwaldGlobalSettings const &settings, EwaldStructureData const &sData, EwaldParameters &params) override
 
bool publishedNewCutoffs () override
 
virtual bool isEstimateReliable (EwaldGlobalSettings const &, EwaldParameters const &) const override
 
- Public Member Functions inherited from nnp::IEwaldTrunc
virtual void calculateParameters (EwaldGlobalSettings const &settings, EwaldStructureData const &sData, EwaldParameters &params)=0
 
virtual bool publishedNewCutoffs ()=0
 
virtual bool isEstimateReliable (EwaldGlobalSettings const &settings, EwaldParameters const &params) const =0
 
virtual ~IEwaldTrunc ()=default
 

Private Member Functions

double calculateEta () const
 
double calculateRCut (double const eta, double const prec) const
 
double calculateKCut (double const eta, double const prec) const
 

Private Attributes

bool newCutoffs = true
 
bool newCutoffsWerePublished = false
 
double volume = 0.0
 

Detailed Description

Definition at line 11 of file EwaldTruncJackson.h.

Member Function Documentation

◆ calculateParameters()

void nnp::EwaldTruncJackson::calculateParameters ( EwaldGlobalSettings const &  settings,
EwaldStructureData const &  sData,
EwaldParameters params 
)
overridevirtual

Implements nnp::IEwaldTrunc.

Definition at line 12 of file EwaldTruncJackson.cpp.

15 {
16 double V = sData.getVolume();
17 newCutoffs = (V != volume);
18 if (!newCutoffs) return;
20 volume = V;
21
22 if ( settings.precision >= 1.0 )
23 throw std::runtime_error("ERROR: Ewald truncation method 0 "
24 "(Jackson) requires precision < 1.0");
25 params.eta = calculateEta();
26 if ( params.eta <= 0.0 )
27 throw std::runtime_error("ERROR: Ewald screening parameter eta is "
28 "not positive, is the unit cell volume "
29 "correct?");
30 params.rCut = calculateRCut(params.eta, settings.precision);
31 params.kCut = calculateKCut(params.eta, settings.precision);
32 return;
33 }
double calculateRCut(double const eta, double const prec) const
double calculateKCut(double const eta, double const prec) const

References calculateEta(), calculateKCut(), calculateRCut(), nnp::EwaldParameters::eta, nnp::EwaldStructureData::getVolume(), nnp::EwaldParameters::kCut, newCutoffs, newCutoffsWerePublished, nnp::EwaldGlobalSettings::precision, nnp::EwaldParameters::rCut, and volume.

Here is the call graph for this function:

◆ publishedNewCutoffs()

bool nnp::EwaldTruncJackson::publishedNewCutoffs ( )
overridevirtual

Implements nnp::IEwaldTrunc.

Definition at line 35 of file EwaldTruncJackson.cpp.

36 {
37 bool answer = newCutoffsWerePublished;
39 return answer;
40 }

References newCutoffsWerePublished.

◆ isEstimateReliable()

virtual bool nnp::EwaldTruncJackson::isEstimateReliable ( EwaldGlobalSettings const &  ,
EwaldParameters const &   
) const
inlineoverridevirtual

Implements nnp::IEwaldTrunc.

Definition at line 18 of file EwaldTruncJackson.h.

20 {return true;};

◆ calculateEta()

double nnp::EwaldTruncJackson::calculateEta ( ) const
private

Definition at line 42 of file EwaldTruncJackson.cpp.

43 {
44 // Matrix version of eta.
45 return 1.0 / sqrt(2.0 * M_PI) * pow(volume, 1.0 / 3.0);
46 }

References volume.

Referenced by calculateParameters().

Here is the caller graph for this function:

◆ calculateRCut()

double nnp::EwaldTruncJackson::calculateRCut ( double const  eta,
double const  prec 
) const
private

Definition at line 48 of file EwaldTruncJackson.cpp.

50 {
51 return sqrt(-2.0 * log(prec)) * eta;
52 }

Referenced by calculateParameters().

Here is the caller graph for this function:

◆ calculateKCut()

double nnp::EwaldTruncJackson::calculateKCut ( double const  eta,
double const  prec 
) const
private

Definition at line 54 of file EwaldTruncJackson.cpp.

56 {
57 return sqrt(-2.0 * log(prec)) / eta;
58 }

Referenced by calculateParameters().

Here is the caller graph for this function:

Member Data Documentation

◆ newCutoffs

bool nnp::EwaldTruncJackson::newCutoffs = true
private

Definition at line 22 of file EwaldTruncJackson.h.

Referenced by calculateParameters().

◆ newCutoffsWerePublished

bool nnp::EwaldTruncJackson::newCutoffsWerePublished = false
private

Definition at line 23 of file EwaldTruncJackson.h.

Referenced by calculateParameters(), and publishedNewCutoffs().

◆ volume

double nnp::EwaldTruncJackson::volume = 0.0
private

Definition at line 24 of file EwaldTruncJackson.h.

Referenced by calculateEta(), and calculateParameters().


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