crystalatom.h

00001 // -*- C++ -*-
00002 
00003 /* 
00004  * Gnome Chemistry Utils
00005  * crystalatom.h 
00006  *
00007  * Copyright (C) 2002-2004 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 
00036 using namespace std;
00037 
00038 namespace gcu
00039 {
00040 
00044 class CrystalAtom : public Atom
00045 {
00046 public:
00047 /*
00048 The default constructor.
00049 */
00050         CrystalAtom ();
00051 /*
00052 The destructor of CrystalAtom.
00053 */
00054         virtual ~CrystalAtom ();
00055 
00056 public :
00057 /*
00058 @param Z: the atomic number of the new atom.
00059 @param x: the x coordinate of the new atom.
00060 @param y: the y coordinate of the new atom.
00061 @param z: the z coordinate of the new atom.
00062 
00063 Creates an atom.
00064 */
00065         CrystalAtom (int Z, double x, double y, double z);
00071         CrystalAtom (CrystalAtom& caAtom);
00072 /*
00073 @param caAtom: the Atom to copy.
00074 
00075 @return a CrystalAtom identical to caAtom.
00076 */
00077         CrystalAtom& operator= (CrystalAtom& caAtom);
00078 
00087         void SetColor (float red, float green, float blue, float alpha);
00091         void SetDefaultColor ();
00095         bool HasCustomColor () {return m_bCustomColor;}
00105         void GetColor (double *red, double *green, double *blue, double *alpha);
00111         void SetSize (double r);
00115         double GetSize ();
00120         bool operator== (CrystalAtom& caAtom);
00125         void Cleave () {m_nCleave++;}
00134         double ScalProd (int h, int k, int l);
00147         void NetToCartesian (double a, double b, double c, double alpha, double beta, double gamma);
00160         double Distance (double x, double y, double z, bool bFixed);
00164         double r () {return m_Radius.value.value;}
00168         const GcuAtomicRadius& GetRadius () {return m_Radius;}
00172         void SetRadius (const GcuAtomicRadius& r);
00176         bool IsCleaved () {return m_nCleave != 0;}
00183         virtual bool SaveNode (xmlDocPtr xml, xmlNodePtr node);
00189         virtual bool LoadNode (xmlNodePtr node);
00190         
00191 protected:
00195         float m_fBlue;
00199         float m_fRed;
00203         float m_fGreen;
00207         float m_fAlpha;
00211         bool m_bCustomColor;
00215         GcuAtomicRadius m_Radius;
00221         int m_nCleave; //0 if not cleaved
00222 
00223 GCU_PROP (double, EffectiveRadiusRatio);
00224 };
00225 
00229 typedef list<CrystalAtom*> CrystalAtomList;
00230 }// namespace gcu
00231 
00232 #endif // CRYSTAL_ATOM_H

Generated on Sun Sep 16 14:21:55 2007 for The Gnome Chemistry Utils by  doxygen 1.5.3