Collective Variables Module - Developer Documentation
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
colvarmodule.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 
3 #ifndef COLVARMODULE_H
4 #define COLVARMODULE_H
5 
6 #ifndef COLVARS_VERSION
7 #define COLVARS_VERSION "2017-03-13"
8 #endif
9 
10 #ifndef COLVARS_DEBUG
11 #define COLVARS_DEBUG false
12 #endif
13 
20 
29 #define COLVARS_OK 0
30 #define COLVARS_ERROR 1
31 #define COLVARS_NOT_IMPLEMENTED (1<<1)
32 #define INPUT_ERROR (1<<2) // out of bounds or inconsistent input
33 #define BUG_ERROR (1<<3) // Inconsistent state indicating bug
34 #define FILE_ERROR (1<<4)
35 #define MEMORY_ERROR (1<<5)
36 #define FATAL_ERROR (1<<6) // Should be set, or not, together with other bits
37 #define DELETE_COLVARS (1<<7) // Instruct the caller to delete cvm
38 #define COLVARS_NO_SUCH_FRAME (1<<8) // Cannot load the requested frame
39 
40 #include <iostream>
41 #include <iomanip>
42 #include <string>
43 #include <cstring>
44 #include <sstream>
45 #include <fstream>
46 #include <cmath>
47 #include <vector>
48 #include <list>
49 
50 #ifdef NAMD_VERSION
51 // use Lustre-friendly wrapper to POSIX write()
52 #include "fstream_namd.h"
53 #endif
54 
55 class colvarparse;
56 class colvar;
57 class colvarbias;
58 class colvarproxy;
59 class colvarscript;
60 
61 
71 class colvarmodule {
72 
73 private:
74 
76  colvarmodule();
77 
78 public:
79 
80  friend class colvarproxy;
81  // TODO colvarscript should be unaware of colvarmodule's internals
82  friend class colvarscript;
83 
85  typedef double real;
87  typedef int residue_id;
88 
89  class rvector;
90  template <class T> class vector1d;
91  template <class T> class matrix2d;
92  class quaternion;
93  class rotation;
94 
97  typedef rvector atom_pos;
98 
100  class rmatrix;
101 
102  // allow these classes to access protected data
103  class atom;
104  class atom_group;
105  friend class atom;
106  friend class atom_group;
107  typedef std::vector<atom>::iterator atom_iter;
108  typedef std::vector<atom>::const_iterator atom_const_iter;
109 
112 protected:
113 
114  static int errorCode;
115 
116 public:
117 
118  static void set_error_bits(int code);
119 
120  static bool get_error_bit(int code);
121 
122  static inline int get_error()
123  {
124  return errorCode;
125  }
126 
127  static void clear_error();
128 
129 
131  static long it;
133  static long it_restart;
134 
136  static inline long step_relative()
137  {
138  return it - it_restart;
139  }
140 
143  static inline long step_absolute()
144  {
145  return it;
146  }
147 
151 
156 
157 private:
158 
160  std::string cvm_output_prefix;
161 
162 public:
164  static inline std::string &output_prefix()
165  {
167  return cv->cvm_output_prefix;
168  }
169 
170 private:
171 
173  std::vector<colvar *> colvars;
174 
176  std::vector<colvar *> colvars_active;
177 
180  std::vector<colvar *> colvars_smp;
182  std::vector<int> colvars_smp_items;
183 
184 public:
185 
187  std::vector<colvar *> *variables();
188 
189  /* TODO: implement named CVCs
191  static std::vector<cvc *> cvcs;
193  inline void register_cvc(cvc *p) {
194  cvcs.push_back(p);
195  }
196  */
197 
199  std::vector<colvar *> *variables_active();
200 
203  std::vector<colvar *> *variables_active_smp();
204 
206  std::vector<int> *variables_active_smp_items();
207 
209  std::vector<colvarbias *> biases;
210 
213 
214 private:
215 
217  std::vector<colvarbias *> biases_active_;
218 
219 public:
220 
222  std::vector<colvarbias *> *biases_active();
223 
225  static inline bool debug()
226  {
227  return COLVARS_DEBUG;
228  }
229 
231  size_t size() const;
232 
236 
238  ~colvarmodule();
239 
241  int reset();
242 
244  int read_config_file(char const *config_file_name);
245 
248  int read_config_string(std::string const &conf);
249 
251  int parse_config(std::string &conf);
252 
253  // Parse functions (setup internal data based on a string)
254 
257  static std::istream & getline(std::istream &is, std::string &line);
258 
260  int parse_global_params(std::string const &conf);
261 
263  int parse_colvars(std::string const &conf);
264 
266  int parse_biases(std::string const &conf);
267 
271  int append_new_config(std::string const &conf);
272 
273 private:
274 
277  std::string extra_conf;
278 
280  template <class bias_type>
281  int parse_biases_type(std::string const &conf, char const *keyword);
282 
285  bool check_new_bias(std::string &conf, char const *key);
286 
287 public:
288 
290  static int num_biases_feature(int feature_id);
291 
293  static int num_biases_type(std::string const &type);
294 
295 private:
297  int catch_input_errors(int result);
298 
299 public:
300 
301  // "Setup" functions (change internal data based on related data
302  // from the proxy that may change during program execution)
303  // No additional parsing is done within these functions
304 
307  int setup();
308 
310  int setup_input();
311 
313  int setup_output();
314 
315 #ifdef NAMD_VERSION
316  typedef ofstream_namd ofstream;
317 #else
318  typedef std::ofstream ofstream;
319 #endif
320 
322  std::istream & read_restart(std::istream &is);
324  std::ostream & write_restart(std::ostream &os);
325 
327  int open_traj_file(std::string const &file_name);
329  int close_traj_file();
331  std::ostream & write_traj(std::ostream &os);
333  std::ostream & write_traj_label(std::ostream &os);
334 
336  int write_traj_files();
338  int write_restart_files();
340  int write_output_files();
342  static int backup_file(char const *filename);
343 
345  static colvarbias * bias_by_name(std::string const &name);
346 
348  static colvar * colvar_by_name(std::string const &name);
349 
352  int change_configuration(std::string const &bias_name, std::string const &conf);
353 
355  std::string read_colvar(std::string const &name);
356 
359  real energy_difference(std::string const &bias_name, std::string const &conf);
360 
362  int bias_bin_num(std::string const &bias_name);
364  int bias_current_bin(std::string const &bias_name);
366  int bias_bin_count(std::string const &bias_name, size_t bin_index);
368  int bias_share(std::string const &bias_name);
369 
371  int calc();
372 
374  int calc_colvars();
375 
377  int calc_biases();
378 
380  int update_colvar_forces();
381 
383  int analyze();
384 
387  int read_traj(char const *traj_filename,
388  long traj_read_begin,
389  long traj_read_end);
390 
392  template<typename T> static std::string to_str(T const &x,
393  size_t const &width = 0,
394  size_t const &prec = 0);
396  template<typename T> static std::string to_str(std::vector<T> const &x,
397  size_t const &width = 0,
398  size_t const &prec = 0);
399 
401  static inline std::string wrap_string(std::string const &s,
402  size_t const &nchars)
403  {
404  if (!s.size())
405  return std::string(nchars, ' ');
406  else
407  return ( (s.size() <= size_t(nchars)) ?
408  (s+std::string(nchars-s.size(), ' ')) :
409  (std::string(s, 0, nchars)) );
410  }
411 
413  static size_t const it_width;
415  static size_t const cv_prec;
417  static size_t const cv_width;
419  static size_t const en_prec;
421  static size_t const en_width;
423  static const char * const line_marker;
424 
425 
426  // proxy functions
427 
430  static real unit_angstrom();
431 
433  static real boltzmann();
434 
436  static real temperature();
437 
439  static real dt();
440 
442  static void request_total_force();
443 
445  static void log(std::string const &message);
446 
448  static void fatal_error(std::string const &message);
449 
451  static void error(std::string const &message, int code = COLVARS_ERROR);
452 
454  static void exit(std::string const &message);
455 
456  // Replica exchange commands.
457  static bool replica_enabled();
458  static int replica_index();
459  static int replica_num();
460  static void replica_comm_barrier();
461  static int replica_comm_recv(char* msg_data, int buf_len, int src_rep);
462  static int replica_comm_send(char* msg_data, int msg_len, int dest_rep);
463 
466  static rvector position_distance(atom_pos const &pos1,
467  atom_pos const &pos2);
468 
469 
476  static real position_dist2(atom_pos const &pos1,
477  atom_pos const &pos2);
478 
482  static void select_closest_image(atom_pos &pos,
483  atom_pos const &ref_pos);
484 
489  static void select_closest_images(std::vector<atom_pos> &pos,
490  atom_pos const &ref_pos);
491 
492 
494  std::list<std::string> index_group_names;
495 
497  std::list<std::vector<int> > index_groups;
498 
500  int read_index_file(char const *filename);
501 
502 
507  static int load_atoms(char const *filename,
508  atom_group &atoms,
509  std::string const &pdb_field,
510  double const pdb_field_value = 0.0);
511 
514  static int load_coords(char const *filename,
515  std::vector<atom_pos> &pos,
516  const std::vector<int> &indices,
517  std::string const &pdb_field,
518  double const pdb_field_value = 0.0);
519 
522  static int load_coords_xyz(char const *filename,
523  std::vector<atom_pos> &pos,
524  const std::vector<int> &indices);
525 
527  static size_t cv_traj_freq;
528 
530  static bool b_analysis;
531 
533  static size_t restart_out_freq;
535  std::string restart_out_name;
536 
538  static real rand_gaussian(void);
539 
540 protected:
541 
543  std::ifstream config_s;
544 
547 
549  std::string cv_traj_name;
550 
552  colvarmodule::ofstream cv_traj_os;
553 
556 
558  colvarmodule::ofstream restart_out_os;
559 
560 private:
561 
563  size_t depth_s;
564 
566  std::vector<size_t> depth_v;
567 
568 public:
569 
571  static size_t & depth();
572 
574  static void increase_depth();
575 
577  static void decrease_depth();
578 
579  static inline bool scripted_forces()
580  {
581  return use_scripted_forces;
582  }
583 
585  static bool use_scripted_forces;
586 
589 
591  int calc_scripted_forces();
592 
597 
599  static colvarmodule *main();
600 
601 };
602 
603 
606 
607 
608 #include "colvartypes.h"
609 
610 
611 std::ostream & operator << (std::ostream &os, cvm::rvector const &v);
612 std::istream & operator >> (std::istream &is, cvm::rvector &v);
613 
614 
615 template<typename T> std::string cvm::to_str(T const &x,
616  size_t const &width,
617  size_t const &prec) {
618  std::ostringstream os;
619  if (width) os.width(width);
620  if (prec) {
621  os.setf(std::ios::scientific, std::ios::floatfield);
622  os.precision(prec);
623  }
624  os << x;
625  return os.str();
626 }
627 
628 template<typename T> std::string cvm::to_str(std::vector<T> const &x,
629  size_t const &width,
630  size_t const &prec) {
631  if (!x.size()) return std::string("");
632  std::ostringstream os;
633  if (prec) {
634  os.setf(std::ios::scientific, std::ios::floatfield);
635  }
636  os << "{ ";
637  if (width) os.width(width);
638  if (prec) os.precision(prec);
639  os << x[0];
640  for (size_t i = 1; i < x.size(); i++) {
641  os << ", ";
642  if (width) os.width(width);
643  if (prec) os.precision(prec);
644  os << x[i];
645  }
646  os << " }";
647  return os.str();
648 }
649 
650 
651 #include "colvarproxy.h"
652 
653 
655 {
656  return proxy->unit_angstrom();
657 }
658 
660 {
661  return proxy->boltzmann();
662 }
663 
665 {
666  return proxy->temperature();
667 }
668 
670 {
671  return proxy->dt();
672 }
673 
674 // Replica exchange commands
675 inline bool cvm::replica_enabled() {
676  return proxy->replica_enabled();
677 }
678 inline int cvm::replica_index() {
679  return proxy->replica_index();
680 }
681 inline int cvm::replica_num() {
682  return proxy->replica_num();
683 }
684 inline void cvm::replica_comm_barrier() {
685  return proxy->replica_comm_barrier();
686 }
687 inline int cvm::replica_comm_recv(char* msg_data, int buf_len, int src_rep) {
688  return proxy->replica_comm_recv(msg_data,buf_len,src_rep);
689 }
690 inline int cvm::replica_comm_send(char* msg_data, int msg_len, int dest_rep) {
691  return proxy->replica_comm_send(msg_data,msg_len,dest_rep);
692 }
693 
694 
696 {
697  proxy->request_total_force(true);
698 }
699 
701  atom_pos const &ref_pos)
702 {
703  proxy->select_closest_image(pos, ref_pos);
704 }
705 
706 inline void cvm::select_closest_images(std::vector<atom_pos> &pos,
707  atom_pos const &ref_pos)
708 {
709  proxy->select_closest_images(pos, ref_pos);
710 }
711 
713  atom_pos const &pos2)
714 {
715  return proxy->position_distance(pos1, pos2);
716 }
717 
719  cvm::atom_pos const &pos2)
720 {
721  return proxy->position_dist2(pos1, pos2);
722 }
723 
725 {
726  return proxy->rand_gaussian();
727 }
728 
729 #endif
static void request_total_force()
Request calculation of total force from MD engine.
Definition: colvarmodule.h:695
std::ifstream config_s
Configuration file.
Definition: colvarmodule.h:543
void select_closest_images(std::vector< cvm::atom_pos > &pos, cvm::atom_pos const &ref_pos)
Perform select_closest_image() on a set of atomic positions.
Definition: colvarproxy.h:360
int parse_global_params(std::string const &conf)
Parse the few module's global parameters.
Definition: colvarmodule.cpp:234
1-dimensional vector of real numbers with four components and a quaternion algebra ...
Definition: colvartypes.h:1025
static long step_absolute()
Definition: colvarmodule.h:143
static int num_biases_type(std::string const &type)
Return how many biases are defined with this type.
Definition: colvarmodule.cpp:456
bool cv_traj_append
Appending to the existing trajectory file?
Definition: colvarmodule.h:555
virtual cvm::real dt()=0
Time step of the simulation (fs)
virtual int replica_comm_send(char *msg_data, int msg_len, int dest_rep)
Send data to other replica.
Definition: colvarproxy.h:218
std::vector< colvarbias * > * biases_active()
Array of active collective variable biases.
Definition: colvarmodule.cpp:100
static long it
Current step number.
Definition: colvarmodule.h:131
int bias_bin_num(std::string const &bias_name)
Give the total number of bins for a given bias.
Definition: colvarmodule.cpp:566
virtual cvm::real boltzmann()=0
Boltzmann constant.
static real rand_gaussian(void)
Pseudo-random number with Gaussian distribution.
Definition: colvarmodule.h:724
int open_traj_file(std::string const &file_name)
Open a trajectory file if requested (and leave it open)
Definition: colvarmodule.cpp:1376
static real dt()
Time step of MD integrator (fs)
Definition: colvarmodule.h:669
static real debug_gradients_step_size
Finite difference step size (if there is no dynamics, or if gradients need to be tested independently...
Definition: colvarmodule.h:155
int parse_colvars(std::string const &conf)
Parse and initialize collective variables.
Definition: colvarmodule.cpp:284
static void select_closest_image(atom_pos &pos, atom_pos const &ref_pos)
Get the closest periodic image to a reference position.
Definition: colvarmodule.h:700
static bool use_scripted_forces
Use scripted colvars forces?
Definition: colvarmodule.h:585
virtual cvm::real position_dist2(cvm::atom_pos const &pos1, cvm::atom_pos const &pos2)
Get the PBC-aware square distance between two positions; may need to be reimplemented independently f...
Definition: colvarproxy.h:341
int update_colvar_forces()
Integrate bias and restraint forces, send colvar forces to atoms.
Definition: colvarmodule.cpp:787
static size_t const en_prec
Number of digits to represent the collective variables energy.
Definition: colvarmodule.h:419
Stores numeric id, mass and all mutable data for an atom, mostly used by a cvc.
Definition: colvaratoms.h:20
static size_t cv_traj_freq
Frequency for collective variables trajectory output.
Definition: colvarmodule.h:527
std::vector< colvarbias * > biases
Array of collective variable biases.
Definition: colvarmodule.h:209
static colvarproxy * proxy
Pointer to the proxy object, used to retrieve atomic data from the hosting program; it is static in o...
Definition: colvarmodule.h:596
std::vector< int > * variables_active_smp_items()
Indexes of the items to calculate for each colvar.
Definition: colvarmodule.cpp:94
std::vector< colvar * > * variables_active_smp()
Definition: colvarmodule.cpp:88
int calc_biases()
Calculate biases.
Definition: colvarmodule.cpp:730
vector of real numbers with three components
Definition: colvartypes.h:709
int write_traj_files()
Write all trajectory files.
Definition: colvarmodule.cpp:890
static int load_coords_xyz(char const *filename, std::vector< atom_pos > &pos, const std::vector< int > &indices)
Load the coordinates for a group of atoms from an XYZ file.
Definition: colvarmodule.cpp:1649
std::string cv_traj_name
Name of the trajectory file.
Definition: colvarmodule.h:549
Collective variables module (main class)
Definition: colvarmodule.h:71
real total_bias_energy
Energy of built-in and scripted biases, summed per time-step.
Definition: colvarmodule.h:212
int calc()
Main worker function.
Definition: colvarmodule.cpp:619
static long it_restart
Starting step number for this run.
Definition: colvarmodule.h:133
static colvar * colvar_by_name(std::string const &name)
Look up a colvar by name; returns NULL if not found.
Definition: colvarmodule.cpp:496
virtual cvm::real temperature()=0
Temperature of the simulation (K)
int setup_output()
(Re)initialize the output trajectory and state file (does not write it yet)
Definition: colvarmodule.cpp:1048
Interface between the collective variables module and the simulation or analysis program (NAMD...
Definition: colvarproxy.h:20
int read_index_file(char const *filename)
Read a Gromacs .ndx file.
Definition: colvarmodule.cpp:1558
int append_new_config(std::string const &conf)
Add new configuration during parsing (e.g. to implement back-compatibility); cannot be nested...
Definition: colvarmodule.cpp:227
colvarmodule cvm
Shorthand for the frequently used type prefix.
Definition: colvarmodule.h:605
int read_config_file(char const *config_file_name)
Open a config file, load its contents, and pass it to config_string()
Definition: colvarmodule.cpp:112
static std::istream & getline(std::istream &is, std::string &line)
Definition: colvarmodule.cpp:159
int write_output_files()
Write all FINAL output files.
Definition: colvarmodule.cpp:1228
static int errorCode
Definition: colvarmodule.h:114
int calc_scripted_forces()
Calculate the energy and forces of scripted biases.
Definition: colvarmodule.cpp:855
static void select_closest_images(std::vector< atom_pos > &pos, atom_pos const &ref_pos)
Perform select_closest_image() on a set of atomic positions.
Definition: colvarmodule.h:706
virtual void select_closest_image(cvm::atom_pos &pos, cvm::atom_pos const &ref_pos)
Get the closest periodic image to a reference position.
Definition: colvarproxy.h:350
static int load_atoms(char const *filename, atom_group &atoms, std::string const &pdb_field, double const pdb_field_value=0.0)
Create atoms from a file.
Definition: colvarmodule.cpp:1618
double real
Defining an abstract real number allows to switch precision.
Definition: colvarmodule.h:85
int change_configuration(std::string const &bias_name, std::string const &conf)
Definition: colvarmodule.cpp:509
rvector atom_pos
Atom position (different type name from rvector, to make possible future PBC-transparent implementati...
Definition: colvarmodule.h:93
int calc_colvars()
Calculate collective variables.
Definition: colvarmodule.cpp:656
static std::string & output_prefix()
Accessor for the above.
Definition: colvarmodule.h:164
int close_traj_file()
Close it.
Definition: colvarmodule.cpp:1402
Collective variable bias, base class.
Definition: colvarbias.h:12
static int load_coords(char const *filename, std::vector< atom_pos > &pos, const std::vector< int > &indices, std::string const &pdb_field, double const pdb_field_value=0.0)
Load the coordinates for a group of atoms from a file (PDB or XYZ)
static int backup_file(char const *filename)
Backup a file before writing it.
Definition: colvarmodule.cpp:1222
std::vector< colvar * > * variables()
Array of collective variables.
Definition: colvarmodule.cpp:76
virtual cvm::rvector position_distance(cvm::atom_pos const &pos1, cvm::atom_pos const &pos2)=0
Get the PBC-aware distance vector between two positions.
static size_t & depth()
Get the current object depth in the hierarchy.
Definition: colvarmodule.cpp:1492
std::list< std::vector< int > > index_groups
Groups from a Gromacs .ndx file read at startup.
Definition: colvarmodule.h:497
std::ostream & write_traj(std::ostream &os)
Write in the trajectory file.
Definition: colvarmodule.cpp:1440
static void fatal_error(std::string const &message)
Print a message to the main log and exit with error code.
Definition: colvarmodule.cpp:1543
bool it_restart_from_state_file
Definition: colvarmodule.h:150
virtual void request_total_force(bool yesno)
Tell the proxy whether total forces are needed (may not always be available)
Definition: colvarproxy.h:322
std::string restart_out_name
Output restart file name.
Definition: colvarmodule.h:535
int reset()
Actual function called by the destructor.
Definition: colvarmodule.cpp:974
int setup_input()
(Re)initialize and (re)read the input state file calling read_restart()
Definition: colvarmodule.cpp:1008
2-dimensional array of real numbers with three components along each dimension (works with colvarmodu...
Definition: colvartypes.h:887
std::ostream & write_restart(std::ostream &os)
Write the output restart file.
Definition: colvarmodule.cpp:1339
virtual cvm::real unit_angstrom()=0
Value of the unit for atomic coordinates with respect to angstroms (used by some variables for hard-c...
static std::string wrap_string(std::string const &s, size_t const &nchars)
Reduce the number of characters in a string.
Definition: colvarmodule.h:401
std::list< std::string > index_group_names
Names of groups from a Gromacs .ndx file to be read at startup.
Definition: colvarmodule.h:494
int read_traj(char const *traj_filename, long traj_read_begin, long traj_read_end)
Read a collective variable trajectory (post-processing only, not called at runtime) ...
Definition: colvarmodule.cpp:1270
~colvarmodule()
Destructor.
Definition: colvarmodule.cpp:962
Definition: colvarscript.h:16
virtual int replica_comm_recv(char *msg_data, int buf_len, int src_rep)
Receive data from other replica.
Definition: colvarproxy.h:213
Arbitrary size array (two dimensions) suitable for linear algebra operations (i.e. for floating point numbers it can be used with library functions)
Definition: colvarmodule.h:91
std::string read_colvar(std::string const &name)
Read a colvar value.
Definition: colvarmodule.cpp:524
static int num_biases_feature(int feature_id)
Return how many biases have this feature enabled.
Definition: colvarmodule.cpp:441
int bias_current_bin(std::string const &bias_name)
Calculate the bin index for a given bias.
Definition: colvarmodule.cpp:549
static void exit(std::string const &message)
Print a message to the main log and exit normally.
Definition: colvarmodule.cpp:1552
static size_t restart_out_freq
Frequency for saving output restarts.
Definition: colvarmodule.h:533
static colvarbias * bias_by_name(std::string const &name)
Look up a bias by name; returns NULL if not found.
Definition: colvarmodule.cpp:483
static bool b_analysis
True if only analysis is performed and not a run.
Definition: colvarmodule.h:530
static real position_dist2(atom_pos const &pos1, atom_pos const &pos2)
Get the square distance between two positions (with periodic boundary conditions handled transparentl...
Definition: colvarmodule.h:718
int residue_id
Residue identifier.
Definition: colvarmodule.h:87
static void error(std::string const &message, int code=COLVARS_ERROR)
Print a message to the main log and set global error code.
Definition: colvarmodule.cpp:1536
int setup()
Definition: colvarmodule.cpp:950
static const char *const line_marker
Line separator in the log output.
Definition: colvarmodule.h:423
static std::string to_str(T const &x, size_t const &width=0, size_t const &prec=0)
Quick conversion of an object to a string.
Definition: colvarmodule.h:615
virtual int replica_num()
Total number of replica.
Definition: colvarproxy.h:207
std::vector< colvar * > * variables_active()
Collective variables with the active flag on.
Definition: colvarmodule.cpp:82
A collective variable (main class); to be defined, it needs at least one object of a derived class of...
Definition: colvar.h:41
static bool scripting_after_biases
Wait for all biases before calculating scripted forces?
Definition: colvarmodule.h:588
virtual bool replica_enabled()
Indicate if multi-replica support is available and active.
Definition: colvarproxy.h:201
virtual int replica_index()
Index of this replica.
Definition: colvarproxy.h:204
real energy_difference(std::string const &bias_name, std::string const &conf)
Definition: colvarmodule.cpp:536
int read_config_string(std::string const &conf)
Parse a config string assuming it is a complete configuration (i.e. calling all parse functions) ...
Definition: colvarmodule.cpp:141
static rvector position_distance(atom_pos const &pos1, atom_pos const &pos2)
Get the distance between two atomic positions with pbcs handled correctly.
Definition: colvarmodule.h:712
static colvarmodule * main()
Accessor for the above.
Definition: colvarmodule.cpp:70
int parse_biases(std::string const &conf)
Parse and initialize collective variable biases.
Definition: colvarmodule.cpp:367
static real temperature()
Temperature of the simulation (K)
Definition: colvarmodule.h:664
int analyze()
Perform analysis.
Definition: colvarmodule.cpp:919
static size_t const it_width
Number of characters to represent a time step.
Definition: colvarmodule.h:413
static long step_relative()
Return the current step number from the beginning of this run.
Definition: colvarmodule.h:136
static size_t const cv_prec
Number of digits to represent a collective variables value(s)
Definition: colvarmodule.h:415
static size_t const en_width
Number of characters to represent the collective variables energy.
Definition: colvarmodule.h:421
colvarmodule::ofstream restart_out_os
Output restart file.
Definition: colvarmodule.h:558
virtual void replica_comm_barrier()
Synchronize replica.
Definition: colvarproxy.h:210
Base class containing parsing functions; all objects which need to parse input inherit from this...
Definition: colvarparse.h:18
int write_restart_files()
Write all restart files.
Definition: colvarmodule.cpp:873
static void log(std::string const &message)
Print a message to the main log.
Definition: colvarmodule.cpp:1467
A rotation between two sets of coordinates (for the moment a wrapper for colvarmodule::quaternion) ...
Definition: colvartypes.h:1374
colvarparse * parse
Configuration file parser object.
Definition: colvarmodule.h:546
virtual cvm::real rand_gaussian(void)=0
Pseudo-random number with Gaussian distribution.
static void increase_depth()
Increase the depth (number of indentations in the output)
Definition: colvarmodule.cpp:1478
std::ostream & write_traj_label(std::ostream &os)
Write explanatory labels in the trajectory file.
Definition: colvarmodule.cpp:1410
Arbitrary size array (one dimensions) suitable for linear algebra operations (i.e. for floating point numbers it can be used with library functions)
Definition: colvarmodule.h:90
static real boltzmann()
Boltmann constant.
Definition: colvarmodule.h:659
colvarmodule::ofstream cv_traj_os
Collective variables output trajectory file.
Definition: colvarmodule.h:552
size_t size() const
How many objects are configured yet?
Definition: colvarmodule.cpp:106
static size_t const cv_width
Number of characters to represent a collective variables value(s)
Definition: colvarmodule.h:417
static real unit_angstrom()
Value of the unit for atomic coordinates with respect to angstroms (used by some variables for hard-c...
Definition: colvarmodule.h:654
std::istream & read_restart(std::istream &is)
Read the input restart file.
Definition: colvarmodule.cpp:1095
static void decrease_depth()
Decrease the depth (number of indentations in the output)
Definition: colvarmodule.cpp:1484
static bool debug()
Whether debug output should be enabled (compile-time option)
Definition: colvarmodule.h:225
Group of atom objects, mostly used by a cvc object to gather all atomic data.
Definition: colvaratoms.h:141
int parse_config(std::string &conf)
Parse a "clean" config string (no comments)
Definition: colvarmodule.cpp:178