T2345: Replace instances of NULL with nullptr

Per guidance from Axel, revert lib/kokkos and lib/colvars
to remove nullptr changes.
This commit is contained in:
Anne Gunn
2020-09-11 08:53:44 -06:00
parent 9a5d8fd18b
commit f524fa758d
31 changed files with 196 additions and 196 deletions

View File

@ -36,7 +36,7 @@ colvarbias_meta::colvarbias_meta(char const *key)
: colvarbias(key), colvarbias_ti(key)
{
new_hills_begin = hills.end();
hills_traj_os = nullptr;
hills_traj_os = NULL;
hill_width = 0.0;
@ -45,8 +45,8 @@ colvarbias_meta::colvarbias_meta(char const *key)
use_grids = true;
grids_freq = 0;
rebin_grids = false;
hills_energy = nullptr;
hills_energy_gradients = nullptr;
hills_energy = NULL;
hills_energy_gradients = NULL;
dump_fes = true;
keep_hills = false;
@ -153,7 +153,7 @@ int colvarbias_meta::init(std::string const &conf)
get_keyval(conf, "keepHills", keep_hills, keep_hills);
get_keyval(conf, "keepFreeEnergyFiles", dump_fes_save, dump_fes_save);
if (hills_energy == nullptr) {
if (hills_energy == NULL) {
hills_energy = new colvar_grid_scalar(colvars);
hills_energy_gradients = new colvar_grid_gradient(colvars);
}
@ -262,7 +262,7 @@ int colvarbias_meta::init_well_tempered_params(std::string const &conf)
int colvarbias_meta::init_ebmeta_params(std::string const &conf)
{
// for ebmeta
target_dist = nullptr;
target_dist = NULL;
get_keyval(conf, "ebMeta", ebmeta, false);
if(ebmeta){
if (use_grids && expand_grids) {
@ -328,12 +328,12 @@ colvarbias_meta::~colvarbias_meta()
if (hills_traj_os) {
proxy->close_output_stream(hills_traj_file_name());
hills_traj_os = nullptr;
hills_traj_os = NULL;
}
if (target_dist) {
delete target_dist;
target_dist = nullptr;
target_dist = NULL;
}
}
@ -342,12 +342,12 @@ int colvarbias_meta::clear_state_data()
{
if (hills_energy) {
delete hills_energy;
hills_energy = nullptr;
hills_energy = NULL;
}
if (hills_energy_gradients) {
delete hills_energy_gradients;
hills_energy_gradients = nullptr;
hills_energy_gradients = NULL;
}
hills.clear();
@ -451,8 +451,8 @@ int colvarbias_meta::update()
error_code |= replica_share();
}
error_code |= calc_energy(nullptr);
error_code |= calc_forces(nullptr);
error_code |= calc_energy(NULL);
error_code |= calc_forces(NULL);
return error_code;
}
@ -593,7 +593,7 @@ int colvarbias_meta::update_bias()
std::vector<int> curr_bin = hills_energy->get_colvars_index();
hills_energy_sum_here = hills_energy->value(curr_bin);
} else {
calc_hills(new_hills_begin, hills.end(), hills_energy_sum_here, nullptr);
calc_hills(new_hills_begin, hills.end(), hills_energy_sum_here, NULL);
}
hills_scale *= cvm::exp(-1.0*hills_energy_sum_here/(bias_temperature*cvm::boltzmann()));
}
@ -887,14 +887,14 @@ void colvarbias_meta::project_hills(colvarbias_meta::hill_iter h_first,
std::vector<cvm::real> colvar_forces_scalar(num_variables());
std::vector<int> he_ix = he->new_index();
std::vector<int> hg_ix = (hg != nullptr) ? hg->new_index() : std::vector<int> (0);
std::vector<int> hg_ix = (hg != NULL) ? hg->new_index() : std::vector<int> (0);
cvm::real hills_energy_here = 0.0;
std::vector<colvarvalue> hills_forces_here(num_variables(), 0.0);
size_t count = 0;
size_t const print_frequency = ((hills.size() >= 1000000) ? 1 : (1000000/(hills.size()+1)));
if (hg != nullptr) {
if (hg != NULL) {
// loop over the points of the grid
for ( ;
@ -1310,8 +1310,8 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is)
hills_energy_gradients = new colvar_grid_gradient(colvars);
}
colvar_grid_scalar *hills_energy_backup = nullptr;
colvar_grid_gradient *hills_energy_gradients_backup = nullptr;
colvar_grid_scalar *hills_energy_backup = NULL;
colvar_grid_gradient *hills_energy_gradients_backup = NULL;
if (has_data) {
if (cvm::debug())
@ -1327,7 +1327,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is)
size_t const hills_energy_pos = is.tellg();
std::string key;
if (!(is >> key)) {
if (hills_energy_backup != nullptr) {
if (hills_energy_backup != NULL) {
delete hills_energy;
delete hills_energy_gradients;
hills_energy = hills_energy_backup;
@ -1343,7 +1343,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is)
is.seekg(hills_energy_pos, std::ios::beg);
grids_from_restart_file = false;
if (!rebin_grids) {
if (hills_energy_backup == nullptr)
if (hills_energy_backup == NULL)
cvm::fatal_error("Error: couldn't read the free energy grid for metadynamics bias \""+
this->name+"\""+
((comm != single_replica) ? ", replica \""+replica_id+"\"" : "")+
@ -1365,7 +1365,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is)
size_t const hills_energy_gradients_pos = is.tellg();
if (!(is >> key)) {
if (hills_energy_backup != nullptr) {
if (hills_energy_backup != NULL) {
delete hills_energy;
delete hills_energy_gradients;
hills_energy = hills_energy_backup;
@ -1381,7 +1381,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is)
is.seekg(hills_energy_gradients_pos, std::ios::beg);
grids_from_restart_file = false;
if (!rebin_grids) {
if (hills_energy_backup == nullptr)
if (hills_energy_backup == NULL)
cvm::fatal_error("Error: couldn't read the free energy gradients grid for metadynamics bias \""+
this->name+"\""+
((comm != single_replica) ? ", replica \""+replica_id+"\"" : "")+
@ -1406,7 +1406,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is)
this->name+"\""+
((comm != single_replica) ? ", replica \""+replica_id+"\"" : "")+"\n");
if (hills_energy_backup != nullptr) {
if (hills_energy_backup != NULL) {
// now that we have successfully updated the grids, delete the
// backup copies
if (cvm::debug())
@ -1594,7 +1594,7 @@ int colvarbias_meta::setup_output()
// TODO: one may want to specify the path manually for intricated filesystems?
char *pwd = new char[3001];
if (GETCWD(pwd, 3000) == nullptr)
if (GETCWD(pwd, 3000) == NULL)
cvm::fatal_error("Error: cannot get the path of the current working directory.\n");
replica_list_file =
(std::string(pwd)+std::string(PATHSEP)+
@ -1885,7 +1885,7 @@ int colvarbias_meta::reopen_replica_buffer_file()
{
int error_code = COLVARS_OK;
colvarproxy *proxy = cvm::proxy;
if (proxy->get_output_stream(replica_hills_file) != nullptr) {
if (proxy->get_output_stream(replica_hills_file) != NULL) {
error_code |= proxy->close_output_stream(replica_hills_file);
}
error_code |= proxy->remove_file(replica_hills_file);