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           { m_HM = name; }
00045         void SetHallName(const char *name)
00046           { m_Hall = name; }
00047         void SetHallName(const std::string &name)
00048           { m_Hall = name; }
00049         void SetId(unsigned n)
00050           { m_id = n; }
00051         void AddTransform(const std::string &s);
00052 
00053         const std::string & GetHMName() const
00054           { return m_HM;}
00055         const std::string & GetHallName()const
00056           { return m_Hall;}
00057         unsigned GetId() const
00058           { return m_id; }
00059         std::list<vector3> Transform(const vector3 &v) const;
00060 
00061         transform3d const * BeginTransform(transform3dIterator &i) const;
00062         transform3d const * NextTransform(transform3dIterator &i) const;
00063 
00064         // static methods
00065         /* The name might be either a HM or Hall name */
00066         static const SpaceGroup * GetSpaceGroup (char const *name);
00067         static const SpaceGroup * GetSpaceGroup (const std::string &name);
00068         static const SpaceGroup * GetSpaceGroup (unsigned id);
00069         static const SpaceGroup * Find (SpaceGroup* group);
00070         /* Use it if the space group is unknown (might happen if no database has
00071          been loaded or if the HM name is not usual. */
00072         // Unfortunately, this seems to confuse the SWIG parser
00073         // Fortunately, it's not needed for the scripting bindings,
00074         // since this is internal code
00075 #ifndef SWIG
00076         void RegisterSpaceGroup (int nb = 0, ...);
00077 #endif
00078 
00079         bool operator ==(const SpaceGroup &) const;
00080         int operator!=(const SpaceGroup &other) const
00081           {
00082             return !((*this) == other);
00083           }
00084         bool IsValid() const;
00085 
00086       private:
00090         std::string m_HM;
00091         std::string m_Hall;
00092         unsigned int m_id;
00093         std::list<transform3d*> m_transforms;
00094     };
00095 
00096 }
00097 
00098 #endif // OB_SPACE_GROUP_H
00099 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines