SSAGES  0.8.3
Software Suite for Advanced General Ensemble Simulations
Public Member Functions | Static Public Member Functions | List of all members
SSAGES::Fourier Class Reference

Defines the class of Fourier polynomials. More...

#include <Basis.h>

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

Public Member Functions

 Fourier (unsigned int polyOrd, double boundLow, double boundUp, unsigned int nbins)
 Constructor. More...
 
double Evaluate (double x, int n)
 Calculates the output of the basis function. More...
 
double EvalGrad (double x, int n)
 Calculates the gradient of the basis function. More...
 
double GetNorm (int)
 Gets the norm of the basis function. More...
 
- Public Member Functions inherited from SSAGES::BasisFunction
 BasisFunction (unsigned int polyOrd, unsigned int nbins, bool isFinite, bool zeroOrder, double boundLow, double boundUp)
 Constructor. More...
 
unsigned int GetOrder ()
 Gets the order of the current polynomial.
 
unsigned int GetBins ()
 Gets the number of bins for the discretization.
 
bool GetZeroOrder ()
 Gets the flag for constant-order polynomials.
 
double GetLower ()
 Gets the lower bound on the CV.
 
double GetUpper ()
 Gets the upper bound on the CV.
 
double GetRange ()
 Gets the magnitude of the range of bounds.
 
virtual double Weight (double val)
 Calculates the gradient of the basis function. More...
 
virtual ~BasisFunction ()
 Destructor.
 

Static Public Member Functions

static FourierBuild (const Json::Value &json, const std::string &path, unsigned int nbins)
 Build the Fourier polynomial.
 
- Static Public Member Functions inherited from SSAGES::BasisFunction
static BasisFunctionBuild (const Json::Value &json, const std::string &path, unsigned int nbins)
 Build BasisFunction from JSON value. More...
 

Additional Inherited Members

- Protected Attributes inherited from SSAGES::BasisFunction
unsigned int polyOrd_
 Order of the polynomial.
 
unsigned int nbins_
 Number of bins.
 
bool isFinite_
 Flag for finite-range polynomials.
 
bool zeroOrder_
 Flag for constant-order polynomials.
 
double boundLow_
 Lower bound on CV.
 
double boundUp_
 Upper bound on CV.
 

Detailed Description

Defines the class of Fourier polynomials.

Definition at line 284 of file Basis.h.

Constructor & Destructor Documentation

◆ Fourier()

SSAGES::Fourier::Fourier ( unsigned int  polyOrd,
double  boundLow,
double  boundUp,
unsigned int  nbins 
)
inline

Constructor.

Parameters
polyOrdOrder of Fourier polynomial.
boundLowLower bounds of restraint springs.
boundUpUpper bounds of restraint springs.
nbinsNumber of bins.

Constructs an instance of the Fourier function class.

Definition at line 298 of file Basis.h.

298  :
299  BasisFunction(polyOrd, nbins, true, true, boundLow, boundUp)
300  {
301  }
BasisFunction(unsigned int polyOrd, unsigned int nbins, bool isFinite, bool zeroOrder, double boundLow, double boundUp)
Constructor.
Definition: Basis.h:84

Member Function Documentation

◆ EvalGrad()

double SSAGES::Fourier::EvalGrad ( double  val,
int  order 
)
inlinevirtual

Calculates the gradient of the basis function.

Parameters
valInput value for function.
orderOrder of the polynomial.
Returns
Gradient for function.

Reimplemented from SSAGES::BasisFunction.

Definition at line 314 of file Basis.h.

315  {
316  return n == 0 ? 0.0 :
317  n % 2 == 0 ? (-2.0*floor(double(n)*0.5)*M_PI/(boundUp_-boundLow_))*(std::sin(2.0*floor(double(n)*0.5)*M_PI*x/(boundUp_-boundLow_))) :
318  (2.0*floor(double(n)*0.5)*M_PI/(boundUp_-boundLow_))*std::cos(2.0*floor(double(n)*0.5)*M_PI*x/(boundUp_-boundLow_));
319  }
double boundUp_
Upper bound on CV.
Definition: Basis.h:69
double boundLow_
Lower bound on CV.
Definition: Basis.h:68

◆ Evaluate()

double SSAGES::Fourier::Evaluate ( double  val,
int  order 
)
inlinevirtual

Calculates the output of the basis function.

Parameters
valInput value for function.
orderOrder of the polynomial.
Returns
Output value for function.

Reimplemented from SSAGES::BasisFunction.

Definition at line 306 of file Basis.h.

307  {
308  return n == 0 ? 0.5 :
309  n % 2 == 1 ? std::sin(2.0*floor(double(n)*0.5)*M_PI*x/(boundUp_-boundLow_)) :
310  std::cos(2.0*floor(double(n)*0.5)*M_PI*x/(boundUp_-boundLow_));
311  }
STL namespace.
double boundUp_
Upper bound on CV.
Definition: Basis.h:69
double boundLow_
Lower bound on CV.
Definition: Basis.h:68

◆ GetNorm()

double SSAGES::Fourier::GetNorm ( int  order)
inlinevirtual

Gets the norm of the basis function.

Parameters
orderOrder of the polynomial.
Returns
Norm of a specific order of polynomial.

Reimplemented from SSAGES::BasisFunction.

Definition at line 321 of file Basis.h.

322  {
323  //Assumes the period of the function is the range of the CV
324  return 2.0/(boundUp_-boundLow_);
325  }
double boundUp_
Upper bound on CV.
Definition: Basis.h:69
double boundLow_
Lower bound on CV.
Definition: Basis.h:68

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