LCOV - code coverage report
Current view: top level - adjmat - ClusteringBase.h (source / functions) Hit Total Coverage
Test: plumed test coverage Lines: 2 2 100.0 %
Date: 2024-10-11 08:09:47 Functions: 1 1 100.0 %

          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_adjmat_ClusteringBase_h
      23             : #define __PLUMED_adjmat_ClusteringBase_h
      24             : 
      25             : #include "ActionWithInputMatrix.h"
      26             : #include "multicolvar/AtomValuePack.h"
      27             : 
      28             : namespace PLMD {
      29             : namespace adjmat {
      30             : 
      31             : class ClusteringBase : public ActionWithInputMatrix {
      32             : protected:
      33             : /// Vector that stores the sizes of the current set of clusters
      34             :   std::vector< std::pair<unsigned,unsigned> > cluster_sizes;
      35             : /// Used to identify the cluster we are working on
      36             :   int number_of_cluster;
      37             : /// Vector that identifies the cluster each atom belongs to
      38             :   std::vector<unsigned> which_cluster;
      39             : public:
      40             : /// Create manual
      41             :   static void registerKeywords( Keywords& keys );
      42             : /// Constructor
      43             :   explicit ClusteringBase(const ActionOptions&);
      44             : /// This checks whether derivatives can be computed given the base multicolvar
      45             :   void turnOnDerivatives() override;
      46             : /// Are these two atoms connected
      47             :   bool areConnected( const unsigned& iatom, const unsigned& jatom ) const ;
      48             : /// Do the calculation
      49             :   void calculate() override;
      50             : /// Do the clustering
      51             :   virtual void performClustering()=0;
      52             : /// Get the number of clusters that have been found
      53             :   unsigned getNumberOfClusters() const ;
      54             : /// Get the atoms in one of the clusters
      55             :   virtual void retrieveAtomsInCluster( const unsigned& clust, std::vector<unsigned>& myatoms ) const ;
      56             : /// Do nothing for apply here
      57          26 :   void apply() override {}
      58             : /// Get the cutoff
      59             :   virtual double getCutoffForConnection() const ;
      60             : };
      61             : 
      62             : inline
      63             : unsigned ClusteringBase::getNumberOfClusters() const {
      64           4 :   return number_of_cluster + 1;
      65             : }
      66             : 
      67             : }
      68             : }
      69             : 
      70             : #endif

Generated by: LCOV version 1.15