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

colvar_grid Class Template Reference

\brief Grid of values of a function of several collective variables
Parameters:
T  The data type Only scalar colvars supported so far: vector colvars are treated as arrays.
More...

#include <colvargrid.h>

Inheritance diagram for colvar_grid:

colvarparse colvarparams List of all members.

Public Methods

size_t num_variables () const
 Return the number of colvar objects. More...

std::vector< int > const & number_of_points_vec () const
 Return the numbers of points in all dimensions. More...

size_t number_of_points (int const icv=-1) const
 Return the number of points in the i-th direction, if provided, or the total number. More...

std::vector< int > const & sizes () const
 Get the sizes in each direction. More...

void set_sizes (std::vector< int > const &new_sizes)
 Set the sizes in each direction. More...

size_t multiplicity () const
 Return the multiplicity of the type used. More...

void request_actual_value (bool b=true)
 \brief Request grid to use actual values of extended coords. More...

int setup (std::vector< int > const &nx_i, T const &t=T(), size_t const &mult_i=1)
 \brief Allocate data. More...

int setup ()
 \brief Allocate data (allow initialization also after construction). More...

void reset (T const &t=T())
 \brief Reset data (in case the grid is being reused). More...

 colvar_grid ()
 Default constructor. More...

virtual ~colvar_grid ()
 Destructor. More...

 colvar_grid (colvar_grid< T > const &g)
 \brief "Almost copy-constructor": only copies configuration parameters from another grid, but doesn't reallocate stuff; setup() must be called after that;. More...

 colvar_grid (std::vector< int > const &nx_i, T const &t=T(), size_t mult_i=1)
 \brief Constructor from explicit grid sizes
Parameters:
nx_i  Number of grid points along each dimension
t  Initial value for the function at each point (optional)
mult_i  Multiplicity of each value.
More...


 colvar_grid (std::vector< colvar * > const &colvars, T const &t=T(), size_t mult_i=1, bool add_extra_bin=false)
 \brief Constructor from a vector of colvars
Parameters:
add_extra_bin  requests that non-periodic dimensions are extended by 1 bin to accommodate the integral (PMF) of another gridded quantity (gradient).
More...


int init_from_colvars (std::vector< colvar * > const &colvars, size_t mult_i=1, bool add_extra_bin=false)
int init_from_boundaries ()
void wrap (std::vector< int > &ix) const
 Wrap an index vector around periodic boundary conditions also checks validity of non-periodic indices. More...

bool wrap_edge (std::vector< int > &ix) const
 Wrap an index vector around periodic boundary conditions or detects edges if non-periodic. More...

int current_bin_scalar (int const i) const
 \brief Report the bin corresponding to the current value of variable i. More...

int current_bin_scalar_bound (int const i) const
 \brief Report the bin corresponding to the current value of variable i and assign first or last bin if out of boundaries. More...

int current_bin_scalar (int const i, int const iv) const
 \brief Report the bin corresponding to the current value of item iv in variable i. More...

int value_to_bin_scalar (colvarvalue const &value, const int i) const
 \brief Use the lower boundary and the width to report which bin the provided value is in. More...

cvm::real current_bin_scalar_fraction (int const i) const
 \brief Report the fraction of bin beyond current_bin_scalar(). More...

cvm::real value_to_bin_scalar_fraction (colvarvalue const &value, const int i) const
 \brief Use the lower boundary and the width to report the fraction of bin beyond value_to_bin_scalar() that the provided value is in. More...

int value_to_bin_scalar_bound (colvarvalue const &value, const int i) const
 \brief Use the lower boundary and the width to report which bin the provided value is in and assign first or last bin if out of boundaries. More...

int value_to_bin_scalar (colvarvalue const &value, colvarvalue const &new_offset, cvm::real const &new_width) const
 \brief Same as the standard version, but uses another grid definition. More...

colvarvalue bin_to_value_scalar (int const &i_bin, int const i) const
 \brief Use the two boundaries and the width to report the central value corresponding to a bin index. More...

colvarvalue bin_to_value_scalar (int const &i_bin, colvarvalue const &new_offset, cvm::real const &new_width) const
 \brief Same as the standard version, but uses different parameters. More...

void set_value (std::vector< int > const &ix, T const &t, size_t const &imult=0)
 Set the value at the point with index ix. More...

void set_value (size_t i, T const &t)
 Set the value at the point with linear address i (for speed). More...

void delta_grid (colvar_grid< T > const &other_grid)
 \brief Get the change from this to other_grid and store the result in this. this_grid := other_grid - this_grid Grids must have the same dimensions. More...

void copy_grid (colvar_grid< T > const &other_grid)
 \brief Copy data from another grid of the same type, AND identical definition (boundaries, widths) Added for shared ABF. More...

void raw_data_out (T *out_data) const
 \brief Extract the grid data as they are represented in memory. Put the results in "out_data". More...

void raw_data_out (std::vector< T > &out_data) const
void raw_data_in (const T *in_data)
 \brief Input the data as they are represented in memory. More...

void raw_data_in (const std::vector< T > &in_data)
size_t raw_data_num () const
 \brief Size of the data as they are represented in memory. More...

T const & value (std::vector< int > const &ix, size_t const &imult=0) const
 \brief Get the binned value indexed by ix, or the first of them if the multiplicity is larger than 1. More...

T const & value (size_t i) const
 \brief Get the binned value indexed by linear address i. More...

void add_constant (T const &t)
 \brief Add a constant to all elements (fast loop). More...

void multiply_constant (cvm::real const &a)
 \brief Multiply all elements by a scalar constant (fast loop). More...

void remove_small_values (cvm::real const &a)
 \brief Assign values that are smaller than scalar constant the latter value (fast loop). More...

std::vector< int > const get_colvars_index (std::vector< colvarvalue > const &values) const
 \brief Get the bin indices corresponding to the provided values of the colvars. More...

std::vector< int > const get_colvars_index () const
 \brief Get the bin indices corresponding to the current values of the colvars. More...

std::vector< int > const get_colvars_index_bound () const
 \brief Get the bin indices corresponding to the provided values of the colvars and assign first or last bin if out of boundaries. More...

cvm::real bin_distance_from_boundaries (std::vector< colvarvalue > const &values, bool skip_hard_boundaries=false)
 \brief Get the minimal distance (in number of bins) from the boundaries; a negative number is returned if the given point is off-grid. More...

void map_grid (colvar_grid< T > const &other_grid)
 \brief Add data from another grid of the same type Note: this function maps other_grid inside this one regardless of whether it fits or not. More...

void add_grid (colvar_grid< T > const &other_grid, cvm::real scale_factor=1.0)
 \brief Add data from another grid of the same type, AND identical definition (boundaries, widths). More...

virtual T value_output (std::vector< int > const &ix, size_t const &imult=0) const
 \brief Return the value suitable for output purposes (so that it may be rescaled or manipulated without changing it permanently). More...

virtual void value_input (std::vector< int > const &ix, T const &t, size_t const &imult=0, bool add=false)
 \brief Get the value from a formatted output and transform it into the internal representation (the two may be different, e.g. when using colvar_grid_count). More...

std::vector< int > const new_index () const
 \brief Get the index corresponding to the "first" bin, to be used as the initial value for an index in looping. More...

bool index_ok (std::vector< int > const &ix) const
 \brief Check that the index is within range in each of the dimensions. More...

void incr (std::vector< int > &ix) const
 \brief Increment the index, in a way that will make it loop over the whole nd-dimensional array. More...

std::ostream & write_params (std::ostream &os)
 Write the grid parameters (number of colvars, boundaries, width and number of points). More...

int parse_params (std::string const &conf, colvarparse::Parse_Mode const parse_mode=colvarparse::parse_normal)
 Read a grid definition from a config string. More...

void check_consistency ()
 \brief Check that the grid information inside (boundaries, widths, ...) is consistent with the current setting of the colvars. More...

void check_consistency (colvar_grid< T > const &other_grid)
 \brief Check that the grid information inside (boundaries, widths, ...) is consistent with that of another grid. More...

std::istream & read_restart (std::istream &is)
 \brief Read grid entry in restart file. More...

std::ostream & write_restart (std::ostream &os)
 \brief Write grid entry in restart file. More...

std::ostream & write_raw (std::ostream &os, size_t const buf_size=3) const
 \brief Write the grid data without labels, as they are represented in memory
Parameters:
buf_size  Number of values per line.
More...


std::istream & read_raw (std::istream &is)
 \brief Read data written by colvar_grid::write_raw(). More...

std::istream & read_multicol (std::istream &is, bool add=false)
 Read a grid written by write_multicol(), incrementing if add is true. More...

int read_multicol (std::string const &filename, std::string description="grid file", bool add=false)
 Read a grid written by write_multicol(), incrementing if add is true. More...

std::ostream & write_multicol (std::ostream &os) const
 Write grid in a format which is both human-readable and gnuplot-friendly. More...

int write_multicol (std::string const &filename, std::string description="grid file") const
 Write grid in a format which is both human-readable and gnuplot-friendly. More...

std::ostream & write_opendx (std::ostream &os) const
 Write the grid data without labels, as they are represented in memory. More...

int write_opendx (std::string const &filename, std::string description="grid file") const
 Write the grid data without labels, as they are represented in memory. More...


Public Attributes

std::vector< colvarvaluelower_boundaries
 Lower boundaries of the colvars in this grid. More...

std::vector< colvarvalueupper_boundaries
 Upper boundaries of the colvars in this grid. More...

std::vector< bool > periodic
 Whether some colvars are periodic. More...

std::vector< bool > hard_lower_boundaries
 Whether some colvars have hard lower boundaries. More...

std::vector< bool > hard_upper_boundaries
 Whether some colvars have hard upper boundaries. More...

std::vector< cvm::realwidths
 Widths of the colvars in this grid. More...

bool has_parent_data
 True if this is a count grid related to another grid of data. More...

bool has_data
 Whether this grid has been filled with data or is still empty. More...


Protected Methods

size_t address (std::vector< int > const &ix) const
 Get the low-level index corresponding to an index. More...


Protected Attributes

size_t nd
 Number of dimensions. More...

std::vector< int > nx
 Number of points along each dimension. More...

std::vector< int > nxc
 Cumulative number of points along each dimension. More...

size_t mult
 \brief Multiplicity of each datum (allow the binning of non-scalar types such as atomic gradients). More...

size_t nt
 Total number of grid points. More...

std::vector< T > data
 Low-level array of values. More...

std::vector< size_t > new_data
 Newly read data (used for count grids, when adding several grids read from disk). More...

std::vector< colvar * > cv
 Colvars collected in this grid. More...

std::vector< bool > use_actual_value
 Do we request actual value (for extended-system colvars)? More...


Detailed Description

template<class T>
class colvar_grid< T >

\brief Grid of values of a function of several collective variables
Parameters:
T  The data type Only scalar colvars supported so far: vector colvars are treated as arrays.

Definition at line 25 of file colvargrid.h.


Constructor & Destructor Documentation

template<class T>
colvar_grid< T >::colvar_grid   [inline]
 

Default constructor.

Definition at line 204 of file colvargrid.h.

template<class T>
virtual colvar_grid< T >::~colvar_grid   [inline, virtual]
 

Destructor.

Definition at line 213 of file colvargrid.h.

template<class T>
colvar_grid< T >::colvar_grid colvar_grid< T > const &    g [inline]
 

\brief "Almost copy-constructor": only copies configuration parameters from another grid, but doesn't reallocate stuff; setup() must be called after that;.

Definition at line 219 of file colvargrid.h.

template<class T>
colvar_grid< T >::colvar_grid std::vector< int > const &    nx_i,
T const &    t = T(),
size_t    mult_i = 1
[inline]
 

\brief Constructor from explicit grid sizes

Parameters:
nx_i  Number of grid points along each dimension
t  Initial value for the function at each point (optional)
mult_i  Multiplicity of each value.

Definition at line 240 of file colvargrid.h.

template<class T>
colvar_grid< T >::colvar_grid std::vector< colvar * > const &    colvars,
T const &    t = T(),
size_t    mult_i = 1,
bool    add_extra_bin = false
[inline]
 

\brief Constructor from a vector of colvars

Parameters:
add_extra_bin  requests that non-periodic dimensions are extended by 1 bin to accommodate the integral (PMF) of another gridded quantity (gradient).

Definition at line 251 of file colvargrid.h.


Member Function Documentation

template<class T>
void colvar_grid< T >::add_constant T const &    t [inline]
 

\brief Add a constant to all elements (fast loop).

Definition at line 582 of file colvargrid.h.

template<class T>
void colvar_grid< T >::add_grid colvar_grid< T > const &    other_grid,
cvm::real    scale_factor = 1.0
[inline]
 

\brief Add data from another grid of the same type, AND identical definition (boundaries, widths).

Definition at line 713 of file colvargrid.h.

template<class T>
size_t colvar_grid< T >::address std::vector< int > const &    ix const [inline, protected]
 

Get the low-level index corresponding to an index.

Definition at line 58 of file colvargrid.h.

Referenced by colvar_grid< size_t >::set_value, colvar_grid< size_t >::value, and colvar_grid< size_t >::value_input.

template<class T>
cvm::real colvar_grid< T >::bin_distance_from_boundaries std::vector< colvarvalue > const &    values,
bool    skip_hard_boundaries = false
[inline]
 

\brief Get the minimal distance (in number of bins) from the boundaries; a negative number is returned if the given point is off-grid.

Definition at line 640 of file colvargrid.h.

template<class T>
colvarvalue colvar_grid< T >::bin_to_value_scalar int const &    i_bin,
colvarvalue const &    new_offset,
cvm::real const &    new_width
const [inline]
 

\brief Same as the standard version, but uses different parameters.

Definition at line 471 of file colvargrid.h.

template<class T>
colvarvalue colvar_grid< T >::bin_to_value_scalar int const &    i_bin,
int const    i
const [inline]
 

\brief Use the two boundaries and the width to report the central value corresponding to a bin index.

Definition at line 465 of file colvargrid.h.

Referenced by colvar_grid< size_t >::map_grid, and write_multicol.

template<class T>
void colvar_grid< T >::check_consistency colvar_grid< T > const &    other_grid [inline]
 

\brief Check that the grid information inside (boundaries, widths, ...) is consistent with that of another grid.

Definition at line 932 of file colvargrid.h.

template<class T>
void colvar_grid< T >::check_consistency   [inline]
 

\brief Check that the grid information inside (boundaries, widths, ...) is consistent with the current setting of the colvars.

Definition at line 913 of file colvargrid.h.

template<class T>
void colvar_grid< T >::copy_grid colvar_grid< T > const &    other_grid [inline]
 

\brief Copy data from another grid of the same type, AND identical definition (boundaries, widths) Added for shared ABF.

Definition at line 521 of file colvargrid.h.

template<class T>
int colvar_grid< T >::current_bin_scalar int const    i,
int const    iv
const [inline]
 

\brief Report the bin corresponding to the current value of item iv in variable i.

Definition at line 417 of file colvargrid.h.

template<class T>
int colvar_grid< T >::current_bin_scalar int const    i const [inline]
 

\brief Report the bin corresponding to the current value of variable i.

Definition at line 404 of file colvargrid.h.

Referenced by colvar_grid< size_t >::get_colvars_index.

template<class T>
int colvar_grid< T >::current_bin_scalar_bound int const    i const [inline]
 

\brief Report the bin corresponding to the current value of variable i and assign first or last bin if out of boundaries.

Definition at line 411 of file colvargrid.h.

Referenced by colvar_grid< size_t >::get_colvars_index_bound.

template<class T>
cvm::real colvar_grid< T >::current_bin_scalar_fraction int const    i const [inline]
 

\brief Report the fraction of bin beyond current_bin_scalar().

Definition at line 432 of file colvargrid.h.

template<class T>
void colvar_grid< T >::delta_grid colvar_grid< T > const &    other_grid [inline]
 

\brief Get the change from this to other_grid and store the result in this. this_grid := other_grid - this_grid Grids must have the same dimensions.

Definition at line 497 of file colvargrid.h.

template<class T>
std::vector<int> const colvar_grid< T >::get_colvars_index   const [inline]
 

\brief Get the bin indices corresponding to the current values of the colvars.

Definition at line 617 of file colvargrid.h.

template<class T>
std::vector<int> const colvar_grid< T >::get_colvars_index std::vector< colvarvalue > const &    values const [inline]
 

\brief Get the bin indices corresponding to the provided values of the colvars.

Definition at line 606 of file colvargrid.h.

template<class T>
std::vector<int> const colvar_grid< T >::get_colvars_index_bound   const [inline]
 

\brief Get the bin indices corresponding to the provided values of the colvars and assign first or last bin if out of boundaries.

Definition at line 628 of file colvargrid.h.

template<class T>
void colvar_grid< T >::incr std::vector< int > &    ix const [inline]
 

\brief Increment the index, in a way that will make it loop over the whole nd-dimensional array.

Definition at line 782 of file colvargrid.h.

Referenced by colvar_grid< size_t >::map_grid, read_multicol, colvar_grid< size_t >::read_raw, write_multicol, and colvar_grid< size_t >::write_raw.

template<class T>
bool colvar_grid< T >::index_ok std::vector< int > const &    ix const [inline]
 

\brief Check that the index is within range in each of the dimensions.

Definition at line 771 of file colvargrid.h.

Referenced by colvar_grid< size_t >::map_grid, read_multicol, colvar_grid< size_t >::read_raw, write_multicol, and colvar_grid< size_t >::write_raw.

template<class T>
int colvar_grid< T >::init_from_boundaries   [inline]
 

Definition at line 331 of file colvargrid.h.

Referenced by colvar_grid< size_t >::init_from_colvars, and colvar_grid< size_t >::parse_params.

template<class T>
int colvar_grid< T >::init_from_colvars std::vector< colvar * > const &    colvars,
size_t    mult_i = 1,
bool    add_extra_bin = false
[inline]
 

Definition at line 261 of file colvargrid.h.

Referenced by colvar_grid< size_t >::colvar_grid.

template<class T>
void colvar_grid< T >::map_grid colvar_grid< T > const &    other_grid [inline]
 

\brief Add data from another grid of the same type Note: this function maps other_grid inside this one regardless of whether it fits or not.

Definition at line 670 of file colvargrid.h.

template<class T>
size_t colvar_grid< T >::multiplicity   const [inline]
 

Return the multiplicity of the type used.

Definition at line 135 of file colvargrid.h.

Referenced by colvar_grid< size_t >::add_grid, colvar_grid< size_t >::copy_grid, colvar_grid< size_t >::delta_grid, and colvar_grid< size_t >::map_grid.

template<class T>
void colvar_grid< T >::multiply_constant cvm::real const &    a [inline]
 

\brief Multiply all elements by a scalar constant (fast loop).

Definition at line 590 of file colvargrid.h.

template<class T>
std::vector<int> const colvar_grid< T >::new_index   const [inline]
 

\brief Get the index corresponding to the "first" bin, to be used as the initial value for an index in looping.

Definition at line 764 of file colvargrid.h.

Referenced by colvar_grid< size_t >::get_colvars_index, colvar_grid< size_t >::get_colvars_index_bound, colvar_grid< size_t >::map_grid, read_multicol, colvar_grid< size_t >::read_raw, write_multicol, and colvar_grid< size_t >::write_raw.

template<class T>
size_t colvar_grid< T >::num_variables   const [inline]
 

Return the number of colvar objects.

Definition at line 100 of file colvargrid.h.

Referenced by write_opendx.

template<class T>
size_t colvar_grid< T >::number_of_points int const    icv = -1 const [inline]
 

Return the number of points in the i-th direction, if provided, or the total number.

Definition at line 113 of file colvargrid.h.

Referenced by write_opendx.

template<class T>
std::vector<int> const& colvar_grid< T >::number_of_points_vec   const [inline]
 

Return the numbers of points in all dimensions.

Definition at line 106 of file colvargrid.h.

template<class T>
int colvar_grid< T >::parse_params std::string const &    conf,
colvarparse::Parse_Mode const    parse_mode = colvarparse::parse_normal
[inline]
 

Read a grid definition from a config string.

Definition at line 837 of file colvargrid.h.

Referenced by colvar_grid< size_t >::read_restart.

template<class T>
void colvar_grid< T >::raw_data_in const std::vector< T > &    in_data [inline]
 

Definition at line 558 of file colvargrid.h.

template<class T>
void colvar_grid< T >::raw_data_in const T *    in_data [inline]
 

\brief Input the data as they are represented in memory.

Definition at line 553 of file colvargrid.h.

template<class T>
size_t colvar_grid< T >::raw_data_num   const [inline]
 

\brief Size of the data as they are represented in memory.

Definition at line 564 of file colvargrid.h.

template<class T>
void colvar_grid< T >::raw_data_out std::vector< T > &    out_data const [inline]
 

Definition at line 548 of file colvargrid.h.

template<class T>
void colvar_grid< T >::raw_data_out T *    out_data const [inline]
 

\brief Extract the grid data as they are represented in memory. Put the results in "out_data".

Definition at line 544 of file colvargrid.h.

template<class T>
int colvar_grid< T >::read_multicol std::string const &    filename,
std::string    description = "grid file",
bool    add = false
 

Read a grid written by write_multicol(), incrementing if add is true.

Reimplemented in colvar_grid_count.

Definition at line 124 of file colvargrid_def.h.

References colvarproxy_io::close_input_stream, COLVARS_FILE_ERROR, colvarproxy_io::input_stream, colvarmodule::main, colvarmodule::proxy, and read_multicol.

template<class T>
std::istream & colvar_grid< T >::read_multicol std::istream &    is,
bool    add = false
 

Read a grid written by write_multicol(), incrementing if add is true.

Reimplemented in colvar_grid_count.

Definition at line 25 of file colvargrid_def.h.

References bin, COLVARS_INPUT_ERROR, cv, data, colvarmodule::error, colvarmodule::fabs, has_data, has_parent_data, incr, index_ok, colvarmodule::log, lower_boundaries, mult, n, nd, new_data, new_index, nx, value_input, value_to_bin_scalar, and widths.

Referenced by read_multicol, colvar_grid_gradient::read_multicol, colvar_grid_scalar::read_multicol, and colvar_grid_count::read_multicol.

template<class T>
std::istream& colvar_grid< T >::read_raw std::istream &    is [inline]
 

\brief Read data written by colvar_grid::write_raw().

Definition at line 1008 of file colvargrid.h.

Referenced by colvar_grid< size_t >::read_restart.

template<class T>
std::istream& colvar_grid< T >::read_restart std::istream &    is [inline]
 

\brief Read grid entry in restart file.

Definition at line 955 of file colvargrid.h.

template<class T>
void colvar_grid< T >::remove_small_values cvm::real const &    a [inline]
 

\brief Assign values that are smaller than scalar constant the latter value (fast loop).

Definition at line 597 of file colvargrid.h.

template<class T>
void colvar_grid< T >::request_actual_value bool    b = true [inline]
 

\brief Request grid to use actual values of extended coords.

Definition at line 141 of file colvargrid.h.

template<class T>
void colvar_grid< T >::reset T const &    t = T() [inline]
 

\brief Reset data (in case the grid is being reused).

Definition at line 197 of file colvargrid.h.

template<class T>
void colvar_grid< T >::set_sizes std::vector< int > const &    new_sizes [inline]
 

Set the sizes in each direction.

Definition at line 129 of file colvargrid.h.

template<class T>
void colvar_grid< T >::set_value size_t    i,
T const &    t
[inline]
 

Set the value at the point with linear address i (for speed).

Definition at line 488 of file colvargrid.h.

template<class T>
void colvar_grid< T >::set_value std::vector< int > const &    ix,
T const &    t,
size_t const &    imult = 0
[inline]
 

Set the value at the point with index ix.

Definition at line 479 of file colvargrid.h.

Referenced by colvar_grid< size_t >::map_grid.

template<class T>
int colvar_grid< T >::setup   [inline]
 

\brief Allocate data (allow initialization also after construction).

Definition at line 191 of file colvargrid.h.

Referenced by colvar_grid< size_t >::colvar_grid, colvar_grid< size_t >::init_from_colvars, colvar_grid< size_t >::parse_params, and colvar_grid< size_t >::setup.

template<class T>
int colvar_grid< T >::setup std::vector< int > const &    nx_i,
T const &    t = T(),
size_t const &    mult_i = 1
[inline]
 

\brief Allocate data.

Definition at line 150 of file colvargrid.h.

template<class T>
std::vector<int> const& colvar_grid< T >::sizes   const [inline]
 

Get the sizes in each direction.

Definition at line 123 of file colvargrid.h.

template<class T>
T const& colvar_grid< T >::value size_t    i const [inline]
 

\brief Get the binned value indexed by linear address i.

Definition at line 576 of file colvargrid.h.

template<class T>
T const& colvar_grid< T >::value std::vector< int > const &    ix,
size_t const &    imult = 0
const [inline]
 

\brief Get the binned value indexed by ix, or the first of them if the multiplicity is larger than 1.

Definition at line 569 of file colvargrid.h.

Referenced by colvar_grid< size_t >::current_bin_scalar, colvar_grid< size_t >::map_grid, colvar_grid< size_t >::value_output, colvar_grid< size_t >::value_to_bin_scalar, colvar_grid< size_t >::value_to_bin_scalar_bound, and colvar_grid< size_t >::value_to_bin_scalar_fraction.

template<class T>
virtual void colvar_grid< T >::value_input std::vector< int > const &    ix,
T const &    t,
size_t const &    imult = 0,
bool    add = false
[inline, virtual]
 

\brief Get the value from a formatted output and transform it into the internal representation (the two may be different, e.g. when using colvar_grid_count).

Reimplemented in colvar_grid_count.

Definition at line 744 of file colvargrid.h.

Referenced by read_multicol, and colvar_grid< size_t >::read_raw.

template<class T>
virtual T colvar_grid< T >::value_output std::vector< int > const &    ix,
size_t const &    imult = 0
const [inline, virtual]
 

\brief Return the value suitable for output purposes (so that it may be rescaled or manipulated without changing it permanently).

Reimplemented in colvar_grid_scalar.

Definition at line 735 of file colvargrid.h.

Referenced by write_multicol, and colvar_grid< size_t >::write_raw.

template<class T>
int colvar_grid< T >::value_to_bin_scalar colvarvalue const &    value,
colvarvalue const &    new_offset,
cvm::real const &    new_width
const [inline]
 

\brief Same as the standard version, but uses another grid definition.

Definition at line 456 of file colvargrid.h.

template<class T>
int colvar_grid< T >::value_to_bin_scalar colvarvalue const &    value,
const int    i
const [inline]
 

\brief Use the lower boundary and the width to report which bin the provided value is in.

Definition at line 426 of file colvargrid.h.

Referenced by colvar_grid< size_t >::current_bin_scalar, colvar_grid< size_t >::get_colvars_index, colvar_grid< size_t >::map_grid, and read_multicol.

template<class T>
int colvar_grid< T >::value_to_bin_scalar_bound colvarvalue const &    value,
const int    i
const [inline]
 

\brief Use the lower boundary and the width to report which bin the provided value is in and assign first or last bin if out of boundaries.

Definition at line 447 of file colvargrid.h.

Referenced by colvar_grid< size_t >::current_bin_scalar_bound.

template<class T>
cvm::real colvar_grid< T >::value_to_bin_scalar_fraction colvarvalue const &    value,
const int    i
const [inline]
 

\brief Use the lower boundary and the width to report the fraction of bin beyond value_to_bin_scalar() that the provided value is in.

Definition at line 439 of file colvargrid.h.

Referenced by colvar_grid< size_t >::current_bin_scalar_fraction.

template<class T>
void colvar_grid< T >::wrap std::vector< int > &    ix const [inline]
 

Wrap an index vector around periodic boundary conditions also checks validity of non-periodic indices.

Definition at line 373 of file colvargrid.h.

template<class T>
bool colvar_grid< T >::wrap_edge std::vector< int > &    ix const [inline]
 

Wrap an index vector around periodic boundary conditions or detects edges if non-periodic.

Definition at line 390 of file colvargrid.h.

template<class T>
int colvar_grid< T >::write_multicol std::string const &    filename,
std::string    description = "grid file"
const
 

Write grid in a format which is both human-readable and gnuplot-friendly.

Reimplemented in colvar_grid_count.

Definition at line 189 of file colvargrid_def.h.

References colvarproxy_io::close_output_stream, COLVARS_FILE_ERROR, colvarmodule::main, colvarproxy_io::output_stream, colvarmodule::proxy, and write_multicol.

template<class T>
std::ostream & colvar_grid< T >::write_multicol std::ostream &    os const
 

Write grid in a format which is both human-readable and gnuplot-friendly.

Reimplemented in colvar_grid_count.

Definition at line 141 of file colvargrid_def.h.

References bin_to_value_scalar, incr, index_ok, lower_boundaries, mult, nd, new_index, nx, periodic, value_output, and widths.

Referenced by write_multicol, colvar_grid_gradient::write_multicol, colvar_grid_scalar::write_multicol, and colvar_grid_count::write_multicol.

template<class T>
int colvar_grid< T >::write_opendx std::string const &    filename,
std::string    description = "grid file"
const
 

Write the grid data without labels, as they are represented in memory.

Reimplemented in colvar_grid_count.

Definition at line 247 of file colvargrid_def.h.

References colvarproxy_io::close_output_stream, COLVARS_FILE_ERROR, colvarmodule::main, colvarproxy_io::output_stream, colvarmodule::proxy, and write_opendx.

template<class T>
std::ostream & colvar_grid< T >::write_opendx std::ostream &    os const
 

Write the grid data without labels, as they are represented in memory.

Reimplemented in colvar_grid_count.

Definition at line 205 of file colvargrid_def.h.

References lower_boundaries, num_variables, number_of_points, widths, and write_raw.

Referenced by write_opendx, colvar_grid_gradient::write_opendx, colvar_grid_scalar::write_opendx, and colvar_grid_count::write_opendx.

template<class T>
std::ostream& colvar_grid< T >::write_params std::ostream &    os [inline]
 

Write the grid parameters (number of colvars, boundaries, width and number of points).

Definition at line 807 of file colvargrid.h.

Referenced by colvar_grid< size_t >::write_restart.

template<class T>
std::ostream& colvar_grid< T >::write_raw std::ostream &    os,
size_t const    buf_size = 3
const [inline]
 

\brief Write the grid data without labels, as they are represented in memory

Parameters:
buf_size  Number of values per line.

Definition at line 983 of file colvargrid.h.

Referenced by write_opendx, and colvar_grid< size_t >::write_restart.

template<class T>
std::ostream& colvar_grid< T >::write_restart std::ostream &    os [inline]
 

\brief Write grid entry in restart file.

Definition at line 972 of file colvargrid.h.


Member Data Documentation

template<class T>
std::vector<colvar *> colvar_grid::cv [protected]
 

Colvars collected in this grid.

Definition at line 52 of file colvargrid.h.

Referenced by colvar_grid< size_t >::bin_distance_from_boundaries, colvar_grid< size_t >::check_consistency, colvar_grid< size_t >::colvar_grid, colvar_grid< size_t >::current_bin_scalar, colvar_grid< size_t >::current_bin_scalar_bound, colvar_grid< size_t >::current_bin_scalar_fraction, colvar_grid< size_t >::init_from_boundaries, colvar_grid< size_t >::init_from_colvars, colvar_grid< size_t >::parse_params, and read_multicol.

template<class T>
std::vector<T> colvar_grid::data [protected]
 

Low-level array of values.

Definition at line 46 of file colvargrid.h.

Referenced by colvar_grid< size_t >::add_constant, colvar_grid< size_t >::add_grid, colvar_grid< size_t >::check_consistency, colvar_grid< size_t >::colvar_grid, colvar_grid< size_t >::copy_grid, colvar_grid< size_t >::delta_grid, colvar_grid< size_t >::multiply_constant, colvar_grid< size_t >::raw_data_in, colvar_grid< size_t >::raw_data_num, colvar_grid< size_t >::raw_data_out, read_multicol, colvar_grid< size_t >::remove_small_values, colvar_grid< size_t >::reset, colvar_grid< size_t >::set_value, colvar_grid< size_t >::setup, colvar_grid< size_t >::value, and colvar_grid< size_t >::value_input.

template<class T>
std::vector<bool> colvar_grid::hard_lower_boundaries
 

Whether some colvars have hard lower boundaries.

Definition at line 85 of file colvargrid.h.

Referenced by colvar_grid< size_t >::bin_distance_from_boundaries, colvar_grid< size_t >::colvar_grid, and colvar_grid< size_t >::init_from_colvars.

template<class T>
std::vector<bool> colvar_grid::hard_upper_boundaries
 

Whether some colvars have hard upper boundaries.

Definition at line 88 of file colvargrid.h.

Referenced by colvar_grid< size_t >::bin_distance_from_boundaries, colvar_grid< size_t >::colvar_grid, and colvar_grid< size_t >::init_from_colvars.

template<class T>
bool colvar_grid::has_data
 

Whether this grid has been filled with data or is still empty.

Definition at line 97 of file colvargrid.h.

Referenced by colvar_grid< size_t >::add_constant, colvar_grid< size_t >::add_grid, colvar_grid< size_t >::colvar_grid, colvar_grid< size_t >::copy_grid, colvar_grid< size_t >::delta_grid, colvar_grid< size_t >::map_grid, colvar_grid< size_t >::raw_data_in, read_multicol, colvar_grid< size_t >::read_raw, colvar_grid< size_t >::set_value, and colvar_grid< size_t >::value_input.

template<class T>
bool colvar_grid::has_parent_data
 

True if this is a count grid related to another grid of data.

Definition at line 94 of file colvargrid.h.

Referenced by colvar_grid< size_t >::colvar_grid, and read_multicol.

template<class T>
std::vector<colvarvalue> colvar_grid::lower_boundaries
 

Lower boundaries of the colvars in this grid.

Definition at line 76 of file colvargrid.h.

Referenced by colvar_grid< size_t >::bin_distance_from_boundaries, colvar_grid< size_t >::bin_to_value_scalar, colvar_grid< size_t >::check_consistency, colvar_grid< size_t >::colvar_grid, colvar_grid< size_t >::init_from_boundaries, colvar_grid< size_t >::init_from_colvars, colvar_grid< size_t >::map_grid, colvar_grid< size_t >::parse_params, read_multicol, colvar_grid< size_t >::value_to_bin_scalar, colvar_grid< size_t >::value_to_bin_scalar_bound, colvar_grid< size_t >::value_to_bin_scalar_fraction, write_multicol, write_opendx, and colvar_grid< size_t >::write_params.

template<class T>
size_t colvar_grid::mult [protected]
 

\brief Multiplicity of each datum (allow the binning of non-scalar types such as atomic gradients).

Definition at line 40 of file colvargrid.h.

Referenced by colvar_grid< size_t >::colvar_grid, colvar_grid< size_t >::init_from_colvars, colvar_grid< size_t >::map_grid, colvar_grid< size_t >::multiplicity, colvar_grid< size_t >::parse_params, read_multicol, colvar_grid< size_t >::read_raw, colvar_grid< size_t >::setup, write_multicol, and colvar_grid< size_t >::write_raw.

template<class T>
size_t colvar_grid::nd [protected]
 

Number of dimensions.

Definition at line 30 of file colvargrid.h.

Referenced by colvar_grid< size_t >::address, colvar_grid< size_t >::bin_distance_from_boundaries, colvar_grid< size_t >::check_consistency, colvar_grid< size_t >::colvar_grid, colvar_grid< size_t >::get_colvars_index, colvar_grid< size_t >::get_colvars_index_bound, colvar_grid< size_t >::index_ok, colvar_grid< size_t >::init_from_colvars, colvar_grid< size_t >::map_grid, colvar_grid< size_t >::new_index, colvar_grid< size_t >::num_variables, colvar_grid< size_t >::parse_params, read_multicol, colvar_grid< size_t >::setup, colvar_grid< size_t >::wrap, colvar_grid< size_t >::wrap_edge, write_multicol, and colvar_grid< size_t >::write_params.

template<class T>
std::vector<size_t> colvar_grid::new_data [protected]
 

Newly read data (used for count grids, when adding several grids read from disk).

Definition at line 49 of file colvargrid.h.

Referenced by read_multicol.

template<class T>
size_t colvar_grid::nt [protected]
 

Total number of grid points.

Definition at line 43 of file colvargrid.h.

Referenced by colvar_grid< size_t >::add_constant, colvar_grid< size_t >::colvar_grid, colvar_grid< size_t >::init_from_boundaries, colvar_grid< size_t >::multiply_constant, colvar_grid< size_t >::number_of_points, colvar_grid< size_t >::remove_small_values, colvar_grid< size_t >::reset, and colvar_grid< size_t >::setup.

template<class T>
std::vector<int> colvar_grid::nx [protected]
 

Number of points along each dimension.

Definition at line 33 of file colvargrid.h.

Referenced by colvar_grid< size_t >::address, colvar_grid< size_t >::colvar_grid, colvar_grid< size_t >::incr, colvar_grid< size_t >::index_ok, colvar_grid< size_t >::init_from_boundaries, colvar_grid< size_t >::number_of_points, colvar_grid< size_t >::number_of_points_vec, colvar_grid< size_t >::parse_params, read_multicol, colvar_grid< size_t >::set_sizes, colvar_grid< size_t >::setup, colvar_grid< size_t >::sizes, colvar_grid< size_t >::value_to_bin_scalar_bound, colvar_grid< size_t >::wrap, colvar_grid< size_t >::wrap_edge, write_multicol, and colvar_grid< size_t >::write_params.

template<class T>
std::vector<int> colvar_grid::nxc [protected]
 

Cumulative number of points along each dimension.

Definition at line 36 of file colvargrid.h.

Referenced by colvar_grid< size_t >::address, colvar_grid< size_t >::init_from_boundaries, and colvar_grid< size_t >::setup.

template<class T>
std::vector<bool> colvar_grid::periodic
 

Whether some colvars are periodic.

Definition at line 82 of file colvargrid.h.

Referenced by colvar_grid< size_t >::bin_distance_from_boundaries, colvar_grid< size_t >::colvar_grid, colvar_grid< size_t >::init_from_boundaries, colvar_grid< size_t >::init_from_colvars, colvar_grid< size_t >::parse_params, colvar_grid< size_t >::wrap, colvar_grid< size_t >::wrap_edge, and write_multicol.

template<class T>
std::vector<colvarvalue> colvar_grid::upper_boundaries
 

Upper boundaries of the colvars in this grid.

Definition at line 79 of file colvargrid.h.

Referenced by colvar_grid< size_t >::bin_distance_from_boundaries, colvar_grid< size_t >::check_consistency, colvar_grid< size_t >::colvar_grid, colvar_grid< size_t >::init_from_boundaries, colvar_grid< size_t >::init_from_colvars, colvar_grid< size_t >::parse_params, and colvar_grid< size_t >::write_params.

template<class T>
std::vector<bool> colvar_grid::use_actual_value [protected]
 

Do we request actual value (for extended-system colvars)?

Definition at line 55 of file colvargrid.h.

Referenced by colvar_grid< size_t >::colvar_grid, colvar_grid< size_t >::current_bin_scalar, colvar_grid< size_t >::current_bin_scalar_bound, colvar_grid< size_t >::current_bin_scalar_fraction, colvar_grid< size_t >::init_from_colvars, colvar_grid< size_t >::parse_params, and colvar_grid< size_t >::request_actual_value.

template<class T>
std::vector<cvm::real> colvar_grid::widths
 

Widths of the colvars in this grid.

Definition at line 91 of file colvargrid.h.

Referenced by colvar_grid< size_t >::bin_distance_from_boundaries, colvar_grid< size_t >::bin_to_value_scalar, colvar_grid< size_t >::check_consistency, colvar_grid< size_t >::colvar_grid, colvar_grid< size_t >::init_from_boundaries, colvar_grid< size_t >::init_from_colvars, colvar_grid< size_t >::map_grid, colvar_grid< size_t >::parse_params, read_multicol, colvar_grid< size_t >::value_to_bin_scalar, colvar_grid< size_t >::value_to_bin_scalar_bound, colvar_grid< size_t >::value_to_bin_scalar_fraction, write_multicol, write_opendx, and colvar_grid< size_t >::write_params.


The documentation for this class was generated from the following files:
Generated on Wed May 8 04:27:53 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002