Open Babel  3.0
spacegroup.h
Go to the documentation of this file.
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 
24 #include <string>
25 #include <list>
26 
27 namespace OpenBabel
28 {
29 
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  { m_Hall = name; }
44  void SetId(unsigned n)
45  { m_id = n; }
46  void AddTransform(const std::string &s);
47 
48  const std::string & GetHMName() const
49  { return m_HM;}
50  const std::string & GetHallName()const
51  { return m_Hall;}
52  unsigned GetId() const
53  { return m_id; }
54  unsigned int GetOriginAlternative() const
55  { 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  {
79  return !((*this) == other);
80  }
81  bool IsValid() const;
82 
83  const int HEXAGONAL_ORIGIN;
84 
85  private:
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 
unsigned int GetOriginAlternative() const
Definition: spacegroup.h:54
int operator!=(const SpaceGroup &other) const
Definition: spacegroup.h:77
const std::string & GetHallName() const
Definition: spacegroup.h:50
unsigned GetId() const
Definition: spacegroup.h:52
Handle 3D transformations, such as space group definitions.
Definition: transform3d.h:35
Represents a vector in 3-dimensional real space.
Definition: vector3.h:44
const int HEXAGONAL_ORIGIN
Definition: spacegroup.h:83
std::list< transform3d * >::const_iterator transform3dIterator
Definition: transform3d.h:75
void SetHallName(const char *name)
Definition: spacegroup.h:42
Handle 3D transformations in space groups.
void SetId(unsigned n)
Definition: spacegroup.h:44
Handle crystallographic space group symmetry.
Definition: spacegroup.h:35
const std::string & GetHMName() const
Definition: spacegroup.h:48
bool operator==(const OBBitVec &bv1, const OBBitVec &bv2)
Definition: bitvec.cpp:525
Global namespace for all Open Babel code.
Definition: alias.h:22