Update Colvars library to version 2025-04-18
The following is a list of pull requests relevant to LAMMPS in the Colvars repository since 2024-08-06: - 752 New tool poisson_integrator_conv https://github.com/Colvars/colvars/pull/752 (@jhenin) - 733 Custom grids for all biases https://github.com/Colvars/colvars/pull/733 (@giacomofiorin, @jhenin) - 776 Avoid error in acos and asin with fast-math https://github.com/Colvars/colvars/pull/776 (@jhenin) - 773 fix: fix the clang build test failure of OPES https://github.com/Colvars/colvars/pull/773 (@HanatoK) - 768 fix: clamp the input values of asin and acos in case of fast math on aarch64 https://github.com/Colvars/colvars/pull/768 (@HanatoK) - 761 Add debug code for the Jacobi failure https://github.com/Colvars/colvars/pull/761 (@HanatoK) - 759 min_image fix; Saves long runs from crashes; https://github.com/Colvars/colvars/pull/759 (@PolyachenkoYA) - 757 Fix MSVC OpenMP issue https://github.com/Colvars/colvars/pull/757 (@HanatoK) - 755 Fix indentation of 'Init CVC' message in standard output https://github.com/Colvars/colvars/pull/755 (@jhenin) - 750 Optimize and simplify the calculation of dihedral gradients https://github.com/Colvars/colvars/pull/750 (@HanatoK) - 749 Add references to new Colvars paper https://github.com/Colvars/colvars/pull/749 (@jhenin, @giacomofiorin) - 740 Report the specific C++ standard at init time, stop warning about C++97/03 https://github.com/Colvars/colvars/pull/740 (@giacomofiorin) - 731 Improve detection of hard/mathematical boundaries https://github.com/Colvars/colvars/pull/731 (@giacomofiorin) - 729 Optimize the fit gradients https://github.com/Colvars/colvars/pull/729 (@HanatoK, @jhenin) - 728 Fix undefined behavior when getting the current working directory from std::filesystem https://github.com/Colvars/colvars/pull/728 (@giacomofiorin) - 727 Add patchversion scripting command https://github.com/Colvars/colvars/pull/727 (@giacomofiorin) - 724 Fix gradients and metric functions of distanceDir https://github.com/Colvars/colvars/pull/724 (@giacomofiorin) - 715 Add missing rotation in orientation component https://github.com/Colvars/colvars/pull/715 (@giacomofiorin) - 713 fix: try to solve #87 for non-scala components https://github.com/Colvars/colvars/pull/713 (@HanatoK) - 709 Implementation of OPES in Colvars https://github.com/Colvars/colvars/pull/709 (@HanatoK, @giacomofiorin, @jhenin) - 706 BUGFIX for Segmentation fault in colvarbias_meta::calc_energy() with useGrids off https://github.com/Colvars/colvars/pull/706 (@alphataubio) - 570 enable use of CVs defined by PyTorch neural network models https://github.com/Colvars/colvars/pull/570 (@zwpku, @giacomofiorin, @HanatoK, @jhenin) Authors: @alphataubio, @EzryStIago, @giacomofiorin, @HanatoK, @jhenin, @PolyachenkoYA, @zwpku
This commit is contained in:
@ -243,7 +243,7 @@ void colvarproxy_atom_groups::compute_max_atom_groups_applied_force()
|
||||
|
||||
colvarproxy_smp::colvarproxy_smp()
|
||||
{
|
||||
b_smp_active = true; // May be disabled by user option
|
||||
smp_mode = smp_mode_t::cvcs; // May be disabled by user option
|
||||
omp_lock_state = NULL;
|
||||
#if defined(_OPENMP)
|
||||
if (omp_get_thread_num() == 0) {
|
||||
@ -265,41 +265,45 @@ colvarproxy_smp::~colvarproxy_smp()
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int colvarproxy_smp::check_smp_enabled()
|
||||
{
|
||||
colvarproxy::smp_mode_t colvarproxy_smp::get_smp_mode() const {
|
||||
#if defined(_OPENMP)
|
||||
if (b_smp_active) {
|
||||
return COLVARS_OK;
|
||||
}
|
||||
return COLVARS_ERROR;
|
||||
return smp_mode;
|
||||
#else
|
||||
return COLVARS_NOT_IMPLEMENTED;
|
||||
return colvarproxy::smp_mode_t::none;
|
||||
#endif
|
||||
}
|
||||
|
||||
int colvarproxy_smp::set_smp_mode(smp_mode_t mode) {
|
||||
#if defined(_OPENMP)
|
||||
smp_mode = mode;
|
||||
return COLVARS_OK;
|
||||
#else
|
||||
if (mode != colvarproxy::smp_mode_t::none) {
|
||||
return COLVARS_NOT_IMPLEMENTED;
|
||||
} else {
|
||||
smp_mode = colvarproxy::smp_mode_t::none;
|
||||
}
|
||||
return COLVARS_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
int colvarproxy_smp::smp_colvars_loop()
|
||||
int colvarproxy_smp::smp_loop(int n_items, std::function<int (int)> const &worker)
|
||||
{
|
||||
int error_code = COLVARS_OK;
|
||||
#if defined(_OPENMP)
|
||||
colvarmodule *cv = cvm::main();
|
||||
colvarproxy *proxy = cv->proxy;
|
||||
cvm::increase_depth();
|
||||
#pragma omp parallel for
|
||||
for (int i = 0; i < static_cast<int>(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);
|
||||
for (int i = 0; i < n_items; i++) {
|
||||
int const retcode = worker(i);
|
||||
#pragma omp atomic
|
||||
error_code |= retcode;
|
||||
}
|
||||
return cvm::get_error();
|
||||
cvm::decrease_depth();
|
||||
#else
|
||||
return COLVARS_NOT_IMPLEMENTED;
|
||||
error_code |= COLVARS_NOT_IMPLEMENTED;
|
||||
#endif
|
||||
return error_code;
|
||||
}
|
||||
|
||||
|
||||
@ -470,8 +474,8 @@ colvarproxy::~colvarproxy()
|
||||
|
||||
bool colvarproxy::io_available()
|
||||
{
|
||||
return (check_smp_enabled() == COLVARS_OK && smp_thread_id() == 0) ||
|
||||
(check_smp_enabled() != COLVARS_OK);
|
||||
return ((get_smp_mode() != smp_mode_t::none) && smp_thread_id() == 0) ||
|
||||
(get_smp_mode() == smp_mode_t::none);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user