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) { plumed_error(); regulariser=po.regulariser; return *this; } 49 : /// Setup the Pamm object 50 : void setup( const std::string& filename, const double& reg, const std::vector<std::string>& valnames, 51 : const std::vector<bool>& pbcin, const std::vector<std::string>& imin, const std::vector<std::string>& imax, 52 : std::string& errorstr ); 53 : /// 54 : void evaluate( const std::vector<double>& invar, std::vector<double>& outvals, std::vector<std::vector<double> >& der ) const ; 55 : /// 56 : unsigned getNumberOfKernels() const ; 57 : /// 58 : std::vector<double> getKernelCenter( const unsigned& kno ) const ; 59 : /// 60 : std::vector<double> getKernelSupport( const unsigned& kno ) const ; 61 : }; 62 : 63 : inline 64 : unsigned PammObject::getNumberOfKernels() const { 65 134 : return kernels.size(); 66 : } 67 : 68 : inline 69 : std::vector<double> PammObject::getKernelCenter( const unsigned& kno ) const { 70 44 : return kernels[kno]->getCenter(); 71 : } 72 : 73 : inline 74 : std::vector<double> PammObject::getKernelSupport( const unsigned& kno ) const { 75 44 : return kernels[kno]->getContinuousSupport(); 76 : } 77 : 78 : } 79 : } 80 : 81 : #endif 82 :