LOOS  v2.3.2
internal-water-filter.hpp
1 /*
2  Internal water filter library
3 */
4 
5 
6 /*
7  This file is part of LOOS.
8 
9  LOOS (Lightweight Object-Oriented Structure library)
10  Copyright (c) 2008, Tod D. Romo, Alan Grossfield
11  Department of Biochemistry and Biophysics
12  School of Medicine & Dentistry, University of Rochester
13 
14  This package (LOOS) is free software: you can redistribute it and/or modify
15  it under the terms of the GNU General Public License as published by
16  the Free Software Foundation under version 3 of the License.
17 
18  This package is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  GNU General Public License for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with this program. If not, see <http://www.gnu.org/licenses/>.
25 */
26 
27 
28 
29 #if !defined(LOOS_INTERNAL_WATER_FILTER_HPP)
30 #define LOOS_INTERNAL_WATER_FILTER_HPP
31 
32 #include <loos.hpp>
33 #include <DensityGrid.hpp>
34 #include <vector>
35 
36 
37 namespace loos {
38 
39  namespace DensityTools {
40 
41 
44  public:
45  WaterFilterBase() { }
46  virtual ~WaterFilterBase() { }
47 
49 
52  virtual std::vector<int> filter(const loos::AtomicGroup&, const loos::AtomicGroup&) =0;
53 
55  virtual std::vector<loos::GCoord> boundingBox(const loos::AtomicGroup&) =0;
56 
58  virtual double volume(void) =0;
59 
61  virtual std::string name(void) const =0;
62 
63  protected:
64  std::vector<loos::GCoord> bdd_;
65  };
66 
67 
68  // --------------------------------------------------------------------------------
69 
71 
77  public:
78  WaterFilterBox(const double pad) : pad_(pad) { }
79  virtual ~WaterFilterBox() { }
80 
81  virtual std::vector<int> filter(const loos::AtomicGroup&, const loos::AtomicGroup&);
82  virtual std::vector<loos::GCoord> boundingBox(const loos::AtomicGroup&);
83 
84  virtual double volume(void);
85  virtual std::string name(void) const;
86 
87  private:
88  double pad_;
89  };
90 
91 
92 
93  // --------------------------------------------------------------------------------
94 
96 
101  public:
102  WaterFilterRadius(const double radius) : radius_(radius) { }
103  virtual ~WaterFilterRadius() { }
104 
105  virtual std::vector<int> filter(const loos::AtomicGroup&, const loos::AtomicGroup&);
106  virtual std::vector<loos::GCoord> boundingBox(const loos::AtomicGroup&);
107 
108  virtual double volume(void);
109  virtual std::string name(void) const;
110 
111  private:
112  double radius_;
113  };
114 
115 
116  // --------------------------------------------------------------------------------
117 
119 
128  public:
129  WaterFilterAxis(const double radius) : radius_(radius*radius) { }
130  virtual ~WaterFilterAxis() { }
131 
132  virtual std::string name(void) const;
133  virtual double volume(void);
134 
135  virtual std::vector<int> filter(const loos::AtomicGroup&, const loos::AtomicGroup&);
136  std::vector<loos::GCoord> boundingBox(const loos::AtomicGroup&);
137 
138  private:
139  loos::GCoord axis_, orig_;
140  double radius_;
141  };
142 
143  // --------------------------------------------------------------------------------
144 
146 
156  public:
157  WaterFilterCore(const double radius) : radius_(radius*radius) { }
158  virtual ~WaterFilterCore() { }
159 
160  virtual std::string name(void) const;
161  virtual double volume(void);
162 
163  virtual std::vector<int> filter(const loos::AtomicGroup&, const loos::AtomicGroup&);
164  std::vector<loos::GCoord> boundingBox(const loos::AtomicGroup&);
165 
166  private:
167  loos::GCoord calculateAxis(const loos::AtomicGroup& grp);
168 
169 
170  loos::GCoord axis_, orig_;
171  double radius_;
172  };
173 
174 
175 
176  // --------------------------------------------------------------------------------
177 
179 
187  public:
188  WaterFilterBlob(const DensityGrid<int>& blob) : blob_(blob), bdd_set(false), vol(-1.0) { }
189  virtual ~WaterFilterBlob() { }
190 
191  virtual std::string name(void) const;
192  virtual double volume(void);
193 
194  std::vector<int> filter(const loos::AtomicGroup&, const loos::AtomicGroup&);
195  std::vector<loos::GCoord> boundingBox(const loos::AtomicGroup&);
196 
197  private:
198  DensityGrid<int> blob_;
199  bool bdd_set;
200  double vol;
201  };
202 
203 
204  // --------------------------------------------------------------------------------
205 
208  public:
209  WaterFilterDecorator(WaterFilterBase* p) : base(p) { }
210  virtual ~WaterFilterDecorator() { }
211 
212  virtual std::string name(void) const { return(base->name()); }
213  virtual double volume(void) { return(base->volume()); }
214 
215  virtual std::vector<int> filter(const loos::AtomicGroup& solv, const loos::AtomicGroup& prot) {
216  return(base->filter(solv, prot));
217  }
218 
219  virtual std::vector<loos::GCoord> boundingBox(const loos::AtomicGroup& prot) {
220  return(base->boundingBox(prot));
221  }
222 
223  private:
224  WaterFilterBase *base;
225  };
226 
227 
230  public:
231  ZClippedWaterFilter(WaterFilterBase* p, const double zmin, const double zmax) : WaterFilterDecorator(p),
232  zmin_(zmin), zmax_(zmax) { }
233  virtual ~ZClippedWaterFilter() { }
234 
235  std::string name(void) const;
236  std::vector<int> filter(const loos::AtomicGroup&, const loos::AtomicGroup&);
237  std::vector<loos::GCoord> boundingBox(const loos::AtomicGroup&);
238 
239  double volume(void) { return(0.0); }
240 
241  private:
242  double zmin_, zmax_;
243  };
244 
245 
246 
248 
261  public:
262  BulkedWaterFilter(WaterFilterBase* p, const double pad, const double zmin, const double zmax) : WaterFilterDecorator(p),
263  pad_(pad),
264  zmin_(zmin), zmax_(zmax) { }
265  virtual ~BulkedWaterFilter() { }
266 
267  std::string name(void) const;
268  std::vector<int> filter(const loos::AtomicGroup&, const loos::AtomicGroup&);
269  std::vector<loos::GCoord> boundingBox(const loos::AtomicGroup&);
270 
271  double volume(void) { return(0.0); }
272 
273  private:
274  double pad_;
275  double zmin_, zmax_;
276  };
277 
278  };
279 
280 }
281 
282 
283 #endif
virtual std::vector< int > filter(const loos::AtomicGroup &, const loos::AtomicGroup &)
Given a molecule and a set of waters, pick which waters are inside.
virtual double volume(void)
Calculate the volume of the region we can pick waters from...
virtual std::vector< int > filter(const loos::AtomicGroup &, const loos::AtomicGroup &)
Given a molecule and a set of waters, pick which waters are inside.
Pick waters inside a bounding box.
double volume(void)
Calculate the volume of the region we can pick waters from...
virtual double volume(void)
Calculate the volume of the region we can pick waters from...
virtual std::string name(void) const
Just states the name of the filter/picker.
virtual double volume(void)
Calculate the volume of the region we can pick waters from...
std::vector< int > filter(const loos::AtomicGroup &, const loos::AtomicGroup &)
Given a molecule and a set of waters, pick which waters are inside.
virtual std::vector< loos::GCoord > boundingBox(const loos::AtomicGroup &prot)
Calculate the appropriate bounding box (given the molecule)
std::vector< int > filter(const loos::AtomicGroup &, const loos::AtomicGroup &)
Given a molecule and a set of waters, pick which waters are inside.
virtual std::vector< int > filter(const loos::AtomicGroup &, const loos::AtomicGroup &)
Given a molecule and a set of waters, pick which waters are inside.
virtual std::vector< int > filter(const loos::AtomicGroup &, const loos::AtomicGroup &)=0
Given a molecule and a set of waters, pick which waters are inside.
Restrict waters to be within a given z-range.
virtual std::vector< int > filter(const loos::AtomicGroup &solv, const loos::AtomicGroup &prot)
Given a molecule and a set of waters, pick which waters are inside.
virtual double volume(void)
Calculate the volume of the region we can pick waters from...
virtual double volume(void)
Calculate the volume of the region we can pick waters from...
virtual std::string name(void) const
Just states the name of the filter/picker.
Base interface for water filter/picker.
virtual std::vector< loos::GCoord > boundingBox(const loos::AtomicGroup &)
Calculate the appropriate bounding box (given the molecule)
std::vector< loos::GCoord > boundingBox(const loos::AtomicGroup &)
Calculate the appropriate bounding box (given the molecule)
std::vector< int > filter(const loos::AtomicGroup &, const loos::AtomicGroup &)
Given a molecule and a set of waters, pick which waters are inside.
std::vector< loos::GCoord > boundingBox(const loos::AtomicGroup &)
Calculate the appropriate bounding box (given the molecule)
virtual std::vector< loos::GCoord > boundingBox(const loos::AtomicGroup &)=0
Calculate the appropriate bounding box (given the molecule)
virtual std::string name(void) const
Just states the name of the filter/picker.
virtual std::string name(void) const
Just states the name of the filter/picker.
virtual std::vector< int > filter(const loos::AtomicGroup &, const loos::AtomicGroup &)
Given a molecule and a set of waters, pick which waters are inside.
std::vector< loos::GCoord > boundingBox(const loos::AtomicGroup &)
Calculate the appropriate bounding box (given the molecule)
virtual std::string name(void) const
Just states the name of the filter/picker.
Add bulk water back into the mask/map.
std::string name(void) const
Just states the name of the filter/picker.
std::vector< loos::GCoord > boundingBox(const loos::AtomicGroup &)
Calculate the appropriate bounding box (given the molecule)
Class for handling groups of Atoms (pAtoms, actually)
Definition: AtomicGroup.hpp:87
Pick waters within a given radius of a group of atoms.
Namespace for most things not already encapsulated within a class.
Pick waters that are within a radius of the principal axis for a molecule.
Pick waters that are within a radius of the core axis for a molecule.
double volume(void)
Calculate the volume of the region we can pick waters from...
Decorator base class for "decorating" the core water filters...
std::string name(void) const
Just states the name of the filter/picker.
virtual double volume(void)=0
Calculate the volume of the region we can pick waters from...
virtual std::vector< loos::GCoord > boundingBox(const loos::AtomicGroup &)
Calculate the appropriate bounding box (given the molecule)
virtual std::string name(void) const =0
Just states the name of the filter/picker.
virtual std::string name(void) const
Just states the name of the filter/picker.
virtual double volume(void)
Calculate the volume of the region we can pick waters from...
Pick waters based on a grid-mask.
std::vector< loos::GCoord > boundingBox(const loos::AtomicGroup &)
Calculate the appropriate bounding box (given the molecule)