#!/bin/sh
###############################################################################
##
## HIGH VERBOSITY EXAMPLE
##
###############################################################################
# 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 cp.x to perform molecular dynamics"
$ECHO "in the presence of an electric field described through the"
$ECHO "modern theory of the polarization. The example shows how to"
$ECHO "calculate high-frequency and static dielectric constants and"
$ECHO "Born effective charges."
# set the needed environment variables
. ../../../environment_variables
# required executables and pseudopotentials
BIN_LIST="cp.x"
PSEUDO_LIST="O.pz-rrkjus.UPF Mg.pz-n-vbc.UPF"
$ECHO
$ECHO " executables directory: $BIN_DIR"
$ECHO " pseudo directory: $PSEUDO_DIR"
$ECHO " temporary directory: $TMP_DIR"
$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 "Downloading $FILE to $PSEUDO_DIR...\c"
$WGET $PSEUDO_DIR/$FILE \
http://www.quantum-espresso.org/pseudo/1.3/UPF/$FILE 2> /dev/null
fi
if test $? != 0; then
$ECHO
$ECHO "ERROR: $PSEUDO_DIR/$FILE not existent or not readable"
$ECHO "Aborting"
exit 1
fi
done
$ECHO " done"
# how to run executables
CP_COMMAND="$PARA_PREFIX $BIN_DIR/cp.x $PARA_POSTFIX"
$ECHO
$ECHO " running cp.x as: $CP_COMMAND"
$ECHO
# clean TMP_DIR
$ECHO " cleaning $TMP_DIR...\c"
rm -rf $TMP_DIR/*
$ECHO " done"
# molecular dynamics calculation
cat > mgo.cp.cg.xml << EOF
|
0.0 0.0 0.0 0.0 0.0
|
12.01
O.pz-rrkjus.UPF
0.8d0
24.30
Mg.pz-n-vbc.UPF
0.066300000 0.066300000 0.066300000
4.044300000 4.044300000 0.066300000
4.044300000 0.066300000 4.044300000
0.066300000 4.044300000 4.044300000
0.066300000 0.066300000 8.022300000
4.044300000 4.044300000 8.022300000
4.044300000 0.066300000 12.000300000
0.066300000 4.044300000 12.000300000
0.066300000 8.022300000 0.066300000
4.044300000 12.000300000 0.066300000
4.044300000 8.022300000 4.044300000
0.066300000 12.000300000 4.044300000
0.066300000 8.022300000 8.022300000
4.044300000 12.000300000 8.022300000
4.044300000 8.022300000 12.000300000
0.066300000 12.000300000 12.000300000
8.022300000 0.066300000 0.066300000
12.000300000 4.044300000 0.066300000
12.000300000 0.066300000 4.044300000
8.022300000 4.044300000 4.044300000
8.022300000 0.066300000 8.022300000
12.000300000 4.044300000 8.022300000
12.000300000 0.066300000 12.000300000
8.022300000 4.044300000 12.000300000
8.022300000 8.022300000 0.066300000
12.000300000 12.000300000 0.066300000
12.000300000 8.022300000 4.044300000
8.022300000 12.000300000 4.044300000
8.022300000 8.022300000 8.022300000
12.000300000 12.000300000 8.022300000
12.000300000 8.022300000 12.000300000
8.022300000 12.000300000 12.000300000
0.066300000 0.066300000 4.044300000
4.044300000 4.044300000 4.044300000
4.044300000 0.066300000 8.022300000
0.066300000 4.044300000 8.022300000
0.066300000 0.066300000 12.000300000
4.044300000 4.044300000 12.000300000
4.044300000 0.066300000 15.978300000
0.066300000 4.044300000 15.978300000
0.066300000 8.022300000 4.044300000
4.044300000 12.000300000 4.044300000
4.044300000 8.022300000 8.022300000
0.066300000 12.000300000 8.022300000
0.066300000 8.022300000 12.000300000
4.044300000 12.000300000 12.000300000
4.044300000 8.022300000 15.978300000
0.066300000 12.000300000 15.978300000
8.022300000 0.066300000 4.044300000
12.000300000 4.044300000 4.044300000
12.000300000 0.066300000 8.022300000
8.022300000 4.044300000 8.022300000
8.022300000 0.066300000 12.000300000
12.000300000 4.044300000 12.000300000
12.000300000 0.066300000 15.978300000
8.022300000 4.044300000 15.978300000
8.022300000 8.022300000 4.044300000
12.000300000 12.000300000 4.044300000
12.000300000 8.022300000 8.022300000
8.022300000 12.000300000 8.022300000
8.022300000 8.022300000 12.000300000
12.000300000 12.000300000 12.000300000
12.000300000 8.022300000 15.978300000
8.022300000 12.000300000 15.978300000
$PSEUDO_DIR/
$TMP_DIR/
from_scratch
1
TRUE
TRUE
random
from_input
20.0
160.0
1.d-8
128
1
TRUE
0.0
1
none
not_controlled
none
1
30
30
30
1000.d0
4.d0
Gram-Schmidt
0.02
TRUE
0.3
250
0.0
1.0
3
EOF
$ECHO " running the CG calculation for bulk MgO E_field=0. a.u. ...\c"
$CP_COMMAND < mgo.cp.cg.xml > mgo.cp.cg.out
check_failure $?
$ECHO " done"
cat > mgo.cp.cg.efield.xml << EOF
0.0 0.0 0.0 0.0 0.0
|
12.01
O.pz-rrkjus.UPF
0.8d0
24.30
Mg.pz-n-vbc.UPF
0.066300000 0.066300000 0.066300000
4.044300000 4.044300000 0.066300000
4.044300000 0.066300000 4.044300000
0.066300000 4.044300000 4.044300000
0.066300000 0.066300000 8.022300000
4.044300000 4.044300000 8.022300000
4.044300000 0.066300000 12.000300000
0.066300000 4.044300000 12.000300000
0.066300000 8.022300000 0.066300000
4.044300000 12.000300000 0.066300000
4.044300000 8.022300000 4.044300000
0.066300000 12.000300000 4.044300000
0.066300000 8.022300000 8.022300000
4.044300000 12.000300000 8.022300000
4.044300000 8.022300000 12.000300000
0.066300000 12.000300000 12.000300000
8.022300000 0.066300000 0.066300000
12.000300000 4.044300000 0.066300000
12.000300000 0.066300000 4.044300000
8.022300000 4.044300000 4.044300000
8.022300000 0.066300000 8.022300000
12.000300000 4.044300000 8.022300000
12.000300000 0.066300000 12.000300000
8.022300000 4.044300000 12.000300000
8.022300000 8.022300000 0.066300000
12.000300000 12.000300000 0.066300000
12.000300000 8.022300000 4.044300000
8.022300000 12.000300000 4.044300000
8.022300000 8.022300000 8.022300000
12.000300000 12.000300000 8.022300000
12.000300000 8.022300000 12.000300000
8.022300000 12.000300000 12.000300000
0.066300000 0.066300000 4.044300000
4.044300000 4.044300000 4.044300000
4.044300000 0.066300000 8.022300000
0.066300000 4.044300000 8.022300000
0.066300000 0.066300000 12.000300000
4.044300000 4.044300000 12.000300000
4.044300000 0.066300000 15.978300000
0.066300000 4.044300000 15.978300000
0.066300000 8.022300000 4.044300000
4.044300000 12.000300000 4.044300000
4.044300000 8.022300000 8.022300000
0.066300000 12.000300000 8.022300000
0.066300000 8.022300000 12.000300000
4.044300000 12.000300000 12.000300000
4.044300000 8.022300000 15.978300000
0.066300000 12.000300000 15.978300000
8.022300000 0.066300000 4.044300000
12.000300000 4.044300000 4.044300000
12.000300000 0.066300000 8.022300000
8.022300000 4.044300000 8.022300000
8.022300000 0.066300000 12.000300000
12.000300000 4.044300000 12.000300000
12.000300000 0.066300000 15.978300000
8.022300000 4.044300000 15.978300000
8.022300000 8.022300000 4.044300000
12.000300000 12.000300000 4.044300000
12.000300000 8.022300000 8.022300000
8.022300000 12.000300000 8.022300000
8.022300000 8.022300000 12.000300000
12.000300000 12.000300000 12.000300000
12.000300000 8.022300000 15.978300000
8.022300000 12.000300000 15.978300000
$PSEUDO_DIR/
$TMP_DIR/
restart
1
FALSE
TRUE
random
from_input
20.0
160.0
1.d-8
128
1
TRUE
0.001
1
none
not_controlled
none
1
30
30
30
1000.d0
4.d0
Gram-Schmidt
0.02
TRUE
0.3
250
0.0
1.0
3
EOF
$ECHO " running the CG calculation for bulk MgO E_field=0.001 a.u. ...\c"
$CP_COMMAND < mgo.cp.cg.efield.xml > mgo.cp.cg.efield.out
check_failure $?
$ECHO " done"
cat > mgo.cp.damp.efield.xml << EOF
0.0 0.0 0.0 0.0 0.0
|
1.0
O.pz-rrkjus.UPF
1.0
Mg.pz-n-vbc.UPF
0.066300000 0.066300000 0.066300000
4.044300000 4.044300000 0.066300000
4.044300000 0.066300000 4.044300000
0.066300000 4.044300000 4.044300000
0.066300000 0.066300000 8.022300000
4.044300000 4.044300000 8.022300000
4.044300000 0.066300000 12.000300000
0.066300000 4.044300000 12.000300000
0.066300000 8.022300000 0.066300000
4.044300000 12.000300000 0.066300000
4.044300000 8.022300000 4.044300000
0.066300000 12.000300000 4.044300000
0.066300000 8.022300000 8.022300000
4.044300000 12.000300000 8.022300000
4.044300000 8.022300000 12.000300000
0.066300000 12.000300000 12.000300000
8.022300000 0.066300000 0.066300000
12.000300000 4.044300000 0.066300000
12.000300000 0.066300000 4.044300000
8.022300000 4.044300000 4.044300000
8.022300000 0.066300000 8.022300000
12.000300000 4.044300000 8.022300000
12.000300000 0.066300000 12.000300000
8.022300000 4.044300000 12.000300000
8.022300000 8.022300000 0.066300000
12.000300000 12.000300000 0.066300000
12.000300000 8.022300000 4.044300000
8.022300000 12.000300000 4.044300000
8.022300000 8.022300000 8.022300000
12.000300000 12.000300000 8.022300000
12.000300000 8.022300000 12.000300000
8.022300000 12.000300000 12.000300000
0.066300000 0.066300000 4.044300000
4.044300000 4.044300000 4.044300000
4.044300000 0.066300000 8.022300000
0.066300000 4.044300000 8.022300000
0.066300000 0.066300000 12.000300000
4.044300000 4.044300000 12.000300000
4.044300000 0.066300000 15.978300000
0.066300000 4.044300000 15.978300000
0.066300000 8.022300000 4.044300000
4.044300000 12.000300000 4.044300000
4.044300000 8.022300000 8.022300000
0.066300000 12.000300000 8.022300000
0.066300000 8.022300000 12.000300000
4.044300000 12.000300000 12.000300000
4.044300000 8.022300000 15.978300000
0.066300000 12.000300000 15.978300000
8.022300000 0.066300000 4.044300000
12.000300000 4.044300000 4.044300000
12.000300000 0.066300000 8.022300000
8.022300000 4.044300000 8.022300000
8.022300000 0.066300000 12.000300000
12.000300000 4.044300000 12.000300000
12.000300000 0.066300000 15.978300000
8.022300000 4.044300000 15.978300000
8.022300000 8.022300000 4.044300000
12.000300000 12.000300000 4.044300000
12.000300000 8.022300000 8.022300000
8.022300000 12.000300000 8.022300000
8.022300000 8.022300000 12.000300000
12.000300000 12.000300000 12.000300000
12.000300000 8.022300000 15.978300000
8.022300000 12.000300000 15.978300000
$PSEUDO_DIR/
$TMP_DIR/
restart
100
FALSE
TRUE
random
20.0
160.0
128
1
TRUE
0.001
20
10.0
verlet
none
100
30
30
30
250.d0
3.d0
0.02
0.0
3
damp
30
0.05
EOF
$ECHO " running the CP- damped MD calculation for bulk MgO E_field=0.001 a.u. ...\c"
$CP_COMMAND < mgo.cp.damp.efield.xml > mgo.cp.damp.efield.out
check_failure $?
$ECHO " done"
$ECHO
$ECHO "$EXAMPLE_DIR : done"