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

colvarvalue Class Reference

\brief Value of a collective variable: this is a metatype which can be set at runtime. By default it is set to be a scalar number, and can be treated as such in all operations (this is done by most colvar::cvc implementations). colvarvalue allows colvar to be treat different data types. By default, a colvarvalue variable is a scalar number. To use it as another type, declare and initialize it as `colvarvalue x(colvarvalue::type_xxx)`, use `x.type (colvarvalue::type_xxx)` at a later stage, or if unset, assign the type with `x = y;`, provided y is correctly set. All operators (either unary or binary) on a colvarvalue object performs one or more checks on the Type, except when reading from a stream, when there is no way to detect the Type. To use `is >> x;` x MUST already have a type correcly set up for properly parsing the stream. No problem of course with the output streams: `os << x;` Note on performance: to avoid type checks in a long array of colvarvalue objects, use one of the existing "_opt" functions or implement a new one. More...

#include <colvarvalue.h>

List of all members.

Public Types

enum  Type {
  type_notset, type_scalar, type_3vector, type_unit3vector,
  type_unit3vectorderiv, type_quaternion, type_quaternionderiv, type_vector,
  type_all
}
 \brief Possible types of value These three cover most possibilities of data type one can devise. If you need to implement a new colvar with a very complex data type, it's better to put an allocatable class here. More...


Public Methods

size_t size () const
 Number of dimensions of this variable. More...

 colvarvalue ()
 \brief Default constructor: this class defaults to a scalar number and always behaves like it unless you change its type. More...

 colvarvalue (Type const &vti)
 Constructor from a type specification. More...

 colvarvalue (cvm::real const &x)
 Copy constructor from real base type. More...

 colvarvalue (cvm::rvector const &v, Type vti=type_3vector)
 \brief Copy constructor from rvector base type (Note: this sets by default a type type_3vector , if you want a type_unit3vector you must set it explicitly). More...

 colvarvalue (cvm::quaternion const &q, Type vti=type_quaternion)
 \brief Copy constructor from quaternion base type. More...

 colvarvalue (cvm::vector1d< cvm::real > const &v, Type vti=type_vector)
 Copy constructor from vector1d base type. More...

 colvarvalue (colvarvalue const &x)
 Copy constructor from another colvarvalue. More...

void reset ()
 Set to the null value for the data type currently defined. More...

void apply_constraints ()
 \brief If the variable has constraints (e.g. unitvector or quaternion), transform it to satisfy them; this function needs to be called only when the colvarvalue is calculated outside of colvar::cvc objects. More...

Type type () const
 Get the current type. More...

void type (Type const &vti)
 Set the type explicitly. More...

void type (colvarvalue const &x)
 Set the type after another colvarvalue. More...

void is_derivative ()
 Make the type a derivative of the original type (so that its constraints do not apply). More...

cvm::real norm2 () const
 Square norm of this colvarvalue. More...

cvm::real norm () const
 Norm of this colvarvalue. More...

cvm::real sum () const
 Sum of the components of this colvarvalue (if more than one dimension). More...

colvarvalue ones () const
 Return a colvarvalue object of the same type and all components set to 1. More...

cvm::real dist2 (colvarvalue const &x2) const
 Square distance between this colvarvalue and another. More...

colvarvalue dist2_grad (colvarvalue const &x2) const
 Derivative with respect to this colvarvalue of the square distance. More...

colvarvalue & operator= (colvarvalue const &x)
 Assignment operator (type of x is checked). More...

void operator+= (colvarvalue const &x)
void operator-= (colvarvalue const &x)
void operator *= (cvm::real const &a)
void operator/= (cvm::real const &a)
 operator cvm::real () const
 operator cvm::rvector () const
 operator cvm::quaternion () const
cvm::vector1d< cvm::real
> const 
as_vector () const
bool is_scalar () const
 Whether this variable is a real number. More...

void add_elem (colvarvalue const &x)
 Add an element to the vector (requires that type_vector is already set). This is only needed to use this object as a vector of "complex" colvar values. To use it instead as a plain n-dimensional vector, access vector1d_value directly. More...

colvarvalue const get_elem (int const i_begin, int const i_end, Type const vt) const
 Get a single colvarvalue out of elements of the vector. More...

colvarvalue const get_elem (int const icv) const
 Get a single colvarvalue out of elements of the vector. More...

void set_elem (int const icv, colvarvalue const &x)
 Set elements of the vector from a single colvarvalue (uses the rank of x to compute the length). More...

void set_elem (int const i_begin, int const i_end, colvarvalue const &x)
 Set elements of the vector from a single colvarvalue. More...

void set_random ()
 Make each element a random number in N(0,1). More...

void set_ones (cvm::real assigned_value=1.0)
 Make each element equal to the given argument. More...

cvm::real operator[] (int const i) const
 Get a scalar number out of an element of the vector. More...

cvm::realoperator[] (int const i)
 Use an element of the vector as a scalar number. More...

void undef_op () const
 Undefined operation. More...

size_t output_width (size_t const &real_width) const
 Give the number of characters required to output this colvarvalue, given the current type assigned and the number of characters for a real number. More...

std::string to_simple_string () const
 Formats value as a script-friendly string (space separated list). More...

int from_simple_string (std::string const &s)
 Parses value from a script-friendly string (space separated list). More...


Static Public Methods

bool type_checking ()
 \brief Whether or not the type check is enforced. More...

std::string const type_desc (Type t)
 Runtime description of value types. More...

std::string const type_keyword (Type t)
 User keywords for specifying value types in the configuration. More...

size_t num_df (Type t)
 Number of degrees of freedom for each supported type. More...

size_t num_dimensions (Type t)
 Number of dimensions for each supported type (used to allocate vector1d_value). More...

colvarvalue const interpolate (colvarvalue const &x1, colvarvalue const &x2, cvm::real const lambda=0.5)
 Return the midpoint between x1 and x2, optionally weighted by lambda (which must be between 0.0 and 1.0). More...

int check_types (colvarvalue const &x1, colvarvalue const &x2)
 Ensure that the two types are the same within a binary operator. More...

int check_types_assign (Type const &vt1, Type const &vt2)
 Ensure that the two types are the same within an assignment, or that the left side is type_notset. More...

void inner_opt (colvarvalue const &x, std::vector< colvarvalue >::iterator &xv, std::vector< colvarvalue >::iterator const &xv_end, std::vector< cvm::real >::iterator &result)
 \brief Optimized routine for the inner product of one collective variable with an array. More...

void inner_opt (colvarvalue const &x, std::list< colvarvalue >::iterator &xv, std::list< colvarvalue >::iterator const &xv_end, std::vector< cvm::real >::iterator &result)
 \brief Optimized routine for the inner product of one collective variable with an array. More...

void p2leg_opt (colvarvalue const &x, std::vector< colvarvalue >::iterator &xv, std::vector< colvarvalue >::iterator const &xv_end, std::vector< cvm::real >::iterator &result)
 \brief Optimized routine for the second order Legendre polynomial, (3cos^2(w)-1)/2, of one collective variable with an array. More...

void p2leg_opt (colvarvalue const &x, std::list< colvarvalue >::iterator &xv, std::list< colvarvalue >::iterator const &xv_end, std::vector< cvm::real >::iterator &result)
 \brief Optimized routine for the second order Legendre polynomial of one collective variable with an array. More...


Public Attributes

Type value_type
 Current type of this colvarvalue object. More...

cvm::real real_value
 \brief Real data member. More...

cvm::rvector rvector_value
 \brief 3-dimensional vector data member. More...

cvm::quaternion quaternion_value
 \brief Quaternion data member. More...

cvm::vector1d< cvm::realvector1d_value
 \brief Generic vector data member. More...

std::vector< Typeelem_types
 \brief If vector1d_value is a concatenation of colvarvalues, keep track of the individual types. More...

std::vector< int > elem_indices
 \brief If vector1d_value is a concatenation of colvarvalues, these mark the initial components of each colvarvalue. More...

std::vector< int > elem_sizes
 \brief If vector1d_value is a concatenation of colvarvalues, these mark how many components for each colvarvalue. More...


Friends

colvarvalue operator+ (colvarvalue const &x1, colvarvalue const &x2)
colvarvalue operator- (colvarvalue const &x1, colvarvalue const &x2)
colvarvalue operator * (colvarvalue const &x, cvm::real const &a)
colvarvalue operator * (cvm::real const &a, colvarvalue const &x)
colvarvalue operator/ (colvarvalue const &x, cvm::real const &a)
cvm::real operator * (colvarvalue const &x1, colvarvalue const &x2)
 Inner product. More...

std::ostream & operator<< (std::ostream &os, colvarvalue const &q)
 \brief Formatted output operator. More...

std::istream & operator>> (std::istream &is, colvarvalue &q)
 \brief Formatted input operator. More...


Detailed Description

\brief Value of a collective variable: this is a metatype which can be set at runtime. By default it is set to be a scalar number, and can be treated as such in all operations (this is done by most colvar::cvc implementations). colvarvalue allows colvar to be treat different data types. By default, a colvarvalue variable is a scalar number. To use it as another type, declare and initialize it as `colvarvalue x(colvarvalue::type_xxx)`, use `x.type (colvarvalue::type_xxx)` at a later stage, or if unset, assign the type with `x = y;`, provided y is correctly set. All operators (either unary or binary) on a colvarvalue object performs one or more checks on the Type, except when reading from a stream, when there is no way to detect the Type. To use `is >> x;` x MUST already have a type correcly set up for properly parsing the stream. No problem of course with the output streams: `os << x;` Note on performance: to avoid type checks in a long array of colvarvalue objects, use one of the existing "_opt" functions or implement a new one.

Definition at line 41 of file colvarvalue.h.


Member Enumeration Documentation

enum colvarvalue::Type
 

\brief Possible types of value These three cover most possibilities of data type one can devise. If you need to implement a new colvar with a very complex data type, it's better to put an allocatable class here.

Enumeration values:
type_notset  Undefined type.
type_scalar  Scalar number, implemented as colvarmodule::real (default).
type_3vector  3-dimensional vector, implemented as colvarmodule::rvector.
type_unit3vector  3-dimensional unit vector, implemented as colvarmodule::rvector.
type_unit3vectorderiv  3-dimensional vector that is a derivative of a unitvector.
type_quaternion  4-dimensional unit vector representing a rotation, implemented as colvarmodule::quaternion.
type_quaternionderiv  4-dimensional vector that is a derivative of a quaternion.
type_vector  vector (arbitrary dimension).
type_all  Needed to iterate through enum.

Definition at line 50 of file colvarvalue.h.

Referenced by check_types_assign, colvarvalue, colvar::init, and type.


Constructor & Destructor Documentation

colvarvalue::colvarvalue  
 

\brief Default constructor: this class defaults to a scalar number and always behaves like it unless you change its type.

Definition at line 19 of file colvarvalue.C.

Referenced by dist2_grad, get_elem, and interpolate.

colvarvalue::colvarvalue Type const &    vti
 

Constructor from a type specification.

Definition at line 24 of file colvarvalue.C.

References reset.

colvarvalue::colvarvalue cvm::real const &    x
 

Copy constructor from real base type.

Definition at line 30 of file colvarvalue.C.

colvarvalue::colvarvalue cvm::rvector const &    v,
Type    vti = type_3vector
 

\brief Copy constructor from rvector base type (Note: this sets by default a type type_3vector , if you want a type_unit3vector you must set it explicitly).

Definition at line 35 of file colvarvalue.C.

References Type.

colvarvalue::colvarvalue cvm::quaternion const &    q,
Type    vti = type_quaternion
 

\brief Copy constructor from quaternion base type.

Definition at line 40 of file colvarvalue.C.

References Type.

colvarvalue::colvarvalue cvm::vector1d< cvm::real > const &    v,
Type    vti = type_vector
 

Copy constructor from vector1d base type.

Definition at line 73 of file colvarvalue.C.

References colvarmodule::error, num_dimensions, quaternion_value, real_value, rvector_value, Type, type_3vector, type_desc, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, type_vector, value_type, and vector1d_value.

colvarvalue::colvarvalue colvarvalue const &    x
 

Copy constructor from another colvarvalue.

Definition at line 45 of file colvarvalue.C.

References elem_indices, elem_sizes, elem_types, quaternion_value, real_value, rvector_value, type_3vector, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, type_vector, and vector1d_value.


Member Function Documentation

void colvarvalue::add_elem colvarvalue const &    x
 

Add an element to the vector (requires that type_vector is already set). This is only needed to use this object as a vector of "complex" colvar values. To use it instead as a plain n-dimensional vector, access vector1d_value directly.

Definition at line 315 of file colvarvalue.C.

References elem_indices, elem_sizes, elem_types, colvarmodule::error, n, num_dimensions, set_elem, type_vector, value_type, and vector1d_value.

void colvarvalue::apply_constraints  
 

\brief If the variable has constraints (e.g. unitvector or quaternion), transform it to satisfy them; this function needs to be called only when the colvarvalue is calculated outside of colvar::cvc objects.

Definition at line 227 of file colvarvalue.C.

References elem_indices, elem_sizes, elem_types, quaternion_value, rvector_value, set_elem, colvarmodule::sqrt, type_3vector, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, type_vector, and vector1d_value.

Referenced by colvar::calc_runave, interpolate, operator>>, and colvar::update_extended_Lagrangian.

cvm::vector1d< cvm::real > const colvarvalue::as_vector   const [inline]
 

Definition at line 627 of file colvarvalue.h.

References quaternion_value, real_value, rvector_value, type_3vector, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, type_vector, and vector1d_value.

Referenced by colvar::communicate_forces, and set_elem.

int colvarvalue::check_types colvarvalue const &    x1,
colvarvalue const &    x2
[inline, static]
 

Ensure that the two types are the same within a binary operator.

Definition at line 421 of file colvarvalue.h.

References COLVARS_ERROR, colvarmodule::error, colvarmodule::to_str, type, type_checking, type_desc, type_quaternion, type_quaternionderiv, type_unit3vector, type_unit3vectorderiv, type_vector, and vector1d_value.

Referenced by colvar::calc_acf, dist2, dist2_grad, colvar::init, inner_opt, interpolate, operator *, operator+, operator+=, operator-, operator-=, and p2leg_opt.

int colvarvalue::check_types_assign Type const &    vt1,
Type const &    vt2
[inline, static]
 

Ensure that the two types are the same within an assignment, or that the left side is type_notset.

Definition at line 464 of file colvarvalue.h.

References COLVARS_ERROR, colvarmodule::error, Type, type_checking, type_desc, type_notset, type_quaternion, type_quaternionderiv, type_unit3vector, and type_unit3vectorderiv.

Referenced by operator=, and set_elem.

cvm::real colvarvalue::dist2 colvarvalue const &    x2 const [inline]
 

Square distance between this colvarvalue and another.

Definition at line 707 of file colvarvalue.h.

References colvarmodule::acos, check_types, quaternion_value, real_value, rvector_value, type, type_3vector, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, type_vector, undef_op, and vector1d_value.

Referenced by colvar::cvc::dist2, colvar::dist2, and interpolate.

colvarvalue colvarvalue::dist2_grad colvarvalue const &    x2 const
 

Derivative with respect to this colvarvalue of the square distance.

Definition at line 595 of file colvarvalue.C.

References check_types, colvarvalue, quaternion_value, real_value, rvector_value, type_3vector, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, type_vector, undef_op, value_type, and vector1d_value.

Referenced by colvar::cvc::dist2_lgrad, colvar::dist2_lgrad, colvar::cvc::dist2_rgrad, colvar::dist2_rgrad, and colvarbias_restraint_centers_moving::update_centers.

int colvarvalue::from_simple_string std::string const &    s
 

Parses value from a script-friendly string (space separated list).

Definition at line 697 of file colvarvalue.C.

References COLVARS_ERROR, quaternion_value, real_value, rvector_value, type, type_3vector, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, type_vector, undef_op, and vector1d_value.

Referenced by colvarproxy_tcl::tcl_run_colvar_callback.

colvarvalue const colvarvalue::get_elem int const    icv const
 

Get a single colvarvalue out of elements of the vector.

Definition at line 353 of file colvarvalue.C.

References colvarvalue, elem_indices, elem_sizes, elem_types, colvarmodule::error, get_elem, and type_notset.

colvarvalue const colvarvalue::get_elem int const    i_begin,
int const    i_end,
Type const    vt
const
 

Get a single colvarvalue out of elements of the vector.

Definition at line 331 of file colvarvalue.C.

References colvarvalue, colvarmodule::error, type_notset, and vector1d_value.

Referenced by get_elem, and norm2.

void colvarvalue::inner_opt colvarvalue const &    x,
std::list< colvarvalue >::iterator &    xv,
std::list< colvarvalue >::iterator const &    xv_end,
std::vector< cvm::real >::iterator &    result
[static]
 

\brief Optimized routine for the inner product of one collective variable with an array.

Definition at line 862 of file colvarvalue.C.

References check_types, quaternion_value, real_value, result, rvector_value, type_3vector, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, type_vector, undef_op, value_type, and vector1d_value.

void colvarvalue::inner_opt colvarvalue const &    x,
std::vector< colvarvalue >::iterator &    xv,
std::vector< colvarvalue >::iterator const &    xv_end,
std::vector< cvm::real >::iterator &    result
[static]
 

\brief Optimized routine for the inner product of one collective variable with an array.

Definition at line 821 of file colvarvalue.C.

References check_types, quaternion_value, real_value, result, rvector_value, type_3vector, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, type_vector, undef_op, value_type, and vector1d_value.

Referenced by colvar::calc_coor_acf, and colvar::calc_vel_acf.

colvarvalue const colvarvalue::interpolate colvarvalue const &    x1,
colvarvalue const &    x2,
cvm::real const    lambda = 0.5
[static]
 

Return the midpoint between x1 and x2, optionally weighted by lambda (which must be between 0.0 and 1.0).

Definition at line 628 of file colvarvalue.C.

References apply_constraints, check_types, COLVARS_BUG_ERROR, COLVARS_INPUT_ERROR, colvarvalue, dist2, colvarmodule::error, norm, colvarmodule::sqrt, type, type_3vector, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, type_vector, and undef_op.

Referenced by colvarbias_restraint_centers_moving::init, and colvarbias_restraint_centers_moving::update_centers.

void colvarvalue::is_derivative  
 

Make the type a derivative of the original type (so that its constraints do not apply).

Definition at line 291 of file colvarvalue.C.

References type, type_3vector, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, and type_vector.

bool colvarvalue::is_scalar   const [inline]
 

Whether this variable is a real number.

Definition at line 255 of file colvarvalue.h.

cvm::real colvarvalue::norm   const [inline]
 

Norm of this colvarvalue.

Definition at line 173 of file colvarvalue.h.

References colvarmodule::sqrt.

Referenced by interpolate.

cvm::real colvarvalue::norm2   const [inline]
 

Square norm of this colvarvalue.

Definition at line 652 of file colvarvalue.h.

References elem_types, get_elem, quaternion_value, real_value, result, rvector_value, type_3vector, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, type_vector, and vector1d_value.

Referenced by colvar::calc_colvar_properties, colvar::calc_coor_acf, colvar::rmsd::calc_value, and colvar::calc_vel_acf.

size_t colvarvalue::num_df Type    t [static]
 

Number of degrees of freedom for each supported type.

Definition at line 157 of file colvarvalue.C.

References type_3vector, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, and type_vector.

size_t colvarvalue::num_dimensions Type    t [static]
 

Number of dimensions for each supported type (used to allocate vector1d_value).

Definition at line 180 of file colvarvalue.C.

References type_3vector, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, and type_vector.

Referenced by add_elem, and colvarvalue.

colvarvalue colvarvalue::ones   const
 

Return a colvarvalue object of the same type and all components set to 1.

void colvarvalue::operator *= cvm::real const &    a [inline]
 

Definition at line 581 of file colvarvalue.h.

References quaternion_value, real_value, rvector_value, type_3vector, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vectorderiv, type_vector, undef_op, and vector1d_value.

colvarvalue::operator cvm::quaternion   const [inline]
 

Definition at line 239 of file colvarvalue.h.

References colvarmodule::error, quaternion_value, type_desc, type_quaternion, type_quaternionderiv, and value_type.

colvarvalue::operator cvm::real   const [inline]
 

Definition at line 215 of file colvarvalue.h.

References colvarmodule::error, operator cvm::real, real_value, type_desc, type_scalar, and value_type.

Referenced by operator cvm::real.

colvarvalue::operator cvm::rvector   const [inline]
 

Definition at line 226 of file colvarvalue.h.

References colvarmodule::error, rvector_value, type_3vector, type_desc, type_unit3vector, type_unit3vectorderiv, and value_type.

void colvarvalue::operator+= colvarvalue const &    x [inline]
 

Definition at line 527 of file colvarvalue.h.

References check_types, quaternion_value, real_value, rvector_value, type, type_3vector, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, type_vector, undef_op, and vector1d_value.

void colvarvalue::operator-= colvarvalue const &    x [inline]
 

Definition at line 554 of file colvarvalue.h.

References check_types, quaternion_value, real_value, rvector_value, type_3vector, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, type_vector, undef_op, and vector1d_value.

void colvarvalue::operator/= cvm::real const &    a [inline]
 

Definition at line 605 of file colvarvalue.h.

References quaternion_value, real_value, rvector_value, type_3vector, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, type_vector, undef_op, and vector1d_value.

colvarvalue & colvarvalue::operator= colvarvalue const &    x [inline]
 

Assignment operator (type of x is checked).

Definition at line 494 of file colvarvalue.h.

References check_types_assign, elem_indices, elem_sizes, elem_types, quaternion_value, real_value, rvector_value, type, type_3vector, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, type_vector, undef_op, value_type, and vector1d_value.

cvm::real & colvarvalue::operator[] int const    i [inline]
 

Use an element of the vector as a scalar number.

Definition at line 398 of file colvarvalue.h.

References COLVARS_BUG_ERROR, colvarmodule::error, quaternion_value, real_value, rvector_value, type_3vector, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, type_vector, and vector1d_value.

cvm::real colvarvalue::operator[] int const    i const [inline]
 

Get a scalar number out of an element of the vector.

Definition at line 375 of file colvarvalue.h.

References COLVARS_BUG_ERROR, colvarmodule::error, quaternion_value, real_value, rvector_value, type_3vector, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, type_vector, and vector1d_value.

size_t colvarvalue::output_width size_t const &    real_width const
 

Give the number of characters required to output this colvarvalue, given the current type assigned and the number of characters for a real number.

Definition at line 799 of file colvarvalue.C.

References type_3vector, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, type_vector, value_type, and vector1d_value.

Referenced by colvar::calc_runave, and colvar::write_traj_label.

void colvarvalue::p2leg_opt colvarvalue const &    x,
std::list< colvarvalue >::iterator &    xv,
std::list< colvarvalue >::iterator const &    xv_end,
std::vector< cvm::real >::iterator &    result
[static]
 

\brief Optimized routine for the second order Legendre polynomial of one collective variable with an array.

Definition at line 958 of file colvarvalue.C.

References check_types, colvarmodule::error, quaternion_value, result, rvector_value, type_3vector, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, undef_op, and value_type.

void colvarvalue::p2leg_opt colvarvalue const &    x,
std::vector< colvarvalue >::iterator &    xv,
std::vector< colvarvalue >::iterator const &    xv_end,
std::vector< cvm::real >::iterator &    result
[static]
 

\brief Optimized routine for the second order Legendre polynomial, (3cos^2(w)-1)/2, of one collective variable with an array.

Definition at line 903 of file colvarvalue.C.

References check_types, colvarmodule::error, quaternion_value, result, rvector_value, type_3vector, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, type_vector, undef_op, value_type, and vector1d_value.

Referenced by colvar::calc_p2coor_acf.

void colvarvalue::reset  
 

Set to the null value for the data type currently defined.

Definition at line 202 of file colvarvalue.C.

References quaternion_value, real_value, rvector_value, type_3vector, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, type_vector, and vector1d_value.

Referenced by colvar::calc_colvar_properties, colvar::calc_runave, colvar::collect_cvc_Jacobians, colvar::collect_cvc_total_forces, colvar::collect_cvc_values, colvarvalue, colvar::init, colvar::reset_bias_force, type, colvarbias_restraint_histogram::update, colvar::update_extended_Lagrangian, and colvar::update_forces_energy.

void colvarvalue::set_elem int const    i_begin,
int const    i_end,
colvarvalue const &    x
 

Set elements of the vector from a single colvarvalue.

Definition at line 343 of file colvarvalue.C.

References as_vector, colvarmodule::error, and vector1d_value.

void colvarvalue::set_elem int const    icv,
colvarvalue const &    x
 

Set elements of the vector from a single colvarvalue (uses the rank of x to compute the length).

Definition at line 365 of file colvarvalue.C.

References check_types_assign, elem_indices, elem_sizes, elem_types, colvarmodule::error, and value_type.

Referenced by add_elem, and apply_constraints.

void colvarvalue::set_ones cvm::real    assigned_value = 1.0
 

Make each element equal to the given argument.

Definition at line 410 of file colvarvalue.C.

References quaternion_value, real_value, rvector_value, type, type_3vector, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, type_vector, undef_op, and vector1d_value.

Referenced by colvarbias_restraint_linear::restraint_force.

void colvarvalue::set_random  
 

Make each element a random number in N(0,1).

Definition at line 376 of file colvarvalue.C.

References quaternion_value, colvarmodule::rand_gaussian, real_value, rvector_value, type, type_3vector, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, type_vector, undef_op, and vector1d_value.

Referenced by colvar::update_extended_Lagrangian.

size_t colvarvalue::size   const [inline]
 

Number of dimensions of this variable.

Definition at line 354 of file colvarvalue.h.

References type_3vector, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, type_vector, and vector1d_value.

Referenced by colvar::collect_cvc_values, colvar::communicate_forces, colvar::cvc::debug_gradients, colvar::init, and colvar::num_dimensions.

cvm::real colvarvalue::sum   const [inline]
 

Sum of the components of this colvarvalue (if more than one dimension).

Definition at line 684 of file colvarvalue.h.

References quaternion_value, real_value, rvector_value, type_3vector, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, type_vector, and vector1d_value.

std::string colvarvalue::to_simple_string   const
 

Formats value as a script-friendly string (space separated list).

Definition at line 670 of file colvarvalue.C.

References quaternion_value, real_value, rvector_value, string, colvarmodule::to_str, type, type_3vector, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, type_vector, undef_op, and vector1d_value.

void colvarvalue::type colvarvalue const &    x
 

Set the type after another colvarvalue.

Definition at line 274 of file colvarvalue.C.

References reset, type, type_vector, value_type, and vector1d_value.

void colvarvalue::type Type const &    vti
 

Set the type explicitly.

Definition at line 261 of file colvarvalue.C.

References reset, type_vector, value_type, and vector1d_value.

Type colvarvalue::type   const [inline]
 

Get the current type.

Definition at line 154 of file colvarvalue.h.

References Type, and value_type.

Referenced by colvar::alch_lambda::alch_lambda, colvar::alpha_angles::alpha_angles, colvar::calc_colvar_properties, colvarbias_meta::calc_hills_force, colvar::calc_runave, check_types, colvar::collect_cvc_values, colvar::communicate_forces, colvar::coordnum::coordnum, colvar::cvc::debug_gradients, colvar::dihedPC::dihedPC, colvar::dipole_magnitude::dipole_magnitude, dist2, colvar::distance_dir::distance_dir, colvar::distance_pairs::distance_pairs, colvar::distance_vec::distance_vec, colvar::distance_z::distance_z, from_simple_string, colvar::h_bond::h_bond, colvar::init, colvar::cvc::init_as_angle, colvar::cvc::init_as_distance, colvar::cvc::init_as_periodic_angle, colvar::init_extended_Lagrangian, colvar::init_grid_parameters, colvar::cvc::init_scalar_boundaries, interpolate, is_derivative, colvar::map_total::map_total, operator+=, operator<<, operator=, operator>>, colvar::orientation::orientation, colvar::polar_theta::polar_theta, colvar::read_state, colvar::reset_bias_force, set_ones, set_random, colvar::spin_angle::spin_angle, to_simple_string, type, colvarbias_restraint_histogram::update, colvar::update_extended_Lagrangian, and colvar::update_forces_energy.

bool colvarvalue::type_checking   [inline, static]
 

\brief Whether or not the type check is enforced.

Definition at line 99 of file colvarvalue.h.

Referenced by check_types, and check_types_assign.

std::string const colvarvalue::type_desc Type    t [static]
 

Runtime description of value types.

Definition at line 108 of file colvarvalue.C.

References type_3vector, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, and type_vector.

Referenced by check_types, check_types_assign, colvarvalue, colvar::init, operator cvm::quaternion, operator cvm::real, operator cvm::rvector, and undef_op.

std::string const colvarvalue::type_keyword Type    t [static]
 

User keywords for specifying value types in the configuration.

Definition at line 133 of file colvarvalue.C.

References type_3vector, type_notset, type_quaternion, type_quaternionderiv, type_scalar, type_unit3vector, type_unit3vectorderiv, and type_vector.

Referenced by colvar::init.

void colvarvalue::undef_op   const
 

Undefined operation.

Definition at line 444 of file colvarvalue.C.

References colvarmodule::error, and type_desc.

Referenced by dist2, dist2_grad, from_simple_string, inner_opt, interpolate, operator *, operator *=, operator+, operator+=, operator-, operator-=, operator/, operator/=, operator=, operator>>, p2leg_opt, set_ones, set_random, and to_simple_string.


Friends And Related Function Documentation

cvm::real operator * colvarvalue const &    x1,
colvarvalue const &    x2
[friend]
 

Inner product.

Definition at line 568 of file colvarvalue.C.

colvarvalue operator * cvm::real const &    a,
colvarvalue const &    x
[friend]
 

Definition at line 509 of file colvarvalue.C.

colvarvalue operator * colvarvalue const &    x,
cvm::real const &    a
[friend]
 

Definition at line 534 of file colvarvalue.C.

colvarvalue operator+ colvarvalue const &    x1,
colvarvalue const &    x2
[friend]
 

Definition at line 453 of file colvarvalue.C.

colvarvalue operator- colvarvalue const &    x1,
colvarvalue const &    x2
[friend]
 

Definition at line 480 of file colvarvalue.C.

colvarvalue operator/ colvarvalue const &    x,
cvm::real const &    a
[friend]
 

Definition at line 541 of file colvarvalue.C.

std::ostream& operator<< std::ostream &    os,
colvarvalue const &    q
[friend]
 

\brief Formatted output operator.

Definition at line 724 of file colvarvalue.C.

std::istream& operator>> std::istream &    is,
colvarvalue &    q
[friend]
 

\brief Formatted input operator.

Definition at line 761 of file colvarvalue.C.


Member Data Documentation

std::vector<int> colvarvalue::elem_indices
 

\brief If vector1d_value is a concatenation of colvarvalues, these mark the initial components of each colvarvalue.

Definition at line 92 of file colvarvalue.h.

Referenced by add_elem, apply_constraints, colvarvalue, get_elem, operator=, and set_elem.

std::vector<int> colvarvalue::elem_sizes
 

\brief If vector1d_value is a concatenation of colvarvalues, these mark how many components for each colvarvalue.

Definition at line 96 of file colvarvalue.h.

Referenced by add_elem, apply_constraints, colvarvalue, get_elem, operator=, and set_elem.

std::vector<Type> colvarvalue::elem_types
 

\brief If vector1d_value is a concatenation of colvarvalues, keep track of the individual types.

Definition at line 88 of file colvarvalue.h.

Referenced by add_elem, apply_constraints, colvarvalue, get_elem, norm2, operator=, and set_elem.

cvm::quaternion colvarvalue::quaternion_value
 

\brief Quaternion data member.

Definition at line 81 of file colvarvalue.h.

Referenced by apply_constraints, colvar::orientation::apply_force, as_vector, colvar::orientation::calc_value, colvarvalue, dist2, colvar::orientation::dist2, dist2_grad, colvar::orientation::dist2_lgrad, colvar::orientation::dist2_rgrad, from_simple_string, inner_opt, norm2, operator *, operator *=, operator cvm::quaternion, operator+, operator+=, operator-, operator-=, operator/, operator/=, operator<<, operator=, operator>>, operator[], p2leg_opt, reset, set_ones, set_random, sum, and to_simple_string.

cvm::real colvarvalue::real_value
 

\brief Real data member.

Definition at line 75 of file colvarvalue.h.

Referenced by colvar::alch_lambda::alch_lambda, colvar::map_total::apply_force, colvar::euler_theta::apply_force, colvar::euler_psi::apply_force, colvar::euler_phi::apply_force, colvar::spin_angle::apply_force, colvar::tilt::apply_force, colvar::orientation_proj::apply_force, colvar::orientation_angle::apply_force, colvar::alpha_angles::apply_force, colvar::eigenvector::apply_force, colvar::rmsd::apply_force, colvar::inertia_z::apply_force, colvar::inertia::apply_force, colvar::gyration::apply_force, colvar::dipole_magnitude::apply_force, colvar::distance_inv::apply_force, colvar::distance_xy::apply_force, colvar::distance_z::apply_force, colvar::distance::apply_force, colvar::groupcoordnum::apply_force, colvar::selfcoordnum::apply_force, colvar::coordnum::apply_force, colvar::polar_phi::apply_force, colvar::polar_theta::apply_force, colvar::dihedral::apply_force, colvar::dipole_angle::apply_force, colvar::angle::apply_force, colvar::alch_Flambda::apply_force, colvar::alch_lambda::apply_force, as_vector, colvar_grid< size_t >::bin_to_value_scalar, colvar::eigenvector::calc_force_invgrads, colvar::rmsd::calc_force_invgrads, colvar::gyration::calc_force_invgrads, colvar::distance_xy::calc_force_invgrads, colvar::distance_z::calc_force_invgrads, colvar::distance::calc_force_invgrads, colvar::dihedral::calc_force_invgrads, colvar::angle::calc_force_invgrads, colvar::rmsd::calc_gradients, colvar::gyration::calc_gradients, colvar::distance_xy::calc_gradients, colvar::distance_z::calc_gradients, colvar::eigenvector::calc_Jacobian_derivative, colvar::rmsd::calc_Jacobian_derivative, colvar::gyration::calc_Jacobian_derivative, colvar::distance_xy::calc_Jacobian_derivative, colvar::distance_z::calc_Jacobian_derivative, colvar::distance::calc_Jacobian_derivative, colvar::angle::calc_Jacobian_derivative, colvar::map_total::calc_value, colvar::euler_theta::calc_value, colvar::euler_psi::calc_value, colvar::euler_phi::calc_value, colvar::spin_angle::calc_value, colvar::tilt::calc_value, colvar::orientation_proj::calc_value, colvar::orientation_angle::calc_value, colvar::dihedPC::calc_value, colvar::alpha_angles::calc_value, colvar::eigenvector::calc_value, colvar::rmsd::calc_value, colvar::inertia_z::calc_value, colvar::inertia::calc_value, colvar::gyration::calc_value, colvar::dipole_magnitude::calc_value, colvar::distance_inv::calc_value, colvar::distance_xy::calc_value, colvar::distance_z::calc_value, colvar::distance::calc_value, colvar::groupcoordnum::calc_value, colvar::selfcoordnum::calc_value, colvar::h_bond::calc_value, colvar::coordnum::calc_value, colvar::polar_phi::calc_value, colvar::polar_theta::calc_value, colvar::dihedral::calc_value, colvar::dipole_angle::calc_value, colvar::angle::calc_value, colvar::alch_Flambda::calc_value, colvar::alch_lambda::calc_value, colvarvalue, colvar::selfcoordnum::compute_selfcoordnum, colvar::cvc::debug_gradients, dist2, colvar::euler_psi::dist2, colvar::euler_phi::dist2, colvar::spin_angle::dist2, colvar::distance_z::dist2, colvar::polar_phi::dist2, colvar::dihedral::dist2, colvar::dist2, dist2_grad, colvar::euler_psi::dist2_lgrad, colvar::euler_phi::dist2_lgrad, colvar::spin_angle::dist2_lgrad, colvar::distance_z::dist2_lgrad, colvar::polar_phi::dist2_lgrad, colvar::dihedral::dist2_lgrad, colvar::dist2_lgrad, colvar::euler_psi::dist2_rgrad, colvar::euler_phi::dist2_rgrad, colvar::spin_angle::dist2_rgrad, colvar::distance_z::dist2_rgrad, colvar::polar_phi::dist2_rgrad, colvar::dihedral::dist2_rgrad, colvar::dist2_rgrad, from_simple_string, colvar::cvc::init_as_distance, colvar::init_grid_parameters, colvar::cvc::init_scalar_boundaries, inner_opt, colvar::coordnum::main_loop, norm2, operator *, operator *=, operator cvm::real, operator+, operator+=, operator-, operator-=, operator/, operator/=, operator<<, operator=, operator>>, operator[], reset, set_ones, set_random, sum, to_simple_string, colvarbias_restraint_histogram::update, 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, colvar::euler_psi::wrap, colvar::euler_phi::wrap, colvar::spin_angle::wrap, colvar::distance_z::wrap, colvar::polar_phi::wrap, colvar::dihedral::wrap, and colvar::wrap.

cvm::rvector colvarvalue::rvector_value
 

\brief 3-dimensional vector data member.

Definition at line 78 of file colvarvalue.h.

Referenced by apply_constraints, colvar::distance_dir::apply_force, colvar::distance_vec::apply_force, as_vector, colvar::distance_dir::calc_value, colvar::distance_vec::calc_value, colvarvalue, dist2, colvar::distance_dir::dist2, colvar::distance_vec::dist2, dist2_grad, colvar::distance_dir::dist2_lgrad, colvar::distance_vec::dist2_lgrad, colvar::distance_dir::dist2_rgrad, colvar::distance_vec::dist2_rgrad, from_simple_string, inner_opt, norm2, operator *, operator *=, operator cvm::rvector, operator+, operator+=, operator-, operator-=, operator/, operator/=, operator<<, operator=, operator>>, operator[], p2leg_opt, reset, set_ones, set_random, sum, and to_simple_string.

Type colvarvalue::value_type
 

Current type of this colvarvalue object.

Definition at line 72 of file colvarvalue.h.

Referenced by add_elem, colvarvalue, dist2_grad, inner_opt, operator *, operator cvm::quaternion, operator cvm::real, operator cvm::rvector, operator+, operator-, operator/, operator=, output_width, p2leg_opt, set_elem, and type.

cvm::vector1d<cvm::real> colvarvalue::vector1d_value
 

\brief Generic vector data member.

Definition at line 84 of file colvarvalue.h.

Referenced by add_elem, apply_constraints, colvar::cartesian::apply_force, as_vector, colvar::cartesian::calc_value, colvar::distance_pairs::calc_value, check_types, colvarvalue, dist2, dist2_grad, from_simple_string, get_elem, colvar::init, inner_opt, norm2, operator *, operator *=, operator+, operator+=, operator-, operator-=, operator/, operator/=, operator<<, operator=, operator>>, operator[], output_width, p2leg_opt, reset, set_elem, set_ones, set_random, size, sum, to_simple_string, type, and colvarbias_restraint_histogram::update.


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