A MetaDynamics Package
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Groups Pages
Public Member Functions | Static Public Member Functions | List of all members
SSAGES::BoxVolumeCV Class Reference

Collective variable on the volume of a box. More...

#include <BoxVolumeCV.h>

Inheritance diagram for SSAGES::BoxVolumeCV:
Inheritance graph

Public Member Functions

 BoxVolumeCV ()
void Initialize (const Snapshot &snapshot) override
 Initialize the CV.
void Evaluate (const Snapshot &snapshot) override
 Evaluate the CV. More...
- Public Member Functions inherited from SSAGES::CollectiveVariable
 CollectiveVariable ()
double GetValue () const
 Get current value of the CV. More...
virtual double GetMinimumImage (double) const
 Returns the minimum image of a CV based on the input location. More...
virtual double GetPeriodicValue (double location) const
 Apply periodic boundaries to a given value. More...
const std::vector< Vector3 > & GetGradient () const
 Get current gradient of the CV. More...
const Matrix3GetBoxGradient () const
 Get gradient contribution to box.
const std::array< double, 2 > & GetBoundaries ()
 Get CV boundaries. More...
virtual double GetDifference (double location) const

Static Public Member Functions

static BoxVolumeCVBuild (const Json::Value &json, const std::string &path)
- Static Public Member Functions inherited from SSAGES::CollectiveVariable
static CollectiveVariableBuildCV (const Json::Value &json, const std::string &path)
 Set up collective variable. More...

Additional Inherited Members

- Protected Attributes inherited from SSAGES::CollectiveVariable
std::vector< Vector3grad_
 Gradient vector dCv/dxi.
Matrix3 boxgrad_
 Gradient w.r.t box vectors dCv/dHij.
double val_
 Current value of CV.
std::array< double, 2 > bounds_
 Bounds on CV.

Detailed Description

Collective variable on the volume of a box.

Collective variable on the volume of a box.

Definition at line 36 of file BoxVolumeCV.h.

Member Function Documentation

void SSAGES::BoxVolumeCV::Evaluate ( const Snapshot snapshot)

Evaluate the CV.

snapshotCurrent simulation snapshot.

Definition at line 52 of file BoxVolumeCV.h.

References SSAGES::CollectiveVariable::boxgrad_, SSAGES::Snapshot::GetCommunicator(), SSAGES::Snapshot::GetNumAtoms(), SSAGES::Snapshot::GetVolume(), SSAGES::CollectiveVariable::grad_, and SSAGES::CollectiveVariable::val_.

53  {
54  // Fill empty gradient.
55  auto n = snapshot.GetNumAtoms();
56  std::fill(grad_.begin(), grad_.end(), Vector3{0,0,0});
57  grad_.resize(n, Vector3{0,0,0});
59  val_ = snapshot.GetVolume();
60  if(snapshot.GetCommunicator().rank() == 0)
61  boxgrad_ = val_*Matrix3::Identity();
62  }
std::vector< Vector3 > grad_
Gradient vector dCv/dxi.
Eigen::Vector3d Vector3
Three-dimensional vector.
Definition: types.h:33
double val_
Current value of CV.
Matrix3 boxgrad_
Gradient w.r.t box vectors dCv/dHij.

Here is the call graph for this function:

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