Loading...
Searching...
No Matches
distgeom.h
Go to the documentation of this file.
/**********************************************************************
distgeom.h - Distance Geometry generation and sampling
Copyright (C) 2011 by Tim Vandermeersch
Copyright (C) 2012 by Geoffrey Hutchison
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_DISTGEOM_H
#define OB_DISTGEOM_H
#include <openbabel/babelconfig.h>
#include <openbabel/mol.h>
#include <iostream>
#ifndef OBAPI
#define OBAPI
#endif
#ifdef HAVE_EIGEN
#include <Eigen/Core>
#include <LBFGS.h>
namespace OpenBabel {
class DistanceGeometryPrivate;
class OBCisTransStereo;
class TetrahedralInfo {
int c;
std::vector<unsigned long> nbrs;
double lb, ub;
public:
TetrahedralInfo(int center, std::vector<unsigned long> neighbors,
double lower_bound, double upper_bound) :
c(center), nbrs(neighbors),
lb(lower_bound), ub(upper_bound) {}
int GetCenter() {
return c;
}
std::vector<unsigned long> GetNeighbors() {
return nbrs;
}
double GetUpperBound() {
return ub;
}
double GetLowerBound() {
return lb;
}
};
class OBAPI OBDistanceGeometry {
friend class DistgeomFunc;
public:
OBDistanceGeometry();
OBDistanceGeometry(const OBMol &mol, bool useCurrentGeometry);
~OBDistanceGeometry();
bool Setup(const OBMol &mol, bool useCurrentGeom = false);
void Generate();
void AddConformer();
void GetConformers(OBMol &mol);
bool WasSuccessful() const;
bool GetGeometry(OBMol &mol, bool useCurrentGeom = false);
Eigen::MatrixXf GetBoundsMatrix();
bool SetBoundsMatrix(const Eigen::MatrixXf bounds);
float GetUpperBounds(int i, int j);
float GetLowerBounds(int i, int j);
unsigned int GetDimension() {return dim;};
std::vector<TetrahedralInfo> _stereo;
private:
OBMol _mol;
std::vector<OBGenericData*> _vdata;
DistanceGeometryPrivate *_d;
Eigen::VectorXd _coord; // one-dimensional vector containing coordinates of atoms
std::string input_smiles;
unsigned int dim;
bool generateInitialCoords();
bool firstMinimization();
bool minimizeFourthDimension();
void SetUpperBounds();
void Set12Bounds(bool useCurrentGeom);
void Set13Bounds(bool useCurrentGeom);
void SetAromaticRingBounds();
void Set14Bounds();
void Set15Bounds();
int AreInSameRing(OBAtom *a, OBAtom *b);
void TriangleSmooth();
void SetLowerBounds();
OBCisTransStereo *GetCisTransStereo(OBBond *bond);
void CorrectStereoConstraints(double scale = 1.0);
bool CheckStereoConstraints();
bool CheckBounds();
};
class DistGeomFunc {
OBDistanceGeometry* const owner;
public:
DistGeomFunc(OBDistanceGeometry* owner) : owner(owner) {}
double operator() (const Eigen::VectorXd& x, Eigen::VectorXd& grad);
};
class DistGeomFunc4D {
OBDistanceGeometry* const owner;
public:
DistGeomFunc4D(OBDistanceGeometry* owner) : owner(owner) {}
double operator() (const Eigen::VectorXd& x, Eigen::VectorXd& grad);
};
}
#endif
#endif
OpenBabel::OBCisTransStereo
Class for handling and storing cis/trans stereochemistry.
Definition cistrans.h:76
mol.h
Handle molecules. Declarations of OBMol, OBAtom, OBBond, OBResidue. (the main header for Open Babel).
OpenBabel
Global namespace for all Open Babel code.
Definition alias.h:23