Update Colvars library to version 2024-06-04
This commit is contained in:
@ -27,7 +27,10 @@ colvarbias_restraint::colvarbias_restraint(char const *key)
|
||||
|
||||
int colvarbias_restraint::init(std::string const &conf)
|
||||
{
|
||||
colvarbias::init(conf);
|
||||
int err = colvarbias::init(conf);
|
||||
if (err != COLVARS_OK) {
|
||||
return err;
|
||||
}
|
||||
enable(f_cvb_apply_force);
|
||||
|
||||
colvarbias_ti::init(conf);
|
||||
@ -202,6 +205,8 @@ int colvarbias_restraint_moving::init(std::string const &conf)
|
||||
|
||||
first_step = cvm::step_absolute();
|
||||
|
||||
cvm::log("Initial step for restraint change: " + cvm::to_str(first_step) + "\n");
|
||||
|
||||
get_keyval(conf, "targetNumSteps", target_nsteps, target_nsteps);
|
||||
if (!target_nsteps) {
|
||||
cvm::error("Error: targetNumSteps must be non-zero.\n", COLVARS_INPUT_ERROR);
|
||||
@ -232,10 +237,9 @@ std::string const colvarbias_restraint_moving::get_state_params() const
|
||||
std::ostringstream os;
|
||||
os.setf(std::ios::scientific, std::ios::floatfield);
|
||||
if (b_chg_centers || b_chg_force_k) {
|
||||
// TODO move this
|
||||
os << "firstStep " << std::setw(cvm::it_width) << first_step << "\n";
|
||||
if (target_nstages) {
|
||||
os << "stage " << std::setw(cvm::it_width)
|
||||
<< stage << "\n";
|
||||
os << "stage " << std::setw(cvm::it_width) << stage << "\n";
|
||||
}
|
||||
}
|
||||
return os.str();
|
||||
@ -245,6 +249,12 @@ std::string const colvarbias_restraint_moving::get_state_params() const
|
||||
int colvarbias_restraint_moving::set_state_params(std::string const &conf)
|
||||
{
|
||||
if (b_chg_centers || b_chg_force_k) {
|
||||
auto first_step_flags = colvarparse::parse_restart;
|
||||
if (cvm::main()->restart_version_number() > 20230906) {
|
||||
// Only require the first step when the code could produce it
|
||||
first_step_flags = colvarparse::parse_restart | colvarparse::parse_required;
|
||||
}
|
||||
get_keyval(conf, "firstStep", first_step, first_step, first_step_flags);
|
||||
if (target_nstages) {
|
||||
get_keyval(conf, "stage", stage, stage,
|
||||
colvarparse::parse_restart | colvarparse::parse_required);
|
||||
@ -837,18 +847,6 @@ int colvarbias_restraint_harmonic::set_state_params(std::string const &conf)
|
||||
}
|
||||
|
||||
|
||||
std::ostream & colvarbias_restraint_harmonic::write_state_data(std::ostream &os)
|
||||
{
|
||||
return colvarbias_ti::write_state_data(os);
|
||||
}
|
||||
|
||||
|
||||
std::istream & colvarbias_restraint_harmonic::read_state_data(std::istream &is)
|
||||
{
|
||||
return colvarbias_ti::read_state_data(is);
|
||||
}
|
||||
|
||||
|
||||
std::ostream & colvarbias_restraint_harmonic::write_traj_label(std::ostream &os)
|
||||
{
|
||||
colvarbias_restraint::write_traj_label(os);
|
||||
@ -1136,18 +1134,6 @@ int colvarbias_restraint_harmonic_walls::set_state_params(std::string const &con
|
||||
}
|
||||
|
||||
|
||||
std::ostream & colvarbias_restraint_harmonic_walls::write_state_data(std::ostream &os)
|
||||
{
|
||||
return colvarbias_ti::write_state_data(os);
|
||||
}
|
||||
|
||||
|
||||
std::istream & colvarbias_restraint_harmonic_walls::read_state_data(std::istream &is)
|
||||
{
|
||||
return colvarbias_ti::read_state_data(is);
|
||||
}
|
||||
|
||||
|
||||
std::ostream & colvarbias_restraint_harmonic_walls::write_traj_label(std::ostream &os)
|
||||
{
|
||||
colvarbias_restraint::write_traj_label(os);
|
||||
@ -1293,18 +1279,6 @@ int colvarbias_restraint_linear::set_state_params(std::string const &conf)
|
||||
}
|
||||
|
||||
|
||||
std::ostream & colvarbias_restraint_linear::write_state_data(std::ostream &os)
|
||||
{
|
||||
return colvarbias_ti::write_state_data(os);
|
||||
}
|
||||
|
||||
|
||||
std::istream & colvarbias_restraint_linear::read_state_data(std::istream &is)
|
||||
{
|
||||
return colvarbias_ti::read_state_data(is);
|
||||
}
|
||||
|
||||
|
||||
std::ostream & colvarbias_restraint_linear::write_traj_label(std::ostream &os)
|
||||
{
|
||||
colvarbias_restraint::write_traj_label(os);
|
||||
@ -1338,7 +1312,10 @@ int colvarbias_restraint_histogram::init(std::string const &conf)
|
||||
{
|
||||
int error_code = COLVARS_OK;
|
||||
|
||||
colvarbias::init(conf);
|
||||
int err = colvarbias::init(conf);
|
||||
if (err != COLVARS_OK) {
|
||||
return err;
|
||||
}
|
||||
enable(f_cvb_apply_force);
|
||||
|
||||
cvm::main()->cite_feature("histogramRestraint colvar bias implementation");
|
||||
|
||||
Reference in New Issue
Block a user