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