00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef OST_SUPERPOSITION_HH
00024 #define OST_SUPERPOSITION_HH
00025
00026 #include <ost/base.hh>
00027 #include <ost/geom/geom.hh>
00028 #include <ost/mol/entity_view.hh>
00029 #include <ost/mol/alg/module_config.hh>
00030 #include <ost/mol/atom_view.hh>
00031
00032 namespace ost { namespace mol {
00033
00034 class EntityHandle;
00035
00036 namespace alg {
00037
00042 struct DLLEXPORT_OST_MOL_ALG SuperpositionResult {
00043 SuperpositionResult()
00044 : ncycles(0), rmsd(0.0), transformation() {
00045 }
00046 int ncycles;
00047 Real rmsd;
00048 Real rmsd_superposed_atoms;
00049 Real fraction_superposed;
00050 geom::Mat4 transformation;
00051 mol::EntityView entity_view1;
00052 mol::EntityView entity_view2;
00053 };
00054
00055
00056
00057
00058 class MeanSquareMinimizerImpl;
00059
00060
00061 class DLLEXPORT_OST_MOL_ALG MeanSquareMinimizer {
00062 public:
00063 static MeanSquareMinimizer FromAtomLists(const mol::AtomViewList& atoms,
00064 const mol::AtomViewList& atoms_ref);
00065 static MeanSquareMinimizer FromPointLists(const std::vector<geom::Vec3>& points,
00066 const std::vector<geom::Vec3>& points_ref);
00067 SuperpositionResult MinimizeOnce() const;
00068
00069 SuperpositionResult IterativeMinimize(int ncycles=5, Real distance_threshold=2.0) const;
00070
00071 ~MeanSquareMinimizer();
00072
00073
00074 MeanSquareMinimizer& operator=(const MeanSquareMinimizer& rhs);
00075 MeanSquareMinimizer(const MeanSquareMinimizer& rhs);
00076 void swap(MeanSquareMinimizer& rhs) {
00077 std::swap(rhs.impl_, impl_);
00078 }
00079
00080 protected:
00081 MeanSquareMinimizer(): impl_(NULL) {}
00082 MeanSquareMinimizerImpl* impl_;
00083 };
00084
00086 SuperpositionResult DLLEXPORT_OST_MOL_ALG SuperposeAtoms(const mol::AtomViewList& atoms1,
00087 const mol::AtomViewList& atoms2,
00088 bool apply_transform);
00090 SuperpositionResult DLLEXPORT_OST_MOL_ALG SuperposeSVD(const mol::EntityView& ev1,
00091 const mol::EntityView& ev2,
00092 bool apply_transform);
00093
00095 SuperpositionResult DLLEXPORT_OST_MOL_ALG SuperposeSVD(const geom::Vec3List& pl1,
00096 const geom::Vec3List& pl2);
00097
00099 SuperpositionResult DLLEXPORT_OST_MOL_ALG IterativeSuperposeSVD(const mol::EntityView& ev1,
00100 const mol::EntityView& ev2,
00101 int max_cycles,
00102 Real distance_threshold,
00103 bool apply_transform);
00104
00106 SuperpositionResult DLLEXPORT_OST_MOL_ALG IterativeSuperposeSVD(const geom::Vec3List& pl1,
00107 const geom::Vec3List& pl2,
00108 int max_cycles,
00109 Real distance_threshold);
00110
00111
00112
00114 Real DLLEXPORT_OST_MOL_ALG CalculateRMSD(const mol::EntityView& ev1,
00115 const mol::EntityView& ev2,
00116 const geom::Mat4& transformation);
00117
00118
00119
00120 }}}
00121 #endif