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