Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef OB_BUILDER_H
00021 #define OB_BUILDER_H
00022
00023 #include <vector>
00024 #include <string>
00025 #include <map>
00026
00027 #include <list>
00028 #include <set>
00029 #include <openbabel/base.h>
00030 #include <openbabel/mol.h>
00031 #include <openbabel/stereo/stereo.h>
00032
00033 namespace OpenBabel
00034 {
00037 class OBAPI OBBuilder {
00038 public:
00039
00040 OBBuilder(): _keeprings(false) {}
00041
00043
00044
00049 bool Build(OBMol &mol);
00051
00053
00054
00062 void SetKeepRings() { _keeprings = true; }
00063 void UnsetKeepRings() { _keeprings = false; }
00065
00066
00068 void LoadFragments();
00069
00074 static vector3 GetNewBondVector(OBAtom *atom);
00075 static vector3 GetNewBondVector(OBAtom *atom, double length);
00076
00088 static bool Connect(OBMol &mol, int a, int b, vector3 &newpos, int bondOrder = 1);
00099 static bool Connect(OBMol &mol, int a, int b, int bondOrder = 1);
00127 static bool Swap(OBMol &mol, int a, int b, int c, int d);
00134
00137 static void CorrectStereoBonds(OBMol &mol);
00141 static void CorrectStereoAtoms(OBMol &mol);
00144 static bool IsSpiroAtom(unsigned long atomId, OBMol &mol);
00149 static OBBitVec GetFragment(OBAtom *atom);
00150 static void AddNbrs(OBBitVec &fragment, OBAtom *atom);
00151
00152 private:
00154 static std::vector<std::pair<OBSmartsPattern*, std::vector<vector3> > > _fragments;
00156
00157 static void ConnectFrags(OBMol &mol, OBMol &workmol, std::vector<int> match, std::vector<vector3> coords,
00158 std::vector<int> pivot);
00160 static void FlipSpiro(OBMol &mol, int idx);
00161 static bool FixRingStereo(std::vector<std::pair<OBStereo::Ref, bool> > atomIds,
00162 OBMol &mol, OBStereo::Refs &unfixedcenters);
00163 static void AddRingNbrs(OBBitVec &fragment, OBAtom *atom, OBMol &mol);
00164 static bool SwapWithVector(OBMol &mol, int a, int b, int c, const vector3 &newlocation);
00165 bool _keeprings;
00166 };
00167
00168 }
00169
00170 #endif // OB_BUILDER_H
00171