SSAGES  0.1
A MetaDynamics Package
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Groups Pages
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 Gaussian function. More...
 

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 72 of file PairwiseKernel.h.

Constructor & Destructor Documentation

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

Constructor.

Parameters
muCenter of Gaussian.
sigmaWidth of Gaussian.

Construct a GaussianPK.

Definition at line 87 of file PairwiseKernel.h.

Referenced by Build().

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

Here is the caller graph for this function:

Member Function Documentation

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

Build GaussianPK from JSON value.

Parameters
jsonJSON value node.
Returns
Pointer to new GaussianPK.

Definition at line 47 of file PairwiseKernel.cpp.

References GaussianPK(), 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::Reader reader;
52 
53  reader.parse(JsonSchema::GaussianPK, schema);
54  validator.Parse(schema, path);
55 
56  // Validate inputs.
57  validator.Validate(json, path);
58  if(validator.HasErrors())
59  throw BuildException(validator.GetErrors());
60 
61  return new GaussianPK(
62  json["mu"].asDouble(),
63  json["sigma"].asDouble()
64  );
65  }
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)
Constructor.
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:

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

Evaluate the Gaussian function.

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

Implements SSAGES::PairwiseKernel.

Definition at line 97 of file PairwiseKernel.h.

References mu_, and sigma_.

98  {
99  const auto dx = (rij - mu_)/sigma_;
100  const auto f = exp( - dx*dx/2.);
101  const auto pre = - dx/sigma_;
102 
103  df = pre * f;
104  return f;
105  }
double mu_
Center of Gaussian.
double sigma_
Width of Gaussian.

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