Loading...
Searching...
No Matches
align.h
Go to the documentation of this file.
/**********************************************************************
align.h - Align two molecules or vectors of vector3
Copyright (C) 2010 by Noel M. O'Boyle
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_ALIGN_H
#define OB_ALIGN_H
#include <openbabel/mol.h>
#include <openbabel/math/vector3.h>
#include <openbabel/math/matrix3x3.h>
#include <openbabel/isomorphism.h>
#include <Eigen/Core>
namespace OpenBabel
{
class OBAPI OBAlign {
public:
OBAlign(bool includeH=false, bool symmetry=true);
OBAlign(const OBMol &refmol, const OBMol &targetmol, bool includeH=false, bool symmetry=true);
OBAlign(const std::vector<vector3> &ref, const std::vector<vector3> &target);
void SetRef(const std::vector<vector3> &ref);
void SetTarget(const std::vector<vector3> &target);
void SetRefMol(const OBMol &refmol);
void SetTargetMol(const OBMol &targetmol);
bool Align();
enum AlignMethod {
Kabsch = 0, // Returns matrix and RMSD
QCP = 1 // Returns just RMSD (fast)
};
void SetMethod(enum AlignMethod method);
double GetRMSD();
matrix3x3 GetRotMatrix();
std::vector<vector3> GetAlignment();
bool UpdateCoords(OBMol* target);
private:
bool _ready;
bool _fail;
bool _symmetry;
bool _includeH;
enum AlignMethod _method;
double _rmsd;
OBBitVec _frag_atoms;
Automorphisms _aut;
const OBMol* _prefmol;
const OBMol* _ptargetmol;
Eigen::MatrixXd _rotMatrix;
Eigen::Vector3d _ref_centr, _target_centr;
const std::vector<vector3> *_pref;
const std::vector<vector3> *_ptarget;
std::vector<vector3> _refmol_coords;
std::vector<vector3> _targetmol_coords;
Eigen::MatrixXd _result;
Eigen::MatrixXd _mref, _mtarget;
void VectorsToMatrix(const std::vector<vector3> *pcoords, Eigen::MatrixXd &coords);
Eigen::Vector3d MoveToOrigin(Eigen::MatrixXd &coords);
void SimpleAlign(const Eigen::MatrixXd &mtarget);
void TheobaldAlign(const Eigen::MatrixXd &mtarget);
// Generate a mapping from the permutation map to the index of
// correct column in _mtarget. Need to handle the fact that the
// permutation group contains non-fragment atoms.
// For example, map(213465) will be converted to newidx(102354).
// If the atom with Idx=3 is not in the fragment, it will be
// converted to newidx(10X243) instead.
std::vector<unsigned int> _newidx;
};
}
#endif // OB_ALIGN_H
OpenBabel::OBAlign::AlignMethod
AlignMethod
Definition align.h:119
OpenBabel::OBAlign::Kabsch
@ Kabsch
Definition align.h:120
OpenBabel::OBAlign::QCP
@ QCP
Definition align.h:121
OpenBabel::OBAlign::SetTargetMol
void SetTargetMol(const OBMol &targetmol)
Definition align.cpp:139
OpenBabel::OBAlign::OBAlign
OBAlign(bool includeH=false, bool symmetry=true)
Definition align.cpp:43
OpenBabel::OBAlign::SetTarget
void SetTarget(const std::vector< vector3 > &target)
Definition align.cpp:101
OpenBabel::OBAlign::SetRef
void SetRef(const std::vector< vector3 > &ref)
Definition align.cpp:93
OpenBabel::OBAlign::Align
bool Align()
Definition align.cpp:305
OpenBabel::OBAlign::SetRefMol
void SetRefMol(const OBMol &refmol)
Definition align.cpp:109
OpenBabel::OBBitVec
A speed-optimized vector of bits.
Definition bitvec.h:58
OpenBabel::OBMol
Molecule Class.
Definition mol.h:121
OpenBabel::matrix3x3
Represents a real 3x3 matrix.
Definition matrix3x3.h:43
OpenBabel::Automorphisms
OBIsomorphismMapper::Mappings Automorphisms
A group of automorphic permutations.
Definition isomorphism.h:206
isomorphism.h
OBIsomorphismMapper class for finding isomorphisms.
matrix3x3.h
Handle 3D Rotation matrix.
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
vector3.h
Handle 3D coordinates.