Skip to content

Commit

Permalink
Remove unused function parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomofiorin committed Oct 18, 2024
1 parent 31d6256 commit 617731a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 37 deletions.
34 changes: 7 additions & 27 deletions src/colvarbias_meta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,33 +318,15 @@ colvarbias_meta::~colvarbias_meta()
{
colvarbias_meta::clear_state_data();
colvarproxy *proxy = cvm::main()->proxy;

proxy->close_output_stream(replica_hills_file);

proxy->close_output_stream(hills_traj_file_name());

if (target_dist) {
delete target_dist;
target_dist = NULL;
}
}


int colvarbias_meta::clear_state_data()
{
if (hills_energy) {
delete hills_energy;
hills_energy = NULL;
}

if (hills_energy_gradients) {
delete hills_energy_gradients;
hills_energy_gradients = NULL;
}

hills.clear();
hills_off_grid.clear();

return COLVARS_OK;
}

Expand Down Expand Up @@ -626,8 +608,7 @@ int colvarbias_meta::update_grid_data()
{
if ((cvm::step_absolute() % grids_freq) == 0) {
// map the most recent gaussians to the grids
project_hills(new_hills_begin, hills.end(),
hills_energy, hills_energy_gradients);
project_hills(new_hills_begin, hills.end(), hills_energy.get(), hills_energy_gradients.get());
new_hills_begin = hills.end();

// TODO: we may want to condense all into one replicas array,
Expand All @@ -636,8 +617,8 @@ int colvarbias_meta::update_grid_data()
for (size_t ir = 0; ir < replicas.size(); ir++) {
replicas[ir]->project_hills(replicas[ir]->new_hills_begin,
replicas[ir]->hills.end(),
replicas[ir]->hills_energy,
replicas[ir]->hills_energy_gradients);
replicas[ir]->hills_energy.get(),
replicas[ir]->hills_energy_gradients.get());
replicas[ir]->new_hills_begin = replicas[ir]->hills.end();
}
}
Expand Down Expand Up @@ -962,8 +943,7 @@ void colvarbias_meta::project_hills(colvarbias_meta::hill_iter h_first,


void colvarbias_meta::recount_hills_off_grid(colvarbias_meta::hill_iter h_first,
colvarbias_meta::hill_iter h_last,
colvar_grid_scalar * /* he */)
colvarbias_meta::hill_iter h_last)
{
hills_off_grid.clear();

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

} else {
Expand Down
21 changes: 11 additions & 10 deletions src/colvarbias_meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
#include <iosfwd>

#include "colvarbias.h"
#include "colvargrid.h"

class colvar_grid_scalar;
class colvar_grid_gradient;



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

/// Regenerate the hills_off_grid list
void recount_hills_off_grid(hill_iter h_first, hill_iter h_last,
colvar_grid_scalar *ge);
void recount_hills_off_grid(hill_iter h_first, hill_iter h_last);

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

Expand Down Expand Up @@ -211,7 +213,7 @@ class colvarbias_meta
bool ebmeta;

/// Target distribution for EBmeta
colvar_grid_scalar* target_dist;
std::shared_ptr<colvar_grid_scalar> target_dist;

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

/// Hill energy, cached on a grid
colvar_grid_scalar *hills_energy;
std::shared_ptr<colvar_grid_scalar> hills_energy;

/// Hill forces, cached on a grid
colvar_grid_gradient *hills_energy_gradients;
std::shared_ptr<colvar_grid_gradient> hills_energy_gradients;

/// \brief Project the selected hills onto grids
void project_hills(hill_iter h_first, hill_iter h_last,
colvar_grid_scalar *ge, colvar_grid_gradient *gf,
bool print_progress = false);
/// Project the selected hills onto grids
void project_hills(hill_iter h_first, hill_iter h_last, colvar_grid_scalar *ge,
colvar_grid_gradient *gf, bool print_progress = false);


// Multiple Replicas variables and functions
Expand Down

0 comments on commit 617731a

Please sign in to comment.