Line data Source code
1 : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 : Copyright (c) 2015-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_gridtools_HistogramOnGrid_h
23 : #define __PLUMED_gridtools_HistogramOnGrid_h
24 :
25 : #include "GridVessel.h"
26 :
27 : namespace PLMD {
28 :
29 : class KernelFunctions;
30 :
31 : namespace gridtools {
32 :
33 100 : class HistogramOnGrid : public GridVessel {
34 : private:
35 : unsigned neigh_tot;
36 : bool addOneKernelAtATime;
37 : std::string kerneltype;
38 : std::vector<double> bandwidths;
39 : std::vector<unsigned> nneigh;
40 : protected:
41 : bool discrete;
42 : public:
43 : double von_misses_norm;
44 : double von_misses_concentration;
45 : static void registerKeywords( Keywords& keys );
46 : explicit HistogramOnGrid( const vesselbase::VesselOptions& da );
47 : void setBounds( const std::vector<std::string>& smin, const std::vector<std::string>& smax,
48 : const std::vector<unsigned>& nbins, const std::vector<double>& spacing );
49 : void calculate( const unsigned& current, MultiValue& myvals, std::vector<double>& buffer, std::vector<unsigned>& der_list ) const ;
50 : void finish( const std::vector<double>& buffer );
51 : virtual void accumulate( const unsigned& ipoint, const double& weight, const double& dens, const std::vector<double>& der, std::vector<double>& buffer ) const ;
52 : virtual void accumulateForce( const unsigned& ipoint, const double& weight, const std::vector<double>& der, std::vector<double>& intforce ) const ;
53 : unsigned getNumberOfBufferPoints() const ;
54 : KernelFunctions* getKernelAndNeighbors( std::vector<double>& point, unsigned& num_neigh, std::vector<unsigned>& neighbors ) const;
55 : std::vector<Value*> getVectorOfValues() const ;
56 18 : void addOneKernelEachTimeOnly() { addOneKernelAtATime=true; }
57 : virtual void getFinalForces( const std::vector<double>& buffer, std::vector<double>& finalForces );
58 : bool noDiscreteKernels() const ;
59 : double getFibonacciCutoff() const ;
60 : };
61 :
62 : inline
63 251 : unsigned HistogramOnGrid::getNumberOfBufferPoints() const {
64 251 : if( addOneKernelAtATime ) return neigh_tot;
65 233 : return GridVessel::getNumberOfBufferPoints();
66 : }
67 :
68 : }
69 : }
70 : #endif
|