All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
BiasRepresentation.h
Go to the documentation of this file.
1 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2  Copyright (c) 2013 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-code.org for more information.
6 
7  This file is part of plumed, version 2.0.
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_tools_BiasRepresentation_h
23 #define __PLUMED_tools_BiasRepresentation_h
24 
25 #include "Exception.h"
26 #include "KernelFunctions.h"
27 #include "File.h"
28 #include "Grid.h"
29 #include <iostream>
30 
31 using namespace std;
32 
33 namespace PLMD{
34 
35 //+PLUMEDOC INTERNAL biasrepresentation
36 /*
37 
38 */
39 //+ENDPLUMEDOC
40 
41 /// this class implements a general purpose class that aims to
42 /// provide a Grid/list
43 /// transparently add gaussians to a bias
44 
46  public:
47  /// create a bias representation from a list of pointer to values
48  BiasRepresentation(vector<Value*> tmpvalues, Communicator &cc );
49  /// create a bias using explicit sigma in input (needed for histogram building)
50  BiasRepresentation(vector<Value*> tmpvalues, Communicator &cc , vector<double> sigma);
51  /// create a bias containing a grid representation
52  BiasRepresentation(vector<Value*> tmpvalues, Communicator &cc , vector<string> gmin, vector<string> gmax, vector<unsigned> nbin );
53  /// create a histogram with grid representation and sigmas in input
54  BiasRepresentation(vector<Value*> tmpvalues, Communicator &cc , vector<string> gmin, vector<string> gmax, vector<unsigned> nbin , vector<double> sigma);
55  /// destructor
57  /// retrieve the number of dimension of the representation
58  unsigned getNumberOfDimensions();
59  /// add the grid to the representation
60  void addGrid( vector<string> gmin, vector<string> gmax, vector<unsigned> nbin );
61  /// push a kernel on the representation (includes widths and height)
62  void pushKernel( IFile * ff);
63  /// set the flag that rescales the free energy to the bias
64  void setRescaledToBias(bool rescaled);
65  /// check if the representation is rescaled to the bias
66  const bool & isRescaledToBias();
67  /// check if the sigma values are already provided (in case of a histogram representation with input sigmas)
68  bool hasSigmaInInput();
69  /// get the names of the variables
70  vector<string> getNames();
71  /// get the pointer to the values
72  const vector<Value*> & getPtrToValues();
73  /// get the number of kernels contained in the representation
74  int getNumberOfKernels();
75  /// get the name of the i-th value
76  const string & getName(unsigned i);
77  /// get a pointer to a specific value
78  Value* getPtrToValue(unsigned i);
79  /// get the pointer to the grid
80  Grid* getGridPtr();
81  /// get a new histogram point from a file
82  KernelFunctions* readFromPoint(IFile *ifile);
83  /// get an automatic min/max from the set so to know how to configure the grid
84  void getMinMaxBin(vector<double> &vmin, vector<double> &vmax, vector<unsigned> &vbin);
85  /// clear the representation (grid included)
86  void clear();
87  private:
88  int ndim;
89  bool hasgrid;
91  vector<Value*> values;
92  vector<string> names;
93  vector<KernelFunctions*> hills;
94  vector<double> biasf;
95  vector<double> histosigma;
98 };
99 
100 }
101 
102 #endif
A class for holding the value of a function together with its derivatives.
Definition: Value.h:46
Class containing wrappers to MPI.
Definition: Communicator.h:44
STL namespace.
Class for input files.
Definition: IFile.h:40
vector< KernelFunctions * > hills
this class implements a general purpose class that aims to provide a Grid/list transparently add gaus...