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

colvar_grid_gradient Class Reference

Class for accumulating the gradient of a scalar function on a grid. More...

#include <colvargrid.h>

Inheritance diagram for colvar_grid_gradient:

colvar_grid< cvm::real > colvarparse colvarparams List of all members.

Public Methods

 colvar_grid_gradient ()
 Default constructor. More...

virtual ~colvar_grid_gradient ()
 Destructor. More...

 colvar_grid_gradient (std::vector< int > const &nx_i)
 Constructor from specific sizes arrays. More...

 colvar_grid_gradient (std::vector< colvar * > &colvars)
 Constructor from a vector of colvars. More...

 colvar_grid_gradient (std::string &filename)
 Constructor from a multicol file. More...

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

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

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

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

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

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

void vector_value (std::vector< int > const &ix, std::vector< cvm::real > &v) const
 \brief Get a vector with the binned value(s) indexed by ix, normalized if applicable. More...

void acc_value (std::vector< int > const &ix, std::vector< colvarvalue > const &values)
 \brief Accumulate the value. More...

void acc_force (std::vector< int > const &ix, cvm::real const *forces)
 \brief Accumulate the gradient based on the force (i.e. sums the opposite of the force). More...

void acc_force_weighted (std::vector< int > const &ix, cvm::real const *forces, cvm::real weight)
 \brief Accumulate the gradient based on the force (i.e. sums the opposite of the force) with a non-integer weight. More...

virtual cvm::real value_output (std::vector< int > const &ix, size_t const &imult=0) const
 \brief Return the value of the function at ix divided by its number of samples (if the count grid is defined). More...

virtual void value_input (std::vector< int > const &ix, cvm::real const &new_value, size_t const &imult=0, bool add=false)
 \brief Get the value from a formatted output and transform it into the internal representation (it may have been rescaled or manipulated). More...

cvm::real average ()
 Compute and return average value for a 1D gradient grid. More...

void write_1D_integral (std::ostream &os)
 \brief If the grid is 1-dimensional, integrate it and write the integral to a file. More...


Public Attributes

colvar_grid_countsamples
 \brief Provide the sample count by which each binned value should be divided. More...

colvar_grid_scalarweights
 \brief Provide the floating point weights by which each binned value should be divided (alternate to samples, only one should be non-null). More...


Detailed Description

Class for accumulating the gradient of a scalar function on a grid.

Definition at line 1446 of file colvargrid.h.


Constructor & Destructor Documentation

colvar_grid_gradient::colvar_grid_gradient  
 

Default constructor.

Definition at line 199 of file colvargrid.C.

References NULL.

virtual colvar_grid_gradient::~colvar_grid_gradient   [inline, virtual]
 

Destructor.

Definition at line 1462 of file colvargrid.h.

colvar_grid_gradient::colvar_grid_gradient std::vector< int > const &    nx_i
 

Constructor from specific sizes arrays.

Definition at line 205 of file colvargrid.C.

References NULL, and size.

colvar_grid_gradient::colvar_grid_gradient std::vector< colvar * > &    colvars
 

Constructor from a vector of colvars.

Definition at line 211 of file colvargrid.C.

References NULL, and size.

colvar_grid_gradient::colvar_grid_gradient std::string   filename
 

Constructor from a multicol file.

Definition at line 218 of file colvargrid.C.

References colvarproxy_io::close_input_stream, COLVARS_INPUT_ERROR, colvarmodule::error, colvarproxy_io::input_stream, colvar_grid< cvm::real >::lower_boundaries, colvarmodule::main, colvar_grid< cvm::real >::mult, colvar_grid< cvm::real >::nd, NULL, colvar_grid< cvm::real >::periodic, colvarmodule::proxy, read_multicol, colvar_grid< cvm::real >::setup, and colvar_grid< cvm::real >::widths.


Member Function Documentation

void colvar_grid_gradient::acc_force std::vector< int > const &    ix,
cvm::real const *    forces
[inline]
 

\brief Accumulate the gradient based on the force (i.e. sums the opposite of the force).

Definition at line 1530 of file colvargrid.h.

References colvar_grid< cvm::real >::address, colvar_grid< cvm::real >::data, colvar_grid_count::incr_count, and colvar_grid< cvm::real >::mult.

Referenced by colvarbias_meta::project_hills, and colvarbias_abf::update.

void colvar_grid_gradient::acc_force_weighted std::vector< int > const &    ix,
cvm::real const *    forces,
cvm::real    weight
[inline]
 

\brief Accumulate the gradient based on the force (i.e. sums the opposite of the force) with a non-integer weight.

Definition at line 1540 of file colvargrid.h.

References colvar_grid_scalar::acc_value, colvar_grid< cvm::real >::address, colvar_grid< cvm::real >::data, and colvar_grid< cvm::real >::mult.

void colvar_grid_gradient::acc_value std::vector< int > const &    ix,
std::vector< colvarvalue > const &    values
[inline]
 

\brief Accumulate the value.

Definition at line 1520 of file colvargrid.h.

References colvar_grid< cvm::real >::address, colvar_grid< cvm::real >::data, colvar_grid_count::incr_count, and colvar_grid< cvm::real >::mult.

Referenced by colvarbias_ti::update_system_forces.

cvm::real colvar_grid_gradient::average   [inline]
 

Compute and return average value for a 1D gradient grid.

Definition at line 1586 of file colvargrid.h.

References colvar_grid< cvm::real >::incr, colvar_grid< cvm::real >::index_ok, n, colvar_grid< cvm::real >::nd, colvar_grid< cvm::real >::new_index, colvar_grid< cvm::real >::nx, colvarmodule::real, colvar_grid< cvm::real >::value, and colvar_grid< size_t >::value.

Referenced by integrate_potential::integrate, colvarbias_abf::update, and write_1D_integral.

int colvar_grid_gradient::read_multicol std::string const &    filename,
std::string    description = "grid file",
bool    add = false
[virtual]
 

Read a grid written by write_multicol(), incrementin if data is true.

Reimplemented from colvar_grid< cvm::real >.

Definition at line 289 of file colvargrid.C.

References colvar_grid::read_multicol.

std::istream & colvar_grid_gradient::read_multicol std::istream &    is,
bool    add = false
[virtual]
 

Read a grid written by write_multicol(), incrementin if data is true.

Reimplemented from colvar_grid< cvm::real >.

Definition at line 284 of file colvargrid.C.

References colvar_grid::read_multicol.

Referenced by colvar_grid_gradient.

virtual void colvar_grid_gradient::value_input std::vector< int > const &    ix,
cvm::real const &    new_value,
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 (it may have been rescaled or manipulated).

Reimplemented from colvar_grid< cvm::real >.

Definition at line 1565 of file colvargrid.h.

References colvar_grid< cvm::real >::address, colvar_grid< cvm::real >::data, colvar_grid< cvm::real >::has_data, colvar_grid_count::new_count, and colvar_grid< size_t >::value.

virtual cvm::real colvar_grid_gradient::value_output std::vector< int > const &    ix,
size_t const &    imult = 0
const [inline, virtual]
 

\brief Return the value of the function at ix divided by its number of samples (if the count grid is defined).

Reimplemented from colvar_grid< cvm::real >.

Definition at line 1551 of file colvargrid.h.

References colvar_grid< cvm::real >::address, colvar_grid< cvm::real >::data, colvarmodule::real, and colvar_grid< size_t >::value.

Referenced by integrate_potential::integrate.

void colvar_grid_gradient::vector_value std::vector< int > const &    ix,
std::vector< cvm::real > &    v
const [inline]
 

\brief Get a vector with the binned value(s) indexed by ix, normalized if applicable.

Definition at line 1497 of file colvargrid.h.

References colvar_grid< cvm::real >::mult, colvar_grid< size_t >::value, and colvar_grid< cvm::real >::value.

Referenced by colvarbias_abf::update.

void colvar_grid_gradient::write_1D_integral std::ostream &    os
 

\brief If the grid is 1-dimensional, integrate it and write the integral to a file.

Definition at line 319 of file colvargrid.C.

References average, bin, colvar_grid< cvm::real >::cv, colvarmodule::error, colvar_grid< cvm::real >::incr, colvar_grid< cvm::real >::index_ok, colvar_grid< cvm::real >::new_index, colvar_grid< cvm::real >::nx, colvar_grid< cvm::real >::periodic, colvarmodule::real, samples, colvar_grid< cvm::real >::value, and colvar_grid< size_t >::value.

Referenced by colvarbias_ti::write_output_files.

int colvar_grid_gradient::write_multicol std::string const &    filename,
std::string    description = "grid file"
const [virtual]
 

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

Reimplemented from colvar_grid< cvm::real >.

Definition at line 301 of file colvargrid.C.

References colvar_grid::write_multicol.

std::ostream & colvar_grid_gradient::write_multicol std::ostream &    os const [virtual]
 

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

Reimplemented from colvar_grid< cvm::real >.

Definition at line 296 of file colvargrid.C.

References colvar_grid::write_multicol.

Referenced by colvarbias_reweightaMD::write_cumulant_expansion_pmf, colvarbias_reweightaMD::write_exponential_reweighted_pmf, and colvarbias_ti::write_output_files.

int colvar_grid_gradient::write_opendx std::string const &    filename,
std::string    description = "grid file"
const [virtual]
 

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

Reimplemented from colvar_grid< cvm::real >.

Definition at line 312 of file colvargrid.C.

References colvar_grid::write_opendx.

std::ostream & colvar_grid_gradient::write_opendx std::ostream &    os const [virtual]
 

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

Reimplemented from colvar_grid< cvm::real >.

Definition at line 307 of file colvargrid.C.

References colvar_grid::write_opendx.


Member Data Documentation

colvar_grid_count* colvar_grid_gradient::samples
 

\brief Provide the sample count by which each binned value should be divided.

Definition at line 1452 of file colvargrid.h.

Referenced by integrate_potential::get_grad, colvarbias_abf::init, colvarbias_ti::init_grids, and write_1D_integral.

colvar_grid_scalar* colvar_grid_gradient::weights
 

\brief Provide the floating point weights by which each binned value should be divided (alternate to samples, only one should be non-null).

Definition at line 1456 of file colvargrid.h.


The documentation for this class was generated from the following files:
Generated on Fri Mar 29 02:47:24 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002