LOOS  v2.3.2
water-lib.cpp
1 // -------------------------------------------------
2 // Water (density) 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 #include "water-lib.hpp"
30 
31 
32 namespace loos {
33  namespace DensityTools {
34 
35  std::vector<GCoord> getBounds(pTraj& traj, AtomicGroup& g, const std::vector<uint>& indices) {
36  double d = std::numeric_limits<double>::max();
37  GCoord min(d, d, d);
38  GCoord max(-d, -d, -d);
39 
40  for (std::vector<uint>::const_iterator i = indices.begin(); i != indices.end(); ++i) {
41  traj->readFrame(*i);
42  traj->updateGroupCoords(g);
43  std::vector<GCoord> bdd = g.boundingBox();
44  for (int j=0; j<3; ++j) {
45  if (bdd[0][j] < min[j])
46  min[j] = bdd[0][j];
47  if (bdd[1][j] > max[j])
48  max[j] = bdd[1][j];
49  }
50  }
51 
52  std::vector<GCoord> bdd;
53  bdd.push_back(min);
54  bdd.push_back(max);
55  return(bdd);
56  }
57 
58 
59  };
60 
61 };
std::vector< GCoord > getBounds(pTraj &traj, AtomicGroup &g, const std::vector< uint > &indices)
Get the max bounding box for a group over the trajectory.
Definition: water-lib.cpp:35
std::vector< GCoord > boundingBox(void) const
Bounding box for the group...
Class for handling groups of Atoms (pAtoms, actually)
Definition: AtomicGroup.hpp:87
Namespace for most things not already encapsulated within a class.