16#include "colvardeps.h"
18template <
typename T1,
typename T2>
79 atom(
int atom_number);
87 std::string
const &atom_name,
88 std::string
const &segment_id);
170 atom_group(std::vector<cvm::atom>
const &atoms_in);
193 int parse(std::string
const &conf);
195 int add_atom_numbers(std::string
const &numbers_conf);
196 int add_atoms_of_group(
atom_group const * ag);
197 int add_index_group(std::string
const &index_group_name);
198 int add_atom_numbers_range(std::string
const &range_conf);
199 int add_atom_name_residue_range(std::string
const &psf_segid,
200 std::string
const &range_conf);
201 int parse_fitting_options(std::string
const &group_conf);
229 std::vector<feature *> &modify_features()
override {
return ag_features; }
231 static void delete_features()
262 inline cvm::atom & operator [] (
size_t const i)
267 inline cvm::atom const & operator [] (
size_t const i)
const
272 inline cvm::atom_iter begin()
274 return atoms.begin();
277 inline cvm::atom_const_iter begin()
const
279 return atoms.begin();
282 inline cvm::atom_iter end()
287 inline cvm::atom_const_iter end()
const
292 inline size_t size()
const
303 inline std::vector<int>
const &
ids()
const
308 std::string
const print_atom_ids()
const;
375 void setup_rotation_derivative();
402 for (cvm::atom_iter ai =
atoms.begin(); ai !=
atoms.end(); ai++)
412 std::vector<cvm::atom_pos>
positions()
const;
Parent class for a member object of a bias, cv or cvc etc. containing features and their dependencies...
Definition: colvardeps.h:34
Group of atom objects, mostly used by a colvar::cvc object to gather all atomic data.
Definition: colvaratoms.h:159
std::vector< int > sorted_atoms_ids_map
Map entries of sorted_atoms_ids onto the original positions in the group.
Definition: colvaratoms.h:252
std::vector< int > sorted_atoms_ids
Definition: colvaratoms.h:249
void read_positions()
Get the current positions.
Definition: colvaratoms.cpp:998
int remove_atom(cvm::atom_iter ai)
Remove an atom object from this group.
Definition: colvaratoms.cpp:177
cvm::atom_pos cog_orig
Center of geometry before any fitting.
Definition: colvaratoms.h:424
int init()
Set default values for common flags.
Definition: colvaratoms.cpp:223
void calc_fit_gradients()
Calculate the derivatives of the fitting transformation.
Definition: colvaratoms.cpp:1213
void update_total_charge()
Update the total mass of the group.
Definition: colvaratoms.cpp:357
cvm::rvector scalar_com_gradient
The derivative of a scalar variable with respect to the COM.
Definition: colvaratoms.h:446
std::vector< cvm::atom_pos > positions_shifted(cvm::rvector const &shift) const
Return a copy of the current atom positions, shifted by a constant vector.
Definition: colvaratoms.cpp:1306
cvm::rvector center_of_mass_scalar_gradient() const
Return previously gradient of scalar variable with respect to the COM.
Definition: colvaratoms.h:458
void read_total_forces()
Get the current total_forces; this must be called always after read_positions(); if f_ag_rotate is de...
Definition: colvaratoms.cpp:1129
cvm::atom_pos com
Center of mass.
Definition: colvaratoms.h:441
int index
Index in the colvarproxy arrays (if the group is scalable)
Definition: colvaratoms.h:258
void reset_atoms_data()
Call reset_data() for each atom.
Definition: colvaratoms.h:400
int init_dependencies() override
Initialize dependency tree.
Definition: colvaratoms.cpp:250
void print_properties(std::string const &colvar_name, int i, int j)
Print the updated the total mass and charge of a group. This is needed in case the hosting MD code ha...
Definition: colvaratoms.cpp:375
std::string key
Keyword used to define the group.
Definition: colvaratoms.h:180
std::string name
Optional name to reuse properties of this in other groups.
Definition: colvaratoms.h:176
bool noforce
Don't apply any force on this group (use its coordinates only to calculate a colvar)
Definition: colvaratoms.h:367
int calc_required_properties()
Recompute all mutable quantities that are required to compute CVCs.
Definition: colvaratoms.cpp:1011
static std::vector< feature * > ag_features
Implementation of the feature list for atom group.
Definition: colvaratoms.h:224
atom_group()
Default constructor.
Definition: colvaratoms.cpp:90
std::vector< cvm::atom_pos > ref_pos
use reference coordinates for f_ag_center or f_ag_rotate
Definition: colvaratoms.h:342
void update_total_mass()
Update the total mass of the atom group.
Definition: colvaratoms.cpp:336
cvm::real total_charge
Total charge of the atom group.
Definition: colvaratoms.h:360
std::vector< int > const & sorted_ids_map() const
Map entries of sorted_atoms_ids onto the original positions in the group.
Definition: colvaratoms.h:321
std::vector< int > const & sorted_ids() const
Definition: colvaratoms.h:315
int add_atom(cvm::atom const &a)
Add an atom object to this group.
Definition: colvaratoms.cpp:132
void apply_force(cvm::rvector const &force)
Apply a force "to the center of mass", i.e. the force is distributed on each atom according to its ma...
Definition: colvaratoms.cpp:1436
void calc_apply_roto_translation()
(Re)calculate the optimal roto-translation
Definition: colvaratoms.cpp:1040
int add_atom_id(int aid)
Add an atom ID to this group (the actual atomicdata will be not be handled by the group)
Definition: colvaratoms.cpp:157
std::vector< int > const & ids() const
Internal atom IDs (populated during initialization)
Definition: colvaratoms.h:303
std::vector< cvm::rvector > total_forces() const
Return a copy of the total forces.
Definition: colvaratoms.cpp:1348
cvm::rvector dipole() const
Return the (previously calculated) dipole of the atom group.
Definition: colvaratoms.h:480
cvm::real total_mass
Total mass of the atom group.
Definition: colvaratoms.h:354
std::vector< cvm::atom_pos > positions() const
Return a copy of the current atom positions.
Definition: colvaratoms.cpp:1285
int calc_dipole(cvm::atom_pos const &dipole_center)
Calculate the dipole of the atom group around the specified center.
Definition: colvaratoms.cpp:1185
void apply_translation(cvm::rvector const &t)
Move all positions.
Definition: colvaratoms.cpp:1089
bool b_user_defined_fit
Indicates that the user has explicitly set centerToReference or rotateReference, and the correspondin...
Definition: colvaratoms.h:339
rotation_derivative< cvm::atom, cvm::atom_pos > * rot_deriv
Rotation derivative;.
Definition: colvaratoms.h:334
int set_dummy_pos(cvm::atom_pos const &pos)
If this group is dummy, set the corresponding position.
Definition: colvaratoms.cpp:210
int calc_center_of_mass()
Calculate the center of mass of the atomic positions, assuming that they are already pbc-wrapped.
Definition: colvaratoms.cpp:1165
cvm::atom_pos ref_pos_cog
Center of geometry of the reference coordinates; regardless of whether f_ag_center is true,...
Definition: colvaratoms.h:347
~atom_group() override
Destructor.
Definition: colvaratoms.cpp:111
cvm::atom_pos center_of_geometry() const
Return the center of geometry of the atomic positions.
Definition: colvaratoms.h:429
std::vector< cvm::atom_pos > fit_gradients
Derivatives of the fitting transformation.
Definition: colvaratoms.h:511
void center_ref_pos()
Save aside the center of geometry of the reference positions, then subtract it from them.
Definition: colvaratoms.cpp:984
std::vector< cvm::atom > atoms
Array of atom objects.
Definition: colvaratoms.h:242
cvm::atom_pos center_of_mass() const
Return the center of mass (COM) of the atomic positions.
Definition: colvaratoms.h:451
bool b_dummy
If this option is on, this group merely acts as a wrapper for a fixed position; any calls to atoms wi...
Definition: colvaratoms.h:300
cvm::rvector dip
Dipole moment of the atom group.
Definition: colvaratoms.h:475
void apply_colvar_force(cvm::real const &force)
Used by a (scalar) colvar to apply its force on its atom_group members.
Definition: colvaratoms.cpp:1390
cvm::rotation rot
The rotation calculated automatically if f_ag_rotate is defined.
Definition: colvaratoms.h:331
cvm::atom_pos dummy_atom_pos
Dummy atom position.
Definition: colvaratoms.h:255
cvm::rvector total_force() const
Return a copy of the aggregated total force on the group.
Definition: colvaratoms.cpp:1371
int calc_center_of_geometry()
Calculate the center of geometry of the atomic positions, assuming that they are already pbc-wrapped.
Definition: colvaratoms.cpp:1150
int create_sorted_ids()
Allocates and populates sorted_ids and sorted_ids_map.
Definition: colvaratoms.cpp:936
cvm::atom_pos cog
Center of geometry.
Definition: colvaratoms.h:421
std::vector< int > atoms_ids
Internal atom IDs for host code.
Definition: colvaratoms.h:245
atom_group * fitting_group
If f_ag_center or f_ag_rotate is true, use this group to define the transformation (default: this gro...
Definition: colvaratoms.h:351
int set_dummy()
Set this group as a dummy group (no actual atoms)
Definition: colvaratoms.cpp:198
void set_weighted_gradient(cvm::rvector const &grad)
Shorthand: save the specified gradient on each atom, weighting with the atom mass (mostly used in com...
Definition: colvaratoms.cpp:1199
int setup()
Update data required to calculate cvc's.
Definition: colvaratoms.cpp:311
std::vector< cvm::rvector > velocities() const
Return a copy of the current atom velocities.
Definition: colvaratoms.cpp:1327
static int overlap(const atom_group &g1, const atom_group &g2)
Definition: colvaratoms.cpp:972
const std::vector< feature * > & features() const override
Implementation of the feature list accessor for atom group.
Definition: colvaratoms.h:227
void calc_fit_gradients_impl()
Actual implementation of calc_fit_gradients. The template is used to avoid branching inside the loops...
Definition: colvaratoms.cpp:1235
void do_feature_side_effects(int id) override
Definition: colvaratoms.cpp:922
void read_velocities()
Get the current velocities; this must be called always after read_positions(); if f_ag_rotate is defi...
Definition: colvaratoms.cpp:1107
Stores numeric id, mass and all mutable data for an atom, mostly used by a colvar::cvc.
Definition: colvaratoms.h:31
int id
Identifier for the MD program (0-based)
Definition: colvaratoms.h:41
void apply_force(cvm::rvector const &new_force) const
Apply a force to the atom.
Definition: colvaratoms.h:147
cvm::rvector grad
Gradient of a scalar collective variable with respect to this atom.
Definition: colvaratoms.h:71
void read_velocity()
Get the current velocity.
Definition: colvaratoms.h:127
void update_charge()
Get the latest value of the charge.
Definition: colvaratoms.h:114
int index
Index in the colvarproxy arrays (NOT in the global topology!)
Definition: colvaratoms.h:36
void reset_data()
Set mutable data (everything except id and mass) to zero.
Definition: colvaratoms.h:100
~atom()
Destructor.
Definition: colvaratoms.cpp:70
cvm::real charge
Charge.
Definition: colvaratoms.h:47
atom & operator=(atom const &a)
Assignment operator (added to appease LGTM)
Definition: colvaratoms.cpp:78
cvm::rvector total_force
System force at the previous step (copied from the program, can be modified if necessary)
Definition: colvaratoms.h:59
void read_position()
Get the current position.
Definition: colvaratoms.h:121
void read_total_force()
Get the total force.
Definition: colvaratoms.h:133
cvm::real mass
Mass.
Definition: colvaratoms.h:44
cvm::rvector vel
Current velocity (copied from the program, can be modified if necessary)
Definition: colvaratoms.h:55
cvm::atom_pos pos
Current position (copied from the program, can be modified if necessary)
Definition: colvaratoms.h:51
atom()
Default constructor (sets index and id both to -1)
Definition: colvaratoms.cpp:24
void update_mass()
Get the latest value of the mass.
Definition: colvaratoms.h:107
A rotation between two sets of coordinates (for the moment a wrapper for colvarmodule::quaternion)
Definition: colvartypes.h:1314
vector of real numbers with three components
Definition: colvartypes.h:727
rvector atom_pos
Atom position (different type name from rvector, to make possible future PBC-transparent implementati...
Definition: colvarmodule.h:197
double real
Defining an abstract real number allows to switch precision.
Definition: colvarmodule.h:95
int residue_id
Residue identifier.
Definition: colvarmodule.h:193
colvarparse * parse
Configuration file parser object.
Definition: colvarmodule.h:794
static colvarproxy * proxy
Pointer to the proxy object, used to retrieve atomic data from the hosting program; it is static in o...
Definition: colvarmodule.h:860
Base class containing parsing functions; all objects which need to parse input inherit from this.
Definition: colvarparse.h:27
cvm::real get_atom_mass(int index) const
Definition: colvarproxy.h:89
cvm::real get_atom_charge(int index) const
Definition: colvarproxy.h:103
Definition: colvarproxy.h:573
Collective variables main module.
Parsing functions for collective variables.
Helper class for calculating the derivative of rotation.
Definition: colvar_rotation_derivative.h:49