2016-03-24 14:37:03 +01:00
|
|
|
#!/bin/bash
|
2016-03-11 18:49:29 +01:00
|
|
|
|
|
|
|
MPIRUN_CMD=mpirun
|
|
|
|
|
|
|
|
show_help()
|
|
|
|
{
|
|
|
|
echo "
|
2019-09-16 10:59:46 +02:00
|
|
|
Usage: vasp_dmft [-n <number of cores>] -i <number of iterations> -j <number of VASP iterations with fixed charge density> [-v <VASP version>] [-p <path to VASP directory>] [<dmft_script.py>]
|
2016-03-11 18:49:29 +01:00
|
|
|
|
2019-09-16 10:59:46 +02:00
|
|
|
If the number of cores is not specified it is set to 1 by default.
|
2016-03-11 18:49:29 +01:00
|
|
|
|
2019-12-20 10:51:58 +01:00
|
|
|
Set the number of times the dmft solver is called with -i <number of iterations>
|
|
|
|
|
|
|
|
Set the number of VASP iteration with a fixed charge density update
|
|
|
|
inbetween the dmft runs with -j <number of VASP iterations with fixed charge density>
|
|
|
|
|
|
|
|
Set the version of VASP by -v standard(default)/no_gamma_write to
|
|
|
|
specify if VASP writes the GAMMA file or not.
|
2016-03-11 18:49:29 +01:00
|
|
|
|
|
|
|
If the path to VASP directory is not specified it must be provided by a
|
|
|
|
variable VASP_DIR.
|
2019-12-20 10:51:58 +01:00
|
|
|
|
|
|
|
<dmft_script.py> must provide an importable function 'dmft_cycle()'
|
|
|
|
which is invoked once per DFT+DMFT iteration. If the script name is
|
|
|
|
omitted the default name 'csc_dmft.py' is used.
|
|
|
|
|
2019-11-25 09:53:05 +01:00
|
|
|
|
2016-03-11 18:49:29 +01:00
|
|
|
"
|
|
|
|
}
|
|
|
|
|
2019-09-16 10:59:46 +02:00
|
|
|
while getopts ":n:i:j:v:p:h" opt; do
|
2016-03-11 18:49:29 +01:00
|
|
|
case $opt in
|
|
|
|
n)
|
|
|
|
# echo "Option: Ncpu, argument: $OPTARG"
|
|
|
|
if [ -n "$OPTARG" ]; then
|
|
|
|
NPROC=$OPTARG
|
|
|
|
# echo "Number of cores: $NPROC"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
i)
|
|
|
|
# echo "Option: Niter"
|
|
|
|
if [ -n "$OPTARG" ]; then
|
|
|
|
NITER=$OPTARG
|
|
|
|
# echo "Number of iterations: $NITER"
|
|
|
|
fi
|
|
|
|
;;
|
2019-09-16 10:59:46 +02:00
|
|
|
j)
|
|
|
|
# echo "Option: Ndftiter"
|
|
|
|
if [ -n "$OPTARG" ]; then
|
|
|
|
NDFTITER=$OPTARG
|
|
|
|
# echo "Number of iterations with fixed density: $NDFTITER"
|
|
|
|
fi
|
|
|
|
;;
|
2016-03-11 18:49:29 +01:00
|
|
|
p)
|
|
|
|
if [ -n "$OPTARG" ]; then
|
|
|
|
VASP_DIR=$OPTARG
|
|
|
|
fi
|
|
|
|
;;
|
2019-09-16 10:59:46 +02:00
|
|
|
v)
|
|
|
|
if [ -n "$OPTARG" ]; then
|
|
|
|
VASP_VERSION=$OPTARG
|
2019-11-25 09:53:05 +01:00
|
|
|
# echo "Version of VASP (writing GAMMA file (standard) or not (no_gamma_write): $VASP_VERSION"
|
2019-09-16 10:59:46 +02:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
h)
|
|
|
|
show_help
|
|
|
|
exit 1
|
|
|
|
;;
|
2016-03-11 18:49:29 +01:00
|
|
|
:)
|
|
|
|
echo " Error: Option -$OPTARG requires an argument" >&2
|
|
|
|
show_help
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
\?)
|
|
|
|
echo " Error: Invalid option -$OPTARG" >&2
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z "$NITER" ]; then
|
|
|
|
echo " Error: Number of iterations must be specified with option -i" >&2
|
|
|
|
show_help
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-09-16 10:59:46 +02:00
|
|
|
|
2016-03-11 18:49:29 +01:00
|
|
|
if [ -z "$VASP_DIR" ]; then
|
|
|
|
echo " Error: A path to VASP directory must be given either with option -p or by setting variable VASP_DIR" >&2
|
|
|
|
show_help
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$NPROC" ]; then
|
|
|
|
echo " Number of cores not specified, setting to 1"
|
|
|
|
NPROC=1
|
|
|
|
fi
|
|
|
|
|
2019-09-16 10:59:46 +02:00
|
|
|
if [ -z "$NDFTITER" ]; then
|
|
|
|
echo " Number of VASP iterations without updating density not specified, setting to 1"
|
|
|
|
NDFTITER=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$VASP_VERSION" ]; then
|
|
|
|
echo " VASP version not specified, setting to standard"
|
|
|
|
VASP_VERSION="standard"
|
|
|
|
fi
|
|
|
|
|
2016-03-11 18:49:29 +01:00
|
|
|
shift $((OPTIND-1))
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
DMFT_SCRIPT=csc_dmft.py
|
|
|
|
else
|
|
|
|
DMFT_SCRIPT=$1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo " Number of cores: $NPROC"
|
|
|
|
echo " Number of iterations: $NITER"
|
2019-09-16 10:59:46 +02:00
|
|
|
echo " Number of iterations with fixed density: $NDFTITER"
|
|
|
|
echo " VASP version: $VASP_VERSION"
|
2016-03-11 18:49:29 +01:00
|
|
|
echo " Script name: $DMFT_SCRIPT"
|
|
|
|
|
|
|
|
rm -f vasp.lock
|
2019-11-25 09:53:05 +01:00
|
|
|
stdbuf -o 0 $MPIRUN_CMD -np $NPROC "$VASP_DIR" &
|
2016-03-11 18:49:29 +01:00
|
|
|
|
2016-03-24 19:57:49 +01:00
|
|
|
|
2019-09-16 10:59:46 +02:00
|
|
|
$MPIRUN_CMD -np $NPROC python -m triqs_dft_tools.converters.plovasp.sc_dmft $(jobs -p) $NITER $NDFTITER $DMFT_SCRIPT 'plo.cfg' $VASP_VERSION || kill %1
|
2016-03-11 18:49:29 +01:00
|
|
|
|