Line data Source code
1 : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 : Copyright (c) 2016-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_mapping_PathReparameterization_h 23 : #define __PLUMED_mapping_PathReparameterization_h 24 : 25 : #include "reference/ReferenceConfiguration.h" 26 : #include "reference/Direction.h" 27 : #include "tools/PDB.h" 28 : #include <memory> 29 : 30 : 31 : namespace PLMD { 32 : namespace mapping { 33 : 34 : /// \ingroup TOOLBOX 35 : /// This class can be used to make a set of reference configurations equidistant 36 : 37 8 : class PathReparameterization { 38 : private: 39 : /// This is used when setting up frames 40 : PDB mypdb; 41 : /// Packs that we use to store the vectors connecting frames 42 : MultiValue mydpack; 43 : ReferenceValuePack mypack; 44 : /// Direction that is used to reparameterize configurations 45 : Direction mydir; 46 : /// The PBC object that you would like to use to calculate distances 47 : const Pbc& pbc; 48 : /// The underlying value object for the arguments 49 : const std::vector<Value*>& args; 50 : /// Reference to path that we are reparameterizing 51 : const std::vector<std::unique_ptr<ReferenceConfiguration>>& mypath; 52 : /// These are the current separations and the total length of the path 53 : std::vector<double> len, sumlen, sfrac; 54 : /// Maximum number of cycles in path reparameterization 55 : unsigned MAXCYCLES; 56 : /// This function is used to work out when we are at loop ends as we go through them in positive and negative order 57 : bool loopEnd( const int& index, const int& end, const int& inc ) const ; 58 : /// Calculate the current spacings for the frames between istart and iend and return the average spacing 59 : void calcCurrentPathSpacings( const int& istart, const int& iend ); 60 : /// Reparameterize the frames of the path between istart and iend and make the spacing equal to target 61 : void reparameterizePart( const int& istart, const int& iend, const double& target, const double& TOL ); 62 : public: 63 : PathReparameterization( const Pbc& ipbc, const std::vector<Value*>& iargs, std::vector<std::unique_ptr<ReferenceConfiguration>>& pp ); 64 : /// Reparameterize the frames of the path between istart and iend so as to make the spacing constant 65 : void reparameterize( const int& istart, const int& iend, const double& TOL ); 66 : }; 67 : 68 : } 69 : } 70 : #endif