fixed g_tune_pme to pass correctly boolean arguments to mdrun
authorSzilard Pall <pszilard@cbr.su.se>
Fri, 8 Apr 2011 22:23:34 +0000 (00:23 +0200)
committerSzilard Pall <pszilard@cbr.su.se>
Fri, 8 Apr 2011 22:23:34 +0000 (00:23 +0200)
src/tools/gmx_tune_pme.c

index 9702384cca949c4501ff776609cbbbd581dfa1de..f22d3080c3461ed0af5c49cbf9bdc5710c20a0ce 100644 (file)
@@ -1845,10 +1845,19 @@ static void create_command_line_snippets(
         /* Skip options not meant for mdrun */        
         if (!is_main_switch(opt))
         {
-            /* Print it to a string buffer, strip away trailing whitespaces that pa_val also returns: */
-            sprintf(strbuf2, "%s", pa_val(&pa[i],buf,BUFLENGTH));
-            rtrim(strbuf2);
-            sprintf(strbuf, "%s %s ", opt, strbuf2);
+            /* Boolean arguments need to be generated in the -[no]argname format */
+            if (pa[i].type == etBOOL)
+            {
+                sprintf(strbuf,"-%s%s ",*pa[i].u.b ? "" : "no",opt+1);
+            }
+            else
+            {
+                /* Print it to a string buffer, strip away trailing whitespaces that pa_val also returns: */
+                sprintf(strbuf2, "%s", pa_val(&pa[i],buf,BUFLENGTH));
+                rtrim(strbuf2);
+                sprintf(strbuf, "%s %s ", opt, strbuf2);
+            }
+
             /* We need the -np (or -nt) switch in a separate buffer - whether or not it was set! */
             if (0 == strcmp(opt,np_or_nt))
             {