This commit is contained in:
Emmanuel Giner 2019-01-16 17:50:32 +01:00
commit 03b0b10acd
5 changed files with 160 additions and 29 deletions

2
TODO
View File

@ -65,4 +65,6 @@ qp_stop : pour forcer a terminer proprement le programme (kill clean)
Virer EMSL
qp_create... -> qp_create_ezfio

View File

@ -1,43 +1,41 @@
# Configuration of all the paths to executables and libraries
if [[ -z $QP_PYTHON ]]
then
QP_PYTHON=
# Load dependencies
for i in ezfio.rc irpf90.rc ninja.rc ocaml.rc
do
source $i
done
# Load dependencies
for i in ezfio.rc irpf90.rc ninja.rc ocaml.rc
do
source $i
done
export QP_PYTHON=${QP_PYTHON}:${QP_EZFIO}/Python
export QP_PYTHON=${QP_PYTHON}:${QP_ROOT}/scripts
export QP_PYTHON=${QP_PYTHON}:${QP_ROOT}/scripts/ezfio_interface
export QP_PYTHON=${QP_PYTHON}:${QP_ROOT}/scripts/utility
export QP_PYTHON=${QP_PYTHON}:${QP_ROOT}/scripts/module
export QP_PYTHON=${QP_PYTHON}:${QP_ROOT}/scripts/compilation
export QP_PYTHON=${QP_PYTHON}:${QP_ROOT}/external/Python
export QP_PYTHON=${QP_PYTHON}:${QP_ROOT}/external/Python/resultsFile
export QP_PYTHON=${QP_PYTHON}:${QP_EZFIO}/Python
export QP_PYTHON=${QP_PYTHON}:${QP_ROOT}/scripts
export QP_PYTHON=${QP_PYTHON}:${QP_ROOT}/scripts/ezfio_interface
export QP_PYTHON=${QP_PYTHON}:${QP_ROOT}/scripts/utility
export QP_PYTHON=${QP_PYTHON}:${QP_ROOT}/scripts/module
export QP_PYTHON=${QP_PYTHON}:${QP_ROOT}/scripts/compilation
export QP_PYTHON=${QP_PYTHON}:${QP_ROOT}/external/Python
export QP_PYTHON=${QP_PYTHON}:${QP_ROOT}/external/Python/resultsFile
function qp_prepend_export () {
eval "value_1="\${$1}""
if [[ -z $value_1 ]] ; then
echo "${2}:"
else
echo "${2}:${value_1}"
fi
}
function qp_prepend_export () {
eval "value_1="\${$1}""
if [[ -z $value_1 ]] ; then
echo "${2}:"
else
echo "${2}:${value_1}"
fi
}
export PYTHONPATH=$(qp_prepend_export "PYTHONPATH" "${QP_EZFIO}/Python":"${QP_PYTHON}")
export PYTHONPATH=$(qp_prepend_export "PYTHONPATH" "${QP_EZFIO}/Python":"${QP_PYTHON}")
export PATH=$(qp_prepend_export "PATH" "${QP_PYTHON}":"${QP_ROOT}"/bin:"${QP_ROOT}"/ocaml)
export PATH=$(qp_prepend_export "PATH" "${QP_PYTHON}":"${QP_ROOT}"/bin:"${QP_ROOT}"/ocaml)
export LD_LIBRARY_PATH=$(qp_prepend_export "LD_LIBRARY_PATH" "${QP_ROOT}"/lib:"${QP_ROOT}"/lib64)
export LD_LIBRARY_PATH=$(qp_prepend_export "LD_LIBRARY_PATH" "${QP_ROOT}"/lib:"${QP_ROOT}"/lib64)
export LIBRARY_PATH=$(qp_prepend_export "LIBRARY_PATH" "${QP_ROOT}"/lib:"${QP_ROOT}"/lib64)
export LIBRARY_PATH=$(qp_prepend_export "LIBRARY_PATH" "${QP_ROOT}"/lib:"${QP_ROOT}"/lib64)
export C_INCLUDE_PATH=$(qp_prepend_export "C_INCLUDE_PATH" "${QP_ROOT}"/include)
export C_INCLUDE_PATH=$(qp_prepend_export "C_INCLUDE_PATH" "${QP_ROOT}"/include)
fi

View File

@ -37,6 +37,18 @@ Usage:
function qp()
{
function clean_ezfio() {
RESULT=""
while [[ -n $1 ]] ; do
case "$1" in
None) RESULT+='"None" ' ;;
*) RESULT+="$1 " ;;
esac
shift
done
eval set -- "$RESULT"
}
case $1 in
"set_file")
if [[ -d ${2} ]] ; then
@ -46,6 +58,7 @@ function qp()
fi;;
"has"|"set"|"get"|"unset_file")
clean_ezfio
ezfio "$@"
;;

118
scripts/qp_reset Executable file
View File

@ -0,0 +1,118 @@
#!/bin/bash
#
# Resets parts of the EZFIO directory.
#
# Wed Jan 16 16:50:36 CET 2019
#
# Check the QP_ROOT directory
if [[ -z ${QP_ROOT} ]] ; then
echo "The QP_ROOT environment variable is not set."
echo "Please reload the quantum_package.rc file."
exit 1
fi
source ${QP_ROOT}/quantum_package.rc
TEMP=$(getopt -o adhm -l all,dets,help,mos -n $0 -- "$@") || exit 1
eval set -- "$TEMP"
function help() {
cat << EOF
This command resets parts of the EZFIO directory.
Usage:
$(basename $0) [OPTIONS] EZFIO_DIR
Arguments:
EZFIO_DIR EZFIO directory
Options:
-a --all Reset to the state after qp_create
-d --dets Deletes the determinants and CI coefficients
-h --help Prints the help message
-m --mos Deletes the MOs
Examples:
To delete the complete set of determinants and CI coefficients:
$(basename $0) --dets h2o.ezfio
To delete the molecular orbitals (implies -dets):
$(basename $0) --mos h2o.ezfio
EOF
exit 0
}
function error() {
>&2 echo "$(basename $0): $@"
exit 2
}
dets=0
mos=0
while true ; do
case "$1" in
-a|--all)
dets=1
mos=1
;;
-d|--dets)
dets=1
;;
-m|--mos)
mos=1
;;
-h|-help|--help)
help
exit 0;;
--) shift ; break ;;
*)
error $(basename $0)": unknown option $1, try --help"
exit 2;;
esac
shift
done
if [[ -z $1 ]] ; then
help
error "EZFIO directory not specified"
fi
if [[ ! -d $1 ]] ; then
error "EZFIO directory not found"
fi
ezfio=$1
qp set_file $ezfio
if [[ $dets -eq 1 ]] ; then
rm -- ${ezfio}/determinants/psi_{det,coef}.gz
fi
set -x
if [[ $mos -eq 1 ]] ; then
if [[ -f ${ezfio}/mo_basis/mo_class.gz ]] && [[ $(qp get mo_basis mo_num) -ne \
$(zcat ${ezfio}/mo_basis/mo_class.gz |grep Active | wc -l) ]] ; then
echo "Warning: You will need to re-define the MO classes"
fi
rm --recursive --force -- ${ezfio}/mo_basis
rm --recursive --force -- ${ezfio}/work/mo_ints_*
fi
qp_edit --check ${ezfio}
if [[ $mos -eq 1 ]] ; then
qp set mo_two_e_ints io_mo_two_e_integrals None
qp set mo_one_e_ints io_mo_integrals_e_n None
qp set mo_one_e_ints io_mo_integrals_kinetic None
qp set mo_one_e_ints io_mo_integrals_pseudo None
qp set mo_one_e_ints io_mo_one_e_integrals None
fi