Skip to content

Commit aa5af96

Browse files
giacomofiorinjhenin
authored andcommitted
Remove unused function parameter
1 parent 6866cd1 commit aa5af96

File tree

2 files changed

+18
-37
lines changed

2 files changed

+18
-37
lines changed

src/colvarbias_meta.cpp

+7-27
Original file line numberDiff line numberDiff line change
@@ -318,33 +318,15 @@ colvarbias_meta::~colvarbias_meta()
318318
{
319319
colvarbias_meta::clear_state_data();
320320
colvarproxy *proxy = cvm::main()->proxy;
321-
322321
proxy->close_output_stream(replica_hills_file);
323-
324322
proxy->close_output_stream(hills_traj_file_name());
325-
326-
if (target_dist) {
327-
delete target_dist;
328-
target_dist = NULL;
329-
}
330323
}
331324

332325

333326
int colvarbias_meta::clear_state_data()
334327
{
335-
if (hills_energy) {
336-
delete hills_energy;
337-
hills_energy = NULL;
338-
}
339-
340-
if (hills_energy_gradients) {
341-
delete hills_energy_gradients;
342-
hills_energy_gradients = NULL;
343-
}
344-
345328
hills.clear();
346329
hills_off_grid.clear();
347-
348330
return COLVARS_OK;
349331
}
350332

@@ -626,8 +608,7 @@ int colvarbias_meta::update_grid_data()
626608
{
627609
if ((cvm::step_absolute() % grids_freq) == 0) {
628610
// map the most recent gaussians to the grids
629-
project_hills(new_hills_begin, hills.end(),
630-
hills_energy, hills_energy_gradients);
611+
project_hills(new_hills_begin, hills.end(), hills_energy.get(), hills_energy_gradients.get());
631612
new_hills_begin = hills.end();
632613

633614
// TODO: we may want to condense all into one replicas array,
@@ -636,8 +617,8 @@ int colvarbias_meta::update_grid_data()
636617
for (size_t ir = 0; ir < replicas.size(); ir++) {
637618
replicas[ir]->project_hills(replicas[ir]->new_hills_begin,
638619
replicas[ir]->hills.end(),
639-
replicas[ir]->hills_energy,
640-
replicas[ir]->hills_energy_gradients);
620+
replicas[ir]->hills_energy.get(),
621+
replicas[ir]->hills_energy_gradients.get());
641622
replicas[ir]->new_hills_begin = replicas[ir]->hills.end();
642623
}
643624
}
@@ -962,8 +943,7 @@ void colvarbias_meta::project_hills(colvarbias_meta::hill_iter h_first,
962943

963944

964945
void colvarbias_meta::recount_hills_off_grid(colvarbias_meta::hill_iter h_first,
965-
colvarbias_meta::hill_iter h_last,
966-
colvar_grid_scalar * /* he */)
946+
colvarbias_meta::hill_iter h_last)
967947
{
968948
hills_off_grid.clear();
969949

@@ -1471,9 +1451,9 @@ void colvarbias_meta::rebin_grids_after_restart()
14711451
if (restart_keep_hills && !hills.empty()) {
14721452
// if there are hills, recompute the new grids from them
14731453
cvm::log("Rebinning the energy and forces grids from "+
1474-
cvm::to_str(hills.size())+" hills (this may take a while)...\n");
1475-
project_hills(hills.begin(), hills.end(),
1476-
new_hills_energy, new_hills_energy_gradients, true);
1454+
cvm::to_str(hills.size())+" hills (this may take a bit)...\n");
1455+
project_hills(hills.begin(), hills.end(), new_hills_energy.get(),
1456+
new_hills_energy_gradients.get(), true);
14771457
cvm::log("rebinning done.\n");
14781458

14791459
} else {

src/colvarbias_meta.h

+11-10
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
#include <iosfwd>
1616

1717
#include "colvarbias.h"
18-
#include "colvargrid.h"
18+
19+
class colvar_grid_scalar;
20+
class colvar_grid_gradient;
21+
1922

2023

2124
/// Metadynamics bias (implementation of \link colvarbias \endlink)
@@ -123,8 +126,7 @@ class colvarbias_meta
123126
hill_iter new_hills_off_grid_begin;
124127

125128
/// Regenerate the hills_off_grid list
126-
void recount_hills_off_grid(hill_iter h_first, hill_iter h_last,
127-
colvar_grid_scalar *ge);
129+
void recount_hills_off_grid(hill_iter h_first, hill_iter h_last);
128130

129131
template <typename OST> OST &write_hill_template_(OST &os, colvarbias_meta::hill const &h);
130132

@@ -211,7 +213,7 @@ class colvarbias_meta
211213
bool ebmeta;
212214

213215
/// Target distribution for EBmeta
214-
colvar_grid_scalar* target_dist;
216+
std::shared_ptr<colvar_grid_scalar> target_dist;
215217

216218
/// Number of equilibration steps for EBmeta
217219
cvm::step_number ebmeta_equil_steps;
@@ -223,15 +225,14 @@ class colvarbias_meta
223225
bool safely_read_restart;
224226

225227
/// Hill energy, cached on a grid
226-
colvar_grid_scalar *hills_energy;
228+
std::shared_ptr<colvar_grid_scalar> hills_energy;
227229

228230
/// Hill forces, cached on a grid
229-
colvar_grid_gradient *hills_energy_gradients;
231+
std::shared_ptr<colvar_grid_gradient> hills_energy_gradients;
230232

231-
/// \brief Project the selected hills onto grids
232-
void project_hills(hill_iter h_first, hill_iter h_last,
233-
colvar_grid_scalar *ge, colvar_grid_gradient *gf,
234-
bool print_progress = false);
233+
/// Project the selected hills onto grids
234+
void project_hills(hill_iter h_first, hill_iter h_last, colvar_grid_scalar *ge,
235+
colvar_grid_gradient *gf, bool print_progress = false);
235236

236237

237238
// Multiple Replicas variables and functions

0 commit comments

Comments
 (0)