LOOS 4.1.0
The Lightweight Object Oriented Structural analysis library/toolkit
Loading...
Searching...
No Matches
water-hist-lib.hpp
1// -------------------------------------------------
2// Water Histogram Library
3// -------------------------------------------------
4
5/*
6 This file is part of LOOS.
7
8 LOOS (Lightweight Object-Oriented Structure library)
9 Copyright (c) 2009 Tod D. Romo, Alan Grossfield
10 Department of Biochemistry and Biophysics
11 School of Medicine & Dentistry, University of Rochester
12
13 This package (LOOS) is free software: you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation under version 3 of the License.
16
17 This package is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program. If not, see <http://www.gnu.org/licenses/>.
24*/
25
26
27
28
29#if !defined(LOOS_WATER_HIST_LIB_HPP)
30#define LOOS_WATER_HIST_LIB_HPP
31
32#include <iostream>
33
34#include <DensityGrid.hpp>
35#include <GridUtils.hpp>
36#include <water-lib.hpp>
37#include <internal-water-filter.hpp>
38
39
40namespace loos {
41
42 namespace DensityTools {
43
44
46 public:
47 virtual ~BulkEstimator() { }
48 virtual void reinitialize(pTraj&, const std::vector<uint>&) =0;
49 virtual void operator()(const double) =0;
50 virtual double bulkDensity(void) const =0;
51 virtual double stdDev(const double) const =0;
52 virtual void clear() =0;
53
54 friend std::ostream& operator<<(std::ostream& os, const BulkEstimator& b) {
55 return(b.print(os));
56 }
57
58 private:
59 virtual std::ostream& print(std::ostream& os) const =0;
60 };
61
62
64 public:
65 void reinitialize(pTraj& p, const std::vector<uint>& f) { }
66 void operator()(const double d) { }
67 double bulkDensity(void) const { return(1.0); }
68 double stdDev(const double d) const { return(0.0); }
69 void clear(void) { }
70
71 private:
72 std::ostream& print(std::ostream& os) const {
73 os << "No bulk estimate";
74 return(os);
75 }
76 };
77
78
80 public:
81 ZClipEstimator(AtomicGroup& water, pTraj& traj, const std::vector<uint>& frames, const double zclip, const double gridres)
82 : water_(water), zclip_(zclip), gridres_(gridres), count_zero(false)
83 {
84 reinitialize(traj, frames);
85 }
86
87 void countZero(const bool flag = true) { count_zero = flag; }
88
89 void reinitialize(pTraj& traj, const std::vector<uint>& frames);
90 void operator()(const double density);
91 double bulkDensity(void) const;
92 double stdDev(const double mean) const;
93 void clear(void) { thegrid.clear(); }
94
95 private:
96 std::ostream& print(std::ostream& os) const {
97 os << boost::format("ZClipEstimator = %s x %s @ %s") % thegrid.minCoord() % thegrid.maxCoord() % thegrid.gridDims();
98 return(os);
99 }
100
101 private:
102 AtomicGroup water_;
103 double zclip_, gridres_;
104 bool count_zero;
105 DensityGrid<double> thegrid;
106 };
107
108
110 public:
111 ZSliceEstimator(AtomicGroup& water, pTraj& traj, const std::vector<uint>& frames, const double zmin, const double zmax, const double gridres)
112 : water_(water), zmin_(zmin), zmax_(zmax), gridres_(gridres), count_zero(false)
113 {
114 reinitialize(traj, frames);
115 }
116
117 void countZero(const bool flag = true) { count_zero = flag; }
118
119 void reinitialize(pTraj& traj, const std::vector<uint>& frames);
120 void operator()(const double density);
121 double bulkDensity(void) const;
122 double stdDev(const double mean) const;
123 void clear(void) { thegrid.clear(); }
124
125 private:
126 std::ostream& print(std::ostream& os) const {
127 os << boost::format("ZSliceEstimator = %s x %s @ %s") % thegrid.minCoord() % thegrid.maxCoord() % thegrid.gridDims();
128 return(os);
129 }
130
131 private:
132 AtomicGroup water_;
133 double zmin_, zmax_, gridres_;
134 bool count_zero;
135 DensityGrid<double> thegrid;
136 };
137
138
139
140
142 public:
143 WaterHistogrammer(const AtomicGroup& protein, const AtomicGroup& water, BulkEstimator* est, WaterFilterBase* filter) :
144 protein_(protein), water_(water), estimator_(est), the_filter(filter), out_of_bounds(0) { }
145
146 void clear() { grid_.clear(); out_of_bounds = 0; }
147
148 void setGrid(const GCoord& min, const GCoord& max, const double resolution);
149 void setGrid(pTraj& traj, const std::vector<uint>& frames, const double resolution, const double pad = 0.0);
150
151 void accumulate(const double density);
152 void accumulate(pTraj& traj, const std::vector<uint>& frames);
153 DensityGrid<double> grid() const { return(grid_); }
154 long outOfBounds() const { return(out_of_bounds); }
155
156
157
158 private:
159 AtomicGroup protein_, water_;
160 BulkEstimator* estimator_;
161 WaterFilterBase* the_filter;
162 long out_of_bounds;
163 DensityGrid<double> grid_;
164 };
165
166
167 };
168
169};
170
171
172
173#endif
Class for handling groups of Atoms (pAtoms, actually)
Definition AtomicGroup.hpp:108
Definition water-hist-lib.hpp:45
Definition water-hist-lib.hpp:63
Base interface for water filter/picker.
Definition internal-water-filter.hpp:43
Definition water-hist-lib.hpp:141
Definition water-hist-lib.hpp:79
Definition water-hist-lib.hpp:109
Namespace for most things not already encapsulated within a class.
Definition version.cpp:3