<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    This was meant as a reply to this thread:
<a class="moz-txt-link-freetext" href="https://www.mail-archive.com/users@lists.quantum-espresso.org/msg33771.html">https://www.mail-archive.com/users@lists.quantum-espresso.org/msg33771.html</a><br>
    Sorry about that.<br>
    <u><span class="sender pipe"><a
href="https://www.mail-archive.com/search?l=users@lists.quantum-espresso.org&q=from:%22Lorenzo+Paulatto%22"
          rel="nofollow"><span itemprop="author" itemscope=""
            itemtype="http://schema.org/Person"><span itemprop="name"></span></span></a></span></u>
    <br>
____________________________________________________________________________________________________<br>
    <br>
    <div class="moz-cite-prefix">Am 08.11.2018 um 18:29 schrieb Noé
      Mascello:<br>
    </div>
    <blockquote type="cite"
      cite="mid:cfd60574-0b92-c11c-5a6b-9b743daae420@student.ethz.ch">Hello
      <br>
      <br>
      I had the same problem i.e. combining the dvscf files of
      calculations that were split into calculations of irreducible
      representations. Since there was no conclusion, I just wanted to
      say that the solution as suggested by Lorenzo Paulatto works. I
      have attached a small script below that can be used as inspiration
      if confroted with the same problem. It should work for any general
      case. I have checked the integrity of the combined dvscf files by
      running EPW calculations with them and comparing the results to a
      case where the phonon calculations have not been split into
      calculations of irreducible representations. This yielded the same
      results. The dvscf files are however different to the dvscf files
      obtained when the calculation is not split into calculation of
      irreducible q-points or not split at all. I don't quite understand
      that and one should probably check it oneself.
      <br>
      <br>
      Cheers,
      <br>
      <br>
      Noé Mascello
      <br>
      <br>
      ETH Zurich
      <br>
      <br>
      <br>
_____________________________________________________________________________________
      <br>
      #!/bin/bash
      <br>
      #You need to run the script in the directory where the '_ph0'
      directory of the collected phonon calculations is located.
      <br>
      #Furthermore the directories of the separate phonon calculations
      are named 'q${q}_r${r}' where ${q} is the number of the
      irreducible q-point and ${r} is the number of a corresponding
      representation.
      <br>
      <br>
      pf="prefix"
      <br>
      <br>
      #get the number of irreducible q-points and representations
      <br>
      irr_qs=$(grep q-points ph_start.out | tail -n1 | grep -o [0-9]*)
      <br>
      for ((i=0; i < irr_qs; i++))
      <br>
      do
      <br>
          q=$((i+1))
      <br>
          irreps_el=$(grep -A1 "<NUMBER_IRR_REP"
      _ph0/${pf}.phsave/patterns.${q}.xml | tail -n1)
      <br>
          irreps[$i]=$irreps_el
      <br>
      done
      <br>
      <br>
      #combine the dvscf1 files bytewise for every q-point
      <br>
      for ((q=1; q <= irr_qs; q++))
      <br>
      do
      <br>
      i=$((q-1))
      <br>
      size_new=0
      <br>
      size_old=0
      <br>
      touch dvscf1_old
      <br>
      <br>
      for ((r=1; r <= irreps[i]; r++))
      <br>
      do
      <br>
      if ((q==1))
      <br>
      then
      <br>
      size_new=$(ls -l q1_r${r}/_ph0/${pf}.dvscf1 | awk '{print $5}')
      <br>
      _count=$((size_new - size_old))
      <br>
      _skip=$((size_new - _count))
      <br>
      size_old=$size_new
      <br>
      dd if=q1_r${r}/_ph0/${pf}.dvscf1 of=dvscf1_temp skip=$_skip
      count=$_count iflag=skip_bytes,count_bytes
      <br>
      cat dvscf1_old dvscf1_temp > dvscf1_new
      <br>
      mv dvscf1_new dvscf1_old
      <br>
      <br>
      else
      <br>
      size_new=$(ls -l q${q}_r${r}/_ph0/${pf}.q_${q}/${pf}.dvscf1 | awk
      '{print $5}')
      <br>
      _count=$((size_new - size_old))
      <br>
      _skip=$((size_new - _count))
      <br>
      size_old=$size_new
      <br>
      dd if=q${q}_r${r}/_ph0/{pf}.q_${q}/${pf}.dvscf1 of=dvscf1_temp
      skip=$_skip count=$_count iflag=skip_bytes,count_bytes
      <br>
      cat dvscf1_old dvscf1_temp > dvscf1_new
      <br>
      mv dvscf1_new dvscf1_old
      <br>
      fi
      <br>
      done
      <br>
      <br>
      #move the combined dvscf files to the right location
      <br>
      if ((q==1))
      <br>
      then
      <br>
      mv dvscf1_old _ph0/${pf}.dvscf1
      <br>
      else
      <br>
      if [ ! -d _ph0/{pf}.q_${q} ]
      <br>
      then
      <br>
      mkdir _ph0/${pf}.q_${q}
      <br>
      fi
      <br>
      mv dvscf1_old _ph0/${pf}.q_${q}/{pf}.dvscf1
      <br>
      fi
      <br>
      done
      <br>
      <br>
      _______________________________________________
      <br>
      users mailing list
      <br>
      <a class="moz-txt-link-abbreviated" href="mailto:users@lists.quantum-espresso.org">users@lists.quantum-espresso.org</a>
      <br>
      <a class="moz-txt-link-freetext" href="https://lists.quantum-espresso.org/mailman/listinfo/users">https://lists.quantum-espresso.org/mailman/listinfo/users</a><br>
    </blockquote>
    <br>
  </body>
</html>