| 1 |
/********************************************************************** |
| 2 |
rotamer.h - Handle rotamer list data. |
| 3 |
|
| 4 |
Copyright (C) 1998-2000 by OpenEye Scientific Software, Inc. |
| 5 |
Some portions Copyright (C) 2001-2005 by Geoffrey R. Hutchison |
| 6 |
|
| 7 |
This file is part of the Open Babel project. |
| 8 |
For more information, see <http://openbabel.sourceforge.net/> |
| 9 |
|
| 10 |
This program is free software; you can redistribute it and/or modify |
| 11 |
it under the terms of the GNU General Public License as published by |
| 12 |
the Free Software Foundation version 2 of the License. |
| 13 |
|
| 14 |
This program is distributed in the hope that it will be useful, |
| 15 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 |
GNU General Public License for more details. |
| 18 |
***********************************************************************/ |
| 19 |
|
| 20 |
#ifndef OB_ROTAMER_H |
| 21 |
#define OB_ROTAMER_H |
| 22 |
|
| 23 |
#include <vector> |
| 24 |
#include <map> |
| 25 |
|
| 26 |
#if HAVE_FSTREAM |
| 27 |
#include <fstream> |
| 28 |
#elif HAVE_FSTREAM_H |
| 29 |
#include <fstream.h> |
| 30 |
#endif |
| 31 |
|
| 32 |
#include "mol.hpp" |
| 33 |
#include "rotor.hpp" |
| 34 |
#include "generic.hpp" |
| 35 |
|
| 36 |
namespace OpenBabel |
| 37 |
{ |
| 38 |
|
| 39 |
//! Supports a set of rotomer coordinate sets for some number of potentially rotatable bonds |
| 40 |
class OBAPI OBRotamerList : public OBGenericData |
| 41 |
{ |
| 42 |
unsigned int _NBaseCoords; |
| 43 |
std::vector<double*> _c; |
| 44 |
std::vector<std::vector<double> > _vres; |
| 45 |
std::vector<unsigned char*> _vrotamer; |
| 46 |
std::vector<std::pair<OBAtom**,std::vector<int> > > _vrotor; |
| 47 |
|
| 48 |
OBRotamerList(const OBRotamerList &cpy) : OBGenericData(cpy) |
| 49 |
{} |
| 50 |
OBRotamerList& operator =(const OBRotamerList &) |
| 51 |
{ |
| 52 |
return *this; |
| 53 |
} |
| 54 |
|
| 55 |
public: |
| 56 |
OBRotamerList() |
| 57 |
{ |
| 58 |
_NBaseCoords=0; |
| 59 |
_type= OBGenericDataType::RotamerList; |
| 60 |
_attr="RotamerList"; |
| 61 |
} |
| 62 |
~OBRotamerList(); |
| 63 |
void Setup(OBMol&,OBRotorList&); |
| 64 |
void Setup(OBMol&,unsigned char*,int); |
| 65 |
//! \return the number of rotatable bonds considered |
| 66 |
unsigned int NumRotors() const |
| 67 |
{ |
| 68 |
return (unsigned int)_vrotor.size(); |
| 69 |
} |
| 70 |
//! \return the number of rotamer (conformation) coordinate sets |
| 71 |
unsigned int NumRotamers() const |
| 72 |
{ |
| 73 |
return (unsigned int)_vrotamer.size(); |
| 74 |
} |
| 75 |
void AddRotamer(double*); |
| 76 |
void AddRotamer(int *arr); |
| 77 |
void AddRotamer(unsigned char *arr); |
| 78 |
void AddRotamers(unsigned char*,int); |
| 79 |
void GetReferenceArray(unsigned char*); |
| 80 |
void ExpandConformerList(OBMol&,std::vector<double*>&); |
| 81 |
std::vector<unsigned char*>::iterator BeginRotamer() |
| 82 |
{ |
| 83 |
return _vrotamer.begin(); |
| 84 |
} |
| 85 |
std::vector<unsigned char*>::iterator EndRotamer() |
| 86 |
{ |
| 87 |
return _vrotamer.end(); |
| 88 |
} |
| 89 |
|
| 90 |
// Support for internal storage of base coordinate sets that |
| 91 |
// rotamers operate on |
| 92 |
|
| 93 |
//! Create a conformer list using the internal base set of coordinates |
| 94 |
std::vector<double*> CreateConformerList(OBMol& mol); |
| 95 |
|
| 96 |
//! Copies the mol's conformers (the coordinates, NOT the pointers) |
| 97 |
//! into the object as base coordinates |
| 98 |
void SetBaseCoordinateSets(OBMol& mol) |
| 99 |
{ |
| 100 |
SetBaseCoordinateSets(mol.GetConformers(),mol.NumAtoms()); |
| 101 |
} |
| 102 |
|
| 103 |
//! Copies the coordinates in bc, NOT the pointers, into the object |
| 104 |
void SetBaseCoordinateSets(std::vector<double*> bc, unsigned int N); |
| 105 |
|
| 106 |
unsigned int NumBaseCoordinateSets() const |
| 107 |
{ |
| 108 |
return (unsigned int)_c.size(); |
| 109 |
} |
| 110 |
|
| 111 |
//! Get a pointer to a specific base pointer |
| 112 |
double *GetBaseCoordinateSet(unsigned int i) |
| 113 |
{ |
| 114 |
return (i<_c.size()) ? _c[i] : NULL; |
| 115 |
} |
| 116 |
|
| 117 |
unsigned int NumAtoms() const |
| 118 |
{ |
| 119 |
return _NBaseCoords; |
| 120 |
} |
| 121 |
}; |
| 122 |
|
| 123 |
int Swab(int); |
| 124 |
|
| 125 |
} |
| 126 |
|
| 127 |
#endif // OB_ROTAMER_H |
| 128 |
|
| 129 |
//! \file rotamer.h |
| 130 |
//! \brief Handle rotamer list data. |