LOOS  v2.3.2
cryst.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 #if !defined(LOOS_CRYST_HPP)
27 #define LOOS_CRYST_HPP
28 
29 #include <loos_defs.hpp>
30 #include <Coord.hpp>
31 
32 namespace loos {
33 
35  class UnitCell {
36  public:
37  UnitCell() : _a(1.0), _b(1.0), _c(1.0),
38  _alpha(90.0), _beta(90.0), _gamma(90.0),
39  sgroup("P1"), zval(1) { }
40 
41  UnitCell(const GCoord& v) : _a(v.x()), _b(v.y()), _c(v.z()),
42  _alpha(90.0), _beta(90.0), _gamma(90.0),
43  sgroup("P1"), zval(1) { }
44 
45  greal a(void) const { return(_a); }
46  void a(const greal x) { _a = x; }
47 
48  greal b(void) const { return(_b); }
49  void b(const greal x) { _b = x; }
50 
51  greal c(void) const { return(_c); }
52  void c(const greal x) { _c = x; }
53 
54  greal alpha(void) const { return(_alpha); }
55  void alpha(const greal x) { _alpha = x; }
56 
57  greal beta(void) const { return(_beta); }
58  void beta(const greal x) { _beta = x; }
59 
60  greal gamma(void) const { return(_gamma); }
61  void gamma(const greal x) { _gamma = x; }
62 
63  std::string spaceGroup(void) const { return(sgroup); }
64  void spaceGroup(const std::string s) { sgroup = s; }
65 
66  int z(void) const { return(zval); }
67  void z(const int i) { zval = i; }
68 
69 #if !defined(SWIG)
70  friend std::ostream& operator<<(std::ostream& os, const UnitCell& u) {
71  os << "<UNITCELL A='" << u._a << "' B='" << u._b << "' C='" << u._c << "' ALPHA='";
72  os << u._alpha << "' BETA='" << u._beta << "' GAMMA='" << u._gamma << "' SPACEGROUP='";
73  os << u.sgroup << "' Z='" << u.zval << "'/>";
74  return(os);
75  }
76 #endif
77 
78 
79  private:
80  greal _a, _b, _c, _alpha, _beta, _gamma;
81  std::string sgroup;
82  int zval;
83  };
84 
85 
86 }
87 #endif
This class encapsulates crystallographic unit cell data.
Definition: cryst.hpp:35
Namespace for most things not already encapsulated within a class.