Commit ec2a6b9f authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

update colvars to version 2016-08-10

(cherry picked from commit f2ddf828e4855f7626f129a00f30be2191a28f16)
parent 77620106
Loading
Loading
Loading
Loading
+251 B (521 KiB)

File changed.

No diff preview for this file type.

+57 −121
Original line number Diff line number Diff line
@@ -43,7 +43,8 @@ colvar::colvar(std::string const &conf)
  kinetic_energy = 0.0;
  potential_energy = 0.0;

  cvm::combine_errors(error_code, init_components(conf));
  error_code |= init_components(conf);
  if (error_code != COLVARS_OK) return;

  size_t i;

@@ -492,110 +493,44 @@ int colvar::init_components(std::string const &conf)
{
  int error_code = COLVARS_OK;

  cvm::combine_errors(error_code,
                      init_components_type<distance>(conf,
                                                     "distance", "distance"));
  cvm::combine_errors(error_code,
                      init_components_type<distance_vec>(conf,
                                                         "distance vector", "distanceVec"));
  cvm::combine_errors(error_code,
                      init_components_type<cartesian>(conf,
                                                      "Cartesian coordinates", "cartesian"));
  cvm::combine_errors(error_code,
                      init_components_type<distance_dir>(conf,
                                                         "distance vector "
                                                         "direction", "distanceDir"));
  cvm::combine_errors(error_code,
                      init_components_type<distance_z>(conf,
                                                       "distance projection "
                                                       "on an axis", "distanceZ"));
  cvm::combine_errors(error_code,
                      init_components_type<distance_xy>(conf,
                                                        "distance projection "
                                                        "on a plane", "distanceXY"));
  cvm::combine_errors(error_code,
                      init_components_type<distance_inv>(conf,
                                                         "average distance "
                                                         "weighted by inverse power",
                                                         "distanceInv"));
  cvm::combine_errors(error_code,
                      init_components_type<distance_pairs>(conf,
                                                           "N1xN2-long vector "
                                                           "of pairwise distances",
                                                           "distancePairs"));

  cvm::combine_errors(error_code,
                      init_components_type<coordnum>(conf,
                                                     "coordination "
                                                     "number", "coordNum"));
  cvm::combine_errors(error_code,
                      init_components_type<selfcoordnum>(conf,
                                                         "self-coordination "
                                                         "number", "selfCoordNum"));

  cvm::combine_errors(error_code,
                      init_components_type<angle>(conf,
                                                  "angle", "angle"));
  cvm::combine_errors(error_code,
                      init_components_type<dipole_angle>(conf,
                                                         "dipole angle", "dipoleAngle"));
  cvm::combine_errors(error_code,
                      init_components_type<dihedral>(conf,
                                                     "dihedral", "dihedral"));

  cvm::combine_errors(error_code,
                      init_components_type<h_bond>(conf,
                                                   "hydrogen bond", "hBond"));

  //    cvm::combine_errors(error_code, init_components_type<alpha_dihedrals>(conf,  "alpha helix", "alphaDihedrals"));
  cvm::combine_errors(error_code,
                      init_components_type<alpha_angles>(conf,
                                                         "alpha helix", "alpha"));

  cvm::combine_errors(error_code,
                      init_components_type<dihedPC>(conf,
                                                    "dihedral "
                                                    "principal component", "dihedralPC"));

  cvm::combine_errors(error_code,
                      init_components_type<orientation>(conf,
                                                        "orientation", "orientation"));
  cvm::combine_errors(error_code,
                      init_components_type<orientation_angle>(conf,
                                                              "orientation "
                                                              "angle", "orientationAngle"));
  cvm::combine_errors(error_code,
                      init_components_type<orientation_proj>(conf,
                                                             "orientation "
                                                             "projection", "orientationProj"));
  cvm::combine_errors(error_code,
                      init_components_type<tilt>(conf,
                                                 "tilt", "tilt"));
  cvm::combine_errors(error_code,
                      init_components_type<spin_angle>(conf,
                                                       "spin angle", "spinAngle"));

  cvm::combine_errors(error_code,
                      init_components_type<rmsd>(conf,
                                                 "RMSD", "rmsd"));

  //  cvm::combine_errors(error_code, init_components_type <logmsd>(conf,"logarithm of MSD", "logmsd"));

  cvm::combine_errors(error_code,
                      init_components_type<gyration>(conf,
                                                     "radius of "
                                                     "gyration", "gyration"));
  cvm::combine_errors(error_code,
                      init_components_type<inertia>(conf,
                                                    "moment of "
                                                    "inertia", "inertia"));
  cvm::combine_errors(error_code,
                      init_components_type<inertia_z>(conf,
                                                      "moment of inertia around an axis",
                                                      "inertiaZ"));
  cvm::combine_errors(error_code,
                      init_components_type<eigenvector>(conf,
                                                        "eigenvector", "eigenvector"));
  error_code |= init_components_type<distance>(conf, "distance", "distance");
  error_code |= init_components_type<distance_vec>(conf, "distance vector", "distanceVec");
  error_code |= init_components_type<cartesian>(conf, "Cartesian coordinates", "cartesian");
  error_code |= init_components_type<distance_dir>(conf, "distance vector "
    "direction", "distanceDir");
  error_code |= init_components_type<distance_z>(conf, "distance projection "
    "on an axis", "distanceZ");
  error_code |= init_components_type<distance_xy>(conf, "distance projection "
    "on a plane", "distanceXY");
  error_code |= init_components_type<distance_inv>(conf, "average distance "
    "weighted by inverse power", "distanceInv");
  error_code |= init_components_type<distance_pairs>(conf, "N1xN2-long vector "
    "of pairwise distances", "distancePairs");
  error_code |= init_components_type<coordnum>(conf, "coordination "
    "number", "coordNum");
  error_code |= init_components_type<selfcoordnum>(conf, "self-coordination "
    "number", "selfCoordNum");
  error_code |= init_components_type<angle>(conf, "angle", "angle");
  error_code |= init_components_type<dipole_angle>(conf, "dipole angle", "dipoleAngle");
  error_code |= init_components_type<dihedral>(conf, "dihedral", "dihedral");
  error_code |= init_components_type<h_bond>(conf, "hydrogen bond", "hBond");
  error_code |= init_components_type<alpha_angles>(conf, "alpha helix", "alpha");
  error_code |= init_components_type<dihedPC>(conf, "dihedral "
    "principal component", "dihedralPC");
  error_code |= init_components_type<orientation>(conf, "orientation", "orientation");
  error_code |= init_components_type<orientation_angle>(conf, "orientation "
    "angle", "orientationAngle");
  error_code |= init_components_type<orientation_proj>(conf, "orientation "
    "projection", "orientationProj");
  error_code |= init_components_type<tilt>(conf, "tilt", "tilt");
  error_code |= init_components_type<spin_angle>(conf, "spin angle", "spinAngle");
  error_code |= init_components_type<rmsd>(conf, "RMSD", "rmsd");
  error_code |= init_components_type<gyration>(conf, "radius of "
    "gyration", "gyration");
  error_code |= init_components_type<inertia>(conf, "moment of "
    "inertia", "inertia");
  error_code |= init_components_type<inertia_z>(conf, "moment of inertia around an axis", "inertiaZ");
  error_code |= init_components_type<eigenvector>(conf, "eigenvector", "eigenvector");

  if (!cvcs.size() || (error_code != COLVARS_OK)) {
    cvm::error("Error: no valid components were provided "
@@ -732,7 +667,7 @@ int colvar::parse_analysis(std::string const &conf)
    } else {
      cvm::log("Unknown type of correlation function, \""+
                        acf_type_str+"\".\n");
      cvm::set_error_bit(INPUT_ERROR);
      cvm::set_error_bits(INPUT_ERROR);
    }

    get_keyval(conf, "corrFuncOffset", acf_offset, 0);
@@ -803,9 +738,11 @@ int colvar::calc()
  // Note: if anything is added here, it should be added also in the SMP block of calc_colvars()
  int error_code = COLVARS_OK;
  if (is_enabled(f_cv_active)) {
    cvm::combine_errors(error_code, update_cvc_flags());
    cvm::combine_errors(error_code, calc_cvcs());
    cvm::combine_errors(error_code, collect_cvc_data());
    error_code |= update_cvc_flags();
    if (error_code != COLVARS_OK) return error_code;
    error_code |= calc_cvcs();
    if (error_code != COLVARS_OK) return error_code;
    error_code |= collect_cvc_data();
  }
  return error_code;
}
@@ -818,15 +755,15 @@ int colvar::calc_cvcs(int first_cvc, size_t num_cvcs)
    cvm::log("Calculating colvar \""+this->name+"\", components "+
             cvm::to_str(first_cvc)+" through "+cvm::to_str(first_cvc+num_cvcs)+".\n");

  cvm::combine_errors(error_code, check_cvc_range(first_cvc, num_cvcs));
  error_code |= check_cvc_range(first_cvc, num_cvcs);
  if (error_code != COLVARS_OK) {
    return error_code;
  }

  cvm::combine_errors(error_code, calc_cvc_values(first_cvc, num_cvcs));
  cvm::combine_errors(error_code, calc_cvc_gradients(first_cvc, num_cvcs));
  cvm::combine_errors(error_code, calc_cvc_sys_forces(first_cvc, num_cvcs));
  cvm::combine_errors(error_code, calc_cvc_Jacobians(first_cvc, num_cvcs));
  error_code |= calc_cvc_values(first_cvc, num_cvcs);
  error_code |= calc_cvc_gradients(first_cvc, num_cvcs);
  error_code |= calc_cvc_sys_forces(first_cvc, num_cvcs);
  error_code |= calc_cvc_Jacobians(first_cvc, num_cvcs);

  if (cvm::debug())
    cvm::log("Done calculating colvar \""+this->name+"\".\n");
@@ -842,12 +779,11 @@ int colvar::collect_cvc_data()

  int error_code = COLVARS_OK;

  cvm::combine_errors(error_code, collect_cvc_values());
  cvm::combine_errors(error_code, collect_cvc_gradients());
  cvm::combine_errors(error_code, collect_cvc_sys_forces());
  cvm::combine_errors(error_code, collect_cvc_Jacobians());

  cvm::combine_errors(error_code, calc_colvar_properties());
  error_code |= collect_cvc_values();
  error_code |= collect_cvc_gradients();
  error_code |= collect_cvc_sys_forces();
  error_code |= collect_cvc_Jacobians();
  error_code |= calc_colvar_properties();

  if (cvm::debug())
    cvm::log("Done calculating colvar \""+this->name+"\"'s properties.\n");
@@ -1374,7 +1310,7 @@ bool colvar::periodic_boundaries(colvarvalue const &lb, colvarvalue const &ub) c
  if ( (!is_enabled(f_cv_lower_boundary)) || (!is_enabled(f_cv_upper_boundary)) ) {
    cvm::log("Error: checking periodicity for collective variable \""+this->name+"\" "
                    "requires lower and upper boundaries to be defined.\n");
    cvm::set_error_bit(INPUT_ERROR);
    cvm::set_error_bits(INPUT_ERROR);
  }

  if (period > 0.0) {
+6 −6
Original line number Diff line number Diff line
@@ -297,7 +297,7 @@ int cvm::atom_group::parse(std::string const &conf)
    std::string numbers_conf = "";
    size_t pos = 0;
    while (key_lookup(group_conf, "atomNumbers", numbers_conf, pos)) {
      cvm::combine_errors(parse_error, add_atom_numbers(numbers_conf));
      parse_error |= add_atom_numbers(numbers_conf);
      numbers_conf = "";
    }
  }
@@ -306,7 +306,7 @@ int cvm::atom_group::parse(std::string const &conf)
    std::string index_group_name;
    if (get_keyval(group_conf, "indexGroup", index_group_name)) {
      // use an index group from the index file read globally
      cvm::combine_errors(parse_error, add_index_group(index_group_name));
      parse_error |= add_index_group(index_group_name);
    }
  }

@@ -315,7 +315,7 @@ int cvm::atom_group::parse(std::string const &conf)
    size_t pos = 0;
    while (key_lookup(group_conf, "atomNumbersRange",
                      range_conf, pos)) {
      cvm::combine_errors(parse_error, add_atom_numbers_range(range_conf));
      parse_error |= add_atom_numbers_range(range_conf);
      range_conf = "";
    }
  }
@@ -342,8 +342,8 @@ int cvm::atom_group::parse(std::string const &conf)
        cvm::error("Error: more instances of \"atomNameResidueRange\" than "
                   "values of \"psfSegID\".\n", INPUT_ERROR);
      } else {
        cvm::combine_errors(parse_error, add_atom_name_residue_range(psf_segids.size() ?
        *psii : std::string(""), range_conf));
        parse_error |= add_atom_name_residue_range(psf_segids.size() ?
          *psii : std::string(""), range_conf);
        if (psf_segids.size()) psii++;
      }
      range_conf = "";
@@ -407,7 +407,7 @@ int cvm::atom_group::parse(std::string const &conf)
    index = (cvm::proxy)->init_atom_group(atoms_ids);
  }

  cvm::combine_errors(parse_error, parse_fitting_options(group_conf));
  parse_error |= parse_fitting_options(group_conf);

  // TODO move this to colvarparse object
  check_keywords(group_conf, key.c_str());
+1 −1
Original line number Diff line number Diff line
@@ -203,7 +203,7 @@ cvm::real colvarbias::energy_difference(std::string const &conf)
}


// So far, these are only implemented in colvarsbias_abf
// So far, these are only implemented in colvarbias_abf
int colvarbias::bin_num()
{
  cvm::error("Error: bin_num() not implemented.\n");
+2 −2
Original line number Diff line number Diff line
@@ -104,7 +104,7 @@ int colvarbias_histogram::update()
{
  int error_code = COLVARS_OK;
  // update base class
  cvm::combine_errors(error_code, colvarbias::update());
  error_code |= colvarbias::update();

  if (cvm::debug()) {
    cvm::log("Updating histogram bias " + this->name);
@@ -157,7 +157,7 @@ int colvarbias_histogram::update()
    write_output_files();
  }

  cvm::combine_errors(error_code, cvm::get_error());
  error_code |= cvm::get_error();
  return error_code;
}

Loading