Open Babel: generic.h Source File

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

# generic.h

Go to the documentation of this file.

    00001 /**********************************************************************
    00002 generic.h - Handle generic data classes. Custom data for atoms, bonds, etc.
    00003
    00004 Copyright (C) 1998-2001 by OpenEye Scientific Software, Inc.
    00005 Some portions Copyright (C) 2001-2010 by Geoffrey R. Hutchison
    00006
    00007 This file is part of the Open Babel project.
    00008 For more information, see <http://openbabel.org/>
    00009
    00010 This program is free software; you can redistribute it and/or modify
    00011 it under the terms of the GNU General Public License as published by
    00012 the Free Software Foundation version 2 of the License.
    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
    00020 #ifndef OB_GENERIC_H
    00021 #define OB_GENERIC_H
    00022
    00023 #include <openbabel/babelconfig.h>
    00024
    00025 #include <string>
    00026 #include <vector>
    00027 #include <map>
    00028
    00029 #include <openbabel/math/spacegroup.h>
    00030 #include <openbabel/obutil.h>
    00031 #include <openbabel/base.h>
    00032
    00033 namespace OpenBabel
    00034 {
    00035
    00036   // Forward declarations
    00037   class OBBase;
    00038   class OBAtom;
    00039   class OBBond;
    00040   class OBMol;
    00041   class OBRing;
    00042
    00045  class OBAPI OBCommentData : public OBGenericData
    00046   {
    00047   protected:
    00048     std::string _data;
    00049   public:
    00050     OBCommentData();
    00051     OBCommentData(const OBCommentData&);
    00052     virtual OBGenericData* Clone(OBBase* /*parent*/) const{return new OBCommentData(*this);}
    00053
    00054     OBCommentData& operator=(const OBCommentData &src);
    00055
    00056     void          SetData(const std::string &data)
    00057     { _data = data; Trim(_data); }
    00058     void          SetData(const char *d)
    00059     {_data = d; Trim(_data);     }
    00060     const std::string &GetData()              const
    00061     {        return(_data);      }
    00062     virtual const std::string &GetValue()              const
    00063     {        return(_data);      }
    00064   };
    00065
    00069   class OBAPI OBExternalBond
    00070   {
    00071     int     _idx;
    00072     OBAtom *_atom;
    00073     OBBond *_bond;
    00074   public:
    00075   OBExternalBond(): _idx(0), _atom(NULL), _bond(NULL) {}
    00076     OBExternalBond(OBAtom *,OBBond *,int);
    00077     OBExternalBond(const OBExternalBond &);
    00078     ~OBExternalBond()   {}
    00079
    00080     int     GetIdx()  const    {        return(_idx);    }
    00081     OBAtom *GetAtom() const    {        return(_atom);   }
    00082     OBBond *GetBond() const    {        return(_bond);   }
    00083     void SetIdx(int idx)       {        _idx = idx;      }
    00084     void SetAtom(OBAtom *atom) {        _atom = atom;    }
    00085     void SetBond(OBBond *bond) {        _bond = bond;    }
    00086   };
    00087
    00090  class OBAPI OBExternalBondData : public OBGenericData
    00091   {
    00092   protected:
    00093     std::vector<OBExternalBond> _vexbnd;
    00094   public:
    00095     OBExternalBondData();
    00096
    00097     //Copying is not used and too much work to set up
    00098     virtual OBGenericData* Clone(OBBase* /*parent*/) const{return NULL;}
    00099
    00100     void SetData(OBAtom*,OBBond*,int);
    00101     std::vector<OBExternalBond> *GetData()
    00102       {
    00103         return(&_vexbnd);
    00104       }
    00105   };
    00106
    00112  class OBAPI OBPairData : public OBGenericData
    00113   {
    00114   protected:
    00115     std::string _value;
    00116   public:
    00117     OBPairData();
    00118     virtual OBGenericData* Clone(OBBase* /*parent*/) const
    00119       {return new OBPairData(*this);}
    00120     void    SetValue(const char *v)        {      _value = v;    }
    00121     void    SetValue(const std::string &v) {      _value = v;    }
    00122     virtual const std::string &GetValue() const
    00123     {      return(_value);    }
    00124   };
    00125
    00128   // More detailed description in generic.cpp
    00129   template <class ValueT>
    00130     class OBAPI OBPairTemplate : public OBGenericData
    00131   {
    00132   protected:
    00133     ValueT _value;
    00134   public:
    00135   OBPairTemplate():
    00136     OBGenericData("PairData", OBGenericDataType::PairData) {};
    00137     void SetValue(const ValueT t)             { _value = t;     }
    00138     virtual const ValueT &GetGenericValue() const    { return(_value); }
    00139   };
    00140
    00142   typedef OBPairTemplate<int>     OBPairInteger;
    00144   typedef OBPairTemplate<double>  OBPairFloatingPoint;
    00145
    00149  class OBAPI OBSetData : public OBGenericData
    00150   {
    00151   protected:
    00152     std::vector<OBGenericData *> _vdata;
    00153   public:
    00154   OBSetData() : OBGenericData("SetData", OBGenericDataType::SetData) {}
    00155     virtual OBGenericData* Clone(OBBase* /*parent*/) const{return new OBSetData(*this);}
    00156
    00158     void AddData(OBGenericData *d)
    00159     {
    00160       if(d)
    00161         {
    00162           _vdata.push_back(d);
    00163         }
    00164     }
    00165
    00167     void SetData(std::vector<OBGenericData *> &vdata)
    00168     {
    00169       _vdata = vdata;
    00170     }
    00171
    00173     OBGenericData *GetData(const char *s)
    00174     {
    00175       std::vector<OBGenericData*>::iterator i;
    00176
    00177       for (i = _vdata.begin();i != _vdata.end();++i)
    00178         if ((*i)->GetAttribute() == s)
    00179           return(*i);
    00180
    00181       return(NULL);
    00182     }
    00183
    00185     OBGenericData *GetData(const std::string &s)
    00186     {
    00187       std::vector<OBGenericData*>::iterator i;
    00188
    00189       for (i = _vdata.begin();i != _vdata.end();++i)
    00190         if ((*i)->GetAttribute() == s)
    00191           return(*i);
    00192
    00193       return(NULL);
    00194     }
    00195
    00197     virtual const std::vector<OBGenericData *> &GetData() const //now virtual and const
    00198     {
    00199       return(_vdata);
    00200     }
    00201
    00203     std::vector<OBGenericData*>::iterator GetBegin()
    00204       {
    00205         return _vdata.begin();
    00206       }
    00207
    00209     std::vector<OBGenericData*>::iterator GetEnd()
    00210       {
    00211         return _vdata.end();
    00212       }
    00213
    00215     void DeleteData(OBGenericData *gd)
    00216     {
    00217       std::vector<OBGenericData*>::iterator i;
    00218       for (i = _vdata.begin();i != _vdata.end();++i)
    00219         if (*i == gd)
    00220           {
    00221             delete *i;
    00222             _vdata.erase(i);
    00223             break; // Done, don't do anything more, since iterator is invalid
    00224           }
    00225     }
    00226
    00227   }; // OBSetData
    00228
    00232  class OBAPI OBVirtualBond : public OBGenericData
    00233   {
    00234   protected:
    00235     int _bgn;
    00236     int _end;
    00237     int _ord;
    00238     int _stereo;
    00239   public:
    00240     OBVirtualBond();
    00241     virtual OBGenericData* Clone(OBBase* /*parent*/) const{return new OBVirtualBond(*this);}
    00242     OBVirtualBond(int,int,int,int stereo=0);
    00243     int GetBgn()    {      return(_bgn);    }
    00244     int GetEnd()    {      return(_end);    }
    00245     int GetOrder()  {      return(_ord);    }
    00246     int GetStereo() {      return(_stereo); }
    00247   };
    00248
    00251  class OBAPI OBRingData : public OBGenericData
    00252   {
    00253   protected:
    00254     std::vector<OBRing*> _vr;
    00255   public:
    00256     OBRingData();
    00257     OBRingData(const OBRingData &);
    00258     // When copying a molecule, don't copy the RingData. Why not? Well,
    00259     // if you do, you'll end up with two RingDatas because one will already
    00260     // exist due to Kekulize() in EndModify() in operator= in OBMol. Having
    00261     // more than one RingData causes problems as one of them can become invalid
    00262     // and cause segfaults.
    00263     virtual OBGenericData* Clone(OBBase* /*parent*/) const{return NULL;}
    00264     ~OBRingData();
    00265
    00266     OBRingData &operator=(const OBRingData &);
    00267
    00268     void SetData(std::vector<OBRing*> &vr)
    00269     {
    00270       _vr = vr;
    00271     }
    00272     void PushBack(OBRing *r)
    00273     {
    00274       _vr.push_back(r);
    00275     }
    00276     std::vector<OBRing*> &GetData()
    00277       {
    00278         return(_vr);
    00279       }
    00280
    00281     std::vector<OBRing*>::iterator BeginRings()
    00282       { return(_vr.begin()); }
    00283     std::vector<OBRing*>::iterator EndRings()
    00284       { return(_vr.end()); }
    00285     OBRing *BeginRing(std::vector<OBRing*>::iterator &i);
    00286     OBRing *NextRing(std::vector<OBRing*>::iterator &i);
    00287   };
    00288
    00293  class OBAPI OBUnitCell: public OBGenericData
    00294   {
    00295   public:
    00296     enum LatticeType { Undefined,
    00297                        Triclinic,
    00298                        Monoclinic,
    00299                        Orthorhombic,
    00300                        Tetragonal,
    00301                        Rhombohedral ,
    00302                        Hexagonal,
    00303                        Cubic};
    00304
    00305
    00306   protected:
    00307     matrix3x3 _mOrtho;// Orthogonal matrix of column vectors
    00308     matrix3x3 _mOrient;// Orientation matrix
    00309     vector3 _offset;
    00310     std::string _spaceGroupName;
    00311     const SpaceGroup* _spaceGroup;
    00312     LatticeType _lattice;
    00313   public:
    00315     OBUnitCell();
    00316     OBUnitCell(const OBUnitCell &);
    00317     virtual OBGenericData* Clone(OBBase* /*parent*/) const
    00318     {return new OBUnitCell(*this);}
    00319     ~OBUnitCell()    {}
    00320
    00321     OBUnitCell &operator=(const OBUnitCell &);
    00322
    00332     void SetData(const double a, const double b, const double c,
    00333                  const double alpha, const double beta, const double gamma);
    00341     void SetData(const vector3 v1, const vector3 v2, const vector3 v3);
    00342
    00348     void SetData(const matrix3x3 m);
    00349
    00351     void SetOffset(const vector3 v1);
    00352
    00355     void SetSpaceGroup(const SpaceGroup* sg) { _spaceGroup = sg; }
    00356
    00360     void SetSpaceGroup(const std::string sg) { _spaceGroup = SpaceGroup::GetSpaceGroup (sg);
    00361                                                _spaceGroupName = sg; }
    00362
    00368     void SetSpaceGroup(const int sg) { _spaceGroup = SpaceGroup::GetSpaceGroup (sg); }
    00369
    00371     void SetLatticeType(const LatticeType lt) { _lattice = lt; }
    00372
    00375     void FillUnitCell(OBMol *);
    00376
    00378     double GetA();
    00380     double GetB();
    00382     double GetC();
    00384     double GetAlpha();
    00386     double GetBeta();
    00388     double GetGamma();
    00390     vector3 GetOffset();
    00391
    00393     const SpaceGroup* GetSpaceGroup() { return(_spaceGroup); }
    00394
    00396     const std::string GetSpaceGroupName() { return(_spaceGroupName); }
    00397
    00399     LatticeType GetLatticeType( int spacegroup );
    00400
    00402     LatticeType GetLatticeType();
    00403
    00405     std::vector<vector3> GetCellVectors();
    00414     matrix3x3   GetCellMatrix();
    00421     matrix3x3 GetOrthoMatrix();
    00431     matrix3x3 GetOrientationMatrix();
    00438     matrix3x3 GetFractionalMatrix();
    00439
    00446     vector3 FractionalToCartesian(vector3 frac);
    00453     vector3 CartesianToFractional(vector3 cart);
    00454
    00458     vector3 WrapCartesianCoordinate(vector3 cart);
    00462     vector3 WrapFractionalCoordinate(vector3 frac);
    00463
    00465     int GetSpaceGroupNumber( std::string name = "" );
    00467     double GetCellVolume();
    00468   };
    00469
    00475  class OBAPI OBConformerData: public OBGenericData
    00476   {
    00477   protected:
    00479     std::vector<unsigned short>              _vDimension;
    00481     std::vector<double>                      _vEnergies;
    00483     std::vector< std::vector< vector3 > >    _vForces;
    00485     std::vector< std::vector< vector3 > >    _vVelocity;
    00487     std::vector< std::vector< vector3 > >    _vDisplace;
    00489     std::vector<std::string>                 _vData;
    00490
    00491   public:
    00492     OBConformerData();
    00493     OBConformerData(const OBConformerData &);
    00494     virtual OBGenericData* Clone(OBBase* /*parent*/) const{return new OBConformerData(*this);}
    00495     ~OBConformerData()    {}
    00496
    00497     OBConformerData &operator=(const OBConformerData &);
    00498
    00499     void SetDimension(std::vector<unsigned short> vd) { _vDimension = vd; }
    00500     void SetEnergies(std::vector<double> ve) { _vEnergies = ve; }
    00501     void SetForces(std::vector< std::vector< vector3 > > vf) {_vForces = vf;}
    00502     void SetVelocities(std::vector< std::vector< vector3 > > vv)
    00503     { _vVelocity = vv; }
    00504     void SetDisplacements(std::vector< std::vector< vector3 > > vd)
    00505     { _vDisplace = vd; }
    00506     void SetData(std::vector<std::string> vdat) { _vData = vdat; }
    00507
    00508     std::vector<unsigned short> GetDimension() { return _vDimension; }
    00509     std::vector<double>         GetEnergies()  { return _vEnergies; }
    00510     std::vector< std::vector< vector3 > > GetForces() {return _vForces; }
    00511     std::vector< std::vector< vector3 > > GetVelocities()
    00512       {return _vVelocity;}
    00513     std::vector< std::vector< vector3 > > GetDisplacements()
    00514       {return _vDisplace;}
    00515     std::vector<std::string>    GetData() { return _vData; }
    00516
    00517   };
    00518
    00523  class OBAPI OBSymmetryData: public OBGenericData
    00524   {
    00525   protected:
    00526     std::string _spaceGroup;
    00527     std::string _pointGroup;
    00528   public:
    00529     OBSymmetryData();
    00530     OBSymmetryData(const OBSymmetryData &);
    00531     virtual OBGenericData* Clone(OBBase* /*parent*/) const{return new OBSymmetryData(*this);}
    00532     ~OBSymmetryData()    {}
    00533
    00534     OBSymmetryData &operator=(const OBSymmetryData &);
    00535
    00536     void SetData(std::string pg, std::string sg = "")
    00537     { _pointGroup = pg; _spaceGroup = sg; }
    00538     void SetPointGroup(std::string pg) { _pointGroup = pg; }
    00539     void SetSpaceGroup(std::string sg) { _spaceGroup = sg; }
    00540
    00541     std::string GetPointGroup() { return _pointGroup; }
    00542     std::string GetSpaceGroup() { return _spaceGroup; }
    00543   };
    00544
    00548   class OBAPI OBTorsion
    00549   {
    00550     friend class OBMol;
    00551     friend class OBTorsionData;
    00552
    00553   protected:
    00554     std::pair<OBAtom*,OBAtom*> _bc;
    00556     std::vector<triple<OBAtom*,OBAtom*,double> > _ads;
    00557
    00558     OBTorsion(): _bc((OBAtom *)NULL, (OBAtom *)NULL)      {      }
    00559     //protected for use only by friend classes
    00560     OBTorsion(OBAtom *, OBAtom *, OBAtom *, OBAtom *);
    00561
    00562     std::vector<quad<OBAtom*,OBAtom*,OBAtom*,OBAtom*> > GetTorsions();
    00563
    00564   public:
    00565     OBTorsion(const OBTorsion &);
    00566     ~OBTorsion()      {}
    00567
    00568     OBTorsion& operator=(const OBTorsion &);
    00569
    00570     void Clear();
    00571     bool Empty()    {      return(_bc.first == 0 && _bc.second == 0);    }
    00572
    00573     bool AddTorsion(OBAtom *a,OBAtom *b, OBAtom *c,OBAtom *d);
    00574     bool AddTorsion(quad<OBAtom*,OBAtom*,OBAtom*,OBAtom*> &atoms);
    00575
    00576     bool SetAngle(double radians, unsigned int index = 0);
    00577     bool SetData(OBBond * /*bond*/) { return false; }
    00578
    00579     bool GetAngle(double &radians, unsigned int index =0);
    00582     unsigned int GetBondIdx();
    00583     size_t GetSize() const    {      return _ads.size();    }
    00584
    00587     std::pair<OBAtom*,OBAtom*>                  GetBC()
    00588       {
    00589         return(_bc);
    00590       }
    00593     std::vector<triple<OBAtom*,OBAtom*,double> > GetADs()
    00594     {
    00595       return(_ads) ;
    00596     }
    00597
    00598     bool IsProtonRotor();
    00599   };
    00600
    00605  class OBAPI OBTorsionData : public OBGenericData
    00606   {
    00607     friend class OBMol;
    00608
    00609   protected:
    00610     std::vector<OBTorsion> _torsions;
    00611
    00612     OBTorsionData();
    00613     OBTorsionData(const OBTorsionData &);
    00614
    00615   public:
    00616     OBTorsionData &operator=(const OBTorsionData &);
    00617
    00619     virtual OBGenericData* Clone(OBBase* /*parent*/) const
    00620     {return new OBTorsionData(*this);}
    00621
    00622     void Clear();
    00623
    00626     std::vector<OBTorsion> GetData() const
    00627       {
    00628         return _torsions;
    00629       }
    00630
    00633     size_t      GetSize() const
    00634     {
    00635       return _torsions.size();
    00636     }
    00637
    00638     void SetData(OBTorsion &torsion);
    00639
    00640     bool FillTorsionArray(std::vector<std::vector<unsigned int> > &torsions);
    00641   };
    00642
    00645   class OBAPI OBAngle
    00646   {
    00647     friend class OBMol;
    00648     friend class OBAngleData;
    00649
    00650   protected:
    00651
    00652     //member data
    00653
    00654     OBAtom                *_vertex;
    00655     std::pair<OBAtom*,OBAtom*>  _termini;
    00656     double                  _radians;
    00657
    00658     //protected member functions
    00659
    00660     OBAngle();  //protect constructor for use only by friend classes
    00661     OBAngle(OBAtom *vertex,OBAtom *a,OBAtom *b);
    00662
    00663     triple<OBAtom*,OBAtom*,OBAtom*> GetAtoms();
    00664     void SortByIndex();
    00665
    00666   public:
    00667
    00668     OBAngle(const OBAngle &);
    00669     ~OBAngle()
    00670       {
    00671         _vertex = NULL;
    00672       }
    00673
    00674     OBAngle &operator = (const OBAngle &);
    00675     bool     operator ==(const OBAngle &);
    00676
    00677     void  Clear();
    00678
    00681     double GetAngle() const
    00682     {
    00683       return(_radians);
    00684     }
    00687     void  SetAngle(double angle)
    00688     {
    00689       _radians = angle;
    00690     }
    00691     void  SetAtoms(OBAtom *vertex,OBAtom *a,OBAtom *b);
    00692     void  SetAtoms(triple<OBAtom*,OBAtom*,OBAtom*> &atoms);
    00693
    00694   };
    00695
    00698  class OBAPI OBAngleData : public OBGenericData
    00699   {
    00700     friend class OBMol;
    00701
    00702   protected:
    00703     std::vector<OBAngle> _angles;
    00704
    00705     OBAngleData();
    00706     OBAngleData(const OBAngleData &);
    00708
    00709     std::vector<OBAngle> GetData() const
    00710       {
    00711         return(_angles);
    00712       }
    00713
    00714   public:
    00715     OBAngleData &operator =(const OBAngleData &);
    00716     virtual OBGenericData* Clone(OBBase* /*parent*/) const
    00717     {return new OBAngleData(*this);}
    00718
    00719     void Clear();
    00720     unsigned int FillAngleArray(int **angles, unsigned int &size);
    00721     bool FillAngleArray(std::vector<std::vector<unsigned int> > &angles);
    00722
    00723     void         SetData(OBAngle &);
    00726     size_t GetSize() const
    00727     {
    00728       return _angles.size();
    00729     }
    00730   };
    00731
    00732   enum atomreftype{
    00733     output,
    00734     input,
    00735     calcvolume
    00736   }; // sets which atom4ref is accessed by OBChiralData
    00737
    00741  class OBAPI OBChiralData : public OBGenericData
    00742   {
    00743     friend class OBMol;
    00744     friend class OBAtom;
    00745
    00746   protected:
    00747     std::vector<unsigned int> _atom4refs;
    00748     std::vector<unsigned int> _atom4refo;
    00749     std::vector<unsigned int> _atom4refc;
    00750
    00753     int parity;
    00754
    00755   public:
    00756
    00757     OBChiralData();
    00758     OBChiralData(const OBChiralData &src);
    00759     virtual OBGenericData* Clone(OBBase* /*parent*/) const
    00760       { return new OBChiralData(*this); }
    00761     OBChiralData &operator =(const OBChiralData &);
    00762     ~OBChiralData(){}
    00763
    00764     void Clear();
    00765
    00767     std::vector<unsigned int> GetAtom4Refs(atomreftype t) const;
    00769     unsigned int GetAtomRef(int a,atomreftype t);
    00770
    00771     bool SetAtom4Refs(std::vector<unsigned int> atom4refs, atomreftype t);
    00772     int AddAtomRef(unsigned int atomref, atomreftype t);
    00773
    00775     unsigned int GetSize(atomreftype t) const;
    00776   };
    00777
    00780  class OBSerialNums : public OBGenericData
    00781   {
    00782   protected:
    00783     std::map<int, OBAtom*> _serialMap;
    00784
    00785   public:
    00786
    00787   OBSerialNums() :
    00788     OBGenericData("obSerialNums", OBGenericDataType::SerialNums)
    00789       {}
    00790
    00791   OBSerialNums(const OBSerialNums &cp) : OBGenericData(cp)
    00792     {
    00793       _serialMap = cp._serialMap;
    00794     }
    00797     virtual OBGenericData* Clone(OBBase* /*parent*/) const
    00798     {return new OBSerialNums(*this);}
    00799
    00800     std::map<int,OBAtom*> &GetData()    { return _serialMap;    }
    00801     void SetData(std::map<int,OBAtom*> &sm) { _serialMap = sm;  }
    00802
    00803   };
    00804
    00807  class OBAPI OBVibrationData: public OBGenericData
    00808   {
    00809   protected:
    00811     std::vector< std::vector< vector3 > > _vLx;
    00812
    00814     std::vector<double>  _vFrequencies;
    00815
    00817     std::vector<double>  _vIntensities;
    00818
    00820     std::vector<double>  _vRamanActivities;
    00821
    00822   public:
    00823     OBVibrationData(): OBGenericData("VibrationData", OBGenericDataType::VibrationData){};
    00824     virtual ~OBVibrationData() {}
    00825     virtual OBGenericData* Clone(OBBase*) const
    00826          {return new OBVibrationData(*this);}
    00827
    00828     OBVibrationData & operator=(const OBVibrationData &);
    00829
    00830     void SetData(const std::vector< std::vector< vector3 > > & lx,
    00831                  const std::vector<double> & frequencies,
    00832                  const std::vector<double> & intensities);
    00833     void SetData(const std::vector< std::vector< vector3 > > &,
    00834                  const std::vector<double> &,
    00835                  const std::vector<double> &,
    00836                  const std::vector<double> &);
    00837
    00838     std::vector< std::vector< vector3 > > GetLx() const
    00839       { return this->_vLx; }
    00840     std::vector<double> GetFrequencies() const
    00841       { return this->_vFrequencies; }
    00842     std::vector<double> GetIntensities() const
    00843       { return this->_vIntensities; }
    00844     std::vector<double> GetRamanActivities() const
    00845       { return this->_vRamanActivities; }
    00846
    00847     unsigned int GetNumberOfFrequencies() const;
    00848 };
    00849
    00852  class OBAPI OBDOSData: public OBGenericData
    00853   {
    00854   protected:
    00856     double _fermi;
    00857
    00859     std::vector<double>  _vEnergies;
    00860
    00862     std::vector<double>  _vDensities;
    00863
    00865     std::vector<double>  _vIntegration;
    00866
    00867   public:
    00868     OBDOSData(): OBGenericData("DOSData", OBGenericDataType::DOSData){};
    00869     virtual ~OBDOSData() {}
    00870     virtual OBGenericData* Clone(OBBase*) const
    00871          {return new OBDOSData(*this);}
    00872
    00873     OBDOSData & operator=(const OBDOSData &);
    00874
    00875     void SetData(double,
    00876                  const std::vector<double> &,
    00877                  const std::vector<double> &,
    00878                  const std::vector<double> &);
    00879
    00880     double GetFermiEnergy() const
    00881       { return this->_fermi; }
    00882     std::vector<double> GetEnergies() const
    00883       { return this->_vEnergies; }
    00884     std::vector<double> GetDensities() const
    00885       { return this->_vDensities; }
    00886     std::vector<double> GetIntegration() const
    00887       { return this->_vIntegration; }
    00888   };
    00889
    00893   class OBAPI OBOrbital
    00894   {
    00895     friend class OBOrbitalData;
    00896   protected:
    00897     double       _energy;
    00898     double       _occupation;
    00899     std::string  _mullikenSymbol;
    00900   public:
    00901     void SetData(double energy, double occupation = 2.0, std::string symbol = "A")
    00902     { _energy = energy; _occupation = occupation; _mullikenSymbol = symbol; }
    00903
    00904     double GetEnergy() const        { return _energy; }
    00905     double GetOccupation() const    { return _occupation; }
    00906     std::string GetSymbol() const   { return _mullikenSymbol; }
    00907   };
    00908
    00911   class OBAPI OBOrbitalData: public OBGenericData
    00912   {
    00913   public:
    00914     OBOrbitalData(): OBGenericData("OrbitalData", OBGenericDataType::ElectronicData),
    00915       _alphaHOMO(0), _betaHOMO(0), _openShell(false) {};
    00916     virtual ~OBOrbitalData() {}
    00917     virtual OBGenericData* Clone(OBBase*) const
    00918          {return new OBOrbitalData(*this);}
    00919
    00920     OBOrbitalData & operator=(const OBOrbitalData &);
    00921
    00922     void SetAlphaOrbitals(std::vector<OBOrbital> orbitalList)
    00923     { _alphaOrbitals = orbitalList; }
    00924     void SetBetaOrbitals(std::vector<OBOrbital> orbitalList)
    00925     { _betaOrbitals = orbitalList; }
    00926     void SetHOMO(int alpha, int beta = 0)
    00927     { _alphaHOMO = alpha; _betaHOMO = beta; }
    00928     void SetOpenShell(bool openShell)
    00929     { _openShell = openShell; }
    00930
    00931     bool IsOpenShell() { return _openShell; }
    00932
    00933     unsigned int GetAlphaHOMO() { return _alphaHOMO; }
    00934     unsigned int GetBetaHOMO() { return _betaHOMO; }
    00935     std::vector<OBOrbital> GetAlphaOrbitals() { return _alphaOrbitals; }
    00936     std::vector<OBOrbital> GetBetaOrbitals() { return _betaOrbitals; }
    00937
    00940     void LoadClosedShellOrbitals(std::vector<double> energies, std::vector<std::string> symmetries, int alphaHOMO);
    00942     void LoadAlphaOrbitals(std::vector<double> energies, std::vector<std::string> symmetries, int alphaHOMO);
    00944     void LoadBetaOrbitals(std::vector<double> energies, std::vector<std::string> symmetries, int betaHOMO);
    00945
    00946   protected:
    00947     std::vector<OBOrbital> _alphaOrbitals;
    00948     std::vector<OBOrbital> _betaOrbitals;
    00949     unsigned int _alphaHOMO;
    00950     unsigned int _betaHOMO;
    00951     bool _openShell;
    00952   };
    00953
    00956  class OBAPI OBElectronicTransitionData: public OBGenericData
    00957   {
    00958   protected:
    00960     std::vector<double>  _vWavelengths;
    00961
    00963     std::vector<double>  _vForces;
    00964
    00966     std::vector<double>  _vEDipole;
    00967
    00969     std::vector<double>  _vRotatoryStrengthsVelocity;
    00970
    00972     std::vector<double>  _vRotatoryStrengthsLength;
    00973
    00974   public:
    00975     OBElectronicTransitionData(): OBGenericData("ElectronicTransitionData", OBGenericDataType::ElectronicTransitionData) {}
    00976     virtual ~OBElectronicTransitionData() {}
    00977     virtual OBGenericData* Clone(OBBase*) const
    00978          {return new OBElectronicTransitionData(*this);}
    00979
    00980     OBElectronicTransitionData & operator=(const OBElectronicTransitionData &);
    00981
    00982     void SetData(const std::vector<double> & wavelengths,
    00983                  const std::vector<double> & forces);
    00984
    00985     void SetEDipole(const std::vector<double> &);
    00986     void SetRotatoryStrengthsVelocity(const std::vector<double> &);
    00987     void SetRotatoryStrengthsLength(const std::vector<double> &);
    00988
    00989     std::vector<double> GetWavelengths() const
    00990       { return this->_vWavelengths; }
    00991     std::vector<double> GetForces() const
    00992       { return this->_vForces; }
    00993     std::vector<double> GetEDipole() const
    00994       { return this->_vEDipole; }
    00995     std::vector<double> GetRotatoryStrengthsVelocity() const
    00996       { return this->_vRotatoryStrengthsVelocity; }
    00997     std::vector<double> GetRotatoryStrengthsLength() const
    00998       { return this->_vRotatoryStrengthsLength; }
    00999 };
    01000
    01003  class OBAPI OBRotationData: public OBGenericData
    01004  {
    01005  public:
    01006    enum RType{UNKNOWN, ASYMMETRIC, SYMMETRIC, LINEAR};
    01007    OBRotationData(): OBGenericData("RotationData", OBGenericDataType::RotationData){}
    01008    virtual ~OBRotationData(){};
    01009    virtual OBGenericData* Clone(OBBase*) const
    01010          {return new OBRotationData(*this);}
    01011    void SetData(RType RotorType, std::vector<double> RotationalConstants, int SymmetryNumber)
    01012    {
    01013      RotConsts = RotationalConstants;
    01014      type = RotorType;
    01015      SymNum = SymmetryNumber;
    01016    }
    01017
    01019    std::vector<double> GetRotConsts()const{ return RotConsts; }
    01020
    01021    int GetSymmetryNumber()const{ return SymNum; }
    01022    RType GetRotorType()const   { return type; }
    01023
    01024  protected:
    01025    std::vector<double> RotConsts;
    01026    int                 SymNum;
    01027    RType               type;
    01028  };
    01029
    01033  class OBAPI OBVectorData: public OBGenericData
    01034  {
    01035  public:
    01036    OBVectorData(): OBGenericData("VectorData", OBGenericDataType::VectorData){}
    01037    virtual ~OBVectorData(){};
    01038    virtual OBGenericData* Clone(OBBase*) const
    01039          {return new OBVectorData(*this);}
    01040    void SetData(double x, double y, double z)
    01041      { _vec = vector3(x, y, z); }
    01042    void SetData(vector3 data)
    01043      { _vec = data; }
    01044    vector3 GetData() const
    01045      { return _vec; }
    01046
    01047  protected:
    01048    vector3            _vec;
    01049  };
    01050
    01054   class OBAPI OBMatrixData: public OBGenericData
    01055   {
    01056   public:
    01057     OBMatrixData(): OBGenericData("MatrixData", OBGenericDataType::MatrixData){}
    01058     virtual ~OBMatrixData(){};
    01059     virtual OBGenericData* Clone(OBBase*) const
    01060           {return new OBMatrixData(*this);}
    01061     void SetData(matrix3x3 data)
    01062       { _matrix = data; }
    01063     matrix3x3 GetData() const
    01064       { return _matrix; }
    01065
    01066   protected:
    01067     matrix3x3            _matrix;
    01068   };
    01069
    01071   typedef std::vector<OBGenericData*>::iterator OBDataIterator;
    01072
    01073 } //end namespace OpenBabel
    01074
    01075 #endif // OB_GENERIC_H
    01076

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

This file is part of the documentation for Open Babel, version 2.3.

Documentation copyright © 1998-2007, the Open Babel Developers.
Open Babel is hosted by:
Generated on Mon Oct 25 2010 11:55:09 by 1.7.2.