Você está na página 1de 4

#!

/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
# function to test the exit status of a job
. ../check_failure.sh
$ECHO
$ECHO "$EXAMPLE_DIR : starting"
$ECHO
$ECHO "This example shows how to use pw.x and ph.x to calculate phonon"
$ECHO "frequencies at Gamma and X for InSb"
# set the needed environment variables
. ../environment_variables
# required executables and pseudopotentials
BIN_LIST="pw.x ph.x"
PSEUDO_LIST="In.pbe-hgh.UPF Sb.pbe-hgh.UPF"
$ECHO
$ECHO
$ECHO
$ECHO
$ECHO
$ECHO

" executables directory: $BIN_DIR"


" pseudo directory:
$PSEUDO_DIR"
" temporary directory: $TMP_DIR"
" 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
PW_COMMAND="$PARA_PREFIX $BIN_DIR/pw.x $PARA_POSTFIX"
PH_COMMAND="$PARA_PREFIX $BIN_DIR/ph.x $PARA_POSTFIX"
$ECHO
$ECHO " running pw.x as: $PW_COMMAND"
$ECHO " running ph.x as: $PH_COMMAND"
$ECHO
# clean TMP_DIR
$ECHO " cleaning $TMP_DIR...\c"
rm -rf $TMP_DIR/*
$ECHO " done"
# self-consistent calculation
cat > insb.scf.in << EOF
&control
calculation='scf',
restart_mode='from_scratch',
prefix='insb'
pseudo_dir = '$PSEUDO_DIR/',
outdir='$TMP_DIR/'
/
&system
ibrav = 2, celldm(1) =12.246, nat= 2, ntyp= 2,
ecutwfc = 18.0
/
&electrons
mixing_beta = 0.7
conv_thr = 1.0d-8
/
ATOMIC_SPECIES
In 114.82 In.pz-bhs.UPF
Sb 121.75 Sb.pz-bhs.UPF
ATOMIC_POSITIONS (crystal)
In 0.00 0.00 0.00
Sb 0.25 0.25 0.25
K_POINTS
10
0.1250000 0.1250000 0.1250000 1.00
0.1250000 0.1250000 0.3750000 3.00
0.1250000 0.1250000 0.6250000 3.00
0.1250000 0.1250000 0.8750000 3.00
0.1250000 0.3750000 0.3750000 3.00
0.1250000 0.3750000 0.6250000 6.00
0.1250000 0.3750000 0.8750000 6.00
0.1250000 0.6250000 0.6250000 3.00
0.3750000 0.3750000 0.3750000 1.00
0.3750000 0.3750000 0.6250000 3.00
EOF
$ECHO " running the scf calculation for InSb...\c"

$PW_COMMAND < insb.scf.in > si.scf.out


check_failure $?
$ECHO " done"
# phonon calculation at Gamma
cat > insb.phG.in << EOF
phonons of InSb at Gamma
&inputph
tr2_ph=1.0d-14,
prefix='insb',
epsil=.true.,
amass(1)=114.82,
amass(2)=121.75,
outdir='$TMP_DIR/',
fildyn='insb.dynG',
/
0.0 0.0 0.0
EOF
$ECHO " running the phonon calculation at Gamma for InSb...\c"
$PH_COMMAND < insb.phG.in > insb.phG.out
$ECHO " done"
# phonon calculation at X
cat > insb.phX.in << EOF
phonons of InSb at X
&inputph
tr2_ph=1.0d-14,
prefix='insb',
amass(1)=114.82,
amass(2)=121.75,
outdir='$TMP_DIR/',
fildyn='insb.dynX',
/
1.0 0.0 0.0
EOF
$ECHO " running the phonon calculation at X for InSb...\c"
$PH_COMMAND < insb.phX.in > insb.phX.out
check_failure $?
$ECHO " done"
# self-consistent calculation
cat > insb.scf.in << EOF
&control
calculation='scf',
restart_mode='from_scratch',
prefix='insb'
pseudo_dir = '$PSEUDO_DIR/',
outdir='$TMP_DIR/'
/
&system
ibrav = 2, celldm(1) =12.246, nat= 2, ntyp= 2,
ecutwfc = 18.0
/
&electrons
mixing_beta = 0.7
conv_thr = 1.0d-8
/
ATOMIC_SPECIES
In 114.82 In.pz-bhs.UPF
Sb 121.75 Sb.pz-bhs.UPF

ATOMIC_POSITIONS
In 0.00 0.00 0.00
Sb 0.25 0.25 0.25
K_POINTS
10
0.1250000 0.1250000 0.1250000 1.00
0.1250000 0.1250000 0.3750000 3.00
0.1250000 0.1250000 0.6250000 3.00
0.1250000 0.1250000 0.8750000 3.00
0.1250000 0.3750000 0.3750000 3.00
0.1250000 0.3750000 0.6250000 6.00
0.1250000 0.3750000 0.8750000 6.00
0.1250000 0.6250000 0.6250000 3.00
0.3750000 0.3750000 0.3750000 1.00
0.3750000 0.3750000 0.6250000 3.00
EOF
$ECHO " running the scf calculation for InSb again...\c"
$PW_COMMAND < insb.scf.in > insb.scf.out
check_failure $?
$ECHO " done"
# single mode phonon calculation at X
cat > insb.phXsingle.in << EOF
phonons of insb at X, single mode
&inputph
tr2_ph=1.0d-14,
prefix='insb',
amass(1)=114.82,
amass(2)=121.75,
outdir='$TMP_DIR/'
modenum=3
/
1.0 0.0 0.0
EOF
$ECHO " running the phonon calculation for InSb at X for a single mode...\c"
$PH_COMMAND < insb.phXsingle.in > insb.phXsingle.out
check_failure $?
$ECHO " done"
# clean TMP_DIR
$ECHO " cleaning $TMP_DIR...\c"
rm -rf $TMP_DIR/*
$ECHO " done"
$ECHO " cleaning $TMP_DIR...\c"
rm -rf $TMP_DIR/*
$ECHO " done"
$ECHO
$ECHO "$EXAMPLE_DIR: done"

Você também pode gostar