Loading...
Searching...
No Matches
mcdlutil.h
Go to the documentation of this file.
/*-*-C++-*-
**********************************************************************
Copyright (C) 2007,2008 by Sergei V. Trepalin sergey_trepalin@chemical-block.com
Copyright (C) 2007,2008 by Andrei Gakh andrei.gakh@nnsa.doe.gov
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.
***********************************************************************
*/
/*
Diagram is generated using templates, which are stored in SD file templates.sdf
The SD file is usual SD file, which contain chemical structures and might contain data.
Only chemical structures are used. Subgraph isomorphisme search is executed and coordinates
of atoms are determined from templates. See Molecules, 11, 129-141 (2006) for algorithm decription.
Structures in SD file are converted in next manner:
1. All atoms, except explicit hydrogens, are replaced with generic ANY_ATOM (matched with any atom in subgraph isomorphisme search)
2. All bonds are replaces with generic ANY_BOND, which can be matched with any bond in molecule
3. All hydrogen are removed, but they are used for search-query and structure atom matching is believed fo be
successful if chemical structure contains more or equal number of hydrogens, than query. Using explicitly-defined hydrogens
on query enables ones to remove substitutors attachment for atom, which are sterically hidden on templates
if the file will not be found, predefined templates will be used
*/
namespace OpenBabel {
//common constants
static const int MAXBONDS=300;
static const int MAXFRAGS=200;
static const int MAXCHARS=1000;
static const int MAX_DEPTH=10;
static const int NELEMMAX=120;
#define NELEMMCDL 121
// Return valency by hydrogen for given atomic position in the Periodic Table
OBMCDL int hydrogenValency(int na);
OBMCDL int maxValency(int na);
//Alternate overloaded methods
OBMCDL int alternate(OBMol * pmol, const int nH[], int bondOrders []); //This method does not work!
//Zero-based atomic numeration should be in connection matrix arrays iA1 and iA2-so first atom has indez zero
OBMCDL int alternate(const std::vector<int> aPosition,const std::vector<int> aCharge,
const std::vector<int> aRad,const std::vector<int> nHydr, const std::vector<int> iA1,
const std::vector<int> iA2, std::vector<int> & bondOrders, int nAtoms, int nBonds);
//Diagram generation overloaded methods
OBMCDL void generateDiagram(OBMol * pmol);
//Zero-based atomic numeration should be in connection matrix arrays iA1 and iA2-so first atom has indez zero
OBMCDL void generateDiagram(const std::vector<int> iA1, const std::vector<int> iA2,
std::vector<double>& rx, std::vector<double>& ry, int nAtoms, int nBonds);
OBMCDL void generateDiagram(OBMol * pmol, std::ostream & ofs); //for testing purposes only
//Fragment search - pure subgraph isomorphisme
bool fragmentSearch(OBMol * query, OBMol * structure);
bool fragmentSearch(const std::vector<int> aPositionQuery, const std::vector<int> iA1Query,
const std::vector<int> iA2Query, const std::vector<int> bondTypesQuery,
const std::vector<int> aPositionStructure, const std::vector<int> iA1Structure,
const std::vector<int> iA2Structure, const std::vector<int> bondTypesStructure,
int nAtomsQuery, int nBondsQuery, int nAtomsStructure, int nBondsStructure);
OBMCDL void equivalenceList(OBMol * pmol, std::vector<int>& eqList);
void equivalenceList(const std::vector<int> aPosition,const std::vector<int> aCharge,
const std::vector<int> aRad, const std::vector<int> iA1, const std::vector<int> iA2,
const std::vector<int> bondTypes, std::vector<int>& eqList, int nAtoms, int nBonds);
//Fragment addition
OBMCDL void addFragment(OBMol * molecule, OBMol * fragment, int molAN, int fragAN, int molBN,
int fragBN, bool isAddition);
//routines below have no common meaning, but are necessary to process stereo information
OBMCDL void createStereoLists(OBMol * pmol, std::vector<int>& bondStereoList,
std::vector<int>& atomStereoList, std::vector<int>& eqList);
OBMCDL std::string getAtomMCDL(OBMol * pmol, int ntatoms, const std::vector<int> ix,
const std::vector<int> aNumber, const std::vector<int> atomStereoList, const std::vector<int> eqList);
OBMCDL std::string getBondMCDL(OBMol * pmol, int nbStore, int ntatoms, const std::vector<int> ix,
const std::vector<int> aNumber, int bonds[MAXBONDS][4], const std::vector<int> bondStereoList,
const std::vector<int> eqList);
OBMCDL void implementAtomStereo(std::vector<int>& iA1, std::vector<int>& iA2, std::vector<int>& stereoBonds,
const std::vector<double>rx, const std::vector<double> ry, int acount, int bcount, std::string astereo);
OBMCDL void implementBondStereo(const std::vector<int> iA1, const std::vector<int> iA2,
std::vector<double>& rx, std::vector<double>& ry, int acount, int bcount, std::string bstereo);
OBMCDL int groupRedraw(OBMol * pmol, int bondN, int atomN, bool atomNInGroup);
//int groupRedrawFrameAtom(OBMol * pmol, int bondN, int atomInFrame);
OBMCDL int canonizeMCDL(const std::string atomBlock, std::vector<std::string> & structureList);
OBMCDL bool parseFormula(const std::string formulaString, std::vector <int>& enumber, int & valency);
OBMCDL void prepareTest(OBMol * pmol, std::ostream & ofs);
} // namespace OpenBabel
OpenBabel::OBMol
Molecule Class.
Definition mol.h:121
OpenBabel
Global namespace for all Open Babel code.
Definition alias.h:23
OpenBabel::equivalenceList
void equivalenceList(OBMol *pmol, std::vector< int > &eqList)
Equivalence list generation.
Definition mcdlutil.cpp:6193
OpenBabel::MAXFRAGS
static const int MAXFRAGS
Definition mcdlutil.h:39
OpenBabel::groupRedraw
int groupRedraw(OBMol *pmol, int bondN, int atomN, bool atomNInGroup)
Definition mcdlutil.cpp:7118
OpenBabel::getAtomMCDL
std::string getAtomMCDL(OBMol *pmol, int ntatoms, const std::vector< int > ix, const std::vector< int > aNumber, const std::vector< int > atomStereoList, const std::vector< int > eqList)
Definition mcdlutil.cpp:6524
OpenBabel::alternate
int alternate(OBMol *pmol, const int nH[], int bondOrders[])
OpenBabel::implementAtomStereo
void implementAtomStereo(std::vector< int > &iA1, std::vector< int > &iA2, std::vector< int > &stereoBonds, const std::vector< double >rx, const std::vector< double > ry, int acount, int bcount, std::string astereo)
Definition mcdlutil.cpp:6946
OpenBabel::implementBondStereo
void implementBondStereo(const std::vector< int > iA1, const std::vector< int > iA2, std::vector< double > &rx, std::vector< double > &ry, int acount, int bcount, std::string bstereo)
Definition mcdlutil.cpp:7013
OpenBabel::hydrogenValency
int hydrogenValency(int na)
Definition mcdlutil.cpp:3548
OpenBabel::fragmentSearch
bool fragmentSearch(OBMol *query, OBMol *structure)
Definition mcdlutil.cpp:6107
OpenBabel::parseFormula
bool parseFormula(const std::string formulaString, std::vector< int > &enumber, int &valency)
Definition mcdlutil.cpp:7191
OpenBabel::canonizeMCDL
int canonizeMCDL(const std::string atomBlock, std::vector< std::string > &structureList)
Definition mcdlutil.cpp:7267
OpenBabel::MAXBONDS
static const int MAXBONDS
Definition mcdlutil.h:38
OpenBabel::maxValency
int maxValency(int na)
Definition mcdlutil.cpp:3554
OpenBabel::prepareTest
void prepareTest(OBMol *pmol, std::ostream &ofs)
Definition mcdlutil.cpp:7276
OpenBabel::MAXCHARS
static const int MAXCHARS
Definition mcdlutil.h:40
OpenBabel::createStereoLists
void createStereoLists(OBMol *pmol, std::vector< int > &bondStereoList, std::vector< int > &atomStereoList, std::vector< int > &eqList)
Definition mcdlutil.cpp:6226
OpenBabel::getBondMCDL
std::string getBondMCDL(OBMol *pmol, int nbStore, int ntatoms, const std::vector< int > ix, const std::vector< int > aNumber, int bonds[MAXBONDS][4], const std::vector< int > bondStereoList, const std::vector< int > eqList)
Definition mcdlutil.cpp:6680
OpenBabel::MAX_DEPTH
static const int MAX_DEPTH
Definition mcdlutil.h:41
OpenBabel::NELEMMAX
static const int NELEMMAX
Definition mcdlutil.h:42
OpenBabel::addFragment
void addFragment(OBMol *molecule, OBMol *fragment, int molAN, int fragAN, int molBN, int fragBN, bool isAddition)
Definition mcdlutil.cpp:6202
OpenBabel::generateDiagram
void generateDiagram(OBMol *pmol)
Definition mcdlutil.cpp:6075