SSAGES  0.8.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

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 ()

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 


muCenter of Gaussian.
sigmaWidth of Gaussian.

Construct a GaussianPK.

Definition at line 91 of file PairwiseKernel.h.

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

Member Function Documentation

◆ Build()

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

Build GaussianPK from JSON value.

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

Definition at line 47 of file PairwiseKernel.cpp.

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

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

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

Evaluate the pairwise kernel function.

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

Implements SSAGES::PairwiseKernel.

Definition at line 94 of file PairwiseKernel.h.

References SSAGES::PairwiseKernel::Build().

95  {
96  const auto dx = (rij - mu_)/sigma_;
97  const auto f = exp( - dx*dx/2.);
98  const auto pre = - dx/sigma_;
100  df = pre * f;
101  return f;
102  }
double mu_
Center of Gaussian.
double sigma_
Width of Gaussian.
Here is the call graph for this function:

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