RxDock 0.1.0
A fast, versatile, and open-source program for docking ligands to proteins and nucleic acids
Loading...
Searching...
No Matches
PolarSF.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 implementation class for all attractive and repulsive polar scoring fns
14// Provides methods for: creating interaction centers, calculating interaction
15// scores
16
17#ifndef _RBTPOLARSF_H_
18#define _RBTPOLARSF_H_
19
20#include "rxdock/AnnotationHandler.h"
21#include "rxdock/BaseSF.h"
22#include "rxdock/InteractionGrid.h"
23
24#include <nlohmann/json.hpp>
25
26using json = nlohmann::json;
27
28namespace rxdock {
29
30class PolarSF : public virtual BaseSF, public virtual AnnotationHandler {
31public:
32 // Class type string
33 static const std::string _CT;
34 // Parameter names
35 static const std::string _INCR;
36 static const std::string _R12FACTOR;
37 static const std::string _R12INCR;
38 static const std::string _DR12MIN;
39 static const std::string _DR12MAX;
40 static const std::string _A1;
41 static const std::string _DA1MIN;
42 static const std::string _DA1MAX;
43 static const std::string _A2;
44 static const std::string _DA2MIN;
45 static const std::string _DA2MAX;
46 static const std::string _INCMETAL;
47 static const std::string _INCHBD;
48 static const std::string _INCHBA;
49 static const std::string _INCGUAN;
50 static const std::string _GUAN_PLANE;
51 static const std::string _ABS_DR12;
52 static const std::string _LP_OSP2;
53 static const std::string _LP_PHI;
54 static const std::string _LP_DPHIMIN;
55 static const std::string _LP_DPHIMAX;
56 static const std::string _LP_DTHETAMIN;
57 static const std::string _LP_DTHETAMAX;
58
59 virtual ~PolarSF();
60
61 friend void to_json(json &j, const PolarSF &polarSF);
62 friend void from_json(const json &j, PolarSF &polarSF);
63
64protected:
65 PolarSF();
66
67 InteractionCenterList
68 CreateAcceptorInteractionCenters(const AtomList &atomList) const;
69 InteractionCenterList
70 CreateDonorInteractionCenters(const AtomList &atomList) const;
71
72 // Index the intramolecular interactions between two lists
73 void BuildIntraMap(const InteractionCenterList &ICList1,
74 const InteractionCenterList &ICList2,
75 InteractionListMap &intns) const;
76 // Index the intramolecular interactions within a single list
77 void BuildIntraMap(const InteractionCenterList &ICList,
78 InteractionListMap &intns) const;
79
80 double IntraScore(const InteractionCenterList &posList,
81 const InteractionCenterList &negList,
82 const InteractionListMap &prtIntns, bool attr) const;
83 void Partition(const InteractionCenterList &posList,
84 const InteractionCenterList &negList,
85 const InteractionListMap &intns, InteractionListMap &prtIntns,
86 double dist = 0.0) const;
87
88 // Generic scoring function params
89 struct f1prms {
90 double R0, DRMin, DRMax, slope;
91 f1prms(double R, double DMin, double DMax)
92 : R0(R), DRMin(DMin), DRMax(DMax), slope(1.0 / (DMax - DMin)) {}
93 };
94
95 inline f1prms GetRprms() const { return f1prms(0.0, m_DR12Min, m_DR12Max); }
96 inline f1prms GetA1prms() const { return f1prms(m_A1, m_DA1Min, m_DA1Max); }
97 inline f1prms GetA2prms() const { return f1prms(m_A2, m_DA2Min, m_DA2Max); }
98
99 double PolarScore(const InteractionCenter *intn,
100 const InteractionCenterList &intnList, const f1prms &Rprms,
101 const f1prms &A1prms, const f1prms &A2prms) const;
102
103 // As this has a virtual base class we need a separate OwnParameterUpdated
104 // which can be called by concrete subclass ParameterUpdated methods
105 // See Stroustrup C++ 3rd edition, p395, on programming virtual base classes
106 void OwnParameterUpdated(const std::string &strName);
107
108private:
109 // Generic scoring function primitive
110 inline double f1(double DR, const f1prms &prms) const {
111 return (DR > prms.DRMax) ? 0.0
112 : (DR > prms.DRMin) ? 1.0 - prms.slope * (DR - prms.DRMin)
113 : 1.0;
114 }
115
116 void UpdateLPprms();
117
118 // DM 25 Oct 2000 - heavily used params
119 double m_R12Factor;
120 double m_R12Incr;
121 double m_DR12Min;
122 double m_DR12Max;
123 double m_A1;
124 double m_DA1Min;
125 double m_DA1Max;
126 double m_A2;
127 double m_DA2Min;
128 double m_DA2Max;
129 bool m_bAbsDR12;
130 double m_LP_PHI;
131 double m_LP_DPHIMin;
132 double m_LP_DPHIMax;
133 double m_LP_DTHETAMin;
134 double m_LP_DTHETAMax;
135 f1prms m_PHI_lp_prms;
136 f1prms m_PHI_plane_prms;
137 f1prms m_THETAprms;
138};
139
140void to_json(json &j, const PolarSF &polarSF);
141void from_json(const json &j, PolarSF &polarSF);
142
143} // namespace rxdock
144
145#endif //_RBTPOLARSF_H_
Definition AnnotationHandler.h:28
Definition BaseSF.h:28
Definition PolarSF.h:30
Definition PolarSF.h:89