LCOV - code coverage report
Current view: top level - core - FlexibleBin.h (source / functions) Hit Total Coverage
Test: plumed test coverage Lines: 1 1 100.0 %
Date: 2026-11-05 10:19:04 Functions: 0 0 -

          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_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             :   /// number of samples accumulated (diffusion only)
      42             :   unsigned nsamples=0;
      43             :   // minimum and maximum values
      44             :   std::vector<double> sigmamin;
      45             :   std::vector<double> sigmamax;
      46             :   std::vector<bool>  limitmax;
      47             :   std::vector<bool>  limitmin;
      48             : public:
      49             :   /// a constructor that takes the pointer of the action that contains it
      50             :   FlexibleBin(int type,ActionWithArguments *paction, double const &d, std::vector<double> &sigmamin, const std::vector<double> &sigmamax );
      51             :   /// a constructor for 1D FlexBin (for PBMETAD)
      52             :   FlexibleBin(int type, ActionWithArguments *paction, unsigned iarg, double const &d, std::vector<double> &sigmamin, const std::vector<double> &sigmamax);
      53             :   /// update the average (always for diffusion) or calculate the geom covariance (  only when do_when_zero is zero)
      54             :   void update(bool nowAddAHill);
      55             :   /// (diffusion only) restart the running average of the CVs from their next value, keeping the variance:
      56             :   /// used when the CVs jump, e.g. after an accepted replica exchange
      57             :   void restartAverage();
      58             :   /// (diffusion only) set the running average, the variance (upper triangle) and the number of samples,
      59             :   /// e.g. to continue the statistics of a previous run
      60             :   void setStatistics(const std::vector<double>& average, const std::vector<double>& variance, unsigned nsamples);
      61             :   void update(bool nowAddAHill, unsigned iarg);
      62             :   std::vector<double> getMatrix() const;
      63             :   /// (diffusion only) number of CV values used so far to estimate the variance
      64             :   unsigned getNumberOfSamples() const {
      65        2251 :     return nsamples;
      66             :   }
      67             :   std::vector<double> getInverseMatrix() const;
      68             :   std::vector<double> getInverseMatrix(unsigned iarg) const;
      69             :   enum AdaptiveHillsType { none, diffusion, geometry };
      70             : };
      71             : 
      72             : 
      73             : 
      74             : }
      75             : #endif

Generated by: LCOV version 1.16