<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
      charset=windows-1252">
  </head>
  <body>
    <p>I did some more testing of the nlvdw package compiled with
      gfortran with .outputnlvdw having unit 6.  A nlvdw calculation
      runs fine.  It does appear to just be due to a deficiency of
      resources for my system.  Further details given below should you
      be interested in them.</p>
    <p>In gcc-7.4.0.tar.gz at [1], it can be seen in
      gcc/fortran/libgfortran.h that unit 6 and 5 are preconnected as
      standard output and standard input, respectively, from:<br>
    </p>
    <p>/* Default unit number for preconnected standard input and
      output.  */<br>
      #define GFC_STDIN_UNIT_NUMBER 5<br>
      #define GFC_STDOUT_UNIT_NUMBER 6<br>
      #define GFC_STDERR_UNIT_NUMBER 0<br>
    </p>
    <p>However, as stated at [2]:<br>
    </p>
    <p><i>Like any other preconnected unit it may have its connection
        changed in an open statement.</i><br>
    </p>
    <p>Indeed, the preconnection of unit 6 as standard output is
      overridden to write to the .outputnlvdw file instead by the open
      statement in WIEN2k's SRC_nlvdw/vdw.F (on line 87 when iunit=6):<br>
    </p>
    <p>      open (iunit,file=fname,status=status,form=form)<br>
    </p>
    <p>When I tried running Dr. Chakrabarti's alloy_VOPT.struct at [3]
      with "run_lapw -nlvdw", the .dayfile gave me a "Killed" error and
      .outputnlvdw was empty.</p>
    <p>When I ran it, I found it strange that .outputnlvdw was empty. 
      It turned out that gfortran buffers file output in memory by
      default such that the output was never written to the file when
      the program was killed.  I have found that the environmental
      variable GFORTRAN_UNBUFFERED_ALL can be set to 1 [4].  Using
      GFORTRAN_UNBUFFERED_ALL can slow down the small sequential reads
      and writes [5] but is obviously better for debugging and also got
      me passed what I previously reported that might be a gfortran bug
      with buffered file output when using unit 6.  As using a 'print
      *,iunit' statement to try to debug the above open statement in
      vdw.F printed to the .dayfile that files up to unit 5 were opened
      but never showed unit 6 and the later files from nlvdw.def
      opening.</p>
    <p>The calculation I ran made it to the same spot as Dr. Chakrabarti
      and expect the Ubuntu killed it due to insufficient RAM as Prof.
      Tran pointed out at [6].  The small resource Al calculation ran
      without errors though as shown below.<br>
    </p>
    <p><b>alloy_VOPT Calculation</b><br>
    </p>
    <p> <font color="#808080">username@computername:~/wiendata/alloy_VOPT$
        ls<br>
        alloy_VOPT.struct<br>
        username@computername:~/wiendata/alloy_VOPT$ init_lapw -b<br>
        ...<br>
        username@computername:~/wiendata/alloy_VOPT$ gedit
        alloy_VOPT.in0<br>
        username@computername:~/wiendata/alloy_VOPT$ cat alloy_VOPT.in0<br>
        TOT  XC_GGA_X_B86_R EC_LDA VC_LDA    
        (XC_LDA,XC_PBESOL,XC_WC,XC_MBJ,XC_SCAN)                        
        <br>
        NR2V      IFFT      (R2V)<br>
          144  144  144    2.00  1 NCON 9  # min IFFT-parameters,
        enhancement factor, iprint, NCON n<br>
        username@computername:~/wiendata/alloy_VOPT$ cp
        $WIENROOT/SRC_templates/case.innlvdw alloy_VOPT.innlvdw<br>
        username@computername:~/wiendata/alloy_VOPT$ gedit
        alloy_VOPT.innlvdw <br>
        username@computername:~/wiendata/alloy_VOPT$ cat
        alloy_VOPT.innlvdw <br>
        1              kernel type<br>
        -1.887         parameters of the kernel<br>
        25             plane-wave expansion cutoff GMAX<br>
        0.3            density cutoff rhoc<br>
        T              calculation of the potential (T or F)<br>
        10             plane-wave expansion cutoff GMAXpot for the
        potential<br>
        username@computername:~/wiendata/alloy_VOPT$ export
        GFORTRAN_UNBUFFERED_ALL=1<br>
        username@computername:~/wiendata/alloy_VOPT$ run_lapw -nlvdw<br>
        hup: Command not found.<br>
        grep: *scf1*: No such file or directory<br>
        grep: lapw2*.error: No such file or directory<br>
        <br>
        >   stop error<br>
        username@computername:~/wiendata/alloy_VOPT$ cat
        alloy_VOPT.dayfile <br>
        <br>
        Calculating alloy_VOPT in /home/username/wiendata/alloy_VOPT<br>
        on computername with PID 26433<br>
        using WIEN2k_19.1 (Release 25/6/2019) in /home/username/WIEN2k<br>
        <br>
        <br>
            start     (Sun Feb 23 17:47:33 MST 2020) with nlvdw (40/99
        to go)<br>
        <br>
            cycle 1     (Sun Feb 23 17:47:33 MST 2020)     (40/99 to go)<br>
        <br>
        >   nlvdw     (17:47:33) Killed<br>
        710.0u 58.6s 1:18:02.53 16.4% 0+0k 7490168+40io 262257pf+0w<br>
        error: command   /home/username/WIEN2k/nlvdw nlvdw.def   failed<br>
        <br>
        >   stop error<br>
        username@computername:~/wiendata/alloy_VOPT$ cat
        alloy_VOPT.outputnlvdw <br>
        kernel type =  1 (M. Dion et al., PRL 92, 246401 (2004))<br>
        parameter Z_ab of kernel =    -1.88700000<br>
        gmax =  25.0<br>
        density cutoff rhoc = 0.300E+00<br>
        the NL-vdW potential is calculated with gmax_pot =  10.0<br>
        <br>
        n_max, m_max, p_max =    101    101    101<br>
        ifft1, ifft2, ifft3 (for proc myid     0) =    203    203    203<br>
        ifft1*ifft2*ifft3 (for proc myid     0) =    8365427<br>
        Number of G-vectors (for proc myid     0) =    3099627<br>
        <br>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>
%                                                                      %<br>
        % You are using vdW-DF, which was implemented by the Thonhauser
        group. %<br>
        % Please cite the following two papers that made this
        development      %<br>
        % possible and the two reviews that describe the various
        versions:     %<br>
%                                                                      %<br>
        %   T. Thonhauser et al., PRL 115, 136402
        (2015).                      %<br>
        %   T. Thonhauser et al., PRB 76, 125112
        (2007).                       %<br>
        %   K. Berland et al., Rep. Prog. Phys. 78, 066501
        (2015).             %<br>
        %   D.C. Langreth et al., J. Phys.: Condens. Matter 21, 084203
        (2009). %<br>
%                                                                      %<br>
%                                                                      %<br>
        % If you are calculating the stress with vdW-DF, please also
        cite:     %<br>
%                                                                      %<br>
        %   R. Sabatini et al., J. Phys.: Condens. Matter 24, 424209
        (2012).   %<br>
%                                                                      %<br>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>
        <br>
        parameters of the kernel table:<br>
        Nq =  30, lambda = 0.111292E+01, q(1) = 0.100000E-04, q_cut =
        0.100000E+02<br>
        Nr_points =   2000, r_max =   100.0<br>
        q_mesh =<br>
             0.00001000     0.05312929     0.11224701     0.17804050<br>
             0.25126365     0.33275542     0.42344952     0.52438515<br>
             0.63671875     0.76173753     0.90087384     1.05572188<br>
             1.22805595     1.41985071     1.63330352     1.87086022<br>
             2.13524270     2.42948008     2.75694394     3.12138629<br>
             3.52698255     3.97838044     4.48075151     5.03985262<br>
             5.66208887     6.35459089     7.12529230     7.98302412<br>
             8.93761444    10.00000000</font><br>
    </p>
    <p><b>Al Calculation</b></p>
    <p><font color="#808080">username@computername:~/wiendata/Al$
        lsb_release -a<br>
        No LSB modules are available.<br>
        Distributor ID:    Ubuntu<br>
        Description:    Ubuntu 18.04.4 LTS<br>
        Release:    18.04<br>
        Codename:    bionic<br>
        username@computername:~/wiendata/Al$ cat
        $WIENROOT/WIEN2k_VERSION <br>
        WIEN2k_19.1 (Release 25/6/2019)<br>
        username@computername:~/wiendata/Al$ dpkg -l gfortran<br>
        Desired=Unknown/Install/Remove/Purge/Hold<br>
        |
Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend<br>
        |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)<br>
        ||/ Name           Version      Architecture Description<br>
+++-==============-============-============-=================================<br>
        ii  gfortran       4:7.4.0-1ubu amd64        GNU Fortran 95
        compiler<br>
        username@computername:~/wiendata/Al$ ls<br>
        Al.struct<br>
        username@computername:~/wiendata/Al$ init_lapw -b<br>
        ...<br>
        username@computername:~/wiendata/Al$ cp
        $WIENROOT/SRC_templates/case.innlvdw Al.innlvdw<br>
        <br>
        For rev-vdW-DF2:<br>
        <br>
        username@computername:~/wiendata/Al$ cat Al.innldvdw <br>
        1              kernel type<br>
        -1.887        parameters of the kernel<br>
        25             plane-wave expansion cutoff GMAX<br>
        0.3            density cutoff rhoc<br>
        T              calculation of the potential (T or F)<br>
        10             plane-wave expansion cutoff GMAXpot for the
        potential<br>
        username@computername:~/wiendata/Al$ cat Al.in0<br>
        TOT  XC_GGA_X_B86_R EC_LDA VC_LDA    
        (XC_LDA,XC_PBESOL,XC_WC,XC_MBJ,XC_SCAN)                        
        <br>
        NR2V      IFFT      (R2V)<br>
           30   30   30    2.00  1 NCON 9  # min IFFT-parameters,
        enhancement factor, iprint, NCON n<br>
        username@computername:~/wiendata/Al$ run_lapw -nlvdw<br>
        ...<br>
        in cycle 6    ETEST: .0003618600000000   CTEST: .0358926<br>
        hup: Command not found.<br>
        STOP  NLVDW END<br>
        STOP  LAPW0 END<br>
        STOP  LAPW1 END<br>
        STOP  LAPW2 END<br>
        STOP  CORE  END<br>
        STOP  MIXER END<br>
        ec cc and fc_conv 1 1 1<br>
        <br>
        >   stop</font><br>
    </p>
    [1] <a class="moz-txt-link-freetext" href="http://mirrors.ocf.berkeley.edu/gnu/gcc/gcc-7.4.0/">http://mirrors.ocf.berkeley.edu/gnu/gcc/gcc-7.4.0/</a><br>
    [2]
<a class="moz-txt-link-freetext" href="https://stackoverflow.com/questions/44867775/fortran-code-wont-write-to-file">https://stackoverflow.com/questions/44867775/fortran-code-wont-write-to-file</a><br>
    [3]
<a class="moz-txt-link-freetext" href="https://www.mail-archive.com/wien@zeus.theochem.tuwien.ac.at/msg19663.html">https://www.mail-archive.com/wien@zeus.theochem.tuwien.ac.at/msg19663.html</a><br>
    [4]
<a class="moz-txt-link-freetext" href="https://stackoverflow.com/questions/1533717/how-do-i-flush-output-to-file-after-each-write-with-a-gfortran-fortran-90-progra">https://stackoverflow.com/questions/1533717/how-do-i-flush-output-to-file-after-each-write-with-a-gfortran-fortran-90-progra</a><br>
    [5]
<a class="moz-txt-link-freetext" href="https://gcc.gnu.org/onlinedocs/gcc-7.4.0/gfortran/GFORTRAN_005fUNBUFFERED_005fALL.html">https://gcc.gnu.org/onlinedocs/gcc-7.4.0/gfortran/GFORTRAN_005fUNBUFFERED_005fALL.html</a><br>
    [6]
<a class="moz-txt-link-freetext" href="https://www.mail-archive.com/wien@zeus.theochem.tuwien.ac.at/msg19667.html">https://www.mail-archive.com/wien@zeus.theochem.tuwien.ac.at/msg19667.html</a>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 2/17/2020 3:16 AM, Peter Blaha
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:11496545-4020-6e13-8a7d-883e238b385c@theochem.tuwien.ac.at">But
      in nlvdw we do NOT write to the screen (except in case of some
      errors).
      <br>
      <br>
      In any case, please change nlvdw.def unit 6 to 66  and run nlvdw
      nlved.def to verify if this is the source of the problem.
      <br>
      It should print all output on the screen then.
      <br>
      <br>
      <br>
      On 2/16/20 6:39 PM, Gavin Abo wrote:
      <br>
      <blockquote type="cite">Perhaps it's just my system but the WIEN2k
        19.1 nlvdw, which has been compiled with gfortran (gcc version
        7.4.0 under Ubuntu 18.04.4 LTS), is behaving strangely.  It
        seems to get hung up trying to open $file.outputnlvdw in
        SCR_nlvdw/vdw.F.  In x_lapw, I see $file.outputnlvdw defined as
        unit 6.
        <br>
        <br>
        <br>
        It might be that use of unit 6 in the nlvdw package is
        problematic when compiled with gfortran similar to what we saw
        for SRC_symmetry:
        <br>
        <br>
        <br>
<a class="moz-txt-link-freetext" href="https://www.mail-archive.com/wien@zeus.theochem.tuwien.ac.at/msg16674.html">https://www.mail-archive.com/wien@zeus.theochem.tuwien.ac.at/msg16674.html</a><br>
      </blockquote>
    </blockquote>
  </body>
</html>