From b8322eb01d3dafb2ead65e04f6cbe9d3d3dc16d9 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 16 Jan 2019 18:22:16 +0100 Subject: [PATCH] Added qp_reset --- configure | 2 +- etc/qp.rc | 79 ++++++++++++++++++++++++++++-------------------- scripts/qp_reset | 4 +-- 3 files changed, 49 insertions(+), 36 deletions(-) diff --git a/configure b/configure index 77cea9cd..cb441991 100755 --- a/configure +++ b/configure @@ -287,7 +287,7 @@ EOF elif [[ ${PACKAGE} = ezfio ]] ; then download \ - "https://gitlab.com/scemama/EZFIO/-/archive/v1.3.4/EZFIO-v1.3.4.tar.gz" \ + "https://gitlab.com/scemama/EZFIO/-/archive/v1.3.5/EZFIO-v1.3.5.tar.gz" \ "${QP_ROOT}"/external/ezfio.tar.gz execute << EOF cd "\${QP_ROOT}"/external diff --git a/etc/qp.rc b/etc/qp.rc index 0a9dbcaa..832df6e4 100644 --- a/etc/qp.rc +++ b/etc/qp.rc @@ -9,46 +9,51 @@ source ${QP_ROOT}/etc/ezfio.rc function _qp_usage() { - echo " + cat << EOF +qp - Shell function of the qpsh shell + Usage: - qp set_file EZFIO_DIRECTORY - qp unset_file - qp has DIRECTORY ITEM - qp get DIRECTORY ITEM - qp set DIRECTORY ITEM VALUE : Scalar values - qp set DIRECTORY ITEM : Array values read from stdin + EZFIO access: - qp run PROGRAM - qp man PROGRAM - qp srun PROGRAM - qp mpirun PROGRAM + qp set_file EZFIO_DIR Sets the current EZFIO directory. - qp set_frozen_core + qp unset_file Unsets the current EZFIO directory. - qp create_ezfio_from_xyz - qp convert_output_to_ezfio - qp update - qp set_mo_class - qp plugins -" + qp has If the / is set in the + EZFIO directory, returns 1. Otherwise returns 0. + + qp get Returns the value of /. + + qp set [] + Sets the value of /. If the + value is not given in the command line it is read + from the standard input. + + Running programs: + + qp (run|srun|mpirun) + + Getting help: + + qp man (|) + + Running quantum package commands: + + qp convert_output_to_ezfio + qp create_ezfio + qp plugins The corresponding commands start with "qp_". + qp reset To get help for a command , run + qp set_frozen_core --help + qp set_mo_class + qp update + +EOF } 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 @@ -58,7 +63,6 @@ function qp() fi;; "has"|"set"|"get"|"unset_file") - clean_ezfio ezfio "$@" ;; @@ -67,6 +71,11 @@ function qp() qp_set_frozen_core "$@" ${EZFIO_FILE} ;; + "reset") + shift + qp_reset "$@" ${EZFIO_FILE} + ;; + "create_ezfio_from_xyz") shift # Replace ':' by spaces @@ -257,7 +266,7 @@ _qp_Complete() case "${prev2}" in set|has|get) if [[ ${prev} == "qp" ]] ; then - COMPREPLY=( $(compgen -W "plugins set set_frozen_core set_mo_class" -- $cur ) ) + COMPREPLY=( $(compgen -W "plugins set reset set_frozen_core set_mo_class" -- $cur ) ) elif [[ ! -d ${EZFIO_FILE}/${prev} ]] ; then COMPREPLY=( $(compgen -W "" -- $cur ) ) else @@ -272,6 +281,10 @@ _qp_Complete() COMPREPLY=( $(compgen -W "-h $(cat ${QP_ROOT}/data/executables | cut -d ' ' -f 1)" -- $cur ) ) return 0 ;; + reset) + COMPREPLY=( $(compgen -W "-h -m -a -d" -- $cur ) ) + return 0 + ;; unset_file|set_frozen_core) COMPREPLY=() return 0 @@ -291,7 +304,7 @@ _qp_Complete() *) COMPREPLY+=( $(compgen -W 'has get set unset_file edit \ run srun mpirun set_frozen_core \ - set_mo_class ' \ + reset set_mo_class ' \ -- $cur ) ) return 0 ;; diff --git a/scripts/qp_reset b/scripts/qp_reset index bcf5664d..b8c07adf 100755 --- a/scripts/qp_reset +++ b/scripts/qp_reset @@ -93,10 +93,10 @@ ezfio=$1 qp set_file $ezfio if [[ $dets -eq 1 ]] ; then - rm -- ${ezfio}/determinants/psi_{det,coef}.gz + rm --force -- ${ezfio}/determinants/n_det + rm --force -- ${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