<div class="gmail_quote">(This is a re-send; I thought I already joined this forum before sending.)<br><br><font face="'courier new', monospace">Hi,<br><br>I found a trouble while running PWscf with long path names (e.g. wfcdir, or outdir), which I will explain below. I suffered the problem when running PWscf compiled with Intel Fortran (11 or 12, does not matter). I thought first that the problem was in the Intel Fortran itself, but it is not. Cf here:<br>
<br><a href="http://software.intel.com/en-us/forums/showthread.php?t=103025" target="_blank">http://software.intel.com/en-us/forums/showthread.php?t=103025</a><br><br>The root cause was the logic used in copying the input content in subroutine open_input_file_x() (file: Modules/open_close_input_file.f90). In official version 4.3.2 this correspond to lines 104-107 (some more lines printed below for context--it's the do while ...enddo block):<br>
<br> !<br> ! copy file<br> !<br> IF ( ierr == 0 ) THEN<br> lfound=.true.<br> dummy=""<br> do while (TRIM(dummy).ne."MAGICALME") ! LINE 104<br>
read(unit_loc,fmt='(A256)',END=10) dummy ! LINE 105<br> write(stdtmp,*) trim(dummy) ! LINE 106<br> enddo ! LINE 107<br><br>
<br><br>Two problems I noted here:<br><br>1) the write statement with no formatting is troublesome: it adds a white space at the beginning of each line. This manifests in the following symptom. One of my &CONTROL fields contain this line:<br>
<br>outdir = '/mnt/lustre/wirawan0/BIGFILES.runtime/.qe-HACK-MnO/AFM2/rh.1x1x1/qe/Opium-GFRG/vol12.98' ,<br><br>and PWscf, running this input, complains not being able to create subdir:<br><br>'/mnt/lustre/wirawan0/BIGFILES.runtime/.qe-HACK-MnO/AFM2/rh.1x1x1/qe/O pium-GFRG/vol12.98'<br>
<br>(notice stray whitespace between "O" and "pium"). Why is this? Because Intel Fortran library prepends a whitespace at each line of temporary input file (<a href="http://input_tmp.in" target="_blank">input_tmp.in</a>), and happily truncates the output line to 80 characters per line. Doing so, it continues the output in the next line (with an extra whitespace prepended *again*).</font><div>
<font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace">Long story short, what you should have used for line 106 in the code above is:</font></div><div><font face="'courier new', monospace"><br>
</font></div><div><span style="font-family:'courier new',monospace"> write(stdtmp,'(A)') trim(dummy)</span><br style="font-family:'courier new',monospace"><font face="'courier new', monospace"><br>
It would not prepend any whitespace, and it would not truncate the output line every 80 characters.<br><br><br>2) In PWscf, path strings (such as outdir above) have a maximum length of 256 characters. However, format width in line 105 above could prevent all 256 characters to be read properly. To avoid this potential problem, the fmt width above should be greater than 256. '(A512)' would be a safe bet (and set length of `dummy' string to 512 as well). Otherwise there can be unexpected problem with input line truncation.</font></div>
<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace">The following </font><span style="font-family:'courier new',monospace">suggestions err on safe side:</span></div>
<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace">3) If "-input" parameter argument is used, there is no need for input file copying. Why is it still copied anyway?</font></div>
<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace">4) Also, </font><span style="font-family:'courier new',monospace">the name of the temporary file should probably be other than "<a href="http://input_tmp.in" target="_blank">input_tmp.in</a>". It is better to use randomized filename (e.g. C function tmpnam or mkstemp) or make this file in "wfcdir" rather than current directory. This practice will get rid of possible race conditions or unintended overwriting of user's file by the same name.</span></div>
<div><font face="'courier new', monospace"><br></font></div><div><font face="'courier new', monospace">Thanks,<span class="HOEnZb"><font color="#888888"><br>-- <br>Wirawan Purwanto<br>Research Scientist<br>
College of William and Mary<br>Physics Department<br>
Williamsburg, VA 23187<br></font></span></font><br></div>
</div><br><br clear="all"><div><br></div>-- <br>Wirawan Purwanto<br>Research Scientist<br>College of William and Mary<br>Physics Department<br>Williamsburg, VA 23187<br>