RxDock 0.1.0
A fast, versatile, and open-source program for docking ligands to proteins and nucleic acids
Loading...
Searching...
No Matches
SimAnnTransform.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// Simple, non-adaptive simulated annealing protocol
14#ifndef _RBTSIMANNTRANSFORM_H_
15#define _RBTSIMANNTRANSFORM_H_
16
17#include "rxdock/BaseBiMolTransform.h"
18#include "rxdock/ChromElement.h"
19#include "rxdock/Rand.h"
20
21#include <nlohmann/json.hpp>
22
23using json = nlohmann::json;
24
25namespace rxdock {
26
27// Simple class to keep track of Monte Carlo sampling statistics
28class MCStats {
29public:
30 MCStats();
31 void Init(double score);
32 void InitBlock(double score);
33 void Accumulate(double score, bool bAccepted);
34 double Mean() const;
35 double Variance() const;
36 double AccRate() const;
37 double _total;
38 double _total2;
39 double _blockInitial;
40 double _blockFinal;
41 double _blockMin;
42 double _blockMax;
43 double _initial;
44 double _final;
45 double _min;
46 double _max;
47 int _steps;
48 int _accepted;
49};
50typedef SmartPtr<MCStats> MCStatsPtr; // Smart pointer
51
53public:
54 // Static data member for class type
55 static const std::string _CT;
56 // Parameter names
57 static const std::string _START_T;
58 static const std::string _FINAL_T;
59 static const std::string _BLOCK_LENGTH;
60 static const std::string _SCALE_CHROM_LENGTH;
61 static const std::string _NUM_BLOCKS;
62 static const std::string _STEP_SIZE;
63 static const std::string _MIN_ACC_RATE;
64 static const std::string _PARTITION_DIST;
65 static const std::string _PARTITION_FREQ;
66 static const std::string _HISTORY_FREQ;
67
68 RBTDLL_EXPORT static const std::string &GetStartT();
69 RBTDLL_EXPORT static const std::string &GetFinalT();
70 RBTDLL_EXPORT static const std::string &GetBlockLength();
71 RBTDLL_EXPORT static const std::string &GetNumBlocks();
72 RBTDLL_EXPORT static const std::string &GetStepSize();
73 RBTDLL_EXPORT static const std::string &GetPartitionDist();
74 RBTDLL_EXPORT static const std::string &GetPartitionFreq();
75
77 // Constructors/destructors
78 RBTDLL_EXPORT SimAnnTransform(const std::string &strName = "SIMANN");
79 virtual ~SimAnnTransform();
80
81 friend void to_json(json &j, const SimAnnTransform &simAnnTransform);
82 friend void from_json(const json &j, SimAnnTransform &simAnnTransform);
83
85 // Public methods
87
88protected:
90 // Protected methods
92 virtual void SetupReceptor(); // Called by Update when receptor is changed
93 virtual void SetupLigand(); // Called by Update when ligand is changed
94 virtual void
95 SetupTransform(); // Called by Update when either model has changed
96 void MC(double t, int blockLen, double stepSize);
97 virtual void Execute();
98
99private:
101 // Private methods
104 const SimAnnTransform &); // Copy constructor disabled by default
106 operator=(const SimAnnTransform &); // Copy assignment disabled by default
107
108protected:
110 // Protected data
112
113private:
115 // Private data
117 MCStatsPtr m_spStats;
118 Rand &m_rand; // keep a reference to the singleton random number generator
119 RequestPtr m_spPartReq; // Partitioning request
120 ChromElementPtr m_chrom; // Current chromosome
121 std::vector<double>
122 m_minVector; // Chromosome vector corresponding to overall minimum score
123 std::vector<double> m_lastGoodVector; // Saved chromosome before each MC
124 // mutation (to allow revert)
125};
126
127void to_json(json &j, const SimAnnTransform &simAnnTransform);
128void from_json(const json &j, SimAnnTransform &simAnnTransform);
129
130// Useful typedefs
131typedef SmartPtr<SimAnnTransform> SimAnnTransformPtr; // Smart pointer
132
133} // namespace rxdock
134
135#endif //_RBTSIMANNTRANSFORM_H_
Definition BaseBiMolTransform.h:27
Definition SimAnnTransform.h:28
Definition Rand.h:32
Definition SimAnnTransform.h:52
Definition SmartPointer.h:48