25 #include "BasisFunc.h"
26 #include "ForwardFlux.h"
28 #include "StringMethod.h"
30 #include "json/json.h"
31 #include "Drivers/DriverException.h"
32 #include "Validator/ObjectRequirement.h"
33 #include "CVs/CVManager.h"
40 Method* Method::BuildMethod(
const Value& json,
41 const MPI_Comm& world,
43 const std::string& path)
47 CharReaderBuilder rbuilder;
48 CharReader* reader = rbuilder.newCharReader();
50 reader->parse(JsonSchema::Method.c_str(),
51 JsonSchema::Method.c_str() + JsonSchema::Method.size(),
53 validator.
Parse(schema, path);
60 if(json[
"type"] ==
"ABF")
61 method = ABF::Build(json, world, comm, path);
62 else if(json[
"type"] ==
"ANN")
63 method = ANN::Build(json, world, comm, path);
64 else if(json[
"type"] ==
"BFSMethod")
65 method = BFS::Build(json, world, comm, path);
66 else if(json[
"type"] ==
"CFF")
67 method = CFF::Build(json, world, comm, path);
68 else if(json[
"type"] ==
"ForwardFlux")
69 method = ForwardFlux::Build(json, world, comm, path);
70 else if(json[
"type"] ==
"Metadynamics")
71 method = Meta::Build(json, world, comm, path);
72 else if(json[
"type"] ==
"Umbrella")
73 method = Umbrella::Build(json, world, comm, path);
74 else if(json[
"type"] ==
"String")
75 method = StringMethod::Build(json, world, comm, path);
77 throw std::invalid_argument(path +
": Unknown method type specified.");
80 std::vector<unsigned int> cvmask;
81 for(
auto& cv : json[
"cvs"])
83 cvmask.push_back(CVManager::LookupCV(cv, path));
Requirements on an object.
virtual void Parse(Value json, const std::string &path) override
Parse JSON value to generate Requirement(s).
virtual void Validate(const Value &json, const std::string &path) override
Validate JSON value.
std::vector< std::string > GetErrors()
Get list of error messages.
bool HasErrors()
Check if errors have occured.
Exception to be thrown when building the Driver fails.
Interface for Method implementations.
void SetCVMask(const std::vector< unsigned int > &mask)
Sets the collective variable mask.