Loading...
Searching...
No Matches
builder.h
Go to the documentation of this file.
/**********************************************************************
builder.h - OBBuilder class.
Copyright (C) 2007-2008 by Tim Vandermeersch
<tim.vandermeersch@gmail.com>
This file is part of the Open Babel project.
For more information, see <http://openbabel.org/>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
***********************************************************************/
#ifndef OB_BUILDER_H
#define OB_BUILDER_H
#include <vector>
#include <string>
#include <map>
#include <list>
#include <set>
#include <openbabel/stereo/stereo.h>
namespace OpenBabel
{
class OBMol;
class OBAtom;
class OBSmartsPattern;
class vector3;
class OBBitVec;
class OBAPI OBBuilder {
public:
OBBuilder(): _keeprings(false) {}
bool Build(OBMol &mol, bool stereoWarnings = true);
void SetKeepRings() { _keeprings = true; }
void UnsetKeepRings() { _keeprings = false; }
void AddRingFragment(OBSmartsPattern *sp, const std::vector<vector3> &coords);
void LoadFragments();
std::vector<vector3> GetFragmentCoord(std::string smiles);
static vector3 GetNewBondVector(OBAtom *atom);
static vector3 GetNewBondVector(OBAtom *atom, double length);
static bool Connect(OBMol &mol, int a, int b, vector3 &newpos, int bondOrder = 1);
static bool Connect(OBMol &mol, int a, int b, int bondOrder = 1);
static bool Swap(OBMol &mol, int a, int b, int c, int d);
//bool Insert(OBMol &mol, int a, int b, std::string smiles, int c, int d);
static bool CorrectStereoBonds(OBMol &mol);
static bool CorrectStereoAtoms(OBMol &mol, bool warn = true);
static bool IsSpiroAtom(unsigned long atomId, OBMol &mol);
static OBBitVec GetFragment(OBAtom *atom);
static void AddNbrs(OBBitVec &fragment, OBAtom *atom);
private:
//static std::map<std::string, double> _torsion;
static std::vector<std::string> _rigid_fragments;
static std::vector<std::pair<OBSmartsPattern*, std::vector<vector3> > > _ring_fragments;
static std::map<std::string, int> _rigid_fragments_index;
static std::map<std::string, std::vector<vector3> > _rigid_fragments_cache;
// supports the case where the fragments overlap at a spiro atom only.
static void ConnectFrags(OBMol &mol, OBMol &workmol, std::vector<int> match, std::vector<vector3> coords,
std::vector<int> pivot);
static void FlipSpiro(OBMol &mol, int idx);
static bool FixRingStereo(std::vector<std::pair<OBStereo::Ref, bool> > atomIds,
OBMol &mol, OBStereo::Refs &unfixedcenters);
static void AddRingNbrs(OBBitVec &fragment, OBAtom *atom, OBMol &mol);
static bool SwapWithVector(OBMol &mol, int a, int b, int c, const vector3 &newlocation);
bool _keeprings;
}; // class OBBuilder
}// namespace OpenBabel
#endif // OB_BUILDER_H
OpenBabel::OBAtom
Atom class.
Definition atom.h:72
OpenBabel::OBBitVec
A speed-optimized vector of bits.
Definition bitvec.h:58
OpenBabel::OBBuilder::OBBuilder
OBBuilder()
Definition builder.h:45
OpenBabel::OBBuilder::UnsetKeepRings
void UnsetKeepRings()
Definition builder.h:69
OpenBabel::OBBuilder::SetKeepRings
void SetKeepRings()
Definition builder.h:68
OpenBabel::OBMol
Molecule Class.
Definition mol.h:121
OpenBabel::OBSmartsPattern
SMARTS (SMiles ARbitrary Target Specification) substructure searching.
Definition parsmart.h:155
OpenBabel::vector3
Represents a vector in 3-dimensional real space.
Definition vector3.h:45
OpenBabel
Global namespace for all Open Babel code.
Definition alias.h:23
stereo.h
Process molecular stereochemistry information.
OpenBabel::OBStereo::Refs
std::vector< Ref > Refs
Definition stereo.h:156