diff --git a/TODO b/TODO index 217c9e7d..439bda7f 100644 --- a/TODO +++ b/TODO @@ -65,4 +65,6 @@ qp_stop : pour forcer a terminer proprement le programme (kill clean) Virer EMSL +qp_create... -> qp_create_ezfio + diff --git a/etc/paths.rc b/etc/paths.rc index 877dbc12..758097d9 100644 --- a/etc/paths.rc +++ b/etc/paths.rc @@ -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 diff --git a/etc/qp.rc b/etc/qp.rc index 744c2730..0a9dbcaa 100644 --- a/etc/qp.rc +++ b/etc/qp.rc @@ -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 "$@" ;; diff --git a/scripts/qp_reset b/scripts/qp_reset new file mode 100755 index 00000000..bcf5664d --- /dev/null +++ b/scripts/qp_reset @@ -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 + diff --git a/scripts/qp_bitmasks.py b/scripts/utility/qp_bitmasks.py similarity index 100% rename from scripts/qp_bitmasks.py rename to scripts/utility/qp_bitmasks.py