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

version 1.5version 1.6
Line 535
Line 535
         }         }
         force_k = starting_force_k + (target_force_k - starting_force_k)         force_k = starting_force_k + (target_force_k - starting_force_k)
           * std::pow(lambda, force_k_exp);           * std::pow(lambda, force_k_exp);
         cvm::log("Restraint " + this->name + ", stage " +           cvm::log("Restraint " + this->name + ", stage " + cvm::to_str(stage)
                  cvm::to_str(stage) + " : lambda = " + cvm::to_str(lambda));                   + " : lambda = " + cvm::to_str(lambda)
         cvm::log("Setting force constant to " + cvm::to_str(force_k));                   + ", k = " + cvm::to_str(force_k));
       }       }
  
       // TI calculation: estimate free energy derivative       // TI calculation: estimate free energy derivative
Line 565
Line 565
       if (cvm::step_absolute() % target_nsteps == 0 &&       if (cvm::step_absolute() % target_nsteps == 0 &&
           cvm::step_absolute() > 0) {           cvm::step_absolute() > 0) {
  
         cvm::log("Lambda= " + cvm::to_str(lambda) + " dA/dLambda= "         cvm::log("Restraint " + this->name + " Lambda= "
                   + cvm::to_str(lambda) + " dA/dLambda= "
                  + cvm::to_str(restraint_FE / cvm::real(target_nsteps - target_equil_steps)));                  + cvm::to_str(restraint_FE / cvm::real(target_nsteps - target_equil_steps)));
  
         //  ...and move on to the next one         //  ...and move on to the next one
Line 580
Line 581
           }           }
           force_k = starting_force_k + (target_force_k - starting_force_k)           force_k = starting_force_k + (target_force_k - starting_force_k)
             * std::pow(lambda, force_k_exp);             * std::pow(lambda, force_k_exp);
           cvm::log("Restraint " + this->name + ", stage " +           cvm::log("Restraint " + this->name + ", stage " + cvm::to_str(stage)
                    cvm::to_str(stage) + " : lambda = " + cvm::to_str(lambda));                   + " : lambda = " + cvm::to_str(lambda)
           cvm::log("Setting force constant to " + cvm::to_str(force_k));                   + ", k = " + cvm::to_str(force_k));
         }         }
       }       }
  
Line 836
Line 837
     colvarbias_restraint_moving(key),     colvarbias_restraint_moving(key),
     colvarbias_restraint_k_moving(key)     colvarbias_restraint_k_moving(key)
 { {
    lower_wall_k = 0.0;
    upper_wall_k = 0.0;
 } }
  
  
Line 845
Line 848
   colvarbias_restraint_moving::init(conf);   colvarbias_restraint_moving::init(conf);
   colvarbias_restraint_k_moving::init(conf);   colvarbias_restraint_k_moving::init(conf);
  
    get_keyval(conf, "lowerWallConstant", lower_wall_k,
               (lower_wall_k > 0.0) ? lower_wall_k : force_k);
    get_keyval(conf, "upperWallConstant", upper_wall_k,
               (upper_wall_k > 0.0) ? upper_wall_k : force_k);
  
   provide(f_cvb_scalar_variables);   provide(f_cvb_scalar_variables);
   enable(f_cvb_scalar_variables);   enable(f_cvb_scalar_variables);
  
Line 905
Line 913
                    INPUT_ERROR);                    INPUT_ERROR);
       }       }
     }     }
      if (lower_wall_k * upper_wall_k == 0.0) {
        cvm::error("Error: lowerWallConstant and upperWallConstant, "
                   "when defined, must both be positive.\n",
                   INPUT_ERROR);
        return INPUT_ERROR;
      }
      force_k = lower_wall_k * upper_wall_k;
      // transform the two constants to relative values
      // (allow changing both via force_k)
      lower_wall_k /= force_k;
      upper_wall_k /= force_k;
   }   }
  
   for (i = 0; i < num_variables(); i++) {   for (i = 0; i < num_variables(); i++) {
Line 977
Line 996
 cvm::real colvarbias_restraint_harmonic_walls::restraint_potential(size_t i) const cvm::real colvarbias_restraint_harmonic_walls::restraint_potential(size_t i) const
 { {
   cvm::real const dist = colvar_distance(i);   cvm::real const dist = colvar_distance(i);
   return 0.5 * force_k / (variables(i)->width * variables(i)->width) *   cvm::real const scale = dist > 0.0 ? upper_wall_k : lower_wall_k;
    return 0.5 * force_k * scale / (variables(i)->width * variables(i)->width) *
     dist * dist;     dist * dist;
 } }
  
Line 985
Line 1005
 colvarvalue const colvarbias_restraint_harmonic_walls::restraint_force(size_t i) const colvarvalue const colvarbias_restraint_harmonic_walls::restraint_force(size_t i) const
 { {
   cvm::real const dist = colvar_distance(i);   cvm::real const dist = colvar_distance(i);
   return - force_k / (variables(i)->width * variables(i)->width) * dist;   cvm::real const scale = dist > 0.0 ? upper_wall_k : lower_wall_k;
    return - force_k * scale / (variables(i)->width * variables(i)->width) * dist;
 } }
  
  
 cvm::real colvarbias_restraint_harmonic_walls::d_restraint_potential_dk(size_t i) const cvm::real colvarbias_restraint_harmonic_walls::d_restraint_potential_dk(size_t i) const
 { {
   cvm::real const dist = colvar_distance(i);   cvm::real const dist = colvar_distance(i);
   return 0.5 / (variables(i)->width * variables(i)->width) *   cvm::real const scale = dist > 0.0 ? upper_wall_k : lower_wall_k;
    return 0.5 * scale / (variables(i)->width * variables(i)->width) *
     dist * dist;     dist * dist;
 } }
  


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



Made by using version 1.53 of cvs2html