version 1.13 | version 1.14 |
---|
| |
group->key = group_key; | group->key = group_key; |
| |
if (b_try_scalable) { | if (b_try_scalable) { |
if (is_available(f_cvc_scalable_com) && is_enabled(f_cvc_com_based)) { | if (is_available(f_cvc_scalable_com) |
| && is_enabled(f_cvc_com_based) |
| && !is_enabled(f_cvc_debug_gradient)) { |
enable(f_cvc_scalable_com); | enable(f_cvc_scalable_com); |
enable(f_cvc_scalable); | enable(f_cvc_scalable); |
// The CVC makes the feature available; | // The CVC makes the feature available; |
| |
| |
colvar::cvc::~cvc() | colvar::cvc::~cvc() |
{ | { |
| free_children_deps(); |
remove_all_children(); | remove_all_children(); |
for (size_t i = 0; i < atom_groups.size(); i++) { | for (size_t i = 0; i < atom_groups.size(); i++) { |
if (atom_groups[i] != NULL) delete atom_groups[i]; | if (atom_groups[i] != NULL) delete atom_groups[i]; |
| |
} | } |
| |
| |
void colvar::cvc::debug_gradients(cvm::atom_group *group) | void colvar::cvc::calc_fit_gradients() |
{ | { |
// this function should work for any scalar variable: | for (size_t ig = 0; ig < atom_groups.size(); ig++) { |
| atom_groups[ig]->calc_fit_gradients(); |
| } |
| } |
| |
| |
| void colvar::cvc::debug_gradients() |
| { |
| // this function should work for any scalar cvc: |
// the only difference will be the name of the atom group (here, "group") | // the only difference will be the name of the atom group (here, "group") |
// NOTE: this assumes that groups for this cvc are non-overlapping, | // NOTE: this assumes that groups for this cvc are non-overlapping, |
// since atom coordinates are modified only within the current group | // since atom coordinates are modified only within the current group |
| |
if (group->b_dummy) return; | cvm::log("Debugging gradients for " + description); |
| |
| for (size_t ig = 0; ig < atom_groups.size(); ig++) { |
| cvm::atom_group *group = atom_groups[ig]; |
| if (group->b_dummy) continue; |
| |
cvm::rotation const rot_0 = group->rot; | cvm::rotation const rot_0 = group->rot; |
cvm::rotation const rot_inv = group->rot.inverse(); | cvm::rotation const rot_inv = group->rot.inverse(); |
| |
| |
// print the values of the fit gradients | // print the values of the fit gradients |
if (group->b_rotate || group->b_center) { | if (group->b_rotate || group->b_center) { |
if (group->b_fit_gradients) { | if (group->is_enabled(f_ag_fit_gradients)) { |
size_t j; | size_t j; |
| |
// fit_gradients are in the simulation frame: we should print them in the rotated frame | // fit_gradients are in the simulation frame: we should print them in the rotated frame |
| |
} | } |
} | } |
| |
if ((group->b_fit_gradients) && (group->fitting_group != NULL)) { | if ((group->is_enabled(f_ag_fit_gradients)) && (group->fitting_group != NULL)) { |
cvm::atom_group *ref_group = group->fitting_group; | cvm::atom_group *ref_group = group->fitting_group; |
group->read_positions(); | group->read_positions(); |
group->calc_required_properties(); | group->calc_required_properties(); |
| |
cvm::log("Gradient sum: " + cvm::to_str(gradient_sum) + | cvm::log("Gradient sum: " + cvm::to_str(gradient_sum) + |
" Fit gradient sum: " + cvm::to_str(fit_gradient_sum) + | " Fit gradient sum: " + cvm::to_str(fit_gradient_sum) + |
" Total " + cvm::to_str(gradient_sum + fit_gradient_sum)); | " Total " + cvm::to_str(gradient_sum + fit_gradient_sum)); |
| } |
return; | return; |
} | } |
| |