quantum-espresso/examples/example22/run_example

237 lines
5.3 KiB
Bash
Executable File

#!/bin/sh
# run from directory where this script is
cd `echo $0 | sed 's/\(.*\)\/.*/\1/'` # extract pathname
EXAMPLE_DIR=`pwd`
# check whether echo has the -e option
if test "`echo -e`" = "-e" ; then ECHO=echo ; else ECHO="echo -e" ; fi
$ECHO
$ECHO "$EXAMPLE_DIR : starting"
$ECHO
$ECHO "This example shows how to use pwnc.x to calculate the total energy"
$ECHO "and the band structure of fcc-Pt with a fully relativistic "
$ECHO "pseudo-potential including spin-orbit coupling."
$ECHO "pwcond.x is used to calculate the complex bands"
$ECHO "including spin-orbit coupling."
# set the needed environment variables
. ../environment_variables
# required executables and pseudopotentials
BIN_LIST="pwnc.x pwcond.x"
PSEUDO_LIST="Ptrel.RRKJ3.UPF"
$ECHO
$ECHO " executables directory: $BIN_DIR"
$ECHO " pseudo directory: $PSEUDO_DIR"
$ECHO " temporary directory: $TMP_DIR"
$ECHO
$ECHO " 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_DIR" "$EXAMPLE_DIR/results" ; do
if test ! -d $DIR ; then
mkdir $DIR
fi
done
cd $EXAMPLE_DIR/results
# check for executables
for FILE in $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 ! -r $PSEUDO_DIR/$FILE ; then
$ECHO
$ECHO "ERROR: $PSEUDO_DIR/$FILE not existent or not readable"
$ECHO "Aborting"
exit 1
fi
done
$ECHO " done"
# how to run executables
PWNC_COMMAND="$PARA_PREFIX $BIN_DIR/pwnc.x $PARA_POSTFIX"
PWCOND_COMMAND="$PARA_PREFIX $BIN_DIR/pwcond.x $PARA_POSTFIX"
$ECHO
$ECHO " running pwnc.x as: $PWNC_COMMAND"
$ECHO " running pwcond.x as: $PWCOND_COMMAND"
$ECHO
# clean TMP_DIR
$ECHO " cleaning $TMP_DIR...\c"
rm -rf $TMP_DIR/*
$ECHO " done"
# self-consistent calculation
cat > pt.scf.in << EOF
Pt
Pt
&control
calculation = 'scf'
restart_mode='from_scratch',
prefix='Pt',
tprnfor = .true.
pseudo_dir = '$PSEUDO_DIR/',
outdir='$TMP_DIR/'
/
&system
ibrav= 2, celldm(1) =7.42, nat= 1, ntyp= 1,
lspinorb=.true.,
noncolin=.true.,
starting_magnetization=0.0,
occupations='smearing',
degauss=0.02,
smearing='mp',
ecutwfc =30.0,
ecutrho =250.0,
/
&electrons
mixing_beta = 0.7,
conv_thr = 1.0d-8
/
ATOMIC_SPECIES
Pt 79.90 Ptrel.RRKJ3.UPF
ATOMIC_POSITIONS
Pt 0.0000000 0.00000000 0.0
K_POINTS AUTOMATIC
4 4 4 1 1 1
EOF
$ECHO " running the scf calculation for Pt with spin-orbit coupling...\c"
$PWNC_COMMAND < pt.scf.in > pt.scf.out
$ECHO " done"
# a non self-consistent calculation
cat > pt.nscf.in << EOF
Pt
Pt
&control
calculation = 'nscf'
restart_mode='from_scratch',
prefix='Pt',
tprnfor = .true.
pseudo_dir = '$PSEUDO_DIR/',
outdir='$TMP_DIR/'
/
&system
ibrav= 2, celldm(1) =7.42, nat= 1, ntyp= 1,
lspinorb=.true.,
noncolin=.true.,
starting_magnetization=0.0,
occupations='smearing',
degauss=0.02,
smearing='mp',
ecutwfc =30.0,
ecutrho =250.0,
/
&electrons
mixing_beta = 0.7,
conv_thr = 1.0d-8
/
ATOMIC_SPECIES
Pt 79.90 Ptrel.RRKJ3.UPF
ATOMIC_POSITIONS
Pt 0.0000000 0.00000000 0.0
K_POINTS
11
0.0 0.0 0.0 0.0
0.0 0.0 0.1 0.1
0.0 0.0 0.2 0.2
0.0 0.0 0.3 0.3
0.0 0.0 0.4 0.4
0.0 0.0 0.5 0.5
0.0 0.0 0.6 0.6
0.0 0.0 0.7 0.7
0.0 0.0 0.8 0.8
0.0 0.0 0.9 0.9
0.0 0.0 1.0 1.0
EOF
$ECHO " running the non-scf calculation for Pt with spin-orbit coupling...\c"
$PWNC_COMMAND < pt.nscf.in > pt.nscf.out
$ECHO " done"
# a self-consistent calculation of Pt in a tetragonal cell
cat > pt.tet.in << EOF
&control
calculation='scf',
restart_mode='from_scratch',
pseudo_dir = '$PSEUDO_DIR/',
outdir='$TMP_DIR/',
prefix='ptt',
/
&system
ibrav = 6,
celldm(1) =5.23,
celldm(3) =1.4142,
nat= 2,
ntyp= 1,
noncolin=.true.,
lspinorb=.true.,
starting_magnetization(1)=0.0,
ecutwfc = 30.0,
ecutrho = 250.0,
occupations='smearing',
smearing='methfessel-paxton',
degauss=0.02
/
&electrons
conv_thr = 1.0e-8
mixing_beta = 0.7
/
ATOMIC_SPECIES
Pt 58.69 Ptrel.RRKJ3.UPF
ATOMIC_POSITIONS
Pt 0. 0. 0.
Pt 0.5 0.5 0.7071
K_POINTS (automatic)
4 4 3 1 1 1
EOF
$ECHO " running the scf calculation for Pt with tetragonal cell...\c"
$PWNC_COMMAND < pt.tet.in > pt.tet.out
$ECHO " done"
# Calculation of the complex bands of Pt
cat > pt.cond.in << EOF
&inputcond
outdir='$TMP_DIR/'
prefix='ptt'
band_file = 'bands.pt'
ikind=0
bdl1=0.0d0
bdl2=1.4142d0
energy0=0.0d0
denergy=-0.2d0
ewind=4.d0
llapack=.true.
epsproj=1.d-7
cutplot=2.d0
/
1
0.0 0.0 1.0
1
EOF
$ECHO " running the calculation of the complex bands of Pt...\c"
$PWCOND_COMMAND < pt.cond.in > pt.cond.out
$ECHO " done"
$ECHO
$ECHO "$EXAMPLE_DIR: done"