RxDock 0.1.0
A fast, versatile, and open-source program for docking ligands to proteins and nucleic acids
Loading...
Searching...
No Matches
DihedralSF.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 dihedral scoring functions. Provides
14// Dihedral struct for dihedral definitions and score, plus a method for
15// generating lists of dihedral definitions from a bond list.
16// This version hardwired to use Tripos 5.2 atom types and params.
17
18#ifndef _RBTDIHEDRALSF_H_
19#define _RBTDIHEDRALSF_H_
20
21#include "rxdock/Atom.h"
22#include "rxdock/BaseSF.h"
23#include "rxdock/Bond.h"
24#include "rxdock/ParameterFileSource.h"
25#include "rxdock/TriposAtomType.h"
26
27#include <nlohmann/json.hpp>
28
29using json = nlohmann::json;
30
31namespace rxdock {
32
33// Class for holding dihedral atom specifiers and force field params
34// Main method is operator() - calculates single dihedral score for current
35// conformation DM (9 Dec 2003): Extended to allow additional terms to be added
36// to the dihedral potential (AddTerm) Two main uses for AddTerm:
37// i) to define a Fourier series expansion, rather than a simple cosine
38// potential
39// ii) implicit hydrogen correction (ghost terms are added for the missing
40// hydrogen dihedrals
41// defined as offsets from the real heavy-atom
42// dihedral specifiers)
43
45public:
46 // Simple struct for storing the force field params for a single term of the
47 // dihedral potential
48 class prms {
49 public:
50 prms(double ss = 3.0, double kk = 0.2, double o = 0.0)
51 : s(std::fabs(ss)), k(kk), sign((ss > 0.0) ? +1.0 : -1.0), offset(o) {}
52 double s; // rotational degeneracy
53 double k; // barrier height
54 double sign; //+1 or -1, to invert potential
55 double offset; // dihedral offset in degrees (useful for ghost implicit
56 // hydrogens)
57 };
58
59 // Constructor takes the real atom specifiers, plus the first term of the
60 // potential
61 DihedralElement(Atom *pAtom1, Atom *pAtom2, Atom *pAtom3, Atom *pAtom4,
62 const prms &dihprms);
63
64 friend void to_json(json &j, const DihedralElement &dihedralElem);
65 friend void from_json(const json &j, DihedralElement &dihedralElem);
66
67 double operator()() const; // Calculate dihedral score for this interaction
68 Atom *GetAtom1Ptr() const { return m_pAtom1; }
69 Atom *GetAtom2Ptr() const { return m_pAtom2; }
70 Atom *GetAtom3Ptr() const { return m_pAtom3; }
71 Atom *GetAtom4Ptr() const { return m_pAtom4; }
72 // Add additional terms to the potential
73 void AddTerm(const prms &dihprms);
74
75private:
76 DihedralElement(); // Forbid default constructor
77 Atom *m_pAtom1;
78 Atom *m_pAtom2;
79 Atom *m_pAtom3;
80 Atom *m_pAtom4;
81 std::vector<prms> m_prms;
82};
83
84void to_json(json &j, const DihedralElement &dihedralElem);
85void from_json(const json &j, DihedralElement &dihedralElem);
86
87// Useful typedefs
88typedef std::vector<DihedralElement *> DihedralList; // Vector of smart pointers
89typedef DihedralList::iterator DihedralListIter;
90typedef DihedralList::const_iterator DihedralListConstIter;
91
92class DihedralSF : public virtual BaseSF {
93public:
94 // Class type string
95 static const std::string _CT;
96 // Parameter names
97 static const std::string _IMPL_H_CORR; // DM 6 Aug 2002 - option to correct
98 // barrier heights for implicit H's
99
100 virtual ~DihedralSF();
101
102 friend void to_json(json &j, const DihedralSF &dihedralSF);
103 friend void from_json(const json &j, DihedralSF &dihedralSF);
104
105protected:
106 DihedralSF();
107 // Creates a vector of pointers to dihedral objects from a supplied bond list
108 // Dihedral params are set using Tripos 5.2 atom types + params
109 // NOTE: It is the responsibility of the subclass to delete the dihedral
110 // objects which are created
111 DihedralList CreateDihedralList(const BondList &bondList);
112
113private:
114 // Lookup the dihedral params for a given set of types
115 DihedralElement::prms FindDihedralParams(TriposAtomType::eType t1,
116 TriposAtomType::eType t2,
117 TriposAtomType::eType t3,
118 TriposAtomType::eType t4);
119
120 // Determines the list of bonded atoms for pAtom1, and the list of dihedral
121 // offsets for any implicit hydrogens pAtom2 is the other central atom in the
122 // bond, is excluded from the returned list of bonded atoms
123 void CalcBondedAtoms(Atom *pAtom1, Atom *pAtom2, AtomList &bondedAtoms,
124 std::vector<double> &offsets);
125
126 ParameterFileSourcePtr m_spDihedralSource;
127 std::vector<std::string> m_centralPairs;
128 TriposAtomType m_triposType;
129};
130
131void to_json(json &j, const DihedralSF &dihedralSF);
132void from_json(const json &j, DihedralSF &dihedralSF);
133
134} // namespace rxdock
135
136#endif //_RBTDIHEDRALSF_H_
Definition Atom.h:49
Definition BaseSF.h:28
Definition DihedralSF.h:48
Definition DihedralSF.h:44
Definition DihedralSF.h:92
Definition TriposAtomType.h:28