LCOV - code coverage report
Current view: top level - manyrestraints - ManyRestraintsBase.h (source / functions) Hit Total Coverage
Test: plumed test coverage Lines: 7 11 63.6 %
Date: 2026-03-30 13:16:06 Functions: 4 6 66.7 %

          Line data    Source code
       1             : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
       2             :    Copyright (c) 2013-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_manyrestraints_ManyRestraintsBase_h
      23             : #define __PLUMED_manyrestraints_ManyRestraintsBase_h
      24             : 
      25             : #include "core/ActionAtomistic.h"
      26             : #include "core/ActionWithValue.h"
      27             : #include "core/ActionPilot.h"
      28             : #include "vesselbase/ActionWithVessel.h"
      29             : #include "vesselbase/ActionWithInputVessel.h"
      30             : 
      31             : namespace PLMD {
      32             : namespace manyrestraints {
      33             : 
      34             : class ManyRestraintsBase :
      35             :   public ActionWithValue,
      36             :   public ActionPilot,
      37             :   public vesselbase::ActionWithVessel,
      38             :   public vesselbase::ActionWithInputVessel {
      39             : private:
      40             : /// Pointer to underlying action with vessel
      41             :   vesselbase::ActionWithVessel* aves;
      42             : public:
      43             :   static void registerKeywords( Keywords& keys );
      44             :   explicit ManyRestraintsBase(const ActionOptions&);
      45           0 :   bool isPeriodic() override {
      46           0 :     return false;
      47             :   }
      48             :   unsigned getNumberOfDerivatives() override;
      49             : /// Routines that have to be defined so as not to have problems with virtual methods
      50             :   void deactivate_task( const unsigned & task_index ) {};
      51             : /// Don't actually clear the derivatives when this is called from plumed main.
      52             : /// They are calculated inside another action and clearing them would be bad
      53          10 :   void clearDerivatives() override {}
      54             : /// Do jobs required before tasks are undertaken
      55             :   void doJobsRequiredBeforeTaskList() override;
      56             : /// This actually does the calculation
      57             :   void transformBridgedDerivatives( const unsigned& current, MultiValue& invals, MultiValue& outvals ) const override;
      58             : /// Calculate the potential
      59             :   virtual double calcPotential( const double& val, double& df ) const=0;
      60             : // Calculate does nothing
      61           5 :   void calculate() override {};
      62             : /// This should never be called
      63           0 :   void performTask( const unsigned&, const unsigned&, MultiValue& ) const override {
      64           0 :     plumed_error();
      65             :   }
      66             : /// Deactivate task now does nothing
      67             :   void apply() override;
      68          10 :   void applyBridgeForces( const std::vector<double>& bb ) override {
      69          10 :     plumed_assert( bb.size()==0 );
      70          10 :   }
      71             : };
      72             : 
      73             : inline
      74       14828 : unsigned ManyRestraintsBase::getNumberOfDerivatives() {
      75       14828 :   return aves->getNumberOfDerivatives();
      76             : }
      77             : 
      78             : }
      79             : }
      80             : 
      81             : #endif

Generated by: LCOV version 1.16