Avogadro  1.1.0
/home/kitware/dashboards/avogadro/libavogadro/src/zmatrix.h
00001 /**********************************************************************
00002   ZMatrix - Class to store a z matrix
00003 
00004   Copyright (C) 2009 Marcus D. Hanwell
00005 
00006   This file is part of the Avogadro molecular editor project.
00007   For more information, see <http://avogadro.openmolecules.net/>
00008 
00009   Avogadro is free software; you can redistribute it and/or modify
00010   it under the terms of the GNU Lesser General Public License as published by
00011   the Free Software Foundation; either version 2.1 of the License, or
00012   (at your option) any later version.
00013 
00014   Avogadro 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 Street, Fifth Floor, Boston, MA
00022   02110-1301, USA.
00023  **********************************************************************/
00024 
00025 #ifndef ZMATRIX_H
00026 #define ZMATRIX_H
00027 
00028 #include "global.h"
00029 
00030 #include <QObject>
00031 #include <QList>
00032 
00033 namespace Avogadro {
00034 
00035   class Molecule;
00036 
00047   class A_EXPORT ZMatrix : public QObject
00048   {
00049     Q_OBJECT
00050 
00051   public:
00055     explicit ZMatrix(QObject *parent = 0);
00056 
00060     ~ZMatrix();
00061 
00066     void addRow(int row = -1);
00067 
00071     int rows();
00072 
00078     void setBond(int atom1, int atom2);
00079 
00083     void update();
00084 
00085 //  private:
00089     struct zItem
00090     {
00091       unsigned int atomIndex; // Unique ID of the atom
00092       short atomicNumber;     // The atomic number of the entry
00093       double lengths[3];      // Length, angle, dihedral
00094       short indices[3];       // z-matrix reference to other atoms in the matrix
00095     };
00096 
00097     QList<zItem> m_items;
00098     Molecule *m_molecule;
00099 
00100   Q_SIGNALS:
00101     void rowAdded(int row);
00102 
00103   };
00104 
00105   inline int ZMatrix::rows()
00106   {
00107     return m_items.size();
00108   }
00109 
00110 } // End namespace Avogadro
00111 
00112 #endif // ZMATRIX_H