All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
RMSD.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_RMSD_h
23 #define __PLUMED_tools_RMSD_h
24 
25 #include "Vector.h"
26 #include <vector>
27 #include <string>
28 
29 namespace PLMD{
30 
31 class Log;
32 class PDB;
33 class OptimalAlignment;
34 
35 /** \ingroup TOOLBOX
36 A class that implements RMSD calculations
37 This is a class that implements the various infrastructure to calculate the
38 RMSD or MSD respect a given frame. It can be done through an optimal alignment scheme
39 as Kearsley or, more simply, by resetting the center of mass.
40 This is the class that decides this. A very simple use is
41 \verbatim
42 #include "tools/PDB.h"
43 #include "tools/RMSD.h"
44 #include "tools/Vector.h"
45 using namespace PLMD;
46 RMSD rmsd;
47 PDB pdb;
48 // get the pdb (see PDB documentation)
49 pdb.read("file.pdb",true,1.0);
50 string type;
51 type.assign("OPTIMAL");
52 // set the reference and the type
53 rmsd.set(pdb,type);
54 // this calculates the rmsd and the derivatives
55 vector<Vector> derivs;
56 double val;
57 val=rmsd.calculate(getPositions(),derivs,true);
58 \endverbatim
59 
60 **/
61 
62 class RMSD
63 {
66  std::vector<Vector> reference;
67  std::vector<double> align;
68  std::vector<double> displace;
70  Log *log;
71 public:
72 /// Constructor
73  RMSD(Log & log );
74 /// a copy constructor
75  RMSD(const RMSD &);
76 /// assignment
77  RMSD& operator=(const RMSD& );
78 /// the destructor needs to delete the myalignment object eventually
79  ~RMSD();
80 /// clear the structure
81  void clear();
82 /// set reference, align and displace from input pdb structure
83  void set(const PDB&, std::string mytype);
84 /// set the type of alignment we are doing
85  void setType(std::string mytype);
86 /// set reference coordinates
87  void setReference(const std::vector<Vector> & reference);
88 /// set weights
89  void setAlign(const std::vector<double> & align);
90 /// set align
91  void setDisplace(const std::vector<double> & displace);
92 ///
93  std::string getMethod();
94 ///
95  double simpleAlignment(const std::vector<double> & align,
96  const std::vector<double> & displace,
97  const std::vector<Vector> & positions,
98  const std::vector<Vector> & reference ,
99  Log* &log,
100  std::vector<Vector> & derivatives, bool squared=false);
101 template <bool safe>
102  double optimalAlignment(const std::vector<double> & align,
103  const std::vector<double> & displace,
104  const std::vector<Vector> & positions,
105  const std::vector<Vector> & reference ,
106  std::vector<Vector> & derivatives, bool squared=false);
107 /// Compute rmsd
108  double calculate(const std::vector<Vector> & positions,std::vector<Vector> &derivatives, bool squared=false);
109 };
110 
111 }
112 
113 #endif
114 
std::vector< Vector > reference
Definition: RMSD.h:66
void clear()
clear the structure
Definition: RMSD.cpp:93
double optimalAlignment(const std::vector< double > &align, const std::vector< double > &displace, const std::vector< Vector > &positions, const std::vector< Vector > &reference, std::vector< Vector > &derivatives, bool squared=false)
Definition: RMSD.cpp:225
A class that implements RMSD calculations This is a class that implements the various infrastructure ...
Definition: RMSD.h:62
double calculate(const std::vector< Vector > &positions, std::vector< Vector > &derivatives, bool squared=false)
Compute rmsd.
Definition: RMSD.cpp:131
Class containing the log stream.
Definition: Log.h:35
void setAlign(const std::vector< double > &align)
set weights
Definition: RMSD.cpp:121
RMSD(Log &log)
Constructor.
Definition: RMSD.cpp:35
A class that is intended to include or combine various optimal alignment algorithms.
OptimalAlignment * myoptimalalignment
Definition: RMSD.h:69
AlignmentMethod
Definition: RMSD.h:64
void setReference(const std::vector< Vector > &reference)
set reference coordinates
Definition: RMSD.cpp:112
void set(const PDB &, std::string mytype)
set reference, align and displace from input pdb structure
Definition: RMSD.cpp:65
Minimalistic pdb parser.
Definition: PDB.h:38
~RMSD()
the destructor needs to delete the myalignment object eventually
Definition: RMSD.cpp:98
Log * log
Definition: RMSD.h:70
std::vector< double > displace
Definition: RMSD.h:68
RMSD & operator=(const RMSD &)
assignment
Definition: RMSD.cpp:40
void setDisplace(const std::vector< double > &displace)
set align
Definition: RMSD.cpp:126
std::string getMethod()
Definition: RMSD.cpp:102
std::vector< double > align
Definition: RMSD.h:67
double simpleAlignment(const std::vector< double > &align, const std::vector< double > &displace, const std::vector< Vector > &positions, const std::vector< Vector > &reference, Log *&log, std::vector< Vector > &derivatives, bool squared=false)
Definition: RMSD.cpp:172
void setType(std::string mytype)
set the type of alignment we are doing
Definition: RMSD.cpp:73
AlignmentMethod alignmentMethod
Definition: RMSD.h:65