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

colvarmodule::atom_group Class Reference

\brief Group of atom objects, mostly used by a colvar::cvc object to gather all atomic data. More...

#include <colvaratoms.h>

Inheritance diagram for colvarmodule::atom_group:

colvarparse colvardeps colvarparams List of all members.

Public Methods

 atom_group ()
 \brief Default constructor. More...

 atom_group (char const *key)
 \brief Create a group object, assign a name to it. More...

 atom_group (std::vector< cvm::atom > const &atoms_in)
 \brief Initialize the group after a (temporary) vector of atoms. More...

 ~atom_group ()
 \brief Destructor. More...

int init ()
 \brief Set default values for common flags. More...

virtual int init_dependencies ()
 \brief Initialize dependency tree. More...

int setup ()
 \brief Update data required to calculate cvc's. More...

int parse (std::string const &conf)
 \brief Initialize the group by looking up its configuration string in conf and parsing it. More...

int add_atom_numbers (std::string const &numbers_conf)
int add_atoms_of_group (atom_group const *ag)
int add_index_group (std::string const &index_group_name)
int add_atom_numbers_range (std::string const &range_conf)
int add_atom_name_residue_range (std::string const &psf_segid, std::string const &range_conf)
int parse_fitting_options (std::string const &group_conf)
int add_atom (cvm::atom const &a)
 \brief Add an atom object to this group. More...

int add_atom_id (int aid)
 \brief Add an atom ID to this group (the actual atomicdata will be not be handled by the group). More...

int remove_atom (cvm::atom_iter ai)
 \brief Remove an atom object from this group. More...

int set_dummy ()
 Set this group as a dummy group (no actual atoms). More...

int set_dummy_pos (cvm::atom_pos const &pos)
 If this group is dummy, set the corresponding position. More...

void print_properties (std::string const &colvar_name, int i, int j)
 \brief Print the updated the total mass and charge of a group. This is needed in case the hosting MD code has an option to change atom masses after their initialization. More...

virtual const std::vector<
feature * > & 
features () const
 \brief Implementation of the feature list accessor for atom group. More...

virtual std::vector< feature * > & modify_features ()
cvm::atom & operator[] (size_t const i)
cvm::atom const & operator[] (size_t const i) const
cvm::atom_iter begin ()
cvm::atom_const_iter begin () const
cvm::atom_iter end ()
cvm::atom_const_iter end () const
size_t size () const
std::vector< int > const & ids () const
 Internal atom IDs (populated during initialization). More...

std::string const print_atom_ids () const
int create_sorted_ids ()
 Allocates and populates sorted_ids and sorted_ids_map. More...

std::vector< int > const & sorted_ids () const
 Sorted internal atom IDs (populated on-demand by create_sorted_ids); used to read coordinate files. More...

std::vector< int > const & sorted_ids_map () const
 Map entries of sorted_atoms_ids onto the original positions in the group. More...

void update_total_mass ()
 Update the total mass of the atom group. More...

void update_total_charge ()
 Update the total mass of the group. More...

void read_positions ()
 \brief Get the current positions. More...

void calc_apply_roto_translation ()
 \brief (Re)calculate the optimal roto-translation. More...

void center_ref_pos ()
 \brief Save aside the center of geometry of the reference positions, then subtract it from them In this way it will be possible to use ref_pos also for the rotational fit. This is called either by atom_group::parse or by CVCs that assign reference positions (eg. RMSD, eigenvector). More...

void apply_translation (cvm::rvector const &t)
 \brief Move all positions. More...

void read_velocities ()
 \brief Get the current velocities; this must be called always *after* read_positions(); if f_ag_rotate is defined, the same rotation applied to the coordinates will be used. More...

void read_total_forces ()
 \brief Get the current total_forces; this must be called always *after* read_positions(); if f_ag_rotate is defined, the same rotation applied to the coordinates will be used. More...

void reset_atoms_data ()
 Call reset_data() for each atom. More...

int calc_required_properties ()
 \brief Recompute all mutable quantities that are required to compute CVCs. More...

std::vector< cvm::atom_pospositions () const
 \brief Return a copy of the current atom positions. More...

int calc_center_of_geometry ()
 \brief Calculate the center of geometry of the atomic positions, assuming that they are already pbc-wrapped. More...

cvm::atom_pos center_of_geometry () const
 \brief Return the center of geometry of the atomic positions. More...

int calc_center_of_mass ()
 \brief Calculate the center of mass of the atomic positions, assuming that they are already pbc-wrapped. More...

cvm::atom_pos center_of_mass () const
 \brief Return the center of mass (COM) of the atomic positions. More...

cvm::rvector center_of_mass_scalar_gradient () const
 \brief Return previously gradient of scalar variable with respect to the COM. More...

std::vector< cvm::atom_pospositions_shifted (cvm::rvector const &shift) const
 \brief Return a copy of the current atom positions, shifted by a constant vector. More...

std::vector< cvm::rvector > velocities () const
 \brief Return a copy of the current atom velocities. More...

int calc_dipole (cvm::atom_pos const &dipole_center)
 \brief Calculate the dipole of the atom group around the specified center. More...

cvm::rvector dipole () const
 \brief Return the (previously calculated) dipole of the atom group. More...

std::vector< cvm::rvector > total_forces () const
 \brief Return a copy of the total forces. More...

cvm::rvector total_force () const
 \brief Return a copy of the aggregated total force on the group. More...

void set_weighted_gradient (cvm::rvector const &grad)
 \brief Shorthand: save the specified gradient on each atom, weighting with the atom mass (mostly used in combination with center_of_mass). More...

void calc_fit_gradients ()
 \brief Calculate the derivatives of the fitting transformation. More...

void apply_colvar_force (cvm::real const &force)
 \brief Used by a (scalar) colvar to apply its force on its atom_group members The (scalar) force is multiplied by the colvar gradient for each atom; this should be used when a colvar with scalar colvarvalue type is used (this is the most frequent case: for colvars with a non-scalar type, the most convenient solution is to sum together the Cartesian forces from all the colvar components, and use apply_force() or apply_forces()). If the group is being rotated to a reference frame (e.g. to express the colvar independently from the solute rotation), the gradients are temporarily rotated to the original frame. More...

void apply_force (cvm::rvector const &force)
 \brief Apply a force "to the center of mass", i.e. the force is distributed on each atom according to its mass If the group is being rotated to a reference frame (e.g. to express the colvar independently from the solute rotation), the force is rotated back to the original frame. Colvar gradients are not used, either because they were not defined (e.g because the colvar has not a scalar value) or the biases require to micromanage the force. This function will be phased out eventually, in favor of apply_colvar_force() once that is implemented for non-scalar values. More...

void do_feature_side_effects (int id)
 Implements possible actions to be carried out when a given feature is enabled This overloads the base function in colvardeps. More...


Static Public Methods

void delete_features ()
int overlap (const atom_group &g1, const atom_group &g2)
 Detect whether two groups share atoms If yes, returns 1-based number of a common atom; else, returns 0. More...


Public Attributes

std::string name
 \brief Optional name to reuse properties of this in other groups. More...

std::string key
 \brief Keyword used to define the group. More...

bool b_dummy
 \brief If this option is on, this group merely acts as a wrapper for a fixed position; any calls to atoms within or to functions that return disaggregated data will fail. More...

cvm::rotation rot
 The rotation calculated automatically if f_ag_rotate is defined. More...

bool b_user_defined_fit
 \brief Indicates that the user has explicitly set centerToReference or rotateReference, and the corresponding reference: cvc's (eg rmsd, eigenvector) will not override the user's choice. More...

std::vector< cvm::atom_posref_pos
 \brief use reference coordinates for f_ag_center or f_ag_rotate. More...

cvm::atom_pos ref_pos_cog
 \brief Center of geometry of the reference coordinates; regardless of whether f_ag_center is true, ref_pos is centered to zero at initialization, and ref_pos_cog serves to center the positions. More...

atom_group * fitting_group
 \brief If f_ag_center or f_ag_rotate is true, use this group to define the transformation (default: this group itself). More...

cvm::real total_mass
 Total mass of the atom group. More...

cvm::real total_charge
 Total charge of the atom group. More...

bool noforce
 \brief Don't apply any force on this group (use its coordinates only to calculate a colvar). More...

std::vector< cvm::atom_posfit_gradients
 \brief Derivatives of the fitting transformation. More...


Static Public Attributes

std::vector< feature * > ag_features
 \brief Implementation of the feature list for atom group. More...


Protected Attributes

std::vector< cvm::atom > atoms
 \brief Array of atom objects. More...

std::vector< int > atoms_ids
 \brief Internal atom IDs for host code. More...

std::vector< int > sorted_atoms_ids
 Sorted list of internal atom IDs (populated on-demand by create_sorted_ids); used to read coordinate files. More...

std::vector< int > sorted_atoms_ids_map
 Map entries of sorted_atoms_ids onto the original positions in the group. More...

cvm::atom_pos dummy_atom_pos
 \brief Dummy atom position. More...

int index
 \brief Index in the colvarproxy arrays (if the group is scalable). More...


Detailed Description

\brief Group of atom objects, mostly used by a colvar::cvc object to gather all atomic data.

Definition at line 154 of file colvaratoms.h.


Constructor & Destructor Documentation

atom_group::atom_group  
 

\brief Default constructor.

atom_group::atom_group char const *    key
 

\brief Create a group object, assign a name to it.

atom_group::atom_group std::vector< cvm::atom > const &    atoms_in
 

\brief Initialize the group after a (temporary) vector of atoms.

atom_group::~atom_group  
 

\brief Destructor.


Member Function Documentation

int atom_group::add_atom cvm::atom const &    a
 

\brief Add an atom object to this group.

int atom_group::add_atom_id int    aid
 

\brief Add an atom ID to this group (the actual atomicdata will be not be handled by the group).

int atom_group::add_atom_name_residue_range std::string const &    psf_segid,
std::string const &    range_conf
 

int atom_group::add_atom_numbers std::string const &    numbers_conf
 

int atom_group::add_atom_numbers_range std::string const &    range_conf
 

int atom_group::add_atoms_of_group atom_group const *    ag
 

int atom_group::add_index_group std::string const &    index_group_name
 

void atom_group::apply_colvar_force cvm::real const &    force
 

\brief Used by a (scalar) colvar to apply its force on its atom_group members The (scalar) force is multiplied by the colvar gradient for each atom; this should be used when a colvar with scalar colvarvalue type is used (this is the most frequent case: for colvars with a non-scalar type, the most convenient solution is to sum together the Cartesian forces from all the colvar components, and use apply_force() or apply_forces()). If the group is being rotated to a reference frame (e.g. to express the colvar independently from the solute rotation), the gradients are temporarily rotated to the original frame.

void atom_group::apply_force cvm::rvector const &    force
 

\brief Apply a force "to the center of mass", i.e. the force is distributed on each atom according to its mass If the group is being rotated to a reference frame (e.g. to express the colvar independently from the solute rotation), the force is rotated back to the original frame. Colvar gradients are not used, either because they were not defined (e.g because the colvar has not a scalar value) or the biases require to micromanage the force. This function will be phased out eventually, in favor of apply_colvar_force() once that is implemented for non-scalar values.

void atom_group::apply_translation cvm::rvector const &    t
 

\brief Move all positions.

cvm::atom_const_iter atom_group::begin   const [inline]
 

Definition at line 277 of file colvaratoms.h.

References atoms.

cvm::atom_iter atom_group::begin   [inline]
 

Definition at line 272 of file colvaratoms.h.

References atoms.

void atom_group::calc_apply_roto_translation  
 

\brief (Re)calculate the optimal roto-translation.

int atom_group::calc_center_of_geometry  
 

\brief Calculate the center of geometry of the atomic positions, assuming that they are already pbc-wrapped.

int atom_group::calc_center_of_mass  
 

\brief Calculate the center of mass of the atomic positions, assuming that they are already pbc-wrapped.

int atom_group::calc_dipole cvm::atom_pos const &    dipole_center
 

\brief Calculate the dipole of the atom group around the specified center.

void atom_group::calc_fit_gradients  
 

\brief Calculate the derivatives of the fitting transformation.

int atom_group::calc_required_properties  
 

\brief Recompute all mutable quantities that are required to compute CVCs.

cvm::atom_pos atom_group::center_of_geometry   const [inline]
 

\brief Return the center of geometry of the atomic positions.

Definition at line 424 of file colvaratoms.h.

cvm::atom_pos atom_group::center_of_mass   const [inline]
 

\brief Return the center of mass (COM) of the atomic positions.

Definition at line 446 of file colvaratoms.h.

cvm::rvector atom_group::center_of_mass_scalar_gradient   const [inline]
 

\brief Return previously gradient of scalar variable with respect to the COM.

Definition at line 453 of file colvaratoms.h.

void atom_group::center_ref_pos  
 

\brief Save aside the center of geometry of the reference positions, then subtract it from them In this way it will be possible to use ref_pos also for the rotational fit. This is called either by atom_group::parse or by CVCs that assign reference positions (eg. RMSD, eigenvector).

int atom_group::create_sorted_ids  
 

Allocates and populates sorted_ids and sorted_ids_map.

void atom_group::delete_features   [inline, static]
 

Definition at line 232 of file colvaratoms.h.

cvm::rvector atom_group::dipole   const [inline]
 

\brief Return the (previously calculated) dipole of the atom group.

Definition at line 475 of file colvaratoms.h.

void atom_group::do_feature_side_effects int    id [virtual]
 

Implements possible actions to be carried out when a given feature is enabled This overloads the base function in colvardeps.

Reimplemented from colvardeps.

cvm::atom_const_iter atom_group::end   const [inline]
 

Definition at line 287 of file colvaratoms.h.

References atoms.

cvm::atom_iter atom_group::end   [inline]
 

Definition at line 282 of file colvaratoms.h.

References atoms.

virtual const std::vector<feature *>& atom_group::features   const [inline, virtual]
 

\brief Implementation of the feature list accessor for atom group.

Implements colvardeps.

Definition at line 224 of file colvaratoms.h.

std::vector<int> const& atom_group::ids   const [inline]
 

Internal atom IDs (populated during initialization).

Definition at line 303 of file colvaratoms.h.

int atom_group::init  
 

\brief Set default values for common flags.

virtual int atom_group::init_dependencies   [virtual]
 

\brief Initialize dependency tree.

Implements colvardeps.

virtual std::vector<feature *>& atom_group::modify_features   [inline, virtual]
 

Implements colvardeps.

Definition at line 228 of file colvaratoms.h.

cvm::atom const& atom_group::operator[] size_t const    i const [inline]
 

Definition at line 267 of file colvaratoms.h.

References atoms.

cvm::atom& atom_group::operator[] size_t const    i [inline]
 

Definition at line 262 of file colvaratoms.h.

References atoms.

int atom_group::overlap const atom_group &    g1,
const atom_group &    g2
[static]
 

Detect whether two groups share atoms If yes, returns 1-based number of a common atom; else, returns 0.

int atom_group::parse std::string const &    conf
 

\brief Initialize the group by looking up its configuration string in conf and parsing it.

int atom_group::parse_fitting_options std::string const &    group_conf
 

std::vector<cvm::atom_pos> atom_group::positions   const
 

\brief Return a copy of the current atom positions.

std::vector<cvm::atom_pos> atom_group::positions_shifted cvm::rvector const &    shift const
 

\brief Return a copy of the current atom positions, shifted by a constant vector.

std::string const atom_group::print_atom_ids   const
 

void atom_group::print_properties std::string const &    colvar_name,
int    i,
int    j
 

\brief Print the updated the total mass and charge of a group. This is needed in case the hosting MD code has an option to change atom masses after their initialization.

void atom_group::read_positions  
 

\brief Get the current positions.

void atom_group::read_total_forces  
 

\brief Get the current total_forces; this must be called always *after* read_positions(); if f_ag_rotate is defined, the same rotation applied to the coordinates will be used.

void atom_group::read_velocities  
 

\brief Get the current velocities; this must be called always *after* read_positions(); if f_ag_rotate is defined, the same rotation applied to the coordinates will be used.

int atom_group::remove_atom cvm::atom_iter    ai
 

\brief Remove an atom object from this group.

void atom_group::reset_atoms_data   [inline]
 

Call reset_data() for each atom.

Definition at line 395 of file colvaratoms.h.

References atoms.

int atom_group::set_dummy  
 

Set this group as a dummy group (no actual atoms).

int atom_group::set_dummy_pos cvm::atom_pos const &    pos
 

If this group is dummy, set the corresponding position.

void atom_group::set_weighted_gradient cvm::rvector const &    grad
 

\brief Shorthand: save the specified gradient on each atom, weighting with the atom mass (mostly used in combination with center_of_mass).

int atom_group::setup  
 

\brief Update data required to calculate cvc's.

size_t atom_group::size   const [inline]
 

Definition at line 292 of file colvaratoms.h.

References atoms.

std::vector<int> const& atom_group::sorted_ids   const [inline]
 

Sorted internal atom IDs (populated on-demand by create_sorted_ids); used to read coordinate files.

Definition at line 315 of file colvaratoms.h.

std::vector<int> const& atom_group::sorted_ids_map   const [inline]
 

Map entries of sorted_atoms_ids onto the original positions in the group.

Definition at line 321 of file colvaratoms.h.

cvm::rvector atom_group::total_force   const
 

\brief Return a copy of the aggregated total force on the group.

std::vector<cvm::rvector> atom_group::total_forces   const
 

\brief Return a copy of the total forces.

void atom_group::update_total_charge  
 

Update the total mass of the group.

void atom_group::update_total_mass  
 

Update the total mass of the atom group.

std::vector<cvm::rvector> atom_group::velocities   const
 

\brief Return a copy of the current atom velocities.


Member Data Documentation

std::vector<feature *> colvarmodule::atom_group::ag_features [static]
 

\brief Implementation of the feature list for atom group.

Definition at line 221 of file colvaratoms.h.

std::vector<cvm::atom> colvarmodule::atom_group::atoms [protected]
 

\brief Array of atom objects.

Definition at line 242 of file colvaratoms.h.

std::vector<int> colvarmodule::atom_group::atoms_ids [protected]
 

\brief Internal atom IDs for host code.

Definition at line 245 of file colvaratoms.h.

bool colvarmodule::atom_group::b_dummy
 

\brief If this option is on, this group merely acts as a wrapper for a fixed position; any calls to atoms within or to functions that return disaggregated data will fail.

Definition at line 300 of file colvaratoms.h.

bool colvarmodule::atom_group::b_user_defined_fit
 

\brief Indicates that the user has explicitly set centerToReference or rotateReference, and the corresponding reference: cvc's (eg rmsd, eigenvector) will not override the user's choice.

Definition at line 336 of file colvaratoms.h.

cvm::atom_pos colvarmodule::atom_group::dummy_atom_pos [protected]
 

\brief Dummy atom position.

Definition at line 255 of file colvaratoms.h.

std::vector<cvm::atom_pos> colvarmodule::atom_group::fit_gradients
 

\brief Derivatives of the fitting transformation.

Definition at line 496 of file colvaratoms.h.

atom_group* colvarmodule::atom_group::fitting_group
 

\brief If f_ag_center or f_ag_rotate is true, use this group to define the transformation (default: this group itself).

Definition at line 348 of file colvaratoms.h.

int colvarmodule::atom_group::index [protected]
 

\brief Index in the colvarproxy arrays (if the group is scalable).

Definition at line 258 of file colvaratoms.h.

std::string colvarmodule::atom_group::key
 

\brief Keyword used to define the group.

Definition at line 177 of file colvaratoms.h.

std::string colvarmodule::atom_group::name
 

\brief Optional name to reuse properties of this in other groups.

Definition at line 173 of file colvaratoms.h.

bool colvarmodule::atom_group::noforce
 

\brief Don't apply any force on this group (use its coordinates only to calculate a colvar).

Definition at line 364 of file colvaratoms.h.

std::vector<cvm::atom_pos> colvarmodule::atom_group::ref_pos
 

\brief use reference coordinates for f_ag_center or f_ag_rotate.

Definition at line 339 of file colvaratoms.h.

cvm::atom_pos colvarmodule::atom_group::ref_pos_cog
 

\brief Center of geometry of the reference coordinates; regardless of whether f_ag_center is true, ref_pos is centered to zero at initialization, and ref_pos_cog serves to center the positions.

Definition at line 344 of file colvaratoms.h.

cvm::rotation colvarmodule::atom_group::rot
 

The rotation calculated automatically if f_ag_rotate is defined.

Definition at line 331 of file colvaratoms.h.

std::vector<int> colvarmodule::atom_group::sorted_atoms_ids [protected]
 

Sorted list of internal atom IDs (populated on-demand by create_sorted_ids); used to read coordinate files.

Definition at line 249 of file colvaratoms.h.

std::vector<int> colvarmodule::atom_group::sorted_atoms_ids_map [protected]
 

Map entries of sorted_atoms_ids onto the original positions in the group.

Definition at line 252 of file colvaratoms.h.

cvm::real colvarmodule::atom_group::total_charge
 

Total charge of the atom group.

Definition at line 357 of file colvaratoms.h.

cvm::real colvarmodule::atom_group::total_mass
 

Total mass of the atom group.

Definition at line 351 of file colvaratoms.h.


The documentation for this class was generated from the following file:
Generated on Thu Dec 5 02:44:13 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002