[Pw_forum] Issues running PWscf with long path names

Wirawan Purwanto wxpurw at wm.edu
Wed Feb 15 04:36:52 CET 2012


(This is a re-send; I thought I already joined this forum before sending.)

Hi,

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:

http://software.intel.com/en-us/forums/showthread.php?t=103025

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):

       !
       ! copy file
       !
       IF ( ierr == 0 ) THEN
         lfound=.true.
         dummy=""
         do while (TRIM(dummy).ne."MAGICALME")         ! LINE 104
           read(unit_loc,fmt='(A256)',END=10) dummy    ! LINE 105
           write(stdtmp,*) trim(dummy)                 ! LINE 106
         enddo                                         ! LINE 107



Two problems I noted here:

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:

outdir =
'/mnt/lustre/wirawan0/BIGFILES.runtime/.qe-HACK-MnO/AFM2/rh.1x1x1/qe/Opium-GFRG/vol12.98'
,

and PWscf, running this input, complains not being able to create subdir:

'/mnt/lustre/wirawan0/BIGFILES.runtime/.qe-HACK-MnO/AFM2/rh.1x1x1/qe/O
pium-GFRG/vol12.98'

(notice stray whitespace between "O" and "pium"). Why is this? Because
Intel Fortran library prepends a whitespace at each line of temporary input
file (input_tmp.in), 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*).

Long story short, what you should have used for line 106 in the code above
is:

           write(stdtmp,'(A)') trim(dummy)

It would not prepend any whitespace, and it would not truncate the output
line every 80 characters.


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.


The following suggestions err on safe side:

3) If "-input" parameter argument is used, there is no need for input file
copying. Why is it still copied anyway?

4) Also, the name of the temporary file should probably be other than "
input_tmp.in". 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.

Thanks,
-- 
Wirawan Purwanto
Research Scientist
College of William and Mary
Physics Department
Williamsburg, VA 23187




-- 
Wirawan Purwanto
Research Scientist
College of William and Mary
Physics Department
Williamsburg, VA 23187
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.quantum-espresso.org/pipermail/users/attachments/20120214/a4ea8f6c/attachment.html>


More information about the users mailing list