Pteros  2.0
Molecular modeling library for human beings!
rmsf.h
1 
2 /*
3  *
4  * This source code is part of
5  * ******************
6  * *** Pteros ***
7  * ******************
8  * molecular modeling library
9  *
10  * Copyright (c) 2009-2013, Semen Yesylevskyy
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of Artistic License:
14  *
15  * Please note, that Artistic License is slightly more restrictive
16  * then GPL license in terms of distributing the modified versions
17  * of this software (they should be approved first).
18  * Read http://www.opensource.org/licenses/artistic-license-2.0.php
19  * for details. Such license fits scientific software better then
20  * GPL because it prevents the distribution of bugged derivatives.
21  *
22 */
23 
24 #ifndef RMSF_H
25 #define RMSF_H
26 
27 #include "pteros/analysis/trajectory_processor.h"
28 #include "pteros/analysis/consumer.h"
29 #include <map>
30 
31 namespace pteros {
32 
33 struct rmsf_group {
34  Selection sel; // running selection
35 
36  // Selections for all contained residues. They are not stored in any particular order!
37  std::vector<Selection> residue_sel;
38 
39  // Selections not containing given residue. Only used for energy calculations
40  //vector<Selection> residue_sel_rest;
41 
42  // Maps index of residue_sel to rmsf of atoms in this residue
43  // rmsf[w][r](j) is rmsf of atom j in residue r for window w
44  std::vector< std::map<int,Eigen::VectorXd> > rmsf;
45  // Per residue rmsf
46  // per_res_rmsf[w][r] is mean rmsf of residue r in window w
47  std::vector< std::map<int,double> > per_res_rmsf;
48 
49  // Per residue energy
50  //std::vector<Eigen::VectorXf> per_res_energy;
51 
52  std::string name;
53 
54  // RMSD
55  std::vector<double> rmsd;
56 
57  // Per group rmsf
58  std::vector<double> group_rmsf;
59  // Variance per residue
60  //Eigen::VectorXf variance;
61 
62  // Adds new window
63  void add_window();
64 };
65 
66 class RMSF: public Consumer
67 {
68 public:
69  RMSF(Trajectory_processor& proc, const Options& opt): Consumer(&proc){
70  set_options(opt);
71  }
72 
73  void set_options(const Options& opt){
74  options = opt;
75  }
76 
77  static void print_help();
78 
79  virtual ~RMSF();
80  void save_results();
81 
82 private:
83  //------------------------------------
86  virtual void process_frame(const Frame_info& info);
87  virtual void pre_process();
88  virtual void post_process(const Frame_info& info);
89  virtual void window_started(const Frame_info& info);
90  virtual void window_finished(const Frame_info& info);
91  //------------------------------------
93  std::vector<rmsf_group> groups;
94 
95  Selection all;
96 
97  /*
99  std::string top_file;
101  Simulation simulation;
102  Grid_searcher searcher;
103  */
104 
105  bool do_rmsd;
106  Options options;
107 };
108 
109 }
110 
111 #endif // RMSF_H
Pteros namespace.
Definition: options.cpp:32
float rmsd(const Selection &sel1, int fr1, const Selection &sel2, int fr2)
Definition: selection.cpp:1276