Skip to content

Commit

Permalink
Only call calc_fit_gradients when atom groups have explicit gradients
Browse files Browse the repository at this point in the history
  • Loading branch information
HanatoK committed Oct 15, 2024
1 parent f9ade46 commit b56df96
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/colvarcomp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,8 +533,10 @@ void colvar::cvc::calc_Jacobian_derivative()

void colvar::cvc::calc_fit_gradients()
{
for (size_t ig = 0; ig < atom_groups.size(); ig++) {
atom_groups[ig]->calc_fit_gradients();
if (is_enabled(f_cvc_explicit_gradient)) {
for (size_t ig = 0; ig < atom_groups.size(); ig++) {
atom_groups[ig]->calc_fit_gradients();
}
}
}

Expand Down

0 comments on commit b56df96

Please sign in to comment.