crystalatom.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 /* 
00004  * Gnome Chemistry Utils
00005  * crystalatom.h 
00006  *
00007  * Copyright (C) 2002-2008 Jean Bréfort <jean.brefort@normalesup.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  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
00022  * USA
00023  */
00024 
00025 #ifndef CRYSTAL_ATOM_H
00026 #define CRYSTAL_ATOM_H
00027 
00028 #include "atom.h"
00029 #include "chemistry.h"
00030 #include "macros.h"
00031 #include <libxml/parser.h>
00032 #include <libxml/parserInternals.h>
00033 #include <libxml/xmlmemory.h>
00034 #include <list>
00035 
00037 namespace gcu
00038 {
00039 
00040 #define PREC 1e-3
00041 
00045 class CrystalAtom : public Atom
00046 {
00047 public:
00048 /*
00049 The default constructor.
00050 */
00051         CrystalAtom ();
00052 /*
00053 The destructor of CrystalAtom.
00054 */
00055         virtual ~CrystalAtom ();
00056 
00057 public :
00058 /*
00059 @param Z: the atomic number of the new atom.
00060 @param x: the x coordinate of the new atom.
00061 @param y: the y coordinate of the new atom.
00062 @param z: the z coordinate of the new atom.
00063 
00064 Creates an atom.
00065 */
00066         CrystalAtom (int Z, double x, double y, double z);
00072         CrystalAtom (CrystalAtom& caAtom);
00073 /*
00074 @param caAtom: the Atom to copy.
00075 
00076 @return a CrystalAtom identical to caAtom.
00077 */
00078         CrystalAtom& operator= (CrystalAtom& caAtom);
00079 
00088         void SetColor (float red, float green, float blue, float alpha);
00092         void SetDefaultColor ();
00096         bool HasCustomColor () {return m_bCustomColor;}
00106         void GetColor (double *red, double *green, double *blue, double *alpha);
00112         void SetSize (double r);
00116         double GetSize ();
00121         bool operator== (CrystalAtom& caAtom);
00126         void Cleave () {m_nCleave++;}
00135         double ScalProd (int h, int k, int l);
00148         void NetToCartesian (double a, double b, double c, double alpha, double beta, double gamma);
00161         double Distance (double x, double y, double z, bool bFixed);
00165         double r () {return m_Radius.value.value;}
00169         const GcuAtomicRadius& GetRadius () {return m_Radius;}
00173         void SetRadius (const GcuAtomicRadius& r);
00177         bool IsCleaved () {return m_nCleave != 0;}
00184         virtual bool SaveNode (xmlDocPtr xml, xmlNodePtr node) const;
00190         virtual bool LoadNode (xmlNodePtr node);
00191 
00192 protected:
00196         float m_fBlue;
00200         float m_fRed;
00204         float m_fGreen;
00208         float m_fAlpha;
00212         bool m_bCustomColor;
00216         GcuAtomicRadius m_Radius;
00222         int m_nCleave; //0 if not cleaved
00223 
00231         bool SetProperty (unsigned property, char const *value);
00232 
00239         std::string GetProperty (unsigned property) const;
00240 
00241 GCU_PROP (double, EffectiveRadiusRatio);
00242 };
00243 
00247 typedef std::list<CrystalAtom*> CrystalAtomList;
00248 }// namespace gcu
00249 
00250 #endif // CRYSTAL_ATOM_H

Generated on Fri Sep 24 15:58:41 2010 for The Gnome Chemistry Utils by  doxygen 1.5.9