From 6f261c135f0c934bfe7f012b7737f4883d33230d Mon Sep 17 00:00:00 2001 From: Szilard Pall Date: Wed, 12 May 2010 17:18:33 +0200 Subject: [PATCH] Fix in openmm_wrapper which makes it work with MSVC. Note that although this fix seems to solve the weird problem that appears only with MSVC, strictly speaking is not a fix as I have now idea why it works (and why it didn't work before). --- src/kernel/md_openmm.c | 2 ++ src/kernel/openmm_wrapper.cpp | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/kernel/md_openmm.c b/src/kernel/md_openmm.c index 2e5035a92a..ffccdd19ce 100644 --- a/src/kernel/md_openmm.c +++ b/src/kernel/md_openmm.c @@ -585,6 +585,8 @@ double do_md_openmm(FILE *fplog,t_commrec *cr,int nfile,const t_filenm fnm[], /* this is just make gs.sig compatible with the hack of sending signals around by MPI_Reduce with together with other floats */ + /* NOTE: this only works for serial code. For code that allows + MPI nodes to propagate their condition, see kernel/md.c*/ if ( gmx_get_stop_condition() == gmx_stop_cond_next_ns ) gs.set[eglsSTOPCOND]=1; if ( gmx_get_stop_condition() == gmx_stop_cond_next ) diff --git a/src/kernel/openmm_wrapper.cpp b/src/kernel/openmm_wrapper.cpp index d0812805d4..d0fa372e97 100644 --- a/src/kernel/openmm_wrapper.cpp +++ b/src/kernel/openmm_wrapper.cpp @@ -301,9 +301,11 @@ GmxOpenMMPlatformOptions::GmxOpenMMPlatformOptions(const char *optionString) */ string GmxOpenMMPlatformOptions::getOptionValue(const string &opt) { - if (options.find(toUpper(opt)) != options.end()) + map :: const_iterator it = options.find(toUpper(opt)); + if (it != options.end()) { - return options[toUpper(opt)]; + // cout << "@@@>> " << it->first << " : " << it->second << endl; + return it->second; } else { @@ -371,7 +373,13 @@ static void runMemtest(FILE* fplog, int devId, const char* pre_post, GmxOpenMMPl char strout_buf[STRLEN]; int which_test; int res = 0; - const char * test_type = opt->getOptionValue("memtest").c_str(); + string s = opt->getOptionValue("memtest"); + const char * test_type = + s.c_str(); + /* NOTE: thie code below for some misterious reason does NOT work + with MSVC, but the above "fix" seems to solve the problem - not sure why though */ + // opt->getOptionValue("memtest").c_str(); + if (!gmx_strcasecmp(test_type, "off")) { @@ -393,7 +401,7 @@ static void runMemtest(FILE* fplog, int devId, const char* pre_post, GmxOpenMMPl { gmx_fatal(FARGS, "Amount of seconds for memetest is negative (%d). ", which_test); } - + switch (which_test) { case 0: /* no memtest */ -- 2.11.4.GIT