Public Member Functions | Static Public Member Functions | List of all members
PLMD::MDAtomsBase Class Referenceabstract

Class containing interface to MDAtomsTyped. More...

#include <MDAtoms.h>

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

Public Member Functions

virtual ~MDAtomsBase ()
 Virtual destructor, just to allow inheritance. More...
 
virtual void double2MD (const double &, const TypesafePtr &) const =0
 Convert a double to a pointer to an MD-real. More...
 
virtual void getBox (Tensor &) const =0
 Retrieve box as a plumed Tensor. More...
 
virtual void getCharges (const std::vector< int > &index, std::vector< double > &c) const =0
 Retrieve selected charges. More...
 
virtual double getExtraCV (const std::string &name)=0
 Retrieve the value of an extra CV. More...
 
virtual void getLocalPositions (std::vector< Vector > &p) const =0
 Retrieve local positions. More...
 
virtual void getMasses (const std::vector< int > &index, std::vector< double > &m) const =0
 Retrieve selected masses. More...
 
virtual Vector getMDforces (const unsigned index) const =0
 
virtual void getPositions (const std::set< AtomNumber > &index, const std::vector< unsigned > &i, std::vector< Vector > &p) const =0
 Retrieve all atom positions from atom indices and local indices. More...
 
virtual void getPositions (const std::vector< int > &index, std::vector< Vector > &p) const =0
 Retrieve selected positions. More...
 
virtual void getPositions (unsigned i, unsigned j, std::vector< Vector > &p) const =0
 Retrieve all atom positions from index i to index j. More...
 
virtual unsigned getRealPrecision () const =0
 Get the size of MD-real. More...
 
virtual void MD2double (const TypesafePtr &, double &) const =0
 Convert a pointer to an MD-real to a double. More...
 
virtual void rescaleForces (const std::vector< int > &index, double factor)=0
 Rescale all the forces, including the virial. More...
 
virtual void setBox (const TypesafePtr &)=0
 Set a pointer to the box array (3x3) in the MD code. More...
 
virtual void setc (const TypesafePtr &m)=0
 Set a pointer to the charge array in the MD code. More...
 
virtual void setExtraCV (const std::string &name, const TypesafePtr &p)=0
 Set a pointer to an extra CV. More...
 
virtual void setExtraCVForce (const std::string &name, const TypesafePtr &p)=0
 Set a pointer to an extra CV force. More...
 
virtual void setf (const TypesafePtr &f)=0
 Set a pointer to the forces array in the MD code. More...
 
virtual void setf (const TypesafePtr &f, int i)=0
 Set a pointer to the force array in the MD code. More...
 
virtual void setm (const TypesafePtr &m)=0
 Set a pointer to the mass array in the MD code. More...
 
virtual void setp (const TypesafePtr &p)=0
 Set a pointer to the positions array in the MD code. More...
 
virtual void setp (const TypesafePtr &p, int i)=0
 Set a pointer to the position array in the MD code. More...
 
virtual void setUnits (const Units &units, const Units &MDUnits)=0
 Set internal and MD units. More...
 
virtual void setVirial (const TypesafePtr &)=0
 Set a pointer to the virial array (3x3) in the MD code. More...
 
virtual void updateExtraCVForce (const std::string &name, double f)=0
 Update the value of an extra CV force. More...
 
virtual void updateForces (const std::set< AtomNumber > &index, const std::vector< unsigned > &i, const std::vector< Vector > &forces)=0
 Increment the force on selected atoms. More...
 
virtual void updateForces (const std::vector< int > &index, const std::vector< Vector > &f)=0
 Increment the force on selected atoms. More...
 
virtual void updateVirial (const Tensor &v) const =0
 Increment the virial by an amount v. More...
 

Static Public Member Functions

static std::unique_ptr< MDAtomsBasecreate (unsigned n)
 Creates an MDAtomsTyped<T> object such that sizeof(T)==n. More...
 

Detailed Description

Class containing interface to MDAtomsTyped.

This class is used to translate from reals of the type used in MD to plumed (doubles), and also to rearrange atoms list according to specific ordering indexes (to deal with domain decomposition codes) and layout (to allow passing xx[] yy[] zz[] arrays from the MD code).

The class is abstract, but it is possible to allocate a new pointer with create(n), where n is the actual size of MD-reals e.g.

  std::unique_ptr<MDAtomsBase> mdatoms=MDAtomsBase::create(sizeof(float));

Constructor & Destructor Documentation

◆ ~MDAtomsBase()

virtual PLMD::MDAtomsBase::~MDAtomsBase ( )
inlinevirtual

Virtual destructor, just to allow inheritance.

Member Function Documentation

◆ create()

std::unique_ptr< MDAtomsBase > PLMD::MDAtomsBase::create ( unsigned  n)
static

Creates an MDAtomsTyped<T> object such that sizeof(T)==n.

◆ double2MD()

virtual void PLMD::MDAtomsBase::double2MD ( const double &  ,
const TypesafePtr  
) const
pure virtual

Convert a double to a pointer to an MD-real.

Implemented in PLMD::MDAtomsTyped< T >.

◆ getBox()

virtual void PLMD::MDAtomsBase::getBox ( Tensor ) const
pure virtual

Retrieve box as a plumed Tensor.

Implemented in PLMD::MDAtomsTyped< T >.

◆ getCharges()

virtual void PLMD::MDAtomsBase::getCharges ( const std::vector< int > &  index,
std::vector< double > &  c 
) const
pure virtual

Retrieve selected charges.

The operation is done in such a way that c[index[i]] is equal to the charge of atom i

Implemented in PLMD::MDAtomsTyped< T >.

◆ getExtraCV()

virtual double PLMD::MDAtomsBase::getExtraCV ( const std::string &  name)
pure virtual

Retrieve the value of an extra CV.

Implemented in PLMD::MDAtomsTyped< T >.

◆ getLocalPositions()

virtual void PLMD::MDAtomsBase::getLocalPositions ( std::vector< Vector > &  p) const
pure virtual

Retrieve local positions.

Implemented in PLMD::MDAtomsTyped< T >.

◆ getMasses()

virtual void PLMD::MDAtomsBase::getMasses ( const std::vector< int > &  index,
std::vector< double > &  m 
) const
pure virtual

Retrieve selected masses.

The operation is done in such a way that m[index[i]] is equal to the mass of atom i

Implemented in PLMD::MDAtomsTyped< T >.

◆ getMDforces()

virtual Vector PLMD::MDAtomsBase::getMDforces ( const unsigned  index) const
pure virtual

Implemented in PLMD::MDAtomsTyped< T >.

◆ getPositions() [1/3]

virtual void PLMD::MDAtomsBase::getPositions ( const std::set< AtomNumber > &  index,
const std::vector< unsigned > &  i,
std::vector< Vector > &  p 
) const
pure virtual

Retrieve all atom positions from atom indices and local indices.

Implemented in PLMD::MDAtomsTyped< T >.

◆ getPositions() [2/3]

virtual void PLMD::MDAtomsBase::getPositions ( const std::vector< int > &  index,
std::vector< Vector > &  p 
) const
pure virtual

Retrieve selected positions.

The operation is done in such a way that p[index[i]] is equal to the coordinates of atom i

Implemented in PLMD::MDAtomsTyped< T >.

◆ getPositions() [3/3]

virtual void PLMD::MDAtomsBase::getPositions ( unsigned  i,
unsigned  j,
std::vector< Vector > &  p 
) const
pure virtual

Retrieve all atom positions from index i to index j.

Implemented in PLMD::MDAtomsTyped< T >.

◆ getRealPrecision()

virtual unsigned PLMD::MDAtomsBase::getRealPrecision ( ) const
pure virtual

Get the size of MD-real.

Implemented in PLMD::MDAtomsTyped< T >.

◆ MD2double()

virtual void PLMD::MDAtomsBase::MD2double ( const TypesafePtr ,
double &   
) const
pure virtual

Convert a pointer to an MD-real to a double.

Implemented in PLMD::MDAtomsTyped< T >.

◆ rescaleForces()

virtual void PLMD::MDAtomsBase::rescaleForces ( const std::vector< int > &  index,
double  factor 
)
pure virtual

Rescale all the forces, including the virial.

It is applied to all atoms with local index going from 0 to index.size()-1

Implemented in PLMD::MDAtomsTyped< T >.

◆ setBox()

virtual void PLMD::MDAtomsBase::setBox ( const TypesafePtr )
pure virtual

Set a pointer to the box array (3x3) in the MD code.

Implemented in PLMD::MDAtomsTyped< T >.

◆ setc()

virtual void PLMD::MDAtomsBase::setc ( const TypesafePtr m)
pure virtual

Set a pointer to the charge array in the MD code.

Implemented in PLMD::MDAtomsTyped< T >.

◆ setExtraCV()

virtual void PLMD::MDAtomsBase::setExtraCV ( const std::string &  name,
const TypesafePtr p 
)
pure virtual

Set a pointer to an extra CV.

Implemented in PLMD::MDAtomsTyped< T >.

◆ setExtraCVForce()

virtual void PLMD::MDAtomsBase::setExtraCVForce ( const std::string &  name,
const TypesafePtr p 
)
pure virtual

Set a pointer to an extra CV force.

Implemented in PLMD::MDAtomsTyped< T >.

◆ setf() [1/2]

virtual void PLMD::MDAtomsBase::setf ( const TypesafePtr f)
pure virtual

Set a pointer to the forces array in the MD code.

Implemented in PLMD::MDAtomsTyped< T >.

◆ setf() [2/2]

virtual void PLMD::MDAtomsBase::setf ( const TypesafePtr f,
int  i 
)
pure virtual

Set a pointer to the force array in the MD code.

Implemented in PLMD::MDAtomsTyped< T >.

◆ setm()

virtual void PLMD::MDAtomsBase::setm ( const TypesafePtr m)
pure virtual

Set a pointer to the mass array in the MD code.

Implemented in PLMD::MDAtomsTyped< T >.

◆ setp() [1/2]

virtual void PLMD::MDAtomsBase::setp ( const TypesafePtr p)
pure virtual

Set a pointer to the positions array in the MD code.

Implemented in PLMD::MDAtomsTyped< T >.

◆ setp() [2/2]

virtual void PLMD::MDAtomsBase::setp ( const TypesafePtr p,
int  i 
)
pure virtual

Set a pointer to the position array in the MD code.

Implemented in PLMD::MDAtomsTyped< T >.

◆ setUnits()

virtual void PLMD::MDAtomsBase::setUnits ( const Units units,
const Units MDUnits 
)
pure virtual

Set internal and MD units.

Implemented in PLMD::MDAtomsTyped< T >.

◆ setVirial()

virtual void PLMD::MDAtomsBase::setVirial ( const TypesafePtr )
pure virtual

Set a pointer to the virial array (3x3) in the MD code.

Implemented in PLMD::MDAtomsTyped< T >.

◆ updateExtraCVForce()

virtual void PLMD::MDAtomsBase::updateExtraCVForce ( const std::string &  name,
double  f 
)
pure virtual

Update the value of an extra CV force.

Todo:
check if this should also be scaled when acting on total energy

Implemented in PLMD::MDAtomsTyped< T >.

◆ updateForces() [1/2]

virtual void PLMD::MDAtomsBase::updateForces ( const std::set< AtomNumber > &  index,
const std::vector< unsigned > &  i,
const std::vector< Vector > &  forces 
)
pure virtual

Increment the force on selected atoms.

The operation is done only for local atoms used in an action

Implemented in PLMD::MDAtomsTyped< T >.

◆ updateForces() [2/2]

virtual void PLMD::MDAtomsBase::updateForces ( const std::vector< int > &  index,
const std::vector< Vector > &  f 
)
pure virtual

Increment the force on selected atoms.

The operation is done in such a way that f[index[i]] is added to the force on atom i

Implemented in PLMD::MDAtomsTyped< T >.

◆ updateVirial()

virtual void PLMD::MDAtomsBase::updateVirial ( const Tensor v) const
pure virtual

Increment the virial by an amount v.

Implemented in PLMD::MDAtomsTyped< T >.


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