spacegroup.h
Go to the documentation of this file.
00001 /********************************************************************** 00002 spacegroup.h - Handle Crystallographic Space Groups. 00003 00004 Copyright (C) 2007 by Jean Bréfort 00005 00006 This file is part of the Open Babel project. 00007 For more information, see <http://openbabel.org/> 00008 00009 This program is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU General Public License as 00011 published by the Free Software Foundation; either version 2 of the 00012 License, or (at your option) any later version. 00013 00014 This program is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU General Public License for more details. 00018 ***********************************************************************/ 00019 00020 #ifndef OB_SPACE_GROUP_H 00021 #define OB_SPACE_GROUP_H 00022 00023 #include <openbabel/math/transform3d.h> 00024 #include <string> 00025 #include <list> 00026 00027 namespace OpenBabel 00028 { 00029 00035 class OBAPI SpaceGroup 00036 { 00037 public: 00038 SpaceGroup(); 00039 ~SpaceGroup(); 00040 00041 void SetHMName(const char *name) 00042 { m_HM = name; } 00043 void SetHMName(const std::string &name); 00044 void SetHallName(const char *name) 00045 { m_Hall = name; } 00046 void SetHallName(const std::string &name) 00047 { m_Hall = name; } 00048 void SetId(unsigned n) 00049 { m_id = n; } 00050 void AddTransform(const std::string &s); 00051 00052 const std::string & GetHMName() const 00053 { return m_HM;} 00054 const std::string & GetHallName()const 00055 { return m_Hall;} 00056 unsigned GetId() const 00057 { return m_id; } 00058 unsigned int GetOriginAlternative() const 00059 { return m_OriginAlternative; } 00060 std::list<vector3> Transform(const vector3 &v) const; 00061 00062 transform3d const * BeginTransform(transform3dIterator &i) const; 00063 transform3d const * NextTransform(transform3dIterator &i) const; 00064 00065 // static methods 00066 /* The name might be either a HM or Hall name */ 00067 static const SpaceGroup * GetSpaceGroup (char const *name); 00068 static const SpaceGroup * GetSpaceGroup (const std::string &name); 00069 static const SpaceGroup * GetSpaceGroup (unsigned id); 00070 static const SpaceGroup * Find (SpaceGroup* group); 00071 /* Use it if the space group is unknown (might happen if no database has 00072 been loaded or if the HM name is not usual. */ 00073 // Unfortunately, this seems to confuse the SWIG parser 00074 // Fortunately, it's not needed for the scripting bindings, 00075 // since this is internal code 00076 #ifndef SWIG 00077 void RegisterSpaceGroup (int nb = 0, ...); 00078 #endif 00079 00080 bool operator ==(const SpaceGroup &) const; 00081 int operator!=(const SpaceGroup &other) const 00082 { 00083 return !((*this) == other); 00084 } 00085 bool IsValid() const; 00086 00087 private: 00091 std::string m_HM; 00092 std::string m_Hall; 00093 unsigned int m_id; 00094 unsigned int m_OriginAlternative; 00095 std::list<transform3d*> m_transforms; 00096 }; 00097 00098 } 00099 00100 #endif // OB_SPACE_GROUP_H 00101


