<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p><font face="Times New Roman" color="#0000ff">See if the below
        simple test script helps.  It looks like the <font
          color="#ff0000">/</font> could be outputted if SCRATCH is
        blank.  Note that because of case sensitivity SCRATCH is
        different than scratch in the csh script.  It looks like the sed
        -e 's/<font color="#808000">\</font>/<font color="#800080">$/</font>/'`
        may be doing a substitution were <font color="#808000">\</font>
        is replaced by <font color="#800080">$/</font>, where the $
        seems to be the initial input string that is just <font
          color="#ff80ff">\</font> in the case below [1].<br>
      </font></p>
    <p><font face="Times New Roman">username@computername:~/Desktop/test$
        ls<br>
        test.sh<br>
        username@computername:~/Desktop/test$ cat test.sh<br>
        #!/bin/csh -f<br>
        <br>
        set scratch =<br>
        <br>
        if ( $?SCRATCH ) then<br>
          set scratch=`echo $SCRATCH  | sed -e 's/\/$//'`/ # we are
        afraid<br>
                                        # different settings in
        different<br>
                                        # computing centers<br>
                                        #use global variable for scratch
        if set<br>
          echo $scratch<br>
        endif<br>
        username@computername:~/Desktop/test$ export SCRATCH=./<br>
        username@computername:~/Desktop/test$ test.sh<br>
        ./<br>
        username@computername:~/Desktop/test$ export SCRATCH=<br>
        username@computername:~/Desktop/test$ test.sh<br>
        <font color="#ff0000">/</font><br>
        username@computername:~/Desktop/test$ export SCRATCH='<font
          color="#ff80ff">\</font>'<br>
        username@computername:~/Desktop/test$ test.sh<br>
        \/<br>
      </font></p>
    <p><font face="Times New Roman"></font>[1]
<a class="moz-txt-link-freetext" href="https://www.gnu.org/software/sed/manual/html_node/The-_0022s_0022-Command.html">https://www.gnu.org/software/sed/manual/html_node/The-_0022s_0022-Command.html</a><br>
    </p>
    <div class="moz-cite-prefix">On 11/13/2019 8:04 PM, Oleg Rubel
      wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:b9990dda-da27-9e98-8be8-6f79799fdfad@mcmaster.ca">P.S. I
      forgot to mention the version:
      <br>
      WIEN2k_19.1 (Release 25/6/2019)
      <br>
      <br>
      Oleg
      <br>
      <br>
      On 11/13/2019 10:01 PM, Oleg Rubel wrote:
      <br>
      <blockquote type="cite">Dear Wien2k community,
        <br>
        <br>
        I run into a problem when performing optics calculations in
        parallel mode (not MPI), hybrid with SOC. It is run for Si, but
        it is just a step stone to heavier materials where SOC really
        matters.
        <br>
        <br>
        Optics is executed as
        <br>
        <br>
        <blockquote type="cite">[rubel@gra690 optics]$ x optic -so  -hf
          -p
          <br>
          running OPTIC in parallel mode
          <br>
          [1] 4932
          <br>
           OPTIC END
          <br>
          [1]  + Done                          ( cd $PWD; $t $exe
          ${def}_${loop}.def; rm -f .lock_$lockfile[$p] ) >>
          .timeop_$loop
          <br>
          [1] 4937
          <br>
          ...
          <br>
             Summary of opticpara:
          <br>
             localhost     user=0  wallclock=203580
          <br>
          scratch=/
          <br>
          touch: cannot touch '/optics.symmat': Read-only file system
          <br>
          touch: cannot touch '/optics.mommat2': Read-only file system
          <br>
          touch: cannot touch '/optics.mat_diag': Read-only file system
          <br>
          touch: cannot touch '/optics.mme': Read-only file system
          <br>
          /optics.symmat: Read-only file system.
          <br>
          /optics.symma1: Read-only file system.
          <br>
          /optics.symma2: Read-only file system.
          <br>
          /optics.mat_diag: Read-only file system.
          <br>
          /optics.mme: Read-only file system.
          <br>
          rm: cannot remove '/optics.symmat_1': No such file or
          directory
          <br>
          rm: cannot remove '/optics.mat_diag_1': No such file or
          directory
          <br>
          rm: cannot remove '/optics.mme_1': No such file or directory
          <br>
          ...
          <br>
        </blockquote>
        <br>
        The output shows that optics actually ends OK, but the script
        gets stuck with results files pointing to the root directory "/"
        for some reason. Of course, I have no permission to write there.
        The same problem was reported earlier on the mailing list
        <br>
<a class="moz-txt-link-freetext" href="https://www.mail-archive.com/wien@zeus.theochem.tuwien.ac.at/msg17103.html">https://www.mail-archive.com/wien@zeus.theochem.tuwien.ac.at/msg17103.html</a>
        <br>
        <br>
        The problem is the value of "scratch" variable. I edited the
        file
        <br>
        <br>
        <blockquote type="cite">[rubel@gra690 optics]$ vim
          $WIENROOT/opticcpara
          <br>
        </blockquote>
        <br>
        to display the variable. As you can see in the output above, the
        value is "scratch=/" in spite of the fact that
        <br>
        <br>
        <blockquote type="cite">[rubel@gra690 optics]$ echo $SCRATCH
          <br>
          ./
          <br>
        </blockquote>
        <br>
        The workaround is to make changes in the file
        $WIENROOT/opticcpara
        <br>
        <br>
        <blockquote type="cite">if ( $?SCRATCH ) then
          <br>
            set scratch=`echo $SCRATCH  | sed -e 's/\/$//'`/ # we are
          afraid
          <br>
                                          # different settings in
          different
          <br>
                                          # computing centers
          <br>
                                          #use global variable for
          scratch if set
          <br>
            echo "scratch=$scratch" # OLEG
          <br>
            set scratch=$SCRATCH # OLEG
          <br>
          endif
          <br>
        </blockquote>
        <br>
        I am not sure what does the whole command with "sed ..." suppose
        to do? Why do we need to change $SCRATCH value? I tried in
        different shells
        <br>
        <br>
        <blockquote type="cite">[rubel@gra-login1 optics]$ scratch=`echo
          $SCRATCH  | sed -e 's/\/$//'`/
          <br>
          [rubel@gra-login1 optics]$ echo $scratch
          <br>
          ./
          <br>
          [rubel@gra-login1 optics]$ /bin/csh
          <br>
          [rubel@gra-login1 optics]$ set scratch=`echo $SCRATCH  | sed
          -e 's/\/$//'`/
          <br>
          [rubel@gra-login1 optics]$ echo $scratch
          <br>
          ./
          <br>
          [rubel@gra-login1 optics]$ echo $shell
          <br>
          /bin/tcsh
          <br>
        </blockquote>
        <br>
        I could not reproduce "/" in the command line, but in the script
        the value is different for some reason.
        <br>
        <br>
        Any thoughts are welcome :)
        <br>
        <br>
        Thank you in advance
        <br>
        Oleg
        <br>
      </blockquote>
    </blockquote>
  </body>
</html>