Skip to content
Open
4 changes: 2 additions & 2 deletions colvartools/poisson_integrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ int main (int argc, char *argv[]) {
proxy->cvmodule = new colvarmodule(proxy); // This could be omitted if we used the colvarproxy_stub class

std::string gradfile (argv[1]);
std::shared_ptr<colvar_grid_gradient> grad_ptr = std::make_shared<colvar_grid_gradient>(gradfile);
std::shared_ptr<colvar_grid_gradient> grad_ptr = std::make_shared<colvar_grid_gradient>(proxy->cvmodule, gradfile);
if (proxy->cvmodule->get_error()) { return -1; }

int itmax = 10000;
cvm::real err;
cvm::real tol = 1e-8;

colvargrid_integrate fes(grad_ptr);
colvargrid_integrate fes(proxy->cvmodule, grad_ptr);
fes.set_div();
fes.integrate(itmax, tol, err);
fes.set_zero_minimum();
Expand Down
6 changes: 3 additions & 3 deletions colvartools/poisson_integrator_conv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ int main (int argc, char *argv[]) {
proxy->cvmodule = new colvarmodule(proxy); // This could be omitted if we used the colvarproxy_stub class

std::string gradfile (argv[1]);
std::shared_ptr<colvar_grid_gradient> grad_ptr = std::make_shared<colvar_grid_gradient>(gradfile);
std::shared_ptr<colvar_grid_gradient> grad_ptr = std::make_shared<colvar_grid_gradient>(proxy->cvmodule, gradfile);
if (proxy->cvmodule->get_error()) { return -1; }

cvm::real err = 1.;
cvm::real tol = 1e-10;

colvargrid_integrate fes(grad_ptr);
colvargrid_integrate fes(proxy->cvmodule, grad_ptr);
fes.set_div();

// Load reference
colvar_grid_scalar ref(gradfile + ".ref");
colvar_grid_scalar ref(proxy->cvmodule, gradfile + ".ref");
if (proxy->cvmodule->get_error()) { return -1; }

if (ref.number_of_points() != fes.number_of_points()) {
Expand Down
2 changes: 1 addition & 1 deletion lammps/src/COLVARS/colvarproxy_lammps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ double colvarproxy_lammps::compute()
(_lmp->domain->triclinic == 0)) {
// Orthogonal unit cell
boundaries_type = boundaries_pbc_ortho;
colvarproxy_system::update_pbc_lattice();
colvarproxy::update_pbc_lattice();
// It is safer to let LAMMPS deal with high-tilt triclinic boxes
} else {
boundaries_type = boundaries_unsupported;
Expand Down
4 changes: 2 additions & 2 deletions misc_interfaces/C_fortran/C_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ int main() {

// Cannot yet call colvarscript without language interface
unsigned char cmd[][256] = {"", "version" };
run_colvarscript_command(1, (unsigned char **)(cmd));
const char *res = get_colvarscript_result();
run_colvarscript_command(proxy, 1, (unsigned char **)(cmd));
const char *res = get_colvarscript_result(proxy);
printf("Colvarscript claims it runs version %s\n", res);
return 0;
}
2 changes: 1 addition & 1 deletion misc_interfaces/C_fortran/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ COLVARS_LIB = ../../src/libcolvars.a
COLVARS_SRC_DIR = ../../src
IF_OBJ = colvarproxy_C.o

CXXFLAGS := -std=c++11 -pedantic -g -O2 -fPIC
CXXFLAGS := -std=c++17 -pedantic -g -O2 -fPIC

.PHONY: default $(COLVARS_LIB)

Expand Down
2 changes: 1 addition & 1 deletion misc_interfaces/C_fortran/colvarproxy_C.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ static colvarproxy* unique_colvarproxy_object;
colvarproxy_C::colvarproxy_C()
{
std::cerr << "This is the colvarproxy_C constructor at address " << this << std::endl;
colvars = new colvarmodule(this);
cvmodule = new colvarmodule(this);
cvmodule->log("This is the Module speaking.");
}

Expand Down
4 changes: 2 additions & 2 deletions misc_interfaces/C_fortran/colvarproxy_C_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ void call_proxy_member(void *proxy);
// Functions of this type should define a complete interface
// This could be based on colvarscript

int run_colvarscript_command(int objc, unsigned char *const objv[]);
const char * get_colvarscript_result();
int run_colvarscript_command(void *proxy_in, int objc, unsigned char *const objv[]);
const char * get_colvarscript_result(void *proxy_in);

#ifdef __cplusplus
}
Expand Down
16 changes: 8 additions & 8 deletions namd/cudaglobalmaster/colvarproxy_cudaglobalmaster.C
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public:
return smp_mode_t::none;
}
std::vector<smp_mode_t> get_available_smp_modes() const override {
std::vector<colvarproxy_smp::smp_mode_t> available_modes{
std::vector<colvarproxy::smp_mode_t> available_modes{
smp_mode_t::none,
smp_mode_t::gpu
};
Expand Down Expand Up @@ -351,9 +351,9 @@ void colvarproxy_impl::initialize_from_cudagm(
if (simParams->firstTimestep != 0) {
cvmodule->set_initial_step(static_cast<cvm::step_number>(simParams->firstTimestep));
}
colvarproxy_io::set_output_prefix(std::string(simParams->outputFilename));
colvarproxy_io::set_restart_output_prefix(std::string(simParams->restartFilename));
colvarproxy_io::set_default_restart_frequency(simParams->restartFrequency);
colvarproxy::set_output_prefix(std::string(simParams->outputFilename));
colvarproxy::set_restart_output_prefix(std::string(simParams->restartFilename));
colvarproxy::set_default_restart_frequency(simParams->restartFrequency);
}

// Copied from colvarproxy_namd.C
Expand Down Expand Up @@ -814,9 +814,9 @@ void colvarproxy_impl::calculate() {
// aware of this via the following flag
b_simulation_continuing = true;
// Update NAMD output and restart prefixes
colvarproxy_io::set_output_prefix(std::string(simParams->outputFilename));
colvarproxy_io::set_restart_output_prefix(std::string(simParams->restartFilename));
colvarproxy_io::set_default_restart_frequency(simParams->restartFrequency);
colvarproxy::set_output_prefix(std::string(simParams->outputFilename));
colvarproxy::set_restart_output_prefix(std::string(simParams->restartFilename));
colvarproxy::set_default_restart_frequency(simParams->restartFrequency);
cvmodule->setup_output();
}
}
Expand Down Expand Up @@ -1018,7 +1018,7 @@ void colvarproxy_impl::set_lattice() {
} else {
boundaries_type = boundaries_pbc_triclinic;
}
colvarproxy_system::update_pbc_lattice();
colvarproxy::update_pbc_lattice();
} else {
boundaries_type = boundaries_unsupported;
}
Expand Down
16 changes: 8 additions & 8 deletions namd/src/colvarproxy_namd.C
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ colvarproxy_namd::colvarproxy_namd(GlobalMasterColvars *gm)

// find the input state file
StringList *input_restart = Node::Object()->configList->find("colvarsInput");
colvarproxy_io::set_input_prefix(input_restart ? input_restart->data : "");
colvarproxy::set_input_prefix(input_restart ? input_restart->data : "");

update_target_temperature();
set_integration_timestep(simparams->dt);
Expand All @@ -94,9 +94,9 @@ colvarproxy_namd::colvarproxy_namd(GlobalMasterColvars *gm)
updated_masses_ = updated_charges_ = true;

// Take the output prefixes from the NAMD input
colvarproxy_io::set_output_prefix(std::string(simparams->outputFilename));
colvarproxy_io::set_restart_output_prefix(std::string(simparams->restartFilename));
colvarproxy_io::set_default_restart_frequency(simparams->restartFrequency);
colvarproxy::set_output_prefix(std::string(simparams->outputFilename));
colvarproxy::set_restart_output_prefix(std::string(simparams->restartFilename));
colvarproxy::set_default_restart_frequency(simparams->restartFrequency);

if (simparams->accelMDOn) {
accelMDOn = true;
Expand Down Expand Up @@ -376,9 +376,9 @@ void colvarproxy_namd::calculate()
b_simulation_continuing = true;

// Update NAMD output and restart prefixes
colvarproxy_io::set_output_prefix(std::string(simparams->outputFilename));
colvarproxy_io::set_restart_output_prefix(std::string(simparams->restartFilename));
colvarproxy_io::set_default_restart_frequency(simparams->restartFrequency);
colvarproxy::set_output_prefix(std::string(simparams->outputFilename));
colvarproxy::set_restart_output_prefix(std::string(simparams->restartFilename));
colvarproxy::set_default_restart_frequency(simparams->restartFrequency);
cvmodule->setup_output();

}
Expand Down Expand Up @@ -407,7 +407,7 @@ void colvarproxy_namd::calculate()
} else {
boundaries_type = boundaries_pbc_triclinic;
}
colvarproxy_system::update_pbc_lattice();
colvarproxy::update_pbc_lattice();
} else {
boundaries_type = boundaries_unsupported;
}
Expand Down
2 changes: 1 addition & 1 deletion namd/src/colvarproxy_namd.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class colvarproxy_namd : public colvarproxy {
return smp_mode_t::cvcs;
}
std::vector<smp_mode_t> get_available_smp_modes() const override {
std::vector<colvarproxy_smp::smp_mode_t> available_modes{
std::vector<colvarproxy::smp_mode_t> available_modes{
smp_mode_t::cvcs,
smp_mode_t::inner_loop,
smp_mode_t::none
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ifeq ($(CXX),)
CXX := g++
endif
ifeq ($(CXXFLAGS),)
CXXFLAGS := -std=c++11 -pedantic -g -O2 -fPIC
CXXFLAGS := -std=c++17 -pedantic -g -O2 -fPIC
ifneq ($(CXX),"CC")
CXXFLAGS += -Wall
endif
Expand Down
12 changes: 6 additions & 6 deletions src/colvar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#include "colvarcomp_torchann.h"
#include "colvarcomp_coordnums.h"

std::map<std::string, std::function<colvar::cvc *()>> colvar::global_cvc_map =
std::map<std::string, std::function<colvar::cvc *()>>();
std::map<std::string, std::function<colvar::cvc *(colvarmodule *cvmodule_in)>> colvar::global_cvc_map =
std::map<std::string, std::function<colvar::cvc *(colvarmodule *cvmodule_in)>>();

std::map<std::string, std::string> colvar::global_cvc_desc_map =
std::map<std::string, std::string>();
Expand Down Expand Up @@ -822,8 +822,8 @@ template <typename def_class_name>
void colvar::add_component_type(char const *def_description, char const *def_config_key)
{
if (global_cvc_map.count(def_config_key) == 0) {
global_cvc_map[def_config_key] = []() {
return new def_class_name();
global_cvc_map[def_config_key] = [](colvarmodule *cvmodule_in) {
return new def_class_name(cvmodule_in);
};
global_cvc_desc_map[def_config_key] = std::string(def_description);
}
Expand All @@ -845,7 +845,7 @@ int colvar::init_components_type(const std::string& conf, const char* def_config
"a new \""+std::string(def_config_key)+"\" component"+
(cvm::debug() ? ", with configuration:\n"+def_conf
: ".\n"));
cvc *cvcp = global_cvc_map[def_config_key]();
cvc *cvcp = global_cvc_map[def_config_key](cvmodule);
if (!cvcp) {
return cvmodule->error("Error: in creating object of type \"" + std::string(def_config_key) +
"\".\n",
Expand Down Expand Up @@ -1991,7 +1991,7 @@ void colvar::update_extended_Lagrangian()
// [O] leap to v_(i+1/2) (10c)
if (is_enabled(f_cv_Langevin)) {
colvarvalue rnd(x);
rnd.set_random();
rnd.set_random(this->cvmodule);
// ext_sigma has been computed at init time according to (10c)
v_ext = cvm::exp(- 1.0 * dt * ext_gamma) * v_ext + ext_sigma * rnd / ext_mass;
}
Expand Down
4 changes: 2 additions & 2 deletions src/colvar.h
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ class colvar : public colvardeps {
class map_total;

/// A global mapping of cvc names to the cvc constructors
static const std::map<std::string, std::function<colvar::cvc *()>> &get_global_cvc_map()
static const std::map<std::string, std::function<colvar::cvc *(colvarmodule *cvmodule_in)>> &get_global_cvc_map()
{
return global_cvc_map;
}
Expand Down Expand Up @@ -705,7 +705,7 @@ class colvar : public colvardeps {
#endif

/// A global mapping of cvc names to the cvc constructors
static std::map<std::string, std::function<colvar::cvc *()>> global_cvc_map;
static std::map<std::string, std::function<colvar::cvc *(colvarmodule *cvmodule_in)>> global_cvc_map;

/// A global mapping of cvc names to the corresponding descriptions
static std::map<std::string, std::string> global_cvc_desc_map;
Expand Down
Loading