Line data Source code
1 : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 : Copyright (c) 2015-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_pamm_PammObject_h 23 : #define __PLUMED_pamm_PammObject_h 24 : 25 : #include <vector> 26 : #include "core/Value.h" 27 : #include "tools/KernelFunctions.h" 28 : 29 : namespace PLMD { 30 : namespace pamm { 31 : 32 : class PammObject { 33 : private: 34 : /// Regularisation parameter to use 35 : double regulariser; 36 : /// Is the domain periodic 37 : std::vector<bool> pbc; 38 : /// The domain of the function 39 : std::vector<std::string> min, max; 40 : /// List of kernel functions involved 41 : std::vector<std::unique_ptr<KernelFunctions>> kernels; 42 : public: 43 : // Explicit definitions for constructor, copy constructor and destructor 44 : PammObject(); 45 : PammObject( const PammObject& ); 46 : /// GB: I fixed this (should return PammObject&, it was returning PammObject 47 : // However I am not sure the implementation makes sense. 48 : PammObject& operator=(const PammObject& po) { 49 : plumed_error(); 50 : regulariser=po.regulariser; 51 : return *this; 52 : } 53 : /// Setup the Pamm object 54 : void setup( const std::string& filename, const double& reg, const std::vector<std::string>& valnames, 55 : const std::vector<bool>& pbcin, const std::vector<std::string>& imin, const std::vector<std::string>& imax, 56 : std::string& errorstr ); 57 : /// 58 : void evaluate( const std::vector<double>& invar, std::vector<double>& outvals, std::vector<std::vector<double> >& der ) const ; 59 : /// 60 : unsigned getNumberOfKernels() const ; 61 : /// 62 : std::vector<double> getKernelCenter( const unsigned& kno ) const ; 63 : /// 64 : std::vector<double> getKernelSupport( const unsigned& kno ) const ; 65 : }; 66 : 67 : inline 68 : unsigned PammObject::getNumberOfKernels() const { 69 134 : return kernels.size(); 70 : } 71 : 72 : inline 73 : std::vector<double> PammObject::getKernelCenter( const unsigned& kno ) const { 74 44 : return kernels[kno]->getCenter(); 75 : } 76 : 77 : inline 78 : std::vector<double> PammObject::getKernelSupport( const unsigned& kno ) const { 79 44 : return kernels[kno]->getContinuousSupport(); 80 : } 81 : 82 : } 83 : } 84 : 85 : #endif 86 :