Update Colvars to version 2017-10-11
Notable features are the umbrella-integration based free energy estimator for eABF, and the traditional thermodynamic integration estimator now available for umbrella sampling, SMD, metadynamics. Also included are several small fixes. Below is a list of relevant commits in the Colvars repository since the last update. 321d06a 2017-10-10 Add macros to manage colvarscript commands [Giacomo Fiorin] 26c3bec 2017-10-09 Document coming availability of Lepton in LAMMPS [Giacomo Fiorin] cc8f249 2017-10-04 Clarify that SMP depends on code build [Giacomo Fiorin] 0b2ffac 2017-10-04 Summarize colvar definition options, clarify some details [Giacomo Fiorin] 28002e0 2017-10-01 Separate writing of restart file from other output (e.g. PMFs) [Giacomo Fiorin] 92f7c1d 2017-10-01 Deprecate colvarsTrajAppend [Giacomo Fiorin] 12a707f 2017-09-26 Accurate Jacobian calculation for RMSD variants [Jérôme Hénin] fe389c9 2017-09-21 Allow subtractAppliedForce with extended-L again [Jérôme Hénin] c050ce0 2017-09-18 Silence compiler warnings, remove Tabs [Giacomo Fiorin] cb41905 2017-01-11 Add base class for TI estimator in other biases than ABF [Giacomo Fiorin] a1bc676 2017-09-14 Avoid writing to unopened traj file [Jérôme Hénin] b58d8cd 2017-09-08 Function to check for overlapping groups [Jérôme Hénin] 1e5efec 2017-09-07 Check for overlapping groups in coordNum [Jérôme Hénin] 03a61a4 2017-04-06 Add UI-based estimator [fhh2626] ae43754 2017-08-17 Fix outputCenters parsing [Josh Vermaas] 1619e0e 2017-08-14 Delete static feature arrays in cvm destructor [Jérôme Hénin]
This commit is contained in:
@ -10,6 +10,10 @@
|
||||
#include <sstream>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(_OPENMP)
|
||||
#include <omp.h>
|
||||
#endif
|
||||
|
||||
#include "colvarmodule.h"
|
||||
#include "colvarproxy.h"
|
||||
#include "colvarscript.h"
|
||||
@ -40,6 +44,12 @@ bool colvarproxy_system::total_forces_enabled() const
|
||||
}
|
||||
|
||||
|
||||
bool colvarproxy_system::total_forces_same_step() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
cvm::real colvarproxy_system::position_dist2(cvm::atom_pos const &pos1,
|
||||
cvm::atom_pos const &pos2)
|
||||
{
|
||||
@ -204,7 +214,13 @@ void colvarproxy_atom_groups::clear_atom_group(int index)
|
||||
|
||||
colvarproxy_smp::colvarproxy_smp()
|
||||
{
|
||||
b_smp_active = true;
|
||||
b_smp_active = true; // May be disabled by user option
|
||||
omp_lock_state = NULL;
|
||||
#if defined(_OPENMP)
|
||||
if (smp_thread_id() == 0) {
|
||||
omp_init_lock(reinterpret_cast<omp_lock_t *>(omp_lock_state));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -213,60 +229,143 @@ colvarproxy_smp::~colvarproxy_smp() {}
|
||||
|
||||
int colvarproxy_smp::smp_enabled()
|
||||
{
|
||||
#if defined(_OPENMP)
|
||||
if (b_smp_active) {
|
||||
return COLVARS_OK;
|
||||
}
|
||||
return COLVARS_ERROR;
|
||||
#else
|
||||
return COLVARS_NOT_IMPLEMENTED;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int colvarproxy_smp::smp_colvars_loop()
|
||||
{
|
||||
#if defined(_OPENMP)
|
||||
colvarmodule *cv = cvm::main();
|
||||
colvarproxy *proxy = cv->proxy;
|
||||
#pragma omp parallel for
|
||||
for (size_t i = 0; i < cv->variables_active_smp()->size(); i++) {
|
||||
colvar *x = (*(cv->variables_active_smp()))[i];
|
||||
int x_item = (*(cv->variables_active_smp_items()))[i];
|
||||
if (cvm::debug()) {
|
||||
cvm::log("["+cvm::to_str(proxy->smp_thread_id())+"/"+
|
||||
cvm::to_str(proxy->smp_num_threads())+
|
||||
"]: calc_colvars_items_smp(), i = "+cvm::to_str(i)+", cv = "+
|
||||
x->name+", cvc = "+cvm::to_str(x_item)+"\n");
|
||||
}
|
||||
x->calc_cvcs(x_item, 1);
|
||||
}
|
||||
return cvm::get_error();
|
||||
#else
|
||||
return COLVARS_NOT_IMPLEMENTED;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int colvarproxy_smp::smp_biases_loop()
|
||||
{
|
||||
#if defined(_OPENMP)
|
||||
colvarmodule *cv = cvm::main();
|
||||
#pragma omp parallel
|
||||
{
|
||||
#pragma omp for
|
||||
for (size_t i = 0; i < cv->biases_active()->size(); i++) {
|
||||
colvarbias *b = (*(cv->biases_active()))[i];
|
||||
if (cvm::debug()) {
|
||||
cvm::log("Calculating bias \""+b->name+"\" on thread "+
|
||||
cvm::to_str(smp_thread_id())+"\n");
|
||||
}
|
||||
b->update();
|
||||
}
|
||||
}
|
||||
return cvm::get_error();
|
||||
#else
|
||||
return COLVARS_NOT_IMPLEMENTED;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int colvarproxy_smp::smp_biases_script_loop()
|
||||
{
|
||||
#if defined(_OPENMP)
|
||||
colvarmodule *cv = cvm::main();
|
||||
#pragma omp parallel
|
||||
{
|
||||
#pragma omp single nowait
|
||||
{
|
||||
cv->calc_scripted_forces();
|
||||
}
|
||||
#pragma omp for
|
||||
for (size_t i = 0; i < cv->biases_active()->size(); i++) {
|
||||
colvarbias *b = (*(cv->biases_active()))[i];
|
||||
if (cvm::debug()) {
|
||||
cvm::log("Calculating bias \""+b->name+"\" on thread "+
|
||||
cvm::to_str(smp_thread_id())+"\n");
|
||||
}
|
||||
b->update();
|
||||
}
|
||||
}
|
||||
return cvm::get_error();
|
||||
#else
|
||||
return COLVARS_NOT_IMPLEMENTED;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int colvarproxy_smp::smp_thread_id()
|
||||
{
|
||||
#if defined(_OPENMP)
|
||||
return omp_get_thread_num();
|
||||
#else
|
||||
return COLVARS_NOT_IMPLEMENTED;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int colvarproxy_smp::smp_num_threads()
|
||||
{
|
||||
#if defined(_OPENMP)
|
||||
return omp_get_max_threads();
|
||||
#else
|
||||
return COLVARS_NOT_IMPLEMENTED;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int colvarproxy_smp::smp_lock()
|
||||
{
|
||||
#if defined(_OPENMP)
|
||||
omp_set_lock(reinterpret_cast<omp_lock_t *>(omp_lock_state));
|
||||
#endif
|
||||
return COLVARS_OK;
|
||||
}
|
||||
|
||||
|
||||
int colvarproxy_smp::smp_trylock()
|
||||
{
|
||||
#if defined(_OPENMP)
|
||||
return omp_test_lock(reinterpret_cast<omp_lock_t *>(omp_lock_state)) ?
|
||||
COLVARS_OK : COLVARS_ERROR;
|
||||
#else
|
||||
return COLVARS_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int colvarproxy_smp::smp_unlock()
|
||||
{
|
||||
#if defined(_OPENMP)
|
||||
omp_unset_lock(reinterpret_cast<omp_lock_t *>(omp_lock_state));
|
||||
#endif
|
||||
return COLVARS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
colvarproxy_replicas::colvarproxy_replicas() {}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user