rotamer.h

Go to the documentation of this file.
00001 /**********************************************************************
00002 rotamer.h - Handle rotamer list data.
00003  
00004 Copyright (C) 1998-2000 by OpenEye Scientific Software, Inc.
00005 Some portions Copyright (C) 2001-2006 by Geoffrey R. Hutchison
00006  
00007 This file is part of the Open Babel project.
00008 For more information, see <http://openbabel.sourceforge.net/>
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_ROTAMER_H
00021 #define OB_ROTAMER_H
00022 
00023 #include <vector>
00024 #include <map>
00025 
00026 #include <openbabel/mol.h>
00027 #include <openbabel/rotor.h>
00028 #include <openbabel/generic.h>
00029 
00030 namespace OpenBabel
00031 {
00032 
00034   // Further class introduction in rotamer.cpp
00035  class OBAPI OBRotamerList : public OBGenericData
00036   {
00038     unsigned int                         _NBaseCoords;
00040     std::vector<double*>                 _c;
00042     std::vector<std::pair<OBAtom**,std::vector<int> > > _vrotor;
00045     std::vector<std::vector<double> >    _vres;
00047     std::vector<unsigned char*>          _vrotamer;
00048 
00049     /*Because contains OBAtom*, these aren't meaningful without knowing the parent molecule
00050       OBRotamerList(const OBRotamerList &cpy) : OBGenericData(cpy)
00051       {}
00052       OBRotamerList& operator =(const OBRotamerList &)
00053       {
00054       return *this;
00055       }
00056                 */
00057 
00058   public:
00059     OBRotamerList()
00060       {
00061         _NBaseCoords=0;
00062         _type= OBGenericDataType::RotamerList;
00063         _attr="RotamerList";
00064       }
00065                 virtual OBGenericData* Clone(OBBase* parent) const;
00066 
00067     ~OBRotamerList();
00069     void Setup(OBMol&,OBRotorList&);
00074     void Setup(OBMol &mol,unsigned char*ref,int nrotors);
00076     unsigned int NumRotors()   const
00077     {
00078       return (unsigned int)_vrotor.size();
00079     }
00081     unsigned int NumRotamers() const
00082     {
00083       return (unsigned int)_vrotamer.size();
00084     }
00086     void AddRotamer(double*);
00088     void AddRotamer(int *key);
00090     void AddRotamer(std::vector<int> key);
00092     void AddRotamer(unsigned char *key);
00094     void AddRotamers(unsigned char *arr,int nconf);
00096     void GetReferenceArray(unsigned char*) const;
00097 
00099 
00100     std::vector<unsigned char*>::iterator BeginRotamer()
00101       {
00102         return _vrotamer.begin();
00103       }
00104     std::vector<unsigned char*>::iterator EndRotamer()
00105       {
00106         return _vrotamer.end();
00107       }
00109 
00112     std::vector<double*> CreateConformerList(OBMol& mol);
00113 
00116     void ExpandConformerList(OBMol&mol,std::vector<double*>& confs);
00117 
00120     void SetBaseCoordinateSets(OBMol& mol)
00121     {
00122       SetBaseCoordinateSets(mol.GetConformers(), mol.NumAtoms());
00123     }
00124 
00126 
00129     void SetBaseCoordinateSets(std::vector<double*> bc, unsigned int N);
00130 
00132     unsigned int NumBaseCoordinateSets() const
00133     {
00134       return _c.size();
00135     }
00136 
00138     double *GetBaseCoordinateSet(unsigned int i) const
00139     {
00140       return (i<_c.size()) ? _c[i] : NULL;
00141     }
00142 
00144     unsigned int NumAtoms() const
00145     {
00146       return _NBaseCoords;
00147     }
00148   };
00149 
00151   int Swab(int);
00152 
00153 }
00154 
00155 #endif // OB_ROTAMER_H
00156