Skip to content

Commit f4d9110

Browse files
committed
add subsubsamplewfnq.V3.sh
1 parent 59f9d79 commit f4d9110

File tree

1 file changed

+116
-0
lines changed

1 file changed

+116
-0
lines changed

Diff for: subsubsamplewfnq.V3.sh

+116
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
#!/bin/bash
2+
#SBATCH --partition=debug
3+
#SBATCH --nodes=10
4+
#SBATCH --time=00:30:00
5+
#SBATCH --job-name=my_job
6+
#SBATCH --license=SCRATCH
7+
#SBATCH -C haswell
8+
9+
# This script will submit several jobs to generate chi0mat.h5 for each subsampling qpoint
10+
# We need to setup template and cc_q0s.inp to proceed
11+
RUN="srun -n 320"
12+
iq_start=1
13+
iq_end=3
14+
NKPOOL=10
15+
DirTemplate="template"
16+
#Qfile="cc_q0s.inp"
17+
#DirWFNmq="/scratch1/03355/tg826544/InSe/semicore/6x6x1/WFNmq/"
18+
#FILE_WFNmq="WFNmq.h5"
19+
DirCurrent=$(pwd)
20+
for ((iq=${iq_start};iq<=${iq_end};iq++))
21+
do
22+
KPFILE=kpoints_wfnmq_${iq}.dat
23+
d1kvector=$(sed -n "3 p" ./klib/${KPFILE} | awk '{print $1}')
24+
d2kvector=$(sed -n "3 p" ./klib/${KPFILE} | awk '{print $2}')
25+
d3kvector=$(sed -n "3 p" ./klib/${KPFILE} | awk '{print $3}')
26+
echo "iq = ${iq} : ${d1kvector} ${d2kvector} ${d3kvector}"
27+
DirName="Q${iq}"
28+
if [ -d ${DirName} ]; then
29+
echo "${DirName} exist."
30+
else
31+
cp -r ${DirTemplate} ${DirName}
32+
fi
33+
cd $DirName
34+
35+
# QE calculation
36+
INPUT="QE.in"
37+
OUTPUT="QE.out"
38+
EXENAME="pw.x -nk ${NKPOOL}"
39+
cp ../klib/${KPFILE} ./KP.q
40+
41+
if [ -f "${OUTPUT}" ]; then
42+
if [ -z "$(grep "JOB DONE." ${OUTPUT})" ]; then
43+
echo "${OUTPUT} did not finish, restart ${EXENAME} calculation"
44+
DO_RUN_QE="T"
45+
else
46+
echo "Finished. Skip this ${EXENAME} calculation..."
47+
DO_RUN_QE="F"
48+
fi
49+
else
50+
DO_RUN_QE="T"
51+
fi
52+
53+
if [ ${DO_RUN_QE} == "T" ]; then
54+
echo "Start ${EXENAME} calculation"
55+
qassemble.sh
56+
# sleep 2
57+
# ${RUN} ${EXENAME} < ${INPUT} > ${OUTPUT} 2>&1
58+
# if [ ! -z "$(grep "TOTAL:" ${OUTPUT})" ]; then
59+
# echo "Finish ${EXENAME} calculation"
60+
# fi
61+
fi
62+
63+
# PW2BGW calculation
64+
INPUT="pw2bgw.inp"
65+
sed -i "/^ wfng_dk1 =/c\ wfng_dk1 = ${d1kvector}" pw2bgw.inp
66+
sed -i "/^ wfng_dk2 =/c\ wfng_dk2 = ${d2kvector}" pw2bgw.inp
67+
sed -i "/^ wfng_dk3 =/c\ wfng_dk3 = ${d3kvector}" pw2bgw.inp
68+
69+
OUTPUT="pw2bgw.out"
70+
EXENAME="pw2bgw.x -nk 1"
71+
72+
if [ ${DO_RUN_QE} == "F" ]; then
73+
if [ -f "${OUTPUT}" ]; then
74+
if [ -z "$(grep "JOB DONE." ${OUTPUT})" ]; then
75+
echo "${OUTPUT} did not finish, restart ${EXENAME} calculation"
76+
DO_RUN="T"
77+
else
78+
echo "Finished. Skip this ${EXENAME} calculation..."
79+
DO_RUN="F"
80+
fi
81+
else
82+
DO_RUN="T"
83+
fi
84+
else
85+
echo "QE is fresh, do pw2bgw anyway."
86+
DO_RUN="T"
87+
fi
88+
89+
if [ ${DO_RUN} == "T" ]; then
90+
echo "Start ${EXENAME} calculation"
91+
# ${RUN} ${EXENAME} < ${INPUT} > ${OUTPUT} 2>&1
92+
# if [ ! -z "$(grep "TOTAL:" ${OUTPUT})" ]; then
93+
# echo "Finish ${EXENAME} calculation"
94+
# fi
95+
fi
96+
97+
# # WFN2HDF calculation
98+
# OUTPUT="wfn2hdf.out"
99+
# EXENAME="wfn2hdf.x BIN WFN WFN.h5"
100+
101+
# if [ -f "${OUTPUT}" ]; then
102+
# if [ -z "$(grep "JOB DONE." ${OUTPUT})" ]; then
103+
# echo "${OUTPUT} did not finish, restart ${EXENAME} calculation"
104+
# DO_RUN="T"
105+
# else
106+
# echo "Finished. Skip this ${EXENAME} calculation..."
107+
# DO_RUN="F"
108+
# fi
109+
# else
110+
# DO_RUN="T"
111+
# fi
112+
113+
echo "============================="
114+
115+
cd ${DirCurrent}
116+
done

0 commit comments

Comments
 (0)