Line data Source code
1 : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 : Copyright (c) 2012-2019 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.org for more information.
6 :
7 : This file is part of plumed, version 2.
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_colvar_PathMSDBase_h
23 : #define __PLUMED_colvar_PathMSDBase_h
24 :
25 : #include "Colvar.h"
26 : #include "ActionRegister.h"
27 :
28 : #include "tools/PDB.h"
29 : #include "tools/RMSD.h"
30 : #include "tools/Tools.h"
31 :
32 : namespace PLMD {
33 : namespace colvar {
34 :
35 : class PathMSDBase : public Colvar {
36 : /// this class is a general container for path stuff
37 601740 : class ImagePath {
38 : public:
39 : // cardinal indexing: needed to map over msd
40 : unsigned index;
41 : // spiwok indexing
42 : std::vector<double> property;
43 : // distance
44 : double distance;
45 : // similarity (exp - lambda distance) or other
46 : double similarity;
47 : // derivatives of the distance
48 : std::vector<Vector> distder;
49 : // here one can add a pointer to a value (hypothetically providing a distance from a point)
50 : };
51 : struct imgOrderByDist {
52 : bool operator ()(ImagePath const& a, ImagePath const& b) {
53 0 : return (a).distance < (b).distance;
54 : }
55 : };
56 : struct imgOrderBySimilarity {
57 : bool operator ()(ImagePath const& a, ImagePath const& b) {
58 : return (a).similarity > (b).similarity;
59 : }
60 : };
61 :
62 : double lambda;
63 : int neigh_size;
64 : int neigh_stride;
65 : std::vector<RMSD> msdv;
66 : std::string reference;
67 : std::vector<Vector> derivs_s;
68 : std::vector<Vector> derivs_z;
69 : std::vector <ImagePath> imgVec; // this can be used for doing neighlist
70 :
71 : //variables used for the close structure method, i is the number of reference structures
72 : double epsilonClose; //the maximal distance between the close and the current structure before reassignment
73 : int debugClose; //turns on debug mode
74 : int logClose; //turns on logging
75 : RMSD rmsdPosClose; //rmsd between the current and the close structure
76 : bool firstPosClose; //flag indicating the first time we need to calculate the distance between the close and the current structure
77 : bool computeRefClose; //flag indicating necessity to recompute accurately all distances and rotation matrices between the close structure and reference str
78 : std::vector<Tensor> rotationRefClose; //Tensor[i] saved rotation matrices between the close structure and reference structures
79 : Tensor rotationPosClose; //rotation matrix between the close and the current structure
80 : std::array<std::array<Tensor,3>,3> drotationPosCloseDrr01; //Tensor[3][3]; //derivation of the rotation matrix w.r.t rr01, necessary for calculation of derivations
81 : std::vector<unsigned> savedIndices; //saved indices of imgVec from previous steps, used for recalculating after neighbourlist update
82 : protected:
83 : std::vector<PDB> pdbv;
84 : std::vector<std::string> labels;
85 : std::vector< std::vector<double> > indexvec; // use double to allow isomaps
86 : unsigned nframes;
87 : public:
88 : explicit PathMSDBase(const ActionOptions&);
89 : ~PathMSDBase();
90 : // active methods:
91 : virtual void calculate();
92 : // virtual void prepare();
93 : static void registerKeywords(Keywords& keys);
94 : };
95 :
96 : }
97 : }
98 :
99 : #endif
100 :
|