Molecular Modeling Software
リビジョン | 4363e0e639c3270d08257d800118a051b08f641a (tree) |
---|---|
日時 | 2014-04-25 01:44:28 |
作者 | toshinagata1964 <toshinagata1964@a2be...> |
コミッター | toshinagata1964 |
Running GAMESS causes trouble when the temporary directory has a whitespace within the path string (not working yet)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/molby/trunk@531 a2be9bc6-48de-4e38-9406-05402d4bc13c
@@ -160,7 +160,7 @@ class Molecule | ||
160 | 160 | |
161 | 161 | # Prepare the scratch directory in the home directory |
162 | 162 | # (Not in the document home to avoid space-containing path in Windows) |
163 | - scrdir = $home_directory + "/Molby/gamess" | |
163 | + scrdir = $home_directory + "/Test Dir/Molby/gamess" # "Test Dir" for debug | |
164 | 164 | begin |
165 | 165 | mkdir_recursive(scrdir) |
166 | 166 | rescue |
@@ -187,7 +187,7 @@ class Molecule | ||
187 | 187 | # Get the host name etc. |
188 | 188 | hostname = backquote("hostname").chomp |
189 | 189 | if $platform == "win" |
190 | - s = backquote("cmd.exe /c dir #{scrdir}") | |
190 | + s = backquote("cmd.exe /c dir \"#{scrdir}\"") | |
191 | 191 | freebytes = s.split("\n").pop.match(/([0-9,]+)[^0-9]*$/).to_a[1] |
192 | 192 | if freebytes |
193 | 193 | freebytes = (freebytes.gsub(",","").to_i / 1024).to_s + " Kbytes" |
@@ -388,7 +388,7 @@ class Molecule | ||
388 | 388 | # File containing arguments to mpiexec |
389 | 389 | procfil = "#{scrprefix}.processes.mpd" |
390 | 390 | fp = File.open(procfil, "w") |
391 | - fp.print "-env ENVFIL #{envfil} -wdir #{scrdir} -n #{ncpus*2} #{gmsdir}#{sep}gamess.#{gmsvers}.exe\n" | |
391 | + fp.print "-env ENVFIL \"#{envfil}\" -wdir \"#{scrdir}\" -n #{ncpus*2} \"#{gmsdir}#{sep}gamess.#{gmsvers}.exe\"\n" | |
392 | 392 | fp.close |
393 | 393 | end |
394 | 394 | end |
@@ -493,13 +493,13 @@ class Molecule | ||
493 | 493 | if $platform == "win" |
494 | 494 | if gmsvers == "11" |
495 | 495 | hosts = "localhost " * ncpus |
496 | - cmdline = "cmd.exe /c \"#{gmsdir}/ddikick.exe #{gmsdir}/gamess.#{gmsvers}.exe #{inpbody} -ddi #{ncpus} #{ncpus} #{hosts} -scr #{scrdir} < NUL >>#{logname}\"" | |
496 | + cmdline = "cmd.exe /c \"#{gmsdir}/ddikick.exe #{gmsdir}/gamess.#{gmsvers}.exe #{inpbody} -ddi #{ncpus} #{ncpus} #{hosts} -scr \\\"#{scrdir}\\\" < NUL >>\\\"#{logname}\\\"" | |
497 | 497 | else |
498 | - cmdline = "cmd.exe /c \"mpiexec -configfile #{procfil} >>#{logname}\"" | |
498 | + cmdline = "cmd.exe /c \"mpiexec -configfile \\\"#{procfil}\\\" >>\\\"#{logname}\\\"" | |
499 | 499 | end |
500 | 500 | else |
501 | 501 | hosts = "localhost " * ncpus |
502 | - cmdline = "/bin/sh -c '#{gmsdir}/ddikick.x #{gmsdir}/gamess.#{gmsvers}.x #{inpbody} -ddi #{ncpus} #{ncpus} #{hosts} -scr #{scrdir} < /dev/null >>#{logname}'" | |
502 | + cmdline = "/bin/sh -c '\"#{gmsdir}/ddikick.x\" \"#{gmsdir}/gamess.#{gmsvers}.x\" #{inpbody} -ddi #{ncpus} #{ncpus} #{hosts} -scr \"#{scrdir}\" < /dev/null >>\"#{logname}\"'" | |
503 | 503 | end |
504 | 504 | |
505 | 505 | if mol |
@@ -1474,13 +1474,15 @@ MyApp::CallSubProcess(const char *cmdline, const char *procname, int (*callback) | ||
1474 | 1474 | |
1475 | 1475 | if (callback == DUMMY_CALLBACK) { |
1476 | 1476 | #if __WXMSW__ |
1477 | - /* Convert "\r\n" to "\n" */ | |
1478 | - char *p, *pend; | |
1479 | - p = pend = membuf + strlen(membuf); | |
1480 | - while (--p >= membuf) { | |
1481 | - if (*p == '\r') { | |
1482 | - memmove(p, p + 1, pend - p); | |
1483 | - pend--; | |
1477 | + if (membuf != NULL) { | |
1478 | + /* Convert "\r\n" to "\n" */ | |
1479 | + char *p, *pend; | |
1480 | + p = pend = membuf + strlen(membuf); | |
1481 | + while (--p >= membuf) { | |
1482 | + if (*p == '\r') { | |
1483 | + memmove(p, p + 1, pend - p); | |
1484 | + pend--; | |
1485 | + } | |
1484 | 1486 | } |
1485 | 1487 | } |
1486 | 1488 | #endif |