Beispiel #1
0
void cvm::deps::init_cvc_requires() {
  size_t i;
  // Initialize static array once and for all
  if (features().size() == 0) {
    for (i = 0; i < cvm::deps::f_cvc_ntot; i++) {
      features().push_back(new feature);
    }

    f_description(f_cvc_active, "active");
//     The dependency below may become useful if we use dynamic atom groups
//     f_req_children(f_cvc_active, f_ag_active);

    f_description(f_cvc_scalar, "scalar");

    f_description(f_cvc_gradient, "gradient");

    f_description(f_cvc_inv_gradient, "inverse gradient");
    f_req_self(f_cvc_inv_gradient, f_cvc_gradient);

    f_description(f_cvc_debug_gradient, "debug gradient");
    f_req_self(f_cvc_debug_gradient, f_cvc_gradient);

    f_description(f_cvc_Jacobian, "Jacobian");
    f_req_self(f_cvc_Jacobian, f_cvc_inv_gradient);

    f_description(f_cvc_com_based, "depends on group centers of mass");

    f_description(f_cvc_scalable, "scalable calculation");
    f_req_self(f_cvc_scalable, f_cvc_scalable_com);

    f_description(f_cvc_scalable_com, "scalable calculation of centers of mass");
    f_req_self(f_cvc_scalable_com, f_cvc_com_based);


    // TODO only enable this when f_ag_scalable can be turned on for a pre-initialized group
    // f_req_children(f_cvc_scalable, f_ag_scalable);
    // f_req_children(f_cvc_scalable_com, f_ag_scalable_com);
  }

  // Initialize feature_states for each instance
  // default as unavailable, not enabled
  feature_states.reserve(f_cvc_ntot);
  for (i = 0; i < cvm::deps::f_cvc_ntot; i++) {
    feature_states.push_back(new feature_state(false, false));
  }

  // Features that are implemented by all cvcs by default
  // Each cvc specifies what other features are available
  feature_states[f_cvc_active]->available = true;
  feature_states[f_cvc_gradient]->available = true;
  feature_states[f_cvc_scalable_com]->available = (proxy->scalable_group_coms() == COLVARS_OK);
  feature_states[f_cvc_scalable]->available = feature_states[f_cvc_scalable_com]->available;
}
Beispiel #2
0
void colvardeps::init_ag_requires() {
  size_t i;
  // Initialize static array once and for all
  if (features().size() == 0) {
    for (i = 0; i < f_ag_ntot; i++) {
      features().push_back(new feature);
    }

    f_description(f_ag_active, "active");
    f_description(f_ag_center, "translational fit");
    f_description(f_ag_rotate, "rotational fit");
    f_description(f_ag_fitting_group, "reference positions group");
    f_description(f_ag_fit_gradient_group, "fit gradient for main group");
    f_description(f_ag_fit_gradient_ref, "fit gradient for reference group");
    f_description(f_ag_atom_forces, "atomic forces");

    // parallel calculation implies that we have at least a scalable center of mass,
    // but f_ag_scalable is kept as a separate feature to deal with future dependencies
    f_description(f_ag_scalable, "scalable group calculation");
    f_description(f_ag_scalable_com, "scalable group center of mass calculation");
    f_req_self(f_ag_scalable, f_ag_scalable_com);

//     f_description(f_ag_min_msd_fit, "minimum MSD fit")
//     f_req_self(f_ag_min_msd_fit, f_ag_center)
//     f_req_self(f_ag_min_msd_fit, f_ag_rotate)
//     f_req_exclude(f_ag_min_msd_fit, f_ag_fitting_group)
  }

  // Initialize feature_states for each instance
  // default as unavailable, not enabled
  feature_states.reserve(f_ag_ntot);
  for (i = 0; i < colvardeps::f_ag_ntot; i++) {
    feature_states.push_back(new feature_state(false, false));
  }

  // Features that are implemented (or not) by all atom groups
  feature_states[f_ag_active]->available = true;
  // f_ag_scalable_com is provided by the CVC iff it is COM-based
  feature_states[f_ag_scalable_com]->available = false;
  // TODO make f_ag_scalable depend on f_ag_scalable_com (or something else)
  feature_states[f_ag_scalable]->available = true;
}
Beispiel #3
0
void colvardeps::init_cv_requires() {
  size_t i;
  if (features().size() == 0) {
    for (i = 0; i < f_cv_ntot; i++) {
      features().push_back(new feature);
    }

    f_description(f_cv_active, "active");
    f_req_children(f_cv_active, f_cvc_active);
    // Colvars must be either a linear combination, or scalar (and polynomial) or scripted
    f_req_alt3(f_cv_active, f_cv_scalar, f_cv_linear, f_cv_scripted);

    f_description(f_cv_gradient, "gradient");
    f_req_children(f_cv_gradient, f_cvc_gradient);

    f_description(f_cv_collect_gradient, "collect gradient");
    f_req_self(f_cv_collect_gradient, f_cv_gradient);
    f_req_self(f_cv_collect_gradient, f_cv_scalar);

    f_description(f_cv_fdiff_velocity, "fdiff_velocity");

    // System force: either trivial (spring force); through extended Lagrangian, or calculated explicitly
    f_description(f_cv_total_force, "total force");
    f_req_alt2(f_cv_total_force, f_cv_extended_Lagrangian, f_cv_total_force_calc);

    // Deps for explicit total force calculation
    f_description(f_cv_total_force_calc, "total force calculation");
    f_req_self(f_cv_total_force_calc, f_cv_scalar);
    f_req_self(f_cv_total_force_calc, f_cv_linear);
    f_req_children(f_cv_total_force_calc, f_cvc_inv_gradient);
    f_req_self(f_cv_total_force_calc, f_cv_Jacobian);

    f_description(f_cv_Jacobian, "Jacobian derivative");
    f_req_self(f_cv_Jacobian, f_cv_scalar);
    f_req_self(f_cv_Jacobian, f_cv_linear);
    f_req_children(f_cv_Jacobian, f_cvc_Jacobian);

    f_description(f_cv_hide_Jacobian, "hide Jacobian force");
    f_req_self(f_cv_hide_Jacobian, f_cv_Jacobian); // can only hide if calculated

    f_description(f_cv_extended_Lagrangian, "extended Lagrangian");

    f_description(f_cv_Langevin, "Langevin dynamics");
    f_req_self(f_cv_Langevin, f_cv_extended_Lagrangian);

    f_description(f_cv_linear, "linear");

    f_description(f_cv_scalar, "scalar");

    f_description(f_cv_output_energy, "output energy");

    f_description(f_cv_output_value, "output value");

    f_description(f_cv_output_velocity, "output velocity");
    f_req_self(f_cv_output_velocity, f_cv_fdiff_velocity);

    f_description(f_cv_output_applied_force, "output applied force");

    f_description(f_cv_output_total_force, "output total force");
    f_req_self(f_cv_output_total_force, f_cv_total_force);

    f_description(f_cv_subtract_applied_force, "subtract applied force from total force");
    f_req_self(f_cv_subtract_applied_force, f_cv_total_force);

    f_description(f_cv_lower_boundary, "lower boundary");
    f_req_self(f_cv_lower_boundary, f_cv_scalar);

    f_description(f_cv_upper_boundary, "upper boundary");
    f_req_self(f_cv_upper_boundary, f_cv_scalar);

    f_description(f_cv_grid, "grid");
    f_req_self(f_cv_grid, f_cv_lower_boundary);
    f_req_self(f_cv_grid, f_cv_upper_boundary);

    f_description(f_cv_lower_wall, "lower wall");
    f_req_self(f_cv_lower_wall, f_cv_lower_boundary);
    f_req_self(f_cv_lower_wall, f_cv_gradient);

    f_description(f_cv_upper_wall, "upper wall");
    f_req_self(f_cv_upper_wall, f_cv_upper_boundary);
    f_req_self(f_cv_upper_wall, f_cv_gradient);

    f_description(f_cv_runave, "running average");

    f_description(f_cv_corrfunc, "correlation function");

    // The features below are set programmatically
    f_description(f_cv_scripted, "scripted");
    f_description(f_cv_periodic, "periodic");
    f_description(f_cv_scalar, "scalar");
    f_description(f_cv_linear, "linear");
    f_description(f_cv_homogeneous, "homogeneous");
  }

  // Initialize feature_states for each instance
  feature_states.reserve(f_cv_ntot);
  for (i = 0; i < f_cv_ntot; i++) {
    feature_states.push_back(new feature_state(true, false));
    // Most features are available, so we set them so
    // and list exceptions below
   }

  // properties that may NOT be enabled as a dependency
  int unavailable_deps[] = {
    f_cv_lower_boundary,
    f_cv_upper_boundary,
    f_cv_extended_Lagrangian,
    f_cv_Langevin,
    f_cv_scripted,
    f_cv_periodic,
    f_cv_scalar,
    f_cv_linear,
    f_cv_homogeneous
  };
  for (i = 0; i < sizeof(unavailable_deps) / sizeof(unavailable_deps[0]); i++) {
    feature_states[unavailable_deps[i]]->available = false;
  }
}