LOOS  v2.3.2
Selectors.hpp
1 /*
2  This file is part of LOOS.
3 
4  LOOS (Lightweight Object-Oriented Structure library)
5  Copyright (c) 2008, Tod D. Romo, Alan Grossfield
6  Department of Biochemistry and Biophysics
7  School of Medicine & Dentistry, University of Rochester
8 
9  This package (LOOS) is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation under version 3 of the License.
12 
13  This package is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 
23 
24 
25 
26 
27 #if !defined(LOOS_SELECTORS_HPP)
28 #define LOOS_SELECTORS_HPP
29 
30 #include <loos_defs.hpp>
31 #include <AtomicGroup.hpp>
32 #include <Kernel.hpp>
33 
34 
35 namespace loos {
36 
38  struct IndexSelector : public AtomSelector {
39  IndexSelector(const uint index) : _index(index) { }
40 
41  bool operator()(const pAtom& pa) const;
42 
43  uint _index;
44  };
45 
46 
48  struct CAlphaSelector : public AtomSelector {
49  bool operator()(const pAtom&) const;
50  };
51 
53  class BackboneSelector : public AtomSelector {
54  static const uint nresnames = 38;
55  static std::string residue_names[nresnames];
56 
57  static const uint natomnames = 33;
58  static std::string atom_names[natomnames];
59 
60  public:
61  bool operator()(const pAtom&) const;
62  };
63 
64 
66  struct SegidSelector : public AtomSelector {
67  explicit SegidSelector(const std::string s) : str(s) { }
68  bool operator()(const pAtom&) const;
69 
70  std::string str;
71  };
72 
73 
75  struct AtomNameSelector : public AtomSelector {
76  explicit AtomNameSelector(const std::string& s) : str(s) { }
77  bool operator()(const pAtom&) const;
78 
79  std::string str;
80  };
81 
82 
84  struct ResidRangeSelector : public AtomSelector {
85  ResidRangeSelector(const int low, const int high) : _low(low), _high(high) { }
86  bool operator()(const pAtom&) const;
87 
88  int _low, _high;
89  };
90 
92  struct ZSliceSelector : public AtomSelector {
93  ZSliceSelector(const greal min, const greal max) : _min(min), _max(max) { }
94  bool operator()(const pAtom& pa) const;
95 
96  greal _min, _max;
97  };
98 
99 
101 
112  struct NotSelector : public AtomSelector {
113  explicit NotSelector(const AtomSelector& s) : sel(s) { }
114  bool operator()(const pAtom&) const;
115 
116  const AtomSelector& sel;
117  };
118 
119 
121  struct HydrogenSelector : public AtomSelector {
122  bool operator()(const pAtom&) const;
123  };
124 
126  struct HeavyAtomSelector : public AtomSelector {
127  HydrogenSelector hsel;
128  NotSelector not_heavy;
129  HeavyAtomSelector() : not_heavy(hsel) { }
130  bool operator()(const pAtom& pa) const;
131  };
132 
133 
135 
146  struct AndSelector : public AtomSelector {
147  AndSelector(const AtomSelector& x, const AtomSelector& y) : lhs(x), rhs(y) { }
148  bool operator()(const pAtom& pa) const;
149 
150  const AtomSelector& lhs;
151  const AtomSelector& rhs;
152  };
153 
154 
155 
157 
168  struct OrSelector : public AtomSelector {
169  OrSelector(const AtomSelector& x, const AtomSelector& y) : lhs(x), rhs(y) { }
170  bool operator()(const pAtom& pa) const;
171 
172  const AtomSelector& lhs;
173  const AtomSelector& rhs;
174  };
175 
176 
177 
178 
179 
180 
181 
183  struct SolventSelector : public AtomSelector {
184  SolventSelector() : s1("SOLV"), s2("BULK"), osel(s1, s2) {}
185  bool operator()(const pAtom& pa) const;
186 
187  SegidSelector s1, s2;
188  OrSelector osel;
189  };
190 
191 
192 
195  HeavySolventSelector() : sel(s1, s2) { }
196  bool operator()(const pAtom& pa) const;
197 
198  SolventSelector s1;
200  AndSelector sel;
201  };
202 
203 
204 
205 
207 
219  class KernelSelector : public AtomSelector {
220  public:
221  explicit KernelSelector(Kernel& k) : krnl(k) { }
222 
223  bool operator()(const pAtom& pa) const;
224 
225  private:
226  Kernel& krnl;
227 
228  };
229 
230 
231 }
232 
233 #endif
234 
Predicate for selecting atoms from a range of resid's.
Definition: Selectors.hpp:84
bool operator()(const pAtom &pa) const
Definition: Selectors.cpp:170
bool operator()(const pAtom &pa) const
Definition: Selectors.cpp:156
bool operator()(const pAtom &pa) const
Definition: Selectors.cpp:137
bool operator()(const pAtom &) const
Definition: Selectors.cpp:128
bool operator()(const pAtom &) const
Definition: Selectors.cpp:32
bool operator()(const pAtom &) const
Definition: Selectors.cpp:132
bool operator()(const pAtom &pa) const
Definition: Selectors.cpp:175
bool operator()(const pAtom &pa) const
Definition: Selectors.cpp:27
Predicate for selecting backbone.
Definition: Selectors.hpp:53
Combines two selectors with a logical "or".
Definition: Selectors.hpp:168
bool operator()(const pAtom &pa) const
Definition: Selectors.cpp:161
Combines two selectors with a logical "and".
Definition: Selectors.hpp:146
Virtual base-class for selecting atoms from a group.
Definition: AtomicGroup.hpp:56
bool operator()(const pAtom &) const
Definition: Selectors.cpp:116
Predicate for selecting CA atoms.
Definition: Selectors.hpp:48
Predicate for selecting atoms in a specific range of z values.
Definition: Selectors.hpp:92
Selection predicate that executes a compiled Kernel.
Definition: Selectors.hpp:219
bool operator()(const pAtom &) const
Definition: Selectors.cpp:124
Select hydrogen atoms.
Definition: Selectors.hpp:121
Predicate for selecting solvent based on common solvent SEGIDs.
Definition: Selectors.hpp:183
bool operator()(const pAtom &) const
Definition: Selectors.cpp:142
bool operator()(const pAtom &) const
Definition: Selectors.cpp:146
Predicate for selecting atoms based on the passed segid string.
Definition: Selectors.hpp:66
Negates a selection predicate.
Definition: Selectors.hpp:112
Select non-hydrogen atoms.
Definition: Selectors.hpp:126
Predicate for selecting atoms based on explicit name matching.
Definition: Selectors.hpp:75
Namespace for most things not already encapsulated within a class.
The Kernel (virtual machine) for compiling and executing user-defined atom selections.
Definition: Kernel.hpp:42
Predicate for selecting atoms based on index.
Definition: Selectors.hpp:38
bool operator()(const pAtom &pa) const
Definition: Selectors.cpp:165
Select only heavy solvent atoms.
Definition: Selectors.hpp:194
bool operator()(const pAtom &pa) const
Definition: Selectors.cpp:179