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

colvar_grid_scalar Class Reference

Class for accumulating a scalar function on a grid. More...

#include <colvargrid.h>

Inheritance diagram for colvar_grid_scalar:

List of all members.

Public Methods

colvar_grid_scalar ()
Default constructor. More...

colvar_grid_scalar (colvar_grid_scalar const &g)
Copy constructor (needed because of the grad pointer). More...

virtual ~colvar_grid_scalar ()
Destructor. More...

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

colvar_grid_scalar (std::vector< colvar * > &colvars, bool add_extra_bin=false)
Constructor from a vector of colvars. More...

void acc_value (std::vector< int > const &ix, cvm::real const &new_value, size_t const &imult=0)
Accumulate the value. More...

std::istream & read_multicol (std::istream &is, bool add=false)
Read a grid written by write_multicol(), incrementin if data 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(), incrementin if data 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...

void vector_gradient_finite_diff (const std::vector< int > &ix0, std::vector< cvm::real > &grad)
\brief Return the gradient of the scalar field from finite differences Input coordinates are those of gradient grid, shifted wrt scalar grid Should not be called on edges of scalar grid, provided the latter has margins wrt gradient grid. More...

cvm::real gradient_finite_diff (const std::vector< int > &ix0, int n=0)
\brief Return the gradient of discrete count from finite differences on the *same* grid for dimension n. 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)
Enter or add value but also deal with count grid. More...

cvm::real maximum_value () const
\brief Return the highest value. More...

cvm::real minimum_value () const
\brief Return the lowest value. More...

cvm::real minimum_pos_value () const
\brief Return the lowest positive value. More...

cvm::real integral () const
\brief Calculates the integral of the map (uses widths if they are defined). More...

cvm::real entropy () const
\brief Assuming that the map is a normalized probability density, calculates the entropy (uses widths if they are defined). More...


Public Attributes

colvar_grid_count * samples
\brief Provide the associated sample count by which each binned value should be divided. More...


Detailed Description

Class for accumulating a scalar function on a grid.

Definition at line 1227 of file colvargrid.h.


Constructor & Destructor Documentation

colvar_grid_scalar::colvar_grid_scalar ( )

Default constructor.

Definition at line 76 of file colvargrid.C.

References NULL.

colvar_grid_scalar::colvar_grid_scalar ( colvar_grid_scalar const & g )

Copy constructor (needed because of the grad pointer).

Definition at line 80 of file colvargrid.C.

References NULL.

colvar_grid_scalar::~colvar_grid_scalar ( ) [virtual]

Destructor.

Definition at line 95 of file colvargrid.C.

colvar_grid_scalar::colvar_grid_scalar ( std::vector< int > const & nx_i )

Constructor from specific sizes arrays.

Definition at line 85 of file colvargrid.C.

References NULL.

colvar_grid_scalar::colvar_grid_scalar ( std::vector< colvar * > & colvars,
bool add_extra_bin = false
)

Constructor from a vector of colvars.

Definition at line 90 of file colvargrid.C.

References NULL.


Member Function Documentation

void colvar_grid_scalar::acc_value ( std::vector< int > const & ix,
cvm::real const & new_value,
size_t const & imult = 0
) [inline]

Accumulate the value.

Definition at line 1252 of file colvargrid.h.

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

Referenced by colvar_grid_gradient::acc_force_weighted, colvarbias_meta::project_hills, colvarbias_reweightaMD::update, and colvarbias_histogram::update.

cvm::real colvar_grid_scalar::entropy ( ) const

\brief Assuming that the map is a normalized probability density, calculates the entropy (uses widths if they are defined).

Definition at line 183 of file colvargrid.C.

References colvar_grid< cvm::real >::data, colvarmodule::logn, colvar_grid< cvm::real >::nt, and colvar_grid< cvm::real >::widths.

Referenced by colvarbias_meta::init_ebmeta_params.

cvm::real colvar_grid_scalar::gradient_finite_diff ( const std::vector< int > & ix0,
int n = 0
) [inline]

\brief Return the gradient of discrete count from finite differences on the *same* grid for dimension n.

Definition at line 1341 of file colvargrid.h.

References n, colvar_grid< cvm::real >::nx, colvar_grid< cvm::real >::periodic, colvar_grid< cvm::real >::value, colvar_grid< cvm::real >::widths, and colvar_grid< cvm::real >::wrap.

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

cvm::real colvar_grid_scalar::integral ( ) const

\brief Calculates the integral of the map (uses widths if they are defined).

Definition at line 169 of file colvargrid.C.

References colvar_grid< cvm::real >::data, colvar_grid< cvm::real >::nt, and colvar_grid< cvm::real >::widths.

Referenced by colvarbias_meta::init_ebmeta_params.

cvm::real colvar_grid_scalar::maximum_value ( ) const

\brief Return the highest value.

Definition at line 134 of file colvargrid.C.

References colvar_grid< cvm::real >::data, and colvar_grid< cvm::real >::nt.

Referenced by colvarbias_meta::init_ebmeta_params, and colvarbias_meta::write_pmf.

cvm::real colvar_grid_scalar::minimum_pos_value ( ) const

\brief Return the lowest positive value.

Definition at line 153 of file colvargrid.C.

References colvar_grid< cvm::real >::data, and colvar_grid< cvm::real >::nt.

Referenced by colvarbias_meta::init_ebmeta_params.

cvm::real colvar_grid_scalar::minimum_value ( ) const

\brief Return the lowest value.

Definition at line 144 of file colvargrid.C.

References colvar_grid< cvm::real >::data, and colvar_grid< cvm::real >::nt.

Referenced by colvarbias_meta::init_ebmeta_params, and integrate_potential::set_zero_minimum.

int colvar_grid_scalar::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.

Reimplemented from colvar_grid< cvm::real >.

Definition at line 104 of file colvargrid.C.

References colvar_grid::read_multicol.

std::istream & colvar_grid_scalar::read_multicol ( std::istream & is,
bool add = false
)

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

Reimplemented from colvar_grid< cvm::real >.

Definition at line 99 of file colvargrid.C.

References colvar_grid::read_multicol.

Referenced by colvarbias::init, and colvarbias_meta::init_ebmeta_params.

virtual void colvar_grid_scalar::value_input ( std::vector< int > const & ix,
cvm::real const & new_value,
size_t const & imult = 0,
bool add = false
) [inline, virtual]

Enter or add value but also deal with count grid.

Reimplemented from colvar_grid< cvm::real >.

Definition at line 1402 of file colvargrid.h.

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

virtual cvm::real colvar_grid_scalar::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 1384 of file colvargrid.h.

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

void colvar_grid_scalar::vector_gradient_finite_diff ( const std::vector< int > & ix0,
std::vector< cvm::real > & grad
) [inline]

\brief Return the gradient of the scalar field from finite differences Input coordinates are those of gradient grid, shifted wrt scalar grid Should not be called on edges of scalar grid, provided the latter has margins wrt gradient grid.

Definition at line 1290 of file colvargrid.h.

References colvarmodule::error, n, colvar_grid< cvm::real >::nd, colvar_grid< cvm::real >::value, colvar_grid< cvm::real >::widths, and colvar_grid< cvm::real >::wrap.

Referenced by colvarbias_abf::update.

int colvar_grid_scalar::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 from colvar_grid< cvm::real >.

Definition at line 116 of file colvargrid.C.

References colvar_grid::write_multicol.

std::ostream & colvar_grid_scalar::write_multicol ( std::ostream & os ) const

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

Reimplemented from colvar_grid< cvm::real >.

Definition at line 111 of file colvargrid.C.

References colvar_grid::write_multicol.

Referenced by colvarbias_reweightaMD::write_count, colvarbias_reweightaMD::write_cumulant_expansion_pmf, colvarbias_reweightaMD::write_exponential_reweighted_pmf, colvarbias_histogram::write_output_files, and colvarbias_meta::write_pmf.

int colvar_grid_scalar::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 from colvar_grid< cvm::real >.

Definition at line 127 of file colvargrid.C.

References colvar_grid::write_opendx.

std::ostream & colvar_grid_scalar::write_opendx ( std::ostream & os ) const

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

Reimplemented from colvar_grid< cvm::real >.

Definition at line 122 of file colvargrid.C.

References colvar_grid::write_opendx.

Referenced by colvarbias_histogram::write_output_files.


Member Data Documentation

colvar_grid_count* colvar_grid_scalar::samples

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

Definition at line 1233 of file colvargrid.h.


The documentation for this class was generated from the following files:
Generated on Mon Nov 17 02:48:22 2025 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002

AltStyle によって変換されたページ (->オリジナル) /