Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

colvarproxy_atoms Class Reference

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

#include <colvarproxy.h>

Inheritance diagram for colvarproxy_atoms:

colvarproxy colvarproxy_vmd List of all members.

Public Methods

 colvarproxy_atoms ()
 Constructor. More...

virtual ~colvarproxy_atoms ()
 Destructor. More...

virtual int init_atom (int atom_number)
 Prepare this atom for collective variables calculation, selecting it by numeric index (1-based). More...

virtual int check_atom_id (int atom_number)
 Check that this atom number is valid, but do not initialize the corresponding atom yet. More...

virtual int init_atom (cvm::residue_id const &residue, std::string const &atom_name, std::string const &segment_id)
 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. More...

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

virtual void clear_atom (int index)
 \brief Used by the atom class destructor: rather than deleting the array slot (costly) set the corresponding atoms_refcount to zero. More...

virtual int load_atoms (char const *filename, cvm::atom_group &atoms, std::string const &pdb_field, double pdb_field_value=0.0)
 \brief Select atom IDs from a file (usually PDB)
Parameters:
filename  name of the file
atoms  array to which atoms read from "filename" will be appended
pdb_field  (optional) if the file is a PDB and this string is non-empty, select atoms for which this field is non-zero
pdb_field_value  (optional) if non-zero, select only atoms whose pdb_field equals this.
More...


virtual int load_coords (char const *filename, std::vector< cvm::atom_pos > &pos, std::vector< int > const &sorted_ids, std::string const &pdb_field, double pdb_field_value=0.0)
 \brief Load a set of coordinates from a file (usually PDB); if "pos" is already allocated, the number of its elements must match the number of entries in "filename"
Parameters:
filename  name of the file
pos  array of coordinates
sorted_ids  array of sorted internal IDs, used to loop through the file only once
pdb_field  (optional) if the file is a PDB and this string is non-empty, select atoms for which this field is non-zero
pdb_field_value  (optional) if non-zero, select only atoms whose pdb_field equals this.
More...


int reset ()
 Clear atomic data. More...

int get_atom_id (int index) const
 Get the numeric ID of the given atom
Parameters:
index  Internal index in the Colvars arrays.
More...


cvm::real get_atom_mass (int index) const
 Get the mass of the given atom
Parameters:
index  Internal index in the Colvars arrays.
More...


void increase_refcount (int index)
 Increase the reference count of the given atom
Parameters:
index  Internal index in the Colvars arrays.
More...


cvm::real get_atom_charge (int index) const
 Get the charge of the given atom
Parameters:
index  Internal index in the Colvars arrays.
More...


cvm::rvector get_atom_position (int index) const
 Read the current position of the given atom
Parameters:
index  Internal index in the Colvars arrays.
More...


cvm::rvector get_atom_total_force (int index) const
 Read the current total force of the given atom
Parameters:
index  Internal index in the Colvars arrays.
More...


void apply_atom_force (int index, cvm::rvector const &new_force)
 Request that this force is applied to the given atom
Parameters:
index  Internal index in the Colvars arrays
new_force  Force to add.
More...


cvm::rvector get_atom_velocity (int)
 Read the current velocity of the given atom. More...

std::vector< int > const * get_atom_ids () const
size_t get_num_active_atoms () const
 Return number of atoms with positive reference count. More...

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

void compute_max_atoms_applied_force ()
 Compute the maximum norm among all applied forces. More...

cvm::real rms_atoms_applied_force () const
 Get the root-mean-square of the applied forces. More...

cvm::real max_atoms_applied_force () const
 Get the maximum norm among all applied forces. More...

int max_atoms_applied_force_id () const
 Get the atom ID with the largest applied force. More...

bool updated_masses () const
 Record whether masses have been updated. More...

bool updated_charges () const
 Record whether masses have been updated. More...


Protected Methods

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


Protected Attributes

std::vector< int > atoms_ids
 \brief Array of 0-based integers used to uniquely associate atoms within the host program. More...

std::vector< size_t > atoms_refcount
 \brief Keep track of how many times each atom is used by a separate colvar object. More...

std::vector< cvm::realatoms_masses
 \brief Masses of the atoms (allow redefinition during a run, as done e.g. in LAMMPS). More...

std::vector< cvm::realatoms_charges
 \brief Charges of the atoms (allow redefinition during a run, as done e.g. in LAMMPS). More...

std::vector< cvm::rvector > atoms_positions
 \brief Current three-dimensional positions of the atoms. More...

std::vector< cvm::rvector > atoms_total_forces
 \brief Most recent total forces on each atom. More...

std::vector< cvm::rvector > atoms_new_colvar_forces
 \brief Forces applied from colvars, to be communicated to the MD integrator. More...

cvm::real atoms_rms_applied_force_
 Root-mean-square of the applied forces. More...

cvm::real atoms_max_applied_force_
 Maximum norm among all applied forces. More...

int atoms_max_applied_force_id_
 ID of the atom with the maximum norm among all applied forces. More...

bool updated_masses_
 Whether the masses and charges have been updated from the host code. More...

bool updated_charges_
 Whether the masses and charges have been updated from the host code. More...


Detailed Description

\brief Container of atomic data for processing by Colvars.

Definition at line 41 of file colvarproxy.h.


Constructor & Destructor Documentation

colvarproxy_atoms::colvarproxy_atoms  
 

Constructor.

Definition at line 22 of file colvarproxy.C.

References atoms_max_applied_force_, atoms_max_applied_force_id_, atoms_rms_applied_force_, updated_charges_, and updated_masses_.

colvarproxy_atoms::~colvarproxy_atoms   [virtual]
 

Destructor.

Definition at line 30 of file colvarproxy.C.

References reset.


Member Function Documentation

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.

Definition at line 49 of file colvarproxy.C.

References atoms_charges, atoms_ids, atoms_masses, atoms_new_colvar_forces, atoms_positions, atoms_refcount, and atoms_total_forces.

Referenced by colvarproxy_vmd::init_atom.

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:
index  Internal index in the Colvars arrays
new_force  Force to add.

Definition at line 148 of file colvarproxy.h.

References atoms_new_colvar_forces.

int colvarproxy_atoms::check_atom_id cvm::residue_id const &    residue,
std::string const &    atom_name,
std::string const &    segment_id
[virtual]
 

Check that this atom is valid, but do not initialize it yet.

Reimplemented in colvarproxy_vmd.

Definition at line 84 of file colvarproxy.C.

References COLVARS_NOT_IMPLEMENTED, and init_atom.

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

Definition at line 68 of file colvarproxy.C.

References COLVARS_NOT_IMPLEMENTED.

void colvarproxy_atoms::clear_atom int    index [virtual]
 

\brief Used by the atom class destructor: rather than deleting the array slot (costly) set the corresponding atoms_refcount to zero.

Definition at line 93 of file colvarproxy.C.

References atoms_ids, atoms_refcount, COLVARS_INPUT_ERROR, and colvarmodule::error.

void colvarproxy_atoms::compute_max_atoms_applied_force  
 

Compute the maximum norm among all applied forces.

Definition at line 145 of file colvarproxy.C.

References atoms_ids, atoms_max_applied_force_, atoms_max_applied_force_id_, and atoms_new_colvar_forces.

Referenced by colvarproxy::end_of_step.

void colvarproxy_atoms::compute_rms_atoms_applied_force  
 

Compute the root-mean-square of the applied forces.

Definition at line 138 of file colvarproxy.C.

References atoms_rms_applied_force_.

Referenced by colvarproxy::end_of_step.

std::vector<cvm::rvector> const* colvarproxy_atoms::get_atom_applied_forces   const [inline]
 

Definition at line 214 of file colvarproxy.h.

References atoms_new_colvar_forces.

cvm::real colvarproxy_atoms::get_atom_charge int    index const [inline]
 

Get the charge of the given atom

Parameters:
index  Internal index in the Colvars arrays.

Definition at line 126 of file colvarproxy.h.

References atoms_charges.

Referenced by colvarmodule::atom::update_charge.

std::vector<cvm::real> const* colvarproxy_atoms::get_atom_charges   [inline]
 

Definition at line 182 of file colvarproxy.h.

References atoms_charges.

int colvarproxy_atoms::get_atom_id int    index const [inline]
 

Get the numeric ID of the given atom

Parameters:
index  Internal index in the Colvars arrays.

Definition at line 105 of file colvarproxy.h.

References atoms_ids.

std::vector<int> const* colvarproxy_atoms::get_atom_ids   const [inline]
 

Definition at line 162 of file colvarproxy.h.

References atoms_ids.

cvm::real colvarproxy_atoms::get_atom_mass int    index const [inline]
 

Get the mass of the given atom

Parameters:
index  Internal index in the Colvars arrays.

Definition at line 112 of file colvarproxy.h.

References atoms_masses.

Referenced by colvarmodule::atom::update_mass.

std::vector<cvm::real> const* colvarproxy_atoms::get_atom_masses   const [inline]
 

Definition at line 170 of file colvarproxy.h.

References atoms_masses.

cvm::rvector colvarproxy_atoms::get_atom_position int    index const [inline]
 

Read the current position of the given atom

Parameters:
index  Internal index in the Colvars arrays.

Definition at line 133 of file colvarproxy.h.

References atoms_positions.

std::vector<cvm::rvector> const* colvarproxy_atoms::get_atom_positions   const [inline]
 

Definition at line 194 of file colvarproxy.h.

References atoms_positions.

cvm::rvector colvarproxy_atoms::get_atom_total_force int    index const [inline]
 

Read the current total force of the given atom

Parameters:
index  Internal index in the Colvars arrays.

Definition at line 140 of file colvarproxy.h.

References atoms_total_forces.

std::vector<cvm::rvector> const* colvarproxy_atoms::get_atom_total_forces   const [inline]
 

Definition at line 204 of file colvarproxy.h.

References atoms_total_forces.

cvm::rvector colvarproxy_atoms::get_atom_velocity int    [inline]
 

Read the current velocity of the given atom.

Definition at line 154 of file colvarproxy.h.

References COLVARS_NOT_IMPLEMENTED, and colvarmodule::error.

size_t colvarproxy_atoms::get_num_active_atoms   const
 

Return number of atoms with positive reference count.

Definition at line 105 of file colvarproxy.C.

References atoms_refcount, and result.

void colvarproxy_atoms::increase_refcount int    index [inline]
 

Increase the reference count of the given atom

Parameters:
index  Internal index in the Colvars arrays.

Definition at line 119 of file colvarproxy.h.

References atoms_refcount.

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

Definition at line 74 of file colvarproxy.C.

References COLVARS_NOT_IMPLEMENTED, and colvarmodule::error.

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

Definition at line 62 of file colvarproxy.C.

References COLVARS_NOT_IMPLEMENTED.

Referenced by check_atom_id.

int colvarproxy_atoms::load_atoms char const *    filename,
cvm::atom_group &    atoms,
std::string const &    pdb_field,
double    pdb_field_value = 0.0
[virtual]
 

\brief Select atom IDs from a file (usually PDB)

Parameters:
filename  name of the file
atoms  array to which atoms read from "filename" will be appended
pdb_field  (optional) if the file is a PDB and this string is non-empty, select atoms for which this field is non-zero
pdb_field_value  (optional) if non-zero, select only atoms whose pdb_field equals this.

Reimplemented in colvarproxy_vmd.

Definition at line 115 of file colvarproxy.C.

References COLVARS_NOT_IMPLEMENTED, and colvarmodule::error.

int colvarproxy_atoms::load_coords char const *    filename,
std::vector< cvm::atom_pos > &    pos,
std::vector< int > const &    sorted_ids,
std::string const &    pdb_field,
double    pdb_field_value = 0.0
[virtual]
 

\brief Load a set of coordinates from a file (usually PDB); if "pos" is already allocated, the number of its elements must match the number of entries in "filename"

Parameters:
filename  name of the file
pos  array of coordinates
sorted_ids  array of sorted internal IDs, used to loop through the file only once
pdb_field  (optional) if the file is a PDB and this string is non-empty, select atoms for which this field is non-zero
pdb_field_value  (optional) if non-zero, select only atoms whose pdb_field equals this.

Definition at line 126 of file colvarproxy.C.

References COLVARS_NOT_IMPLEMENTED, and colvarmodule::error.

cvm::real colvarproxy_atoms::max_atoms_applied_force   const [inline]
 

Get the maximum norm among all applied forces.

Definition at line 237 of file colvarproxy.h.

References atoms_max_applied_force_.

int colvarproxy_atoms::max_atoms_applied_force_id   const [inline]
 

Get the atom ID with the largest applied force.

Definition at line 243 of file colvarproxy.h.

References atoms_max_applied_force_id_.

std::vector<cvm::rvector>* colvarproxy_atoms::modify_atom_applied_forces   [inline]
 

Definition at line 219 of file colvarproxy.h.

References atoms_new_colvar_forces.

std::vector<cvm::real>* colvarproxy_atoms::modify_atom_charges   [inline]
 

Definition at line 187 of file colvarproxy.h.

References atoms_charges, and updated_charges_.

std::vector<cvm::real>* colvarproxy_atoms::modify_atom_masses   [inline]
 

Definition at line 175 of file colvarproxy.h.

References atoms_masses, and updated_masses_.

std::vector<cvm::rvector>* colvarproxy_atoms::modify_atom_positions   [inline]
 

Definition at line 199 of file colvarproxy.h.

References atoms_positions.

std::vector<cvm::rvector>* colvarproxy_atoms::modify_atom_total_forces   [inline]
 

Definition at line 209 of file colvarproxy.h.

References atoms_total_forces.

int colvarproxy_atoms::reset  
 

Clear atomic data.

Reimplemented in colvarproxy.

Definition at line 36 of file colvarproxy.C.

References atoms_charges, atoms_ids, atoms_masses, atoms_new_colvar_forces, atoms_positions, atoms_refcount, and atoms_total_forces.

Referenced by colvarproxy::reset, and ~colvarproxy_atoms.

cvm::real colvarproxy_atoms::rms_atoms_applied_force   const [inline]
 

Get the root-mean-square of the applied forces.

Definition at line 231 of file colvarproxy.h.

References atoms_rms_applied_force_.

bool colvarproxy_atoms::updated_charges   const [inline]
 

Record whether masses have been updated.

Definition at line 255 of file colvarproxy.h.

References updated_charges_.

bool colvarproxy_atoms::updated_masses   const [inline]
 

Record whether masses have been updated.

Definition at line 249 of file colvarproxy.h.

References updated_masses_.


Member Data Documentation

std::vector<cvm::real> colvarproxy_atoms::atoms_charges [protected]
 

\brief Charges of the atoms (allow redefinition during a run, as done e.g. in LAMMPS).

Definition at line 270 of file colvarproxy.h.

Referenced by add_atom_slot, get_atom_charge, get_atom_charges, colvarproxy_vmd::init_atom, modify_atom_charges, colvarproxy::print_input_atomic_data, reset, and colvarproxy_vmd::update_atomic_properties.

std::vector<int> colvarproxy_atoms::atoms_ids [protected]
 

\brief Array of 0-based integers used to uniquely associate atoms within the host program.

Definition at line 264 of file colvarproxy.h.

Referenced by add_atom_slot, clear_atom, compute_max_atoms_applied_force, get_atom_id, get_atom_ids, colvarproxy_vmd::init_atom, colvarproxy::print_input_atomic_data, reset, colvarproxy_vmd::update_atomic_properties, and colvarproxy_vmd::update_input.

std::vector<cvm::real> colvarproxy_atoms::atoms_masses [protected]
 

\brief Masses of the atoms (allow redefinition during a run, as done e.g. in LAMMPS).

Definition at line 268 of file colvarproxy.h.

Referenced by add_atom_slot, get_atom_mass, get_atom_masses, colvarproxy_vmd::init_atom, modify_atom_masses, colvarproxy::print_input_atomic_data, reset, and colvarproxy_vmd::update_atomic_properties.

cvm::real colvarproxy_atoms::atoms_max_applied_force_ [protected]
 

Maximum norm among all applied forces.

Definition at line 282 of file colvarproxy.h.

Referenced by colvarproxy_atoms, compute_max_atoms_applied_force, and max_atoms_applied_force.

int colvarproxy_atoms::atoms_max_applied_force_id_ [protected]
 

ID of the atom with the maximum norm among all applied forces.

Definition at line 285 of file colvarproxy.h.

Referenced by colvarproxy_atoms, compute_max_atoms_applied_force, and max_atoms_applied_force_id.

std::vector<cvm::rvector> colvarproxy_atoms::atoms_new_colvar_forces [protected]
 

\brief Forces applied from colvars, to be communicated to the MD integrator.

Definition at line 276 of file colvarproxy.h.

Referenced by add_atom_slot, apply_atom_force, compute_max_atoms_applied_force, get_atom_applied_forces, modify_atom_applied_forces, colvarproxy::print_output_atomic_data, reset, and colvarproxy_vmd::update_input.

std::vector<cvm::rvector> colvarproxy_atoms::atoms_positions [protected]
 

\brief Current three-dimensional positions of the atoms.

Definition at line 272 of file colvarproxy.h.

Referenced by add_atom_slot, get_atom_position, get_atom_positions, modify_atom_positions, colvarproxy::print_input_atomic_data, reset, and colvarproxy_vmd::update_input.

std::vector<size_t> colvarproxy_atoms::atoms_refcount [protected]
 

\brief Keep track of how many times each atom is used by a separate colvar object.

Definition at line 266 of file colvarproxy.h.

Referenced by add_atom_slot, clear_atom, get_num_active_atoms, increase_refcount, colvarproxy_vmd::init_atom, colvarproxy::print_input_atomic_data, and reset.

cvm::real colvarproxy_atoms::atoms_rms_applied_force_ [protected]
 

Root-mean-square of the applied forces.

Definition at line 279 of file colvarproxy.h.

Referenced by colvarproxy_atoms, compute_rms_atoms_applied_force, and rms_atoms_applied_force.

std::vector<cvm::rvector> colvarproxy_atoms::atoms_total_forces [protected]
 

\brief Most recent total forces on each atom.

Definition at line 274 of file colvarproxy.h.

Referenced by add_atom_slot, get_atom_total_force, get_atom_total_forces, modify_atom_total_forces, colvarproxy::print_input_atomic_data, and reset.

bool colvarproxy_atoms::updated_charges_ [protected]
 

Whether the masses and charges have been updated from the host code.

Definition at line 288 of file colvarproxy.h.

Referenced by colvarproxy_atoms, colvarproxy_vmd::colvarproxy_vmd, colvarproxy::end_of_step, modify_atom_charges, and updated_charges.

bool colvarproxy_atoms::updated_masses_ [protected]
 

Whether the masses and charges have been updated from the host code.

Definition at line 288 of file colvarproxy.h.

Referenced by colvarproxy_atoms, colvarproxy_vmd::colvarproxy_vmd, colvarproxy::end_of_step, modify_atom_masses, and updated_masses.


The documentation for this class was generated from the following files:
Generated on Thu Apr 18 02:46:58 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002