| version 1.26 | version 1.27 |
|---|
| |
| /// -*- c++ -*- | // -*- c++ -*- |
| | |
| | // This file is part of the Collective Variables module (Colvars). |
| | // The original version of Colvars and its updates are located at: |
| | // https://github.com/colvars/colvars |
| | // Please update all Colvars source files before making any changes. |
| | // If you wish to distribute your changes, please submit them to the |
| | // Colvars repository at GitHub. |
| | |
| #include <errno.h> | #include <errno.h> |
| | |
| |
| | |
| log("Updating NAMD interface:\n"); | log("Updating NAMD interface:\n"); |
| | |
| | if (simparams->wrapAll) { |
| | cvm::log("Warning: enabling wrapAll can lead to inconsistent results " |
| | "for Colvars calculations: please disable wrapAll, " |
| | "as is the default option in NAMD.\n"); |
| | } |
| | |
| log("updating atomic data ("+cvm::to_str(atoms_ids.size())+" atoms).\n"); | log("updating atomic data ("+cvm::to_str(atoms_ids.size())+" atoms).\n"); |
| | |
| size_t i; | size_t i; |
| |
| | |
| cvm::increase_depth(); | cvm::increase_depth(); |
| for (int i = first; i <= last; i++) { | for (int i = first; i <= last; i++) { |
| | colvar *x = (*(cv->variables_active_smp()))[i]; |
| | int x_item = (*(cv->variables_active_smp_items()))[i]; |
| if (cvm::debug()) { | if (cvm::debug()) { |
| cvm::log("["+cvm::to_str(proxy->smp_thread_id())+"/"+cvm::to_str(proxy->smp_num_threads())+ | cvm::log("["+cvm::to_str(proxy->smp_thread_id())+"/"+cvm::to_str(proxy->smp_num_threads())+ |
| "]: calc_colvars_items_smp(), first = "+cvm::to_str(first)+ | "]: calc_colvars_items_smp(), first = "+cvm::to_str(first)+ |
| ", last = "+cvm::to_str(last)+", cv = "+ | ", last = "+cvm::to_str(last)+", cv = "+ |
| cv->colvars_smp[i]->name+", cvc = "+cvm::to_str(cv->colvars_smp_items[i])+"\n"); | x->name+", cvc = "+cvm::to_str(x_item)+"\n"); |
| } | } |
| cv->colvars_smp[i]->calc_cvcs(cv->colvars_smp_items[i], 1); | x->calc_cvcs(x_item, 1); |
| } | } |
| cvm::decrease_depth(); | cvm::decrease_depth(); |
| } | } |
| |
| int colvarproxy_namd::smp_colvars_loop() | int colvarproxy_namd::smp_colvars_loop() |
| { | { |
| colvarmodule *cv = this->colvars; | colvarmodule *cv = this->colvars; |
| CkLoop_Parallelize(calc_colvars_items_smp, 1, this, cv->colvars_smp.size(), 0, cv->colvars_smp.size()-1); | CkLoop_Parallelize(calc_colvars_items_smp, 1, this, |
| | cv->variables_active_smp()->size(), |
| | 0, cv->variables_active_smp()->size()-1); |
| return cvm::get_error(); | return cvm::get_error(); |
| } | } |
| | |
| |
| | |
| cvm::increase_depth(); | cvm::increase_depth(); |
| for (int i = first; i <= last; i++) { | for (int i = first; i <= last; i++) { |
| | colvarbias *b = (*(cv->biases_active()))[i]; |
| if (cvm::debug()) { | if (cvm::debug()) { |
| cvm::log("["+cvm::to_str(proxy->smp_thread_id())+"/"+cvm::to_str(proxy->smp_num_threads())+ | cvm::log("["+cvm::to_str(proxy->smp_thread_id())+"/"+cvm::to_str(proxy->smp_num_threads())+ |
| "]: calc_cv_biases_smp(), first = "+cvm::to_str(first)+ | "]: calc_cv_biases_smp(), first = "+cvm::to_str(first)+ |
| ", last = "+cvm::to_str(last)+", bias = "+ | ", last = "+cvm::to_str(last)+", bias = "+ |
| cv->biases[i]->name+"\n"); | b->name+"\n"); |
| } | } |
| cv->biases[i]->update(); | b->update(); |
| } | } |
| cvm::decrease_depth(); | cvm::decrease_depth(); |
| } | } |
| |
| int colvarproxy_namd::smp_biases_loop() | int colvarproxy_namd::smp_biases_loop() |
| { | { |
| colvarmodule *cv = this->colvars; | colvarmodule *cv = this->colvars; |
| CkLoop_Parallelize(calc_cv_biases_smp, 1, this, cv->biases.size(), 0, cv->biases.size()-1); | CkLoop_Parallelize(calc_cv_biases_smp, 1, this, |
| | cv->biases_active()->size(), 0, cv->biases_active()->size()-1); |
| return cvm::get_error(); | return cvm::get_error(); |
| } | } |
| | |
| |
| int colvarproxy_namd::smp_biases_script_loop() | int colvarproxy_namd::smp_biases_script_loop() |
| { | { |
| colvarmodule *cv = this->colvars; | colvarmodule *cv = this->colvars; |
| CkLoop_Parallelize(calc_cv_biases_smp, 1, this, cv->biases.size(), 0, cv->biases.size()-1, | CkLoop_Parallelize(calc_cv_biases_smp, 1, this, |
| | cv->biases_active()->size(), 0, cv->biases_active()->size()-1, |
| 1, NULL, CKLOOP_NONE, | 1, NULL, CKLOOP_NONE, |
| calc_cv_scripted_forces, 1, this); | calc_cv_scripted_forces, 1, this); |
| return cvm::get_error(); | return cvm::get_error(); |