[QE-users] Fwd: [Pw_forum] how to collect dvscf files?

Noé Mascello mnoe at student.ethz.ch
Thu Nov 8 19:29:19 CET 2018


Hello

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.

Cheers,

Noé Mascello

ETH Zurich


_____________________________________________________________________________________
#!/bin/bash
#You need to run the script in the directory where the '_ph0' directory 
of the collected phonon calculations is located.
#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.

pf="prefix"

#get the number of irreducible q-points and representations
irr_qs=$(grep q-points ph_start.out | tail -n1 | grep -o [0-9]*)
for ((i=0; i < irr_qs; i++))
do
     q=$((i+1))
     irreps_el=$(grep -A1 "<NUMBER_IRR_REP" 
_ph0/${pf}.phsave/patterns.${q}.xml | tail -n1)
     irreps[$i]=$irreps_el
done

#combine the dvscf1 files bytewise for every q-point
for ((q=1; q <= irr_qs; q++))
do
i=$((q-1))
size_new=0
size_old=0
touch dvscf1_old

for ((r=1; r <= irreps[i]; r++))
do
if ((q==1))
then
size_new=$(ls -l q1_r${r}/_ph0/${pf}.dvscf1 | awk '{print $5}')
_count=$((size_new - size_old))
_skip=$((size_new - _count))
size_old=$size_new
dd if=q1_r${r}/_ph0/${pf}.dvscf1 of=dvscf1_temp skip=$_skip 
count=$_count iflag=skip_bytes,count_bytes
cat dvscf1_old dvscf1_temp > dvscf1_new
mv dvscf1_new dvscf1_old

else
size_new=$(ls -l q${q}_r${r}/_ph0/${pf}.q_${q}/${pf}.dvscf1 | awk 
'{print $5}')
_count=$((size_new - size_old))
_skip=$((size_new - _count))
size_old=$size_new
dd if=q${q}_r${r}/_ph0/{pf}.q_${q}/${pf}.dvscf1 of=dvscf1_temp 
skip=$_skip count=$_count iflag=skip_bytes,count_bytes
cat dvscf1_old dvscf1_temp > dvscf1_new
mv dvscf1_new dvscf1_old
fi
done

#move the combined dvscf files to the right location
if ((q==1))
then
mv dvscf1_old _ph0/${pf}.dvscf1
else
if [ ! -d _ph0/{pf}.q_${q} ]
then
mkdir _ph0/${pf}.q_${q}
fi
mv dvscf1_old _ph0/${pf}.q_${q}/{pf}.dvscf1
fi
done



More information about the users mailing list