Fix in openmm_wrapper which makes it work with MSVC.
authorSzilard Pall <pszilard@cbr.su.se>
Wed, 12 May 2010 15:18:33 +0000 (17:18 +0200)
committerSzilard Pall <pszilard@cbr.su.se>
Wed, 12 May 2010 15:18:33 +0000 (17:18 +0200)
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
src/kernel/openmm_wrapper.cpp

index 2e5035a92a574a8b91085826e542bef63d9413f7..ffccdd19ce28800d723cd9fe852c3b33a49fc050 100644 (file)
@@ -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 )
index d0812805d432908d397bdf7e8f0c22a5a40f551a..d0fa372e97393dd0a997ad92b9c2a5df81ff0f99 100644 (file)
@@ -301,9 +301,11 @@ GmxOpenMMPlatformOptions::GmxOpenMMPlatformOptions(const char *optionString)
  */
 string GmxOpenMMPlatformOptions::getOptionValue(const string &opt)
 {
-    if (options.find(toUpper(opt)) != options.end())
+       map<string, string> :: 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 */