1 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2    Copyright (c) 2012-2021 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_core_FlexibleBin_h
23 #define __PLUMED_core_FlexibleBin_h
24 
25 #include<vector>
26 
27 namespace PLMD {
28 
29 class ActionWithArguments;
30 
31 class FlexibleBin {
32 private:
33   int type;
34   // this contains all the infos about the CVs including periodicity
35   ActionWithArguments *paction;
36   double sigma;
37   // variance is the matrix that really matters
38   std::vector<double> variance;
39   // this is only there
40   std::vector<double> average;
41   // minimum and maximum values
42   std::vector<double> sigmamin;
43   std::vector<double> sigmamax;
44   std::vector<bool>  limitmax;
45   std::vector<bool>  limitmin;
46 public:
47   /// a constructor that takes the pointer of the action that contains it
48   FlexibleBin(int type,ActionWithArguments *paction, double const &d, std::vector<double> &sigmamin, std::vector<double> &sigmamax );
49   /// a constructor for 1D FlexBin (for PBMETAD)
50   FlexibleBin(int type, ActionWithArguments *paction, unsigned iarg, double const &d, std::vector<double> &sigmamin, std::vector<double> &sigmamax);
51   /// update the average (always for diffusion) or calculate the geom covariance (  only when do_when_zero is zero)
52   void update(bool nowAddAHill);
53   void update(bool nowAddAHill, unsigned iarg);
54   std::vector<double> getMatrix() const;
55   std::vector<double> getInverseMatrix() const;
56   std::vector<double> getInverseMatrix(unsigned iarg) const;
57   enum AdaptiveHillsType { none, diffusion, geometry };
58 };
59 
60 
61 
62 }
63 #endif
64