builder.h Source File

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

builder.h
Go to the documentation of this file.

    00001 /**********************************************************************
    00002 builder.h - OBBuilder class.
    00003
    00004 Copyright (C) 2007-2008 by Tim Vandermeersch
    00005                            <tim.vandermeersch@gmail.com>
    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_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       //bool Insert(OBMol &mol, int a, int b, std::string smiles, int c, int d);
    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       //  supports the case where the fragments overlap at a spiro atom only.
    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   }; // class OBBuilder
    00167
    00168 }// namespace OpenBabel
    00169
    00170 #endif   // OB_BUILDER_H
    00171

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines