Difference for src/colvarbias_alb.C from version 1.5 to 1.6

version 1.5version 1.6
Line 1
Line 1
 // -*- c++ -*- // -*- c++ -*-
  
  // This file is part of the Collective Variables module (Colvars).
  // The original version of Colvars and its updates are located at:
  // https://github.com/colvars/colvars
  // Please update all Colvars source files before making any changes.
  // If you wish to distribute your changes, please submit them to the
  // Colvars repository at GitHub.
  
 #include <stdio.h> #include <stdio.h>
 #include <stdlib.h> #include <stdlib.h>
 #include <math.h> #include <math.h>
Line 33
Line 40
 { {
   colvarbias::init(conf);   colvarbias::init(conf);
  
    provide(f_cvb_scalar_variables);
    enable(f_cvb_scalar_variables);
  
   provide(f_cvb_history_dependent);   provide(f_cvb_history_dependent);
  
   size_t i;   size_t i;
Line 128
Line 138
  
 colvarbias_alb::~colvarbias_alb() colvarbias_alb::~colvarbias_alb()
 { {
   if (cvm::n_rest_biases > 0) 
     cvm::n_rest_biases -= 1; 
 } }
  
  
Line 239
Line 247
 } }
  
  
 std::istream & colvarbias_alb::read_restart(std::istream &is) int colvarbias_alb::set_state_params(std::string const &conf)
 { {
   size_t const start_pos = is.tellg(); 
  
   cvm::log("Restarting adaptive linear bias \""+ 
             this->name+"\".\n"); 
  
   std::string key, brace, conf; 
   if ( !(is >> key)   || !(key == "ALB") || 
        !(is >> brace) || !(brace == "{") || 
        !(is >> colvarparse::read_block("configuration", conf)) ) { 
  
     cvm::log("Error: in reading restart configuration for restraint bias \""+ 
               this->name+"\" at position "+ 
               cvm::to_str(is.tellg())+" in stream.\n"); 
     is.clear(); 
     is.seekg(start_pos, std::ios::beg); 
     is.setstate(std::ios::failbit); 
     return is; 
   } 
  
   std::string name = ""; 
   if ( (colvarparse::get_keyval(conf, "name", name, std::string(""), colvarparse::parse_silent)) && 
        (name != this->name) ) 
     cvm::fatal_error("Error: in the restart file, the " 
                       "\"ALB\" block has a wrong name\n"); 
   if (name.size() == 0) { 
     cvm::fatal_error("Error: \"ALB\" block in the restart file " 
                       "has no identifiers.\n"); 
   } 
  
   if (!get_keyval(conf, "setCoupling", set_coupling))   if (!get_keyval(conf, "setCoupling", set_coupling))
     cvm::fatal_error("Error: current setCoupling  is missing from the restart.\n");     cvm::fatal_error("Error: current setCoupling  is missing from the restart.\n");
  
Line 299
Line 278
   if (!get_keyval(conf, "b_equilibration", b_equilibration))   if (!get_keyval(conf, "b_equilibration", b_equilibration))
     cvm::fatal_error("Error: current updateCalls is missing from the restart.\n");     cvm::fatal_error("Error: current updateCalls is missing from the restart.\n");
  
   is >> brace;   return COLVARS_OK;
   if (brace != "}") { 
     cvm::fatal_error("Error: corrupt restart information for adaptive linear bias \""+ 
                       this->name+"\": no matching brace at position "+ 
                       cvm::to_str(is.tellg())+" in the restart file.\n"); 
     is.setstate(std::ios::failbit); 
   } 
  
   return is; 
 } }
  
  
 std::ostream & colvarbias_alb::write_restart(std::ostream &os) std::string const colvarbias_alb::get_state_params() const
 { {
   os << "ALB {\n"   std::ostringstream os;
      << "  configuration {\n" 
      << "    name " << this->name << "\n"; 
   os << "    setCoupling ";   os << "    setCoupling ";
   size_t i;   size_t i;
   for (i = 0; i < colvars.size(); i++) {   for (i = 0; i < colvars.size(); i++) {
Line 358
Line 327
   else   else
     os << "    b_equilibration no\n";     os << "    b_equilibration no\n";
  
   os << "  }\n"   return os.str();
      << "}\n\n"; 
  
   return os; 
 } }
  
  


Legend:
Removed in v.1.5 
changed lines
 Added in v.1.6



Made by using version 1.53 of cvs2html