#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. | |
| cvm::real | update () |
| Update the grid. | |
Definition at line 71 of file colvarbias_abf.h.
|
||||||||||||
|
Histogram "bias" constructor.
Definition at line 370 of file colvarbias_abf.C. References colvarmodule::fatal_error(), and colvarmodule::log(). 00371 : colvarbias (conf, key), 00372 grid (NULL) 00373 { 00374 get_keyval (conf, "outputfreq", output_freq, cvm::restart_out_freq); 00375 00376 if ( output_freq == 0 ) { 00377 cvm::fatal_error ("User required histogram with zero output frequency"); 00378 } 00379 00380 grid = new colvar_grid_count (colvars); 00381 bin.assign (colvars.size(), 0); 00382 00383 out_name = cvm::output_prefix + "." + this->name + ".dat"; 00384 cvm::log ("Histogram will be written to file " + out_name); 00385 00386 cvm::log ("Finished histogram setup.\n"); 00387 }
|
|
|
Destructor.
Definition at line 390 of file colvarbias_abf.C. 00391 {
00392 if (grid_os.good()) grid_os.close();
00393
00394 if (grid) {
00395 delete grid;
00396 grid = NULL;
00397 }
00398 }
|
|
|
Update the grid.
Implements colvarbias. Definition at line 401 of file colvarbias_abf.C. References colvar_grid< T >::current_bin_scalar(), colvarmodule::debug(), colvarmodule::fatal_error(), colvar_grid_count::incr_count(), colvar_grid< T >::index_ok(), colvarmodule::log(), colvarmodule::step_absolute(), and colvar_grid< T >::write_multicol(). 00402 {
00403 if (cvm::debug()) cvm::log ("Updating Grid bias " + this->name);
00404
00405 for (size_t i=0; i<colvars.size(); i++) {
00406 bin[i] = grid->current_bin_scalar(i);
00407 }
00408
00409 if ( grid->index_ok (bin) ) { // Only within bounds of the grid...
00410 grid->incr_count (bin);
00411 }
00412
00413 if (output_freq && (cvm::step_absolute() % output_freq) == 0) {
00414 if (cvm::debug()) cvm::log ("Histogram bias trying to write grid to disk");
00415
00416 grid_os.open (out_name.c_str());
00417 if (!grid_os.good()) cvm::fatal_error ("Error opening histogram file " + out_name + " for writing");
00418 grid->write_multicol (grid_os);
00419 grid_os.close ();
00420 }
00421 return 0.0; // no bias energy for histogram
00422 }
|
1.3.9.1