From c8258a48bdc77fd53e96a4fd7890a8d755e0d807 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 25 Mar 2015 11:42:15 +0100 Subject: [PATCH 1/6] Upgrade irpf90 --- scripts/upgrade_irpf90.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/upgrade_irpf90.sh b/scripts/upgrade_irpf90.sh index a3aeac48..5735754f 100755 --- a/scripts/upgrade_irpf90.sh +++ b/scripts/upgrade_irpf90.sh @@ -1,7 +1,7 @@ -#!/bin/bash +#!/bin/bash # # Upgrades IRPF90 from the web. -# Tue Nov 4 00:53:13 CET 2014 +# Wed Mar 25 11:41:04 CET 2015 if [[ -z ${QPACKAGE_ROOT} ]] then @@ -10,9 +10,9 @@ then fi cd -- ${QPACKAGE_ROOT} -mv -- ${QPACKAGE_ROOT}/irpf90 ${QPACKAGE_ROOT}/irpf90.old +mv -f -- ${QPACKAGE_ROOT}/irpf90 ${QPACKAGE_ROOT}/irpf90.old -make irpf90 +${QPACKAGE_ROOT}/scripts/install_irpf90.sh if [[ $? -eq 0 ]] then From 6b2496d0ed7e99b41672a990fde13d7be7246121 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 25 Mar 2015 23:03:51 +0100 Subject: [PATCH 2/6] Lots of cleaning in scripts and Makefiles --- .gitignore | 3 +- scripts/archive_ezfio.sh | 78 --------------- scripts/build_modules.sh | 34 +++++++ scripts/check_dependencies.sh | 14 +-- scripts/clean_modules.sh | 36 +++++++ scripts/create_Makefile.sh | 14 +-- scripts/create_Makefile_depend.sh | 12 ++- scripts/create_Needed_modules.sh | 12 ++- scripts/create_gitignore.sh | 10 ++ scripts/create_module.sh | 21 ++-- scripts/create_rst_templates.sh | 21 ++-- scripts/ezfio_interface.py | 57 +++++++---- scripts/get_basis.sh | 12 ++- scripts/install_curl.sh | 7 +- scripts/install_emsl.sh | 8 +- scripts/install_ezfio.sh | 8 +- scripts/install_ocaml.sh | 4 +- scripts/prepare_ezfio.sh | 18 ++++ scripts/prepare_module.sh | 15 --- scripts/qp_include.sh | 80 +++++++++++++++ scripts/run_Makefile_common.sh | 69 +++++++++++++ scripts/run_Makefile_global.sh | 81 +++++++++++++++ scripts/save_current_mos.sh | 7 ++ scripts/unarchive_ezfio.sh | 54 ---------- scripts/upgrade_ezfio.sh | 2 +- setup_environment.sh | 3 + src/AOs/Makefile | 2 - src/BiInts/Makefile | 2 - src/Bitmask/Makefile | 2 - src/CAS_SD_selected/Makefile | 2 - src/CID/Makefile | 2 - src/CID_SC2_selected/Makefile | 2 - src/CID_selected/Makefile | 2 - src/CIS/Makefile | 2 - src/CISD/Makefile | 2 - src/CISD_SC2_selected/Makefile | 2 - src/CISD_selected/Makefile | 2 - src/DDCI_selected/Makefile | 2 - src/Dets/Makefile | 2 - src/Electrons/Makefile | 2 - src/Ezfio_files/Makefile | 2 - src/FCIdump/Makefile | 2 - src/Full_CI/Makefile | 2 - src/Generators_CAS/Makefile | 2 - src/Generators_full/Makefile | 2 - src/Generators_restart/Makefile | 2 - src/Hartree_Fock/Makefile | 2 - src/MOGuess/Makefile | 2 - src/MOs/Makefile | 2 - src/MP2/Makefile | 2 - src/Makefile | 37 ++++--- src/Makefile.common | 160 +++--------------------------- src/Molden/Makefile | 2 - src/MonoInts/Makefile | 2 - src/NEEDED_MODULES | 2 +- src/Nuclei/Makefile | 2 - src/Output/Makefile | 2 - src/Perturbation/Makefile | 2 - src/Properties/Makefile | 2 - src/Selectors_full/Makefile | 2 - src/Selectors_no_sorted/Makefile | 2 - src/SingleRefMethod/Makefile | 2 - src/Utils/Makefile | 2 - 63 files changed, 491 insertions(+), 456 deletions(-) delete mode 100755 scripts/archive_ezfio.sh create mode 100755 scripts/build_modules.sh create mode 100755 scripts/clean_modules.sh create mode 100755 scripts/prepare_ezfio.sh delete mode 100755 scripts/prepare_module.sh create mode 100644 scripts/qp_include.sh create mode 100755 scripts/run_Makefile_common.sh create mode 100755 scripts/run_Makefile_global.sh delete mode 100755 scripts/unarchive_ezfio.sh diff --git a/.gitignore b/.gitignore index e096320a..cdcdc6d8 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ EMSL_Basis bin/ *.log quantum_package_static.tar.gz - +resultsFile +opam_installer.sh diff --git a/scripts/archive_ezfio.sh b/scripts/archive_ezfio.sh deleted file mode 100755 index eb0298fc..00000000 --- a/scripts/archive_ezfio.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/bash -# -# Computes the MD5 digest of an EZFIO file, and creates a tar. -# Thu Apr 3 16:55:50 CEST 2014 - -if [[ -z ${QPACKAGE_ROOT} ]] -then - print "The QPACKAGE_ROOT environment variable is not set." - print "Please reload the quantum_package.rc file." -fi - -function archive() -{ - FILE="$1" - MD5="$2" - ARCHIVE="${QPACKAGE_ROOT}/data/cache/$MD5" - if [[ -f "$ARCHIVE" ]] - then - if ! diff "$FILE" "${QPACKAGE_ROOT}/data/cache/$MD5" &> /dev/null - then - echo "Something went wrong. The file" - echo "${QPACKAGE_ROOT}/data/cache/$MD5" - echo "is different from $FILE" - echo "Aborting" - return 1 - fi - else - cp "$FILE" "${QPACKAGE_ROOT}/data/cache/$MD5" - fi -} - - - - -EZFIO_FILE=$(basename ${1}) - -if [[ -z ${EZFIO_FILE} ]] -then - echo "Usage: $(basename $0) " - exit 1 -fi - - -cd "${QPACKAGE_ROOT}/EZFIO/src" -FILES=($(python << EOF | sort -from read_config import * -for group in groups: - if group == "ezfio": - continue - for d in groups[group]: - if d[2] == (): - suffix = "" - else: - suffix = ".gz" - print group+'/'+d[0]+suffix -print "ezfio/creation" -print "ezfio/library" -EOF -)) -cd $OLDPWD - -MD5_FILE=$(basename "${EZFIO_FILE}" .ezfio).md5 -rm -f -- "${MD5_FILE}" -for FILE in ${FILES[@]} -do - FILE="${EZFIO_FILE}/${FILE}" - MD5=$(md5sum "${FILE}" 2>/dev/null | cut -d ' ' -f 1) - if [[ ! -z $MD5 ]] - then - if ! archive "$FILE" "$MD5" - then - rm -- "${MD5_FILE}" - exit 1 - fi - echo "$MD5" "$FILE" >> "${MD5_FILE}" - fi -done - diff --git a/scripts/build_modules.sh b/scripts/build_modules.sh new file mode 100755 index 00000000..5aedc105 --- /dev/null +++ b/scripts/build_modules.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# +# This script should run from the directory $QPACKAGE_ROOT/src + +source ${QPACKAGE_ROOT}/scripts/run_Makefile_global.sh + +NPROC=$(cat /proc/cpuinfo | grep MHz | wc -l) + +export IN_MAKE=1 + +for MODULE in $@ +do + if [[ ! -d ${MODULE} ]] + then + error "Module ${MODULE} doesn't exist" + fi + cd ${MODULE} + echo ${MODULE} + ${QPACKAGE_ROOT}/scripts/run_Makefile_common.sh + if [[ $# -eq 1 ]] + then + env make -j ${NPROC} all + else + env make -j ${NPROC} all &> make.log + if [[ $? -ne 0 ]] + then + cat make.log + error " +Build failed for module $MODULE +" + fi + fi + cd ${OLDPWD} +done diff --git a/scripts/check_dependencies.sh b/scripts/check_dependencies.sh index 9e856c41..f21dbc40 100755 --- a/scripts/check_dependencies.sh +++ b/scripts/check_dependencies.sh @@ -10,13 +10,13 @@ # read in the Makefile. # Thu Apr 3 01:44:23 CEST 2014 -function unique_list() -{ - for d in $@ - do - echo $d - done | sort | uniq -} +if [[ -z ${QPACKAGE_ROOT} ]] +then + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 +fi +source ${QPACKAGE_ROOT}/scripts/qp_include.sh if [[ -z $1 ]] then diff --git a/scripts/clean_modules.sh b/scripts/clean_modules.sh new file mode 100755 index 00000000..cc25cede --- /dev/null +++ b/scripts/clean_modules.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# +# Cleans a module directory + +if [[ -z ${QPACKAGE_ROOT} ]] +then + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 +fi +source ${QPACKAGE_ROOT}/scripts/qp_include.sh + +function do_clean() +{ + rm -rf -- \ + IRPF90_temp IRPF90_man Makefile.depend $(cat NEEDED_MODULES) include \ + ezfio_interface.irp.f irpf90.make irpf90_entities tags $(ls_exe) +} + +if [[ -z $1 ]] +then + check_current_dir_is_module + do_clean +else + check_current_dir_is_src + for i in $@ + do + if [[ -d $i ]] + then + cd $i + do_clean + cd $OLDPWD + fi + done +fi + diff --git a/scripts/create_Makefile.sh b/scripts/create_Makefile.sh index f0cbf963..e04b99fc 100755 --- a/scripts/create_Makefile.sh +++ b/scripts/create_Makefile.sh @@ -6,17 +6,17 @@ # module directory. # Thu Apr 3 01:44:41 CEST 2014 -MODULE=$(basename "$PWD") - -if [[ "$MODULE" == "src" ]] +if [[ -z ${QPACKAGE_ROOT} ]] then - echo "Error: This script should not be run in the src directory." - exit 1 + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 fi +source ${QPACKAGE_ROOT}/scripts/qp_include.sh + +check_current_dir_is_module cat << EOF > Makefile -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/scripts/create_Makefile_depend.sh b/scripts/create_Makefile_depend.sh index 6edd9843..56e1c5e0 100755 --- a/scripts/create_Makefile_depend.sh +++ b/scripts/create_Makefile_depend.sh @@ -6,9 +6,19 @@ # files included by including other modules. # Thu Apr 3 01:44:09 CEST 2014 +if [[ -z ${QPACKAGE_ROOT} ]] +then + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 +fi +source ${QPACKAGE_ROOT}/scripts/qp_include.sh + +check_current_dir_is_module + SRC="" OBJ="" -DEPS="$(cat NEEDED_MODULES)" +DEPS="$NEEDED_MODULES" for M in ${DEPS} do diff --git a/scripts/create_Needed_modules.sh b/scripts/create_Needed_modules.sh index 9b08b127..026eadab 100755 --- a/scripts/create_Needed_modules.sh +++ b/scripts/create_Needed_modules.sh @@ -4,13 +4,15 @@ # This script is supposed to run in a module directory. # Thu Apr 3 13:38:38 CEST 2014 -MODULE=$(basename $PWD) - -if [[ $MODULE == "src" ]] +if [[ -z ${QPACKAGE_ROOT} ]] then - echo "Error: This script should not be run in the src directory." - exit 1 + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 fi +source ${QPACKAGE_ROOT}/scripts/qp_include.sh + +check_current_dir_is_module OUTPUT=$(${QPACKAGE_ROOT}/scripts/check_dependencies.sh $@) echo ${OUTPUT} > NEEDED_MODULES diff --git a/scripts/create_gitignore.sh b/scripts/create_gitignore.sh index 2c249bb6..605b0ab8 100755 --- a/scripts/create_gitignore.sh +++ b/scripts/create_gitignore.sh @@ -5,6 +5,16 @@ # Tue Jan 13 14:18:05 CET 2015 # +if [[ -z ${QPACKAGE_ROOT} ]] +then + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 +fi +source ${QPACKAGE_ROOT}/scripts/qp_include.sh + +check_current_dir_is_module + cat << EOF > .gitignore # # Do not modify this file. Add your ignored files to the gitignore diff --git a/scripts/create_module.sh b/scripts/create_module.sh index 74362bc7..dbddc3d3 100755 --- a/scripts/create_module.sh +++ b/scripts/create_module.sh @@ -7,7 +7,17 @@ # All remaining aruments are dependencies. # Thu Apr 3 01:44:58 CEST 2014 -DEBUG=1 +if [[ -z ${QPACKAGE_ROOT} ]] +then + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 +fi +source ${QPACKAGE_ROOT}/scripts/qp_include.sh + +check_current_dir_is_src + +DEBUG=0 # If DEBUG=1, the print debug info. function debug() @@ -36,13 +46,6 @@ function fail() } -if [[ -z $QPACKAGE_ROOT ]] -then - echo "Error:" - echo "QPACKAGE_ROOT environment variable is not set." - echo "source quantum_package.rc" - exit 1 -fi MODULE=$1 @@ -68,7 +71,7 @@ debug "Module does not already exist: OK" # Set up dependencies -ALL_MODULES="$(cat NEEDED_MODULES)" +ALL_MODULES="${NEEDED_MODULES}" echo "Select which modules you are sure you will need: (press q to quit)" NEEDED_MODULES="" select M in ${ALL_MODULES} diff --git a/scripts/create_rst_templates.sh b/scripts/create_rst_templates.sh index d78f49f3..931701ee 100755 --- a/scripts/create_rst_templates.sh +++ b/scripts/create_rst_templates.sh @@ -3,24 +3,15 @@ # Creates the rst files when creating a new module. # Thu Apr 3 11:54:16 CEST 2014 -MODULE=$(basename $PWD) - -if [[ $MODULE == "src" ]] +if [[ -z ${QPACKAGE_ROOT} ]] then - echo "Error: This script should not be run in the src directory." - exit 1 + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 fi +source ${QPACKAGE_ROOT}/scripts/qp_include.sh -function asksure() { - echo -n $@ "(Y/N) " - answer=w - while [[ $answer != [YyNn] ]] - do - read answer - [[ $answer = [Yy] ]] && retval=0 || retval=1 - done - return $retval -} +check_current_dir_is_module README="True" if [[ -f README.rst ]] diff --git a/scripts/ezfio_interface.py b/scripts/ezfio_interface.py index beebd8a2..ed7ebfc9 100755 --- a/scripts/ezfio_interface.py +++ b/scripts/ezfio_interface.py @@ -184,15 +184,26 @@ def save_ezfio_provider(path_head, dict_code_provider): path = "{0}/ezfio_interface.irp.f".format(path_head) - print "Path = {}".format(path) +# print "Path = {}".format(path) - with open(path, "w") as f: - f.write("!DO NOT MODIFY BY HAND \n") - f.write("!Created by $QPACKAGE_ROOT/scripts/ezfio_interface.py \n") - f.write("!from file {0}/EZFIO.cfg\n".format(path_head)) - f.write("\n") - for provider_name, code in dict_code_provider.iteritems(): - f.write(code + "\n") + try: + f = open(path, "r") + except IOError: + old_output = "" + else: + old_output = f.read() + f.close() + + output = "! DO NOT MODIFY BY HAND\n" + \ + "! Created by $QPACKAGE_ROOT/scripts/ezfio_interface.py\n" + \ + "! from file {0}/EZFIO.cfg\n".format(path_head) + \ + "\n" + for provider_name, code in dict_code_provider.iteritems(): + output += code + "\n" + + if output != old_output: + with open(path, "w") as f: + f.write(output) def create_ezfio_config(dict_ezfio_cfg, opt, folder): @@ -220,10 +231,19 @@ def save_ezfio_config(folder, str_ezfio_config): path = "{0}/config/{1}.ezfio_interface_config".format(ezfio_dir, folder) - print "Path = {}".format(path) +# print "Path = {}".format(path) - with open(path, "w") as f: - f.write(str_ezfio_config) + try: + f = open(path, "r") + except IOError: + old_output = "" + else: + old_output = f.read() + f.close() + + if str_ezfio_config != old_output: + with open(path, "w") as f: + f.write(str_ezfio_config) def main(): """Take in argument a EZFIO.cfg""" @@ -238,28 +258,25 @@ def main(): path = os.path.expanduser(path) path = os.path.expandvars(path) path = os.path.abspath(path) - print path +# print path path_dirname = os.path.dirname(path) folder = [i for i in path_dirname.split("/") if i][-1] folder = folder.lower() - print "Find a EZFIO.cfg in {}".format(path) +# print "Found a EZFIO.cfg in {}".format(path) dict_info_provider = get_dict_config_file(path,folder) - print "Generating the ezfio_interface.irp.f: \n" +# print "Generating the ezfio_interface.irp.f: \n" d_config = create_ezfio_provider(dict_info_provider) -# for provider, code in d_config.iteritems(): -# print code - print "Saving the ezfio_interface.irp.f" +# print "Saving the ezfio_interface.irp.f" save_ezfio_provider(path_dirname, d_config) - print "Generating the ezfio_config" +# print "Generating the ezfio_config" config_ezfio = create_ezfio_config(dict_info_provider, "config", folder) -# print config_ezfio - print "Saving ezfio_config" +# print "Saving ezfio_config" save_ezfio_config(folder, config_ezfio) diff --git a/scripts/get_basis.sh b/scripts/get_basis.sh index d6182799..51b0a4f0 100755 --- a/scripts/get_basis.sh +++ b/scripts/get_basis.sh @@ -8,6 +8,13 @@ # Prints in stdout the name of a temporary file containing the basis set. # +if [[ -z ${QPACKAGE_ROOT} ]] +then + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 +fi + export EMSL_API_ROOT="${QPACKAGE_ROOT}"/EMSL_Basis/ export PYTHONPATH="${EMSL_API_ROOT}":${PYTHONPATH} @@ -15,8 +22,11 @@ tmpfile="$1" shift # Case insensitive basis in input -basis=$( ${EMSL_API_ROOT}/EMSL_api.py list_basis | cut -d "'" -f 2 | grep -i "^${1}\$") +#basis=$( ${EMSL_API_ROOT}/EMSL_api.py list_basis | cut -d "'" -f 2 | grep -i "^${1}\$") + +basis="$1" shift + atoms="" for atom in $@ diff --git a/scripts/install_curl.sh b/scripts/install_curl.sh index afe49839..20033f77 100755 --- a/scripts/install_curl.sh +++ b/scripts/install_curl.sh @@ -6,12 +6,11 @@ CURL="curl-7.30.0.ermine" CURL_URL="http://qmcchem.ups-tlse.fr/files/scemama/${CURL}.tar.bz2" -# Check the QPACKAGE_ROOT directory if [[ -z ${QPACKAGE_ROOT} ]] then - echo "The QPACKAGE_ROOT environment variable is not set." - echo "Please reload the quantum_package.rc file." - exit 1 + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 fi cd ${QPACKAGE_ROOT} diff --git a/scripts/install_emsl.sh b/scripts/install_emsl.sh index dae8f670..dff002a1 100755 --- a/scripts/install_emsl.sh +++ b/scripts/install_emsl.sh @@ -6,18 +6,18 @@ BASE="EMSL_Basis_Set_Exchange_Local" URL="https://github.com/LCPQ/${BASE}/archive/master.tar.gz" -# Check the QPACKAGE_ROOT directory if [[ -z ${QPACKAGE_ROOT} ]] then - echo "The QPACKAGE_ROOT environment variable is not set." - echo "Please reload the quantum_package.rc file." - exit 1 + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 fi cd ${QPACKAGE_ROOT} ${QPACKAGE_ROOT}/scripts/fetch_from_web.py ${URL} ${QPACKAGE_ROOT}/${BASE}.tar.gz tar -zxf ${BASE}.tar.gz && rm ${BASE}.tar.gz ||exit 1 +rm -rf EMSL_Basis mv ${BASE}-master EMSL_Basis diff --git a/scripts/install_ezfio.sh b/scripts/install_ezfio.sh index e43363cf..0f7a6505 100755 --- a/scripts/install_ezfio.sh +++ b/scripts/install_ezfio.sh @@ -6,17 +6,15 @@ BASE="ezfio" URL="https://github.com/LCPQ/${BASE}/archive/master.tar.gz" -# Check the QPACKAGE_ROOT directory if [[ -z ${QPACKAGE_ROOT} ]] then - echo "The QPACKAGE_ROOT environment variable is not set." - echo "Please reload the quantum_package.rc file." - exit 1 + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 fi cd ${QPACKAGE_ROOT} - rm -rf -- EZFIO ${QPACKAGE_ROOT}/scripts/fetch_from_web.py ${URL} ${QPACKAGE_ROOT}/${BASE}.tar.gz tar -zxf ${BASE}.tar.gz && rm ${BASE}.tar.gz ||exit 1 diff --git a/scripts/install_ocaml.sh b/scripts/install_ocaml.sh index 3c695df4..9e89fb68 100755 --- a/scripts/install_ocaml.sh +++ b/scripts/install_ocaml.sh @@ -45,7 +45,8 @@ then done fi fi -scripts/fetch_from_web.py "https://raw.github.com/ocaml/opam/master/shell/opam_installer.sh" opam_installer.sh +${QPACKAGE_ROOT}/scripts/fetch_from_web.py \ + "https://raw.github.com/ocaml/opam/master/shell/opam_installer.sh" opam_installer.sh chmod +x opam_installer.sh echo N | ./opam_installer.sh ${QPACKAGE_ROOT}/bin @@ -53,6 +54,7 @@ if [[ ! -f ${QPACKAGE_ROOT}/bin/opam ]]; then echo "Installation of OPAM failed" exit 2 fi +rm opam_installer.sh ${QPACKAGE_ROOT}/bin/opam config setup -a --dot-profile ${QPACKAGE_ROOT}/quantum_package.rc source ${QPACKAGE_ROOT}/quantum_package.rc diff --git a/scripts/prepare_ezfio.sh b/scripts/prepare_ezfio.sh new file mode 100755 index 00000000..c01bacd3 --- /dev/null +++ b/scripts/prepare_ezfio.sh @@ -0,0 +1,18 @@ +#!/bin/bash +# Prepares the EZFIO library before running make +# Wed Mar 25 21:25:11 CET 2015 + +echo "Building EZFIO library" +echo "=-=-=-=-=-=-=-=-=-=-=-" + +# Interpret all the EZFIO.cfg files +for dir in ${QPACKAGE_ROOT}/src/*/ +do + cd $dir || exit -1 + ${QPACKAGE_ROOT}/scripts/ezfio_interface.py +done + +# For old-style directories. Will be removed some day... +cp ${QPACKAGE_ROOT}/src{/*,}/*.ezfio_config ${QPACKAGE_ROOT}/EZFIO/config + + diff --git a/scripts/prepare_module.sh b/scripts/prepare_module.sh deleted file mode 100755 index 287c3663..00000000 --- a/scripts/prepare_module.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -# This script is used by module Makefiles, and should not be used by users. -# Checks if all the other module directories are properly linked in the -# current directory. If not, the links are created. -# Wed Apr 2 14:35:42 CEST 2014 - -for dir in $@ -do - if [[ ! -h $dir ]] ; - then - ln -s ../$dir $dir - fi -done - - diff --git a/scripts/qp_include.sh b/scripts/qp_include.sh new file mode 100644 index 00000000..467baca8 --- /dev/null +++ b/scripts/qp_include.sh @@ -0,0 +1,80 @@ +#!/bin/bash +# +# Useful functions in all scripts + +# Make a list unique +function unique_list() +{ + for d in $@ + do + echo $d + done | sort | uniq +} + +function check_current_dir_is_src() +{ + if [[ "${PWD}" == "${QPACKAGE_ROOT}/src" ]] + then + return 0 + else + echo "Current directory should be \$QPACKAGE_ROOT/src" + exit -1 + fi +} + +function check_current_dir_is_module() +{ + cd .. + if [[ "${PWD}" == "${QPACKAGE_ROOT}/src" ]] + then + cd $OLDPWD + return 0 + else + cd $OLDPWD + echo "Current directory should be \$QPACKAGE_ROOT/src" + exit -1 + fi +} +if [[ -f NEEDED_MODULES ]] +then + NEEDED_MODULES=$(cat NEEDED_MODULES) +fi + +# List of executables in the current directory +function ls_exe() +{ + find . -perm /u+x -type f +} + +function asksure() { + echo -n $@ "(Y/N) " + answer=w + while [[ $answer != [YyNn] ]] + do + read answer + [[ $answer = [Yy] ]] && retval=0 || retval=1 + done + return $retval +} + +function error() +{ + echo "-------------------- Error --------------------" + printf "$@\n" + echo "-----------------------------------------------" + exit -1 +} + +if [[ -z ${DEBUG} ]] +then + function info () + { + : + } +else + function info () + { + echo "$@" + } +fi + diff --git a/scripts/run_Makefile_common.sh b/scripts/run_Makefile_common.sh new file mode 100755 index 00000000..0a579a94 --- /dev/null +++ b/scripts/run_Makefile_common.sh @@ -0,0 +1,69 @@ +#!/bin/bash +# +# Checks to run in every Module directory before building + +if [[ -z ${QPACKAGE_ROOT} ]] +then + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 +fi +source ${QPACKAGE_ROOT}/scripts/qp_include.sh + +check_current_dir_is_module + +# Check if the NEEDED_MODULES file is consistent +INCLUDE_DIRS="${NEEDED_MODULES} include" +NEEDED_MODULES_OK=$( ${QPACKAGE_ROOT}/scripts/check_dependencies.sh ${NEEDED_MODULES} ) +if [[ $? -ne 0 ]] +then + error " +Your NEEDED_MODULES file is inconsistent. It should be +${NEEDED_MODULES_OK} +" +else + info "NEEDED_MODULES files is consistent" +fi + +# Check if README.rst exists +if [[ ! -f README.rst ]] +then + ${QPACKAGE_ROOT}/scripts/create_rst_templates.sh + error " +README.rst was not present, so I created a +default one for you. +You should document it before you compile, as +well as the ASSUMPTIONS.rst file. +" +else + info "README.rst is present" +fi + + +# Check if ASSUMPTIONS.rst exists +if [[ ! -f ASSUMPTIONS.rst ]] +then + error "This is a Bug. At that point, the ASSUMPTIONS.rst) file should exist." +else + info "ASSUMPTIONS.rst is present." +fi + + +# Create symbolic links of other modules +if [[ $PWD != ${QPACKAGE_ROOT}/src ]] +then + for dir in ${INCLUDE_DIRS} + do + if [[ ! -h $dir ]] ; + then + ln -s ../$dir $dir + fi + done +fi + +# Update Makefile.depend +${QPACKAGE_ROOT}/scripts/create_Makefile_depend.sh + +# Update EZFIO interface +${QPACKAGE_ROOT}/scripts/ezfio_interface.py + diff --git a/scripts/run_Makefile_global.sh b/scripts/run_Makefile_global.sh new file mode 100755 index 00000000..82dee8ab --- /dev/null +++ b/scripts/run_Makefile_global.sh @@ -0,0 +1,81 @@ +#!/bin/bash +# Makes several checks before compiling. +# Wed Mar 25 21:22:18 CET 2015 + +# Required EZFIO version +EZFIO_REQUIRED_VERSION=1.1 + +# Required IRPF90 version +IRPF90_REQUIRED_VERSION=1.5 + +if [[ -z ${QPACKAGE_ROOT} ]] +then + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 +fi +source ${QPACKAGE_ROOT}/scripts/qp_include.sh + +check_current_dir_is_src + + +# Check if the user's config exists +if [[ ! -f ${QPACKAGE_ROOT}/src/Makefile.config ]] +then + error " +Makefile.config is not present. +You can create Makefile.config +by modifying Makefile.config.example +" +else + info "Makefile.config is present" +fi + + +IRPF90_VERSION=$( ${IRPF90} -v ) +python << EOF +import sys +irp_version = float("${IRPF90_VERSION}".rsplit('.',1)[0]) +irp_required_version = float($IRPF90_REQUIRED_VERSION) +if irp_version < irp_required_version: + sys.exit(-1) +EOF + +if [[ $? -ne 0 ]] +then + error " +Current IRPF90 version : +\$ ${IRPF90} -v +${IRPF90_VERSION}. + +IRPF90 version >= ${IRPF90_REQUIRED_VERSION} is required. +To upgrade IRPF90, run : + ${QPACKAGE_ROOT}/scripts/upgrade_irpf90.sh +" +else + info "irpf90 version is OK" +fi + + +# Check EZFIO version +EZFIO_VERSION=$(cat ${QPACKAGE_ROOT}/EZFIO/version | cut -d '=' -f 2) +python << EOF +import sys +ezfio_version = float("${EZFIO_VERSION}".rsplit('.',1)[0]) +ezfio_required_version = float($EZFIO_REQUIRED_VERSION) +if ezfio_version < ezfio_required_version: + sys.exit(-1) +EOF + +if [[ $? -ne 0 ]] +then + error " +Current EZFIO version : ${EZFIO_VERSION} +EZFIO version >= ${EZFIO_REQUIRED_VERSION} is required. +To upgrade EZFIO, run : + ${QPACKAGE_ROOT}/scripts/upgrade_ezfio.sh +" +else + info "EZFIO version is OK" +fi + diff --git a/scripts/save_current_mos.sh b/scripts/save_current_mos.sh index 941f4ed8..36149ae2 100755 --- a/scripts/save_current_mos.sh +++ b/scripts/save_current_mos.sh @@ -4,6 +4,13 @@ # directory, where xxx is the corresponding mo_label. # Wed Apr 2 14:35:15 CEST 2014 +if [[ -z ${QPACKAGE_ROOT} ]] +then + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 +fi + EZFIO=$1 if [[ -z ${EZFIO} ]] diff --git a/scripts/unarchive_ezfio.sh b/scripts/unarchive_ezfio.sh deleted file mode 100755 index 7f70fa6e..00000000 --- a/scripts/unarchive_ezfio.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# -# Reads a *.md5 file, then fetches the proper data in the -# cache and re-creates the EZFIO database. -# If the cache data is not present, download it from -# $QPACKAGE_CACHE_URL -# Fri Apr 4 01:02:53 CEST 2014 - -if [[ -z ${QPACKAGE_ROOT} ]] -then - print "The QPACKAGE_ROOT environment variable is not set." - print "Please reload the quantum_package.rc file." -fi - -EZFIO_FILE=$(basename $(basename ${1} .md5)) - -if [[ -z $1 ]] -then - echo "Usage: $(basename $0) " - exit 1 -fi - -if [[ ! -f ${EZFIO_FILE}.md5 ]] -then - echo "Error: ${EZFIO_FILE}.md5 does not exist." - exit 1 -fi - -key=($(cut -d ' ' -f 1 ${EZFIO_FILE}.md5)) -filename=($(cut -d ' ' -f 2 ${EZFIO_FILE}.md5)) - -if [[ -z ${QPACKAGE_CACHE_URL} ]] -then - echo "Error: The QPACKAGE_CACHE_URL environment variable is not set." - exit 1 -fi - -VERSION=$( cut -d '=' -f 2 < ${QPACKAGE_ROOT}/EZFIO/version) -for i in ${!key[@]} -do - MD5=${key[$i]} - file=${filename[$i]} - if [[ ! -d $file ]] - then - mkdir -p $(dirname $file) - echo ${VERSION} > $(dirname $file)/.version - fi - if [[ ! -f ${QPACKAGE_ROOT}/data/cache/${MD5} ]] - then - ${QPACKAGE_ROOT}/scripts/fetch_from_web.py ${QPACKAGE_CACHE_URL}/${MD5} ${QPACKAGE_ROOT}/data/cache/${MD5} - fi - cp ${QPACKAGE_ROOT}/data/cache/${MD5} ${file} -done -echo ${VERSION} > ${EZFIO_FILE}.ezfio/.version diff --git a/scripts/upgrade_ezfio.sh b/scripts/upgrade_ezfio.sh index daa51405..4a9af403 100755 --- a/scripts/upgrade_ezfio.sh +++ b/scripts/upgrade_ezfio.sh @@ -12,7 +12,7 @@ fi cd -- ${QPACKAGE_ROOT} mv -- ${QPACKAGE_ROOT}/EZFIO ${QPACKAGE_ROOT}/EZFIO.old -make EZFIO +${QPACKAGE_ROOT}/scripts/install_ezfio.sh if [[ $? -eq 0 ]] then diff --git a/setup_environment.sh b/setup_environment.sh index c0d8b0ce..9fe24c96 100755 --- a/setup_environment.sh +++ b/setup_environment.sh @@ -75,6 +75,9 @@ source ${QPACKAGE_ROOT}/quantum_package.rc " $BLACK +mkdir -f install_logs +mv *.log install_logs/ + if [[ $1 == "--robot" ]] ; then exit 0 diff --git a/src/AOs/Makefile b/src/AOs/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/AOs/Makefile +++ b/src/AOs/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/BiInts/Makefile b/src/BiInts/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/BiInts/Makefile +++ b/src/BiInts/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Bitmask/Makefile b/src/Bitmask/Makefile index fa91d467..d230cb0c 100644 --- a/src/Bitmask/Makefile +++ b/src/Bitmask/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC=bitmasks_module.f90 diff --git a/src/CAS_SD_selected/Makefile b/src/CAS_SD_selected/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/CAS_SD_selected/Makefile +++ b/src/CAS_SD_selected/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/CID/Makefile b/src/CID/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/CID/Makefile +++ b/src/CID/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/CID_SC2_selected/Makefile b/src/CID_SC2_selected/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/CID_SC2_selected/Makefile +++ b/src/CID_SC2_selected/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/CID_selected/Makefile b/src/CID_selected/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/CID_selected/Makefile +++ b/src/CID_selected/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/CIS/Makefile b/src/CIS/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/CIS/Makefile +++ b/src/CIS/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/CISD/Makefile b/src/CISD/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/CISD/Makefile +++ b/src/CISD/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/CISD_SC2_selected/Makefile b/src/CISD_SC2_selected/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/CISD_SC2_selected/Makefile +++ b/src/CISD_SC2_selected/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/CISD_selected/Makefile b/src/CISD_selected/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/CISD_selected/Makefile +++ b/src/CISD_selected/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/DDCI_selected/Makefile b/src/DDCI_selected/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/DDCI_selected/Makefile +++ b/src/DDCI_selected/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Dets/Makefile b/src/Dets/Makefile index f97f77c0..092d879d 100644 --- a/src/Dets/Makefile +++ b/src/Dets/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC=H_apply_template.f diff --git a/src/Electrons/Makefile b/src/Electrons/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/Electrons/Makefile +++ b/src/Electrons/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Ezfio_files/Makefile b/src/Ezfio_files/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/Ezfio_files/Makefile +++ b/src/Ezfio_files/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/FCIdump/Makefile b/src/FCIdump/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/FCIdump/Makefile +++ b/src/FCIdump/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Full_CI/Makefile b/src/Full_CI/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/Full_CI/Makefile +++ b/src/Full_CI/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Generators_CAS/Makefile b/src/Generators_CAS/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/Generators_CAS/Makefile +++ b/src/Generators_CAS/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Generators_full/Makefile b/src/Generators_full/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/Generators_full/Makefile +++ b/src/Generators_full/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Generators_restart/Makefile b/src/Generators_restart/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/Generators_restart/Makefile +++ b/src/Generators_restart/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Hartree_Fock/Makefile b/src/Hartree_Fock/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/Hartree_Fock/Makefile +++ b/src/Hartree_Fock/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/MOGuess/Makefile b/src/MOGuess/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/MOGuess/Makefile +++ b/src/MOGuess/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/MOs/Makefile b/src/MOs/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/MOs/Makefile +++ b/src/MOs/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/MP2/Makefile b/src/MP2/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/MP2/Makefile +++ b/src/MP2/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Makefile b/src/Makefile index 307197fe..cd8ce65b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,19 +1,24 @@ -default: all +ifndef QPACKAGE_ROOT + $(error "QPACKAGE_ROOT is not defined. Please source quantum_package.rc") +endif -SRC= -OBJ= +include Makefile.config ALL_MODULES=$(shell cat NEEDED_MODULES) +EZFIO_DIR=$(QPACKAGE_ROOT)/EZFIO +EZFIO=$(EZFIO_DIR)/lib/libezfio_irp.a -.PHONY: executables all all_clean $(ALL_MODULES) +.PHONY: $(ALL_MODULES) -all: $(ALL_MODULES) -all_clean: - @for i in $(ALL_MODULES) ; do cd $$i ; make veryclean ; make clean_links ; cd .. ; done +default: $(EZFIO) + $(QPACKAGE_ROOT)/scripts/build_modules.sh $(ALL_MODULES) -$(ALL_MODULES): FORCE - cd $@ ; make -j $$(cat /proc/cpuinfo | grep MHz | wc -l) +veryclean: + $(QPACKAGE_ROOT)/scripts/clean_modules.sh $(ALL_MODULES) + +$(ALL_MODULES): $(EZFIO) + $(QPACKAGE_ROOT)/scripts/build_modules.sh $@ executables: $(ALL_MODULES) rm -f executables ; \ @@ -21,7 +26,15 @@ executables: $(ALL_MODULES) do printf "%-30s %s\n" $$(basename $$EXE) $$EXE | sed "s|$(QPACKAGE_ROOT)|\$$QPACKAGE_ROOT|g" >> executables ;\ done -# Dummy rule to enable to force recompilation -FORCE: +# Define the EZFIO rules +$(EZFIO): $(wildcard $(QPACKAGE_ROOT)/src/*.ezfio_config) $(wildcard $(QPACKAGE_ROOT)/src/*/EZFIO.cfg) + $(QPACKAGE_ROOT)/scripts/prepare_ezfio.sh + cd $(EZFIO_DIR);\ + export FC="$(FC)" ; export FCFLAGS="$(FCFLAGS)" ; export IRPF90="$(IRPF90)" ;\ + $(MAKE) ;\ + $(MAKE) Python + +# Frequent typos +clena: clean +veryclena: veryclean -veryclean: all_clean diff --git a/src/Makefile.common b/src/Makefile.common index 7b63f772..9ecc93c0 100644 --- a/src/Makefile.common +++ b/src/Makefile.common @@ -1,160 +1,34 @@ -.PHONY: default +.PHONY: default silent + +ifneq ($(IN_MAKE),1) + +default: + @$(MAKE) -C $(QPACKAGE_ROOT)/src $$(basename $(PWD)) + +veryclean: + clean_modules.sh + +else # Called by scripts/build_module.sh default: all .gitignore -# Required EZFIO version -EZFIO_VERSION=1.1 - -# Required IRPF90 version -IRPF90_VERSION=1.4 - -# Check if QPACKAGE_ROOT is defined - -ifndef QPACKAGE_ROOT -$(info -------------------- Error --------------------) -$(info QPACKAGE_ROOT undefined. Run the setup_environment.sh script) -$(info -----------------------------------------------) -$(error ) -#else -#$(info QPACKAGE_ROOT is defined.) -endif - - -# Check if the user's config exists - -MAKEFILE_OK=$(shell ls $(QPACKAGE_ROOT)/src/Makefile.config 2> /dev/null && echo True || echo False) -ifeq ($(MAKEFILE_OK),False) -$(info -------------------- Error --------------------) -$(info Makefile.config is not present.) -$(info You can create Makefile.config) -$(info by modifying Makefile.config.example) -$(info -----------------------------------------------) -$(error ) -#else -#$(info Makefile.config is present.) -endif - - # Include the user's config - include $(QPACKAGE_ROOT)/src/Makefile.config - -# Check the version of IRPF90 - -IRP_VERSION_OK=$(shell $(IRPF90) -v | python -c "import sys ; print float(sys.stdin.readline().rsplit('.',1)[0]) >= $(IRPF90_VERSION)") -ifeq ($(IRP_VERSION_OK),False) -$(info -------------------- Error --------------------) -$(info IRPF90 version >= $(IRPF90_VERSION) is required) -$(info To upgrade IRPF90, run : ) -$(info $(QPACKAGE_ROOT)/scripts/upgrade_irpf90.sh ) -$(info -----------------------------------------------) -$(error ) -#else -#$(info irpf90 version is OK.) -endif - - # Create the NEEDED_MODULES variable, needed for IRPF90 - NEEDED_MODULES=$(shell cat NEEDED_MODULES) - -# Check if the NEEDED_MODULES file is consistent - -NEEDED_MODULES_OK=$(shell X=`$(QPACKAGE_ROOT)/scripts/check_dependencies.sh $(NEEDED_MODULES)` && echo OK || echo $$X) -ifneq ($(NEEDED_MODULES_OK),OK) -$(info -------------------- Error --------------------) -$(info Your NEEDED_MODULES file is inconsistent. It should be) -$(info $(NEEDED_MODULES_OK)) -$(info -----------------------------------------------) -$(error ) -#else -#$(info NEEDED_MODULES files is consistent.) -endif - - # Check and update dependencies - include Makefile.depend -# Check if README.rst exists - -README_RST_OK=$(shell ls README.rst 2>/dev/null || echo False) -ifeq ($(README_RST_OK), False) -$(shell $(QPACKAGE_ROOT)/scripts/create_rst_templates.sh) -$(info -------------------- Error --------------------) -$(info README.rst was not present, so I created a) -$(info default one for you.) -$(info You should document it before you compile, as) -$(info well as the ASSUMPTIONS.rst file.) -$(info -----------------------------------------------) -$(error ) -#else -#$(info README.rst is present.) -endif - - -# Check if ASSUMPTIONS.rst exists - -ASSUMPTIONS_RST_OK=$(shell ls ASSUMPTIONS.rst || echo False) -ifeq ($(ASSUMPTIONS_RST_OK), False) -$(info -------------------- Error --------------------) -$(info This is a Bug. At that point, the ASSUMPTIONS.rst) -$(info file should exist.) -$(info -----------------------------------------------) -#else -#$(info ASSUMPTIONS.rst is present.) -endif - - # Define the Makefile common variables - EZFIO_DIR=$(QPACKAGE_ROOT)/EZFIO EZFIO=$(EZFIO_DIR)/lib/libezfio_irp.a INCLUDE_DIRS=$(NEEDED_MODULES) include -# Check EZFIO version - -EZFIO_VERSION_OK=$(shell cat $(EZFIO_DIR)/version | cut -d '=' -f 2 | python -c "import sys ; print float(sys.stdin.readline().rsplit('.',1)[0]) >= $(EZFIO_VERSION)") -ifeq ($(EZFIO_VERSION_OK),False) -$(info -------------------- Error --------------------) -$(info EZFIO version >= $(EZFIO_VERSION) is required ) -$(info To upgrade EZFIO, run : ) -$(info $(QPACKAGE_ROOT)/scripts/upgrade_ezfio.sh ) -$(info -----------------------------------------------) -$(error ) -#else -#$(info EZFIO version is OK.) -endif - -# Define the EZFIO rules - -$(EZFIO): $(wildcard $(QPACKAGE_ROOT)/src/*.ezfio_config) $(wildcard $(QPACKAGE_ROOT)/src/*/*.ezfio_config) $(wildcard $(QPACKAGE_ROOT)/src/*/EZFIO.cfg) - @echo Building EZFIO library - @echo =-=-=-=-=-=-=-=-=-=-=- - for dir in $(QPACKAGE_ROOT)/src/*/ ;\ - do \ - cd $$dir && \ - $(QPACKAGE_ROOT)/scripts/ezfio_interface.py && \ - cd .. ;\ - done - cp $(wildcard $(QPACKAGE_ROOT)/src/*.ezfio_config) $(wildcard $(QPACKAGE_ROOT)/src/*/*.ezfio_config) $(EZFIO_DIR)/config - cd $(EZFIO_DIR) ; export FC="$(FC)" ; export FCFLAGS="$(FCFLAGS)" ; export IRPF90="$(IRPF90)" ; $(MAKE) ; $(MAKE) Python - -ezfio: $(EZFIO) - - -# Create symbolic links of other modules - -ifneq ($(PWD),$(QPACKAGE_ROOT)/src) -$(shell $(QPACKAGE_ROOT)/scripts/prepare_module.sh $(INCLUDE_DIRS)) clean_links: rm -f $(INCLUDE_DIRS) $$(basename $$PWD) -else -clean_links: -endif LIB+=$(EZFIO) $(MKL) IRPF90+=$(patsubst %, -I %, $(INCLUDE_DIRS)) $(IRPF90_FLAGS) @@ -163,22 +37,14 @@ irpf90.make: $(filter-out IRPF90_temp/%, $(wildcard */*.irp.f)) $(wildcard *.irp - $(IRPF90) - update_README.py -Makefile.depend: Makefile - $(QPACKAGE_ROOT)/scripts/create_Makefile_depend.sh - -ifneq ( $(PWD), $($(QPACKAGE_ROOT)/src)) include irpf90.make + endif -# Dummy rule to enable to force recompilation -FORCE: - -vercylean: veryclean - .gitignore: $(QPACKAGE_ROOT)/scripts/create_gitignore.sh - # Frequent typos clena: clean veryclena: veryclean +vercylean: veryclean diff --git a/src/Molden/Makefile b/src/Molden/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/Molden/Makefile +++ b/src/Molden/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/MonoInts/Makefile b/src/MonoInts/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/MonoInts/Makefile +++ b/src/MonoInts/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/NEEDED_MODULES b/src/NEEDED_MODULES index 84057d07..3df2ab88 100644 --- a/src/NEEDED_MODULES +++ b/src/NEEDED_MODULES @@ -1 +1 @@ -AOs BiInts Bitmask Dets Electrons Ezfio_files Full_CI Generators_full Hartree_Fock MOGuess MonoInts MOs Nuclei Output Selectors_full Utils Molden FCIdump Generators_CAS CAS_SD_selected DDCI_selected +AOs BiInts Bitmask CID CID_SC2_selected CID_selected CIS CISD CISD_selected CISD_SC2_selected Dets Electrons Ezfio_files Full_CI Generators_full Hartree_Fock MOGuess MonoInts MOs MP2 Nuclei Output Selectors_full Utils Molden FCIdump Generators_CAS CAS_SD_selected DDCI_selected diff --git a/src/Nuclei/Makefile b/src/Nuclei/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/Nuclei/Makefile +++ b/src/Nuclei/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Output/Makefile b/src/Output/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/Output/Makefile +++ b/src/Output/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Perturbation/Makefile b/src/Perturbation/Makefile index ea95cbf1..b668f388 100644 --- a/src/Perturbation/Makefile +++ b/src/Perturbation/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC=perturbation_template.f diff --git a/src/Properties/Makefile b/src/Properties/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/Properties/Makefile +++ b/src/Properties/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Selectors_full/Makefile b/src/Selectors_full/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/Selectors_full/Makefile +++ b/src/Selectors_full/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Selectors_no_sorted/Makefile b/src/Selectors_no_sorted/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/Selectors_no_sorted/Makefile +++ b/src/Selectors_no_sorted/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/SingleRefMethod/Makefile b/src/SingleRefMethod/Makefile index b2ea1de1..06dc50ff 100644 --- a/src/SingleRefMethod/Makefile +++ b/src/SingleRefMethod/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC= diff --git a/src/Utils/Makefile b/src/Utils/Makefile index 69065f55..aac09429 100644 --- a/src/Utils/Makefile +++ b/src/Utils/Makefile @@ -1,5 +1,3 @@ -default: all - # Define here all new external source files and objects.Don't forget to prefix the # object files with IRPF90_temp/ SRC=map_module.f90 From c7765043fefc0f3526acb04b978c68afa836bda2 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 26 Mar 2015 01:17:37 +0100 Subject: [PATCH 3/6] Improved setup --- scripts/install_irpf90.sh | 1 - setup_environment.sh | 73 +++++++++++++++++++++++++++++++++++---- 2 files changed, 66 insertions(+), 8 deletions(-) diff --git a/scripts/install_irpf90.sh b/scripts/install_irpf90.sh index 04513ca8..d93340d2 100755 --- a/scripts/install_irpf90.sh +++ b/scripts/install_irpf90.sh @@ -27,4 +27,3 @@ echo '${QPACKAGE_ROOT}/irpf90/bin/irpman $@' > bin/irpman chmod +x bin/irpf90 bin/irpman - diff --git a/setup_environment.sh b/setup_environment.sh index 9fe24c96..ca853fdf 100755 --- a/setup_environment.sh +++ b/setup_environment.sh @@ -41,22 +41,81 @@ export PATH=\${PATH}:"\${QPACKAGE_ROOT}"/ocaml source "\${QPACKAGE_ROOT}"/bin/irpman &> /dev/null EOF + source quantum_package.rc -make EZFIO + +echo "${BLUE}===== Installing IRPF90 ===== ${BLACK}" +${QPACKAGE_ROOT}/scripts/install_irpf90.sh | tee install_irpf90.log +if [[ ! -d ${QPACKAGE_ROOT}/irpf90 ]] +then + echo $RED "Error in IRPF90 installation" $BLACK + exit 1 +fi + +if [[ ! -x ${QPACKAGE_ROOT}/bin/irpf90 ]] +then + echo $RED "Error in IRPF90 installation" $BLACK + exit 1 +fi + + +if [[ ! -x ${QPACKAGE_ROOT}/bin/irpman ]] +then + echo $RED "Error in IRPF90 installation" $BLACK + exit 1 +fi + + +echo "${BLUE}===== Installing EZFIO ===== ${BLACK}" +${QPACKAGE_ROOT}/scripts/install_ezfio.sh | tee install_ezfio.log + if [[ ! -d ${QPACKAGE_ROOT}/EZFIO ]] then echo $RED "Error in EZFIO installation" $BLACK exit 1 fi -make ocaml -if [[ ! -f ${QPACKAGE_ROOT}/ocaml/Qptypes.ml ]] + +echo "${BLUE}===== Installing Zlib ===== ${BLACK}" +${QPACKAGE_ROOT}/scripts/install_zlib.sh | tee install_zlib.log + +echo "${BLUE}===== Installing Curl ===== ${BLACK}" +${QPACKAGE_ROOT}/scripts/install_curl.sh | tee install_curl.log + +echo "${BLUE}===== Installing M4 ===== ${BLACK}" +${QPACKAGE_ROOT}/scripts/install_m4.sh | tee install_m4.log + +echo "${BLUE}===== Installing EMSL Basis set library ===== ${BLACK}" +${QPACKAGE_ROOT}/scripts/install_emsl.sh | tee install_emsl.log + +if [[ ! -d ${QPACKAGE_ROOT}/EMSL_Basis ]] then - echo $RED "Error in ocaml installation" $BLACK + echo $RED "Error in EMSL Basis set library installation" $BLACK exit 1 fi -make resultsFile +echo "${BLUE}===== Installing EZFIO ===== ${BLACK}" + +${QPACKAGE_ROOT}/scripts/install_ezfio.sh | tee install_ezfio.log +if [[ ! -d ${QPACKAGE_ROOT}/EZFIO ]] +then + echo $RED "Error in EZFIO installation" $BLACK + exit 1 +fi + + +echo "${BLUE}===== Installing Ocaml compiler and libraries ===== ${BLACK}" +rm -f -- ocaml/Qptypes.ml +${QPACKAGE_ROOT}/scripts/install_ocaml.sh | tee install_ocaml.log + +if [[ ! -f ${QPACKAGE_ROOT}/ocaml/Qptypes.ml ]] +then + echo $RED "Error in Ocaml installation" $BLACK + exit 1 +fi + +echo "${BLUE}===== Installing resultsFile Python library ===== ${BLACK}" +${QPACKAGE_ROOT}/scripts/install_resultsFile.sh if [[ ! -d ${QPACKAGE_ROOT}/resultsFile ]] then echo $RED "Error in resultsFile installation" $BLACK @@ -75,8 +134,8 @@ source ${QPACKAGE_ROOT}/quantum_package.rc " $BLACK -mkdir -f install_logs -mv *.log install_logs/ +mkdir -p ${QPACKAGE_ROOT}/install_logs +mv ${QPACKAGE_ROOT}/*.log ${QPACKAGE_ROOT}/install_logs/ if [[ $1 == "--robot" ]] ; then From a500848a8b721902a67d052397b3dc28945fc672 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 26 Mar 2015 01:33:32 +0100 Subject: [PATCH 4/6] Improved Ocaml makefile --- ocaml/Makefile | 7 +++---- scripts/create_executables_list.sh | 26 ++++++++++++++++++++++++++ src/Makefile | 14 +++++--------- 3 files changed, 34 insertions(+), 13 deletions(-) create mode 100755 scripts/create_executables_list.sh diff --git a/ocaml/Makefile b/ocaml/Makefile index 18788a1b..be763cbd 100644 --- a/ocaml/Makefile +++ b/ocaml/Makefile @@ -1,7 +1,6 @@ -# Check if QPACKAGE_ROOT is defined - .NOPARALLEL: +# Check if QPACKAGE_ROOT is defined ifndef QPACKAGE_ROOT $(info -------------------- Error --------------------) $(info QPACKAGE_ROOT undefined. Source the quantum_package.rc script) @@ -30,8 +29,8 @@ default: $(ALL_TESTS) $(ALL_EXE) .gitignore echo $$i ; \ done >> .gitignore -executables: - $(MAKE) -C $(QPACKAGE_ROOT)/data executables +executables: $(QPACKAGE_ROOT)/data/executables + $(QPACKAGE_ROOT)/scripts/create_executables_list.sh external_libs: opam install cryptokit core diff --git a/scripts/create_executables_list.sh b/scripts/create_executables_list.sh new file mode 100755 index 00000000..b4aa4244 --- /dev/null +++ b/scripts/create_executables_list.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# +# Thu Mar 26 01:27:14 CET 2015 + +if [[ -z ${QPACKAGE_ROOT} ]] +then + print "The QPACKAGE_ROOT environment variable is not set." + print "Please reload the quantum_package.rc file." + exit -1 +fi +source ${QPACKAGE_ROOT}/scripts/qp_include.sh + +cd ${QPACKAGE_ROOT}/data + +rm -f executables +EXES=$(find ${QPACKAGE_ROOT}/src -perm /u+x -type f | grep -e "${QPACKAGE_ROOT}/src/[^/]*/[^/]*$" |sort ) + +for EXE in $EXES +do + printf "%-30s %s\n" $(basename $EXE) $EXE | sed "s|${QPACKAGE_ROOT}|\$QPACKAGE_ROOT|g" >> executables +done + + + + + diff --git a/src/Makefile b/src/Makefile index cd8ce65b..298cc134 100644 --- a/src/Makefile +++ b/src/Makefile @@ -8,24 +8,18 @@ ALL_MODULES=$(shell cat NEEDED_MODULES) EZFIO_DIR=$(QPACKAGE_ROOT)/EZFIO EZFIO=$(EZFIO_DIR)/lib/libezfio_irp.a -.PHONY: $(ALL_MODULES) +.PHONY: $(ALL_MODULES) ezfio -default: $(EZFIO) +default: ezfio $(QPACKAGE_ROOT)/scripts/build_modules.sh $(ALL_MODULES) veryclean: $(QPACKAGE_ROOT)/scripts/clean_modules.sh $(ALL_MODULES) -$(ALL_MODULES): $(EZFIO) +$(ALL_MODULES): ezfio $(QPACKAGE_ROOT)/scripts/build_modules.sh $@ -executables: $(ALL_MODULES) - rm -f executables ; \ - for EXE in $$(find $(QPACKAGE_ROOT)/src -perm /u+x -type f | grep -e "$(QPACKAGE_ROOT)/src/[^/]*/[^/]*$$" |sort ) ; \ - do printf "%-30s %s\n" $$(basename $$EXE) $$EXE | sed "s|$(QPACKAGE_ROOT)|\$$QPACKAGE_ROOT|g" >> executables ;\ - done - # Define the EZFIO rules $(EZFIO): $(wildcard $(QPACKAGE_ROOT)/src/*.ezfio_config) $(wildcard $(QPACKAGE_ROOT)/src/*/EZFIO.cfg) $(QPACKAGE_ROOT)/scripts/prepare_ezfio.sh @@ -34,6 +28,8 @@ $(EZFIO): $(wildcard $(QPACKAGE_ROOT)/src/*.ezfio_config) $(wildcard $(QPACKAGE_ $(MAKE) ;\ $(MAKE) Python +ezfio: $(EZFIO) + # Frequent typos clena: clean veryclena: veryclean From ded78166db5d511172ff90990fcabd9662610ddf Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 26 Mar 2015 02:03:01 +0100 Subject: [PATCH 5/6] Corrected ocaml makefile --- ocaml/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ocaml/Makefile b/ocaml/Makefile index be763cbd..2c3fae01 100644 --- a/ocaml/Makefile +++ b/ocaml/Makefile @@ -30,6 +30,8 @@ default: $(ALL_TESTS) $(ALL_EXE) .gitignore done >> .gitignore executables: $(QPACKAGE_ROOT)/data/executables + +$(QPACKAGE_ROOT)/data/executables: $(QPACKAGE_ROOT)/scripts/create_executables_list.sh external_libs: From abff0f0c44e58d3314abaae0323975081753042d Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 26 Mar 2015 02:16:12 +0100 Subject: [PATCH 6/6] Fixed static build with gfortran --- scripts/make_binary.sh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/scripts/make_binary.sh b/scripts/make_binary.sh index 8ac6495d..832be596 100755 --- a/scripts/make_binary.sh +++ b/scripts/make_binary.sh @@ -123,8 +123,12 @@ echo "Copying dynamic libraries" # -------------------------- MKL_LIBS=$(find_libs ${FORTRAN_EXEC} | grep libmkl | head -1) -MKL_LIBS=$(dirname ${MKL_LIBS}) -MKL_LIBS=$(ls ${MKL_LIBS}/libmkl_{def,avx,avx2}.so) +if [[ -n ${MKL_LIBS} ]] +then + MKL_LIBS=$(dirname ${MKL_LIBS}) + MKL_LIBS=$(ls ${MKL_LIBS}/libmkl_{def,avx,avx2}.so) +fi + ALL_LIBS=$(find_libs ${OCAML_EXEC} ${FORTRAN_EXEC}) cp -- ${ALL_LIBS} ${MKL_LIBS} ${QPACKAGE_STATIC}/extra_lib if [[ $? -ne 0 ]] ; @@ -133,12 +137,7 @@ then exit 1 fi -cp -- ${QPACKAGE_STATIC}/extra_lib/{libiomp*,libmkl*} ${QPACKAGE_STATIC}/lib/ -if [[ $? -ne 0 ]] ; -then - echo 'mv -- ${QPACKAGE_STATIC}/extra_lib/{libiomp*,libmkl*} ${QPACKAGE_STATIC}/lib/' - exit 1 -fi +cp -- ${QPACKAGE_STATIC}/extra_lib/lib{[gi]omp*,mkl*,lapack*,blas*,z*} ${QPACKAGE_STATIC}/lib/ # echo "Copying EMSL_Basis directory"