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 00380 double GetA(); 00381 double GetA() const; 00383 double GetB(); 00384 double GetB() const; 00386 double GetC(); 00387 double GetC() const; 00389 double GetAlpha(); 00390 double GetAlpha() const; 00392 double GetBeta(); 00393 double GetBeta() const; 00395 double GetGamma(); 00396 double GetGamma() const; 00398 vector3 GetOffset(); 00399 vector3 GetOffset() const; 00400 00402 const SpaceGroup* GetSpaceGroup() { return(_spaceGroup); } 00403 const SpaceGroup* GetSpaceGroup() const { return(_spaceGroup); } 00404 00406 const std::string GetSpaceGroupName() { return(_spaceGroupName); } 00407 const std::string GetSpaceGroupName() const { return(_spaceGroupName); } 00408 00410 LatticeType GetLatticeType( int spacegroup ); 00411 LatticeType GetLatticeType( int spacegroup ) const; 00412 00414 LatticeType GetLatticeType(); 00415 LatticeType GetLatticeType() const; 00416 00418 std::vector<vector3> GetCellVectors(); 00419 std::vector<vector3> GetCellVectors() const; 00428 matrix3x3 GetCellMatrix(); 00429 matrix3x3 GetCellMatrix() const; 00436 matrix3x3 GetOrthoMatrix(); 00437 matrix3x3 GetOrthoMatrix() const; 00447 matrix3x3 GetOrientationMatrix(); 00448 matrix3x3 GetOrientationMatrix() const; 00455 matrix3x3 GetFractionalMatrix(); 00456 matrix3x3 GetFractionalMatrix() const; 00457 00464 vector3 FractionalToCartesian(vector3 frac); 00465 vector3 FractionalToCartesian(vector3 frac) const; 00472 vector3 CartesianToFractional(vector3 cart); 00473 vector3 CartesianToFractional(vector3 cart) const; 00474 00478 vector3 WrapCartesianCoordinate(vector3 cart); 00479 vector3 WrapCartesianCoordinate(vector3 cart) const; 00484 vector3 WrapFractionalCoordinate(vector3 frac); 00485 vector3 WrapFractionalCoordinate(vector3 frac) const; 00486 00488 int GetSpaceGroupNumber( std::string name = "" ); 00489 int GetSpaceGroupNumber( std::string name = "" ) const; 00491 double GetCellVolume(); 00492 double GetCellVolume() const; 00493 }; 00494 00500 class OBAPI OBConformerData: public OBGenericData 00501 { 00502 protected: 00504 std::vector<unsigned short> _vDimension; 00506 std::vector<double> _vEnergies; 00508 std::vector< std::vector< vector3 > > _vForces; 00510 std::vector< std::vector< vector3 > > _vVelocity; 00512 std::vector< std::vector< vector3 > > _vDisplace; 00514 std::vector<std::string> _vData; 00515 00516 public: 00517 OBConformerData(); 00518 OBConformerData(const OBConformerData &); 00519 virtual OBGenericData* Clone(OBBase* /*parent*/) const{return new OBConformerData(*this);} 00520 ~OBConformerData() {} 00521 00522 OBConformerData &operator=(const OBConformerData &); 00523 00524 void SetDimension(std::vector<unsigned short> vd) { _vDimension = vd; } 00525 void SetEnergies(std::vector<double> ve) { _vEnergies = ve; } 00526 void SetForces(std::vector< std::vector< vector3 > > vf) {_vForces = vf;} 00527 void SetVelocities(std::vector< std::vector< vector3 > > vv) 00528 { _vVelocity = vv; } 00529 void SetDisplacements(std::vector< std::vector< vector3 > > vd) 00530 { _vDisplace = vd; } 00531 void SetData(std::vector<std::string> vdat) { _vData = vdat; } 00532 00533 std::vector<unsigned short> GetDimension() { return _vDimension; } 00534 std::vector<double> GetEnergies() { return _vEnergies; } 00535 std::vector< std::vector< vector3 > > GetForces() {return _vForces; } 00536 std::vector< std::vector< vector3 > > GetVelocities() 00537 {return _vVelocity;} 00538 std::vector< std::vector< vector3 > > GetDisplacements() 00539 {return _vDisplace;} 00540 std::vector<std::string> GetData() { return _vData; } 00541 00542 }; 00543 00548 class OBAPI OBSymmetryData: public OBGenericData 00549 { 00550 protected: 00551 std::string _spaceGroup; 00552 std::string _pointGroup; 00553 public: 00554 OBSymmetryData(); 00555 OBSymmetryData(const OBSymmetryData &); 00556 virtual OBGenericData* Clone(OBBase* /*parent*/) const{return new OBSymmetryData(*this);} 00557 ~OBSymmetryData() {} 00558 00559 OBSymmetryData &operator=(const OBSymmetryData &); 00560 00561 void SetData(std::string pg, std::string sg = "") 00562 { _pointGroup = pg; _spaceGroup = sg; } 00563 void SetPointGroup(std::string pg) { _pointGroup = pg; } 00564 void SetSpaceGroup(std::string sg) { _spaceGroup = sg; } 00565 00566 std::string GetPointGroup() { return _pointGroup; } 00567 std::string GetSpaceGroup() { return _spaceGroup; } 00568 }; 00569 00573 class OBAPI OBTorsion 00574 { 00575 friend class OBMol; 00576 friend class OBTorsionData; 00577 00578 protected: 00579 std::pair<OBAtom*,OBAtom*> _bc; 00581 std::vector<triple<OBAtom*,OBAtom*,double> > _ads; 00582 00583 OBTorsion(): _bc((OBAtom *)NULL, (OBAtom *)NULL) { } 00584 //protected for use only by friend classes 00585 OBTorsion(OBAtom *, OBAtom *, OBAtom *, OBAtom *); 00586 00587 std::vector<quad<OBAtom*,OBAtom*,OBAtom*,OBAtom*> > GetTorsions(); 00588 00589 public: 00590 OBTorsion(const OBTorsion &); 00591 ~OBTorsion() {} 00592 00593 OBTorsion& operator=(const OBTorsion &); 00594 00595 void Clear(); 00596 bool Empty() { return(_bc.first == 0 && _bc.second == 0); } 00597 00598 bool AddTorsion(OBAtom *a,OBAtom *b, OBAtom *c,OBAtom *d); 00599 bool AddTorsion(quad<OBAtom*,OBAtom*,OBAtom*,OBAtom*> &atoms); 00600 00601 bool SetAngle(double radians, unsigned int index = 0); 00602 bool SetData(OBBond * /*bond*/) { return false; } 00603 00604 bool GetAngle(double &radians, unsigned int index =0); 00607 unsigned int GetBondIdx(); 00608 size_t GetSize() const { return _ads.size(); } 00609 00612 std::pair<OBAtom*,OBAtom*> GetBC() 00613 { 00614 return(_bc); 00615 } 00618 std::vector<triple<OBAtom*,OBAtom*,double> > GetADs() 00619 { 00620 return(_ads) ; 00621 } 00622 00623 bool IsProtonRotor(); 00624 }; 00625 00630 class OBAPI OBTorsionData : public OBGenericData 00631 { 00632 friend class OBMol; 00633 00634 protected: 00635 std::vector<OBTorsion> _torsions; 00636 00637 OBTorsionData(); 00638 OBTorsionData(const OBTorsionData &); 00639 00640 public: 00641 OBTorsionData &operator=(const OBTorsionData &); 00642 00644 virtual OBGenericData* Clone(OBBase* /*parent*/) const 00645 {return new OBTorsionData(*this);} 00646 00647 void Clear(); 00648 00651 std::vector<OBTorsion> GetData() const 00652 { 00653 return _torsions; 00654 } 00655 00658 size_t GetSize() const 00659 { 00660 return _torsions.size(); 00661 } 00662 00663 void SetData(OBTorsion &torsion); 00664 00665 bool FillTorsionArray(std::vector<std::vector<unsigned int> > &torsions); 00666 }; 00667 00670 class OBAPI OBAngle 00671 { 00672 friend class OBMol; 00673 friend class OBAngleData; 00674 00675 protected: 00676 00677 //member data 00678 00679 OBAtom *_vertex; 00680 std::pair<OBAtom*,OBAtom*> _termini; 00681 double _radians; 00682 00683 //protected member functions 00684 00685 OBAngle(); //protect constructor for use only by friend classes 00686 OBAngle(OBAtom *vertex,OBAtom *a,OBAtom *b); 00687 00688 triple<OBAtom*,OBAtom*,OBAtom*> GetAtoms(); 00689 void SortByIndex(); 00690 00691 public: 00692 00693 OBAngle(const OBAngle &); 00694 ~OBAngle() 00695 { 00696 _vertex = NULL; 00697 } 00698 00699 OBAngle &operator = (const OBAngle &); 00700 bool operator ==(const OBAngle &); 00701 00702 void Clear(); 00703 00706 double GetAngle() const 00707 { 00708 return(_radians); 00709 } 00712 void SetAngle(double angle) 00713 { 00714 _radians = angle; 00715 } 00716 void SetAtoms(OBAtom *vertex,OBAtom *a,OBAtom *b); 00717 void SetAtoms(triple<OBAtom*,OBAtom*,OBAtom*> &atoms); 00718 00719 }; 00720 00723 class OBAPI OBAngleData : public OBGenericData 00724 { 00725 friend class OBMol; 00726 00727 protected: 00728 std::vector<OBAngle> _angles; 00729 00730 OBAngleData(); 00731 OBAngleData(const OBAngleData &); 00733 00734 std::vector<OBAngle> GetData() const 00735 { 00736 return(_angles); 00737 } 00738 00739 public: 00740 OBAngleData &operator =(const OBAngleData &); 00741 virtual OBGenericData* Clone(OBBase* /*parent*/) const 00742 {return new OBAngleData(*this);} 00743 00744 void Clear(); 00745 unsigned int FillAngleArray(int **angles, unsigned int &size); 00746 bool FillAngleArray(std::vector<std::vector<unsigned int> > &angles); 00747 00748 void SetData(OBAngle &); 00751 size_t GetSize() const 00752 { 00753 return _angles.size(); 00754 } 00755 }; 00756 00757 enum atomreftype{ 00758 output, 00759 input, 00760 calcvolume 00761 }; // sets which atom4ref is accessed by OBChiralData 00762 00766 class OBAPI OBChiralData : public OBGenericData 00767 { 00768 friend class OBMol; 00769 friend class OBAtom; 00770 00771 protected: 00772 std::vector<unsigned int> _atom4refs; 00773 std::vector<unsigned int> _atom4refo; 00774 std::vector<unsigned int> _atom4refc; 00775 00778 int parity; 00779 00780 public: 00781 00782 OBChiralData(); 00783 OBChiralData(const OBChiralData &src); 00784 virtual OBGenericData* Clone(OBBase* /*parent*/) const 00785 { return new OBChiralData(*this); } 00786 OBChiralData &operator =(const OBChiralData &); 00787 ~OBChiralData(){} 00788 00789 void Clear(); 00790 00792 std::vector<unsigned int> GetAtom4Refs(atomreftype t) const; 00794 unsigned int GetAtomRef(int a,atomreftype t); 00795 00796 bool SetAtom4Refs(std::vector<unsigned int> atom4refs, atomreftype t); 00797 int AddAtomRef(unsigned int atomref, atomreftype t); 00798 00800 unsigned int GetSize(atomreftype t) const; 00801 }; 00802 00805 class OBSerialNums : public OBGenericData 00806 { 00807 protected: 00808 std::map<int, OBAtom*> _serialMap; 00809 00810 public: 00811 00812 OBSerialNums() : 00813 OBGenericData("obSerialNums", OBGenericDataType::SerialNums) 00814 {} 00815 00816 OBSerialNums(const OBSerialNums &cp) : OBGenericData(cp) 00817 { 00818 _serialMap = cp._serialMap; 00819 } 00822 virtual OBGenericData* Clone(OBBase* /*parent*/) const 00823 {return new OBSerialNums(*this);} 00824 00825 std::map<int,OBAtom*> &GetData() { return _serialMap; } 00826 void SetData(std::map<int,OBAtom*> &sm) { _serialMap = sm; } 00827 00828 }; 00829 00832 class OBAPI OBVibrationData: public OBGenericData 00833 { 00834 protected: 00836 std::vector< std::vector< vector3 > > _vLx; 00837 00839 std::vector<double> _vFrequencies; 00840 00842 std::vector<double> _vIntensities; 00843 00845 std::vector<double> _vRamanActivities; 00846 00847 public: 00848 OBVibrationData(): OBGenericData("VibrationData", OBGenericDataType::VibrationData){}; 00849 virtual ~OBVibrationData() {} 00850 virtual OBGenericData* Clone(OBBase*) const 00851 {return new OBVibrationData(*this);} 00852 00853 OBVibrationData & operator=(const OBVibrationData &); 00854 00855 void SetData(const std::vector< std::vector< vector3 > > & lx, 00856 const std::vector<double> & frequencies, 00857 const std::vector<double> & intensities); 00858 void SetData(const std::vector< std::vector< vector3 > > &, 00859 const std::vector<double> &, 00860 const std::vector<double> &, 00861 const std::vector<double> &); 00862 00863 std::vector< std::vector< vector3 > > GetLx() const 00864 { return this->_vLx; } 00865 std::vector<double> GetFrequencies() const 00866 { return this->_vFrequencies; } 00867 std::vector<double> GetIntensities() const 00868 { return this->_vIntensities; } 00869 std::vector<double> GetRamanActivities() const 00870 { return this->_vRamanActivities; } 00871 00872 unsigned int GetNumberOfFrequencies() const; 00873 }; 00874 00877 class OBAPI OBDOSData: public OBGenericData 00878 { 00879 protected: 00881 double _fermi; 00882 00884 std::vector<double> _vEnergies; 00885 00887 std::vector<double> _vDensities; 00888 00890 std::vector<double> _vIntegration; 00891 00892 public: 00893 OBDOSData(): OBGenericData("DOSData", OBGenericDataType::DOSData){}; 00894 virtual ~OBDOSData() {} 00895 virtual OBGenericData* Clone(OBBase*) const 00896 {return new OBDOSData(*this);} 00897 00898 OBDOSData & operator=(const OBDOSData &); 00899 00900 void SetData(double, 00901 const std::vector<double> &, 00902 const std::vector<double> &, 00903 const std::vector<double> &); 00904 00905 double GetFermiEnergy() const 00906 { return this->_fermi; } 00907 std::vector<double> GetEnergies() const 00908 { return this->_vEnergies; } 00909 std::vector<double> GetDensities() const 00910 { return this->_vDensities; } 00911 std::vector<double> GetIntegration() const 00912 { return this->_vIntegration; } 00913 }; 00914 00918 class OBAPI OBOrbital 00919 { 00920 friend class OBOrbitalData; 00921 protected: 00922 double _energy; 00923 double _occupation; 00924 std::string _mullikenSymbol; 00925 public: 00926 void SetData(double energy, double occupation = 2.0, std::string symbol = "A") 00927 { _energy = energy; _occupation = occupation; _mullikenSymbol = symbol; } 00928 00929 double GetEnergy() const { return _energy; } 00930 double GetOccupation() const { return _occupation; } 00931 std::string GetSymbol() const { return _mullikenSymbol; } 00932 }; 00933 00936 class OBAPI OBOrbitalData: public OBGenericData 00937 { 00938 public: 00939 OBOrbitalData(): OBGenericData("OrbitalData", OBGenericDataType::ElectronicData), 00940 _alphaHOMO(0), _betaHOMO(0), _openShell(false) {}; 00941 virtual ~OBOrbitalData() {} 00942 virtual OBGenericData* Clone(OBBase*) const 00943 {return new OBOrbitalData(*this);} 00944 00945 OBOrbitalData & operator=(const OBOrbitalData &); 00946 00947 void SetAlphaOrbitals(std::vector<OBOrbital> orbitalList) 00948 { _alphaOrbitals = orbitalList; } 00949 void SetBetaOrbitals(std::vector<OBOrbital> orbitalList) 00950 { _betaOrbitals = orbitalList; } 00951 void SetHOMO(int alpha, int beta = 0) 00952 { _alphaHOMO = alpha; _betaHOMO = beta; } 00953 void SetOpenShell(bool openShell) 00954 { _openShell = openShell; } 00955 00956 bool IsOpenShell() { return _openShell; } 00957 00958 unsigned int GetAlphaHOMO() { return _alphaHOMO; } 00959 unsigned int GetBetaHOMO() { return _betaHOMO; } 00960 std::vector<OBOrbital> GetAlphaOrbitals() { return _alphaOrbitals; } 00961 std::vector<OBOrbital> GetBetaOrbitals() { return _betaOrbitals; } 00962 00965 void LoadClosedShellOrbitals(std::vector<double> energies, std::vector<std::string> symmetries, int alphaHOMO); 00967 void LoadAlphaOrbitals(std::vector<double> energies, std::vector<std::string> symmetries, int alphaHOMO); 00969 void LoadBetaOrbitals(std::vector<double> energies, std::vector<std::string> symmetries, int betaHOMO); 00970 00971 protected: 00972 std::vector<OBOrbital> _alphaOrbitals; 00973 std::vector<OBOrbital> _betaOrbitals; 00974 unsigned int _alphaHOMO; 00975 unsigned int _betaHOMO; 00976 bool _openShell; 00977 }; 00978 00981 class OBAPI OBElectronicTransitionData: public OBGenericData 00982 { 00983 protected: 00985 std::vector<double> _vWavelengths; 00986 00988 std::vector<double> _vForces; 00989 00991 std::vector<double> _vEDipole; 00992 00994 std::vector<double> _vRotatoryStrengthsVelocity; 00995 00997 std::vector<double> _vRotatoryStrengthsLength; 00998 00999 public: 01000 OBElectronicTransitionData(): OBGenericData("ElectronicTransitionData", OBGenericDataType::ElectronicTransitionData) {} 01001 virtual ~OBElectronicTransitionData() {} 01002 virtual OBGenericData* Clone(OBBase*) const 01003 {return new OBElectronicTransitionData(*this);} 01004 01005 OBElectronicTransitionData & operator=(const OBElectronicTransitionData &); 01006 01007 void SetData(const std::vector<double> & wavelengths, 01008 const std::vector<double> & forces); 01009 01010 void SetEDipole(const std::vector<double> &); 01011 void SetRotatoryStrengthsVelocity(const std::vector<double> &); 01012 void SetRotatoryStrengthsLength(const std::vector<double> &); 01013 01014 std::vector<double> GetWavelengths() const 01015 { return this->_vWavelengths; } 01016 std::vector<double> GetForces() const 01017 { return this->_vForces; } 01018 std::vector<double> GetEDipole() const 01019 { return this->_vEDipole; } 01020 std::vector<double> GetRotatoryStrengthsVelocity() const 01021 { return this->_vRotatoryStrengthsVelocity; } 01022 std::vector<double> GetRotatoryStrengthsLength() const 01023 { return this->_vRotatoryStrengthsLength; } 01024 }; 01025 01028 class OBAPI OBRotationData: public OBGenericData 01029 { 01030 public: 01031 enum RType{UNKNOWN, ASYMMETRIC, SYMMETRIC, LINEAR}; 01032 OBRotationData(): OBGenericData("RotationData", OBGenericDataType::RotationData){} 01033 virtual ~OBRotationData(){}; 01034 virtual OBGenericData* Clone(OBBase*) const 01035 {return new OBRotationData(*this);} 01036 void SetData(RType RotorType, std::vector<double> RotationalConstants, int SymmetryNumber) 01037 { 01038 RotConsts = RotationalConstants; 01039 type = RotorType; 01040 SymNum = SymmetryNumber; 01041 } 01042 01044 std::vector<double> GetRotConsts()const{ return RotConsts; } 01045 01046 int GetSymmetryNumber()const{ return SymNum; } 01047 RType GetRotorType()const { return type; } 01048 01049 protected: 01050 std::vector<double> RotConsts; 01051 int SymNum; 01052 RType type; 01053 }; 01054 01058 class OBAPI OBVectorData: public OBGenericData 01059 { 01060 public: 01061 OBVectorData(): OBGenericData("VectorData", OBGenericDataType::VectorData){} 01062 virtual ~OBVectorData(){}; 01063 virtual OBGenericData* Clone(OBBase*) const 01064 {return new OBVectorData(*this);} 01065 void SetData(double x, double y, double z) 01066 { _vec = vector3(x, y, z); } 01067 void SetData(vector3 data) 01068 { _vec = data; } 01069 vector3 GetData() const 01070 { return _vec; } 01071 01072 protected: 01073 vector3 _vec; 01074 }; 01075 01079 class OBAPI OBMatrixData: public OBGenericData 01080 { 01081 public: 01082 OBMatrixData(): OBGenericData("MatrixData", OBGenericDataType::MatrixData){} 01083 virtual ~OBMatrixData(){}; 01084 virtual OBGenericData* Clone(OBBase*) const 01085 {return new OBMatrixData(*this);} 01086 void SetData(matrix3x3 data) 01087 { _matrix = data; } 01088 matrix3x3 GetData() const 01089 { return _matrix; } 01090 01091 protected: 01092 matrix3x3 _matrix; 01093 }; 01094 01096 typedef std::vector<OBGenericData*>::iterator OBDataIterator; 01097 01098 } //end namespace OpenBabel 01099 01100 #endif // OB_GENERIC_H 01101