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,
bool silent =
false);
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()
311 bool m_has_fitting_force;
312 void apply_force_with_fitting_group();
317 inline cvm::atom & operator [] (
size_t const i)
322 inline cvm::atom const & operator [] (
size_t const i)
const
327 inline cvm::atom_iter begin()
329 return atoms.begin();
332 inline cvm::atom_const_iter begin()
const
334 return atoms.begin();
337 inline cvm::atom_iter end()
342 inline cvm::atom_const_iter end()
const
347 inline size_t size()
const
358 inline std::vector<int>
const &
ids()
const
363 std::string
const print_atom_ids()
const;
430 void setup_rotation_derivative();
457 for (cvm::atom_iter ai =
atoms.begin(); ai !=
atoms.end(); ai++)
467 std::vector<cvm::atom_pos>
positions()
const;
587 template <
bool B_ag_center,
bool B_ag_rotate,
588 typename main_force_accessor_T,
typename fitting_force_accessor_T>
590 main_force_accessor_T accessor_main,
591 fitting_force_accessor_T accessor_fitting)
const;
608 template <
typename main_force_accessor_T,
typename fitting_force_accessor_T>
610 main_force_accessor_T accessor_main,
611 fitting_force_accessor_T accessor_fitting)
const;
Parent class for a member object of a bias, cv or cvc etc. containing features and their dependencies...
Definition: colvardeps.h:34
A helper class for applying forces on an atom group in a way that is aware of the fitting group....
Definition: colvaratoms.h:273
void add_atom_force(size_t i, const cvm::rvector &force)
Apply force to atom i.
Definition: colvaratoms.cpp:1517
~group_force_object()
Destructor of group_force_object.
Definition: colvaratoms.cpp:1511
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:1001
int remove_atom(cvm::atom_iter ai)
Remove an atom object from this group.
Definition: colvaratoms.cpp:177
std::vector< cvm::rvector > group_forces
The temporary forces acting on the main group atoms. Currently this is only used for calculating the ...
Definition: colvaratoms.h:263
cvm::atom_pos cog_orig
Center of geometry before any fitting.
Definition: colvaratoms.h:479
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:1224
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:504
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:1339
cvm::rvector center_of_mass_scalar_gradient() const
Return previously gradient of scalar variable with respect to the COM.
Definition: colvaratoms.h:516
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:1140
cvm::atom_pos com
Center of mass.
Definition: colvaratoms.h:499
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:455
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
void calc_fit_forces_impl(main_force_accessor_T accessor_main, fitting_force_accessor_T accessor_fitting) const
Actual implementation of calc_fit_gradients and calc_fit_forces. The template is used to avoid branch...
Definition: colvaratoms.cpp:1251
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:422
int calc_required_properties()
Recompute all mutable quantities that are required to compute CVCs.
Definition: colvaratoms.cpp:1014
void calc_fit_forces(main_force_accessor_T accessor_main, fitting_force_accessor_T accessor_fitting) const
Calculate or apply the fitting group forces from the main group forces.
Definition: colvaratoms.cpp:1304
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:397
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:415
std::vector< int > const & sorted_ids_map() const
Map entries of sorted_atoms_ids onto the original positions in the group.
Definition: colvaratoms.h:376
std::vector< int > const & sorted_ids() const
Definition: colvaratoms.h:370
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:1469
void calc_apply_roto_translation()
(Re)calculate the optimal roto-translation
Definition: colvaratoms.cpp:1043
std::vector< cvm::atom_pos > pos_unrotated
Unrotated atom positions for fit gradients.
Definition: colvaratoms.h:482
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:358
std::vector< cvm::rvector > total_forces() const
Return a copy of the total forces.
Definition: colvaratoms.cpp:1381
cvm::rvector dipole() const
Return the (previously calculated) dipole of the atom group.
Definition: colvaratoms.h:538
cvm::real total_mass
Total mass of the atom group.
Definition: colvaratoms.h:409
std::vector< cvm::atom_pos > positions() const
Return a copy of the current atom positions.
Definition: colvaratoms.cpp:1318
int calc_dipole(cvm::atom_pos const &dipole_center)
Calculate the dipole of the atom group around the specified center.
Definition: colvaratoms.cpp:1196
void apply_translation(cvm::rvector const &t)
Move all positions.
Definition: colvaratoms.cpp:1100
bool b_user_defined_fit
Indicates that the user has explicitly set centerToReference or rotateReference, and the correspondin...
Definition: colvaratoms.h:394
rotation_derivative< cvm::atom, cvm::atom_pos > * rot_deriv
Rotation derivative;.
Definition: colvaratoms.h:389
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:1176
cvm::atom_pos ref_pos_cog
Center of geometry of the reference coordinates; regardless of whether f_ag_center is true,...
Definition: colvaratoms.h:402
~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:487
std::vector< cvm::atom_pos > fit_gradients
Derivatives of the fitting transformation.
Definition: colvaratoms.h:614
void center_ref_pos()
Save aside the center of geometry of the reference positions, then subtract it from them.
Definition: colvaratoms.cpp:987
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:509
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:355
cvm::rvector dip
Dipole moment of the atom group.
Definition: colvaratoms.h:533
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:1423
cvm::rotation rot
The rotation calculated automatically if f_ag_rotate is defined.
Definition: colvaratoms.h:386
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:1404
int calc_center_of_geometry()
Calculate the center of geometry of the atomic positions, assuming that they are already pbc-wrapped.
Definition: colvaratoms.cpp:1161
int create_sorted_ids()
Allocates and populates sorted_ids and sorted_ids_map.
Definition: colvaratoms.cpp:939
cvm::atom_pos cog
Center of geometry.
Definition: colvaratoms.h:476
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:406
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:1210
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:1360
static int overlap(const atom_group &g1, const atom_group &g2)
Definition: colvaratoms.cpp:975
const std::vector< feature * > & features() const override
Implementation of the feature list accessor for atom group.
Definition: colvaratoms.h:227
void do_feature_side_effects(int id) override
Definition: colvaratoms.cpp:925
void read_velocities()
Get the current velocities; this must be called always after read_positions(); if f_ag_rotate is defi...
Definition: colvaratoms.cpp:1118
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:1363
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:90
cvm::real get_atom_charge(int index) const
Definition: colvarproxy.h:104
Definition: colvarproxy.h:542
Collective variables main module.
Parsing functions for collective variables.
Helper class for calculating the derivative of rotation.
Definition: colvar_rotation_derivative.h:59