#include <colvarbias_abf.h>
Inheritance diagram for colvarbias_histogram:

Public Member Functions | |
| colvarbias_histogram (std::string const &conf, char const *key) | |
| Histogram "bias" constructor. | |
| ~colvarbias_histogram () | |
| Destructor. | |
| void | update () |
| Update the grid. | |
Definition at line 72 of file colvarbias_abf.h.
|
||||||||||||
|
Histogram "bias" constructor.
Definition at line 342 of file colvarbias_abf.C. References colvarmodule::fatal_error(), and colvarmodule::log(). 00343 : colvarbias (conf, key), 00344 grid (NULL) 00345 { 00346 get_keyval (conf, "outputfreq", output_freq, cvm::restart_out_freq); 00347 00348 if ( output_freq == 0 ) { 00349 cvm::fatal_error ("User required histogram with zero output frequency"); 00350 } 00351 00352 grid = new colvar_grid_count (colvars); 00353 bin.assign (colvars.size(), 0); 00354 00355 out_name = cvm::output_prefix + "." + this->name + ".dat"; 00356 cvm::log ("Histogram will be written to file " + out_name); 00357 00358 cvm::log ("Finished histogram setup.\n"); 00359 }
|
|
|
Destructor.
Definition at line 362 of file colvarbias_abf.C. 00363 {
00364 if (grid_os.good()) grid_os.close();
00365
00366 if (grid) {
00367 delete grid;
00368 grid = NULL;
00369 }
00370 }
|
|
|
Update the grid.
Implements colvarbias. Definition at line 373 of file colvarbias_abf.C. References colvarmodule::debug(), colvarmodule::fatal_error(), colvar_grid_count::incr_count(), colvar_grid< T >::index_ok(), colvarmodule::log(), colvarmodule::step_relative(), and colvar_grid< T >::write_multicol(). 00374 {
00375 if (cvm::debug()) cvm::log ("Updating Grid bias " + this->name);
00376
00377 for (size_t i=0; i<colvars.size(); i++) {
00378 bin[i] = colvars[i]->current_bin_scalar();
00379 }
00380
00381 if ( grid->index_ok (bin) ) { // Only within bounds of the grid...
00382 grid->incr_count (bin);
00383 }
00384
00385 if (output_freq && (cvm::step_relative() % output_freq) == 0) {
00386 if (cvm::debug()) cvm::log ("Histogram bias trying to write grid to disk");
00387
00388 grid_os.open (out_name.c_str());
00389 if (!grid_os.good()) cvm::fatal_error ("Error opening histogram file " + out_name + " for writing");
00390 grid->write_multicol (grid_os);
00391 grid_os.close ();
00392 }
00393 }
|
1.3.9.1