Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
PLMD::ReferenceConfiguration Class Referenceabstract

Abstract base class for calculating the distance from a reference configuration. More...

#include <ReferenceConfiguration.h>

Inheritance diagram for PLMD::ReferenceConfiguration:
Inheritance graph
[legend]

Public Member Functions

 ReferenceConfiguration (const ReferenceConfigurationOptions &ro)
 Clear the derivatives. More...
 
virtual ~ReferenceConfiguration ()
 Destructor. More...
 
std::string getName () const
 Return the name of this metric. More...
 
virtual unsigned getNumberOfReferencePositions () const
 
virtual unsigned getNumberOfReferenceArguments () const
 
virtual void getAtomRequests (std::vector< AtomNumber > &, bool disable_checks=false)
 Retrieve the atoms that are required for this guy. More...
 
virtual void getArgumentRequests (std::vector< std::string > &, bool disable_checks=false)
 Retrieve the arguments that are required for this guy. More...
 
virtual void set (const PDB &)
 Set the final number of arguments. More...
 
virtual void read (const PDB &)=0
 Do all local business for setting the configuration. More...
 
void setWeight (const double &ww)
 Set the weight for this frame. More...
 
double getWeight () const
 Return the weight for this frame. More...
 
double calculate (const std::vector< Vector > &pos, const Pbc &pbc, const std::vector< Value * > &vals, ReferenceValuePack &myder, const bool &squared=false) const
 Calculate the distance from the reference configuration. More...
 
virtual double calc (const std::vector< Vector > &pos, const Pbc &pbc, const std::vector< Value * > &vals, const std::vector< double > &args, ReferenceValuePack &myder, const bool &squared) const =0
 Calculate the distance from the reference configuration. More...
 
template<class T >
bool parse (const std::string &key, T &t, bool ignore_missing=false)
 Return the derivatives of the distance wrt the cell vectors. More...
 
template<class T >
bool parseVector (const std::string &key, std::vector< T > &t, bool ignore_missing=false)
 Parse vector from the pdb remarks. More...
 
void parseFlag (const std::string &key, bool &t)
 Parse a flag. More...
 
void checkRead ()
 Check that all the remarks in the pdb have been read in. More...
 
void copyDerivatives (const ReferenceConfiguration *)
 Copy derivatives from one frame to this frame. More...
 
void setNamesAndAtomNumbers (const std::vector< AtomNumber > &numbers, const std::vector< std::string > &arg)
 Set the atom numbers and the argument names. More...
 
void setReferenceConfig (const std::vector< Vector > &pos, const std::vector< double > &arg, const std::vector< double > &metric)
 Set the reference structure (perhaps should also pass the pbc and align and displace ) More...
 
void print (OFile &ofile, const double &time, const double &weight, const double &lunits, const double &old_norm)
 Print a pdb file containing the reference configuration. More...
 
void print (OFile &ofile, const std::string &fmt, const double &lunits)
 
virtual double getReferenceArgument (const unsigned &i) const
 Get one of the referene arguments. More...
 
virtual const std::vector< Vector > & getReferencePositions () const
 These are overwritten in ReferenceArguments and ReferenceAtoms but are required here to make PLMD::distance work. More...
 
virtual const std::vector< double > & getReferenceArguments ()
 
virtual const std::vector< double > & getReferenceMetric ()
 
virtual const std::vector< AtomNumber > & getAbsoluteIndexes ()
 These are overwritten in ReferenceArguments and ReferenceAtoms to make frame copying work. More...
 
virtual const std::vector< std::string > & getArgumentNames ()
 
virtual bool pcaIsEnabledForThisReference ()
 Stuff for pca. More...
 
virtual double projectAtomicDisplacementOnVector (const unsigned &i, const Matrix< Vector > &eigv, const std::vector< Vector > &pos, ReferenceValuePack &mypack) const
 
bool isDirection () const
 Stuff for sanity checks on distance. More...
 
virtual void setupPCAStorage (ReferenceValuePack &mypack)
 Stuff to setup pca. More...
 

Protected Member Functions

void error (const std::string &msg)
 Derivatives wrt to the arguments. More...
 

Private Attributes

std::string name
 The name of this particular config. More...
 
double weight
 A weight assigned to this particular frame. More...
 
std::vector< std::string > line
 A vector containing all the remarks from the pdb input. More...
 
std::vector< AtomNumberfake_atom_numbers
 This is used to store the values of arguments. More...
 
std::vector< std::string > fake_arg_names
 
std::vector< Vectorfake_refatoms
 These are use by the distance function above. More...
 
std::vector< double > fake_refargs
 
std::vector< double > fake_metric
 

Friends

class SingleDomainRMSD
 
double distance (const Pbc &pbc, const std::vector< Value * > &vals, ReferenceConfiguration *, ReferenceConfiguration *, const bool &squared)
 

Detailed Description

Abstract base class for calculating the distance from a reference configuration.

A reference configuration can either have a particular set of atoms in a particular given configuration or it can be that a particular set of colvars have a particular set of values. It could also be a combination of both. To allow all the posible permutations and in order make it easy to add new ways of calculating the distance we have implemented this using polymorphism and multiple inheritance. The following provides information on how to implement a new method for calculating the distance between a pair of configurations

Constructor & Destructor Documentation

PLMD::ReferenceConfiguration::ReferenceConfiguration ( const ReferenceConfigurationOptions ro)
explicit

Clear the derivatives.

PLMD::ReferenceConfiguration::~ReferenceConfiguration ( )
virtual

Destructor.

Member Function Documentation

virtual double PLMD::ReferenceConfiguration::calc ( const std::vector< Vector > &  pos,
const Pbc pbc,
const std::vector< Value * > &  vals,
const std::vector< double > &  args,
ReferenceValuePack myder,
const bool &  squared 
) const
pure virtual

Calculate the distance from the reference configuration.

Implemented in PLMD::MultiDomainRMSD, PLMD::SingleDomainRMSD, PLMD::ArgumentOnlyDistance, PLMD::Direction, and PLMD::FakeFrame.

double PLMD::ReferenceConfiguration::calculate ( const std::vector< Vector > &  pos,
const Pbc pbc,
const std::vector< Value * > &  vals,
ReferenceValuePack myder,
const bool &  squared = false 
) const

Calculate the distance from the reference configuration.

void PLMD::ReferenceConfiguration::checkRead ( )

Check that all the remarks in the pdb have been read in.

void PLMD::ReferenceConfiguration::copyDerivatives ( const ReferenceConfiguration )

Copy derivatives from one frame to this frame.

void PLMD::ReferenceConfiguration::error ( const std::string &  msg)
protected

Derivatives wrt to the arguments.

The virial contribution has to be stored Derivatives wrt to the atoms Crash with an error

const std::vector< AtomNumber > & PLMD::ReferenceConfiguration::getAbsoluteIndexes ( )
inlinevirtual

These are overwritten in ReferenceArguments and ReferenceAtoms to make frame copying work.

Reimplemented in PLMD::ReferenceAtoms.

const std::vector< std::string > & PLMD::ReferenceConfiguration::getArgumentNames ( )
inlinevirtual

Reimplemented in PLMD::ReferenceArguments.

virtual void PLMD::ReferenceConfiguration::getArgumentRequests ( std::vector< std::string > &  ,
bool  disable_checks = false 
)
inlinevirtual

Retrieve the arguments that are required for this guy.

Reimplemented in PLMD::ReferenceArguments.

virtual void PLMD::ReferenceConfiguration::getAtomRequests ( std::vector< AtomNumber > &  ,
bool  disable_checks = false 
)
inlinevirtual

Retrieve the atoms that are required for this guy.

Reimplemented in PLMD::ReferenceAtoms.

std::string PLMD::ReferenceConfiguration::getName ( ) const

Return the name of this metric.

unsigned PLMD::ReferenceConfiguration::getNumberOfReferenceArguments ( ) const
inlinevirtual

Reimplemented in PLMD::ReferenceArguments.

unsigned PLMD::ReferenceConfiguration::getNumberOfReferencePositions ( ) const
inlinevirtual

Reimplemented in PLMD::ReferenceAtoms.

virtual double PLMD::ReferenceConfiguration::getReferenceArgument ( const unsigned &  i) const
inlinevirtual

Get one of the referene arguments.

Reimplemented in PLMD::ReferenceArguments.

const std::vector< double > & PLMD::ReferenceConfiguration::getReferenceArguments ( )
inlinevirtual

Reimplemented in PLMD::ReferenceArguments.

const std::vector< double > & PLMD::ReferenceConfiguration::getReferenceMetric ( )
inlinevirtual

Reimplemented in PLMD::ReferenceArguments.

const std::vector< Vector > & PLMD::ReferenceConfiguration::getReferencePositions ( ) const
inlinevirtual

These are overwritten in ReferenceArguments and ReferenceAtoms but are required here to make PLMD::distance work.

Reimplemented in PLMD::ReferenceAtoms.

double PLMD::ReferenceConfiguration::getWeight ( ) const
inline

Return the weight for this frame.

bool PLMD::ReferenceConfiguration::isDirection ( ) const

Stuff for sanity checks on distance.

template<class T >
bool PLMD::ReferenceConfiguration::parse ( const std::string &  key,
T &  t,
bool  ignore_missing = false 
)

Return the derivatives of the distance wrt the cell vectors.

This returns false for everything other than DRMSD as these sort of calculations have to be done separately when you use RMSD Parse something from the pdb remarks

void PLMD::ReferenceConfiguration::parseFlag ( const std::string &  key,
bool &  t 
)

Parse a flag.

template<class T >
bool PLMD::ReferenceConfiguration::parseVector ( const std::string &  key,
std::vector< T > &  t,
bool  ignore_missing = false 
)

Parse vector from the pdb remarks.

virtual bool PLMD::ReferenceConfiguration::pcaIsEnabledForThisReference ( )
inlinevirtual
void PLMD::ReferenceConfiguration::print ( OFile ofile,
const double &  time,
const double &  weight,
const double &  lunits,
const double &  old_norm 
)

Print a pdb file containing the reference configuration.

void PLMD::ReferenceConfiguration::print ( OFile ofile,
const std::string &  fmt,
const double &  lunits 
)
virtual double PLMD::ReferenceConfiguration::projectAtomicDisplacementOnVector ( const unsigned &  i,
const Matrix< Vector > &  eigv,
const std::vector< Vector > &  pos,
ReferenceValuePack mypack 
) const
inlinevirtual
virtual void PLMD::ReferenceConfiguration::read ( const PDB )
pure virtual
void PLMD::ReferenceConfiguration::set ( const PDB pdb)
virtual

Set the final number of arguments.

Set the final number of atoms Set the reference configuration using a PDB

void PLMD::ReferenceConfiguration::setNamesAndAtomNumbers ( const std::vector< AtomNumber > &  numbers,
const std::vector< std::string > &  arg 
)

Set the atom numbers and the argument names.

void PLMD::ReferenceConfiguration::setReferenceConfig ( const std::vector< Vector > &  pos,
const std::vector< double > &  arg,
const std::vector< double > &  metric 
)

Set the reference structure (perhaps should also pass the pbc and align and displace )

virtual void PLMD::ReferenceConfiguration::setupPCAStorage ( ReferenceValuePack mypack)
inlinevirtual
void PLMD::ReferenceConfiguration::setWeight ( const double &  ww)
inline

Set the weight for this frame.

Friends And Related Function Documentation

double distance ( const Pbc pbc,
const std::vector< Value * > &  vals,
ReferenceConfiguration ref1,
ReferenceConfiguration ref2,
const bool &  squared 
)
friend
friend class SingleDomainRMSD
friend

Member Data Documentation

std::vector<std::string> PLMD::ReferenceConfiguration::fake_arg_names
private
std::vector<AtomNumber> PLMD::ReferenceConfiguration::fake_atom_numbers
private

This is used to store the values of arguments.

These are used to do fake things when we copy frames

std::vector<double> PLMD::ReferenceConfiguration::fake_metric
private
std::vector<double> PLMD::ReferenceConfiguration::fake_refargs
private
std::vector<Vector> PLMD::ReferenceConfiguration::fake_refatoms
private

These are use by the distance function above.

std::vector<std::string> PLMD::ReferenceConfiguration::line
private

A vector containing all the remarks from the pdb input.

std::string PLMD::ReferenceConfiguration::name
private

The name of this particular config.

double PLMD::ReferenceConfiguration::weight
private

A weight assigned to this particular frame.


The documentation for this class was generated from the following files: