/src/openbabel/include/openbabel/math/spacegroup.h
Line | Count | Source |
1 | | /********************************************************************** |
2 | | spacegroup.h - Handle Crystallographic Space Groups. |
3 | | |
4 | | Copyright (C) 2007 by Jean Bréfort |
5 | | |
6 | | This file is part of the Open Babel project. |
7 | | For more information, see <http://openbabel.org/> |
8 | | |
9 | | This program is free software; you can redistribute it and/or |
10 | | modify it under the terms of the GNU General Public License as |
11 | | published by the Free Software Foundation; either version 2 of the |
12 | | License, or (at your option) any later version. |
13 | | |
14 | | This program is distributed in the hope that it will be useful, |
15 | | but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 | | GNU General Public License for more details. |
18 | | ***********************************************************************/ |
19 | | |
20 | | #ifndef OB_SPACE_GROUP_H |
21 | | #define OB_SPACE_GROUP_H |
22 | | |
23 | | #include <openbabel/math/transform3d.h> |
24 | | #include <string> |
25 | | #include <list> |
26 | | |
27 | | namespace OpenBabel |
28 | | { |
29 | | |
30 | | /** \class SpaceGroup spacegroup.h <openbabel/math/spacegroup.h> |
31 | | \brief Handle crystallographic space group symmetry |
32 | | \since version 2.2 |
33 | | \sa transform3d |
34 | | */ |
35 | | class OBAPI SpaceGroup |
36 | | { |
37 | | public: |
38 | | SpaceGroup(); |
39 | | ~SpaceGroup(); |
40 | | |
41 | | void SetHMName(const char *name); |
42 | | void SetHallName(const char *name) |
43 | 0 | { m_Hall = name; } |
44 | | void SetId(unsigned n) |
45 | 0 | { m_id = n; } |
46 | | void AddTransform(const std::string &s); |
47 | | |
48 | | const std::string & GetHMName() const |
49 | 0 | { return m_HM;} |
50 | | const std::string & GetHallName()const |
51 | 0 | { return m_Hall;} |
52 | | unsigned GetId() const |
53 | 0 | { return m_id; } |
54 | | unsigned int GetOriginAlternative() const |
55 | 0 | { return m_OriginAlternative; } |
56 | | std::list<vector3> Transform(const vector3 &v) const; |
57 | | |
58 | | transform3d const * BeginTransform(transform3dIterator &i) const; |
59 | | transform3d const * NextTransform(transform3dIterator &i) const; |
60 | | |
61 | | // static methods |
62 | | /* The name might be either a HM or Hall name */ |
63 | | static const SpaceGroup * GetSpaceGroup (char const *name); |
64 | | static const SpaceGroup * GetSpaceGroup (const std::string &name); |
65 | | static const SpaceGroup * GetSpaceGroup (unsigned id); |
66 | | static const SpaceGroup * Find (SpaceGroup* group); |
67 | | /* Use it if the space group is unknown (might happen if no database has |
68 | | been loaded or if the HM name is not usual. */ |
69 | | // Unfortunately, this seems to confuse the SWIG parser |
70 | | // Fortunately, it's not needed for the scripting bindings, |
71 | | // since this is internal code |
72 | | #ifndef SWIG |
73 | | void RegisterSpaceGroup (int nb = 0, ...); |
74 | | #endif |
75 | | |
76 | | bool operator ==(const SpaceGroup &) const; |
77 | | int operator!=(const SpaceGroup &other) const |
78 | 0 | { |
79 | 0 | return !((*this) == other); |
80 | 0 | } |
81 | | bool IsValid() const; |
82 | | |
83 | | const int HEXAGONAL_ORIGIN; |
84 | | |
85 | | private: |
86 | | /** |
87 | | * Hermann-Mauguin Symbol, long version (e.g. "I m m a", "P 1 21 1") |
88 | | */ |
89 | | std::string m_HM; |
90 | | std::string m_Hall; |
91 | | unsigned int m_id; |
92 | | unsigned int m_OriginAlternative; |
93 | | std::list<transform3d*> m_transforms; |
94 | | }; |
95 | | |
96 | | } |
97 | | |
98 | | #endif // OB_SPACE_GROUP_H |
99 | | |
100 | | //! \file spacegroup.h |
101 | | //! \brief Handle Crystallographic Space Groups |