16#include "colvartypes.h" 
  218      cvm::error(
"Error: trying to use a variable of type \""+
 
  231      cvm::error(
"Error: trying to use a variable of type \""+
 
  243      cvm::error(
"Error: trying to use a variable of type \""+
 
  344                        std::vector<colvarvalue>::iterator       &xv,
 
  345                        std::vector<colvarvalue>::iterator 
const &xv_end,
 
  346                        std::vector<cvm::real>::iterator         &result);
 
  351                        std::list<colvarvalue>::iterator         &xv,
 
  352                        std::list<colvarvalue>::iterator 
const   &xv_end,
 
  353                        std::vector<cvm::real>::iterator         &result);
 
  359                        std::vector<colvarvalue>::iterator       &xv,
 
  360                        std::vector<colvarvalue>::iterator 
const &xv_end,
 
  361                        std::vector<cvm::real>::iterator         &result);
 
  366                        std::list<colvarvalue>::iterator         &xv,
 
  367                        std::list<colvarvalue>::iterator 
const   &xv_end,
 
  368                        std::vector<cvm::real>::iterator         &result);
 
  399    cvm::error(
"Error: trying to access a colvar value " 
  400               "that is not initialized.\n", COLVARS_BUG_ERROR);
 
  422    cvm::error(
"Error: trying to access a colvar value " 
  423               "that is not initialized.\n", COLVARS_BUG_ERROR);
 
  458      cvm::error(
"Trying to perform an operation between two colvar " 
  459                 "values with different types, \""+
 
  464      return COLVARS_ERROR;
 
  470      cvm::error(
"Trying to perform an operation between two vector colvar " 
  471                 "values with different sizes, "+
 
  476      return COLVARS_ERROR;
 
  502        cvm::error(
"Trying to assign a colvar value with type \""+
 
  505        return COLVARS_ERROR;
 
  518  switch (this->
type()) {
 
  546inline void colvarvalue::operator += (
colvarvalue const &x)
 
  550  switch (this->
type()) {
 
  573inline void colvarvalue::operator -= (
colvarvalue const &x)
 
  600inline void colvarvalue::operator *= (
cvm::real const &a)
 
  615    this->vector1d_value *= a;
 
  624inline void colvarvalue::operator /= (
cvm::real const &a)
 
  637    this->vector1d_value /= a;
 
1-dimensional vector of real numbers with four components and a quaternion algebra
Definition: colvartypes.h:968
 
vector of real numbers with three components
Definition: colvartypes.h:724
 
Arbitrary size array (one dimensions) suitable for linear algebra operations (i.e....
Definition: colvartypes.h:34
 
double real
Defining an abstract real number allows to switch precision.
Definition: colvarmodule.h:139
 
static int error(std::string const &message, int code=-1)
Print a message to the main log and set global error code.
Definition: colvarmodule.cpp:2096
 
static real sqrt(real const &x)
Reimplemented to work around MS compiler issues.
Definition: colvarmodule.h:177
 
static std::string to_str(char const *s)
Convert to string for output purposes.
Definition: colvarmodule.cpp:2446
 
Value of a collective variable: this is a metatype which can be set at runtime. By default it is set ...
Definition: colvarvalue.h:43
 
int from_simple_string(std::string const &s)
Parses value from a script-friendly string (space separated list)
Definition: colvarvalue.cpp:771
 
Type
Possible types of value.
Definition: colvarvalue.h:52
 
@ type_notset
Undefined type.
Definition: colvarvalue.h:54
 
@ type_3vector
3-dimensional vector, implemented as colvarmodule::rvector
Definition: colvarvalue.h:58
 
@ type_vector
vector (arbitrary dimension)
Definition: colvarvalue.h:68
 
@ type_unit3vectorderiv
3-dimensional vector that is a derivative of a unitvector
Definition: colvarvalue.h:62
 
@ type_quaternionderiv
4-dimensional vector that is a derivative of a quaternion
Definition: colvarvalue.h:66
 
@ type_quaternion
4-dimensional unit vector representing a rotation, implemented as colvarmodule::quaternion
Definition: colvarvalue.h:64
 
@ type_unit3vector
3-dimensional unit vector, implemented as colvarmodule::rvector
Definition: colvarvalue.h:60
 
@ type_all
Needed to iterate through enum.
Definition: colvarvalue.h:70
 
@ type_scalar
Scalar number, implemented as colvarmodule::real (default)
Definition: colvarvalue.h:56
 
cvm::real dist2(colvarvalue const &x2) const
Square distance between this colvarvalue and another.
Definition: colvarvalue.cpp:626
 
cvm::quaternion quaternion_value
Quaternion data member.
Definition: colvarvalue.h:83
 
std::vector< int > elem_sizes
If vector1d_value is a concatenation of colvarvalues, these mark how many components for each colvarv...
Definition: colvarvalue.h:98
 
colvarvalue()
Default constructor: this class defaults to a scalar number and always behaves like it unless you cha...
Definition: colvarvalue.cpp:18
 
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.
Definition: colvarvalue.cpp:307
 
cvm::real real_value
Real data member.
Definition: colvarvalue.h:77
 
Type type() const
Get the current type.
Definition: colvarvalue.h:154
 
colvarvalue & operator=(colvarvalue const &x)
Assignment operator (type of x is checked)
Definition: colvarvalue.h:513
 
void read_from_stream_template_(IST &is)
Generic stream reading function (formatted and not)
Definition: colvarvalue.cpp:849
 
void apply_constraints()
If the variable has constraints (e.g. unitvector or quaternion), transform it to satisfy them; this f...
Definition: colvarvalue.cpp:203
 
cvm::real norm() const
Norm of this colvarvalue.
Definition: colvarvalue.h:173
 
cvm::real operator[](int const i) const
Get a scalar number out of an element of the vector.
Definition: colvarvalue.h:394
 
void is_derivative()
Definition: colvarvalue.cpp:267
 
void set_ones(cvm::real assigned_value=1.0)
Make each element equal to the given argument.
Definition: colvarvalue.cpp:386
 
void reset()
Set to the null value for the data type currently defined.
Definition: colvarvalue.cpp:178
 
static std::string const type_desc(Type t)
Runtime description of value types.
Definition: colvarvalue.cpp:107
 
colvarvalue ones() const
Return a colvarvalue object of the same type and all components set to 1.
 
std::vector< Type > elem_types
If vector1d_value is a concatenation of colvarvalues, keep track of the individual types.
Definition: colvarvalue.h:90
 
static colvarvalue const interpolate(colvarvalue const &x1, colvarvalue const &x2, cvm::real const lambda=0.5)
Definition: colvarvalue.cpp:702
 
void set_elem(int const icv, colvarvalue const &x)
Definition: colvarvalue.cpp:341
 
static void inner_opt(colvarvalue const &x, std::vector< colvarvalue >::iterator &xv, std::vector< colvarvalue >::iterator const &xv_end, std::vector< cvm::real >::iterator &result)
Optimized routine for the inner product of one collective variable with an array.
Definition: colvarvalue.cpp:920
 
size_t size() const
Number of dimensions of this variable.
Definition: colvarvalue.h:373
 
static bool type_checking()
Whether or not the type check is enforced.
Definition: colvarvalue.h:101
 
static size_t num_dimensions(Type t)
Number of dimensions for each supported type (used to allocate vector1d_value)
Definition: colvarvalue.cpp:156
 
static std::string const type_keyword(Type t)
User keywords for specifying value types in the configuration.
Definition: colvarvalue.cpp:132
 
size_t output_width(size_t const &real_width) const
Definition: colvarvalue.cpp:898
 
void set_random()
Make each element a random number in N(0,1)
Definition: colvarvalue.cpp:352
 
friend std::istream & operator>>(std::istream &is, colvarvalue &x)
Formatted input operator.
Definition: colvarvalue.cpp:885
 
std::vector< int > elem_indices
If vector1d_value is a concatenation of colvarvalues, these mark the initial components of each colva...
Definition: colvarvalue.h:94
 
void write_to_stream_template_(OST &os) const
Generic stream writing function (formatted and not)
Definition: colvarvalue.cpp:799
 
bool is_scalar() const
Whether this variable is a real number.
Definition: colvarvalue.h:255
 
void undef_op() const
Undefined operation.
Definition: colvarvalue.cpp:420
 
cvm::vector1d< cvm::real > vector1d_value
Generic vector data member.
Definition: colvarvalue.h:86
 
friend std::ostream & operator<<(std::ostream &os, colvarvalue const &x)
Formatted output operator.
Definition: colvarvalue.cpp:825
 
cvm::real sum() const
Sum of the components of this colvarvalue (if more than one dimension)
Definition: colvarvalue.cpp:603
 
static 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.
Definition: colvarvalue.h:483
 
Type value_type
Current type of this colvarvalue object.
Definition: colvarvalue.h:74
 
static int check_types(colvarvalue const &x1, colvarvalue const &x2)
Ensure that the two types are the same within a binary operator.
Definition: colvarvalue.h:440
 
colvarvalue dist2_grad(colvarvalue const &x2) const
Derivative with respect to this colvarvalue of the square distance.
Definition: colvarvalue.cpp:662
 
static void p2leg_opt(colvarvalue const &x, std::vector< colvarvalue >::iterator &xv, std::vector< colvarvalue >::iterator const &xv_end, std::vector< cvm::real >::iterator &result)
Optimized routine for the second order Legendre polynomial, (3cos^2(w)-1)/2, of one collective variab...
Definition: colvarvalue.cpp:1002
 
void add_elem(colvarvalue const &x)
Definition: colvarvalue.cpp:291
 
std::string to_simple_string() const
Formats value as a script-friendly string (space separated list)
Definition: colvarvalue.cpp:744
 
cvm::rvector rvector_value
3-dimensional vector data member
Definition: colvarvalue.h:80
 
cvm::real norm2() const
Square norm of this colvarvalue.
Definition: colvarvalue.cpp:571
 
Definition: colvars_memstream.h:30
 
Collective variables main module.