Skip to content

Commit

Permalink
Backport several changes in GROMACS 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomofiorin committed Jan 11, 2024
1 parent 5bb5611 commit f714a1a
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@
*/

#include "colvarproxygromacs.h"
#include "colvarproxy_gromacs_version.h"

#include <sstream>

#include "colvarproxy_gromacs_version.h"


namespace gmx
{
Expand All @@ -59,7 +60,7 @@ ColvarProxyGromacs::ColvarProxyGromacs(const std::string& colvarsConfigString,
gmxAtoms_(atoms), pbcType_(pbcType), logger_(logger), doParsing_(doParsing)
{
engine_name_ = "GROMACS";
version_int = get_version_from_string(COLVARPROXY_VERSION);
version_int = get_version_from_string(COLVARPROXY_VERSION);

//! From colvarproxy
//! The 5 variables below are defined in the `colvarproxy` base class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ void ColvarsOptions::writeInternalParametersToKvt(KeyValueTreeObjectBuilder tree
{

// Copy the content of the colvars input file into a string for latter save in KVT
colvarsConfigString_ = TextReader::readFileToString(colvarsFileName_);
if (!colvarsFileName_.empty())
{
colvarsConfigString_ = TextReader::readFileToString(colvarsFileName_);
}

// Write colvars input file as a string
treeBuilder.addValue<std::string>(c_colvarsModuleName + "-" + c_configStringTag_, colvarsConfigString_);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ class ColvarsOptions final : public IMdpOptionProvider

//! \}

//! Colvars config filename, default colvars.dat
std::string colvarsFileName_ = "colvars.dat";
//! Colvars config filename
std::string colvarsFileName_;


//! Colvars seed for Langevin integrator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ class ColvarsTest : public ::testing::Test
void addMdpOptionColvarsActive()
{
mdpValueBuilder_.rootObject().addValue("colvars-active", std::string("yes"));
mdpValueBuilder_.rootObject().addValue("colvars-filename", std::string("colvars.dat"));
}

//! build an mdp options tree that sets the options for the Colvars module
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
; Colvars bias
colvars-active = true
; colvars config file
colvars-configfile = colvars.dat
colvars-configfile =
; Colvars seed
colvars-seed = -1
</String>
Expand Down
2 changes: 2 additions & 0 deletions src/colvarmodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#ifndef COLVARMODULE_H
#define COLVARMODULE_H

#include <cstdint>

#include "colvars_version.h"

#ifndef COLVARS_DEBUG
Expand Down
6 changes: 3 additions & 3 deletions src/colvarproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ int colvarproxy_smp::smp_colvars_loop()
colvarmodule *cv = cvm::main();
colvarproxy *proxy = cv->proxy;
#pragma omp parallel for
for (size_t i = 0; i < cv->variables_active_smp()->size(); i++) {
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()) {
Expand All @@ -333,7 +333,7 @@ int colvarproxy_smp::smp_biases_loop()
#pragma omp parallel
{
#pragma omp for
for (size_t i = 0; i < cv->biases_active()->size(); i++) {
for (int i = 0; i < static_cast<int>(cv->biases_active()->size()); i++) {
colvarbias *b = (*(cv->biases_active()))[i];
if (cvm::debug()) {
cvm::log("Calculating bias \""+b->name+"\" on thread "+
Expand All @@ -360,7 +360,7 @@ int colvarproxy_smp::smp_biases_script_loop()
cv->calc_scripted_forces();
}
#pragma omp for
for (size_t i = 0; i < cv->biases_active()->size(); i++) {
for (int i = 0; i < static_cast<int>(cv->biases_active()->size()); i++) {
colvarbias *b = (*(cv->biases_active()))[i];
if (cvm::debug()) {
cvm::log("Calculating bias \""+b->name+"\" on thread "+
Expand Down

0 comments on commit f714a1a

Please sign in to comment.