OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
svd_superpose.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 
20 /*
21  * Author Juergen Haas
22  */
23 #ifndef OST_SUPERPOSITION_HH
24 #define OST_SUPERPOSITION_HH
25 
26 #include <ost/base.hh>
27 #include <ost/geom/geom.hh>
28 #include <ost/mol/entity_view.hh>
30 #include <ost/mol/atom_view.hh>
31 
32 namespace ost { namespace mol {
33 
34 class EntityHandle;
35 
36 namespace alg {
37 
44  : ncycles(0), rmsd(0.0), transformation() {
45  }
46  int ncycles;
53 };
54 
55 
56 // the mean square minimizer is split into a private and a public class to avoid
57 // exposing the lib Eigen classes to the outside world
58 class MeanSquareMinimizerImpl;
59 
60 
62 public:
63  static MeanSquareMinimizer FromAtomLists(const mol::AtomViewList& atoms,
64  const mol::AtomViewList& atoms_ref);
65  static MeanSquareMinimizer FromPointLists(const std::vector<geom::Vec3>& points,
66  const std::vector<geom::Vec3>& points_ref);
67  SuperpositionResult MinimizeOnce() const;
68 
69  SuperpositionResult IterativeMinimize(int ncycles=5, Real distance_threshold=2.0) const;
70 
72 
73 
74  MeanSquareMinimizer& operator=(const MeanSquareMinimizer& rhs);
77  std::swap(rhs.impl_, impl_);
78  }
79 
80 protected:
81  MeanSquareMinimizer(): impl_(NULL) {}
82  MeanSquareMinimizerImpl* impl_;
83 };
84 
87  const mol::AtomViewList& atoms2,
88  bool apply_transform);
91  const mol::EntityView& ev2,
92  bool apply_transform);
93 
95 SuperpositionResult DLLEXPORT_OST_MOL_ALG SuperposeSVD(const std::vector<geom::Vec3>& pl1,
96  const std::vector<geom::Vec3>& pl2);
97 
100  const mol::EntityView& ev2,
101  int max_cycles,
102  Real distance_threshold,
103  bool apply_transform);
104 
106 SuperpositionResult DLLEXPORT_OST_MOL_ALG IterativeSuperposeSVD(const std::vector<geom::Vec3>& pl1,
107  const std::vector<geom::Vec3>& pl2,
108  int max_cycles,
109  Real distance_threshold);
110 
111 
112 
115  const mol::EntityView& ev2,
116  const geom::Mat4& transformation);
117 
118 
119 
120 }}}//ns
121 #endif