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

Container of atomic data for processing by Colvars. More...

#include <colvarproxy.h>

Inheritance diagram for colvarproxy_atoms:
Inheritance graph
[legend]

Public Member Functions

 colvarproxy_atoms ()
 Constructor.
 
virtual ~colvarproxy_atoms ()
 Destructor.
 
virtual int init_atom (int atom_number)
 
virtual int check_atom_id (int atom_number)
 
virtual int check_atom_name_selections_available ()
 Check whether it is possible to select atoms by residue number name.
 
virtual int init_atom (cvm::residue_id const &residue, std::string const &atom_name, std::string const &segment_id)
 
virtual int check_atom_id (cvm::residue_id const &residue, std::string const &atom_name, std::string const &segment_id)
 Check that this atom is valid, but do not initialize it yet.
 
virtual void clear_atom (int index)
 Used by the atom class destructor: rather than deleting the array slot (costly) set the corresponding atoms_refcount to zero.
 
int reset ()
 Clear atomic data.
 
int get_atom_id (int index) const
 
cvm::real get_atom_mass (int index) const
 
void increase_refcount (int index)
 
cvm::real get_atom_charge (int index) const
 
cvm::rvector get_atom_position (int index) const
 
cvm::rvector get_atom_total_force (int index) const
 
void apply_atom_force (int index, cvm::rvector const &new_force)
 
cvm::rvector get_atom_velocity (int)
 Read the current velocity of the given atom.
 
std::vector< int > const * get_atom_ids () const
 
size_t get_num_active_atoms () const
 Return number of atoms with positive reference count.
 
std::vector< cvm::real > const * get_atom_masses () const
 
std::vector< cvm::real > * modify_atom_masses ()
 
std::vector< cvm::real > const * get_atom_charges ()
 
std::vector< cvm::real > * modify_atom_charges ()
 
std::vector< cvm::rvector > const * get_atom_positions () const
 
std::vector< cvm::rvector > * modify_atom_positions ()
 
std::vector< cvm::rvector > const * get_atom_total_forces () const
 
std::vector< cvm::rvector > * modify_atom_total_forces ()
 
std::vector< cvm::rvector > const * get_atom_applied_forces () const
 
std::vector< cvm::rvector > * modify_atom_applied_forces ()
 
void compute_rms_atoms_applied_force ()
 Compute the root-mean-square of the applied forces.
 
void compute_max_atoms_applied_force ()
 Compute the maximum norm among all applied forces.
 
cvm::real rms_atoms_applied_force () const
 Get the root-mean-square of the applied forces.
 
cvm::real max_atoms_applied_force () const
 Get the maximum norm among all applied forces.
 
int max_atoms_applied_force_id () const
 Get the atom ID with the largest applied force.
 
bool modified_atom_list () const
 Whether the atom list has been modified internally.
 
void reset_modified_atom_list ()
 Reset the modified atom list flag.
 
bool updated_masses () const
 Record whether masses have been updated.
 
bool updated_charges () const
 Record whether masses have been updated.
 

Protected Member Functions

int add_atom_slot (int atom_id)
 

Protected Attributes

std::vector< int > atoms_ids
 Array of 0-based integers used to uniquely associate atoms within the host program.
 
std::vector< size_t > atoms_refcount
 Keep track of how many times each atom is used by a separate colvar object.
 
std::vector< cvm::realatoms_masses
 Masses of the atoms (allow redefinition during a run, as done e.g. in LAMMPS)
 
std::vector< cvm::realatoms_charges
 Charges of the atoms (allow redefinition during a run, as done e.g. in LAMMPS)
 
std::vector< cvm::rvectoratoms_positions
 Current three-dimensional positions of the atoms.
 
std::vector< cvm::rvectoratoms_total_forces
 Most recent total forces on each atom.
 
std::vector< cvm::rvectoratoms_new_colvar_forces
 Forces applied from colvars, to be communicated to the MD integrator.
 
cvm::real atoms_rms_applied_force_
 Root-mean-square of the applied forces.
 
cvm::real atoms_max_applied_force_
 Maximum norm among all applied forces.
 
int atoms_max_applied_force_id_
 ID of the atom with the maximum norm among all applied forces.
 
bool modified_atom_list_
 Whether the atom list has been modified internally.
 
bool updated_masses_
 Whether the masses and charges have been updated from the host code.
 
bool updated_charges_
 

Detailed Description

Container of atomic data for processing by Colvars.

Member Function Documentation

◆ add_atom_slot()

int colvarproxy_atoms::add_atom_slot ( int  atom_id)
protected

Used by all init_atom() functions: create a slot for an atom not requested yet; returns the index in the arrays

◆ apply_atom_force()

void colvarproxy_atoms::apply_atom_force ( int  index,
cvm::rvector const &  new_force 
)
inline

Request that this force is applied to the given atom

Parameters
indexInternal index in the Colvars arrays
new_forceForce to add

◆ check_atom_id()

int colvarproxy_atoms::check_atom_id ( int  atom_number)
virtual

Check that this atom number is valid, but do not initialize the corresponding atom yet

Reimplemented in colvarproxy_namd, colvarproxy_vmd, and colvarproxy_lammps.

◆ get_atom_charge()

cvm::real colvarproxy_atoms::get_atom_charge ( int  index) const
inline

Get the charge of the given atom

Parameters
indexInternal index in the Colvars arrays

◆ get_atom_id()

int colvarproxy_atoms::get_atom_id ( int  index) const
inline

Get the numeric ID of the given atom

Parameters
indexInternal index in the Colvars arrays

◆ get_atom_mass()

cvm::real colvarproxy_atoms::get_atom_mass ( int  index) const
inline

Get the mass of the given atom

Parameters
indexInternal index in the Colvars arrays

◆ get_atom_position()

cvm::rvector colvarproxy_atoms::get_atom_position ( int  index) const
inline

Read the current position of the given atom

Parameters
indexInternal index in the Colvars arrays

◆ get_atom_total_force()

cvm::rvector colvarproxy_atoms::get_atom_total_force ( int  index) const
inline

Read the current total force of the given atom

Parameters
indexInternal index in the Colvars arrays

◆ increase_refcount()

void colvarproxy_atoms::increase_refcount ( int  index)
inline

Increase the reference count of the given atom

Parameters
indexInternal index in the Colvars arrays

◆ init_atom() [1/2]

int colvarproxy_atoms::init_atom ( int  atom_number)
virtual

Prepare this atom for collective variables calculation, selecting it by numeric index (1-based)

Reimplemented in colvarproxy_namd, colvarproxy_lammps, and colvarproxy_vmd.

◆ init_atom() [2/2]

int colvarproxy_atoms::init_atom ( cvm::residue_id const &  residue,
std::string const &  atom_name,
std::string const &  segment_id 
)
virtual

Select this atom for collective variables calculation, using name and residue number. Not all programs support this: leave this function as is in those cases.

Reimplemented in colvarproxy_namd, and colvarproxy_vmd.


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