All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 unsigned getRealPrecision () const =0
 Get the size of MD-real. More...
 
virtual void setm (void *m)=0
 Set a pointer to the mass array in the MD code. More...
 
virtual void setc (void *m)=0
 Set a pointer to the charge array in the MD code. More...
 
virtual void setBox (void *)=0
 Set a pointer to the box array (3x3) in the MD code. More...
 
virtual void setp (void *p)=0
 Set a pointer to the positions array in the MD code. More...
 
virtual void setVirial (void *)=0
 Set a pointer to the virial array (3x3) in the MD code. More...
 
virtual void setf (void *f)=0
 Set a pointer to the forces array in the MD code. More...
 
virtual void setp (void *p, int i)=0
 Set a pointer to the position array in the MD code. More...
 
virtual void setf (void *f, int i)=0
 Set a pointer to the force array in the MD code. More...
 
virtual void setUnits (const Units &units, const Units &MDUnits)=0
 Set internal and MD units. More...
 
virtual void MD2double (const void *, double &) const =0
 Convert a pointer to an MD-real to a double. More...
 
virtual void double2MD (const double &, void *) 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 getPositions (const std::vector< int > &index, std::vector< Vector > &p) const =0
 Retrieve selected positions. More...
 
virtual void getMasses (const std::vector< int > &index, std::vector< double > &m) const =0
 Retrieve selected masses. More...
 
virtual void getCharges (const std::vector< int > &index, std::vector< double > &c) const =0
 Retrieve selected charges. More...
 
virtual void updateVirial (const Tensor &v) const =0
 Increment the virial by an amount v. More...
 
virtual void updateForces (const std::vector< int > &index, const std::vector< Vector > &f)=0
 Increment the force on selected atoms. More...
 
virtual void rescaleForces (const std::vector< int > &index, double factor)=0
 Rescale all the forces, including the virial. More...
 

Static Public Member Functions

static 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.

  MDAtomsBase mdatoms=MDAtomsBase::create(sizeof(float));
// ...
  delete mdatoms;

Constructor & Destructor Documentation

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

Virtual destructor, just to allow inheritance.

Member Function Documentation

MDAtomsBase * PLMD::MDAtomsBase::create ( unsigned  n)
static

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

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

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

Implemented in PLMD::MDAtomsTyped< T >.

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

Retrieve box as a plumed Tensor.

Implemented in PLMD::MDAtomsTyped< T >.

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 >.

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 >.

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 >.

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

Get the size of MD-real.

Implemented in PLMD::MDAtomsTyped< T >.

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

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

Implemented in PLMD::MDAtomsTyped< T >.

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

Attention
the virial is not scaled indeed... is it a bug??

Implemented in PLMD::MDAtomsTyped< T >.

virtual void PLMD::MDAtomsBase::setBox ( void *  )
pure virtual

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

Implemented in PLMD::MDAtomsTyped< T >.

virtual void PLMD::MDAtomsBase::setc ( void *  m)
pure virtual

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

Implemented in PLMD::MDAtomsTyped< T >.

virtual void PLMD::MDAtomsBase::setf ( void *  f)
pure virtual

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

Implemented in PLMD::MDAtomsTyped< T >.

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

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

Implemented in PLMD::MDAtomsTyped< T >.

virtual void PLMD::MDAtomsBase::setm ( void *  m)
pure virtual

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

Implemented in PLMD::MDAtomsTyped< T >.

virtual void PLMD::MDAtomsBase::setp ( void *  p)
pure virtual

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

Implemented in PLMD::MDAtomsTyped< T >.

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

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

Implemented in PLMD::MDAtomsTyped< T >.

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

Set internal and MD units.

Implemented in PLMD::MDAtomsTyped< T >.

virtual void PLMD::MDAtomsBase::setVirial ( void *  )
pure virtual

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

Implemented in PLMD::MDAtomsTyped< T >.

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 >.

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: