SSAGES  0.9.3
Software Suite for Advanced General Ensemble Simulations
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
SSAGES::GaussianPK Class Reference

Gaussian Function. More...

#include <PairwiseKernel.h>

Inheritance diagram for SSAGES::GaussianPK:
Inheritance graph
[legend]

Public Member Functions

 GaussianPK (double mu, double sigma)
 Constructor. More...
 
double Evaluate (double rij, double &df) const
 Evaluate the pairwise kernel function. More...
 
- Public Member Functions inherited from SSAGES::PairwiseKernel
virtual ~PairwiseKernel ()
 Destructor.
 

Static Public Member Functions

static GaussianPKBuild (const Json::Value &json, const std::string &path)
 Build GaussianPK from JSON value. More...
 
- Static Public Member Functions inherited from SSAGES::PairwiseKernel
static PairwiseKernelBuild (const Json::Value &json, const std::string &path)
 Build PairwiseKernel from JSON value. More...
 

Private Attributes

double mu_
 Center of Gaussian.
 
double sigma_
 Width of Gaussian.
 

Detailed Description

Gaussian Function.

A standard Gaussian function (also called a "bell curve").

Definition at line 76 of file PairwiseKernel.h.

Constructor & Destructor Documentation

◆ GaussianPK()

SSAGES::GaussianPK::GaussianPK ( double  mu,
double  sigma 
)
inline

Constructor.

Parameters
muCenter of Gaussian.
sigmaWidth of Gaussian.

Construct a GaussianPK.

Definition at line 91 of file PairwiseKernel.h.

91  :
92  mu_(mu), sigma_(sigma) {}
double sigma_
Width of Gaussian.
double mu_
Center of Gaussian.

Referenced by Build().

Here is the caller graph for this function:

Member Function Documentation

◆ Build()

GaussianPK * SSAGES::GaussianPK::Build ( const Json::Value &  json,
const std::string &  path 
)
static

Build GaussianPK from JSON value.

Parameters
jsonJSON value node.
pathPath for JSON path specification.
Returns
Pointer to new GaussianPK.
Parameters
jsonJSON value node.
Returns
Pointer to new GaussianPK.

Definition at line 47 of file PairwiseKernel.cpp.

48  {
49  Json::ObjectRequirement validator;
50  Json::Value schema;
51  Json::CharReaderBuilder rbuilder;
52  Json::CharReader* reader = rbuilder.newCharReader();
53 
54  reader->parse(JsonSchema::GaussianPK.c_str(),
55  JsonSchema::GaussianPK.c_str() + JsonSchema::GaussianPK.size(),
56  &schema, nullptr);
57  validator.Parse(schema, path);
58 
59  // Validate inputs.
60  validator.Validate(json, path);
61  if(validator.HasErrors())
62  throw BuildException(validator.GetErrors());
63 
64  return new GaussianPK(
65  json["mu"].asDouble(),
66  json["sigma"].asDouble()
67  );
68  }
Requirements on an object.
virtual void Parse(Value json, const std::string &path) override
Parse JSON value to generate Requirement(s).
virtual void Validate(const Value &json, const std::string &path) override
Validate JSON value.
std::vector< std::string > GetErrors()
Get list of error messages.
Definition: Requirement.h:92
bool HasErrors()
Check if errors have occured.
Definition: Requirement.h:86
GaussianPK(double mu, double sigma)
Constructor.

References GaussianPK(), Json::Requirement::GetErrors(), Json::Requirement::HasErrors(), Json::ObjectRequirement::Parse(), and Json::ObjectRequirement::Validate().

Referenced by SSAGES::PairwiseKernel::Build().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Evaluate()

double SSAGES::GaussianPK::Evaluate ( double  rij,
double &  df 
) const
inlinevirtual

Evaluate the pairwise kernel function.

Parameters
rijdistance between two atoms.
dfReference to variable which will store the gradient.
Returns
value of pairwise kernel function.

Implements SSAGES::PairwiseKernel.

Definition at line 94 of file PairwiseKernel.h.

95  {
96  const auto dx = (rij - mu_)/sigma_;
97  const auto f = exp( - dx*dx/2.);
98  const auto pre = - dx/sigma_;
99 
100  df = pre * f;
101  return f;
102  }

References mu_, and sigma_.


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