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-2005 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 #if HAVE_FSTREAM
00027 #include <fstream>
00028 #elif HAVE_FSTREAM_H
00029 #include <fstream.h>
00030 #endif
00031 
00032 #include "mol.h"
00033 #include "rotor.h"
00034 #include "generic.h"
00035 
00036 namespace OpenBabel
00037 {
00038 
00040 class OBAPI OBRotamerList : public OBGenericData
00041 {
00042     unsigned int                         _NBaseCoords;
00043     std::vector<double*>                       _c;
00044     std::vector<std::vector<double> >               _vres;
00045     std::vector<unsigned char*>               _vrotamer;
00046     std::vector<std::pair<OBAtom**,std::vector<int> > > _vrotor;
00047 
00048     OBRotamerList(const OBRotamerList &cpy) : OBGenericData(cpy)
00049     {}
00050     OBRotamerList& operator =(const OBRotamerList &)
00051     {
00052         return *this;
00053     }
00054 
00055 public:
00056     OBRotamerList()
00057     {
00058         _NBaseCoords=0;
00059         _type= OBGenericDataType::RotamerList;
00060         _attr="RotamerList";
00061     }
00062     ~OBRotamerList();
00063     void Setup(OBMol&,OBRotorList&);
00064     void Setup(OBMol&,unsigned char*,int);
00066     unsigned int NumRotors()   const
00067     {
00068         return (unsigned int)_vrotor.size();
00069     }
00071     unsigned int NumRotamers() const
00072     {
00073         return (unsigned int)_vrotamer.size();
00074     }
00075     void AddRotamer(double*);
00076     void AddRotamer(int *arr);
00077     void AddRotamer(unsigned char *arr);
00078     void AddRotamers(unsigned char*,int);
00079     void GetReferenceArray(unsigned char*);
00080     void ExpandConformerList(OBMol&,std::vector<double*>&);
00081     std::vector<unsigned char*>::iterator BeginRotamer()
00082     {
00083         return _vrotamer.begin();
00084     }
00085     std::vector<unsigned char*>::iterator EndRotamer()
00086     {
00087         return _vrotamer.end();
00088     }
00089 
00090     // Support for internal storage of base coordinate sets that
00091     // rotamers operate on
00092 
00094     std::vector<double*> CreateConformerList(OBMol& mol);
00095 
00098     void SetBaseCoordinateSets(OBMol& mol)
00099     {
00100         SetBaseCoordinateSets(mol.GetConformers(),mol.NumAtoms());
00101     }
00102 
00104     void SetBaseCoordinateSets(std::vector<double*> bc, unsigned int N);
00105 
00106     unsigned int NumBaseCoordinateSets() const
00107     {
00108         return (unsigned int)_c.size();
00109     }
00110 
00112     double *GetBaseCoordinateSet(unsigned int i)
00113     {
00114         return (i<_c.size()) ? _c[i] : NULL;
00115     }
00116 
00117     unsigned int NumAtoms() const
00118     {
00119         return _NBaseCoords;
00120     }
00121 };
00122 
00123 int Swab(int);
00124 
00125 }
00126 
00127 #endif // OB_ROTAMER_H
00128