crystalatom.h

00001 // -*- C++ -*-
00002 
00003 /* 
00004  * Gnome Chemistry Utils
00005  * crystalatom.h 
00006  *
00007  * Copyright (C) 2002-2004
00008  *
00009  * Developed by Jean Bréfort <jean.brefort@normalesup.org>
00010  *
00011  * This library is free software; you can redistribute it and/or
00012  * modify it under the terms of the GNU Lesser General Public
00013  * License as published by the Free Software Foundation; either
00014  * version 2.1 of the License, or (at your option) any later version.
00015  *
00016  * This library is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019  * Lesser General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Lesser General Public
00022  * License along with this library; if not, write to the 
00023  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00024  * Boston, MA  02111-1307, USA.
00025  */
00026 
00027 #ifndef CRYSTAL_ATOM_H
00028 #define CRYSTAL_ATOM_H
00029 
00030 #include <list>
00031 #include <libxml/parser.h>
00032 #include <libxml/parserInternals.h>
00033 #include <libxml/xmlmemory.h>
00034 #include "atom.h"
00035 #include "chemistry.h"
00036 
00037 using namespace std;
00038 
00039 namespace gcu
00040 {
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 
00083         void Draw ();
00092         void SetColor (float red, float green, float blue, float alpha);
00096         void SetDefaultColor ();
00100         bool HasCustomColor () {return m_bCustomColor;}
00110         void GetColor (double *red, double *green, double *blue, double *alpha);
00116         void SetSize (double r);
00120         double GetSize ();
00125         bool operator== (CrystalAtom& caAtom);
00130         void Cleave () {m_nCleave++;}
00139         double ScalProd (int h, int k, int l);
00152         void NetToCartesian (double a, double b, double c, double alpha, double beta, double gamma);
00165         double Distance (double x, double y, double z, bool bFixed);
00169         double r () {return m_Radius.value;}
00173         const GcuAtomicRadius& GetRadius () {return m_Radius;}
00177         void SetRadius (const GcuAtomicRadius& r);
00181         bool IsCleaved () {return m_nCleave != 0;}
00188         virtual bool SaveNode (xmlDocPtr xml, xmlNodePtr node);
00194         virtual bool LoadNode (xmlNodePtr node);
00195         
00196 protected:
00200         float m_fBlue;
00204         float m_fRed;
00208         float m_fGreen;
00212         float m_fAlpha;
00216         bool m_bCustomColor;
00220         GcuAtomicRadius m_Radius;
00226         int m_nCleave; //0 if not cleaved
00227 };
00228 
00232 typedef list<CrystalAtom*> CrystalAtomList;
00233 
00234 }// namespace gcu
00235 
00236 #endif // CRYSTAL_ATOM_H

Generated on Sun Nov 27 18:17:32 2005 for The Gnome Chemistry Utils by  doxygen 1.4.5