The Gnome Chemistry Utils: crystalatom.h Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories

# 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 <list>
    00029 #include <libxml/parser.h>
    00030 #include <libxml/parserInternals.h>
    00031 #include <libxml/xmlmemory.h>
    00032 #include "atom.h"
    00033 #include "chemistry.h"
    00034
    00035 using namespace std;
    00036
    00037 namespace gcu
    00038 {
    00039
    00043 class CrystalAtom : public Atom
    00044 {
    00045 public:
    00046 /*
    00047 The default constructor.
    00048 */
    00049         CrystalAtom ();
    00050 /*
    00051 The destructor of CrystalAtom.
    00052 */
    00053         virtual ~CrystalAtom ();
    00054
    00055 public :
    00056 /*
    00057 @param Z: the atomic number of the new atom.
    00058 @param x: the x coordinate of the new atom.
    00059 @param y: the y coordinate of the new atom.
    00060 @param z: the z coordinate of the new atom.
    00061
    00062 Creates an atom.
    00063 */
    00064         CrystalAtom (int Z, double x, double y, double z);
    00070         CrystalAtom (CrystalAtom& caAtom);
    00071 /*
    00072 @param caAtom: the Atom to copy.
    00073
    00074 @return a CrystalAtom identical to caAtom.
    00075 */
    00076         CrystalAtom& operator= (CrystalAtom& caAtom);
    00077
    00081         void Draw ();
    00090         void SetColor (float red, float green, float blue, float alpha);
    00094         void SetDefaultColor ();
    00098         bool HasCustomColor () {return m_bCustomColor;}
    00108         void GetColor (double *red, double *green, double *blue, double *alpha);
    00114         void SetSize (double r);
    00118         double GetSize ();
    00123         bool operator== (CrystalAtom& caAtom);
    00128         void Cleave () {m_nCleave++;}
    00137         double ScalProd (int h, int k, int l);
    00150         void NetToCartesian (double a, double b, double c, double alpha, double beta, double gamma);
    00163         double Distance (double x, double y, double z, bool bFixed);
    00167         double r () {return m_Radius.value.value;}
    00171         const GcuAtomicRadius& GetRadius () {return m_Radius;}
    00175         void SetRadius (const GcuAtomicRadius& r);
    00179         bool IsCleaved () {return m_nCleave != 0;}
    00186         virtual bool SaveNode (xmlDocPtr xml, xmlNodePtr node);
    00192         virtual bool LoadNode (xmlNodePtr node);
    00193
    00194 protected:
    00198         float m_fBlue;
    00202         float m_fRed;
    00206         float m_fGreen;
    00210         float m_fAlpha;
    00214         bool m_bCustomColor;
    00218         GcuAtomicRadius m_Radius;
    00224         int m_nCleave; //0 if not cleaved
    00225 };
    00226
    00230 typedef list<CrystalAtom*> CrystalAtomList;
    00231
    00232 }// namespace gcu
    00233
    00234 #endif // CRYSTAL_ATOM_H