RxDock 0.1.0
A fast, versatile, and open-source program for docking ligands to proteins and nucleic acids
Loading...
Searching...
No Matches
NMState.h
1/***********************************************************************
2 * The rDock program was developed from 1998 - 2006 by the software team
3 * at RiboTargets (subsequently Vernalis (R&D) Ltd).
4 * In 2006, the software was licensed to the University of York for
5 * maintenance and distribution.
6 * In 2012, Vernalis and the University of York agreed to release the
7 * program as Open Source software.
8 * This version is licensed under GNU-LGPL version 3.0 with support from
9 * the University of Barcelona.
10 * http://rdock.sourceforge.net/
11 ***********************************************************************/
12
13#ifndef _RBTNMSTATE_H_
14#define _RBTNMSTATE_H_
15
16#include <nlohmann/json.hpp>
17
18using json = nlohmann::json;
19
20namespace rxdock {
21
22namespace neldermead {
23
27template <class DataType, class ParameterType> struct State {
28 friend void to_json(json &j, const State &state) {
29 j = json{{"best-parameters", state.bestParameters},
30 {"best-value", state.bestValue},
31 {"current-parameters", state.currentParameters},
32 {"current-value", state.currentValue},
33 {"former-parameters", state.formerParameters},
34 {"former-value", state.formerValue},
35 {"iteration", state.iteration}};
36 }
37
38 friend void from_json(const json &j, State &state) {
39 j.at("best-parameters").get_to(state.bestParameters);
40 j.at("best-value").get_to(state.bestValue);
41 j.at("current-parameters").get_to(state.currentParameters);
42 j.at("current-value").get_to(state.currentValue);
43 j.at("former-parameters").get_to(state.formerParameters);
44 j.at("former-value").get_to(state.formerValue);
45 j.at("iteration").get_to(state.iteration);
46 }
47
48 ParameterType bestParameters;
49 DataType bestValue;
50
51 ParameterType currentParameters;
52 DataType currentValue;
53
54 ParameterType formerParameters;
55 DataType formerValue;
56
57 long iteration;
58};
59
60} // namespace neldermead
61
62} // namespace rxdock
63
64#endif /* _RBTNMSTATE_H_ */
Definition NMState.h:27