-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-c-efield
135 lines (115 loc) · 3.32 KB
/
run-c-efield
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/bin/sh
# problem specific parameters
prefix='graphene'
pseudo_c='C.rel-pbe-n-kjpaw_psl.1.0.0.UPF'
ecutwfc=40.0
ecutrho=326.0
num_kx=10
num_ky=10
num_kz=1
num_bands=16
# electric field
efield='.TRUE.'
efield_amp=0.0d-2 # in atomic units. 1 a.u. = 36.3609*10^10 V/m
THIS_DIR=`pwd`
# check whether echo has the -e option
if test "`echo -e`" = "-e" ; then ECHO=echo ; else ECHO="echo -e" ; fi
$ECHO
$ECHO "Starting ab initio calculations for $prefix..."
$ECHO
# set quantum espresso and wannier90 paths
. qe-path
# set environment variables path
ENV_PATH=$QE_PATH/environment_variables
# set the needed environment variables
. $ENV_PATH
# override pseudopotential path
PSEUDO_DIR=$THIS_DIR/pseudo
# required executables, pseudopotentials, and directories
QE_BIN_LIST="pw.x bands.x"
PSEUDO_LIST="$pseudo_si"
TMP_ROOT_DIR="$THIS_DIR/temp"
TMP_DIR="$THIS_DIR/temp/$prefix-efield"
IN_DIR="$THIS_DIR/in"
OUT_ROOT_DIR="$THIS_DIR/out"
OUT_DIR="$THIS_DIR/out/$prefix-efield"
$ECHO
$ECHO " Quantum ESSPRESSO executables directory: $BIN_DIR"
$ECHO " Pseudopotentials directory: $PSEUDO_DIR"
$ECHO " Temporary directory: $TMP_DIR"
$ECHO "\n checking that needed directories and files exist...\c"
# check for directories
for DIR in "$BIN_DIR" "$PSEUDO_DIR" ; do
if test ! -d $DIR ; then
$ECHO
$ECHO "ERROR: $DIR not existent or not a directory"
$ECHO "Aborting"
exit 1
fi
done
for DIR in "$TMP_ROOT_DIR" "$TMP_DIR" "$OUT_ROOT_DIR" "$OUT_DIR" ; do
if test ! -d $DIR ; then
mkdir $DIR
fi
done
cd $OUT_DIR
# check for qe executables
for FILE in $QE_BIN_LIST ; do
if test ! -x $BIN_DIR/$FILE ; then
$ECHO
$ECHO "ERROR: $BIN_DIR/$FILE not existent or not executable"
$ECHO "Aborting"
exit 1
fi
done
# check for pseudopotentials
for FILE in $PSEUDO_LIST ; do
if test $? != 0; then
$ECHO
$ECHO "ERROR: $PSEUDO_DIR/$FILE not existent or not readable"
$ECHO "Aborting"
exit 1
fi
done
$ECHO " done"
# parallelization
PARA_PREFIX=""
# PARA_PREFIX="mpirun -np 4"
# how to run executables
PW_COMMAND="$PARA_PREFIX $BIN_DIR/pw.x $PARA_POSTFIX"
BANDS_COMMAND="$PARA_PREFIX $BIN_DIR/bands.x $PARA_POSTFIX"
$ECHO
$ECHO " running pw.x as: $PW_COMMAND"
$ECHO " running bands.x as: $BANDS_COMMAND"
$ECHO
$ECHO " running the initial scf calculation...\c"
swfc="'atomic+random'"
echo "Electric field: $efield_amp a.u."
. $IN_DIR/$prefix-efield.scf
$PW_COMMAND < $prefix.scf.in > $prefix.scf.out
check_failure $?
$ECHO " done"
swfc="'file'"
# for val in 1.4d-2 1.45d-2 1.5d-2 1.55d-2 1.6d-2 1.65d-2 1.7d-2
# for val in 0.2d-2 0.4d-2 0.6d-2 0.8d-2 1.0d-2 1.2d-2 1.4d-2 1.6d-2 1.8d-2 2.0d-2
for val in 0.02d-2 0.04d-2 0.06d-2 0.08d-2 0.10d-2 0.12d-2 0.14d-2 0.16d-2 0.18d-2 0.20d-2
do
efield_amp=$val
echo "Electric field: $efield_amp a.u."
. $IN_DIR/$prefix-efield.scf
$PW_COMMAND < $prefix.scf.in > $prefix.scf.out
check_failure $?
$ECHO " done"
done
# $ECHO " running the band calculation...\c"
# . $IN_DIR/$prefix.bands
# $PW_COMMAND < $prefix.bands.in > $prefix.bands.out
# check_failure $?
# $ECHO " done"
# $ECHO " Post processing bands...\c"
# . $IN_DIR/bands.post
# $BANDS_COMMAND < $prefix.bands.post.in > $prefix.bands.post.out
# check_failure $?
# $ECHO " done"
cd $THIS_DIR
# end of file