LCOV - code coverage report
Current view: top level - analysis - ReselectLandmarks.cpp (source / functions) Hit Total Coverage
Test: plumed test coverage Lines: 17 17 100.0 %
Date: 2024-10-11 08:09:47 Functions: 6 7 85.7 %

          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             : #include "LandmarkSelectionBase.h"
      23             : #include "core/ActionRegister.h"
      24             : #include "core/PlumedMain.h"
      25             : #include "core/ActionSet.h"
      26             : #include "tools/Random.h"
      27             : 
      28             : //+PLUMEDOC LANDMARKS RESELECT_LANDMARKS
      29             : /*
      30             : This allows us to use one measure in landmark selection and a different measure in dimensionality reduction
      31             : 
      32             : \par Examples
      33             : 
      34             : */
      35             : //+ENDPLUMEDOC
      36             : 
      37             : namespace PLMD {
      38             : namespace analysis {
      39             : 
      40             : class ReselectLandmarks : public LandmarkSelectionBase {
      41             : private:
      42             :   LandmarkSelectionBase* mylandmarks;
      43             : public:
      44             :   static void registerKeywords( Keywords& keys );
      45             :   explicit ReselectLandmarks( const ActionOptions& ao );
      46             :   void selectLandmarks() override;
      47             : };
      48             : 
      49       10421 : PLUMED_REGISTER_ACTION(ReselectLandmarks,"RESELECT_LANDMARKS")
      50             : 
      51           2 : void ReselectLandmarks::registerKeywords( Keywords& keys ) {
      52           2 :   LandmarkSelectionBase::registerKeywords(keys);
      53           2 :   keys.remove("NLANDMARKS");
      54           4 :   keys.add("compulsory","LANDMARKS","the action that selects the landmarks that you want to reselect using this action");
      55           2 : }
      56             : 
      57           1 : ReselectLandmarks::ReselectLandmarks( const ActionOptions& ao ):
      58             :   Action(ao),
      59           1 :   LandmarkSelectionBase(ao)
      60             : {
      61           1 :   std::string datastr; parse("LANDMARKS",datastr);
      62           1 :   mylandmarks = plumed.getActionSet().selectWithLabel<LandmarkSelectionBase*>( datastr );
      63           1 :   if( !mylandmarks ) error("input to LANDMARKS is not a landmark selection action");
      64           1 :   nlandmarks = mylandmarks->nlandmarks;
      65             : 
      66           1 :   if( (mylandmarks->my_input_data)->getNumberOfDataPoints()!=my_input_data->getNumberOfDataPoints() ) error("mismatch between amount of landmark class and base class");
      67           1 : }
      68             : 
      69           1 : void ReselectLandmarks::selectLandmarks() {
      70           3 :   for(unsigned i=0; i<mylandmarks->getNumberOfDataPoints(); ++i) selectFrame( mylandmarks->getDataPointIndexInBase(i) );
      71           1 : }
      72             : 
      73             : }
      74             : }

Generated by: LCOV version 1.15