RxDock 0.1.0
A fast, versatile, and open-source program for docking ligands to proteins and nucleic acids
Loading...
Searching...
No Matches
BaseSF.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// Base class for all scoring functions
14#ifndef _RBTBASESF_H_
15#define _RBTBASESF_H_
16
17#include "rxdock/BaseObject.h"
18#include "rxdock/Config.h"
19
20#include <nlohmann/json.hpp>
21
22using json = nlohmann::json;
23
24namespace rxdock {
25
26class SFAgg; // forward declaration
27
28class BaseSF : public BaseObject {
29public:
30 // Class type string
31 static const std::string _CT;
32 // Parameter names
33 static const std::string _WEIGHT;
34 // DM 09 Apr 2002 - max distance range over which scoring function operates
35 // Subclasses are free not to use if not required
36 static const std::string _RANGE;
37 // DM 17 Jan 2006 - hardcoded name of scoring function branch under which to
38 // save "system" scoring function terms (e.g. intra-receptor, intra-solvent).
39 // This is a dirty (and hopefully temporary) solution!
40 static const std::string _SYSTEM_SF;
41 static const std::string _INTRA_SF; // Ditto, for ligand intramolecular terms
42
44 // Constructors/destructors
45 virtual ~BaseSF();
46
47 friend void to_json(json &j, const BaseSF &baseSF);
48 friend void from_json(const json &j, BaseSF &baseSF);
49
50 // Give aggregates access to BaseSF private methods/data
51 friend class SFAgg;
52
54 // Public methods
56 // Fully qualified name, prefixed by all ancestors (e.g.
57 // rxdock.score.inter.hbond)
58 std::string GetFullName() const;
59 double GetWeight() const;
60 void SetWeight(double);
61
62 double GetRange() const;
63 RBTDLL_EXPORT void SetRange(double);
64
65 // Main public method - returns current weighted score
66 RBTDLL_EXPORT double Score() const;
67 // Returns all child component scores as a string-variant map
68 // Key = fully qualified component name, value = weighted score
69 //(for saving in a Model's data fields)
70 virtual void ScoreMap(StringVariantMap &scoreMap) const;
71
72 // Aggregate handling methods
73 virtual void Add(BaseSF *);
74 virtual void Remove(BaseSF *);
75 virtual bool isAgg() const;
76 virtual unsigned int GetNumSF() const;
77 virtual BaseSF *GetSF(unsigned int iSF) const;
78 void Orphan(); // Force removal from the parent aggregate
79 BaseSF *GetParentSF() const;
80
81protected:
83 // Protected methods
85 BaseSF(const std::string &strClass, const std::string &strName);
86 BaseSF();
87 // PURE VIRTUAL - DERIVED CLASSES MUST OVERRIDE
88 virtual double RawScore() const = 0;
89 // DM 25 Oct 2000 - track changes to parameter values in local data members
90 // ParameterUpdated is invoked by ParamHandler::SetParameter
91 void ParameterUpdated(const std::string &strName);
92 // Helper method for ScoreMap
93 void AddToParentMapEntry(StringVariantMap &scoreMap, double rs) const;
94
95private:
97 // Private methods
99 BaseSF(const BaseSF &); // Copy constructor disabled by default
100 BaseSF &operator=(const BaseSF &); // Copy assignment disabled by
101 // default
102
103protected:
105 // Protected data
107
108private:
110 // Private data
112 BaseSF *m_parent;
113 double m_weight;
114 double m_range;
115};
116
117void to_json(json &j, const BaseSF &baseSF);
118void from_json(const json &j, BaseSF &baseSF);
119
120// Useful typedefs
121typedef std::vector<BaseSF *> BaseSFList; // Vector of smart pointers
122typedef BaseSFList::iterator BaseSFListIter;
123typedef BaseSFList::const_iterator BaseSFListConstIter;
124
125} // namespace rxdock
126
127#endif //_RBTBASESF_H_
Definition BaseObject.h:32
Definition BaseSF.h:28
Definition SFAgg.h:36