LCOV - code coverage report
Current view: top level - reference - ReferenceArguments.h (source / functions) Hit Total Coverage
Test: plumed test coverage Lines: 7 9 77.8 %
Date: 2018-12-19 07:49:13 Functions: 4 7 57.1 %

          Line data    Source code
       1             : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
       2             :    Copyright (c) 2013-2018 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_reference_ReferenceArguments_h
      23             : #define __PLUMED_reference_ReferenceArguments_h
      24             : 
      25             : #include "ReferenceConfiguration.h"
      26             : #include "tools/Matrix.h"
      27             : 
      28             : namespace PLMD {
      29             : 
      30             : /// \ingroup TOOLBOX
      31             : /// In many applications (e.g. paths, fields, property maps) it is necessary to calculate
      32             : /// the distance between two configurations.  These distances can be calculated in a variety of
      33             : /// different ways.  For instance, one can assert that the distance between the two configuration
      34             : /// is the distance one would have to move all the atoms to transform configuration 1 into configuration
      35             : /// 2. Alternatively, one could calculate the values of a large set of collective coordinates in the two
      36             : /// configurations and then calculate the Euclidean distances between these two points in the resulting
      37             : /// high-dimensional vector space.  Lastly, one can combine these two forms of distance calculation to calculate
      38             : /// a hybrid distance.  Plumed allows one to use all these forms of distance calculations and also to implement
      39             : /// new forms of distance.  You should inherit from this class if your distance involves reference colvar values.
      40             : /// This class and \ref PLMD::ReferenceAtoms mirror the functionalities in \ref PLMD::ActionWithArguments and
      41             : /// \ref PLMD::ActionAtomistic respectively but for distances.
      42             : 
      43         859 : class ReferenceArguments :
      44             :   virtual public ReferenceConfiguration
      45             : {
      46             : private:
      47             : /// The weights for normed euclidean distance
      48             :   std::vector<double> weights;
      49             : /// The N X N matrix we are using to calculate our Malanobius distance
      50             :   Matrix<double> metric;
      51             :   std::vector<double> trig_metric;
      52             : /// The values of the colvars in the reference configuration
      53             :   std::vector<double> reference_args;
      54             : /// The names of the arguments
      55             :   std::vector<std::string> arg_names;
      56             : /// The indices for setting derivatives
      57             :   std::vector<unsigned> arg_der_index;
      58             : protected:
      59             : /// Are we reading weights from input
      60             :   bool hasweights;
      61             : /// Are we calculating a Malanobius distance
      62             :   bool hasmetric;
      63             : /// Read in the atoms from the pdb file
      64             :   void readArgumentsFromPDB( const PDB& pdb );
      65             : /// Set the values of the colvars based on their current instantanous values (used in Analysis)
      66             :   void setReferenceArguments();
      67             : public:
      68             :   explicit ReferenceArguments( const ReferenceConfigurationOptions& ro );
      69             : /// Get the number of reference arguments
      70             :   unsigned getNumberOfReferenceArguments() const ;
      71             : /// Get the arguments required
      72             :   void getArgumentRequests( std::vector<std::string>&, bool disable_checks=false );
      73             : /// Set the names of the arguments
      74             :   void setArgumentNames( const std::vector<std::string>& arg_vals );
      75             : /// Set the positions of the refernce arguments
      76             :   void setReferenceArguments( const std::vector<double>& arg_vals, const std::vector<double>& sigma );
      77             : /// Get the value of the ith reference argument
      78             :   double getReferenceArgument( const unsigned& i ) const ;
      79             : /// Print the arguments out
      80             :   void printArguments( OFile& ofile, const std::string& fmt ) const ;
      81             : /// Return all the reference arguments
      82             :   const std::vector<double>& getReferenceArguments();
      83             :   const std::vector<double>& getReferenceMetric();
      84             : /// Return names
      85             :   const std::vector<std::string>& getArgumentNames();
      86             : /// Calculate the euclidean/malanobius distance the atoms have moved from the reference
      87             : /// configuration in CV space
      88             :   virtual double calculateArgumentDistance( const std::vector<Value*> & vals, const std::vector<double>& arg, ReferenceValuePack& myder, const bool& squared ) const ;
      89             : };
      90             : 
      91             : inline
      92           0 : double ReferenceArguments::getReferenceArgument( const unsigned& i ) const {
      93             :   plumed_dbg_assert( i<reference_args.size() );
      94           0 :   return reference_args[i];
      95             : }
      96             : 
      97             : inline
      98       34269 : const std::vector<double>& ReferenceArguments::getReferenceArguments() {
      99       34269 :   return reference_args;
     100             : }
     101             : 
     102             : inline
     103         200 : const std::vector<std::string>& ReferenceArguments::getArgumentNames() {
     104         200 :   return arg_names;
     105             : }
     106             : 
     107             : inline
     108           8 : unsigned ReferenceArguments::getNumberOfReferenceArguments() const {
     109           8 :   return reference_args.size();
     110             : }
     111             : 
     112             : }
     113             : #endif
     114             : 

Generated by: LCOV version 1.13