All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
OptimalAlignment.h
Go to the documentation of this file.
1 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2  Copyright (c) 2013 The plumed team
3  (see the PEOPLE file at the root of the distribution for a list of names)
4 
5  See http://www.plumed-code.org for more information.
6 
7  This file is part of plumed, version 2.0.
8 
9  plumed is free software: you can redistribute it and/or modify
10  it under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  plumed is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  along with plumed. If not, see <http://www.gnu.org/licenses/>.
21 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
22 #ifndef __PLUMED_tools_OptimalAlignment_h
23 #define __PLUMED_tools_OptimalAlignment_h
24 
25 #include "Vector.h"
26 #include "Tensor.h"
27 #include <vector>
28 
29 namespace PLMD{
30 
31 class Log;
32 class Kearsley;
33 
34 /// A class that is intended to include or combine various optimal alignment algorithms
35 
37 {
38 private:
39  /// a pointer to the object that performs the optimal alignment via quaternions
41  /// displacement vector : a double that says if the coordinate should be used in calculating the RMSD/MSD
42  std::vector<double> displace;
43  /// alignment vector: a double that says if the atom has to be used in reset COM and makeing the alignment
44  std::vector<double> align;
45  /// position of one frame (generally the MD)
46  std::vector<Vector> p0;
47  /// position of the reference frames
48  std::vector<Vector> p1;
49  /// derivatives of the error respect to the p0 (MD running frame)
50  std::vector<Vector> derrdp0;
51  /// derivatives of the error respect to the p1 (static frame, do not remove: useful for SM)
52  std::vector<Vector> derrdp1;
53  /// the pointer to the logfile
54  Log* log;
55  /// a bool that decides to make the fast version (alignment vec= displacement vec) or the slower case
56  bool fast;
57 
58 public:
59  /// the contructor
60  OptimalAlignment( const std::vector<double> & align, const std::vector<double> & displace, const std::vector<Vector> & p0, const std::vector<Vector> & p1 , Log* &log );
61  /// the destructor: delete kearsley
63  /// assignment of the running frame p0
64  void assignP0( const std::vector<Vector> & p0 );
65  /// assignment to the reference frame p1
66  void assignP1( const std::vector<Vector> & p1 );
67  // this updates align runtime
68  void assignAlign( const std::vector<double> & align );
69  // this updates displace runtime
70  void assignDisplace( const std::vector<double> & displace );
71  /// this does the real calculation
72  double calculate( bool rmsd, std::vector<Vector> & derivatives);
73  /// this should perform the weighted alignment
74  double weightedAlignment( bool rmsd);
75  // a finite difference test
76  double weightedFindiffTest( bool rmsd);
77 };
78 
79 }
80 
81 #endif
82 
double weightedFindiffTest(bool rmsd)
double calculate(bool rmsd, std::vector< Vector > &derivatives)
this does the real calculation
void assignP0(const std::vector< Vector > &p0)
assignment of the running frame p0
std::vector< Vector > p0
position of one frame (generally the MD)
void assignP1(const std::vector< Vector > &p1)
assignment to the reference frame p1
void assignDisplace(const std::vector< double > &displace)
std::vector< Vector > p1
position of the reference frames
Class containing the log stream.
Definition: Log.h:35
Kearsley * mykearsley
a pointer to the object that performs the optimal alignment via quaternions
std::vector< double > align
alignment vector: a double that says if the atom has to be used in reset COM and makeing the alignmen...
A class that is intended to include or combine various optimal alignment algorithms.
OptimalAlignment(const std::vector< double > &align, const std::vector< double > &displace, const std::vector< Vector > &p0, const std::vector< Vector > &p1, Log *&log)
the contructor
double weightedAlignment(bool rmsd)
this should perform the weighted alignment
void assignAlign(const std::vector< double > &align)
std::vector< double > displace
displacement vector : a double that says if the coordinate should be used in calculating the RMSD/MSD...
bool fast
a bool that decides to make the fast version (alignment vec= displacement vec) or the slower case ...
std::vector< Vector > derrdp0
derivatives of the error respect to the p0 (MD running frame)
std::vector< Vector > derrdp1
derivatives of the error respect to the p1 (static frame, do not remove: useful for SM) ...
~OptimalAlignment()
the destructor: delete kearsley
Log * log
the pointer to the logfile