Skip to content

Commit ac4132a

Browse files
committed
prevent div calculation before preparations
1 parent df27d7e commit ac4132a

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/colvargrid_integrate.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,6 +1022,7 @@ void colvargrid_integrate::prepare_calculations()
10221022
}
10231023
}
10241024
}
1025+
is_calculations_prepared = true;
10251026
}
10261027

10271028
cvm::real colvargrid_integrate::get_regularized_weight(std::vector<int> &ix)

src/colvargrid_integrate.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ class colvargrid_integrate : public colvar_grid_scalar {
4545
void set_weighted_div();
4646

4747
void set_div(){
48+
if (!is_calculations_prepared)
49+
prepare_calculations();
4850
if (weighted) set_weighted_div();
4951
else set_unweighted_div();
5052
};
@@ -106,6 +108,8 @@ class colvargrid_integrate : public colvar_grid_scalar {
106108
/// sets itself to number of available OpenMP threads
107109
size_t m_num_threads = 1;
108110

111+
bool is_calculations_prepared = false;
112+
109113
// Get G at a specific point where G is the gradient F if there is enough observation else it's F
110114
// multiplied by a coefficient < 1
111115
void get_regularized_grad(std::vector<cvm::real> &F, std::vector<int> &ix);

0 commit comments

Comments
 (0)