SSAGES  0.9.3
Software Suite for Advanced General Ensemble Simulations
CollectiveVariable.cpp
1 
22 #include "CollectiveVariable.h"
23 #include "AlphaRMSDCV.h"
24 #include "CVManager.h"
25 #include "AngleCV.h"
26 #include "ANNCV.h"
27 #include "AntiBetaRMSDCV.h"
28 #include "BoxVolumeCV.h"
29 #include "GyrationTensorCV.h"
30 #include "PairwiseCV.h"
31 #include "ParallelBetaRMSDCV.h"
32 #include "ParticleCoordinateCV.h"
33 #include "ParticlePositionCV.h"
34 #include "ParticleSeparationCV.h"
35 #include "RouseModeCV.h"
36 #include "TorsionalCV.h"
37 #include "RMSDCV.h"
38 #include "json/json.h"
39 #include <stdexcept>
40 
41 namespace SSAGES
42 {
43  CollectiveVariable* CollectiveVariable::BuildCV(const Json::Value &json, const std::string& path)
44  {
45  // Get CV type.
46  auto type = json.get("type", "none").asString();
47 
48  if(type == "Angle")
49  return AngleCV::Build(json, path);
50  else if (type == "ANNCV")
51  return ANNCV::Build(json, path);
52  else if(type == "BoxVolume")
53  return BoxVolumeCV::Build(json, path);
54  else if(type == "GyrationTensor")
55  return GyrationTensorCV::Build(json, path);
56  else if(type == "Pairwise")
57  return PairwiseCV::Build(json, path);
58  else if(type == "ParticleCoordinate")
59  return ParticleCoordinateCV::Build(json, path);
60  else if(type == "ParticlePosition")
61  return ParticlePositionCV::Build(json, path);
62  else if(type == "ParticleSeparation")
63  return ParticleSeparationCV::Build(json, path);
64  else if(type == "RouseMode")
65  return RouseModeCV::Build(json, path);
66  else if(type == "Torsional")
67  return TorsionalCV::Build(json, path);
68  else if (type == "AlphaRMSD")
69  return AlphaRMSDCV::Build(json, path);
70  else if (type == "ParallelBetaRMSD")
71  return ParallelBetaRMSDCV::Build(json, path);
72  else if (type == "AntiBetaRMSD")
73  return AntiBetaRMSDCV::Build(json, path);
74  else if (type == "RMSD")
75  return RMSDCV::Build(json, path);
76  else
77  throw std::invalid_argument(path + ": Unknown CV type specified.");
78  }
79 
80  std::map<std::string, unsigned int> CVManager::cvmap_ = {};
81 }
static ANNCV * Build(const Json::Value &json, const std::string &path)
Set up collective variable.
Definition: ANNCV.h:244
static AlphaRMSDCV * Build(const Json::Value &json, const std::string &path)
Set up collective variable.
Definition: AlphaRMSDCV.h:233
static AngleCV * Build(const Json::Value &json, const std::string &path)
Set up collective variable.
Definition: AngleCV.h:137
static AntiBetaRMSDCV * Build(const Json::Value &json, const std::string &path)
Set up collective variable.
static BoxVolumeCV * Build(const Json::Value &json, const std::string &path)
Set up collective variable.
Definition: BoxVolumeCV.h:65
static std::map< std::string, unsigned int > cvmap_
Map between CV names and ID's.
Definition: CVManager.h:49
Abstract class for a collective variable.
static CollectiveVariable * BuildCV(const Json::Value &json, const std::string &path)
Set up collective variable.
static GyrationTensorCV * Build(const Json::Value &json, const std::string &path)
Set up collective variable.
static PairwiseCV * Build(const Json::Value &json, const std::string &path)
Set up collective variable.
Definition: PairwiseCV.h:200
static ParallelBetaRMSDCV * Build(const Json::Value &json, const std::string &path)
Set up collective variable.
static ParticleCoordinateCV * Build(const Json::Value &json, const std::string &path)
Set up collective variable.
static ParticlePositionCV * Build(const Json::Value &json, const std::string &path)
Set up collective variable.
static ParticleSeparationCV * Build(const Json::Value &json, const std::string &path)
Set up collective variable.
static RMSDCV * Build(const Json::Value &json, const std::string &path)
Set up collective variable.
Definition: RMSDCV.h:244
static RouseModeCV * Build(const Json::Value &json, const std::string &path)
Set up collective variable.
Definition: RouseModeCV.h:192
static TorsionalCV * Build(const Json::Value &json, const std::string &path)
Set up collective variable.
Definition: TorsionalCV.h:229