RxDock 0.1.0
A fast, versatile, and open-source program for docking ligands to proteins and nucleic acids
Loading...
Searching...
No Matches
PMFGridSF.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 _RBTPMFGRIDSF_H_
14#define _RBTPMFGRIDSF_H_
15
16#include "rxdock/BaseInterSF.h"
17#include "rxdock/RealGrid.h"
18
19#include <nlohmann/json.hpp>
20
21using json = nlohmann::json;
22
23namespace rxdock {
24
25class PMFGridSF : public BaseInterSF {
26 bool m_bSmoothed;
27 AtomList theLigandList; // vector to store the ligand
28 std::vector<PMFType> theTypeList; // store PMF used types here
29 std::vector<RealGridPtr> theGrids; // grids with PMF data
30
31 void ReadGrids(json pmfGrids);
32
33public:
34 static const std::string _CT; // class name
35 static const std::string _GRID; // filename extension (.grd)
36 static const std::string
37 _SMOOTHED; // controls wether to smooth the grid values
38
39 PMFGridSF(const std::string &strName = "pmf-grid");
40 virtual ~PMFGridSF();
41
42protected:
43 virtual void SetupReceptor();
44 virtual void SetupLigand();
45 virtual void SetupScore() {}
46 virtual double RawScore() const;
47 unsigned int GetCorrectedType(PMFType aType) const;
48
49private:
50 friend void to_json(json &j, const PMFGridSF &sf) {
51 json atomList;
52 for (const auto &cIter : sf.theLigandList) {
53 json atom = *cIter;
54 atomList.push_back(atom);
55 }
56 json grids;
57 for (const auto &cIter : sf.theGrids) {
58 json grid = *cIter;
59 grids.push_back(grid);
60 }
61
62 j = json{{"smoothed", sf.m_bSmoothed},
63 {"atoms", atomList},
64 {"pmf-types", sf.theTypeList},
65 {"pmf-data", grids}};
66 };
67 friend void from_json(const json &j, PMFGridSF &sf) {
68 j.at("smoothed").get_to(sf.m_bSmoothed);
69
70 sf.theLigandList.clear();
71 sf.theLigandList.reserve(j.at("atoms").size());
72 for (auto &atom : j.at("atoms")) {
73 AtomPtr spAtom = AtomPtr(new Atom(atom));
74 sf.theLigandList.push_back(spAtom);
75 }
76 j.at("pmf-types").get_to(sf.theTypeList);
77
78 sf.theGrids.clear();
79 sf.theGrids.reserve(j.at("grids").size());
80 for (auto &grid : j.at("grids")) {
81 RealGridPtr spGrid = RealGridPtr(new RealGrid(grid));
82 sf.theGrids.push_back(spGrid);
83 }
84 };
85};
86
87} // namespace rxdock
88
89#endif // _RBTPMFGRIDSF_H_
Definition Atom.h:49
Definition BaseInterSF.h:27
Definition PMFGridSF.h:25
Definition RealGrid.h:30