10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-06-22 21:22:17 +02:00

Merge pull request #40 from scemama/master

Cleaning of Makefiles and setup
This commit is contained in:
Anthony Scemama 2015-03-26 02:27:12 +01:00
commit 46965757c6
68 changed files with 600 additions and 483 deletions

3
.gitignore vendored
View File

@ -5,4 +5,5 @@ EMSL_Basis
bin/
*.log
quantum_package_static.tar.gz
resultsFile
opam_installer.sh

View File

@ -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,10 @@ default: $(ALL_TESTS) $(ALL_EXE) .gitignore
echo $$i ; \
done >> .gitignore
executables:
$(MAKE) -C $(QPACKAGE_ROOT)/data executables
executables: $(QPACKAGE_ROOT)/data/executables
$(QPACKAGE_ROOT)/data/executables:
$(QPACKAGE_ROOT)/scripts/create_executables_list.sh
external_libs:
opam install cryptokit core

View File

@ -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) <EZFIO_FILE>"
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

34
scripts/build_modules.sh Executable file
View File

@ -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

View File

@ -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

36
scripts/clean_modules.sh Executable file
View File

@ -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

View File

@ -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=

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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}

View File

@ -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 ]]

View File

@ -32,6 +32,8 @@ from collections import defaultdict
from collections import namedtuple
Type = namedtuple('Type', 'ocaml fortran')
def bool_convertor(b):
return ( b.lower() in [ "true", ".true." ] )
def get_type_dict():
@ -222,15 +224,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, module_lower):
@ -261,10 +274,19 @@ def save_ezfio_config(module_lower, str_ezfio_config):
path = "{0}/config/{1}.ezfio_interface_config".format(ezfio_dir,
module_lower)
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():
@ -285,25 +307,25 @@ def main():
config_file_path = os.path.expanduser(config_file_path)
config_file_path = os.path.expandvars(config_file_path)
config_file_path = os.path.abspath(config_file_path)
print config_file_path
# print config_file_path
path_dirname = os.path.dirname(config_file_path)
module = [i for i in path_dirname.split("/") if i][-1]
module_lower = module.lower()
print "Read {0}".format(config_file_path)
# print "Read {0}".format(config_file_path)
dict_info_provider = get_dict_config_file(config_file_path, module_lower)
print "Generating the ezfio_interface.irp.f: \n"
# print "Generating the ezfio_interface.irp.f: \n"
d_config = create_ezfio_provider(dict_info_provider)
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", module_lower)
print "Saving ezfio_config"
# print "Saving ezfio_config"
save_ezfio_config(module_lower, config_ezfio)

View File

@ -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 $@

View File

@ -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}

View File

@ -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

View File

@ -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

View File

@ -27,4 +27,3 @@ echo '${QPACKAGE_ROOT}/irpf90/bin/irpman $@' > bin/irpman
chmod +x bin/irpf90 bin/irpman

View File

@ -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,10 +54,8 @@ if [[ ! -f ${QPACKAGE_ROOT}/bin/opam ]]
then
echo "Installation of OPAM failed"
exit 2
else
rm "opam_installer.sh"
fi
rm -f opam_installer.sh
${QPACKAGE_ROOT}/bin/opam config setup -a --dot-profile ${QPACKAGE_ROOT}/quantum_package.rc
source ${QPACKAGE_ROOT}/quantum_package.rc

View File

@ -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"

18
scripts/prepare_ezfio.sh Executable file
View File

@ -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

View File

@ -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

80
scripts/qp_include.sh Normal file
View File

@ -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

69
scripts/run_Makefile_common.sh Executable file
View File

@ -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

81
scripts/run_Makefile_global.sh Executable file
View File

@ -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

View File

@ -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} ]]

View File

@ -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) <EZFIO_FILE.md5>"
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

View File

@ -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

View File

@ -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

View File

@ -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,6 +134,9 @@ source ${QPACKAGE_ROOT}/quantum_package.rc
" $BLACK
mkdir -p ${QPACKAGE_ROOT}/install_logs
mv ${QPACKAGE_ROOT}/*.log ${QPACKAGE_ROOT}/install_logs/
if [[ $1 == "--robot" ]] ;
then
exit 0

View File

@ -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=

View File

@ -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=

View File

@ -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

View File

@ -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=

View File

@ -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=

View File

@ -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=

View File

@ -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=

View File

@ -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=

View File

@ -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=

View File

@ -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=

View File

@ -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=

View File

@ -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=

View File

@ -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

View File

@ -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=

View File

@ -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=

View File

@ -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=

View File

@ -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=

View File

@ -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=

View File

@ -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=

View File

@ -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=

View File

@ -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=

View File

@ -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=

View File

@ -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=

View File

@ -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=

View File

@ -1,27 +1,36 @@
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) ezfio
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)
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
$(ALL_MODULES): ezfio
$(QPACKAGE_ROOT)/scripts/build_modules.sh $@
# 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
ezfio: $(EZFIO)
# Frequent typos
clena: clean
veryclena: veryclean
veryclean: all_clean

View File

@ -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

View File

@ -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=

View File

@ -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=

View File

@ -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

View File

@ -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=

View File

@ -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=

View File

@ -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

View File

@ -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=

View File

@ -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=

View File

@ -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=

View File

@ -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=

View File

@ -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