Collective Variables Module - Developer Documentation
Public Member Functions | Public Attributes | Protected Attributes | List of all members
colvarmodule::atom Class Reference

Stores numeric id, mass and all mutable data for an atom, mostly used by a colvar::cvc. More...

#include <colvaratoms.h>

Collaboration diagram for colvarmodule::atom:
Collaboration graph
[legend]

Public Member Functions

 atom ()
 Default constructor (sets index and id both to -1)
 
 atom (int atom_number)
 Initialize an atom for collective variable calculation and get its internal identifier. More...
 
 atom (cvm::residue_id const &residue, std::string const &atom_name, std::string const &segment_id)
 Initialize an atom for collective variable calculation and get its internal identifier. More...
 
 atom (atom const &a)
 Copy constructor.
 
 ~atom ()
 Destructor.
 
atomoperator= (atom const &a)
 Assignment operator (added to appease LGTM)
 
void reset_data ()
 Set mutable data (everything except id and mass) to zero.
 
void update_mass ()
 Get the latest value of the mass.
 
void update_charge ()
 Get the latest value of the charge.
 
void read_position ()
 Get the current position.
 
void read_velocity ()
 Get the current velocity.
 
void read_total_force ()
 Get the total force.
 
void apply_force (cvm::rvector const &new_force) const
 Apply a force to the atom. More...
 

Public Attributes

int id
 Identifier for the MD program (0-based)
 
cvm::real mass
 Mass.
 
cvm::real charge
 Charge.
 
cvm::atom_pos pos
 Current position (copied from the program, can be modified if necessary)
 
cvm::rvector vel
 Current velocity (copied from the program, can be modified if necessary)
 
cvm::rvector total_force
 System force at the previous step (copied from the program, can be modified if necessary)
 
cvm::rvector grad
 Gradient of a scalar collective variable with respect to this atom. More...
 

Protected Attributes

int index
 Index in the colvarproxy arrays (NOT in the global topology!)
 

Detailed Description

Stores numeric id, mass and all mutable data for an atom, mostly used by a colvar::cvc.

This class may be used to keep atomic data such as id, mass, position and collective variable derivatives) altogether. There may be multiple instances with identical numeric id, all acting independently: forces communicated through these instances will be summed together.

Constructor & Destructor Documentation

◆ atom() [1/2]

cvm::atom::atom ( int  atom_number)

Initialize an atom for collective variable calculation and get its internal identifier.

Parameters
atom_numberAtom index in the system topology (1-based)

◆ atom() [2/2]

cvm::atom::atom ( cvm::residue_id const &  residue,
std::string const &  atom_name,
std::string const &  segment_id 
)

Initialize an atom for collective variable calculation and get its internal identifier.

Parameters
residueResidue number
atom_nameName of the atom in the residue
segment_idFor PSF topologies, the segment identifier; for other type of topologies, may not be required

Member Function Documentation

◆ apply_force()

void colvarmodule::atom::apply_force ( cvm::rvector const &  new_force) const
inline

Apply a force to the atom.

Note: the force is not applied instantly, but will be used later by the MD integrator (the colvars module does not integrate equations of motion.

Multiple calls to this function by either the same atom object or different objects with identical id will all be added together.

Member Data Documentation

◆ grad

cvm::rvector colvarmodule::atom::grad

Gradient of a scalar collective variable with respect to this atom.

This can only handle a scalar collective variable (i.e. when the colvarvalue::real_value member is used from the colvarvalue class), which is also the most frequent case. For more complex types of colvarvalue objects, atomic gradients should be defined within the specific colvar::cvc implementation


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