mirror of
https://github.com/LCPQ/quantum_package
synced 2024-08-25 05:51:46 +02:00
Merge branch 'master' of https://github.com/LCPQ/quantum_package
This commit is contained in:
commit
07f47915e8
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,3 +1,8 @@
|
|||||||
quantum_package.rc
|
quantum_package.rc
|
||||||
EZFIO
|
EZFIO
|
||||||
irpf90
|
irpf90
|
||||||
|
EMSL_Basis
|
||||||
|
bin/
|
||||||
|
*.log
|
||||||
|
quantum_package_static.tar.gz
|
||||||
|
|
||||||
|
12
.travis.yml
Normal file
12
.travis.yml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
sudo: true
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- sudo apt-get update
|
||||||
|
- sudo apt-get install gfortran liblapack-dev zip
|
||||||
|
|
||||||
|
script:
|
||||||
|
- ./setup_environment.sh --robot
|
||||||
|
- source ./quantum_package.rc
|
||||||
|
- cp ./src/Makefile.config.gfortran ./src/Makefile.config
|
||||||
|
- make build
|
||||||
|
|
@ -1,8 +1,10 @@
|
|||||||
Quantum package
|
Quantum package
|
||||||
===============
|
===============
|
||||||
|
[![Build Status](https://travis-ci.org/LCPQ/quantum_package.svg?branch=master)](https://travis-ci.org/LCPQ/quantum_package)
|
||||||
|
|
||||||
[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/LCPQ/quantum_package?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/LCPQ/quantum_package?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||||
|
|
||||||
|
|
||||||
Set of quantum chemistry programs and libraries.
|
Set of quantum chemistry programs and libraries.
|
||||||
|
|
||||||
For more information, you can visit the [wiki of the project](http://github.com/LCPQ/quantum_package/wiki>), or the [Install](INSTALL.md) file.
|
For more information, you can visit the [wiki of the project](http://github.com/LCPQ/quantum_package/wiki>), or the [Install](INSTALL.md) file.
|
||||||
|
@ -13,7 +13,7 @@ endif
|
|||||||
LIBS=
|
LIBS=
|
||||||
PKGS=
|
PKGS=
|
||||||
OCAMLCFLAGS="-g -warn-error A"
|
OCAMLCFLAGS="-g -warn-error A"
|
||||||
OCAMLBUILD=ocamlbuild -j 0 -syntax camlp4o -cflags $(OCAMLCFLAGS) -lflags $(OCAMLCFLAGS) -ocamlopt ocamlc.opt
|
OCAMLBUILD=ocamlbuild -j 0 -syntax camlp4o -cflags $(OCAMLCFLAGS) -lflags $(OCAMLCFLAGS)
|
||||||
MLFILES=$(wildcard *.ml) ezfio.ml Qptypes.ml
|
MLFILES=$(wildcard *.ml) ezfio.ml Qptypes.ml
|
||||||
MLIFILES=$(wildcard *.mli)
|
MLIFILES=$(wildcard *.mli)
|
||||||
ALL_TESTS=$(patsubst %.ml,%.byte,$(wildcard test_*.ml))
|
ALL_TESTS=$(patsubst %.ml,%.byte,$(wildcard test_*.ml))
|
||||||
|
268
scripts/ezfio_interface.py
Executable file
268
scripts/ezfio_interface.py
Executable file
@ -0,0 +1,268 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""
|
||||||
|
Take a path in argv
|
||||||
|
Check if EZFIO.cfg exists.
|
||||||
|
EZFIO.cfg are in MODULE directories.
|
||||||
|
create : ezfio_interface.irp.f
|
||||||
|
folder_ezfio_inteface_config
|
||||||
|
|
||||||
|
Example EZFIO.cfg:
|
||||||
|
```
|
||||||
|
[thresh_SCF]
|
||||||
|
doc: Threshold on the convergence of the Hartree Fock energy
|
||||||
|
type: Threshold
|
||||||
|
default: 1.e-10
|
||||||
|
|
||||||
|
[do_pt2_end]
|
||||||
|
type: logical
|
||||||
|
doc: If true, compute the PT2 at the end of the selection
|
||||||
|
default: true
|
||||||
|
```
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import os.path
|
||||||
|
|
||||||
|
import ConfigParser
|
||||||
|
|
||||||
|
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():
|
||||||
|
"""
|
||||||
|
This function makes the correspondance between the type of value read in
|
||||||
|
ezfio.cfg into the f90 and Ocam Type
|
||||||
|
return fancy_type[fancy_type] = namedtuple('Type', 'ocaml fortran')
|
||||||
|
For example fancy_type['Ndet'].fortran = interger
|
||||||
|
.ocaml = int
|
||||||
|
"""
|
||||||
|
|
||||||
|
# ~#~#~#~ #
|
||||||
|
# I n i t #
|
||||||
|
# ~#~#~#~ #
|
||||||
|
|
||||||
|
# Dict to change ocaml LowLevel type into FortranLowLevel type
|
||||||
|
ocaml_to_fortran = {"int": "integer",
|
||||||
|
"float": "double precision",
|
||||||
|
"logical": "logical",
|
||||||
|
"string": "character*60"}
|
||||||
|
|
||||||
|
fancy_type = defaultdict(dict)
|
||||||
|
|
||||||
|
# ~#~#~#~#~#~#~#~ #
|
||||||
|
# R a w _ t y p e #
|
||||||
|
# ~#~#~#~#~#~#~#~ #
|
||||||
|
|
||||||
|
fancy_type['integer'] = Type("int", "integer")
|
||||||
|
fancy_type['int' ] = Type("int", "integer")
|
||||||
|
|
||||||
|
fancy_type['float' ] = Type("float", "double precision")
|
||||||
|
fancy_type['double precision'] = Type("float", "double precision")
|
||||||
|
|
||||||
|
fancy_type['logical'] = Type("bool", "logical")
|
||||||
|
fancy_type['bool' ] = Type("bool", "logical")
|
||||||
|
|
||||||
|
# ~#~#~#~#~#~#~#~ #
|
||||||
|
# q p _ t y p e s #
|
||||||
|
# ~#~#~#~#~#~#~#~ #
|
||||||
|
|
||||||
|
src = os.environ['QPACKAGE_ROOT'] + "/ocaml/qptypes_generator.ml"
|
||||||
|
|
||||||
|
with open(src, "r") as f:
|
||||||
|
l = [i for i in f.read().splitlines() if i.strip().startswith("*")]
|
||||||
|
|
||||||
|
for i in l:
|
||||||
|
ocaml_fancy_type = i.split()[1].strip()
|
||||||
|
ocaml_type = i.split()[3]
|
||||||
|
fortran_type = ocaml_to_fortran[ocaml_type]
|
||||||
|
|
||||||
|
fancy_type[ocaml_fancy_type] = Type(ocaml_type, fortran_type)
|
||||||
|
|
||||||
|
return dict(fancy_type)
|
||||||
|
|
||||||
|
|
||||||
|
type_dict = get_type_dict()
|
||||||
|
|
||||||
|
|
||||||
|
def get_dict_config_file(config_file_path,folder):
|
||||||
|
"""
|
||||||
|
Read a ezfio.cfg
|
||||||
|
Return a dict d[provider_name] = {type, default, ezfio_name,ezfio_dir,doc}
|
||||||
|
"""
|
||||||
|
# ~#~#~#~ #
|
||||||
|
# I n i t #
|
||||||
|
# ~#~#~#~ #
|
||||||
|
|
||||||
|
d = defaultdict(dict)
|
||||||
|
list_option_required = ["default", "doc"]
|
||||||
|
list_option = ["ezfio_name", "output"]
|
||||||
|
|
||||||
|
# ~#~#~#~#~#~#~#~#~#~#~ #
|
||||||
|
# L o a d _ C o n f i g #
|
||||||
|
# ~#~#~#~#~#~#~#~#~#~#~ #
|
||||||
|
|
||||||
|
config_file = ConfigParser.ConfigParser()
|
||||||
|
config_file.readfp(open(config_file_path))
|
||||||
|
|
||||||
|
# ~#~#~#~#~#~#~#~#~ #
|
||||||
|
# F i l l _ d i c t #
|
||||||
|
# ~#~#~#~#~#~#~#~#~ #
|
||||||
|
|
||||||
|
provider_names = config_file.sections()
|
||||||
|
for p in provider_names:
|
||||||
|
provider_name = p.lower()
|
||||||
|
default_d = {"ezfio_name": provider_name, "output": "false" }
|
||||||
|
# Check if type if avalaible
|
||||||
|
type_ = config_file.get(p, "type")
|
||||||
|
if type_ not in type_dict:
|
||||||
|
print "{0} not avalaible. Choose in:".format(type_)
|
||||||
|
print ", ".join([i for i in type_dict])
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
d[provider_name]["type"] = type_dict[type_]
|
||||||
|
|
||||||
|
# Fill the dict with allother the information
|
||||||
|
for k in list_option_required:
|
||||||
|
try:
|
||||||
|
d[provider_name][k] = config_file.get(p, k)
|
||||||
|
except ConfigParser.NoOptionError:
|
||||||
|
print "You need a {0} for {1} in {2}".format(k,
|
||||||
|
provider_name,
|
||||||
|
config_file_path)
|
||||||
|
d[provider_name]["ezfio_dir"] = folder
|
||||||
|
for k in list_option:
|
||||||
|
try:
|
||||||
|
d[provider_name][k] = config_file.get(p, k).lower()
|
||||||
|
except ConfigParser.NoOptionError:
|
||||||
|
d[provider_name][k] = default_d[k]
|
||||||
|
|
||||||
|
# Convert string to bool
|
||||||
|
d[provider_name]["output"] = bool_convertor(d[provider_name]["output"])
|
||||||
|
|
||||||
|
return dict(d)
|
||||||
|
|
||||||
|
|
||||||
|
def create_ezfio_provider(dict_ezfio_cfg):
|
||||||
|
"""
|
||||||
|
From dict d[provider_name] = {type, default, ezfio_name,ezfio_dir,doc}
|
||||||
|
create the a list who containt all the code for the provider
|
||||||
|
return [code, ...]
|
||||||
|
"""
|
||||||
|
from ezfio_with_default import EZFIO_Provider
|
||||||
|
|
||||||
|
dict_code_provider = dict()
|
||||||
|
|
||||||
|
ez_p = EZFIO_Provider()
|
||||||
|
for provider_name, dict_info in dict_ezfio_cfg.iteritems():
|
||||||
|
if not dict_info["output"]:
|
||||||
|
ez_p.set_type(dict_info['type'].fortran)
|
||||||
|
ez_p.set_name(provider_name)
|
||||||
|
ez_p.set_doc(dict_info['doc'])
|
||||||
|
ez_p.set_ezfio_dir(dict_info['ezfio_dir'])
|
||||||
|
ez_p.set_ezfio_name(dict_info['ezfio_name'])
|
||||||
|
ez_p.set_default(dict_info['default'])
|
||||||
|
|
||||||
|
ez_p.set_output("output_%s" % dict_info['ezfio_dir'])
|
||||||
|
dict_code_provider[provider_name] = str(ez_p)
|
||||||
|
|
||||||
|
return dict_code_provider
|
||||||
|
|
||||||
|
|
||||||
|
def save_ezfio_provider(path_head, dict_code_provider):
|
||||||
|
"""
|
||||||
|
Write in "ezfio_interface.irp.f" the
|
||||||
|
value of dict_code_provider
|
||||||
|
"""
|
||||||
|
|
||||||
|
path = "{0}/ezfio_interface.irp.f".format(path_head)
|
||||||
|
|
||||||
|
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")
|
||||||
|
|
||||||
|
|
||||||
|
def create_ezfio_config(dict_ezfio_cfg, opt, folder):
|
||||||
|
"""
|
||||||
|
From dict_ezfio_cfg[provider_name] = {type, default, ezfio_name,ezfio_dir,doc}
|
||||||
|
Return the string ezfio_interface_config
|
||||||
|
"""
|
||||||
|
|
||||||
|
result = [ folder ]
|
||||||
|
lenmax = max( [ len(i) for i in dict_ezfio_cfg ] )+2
|
||||||
|
l = sorted(dict_ezfio_cfg.keys())
|
||||||
|
for provider_name in l:
|
||||||
|
provider_info = dict_ezfio_cfg[provider_name]
|
||||||
|
s = " {0} {1}".format( provider_name.lower().ljust(lenmax), provider_info["type"].fortran )
|
||||||
|
result.append(s)
|
||||||
|
return "\n".join(result)
|
||||||
|
|
||||||
|
def save_ezfio_config(folder, str_ezfio_config):
|
||||||
|
"""
|
||||||
|
Write the str_ezfio_config in
|
||||||
|
$QPACKAGE_ROOT/EZFIO/{0}.ezfio_interface_config".format(folder)
|
||||||
|
"""
|
||||||
|
|
||||||
|
ezfio_dir = "{0}/EZFIO".format(os.environ['QPACKAGE_ROOT'])
|
||||||
|
path = "{0}/config/{1}.ezfio_interface_config".format(ezfio_dir,
|
||||||
|
folder)
|
||||||
|
|
||||||
|
print "Path = {}".format(path)
|
||||||
|
|
||||||
|
with open(path, "w") as f:
|
||||||
|
f.write(str_ezfio_config)
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Take in argument a EZFIO.cfg"""
|
||||||
|
|
||||||
|
try:
|
||||||
|
path = sys.argv[1]
|
||||||
|
except:
|
||||||
|
path = "EZFIO.cfg"
|
||||||
|
if "EZFIO.cfg" not in os.listdir(os.getcwd()):
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
path = os.path.expanduser(path)
|
||||||
|
path = os.path.expandvars(path)
|
||||||
|
path = os.path.abspath(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)
|
||||||
|
dict_info_provider = get_dict_config_file(path,folder)
|
||||||
|
|
||||||
|
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"
|
||||||
|
save_ezfio_provider(path_dirname, d_config)
|
||||||
|
|
||||||
|
print "Generating the ezfio_config"
|
||||||
|
config_ezfio = create_ezfio_config(dict_info_provider, "config", folder)
|
||||||
|
# print config_ezfio
|
||||||
|
|
||||||
|
print "Saving ezfio_config"
|
||||||
|
save_ezfio_config(folder, config_ezfio)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
|
@ -4,6 +4,7 @@
|
|||||||
# Thu Oct 23 21:58:40 CEST 2014
|
# Thu Oct 23 21:58:40 CEST 2014
|
||||||
|
|
||||||
PACKAGES="core cryptokit"
|
PACKAGES="core cryptokit"
|
||||||
|
OPAM_BASE=$HOME/.opam
|
||||||
|
|
||||||
# Check the QPACKAGE_ROOT directory
|
# Check the QPACKAGE_ROOT directory
|
||||||
if [[ -z ${QPACKAGE_ROOT} ]]
|
if [[ -z ${QPACKAGE_ROOT} ]]
|
||||||
@ -16,37 +17,48 @@ fi
|
|||||||
cd ${QPACKAGE_ROOT}
|
cd ${QPACKAGE_ROOT}
|
||||||
|
|
||||||
|
|
||||||
function asksure() {
|
|
||||||
echo -n "Are you sure (Y/N)? "
|
|
||||||
return $retval
|
|
||||||
}
|
|
||||||
|
|
||||||
if [[ -f quantum_package.rc ]]
|
if [[ -f quantum_package.rc ]]
|
||||||
then
|
then
|
||||||
source quantum_package.rc
|
source quantum_package.rc
|
||||||
fi
|
fi
|
||||||
make -C ocaml Qptypes.ml &> /dev/null
|
make -C ocaml Qptypes.ml &> /dev/null
|
||||||
|
|
||||||
if [[ $? -ne 0 ]]
|
if [[ $? -ne 0 ]]
|
||||||
then
|
then
|
||||||
|
|
||||||
if [[ -d ${OCAMLBREW_BASE} ]]
|
if [[ -d ${OPAM_BASE} ]]
|
||||||
then
|
then
|
||||||
echo "Remove directory ${OCAMLBREW_BASE} ? [Y/n]"
|
echo "${OPAM_BASE} exists."
|
||||||
|
echo "Re-install ? [y/N]"
|
||||||
while read -r -n 1 -s answer; do
|
while read -r -n 1 -s answer; do
|
||||||
if [[ $answer = [YyNn] ]]; then
|
if [[ $answer = [YyNn] ]]; then
|
||||||
[[ $answer = [Yy] ]] && rm -rf -- ${HOME}/ocamlbrew
|
if [[ $answer = [Yy] ]] ; then
|
||||||
[[ $answer = [Nn] ]] && exit 1
|
echo " - Remove your directory ${OPAM_BASE}"
|
||||||
break
|
echo " - Restart setup"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [[ $answer = [Nn] ]] ; then
|
||||||
|
make -C ocaml Qptypes.ml
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo $answer
|
|
||||||
fi
|
fi
|
||||||
scripts/fetch_from_web.py "https://raw.github.com/hcarty/ocamlbrew/master/ocamlbrew-install" ocamlbrew-install.sh
|
fi
|
||||||
cat < ocamlbrew-install.sh | env OCAMLBREW_FLAGS="-r" bash | tee ocamlbrew_install.log
|
scripts/fetch_from_web.py "https://raw.github.com/ocaml/opam/master/shell/opam_installer.sh" opam_installer.sh
|
||||||
grep "source " ocamlbrew_install.log | grep "etc/ocamlbrew.bashrc" >> quantum_package.rc
|
chmod +x opam_installer.sh
|
||||||
source quantum_package.rc
|
echo N | ./opam_installer.sh ${QPACKAGE_ROOT}/bin
|
||||||
|
|
||||||
|
if [[ ! -f ${QPACKAGE_ROOT}/bin/opam ]]; then
|
||||||
|
echo "Installation of OPAM failed"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
${QPACKAGE_ROOT}/bin/opam config setup -a --dot-profile ${QPACKAGE_ROOT}/quantum_package.rc
|
||||||
|
|
||||||
|
source ${QPACKAGE_ROOT}/quantum_package.rc
|
||||||
echo Y | opam install ${PACKAGES}
|
echo Y | opam install ${PACKAGES}
|
||||||
fi
|
|
||||||
make -C ocaml Qptypes.ml
|
make -C ocaml Qptypes.ml
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
149
scripts/qpackage
149
scripts/qpackage
@ -1,149 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Runs the programs.
|
|
||||||
# Thu Jun 26 23:40:20 CEST 2014
|
|
||||||
|
|
||||||
# Check environment
|
|
||||||
###################
|
|
||||||
|
|
||||||
if [[ -z $QPACKAGE_ROOT ]]
|
|
||||||
then
|
|
||||||
echo "Error:"
|
|
||||||
echo "QPACKAGE_ROOT environment variable is not set."
|
|
||||||
echo "source quantum_package.rc"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# List of executables
|
|
||||||
#####################
|
|
||||||
|
|
||||||
declare -A EXECUTABLES
|
|
||||||
for EXE in $(find $QPACKAGE_ROOT/src -type f -executable | grep -e "$QPACKAGE_ROOT/src/[^/]*/[^/]*$")
|
|
||||||
do
|
|
||||||
EXECUTABLES[$(basename ${EXE})]="${EXE}"
|
|
||||||
done
|
|
||||||
|
|
||||||
function print_list()
|
|
||||||
{
|
|
||||||
echo
|
|
||||||
echo "Available programs:"
|
|
||||||
echo
|
|
||||||
for EXE in ${!EXECUTABLES[@]}
|
|
||||||
do
|
|
||||||
printf " * %-30s [ %s ]\n" $EXE ${EXECUTABLES[$EXE]}
|
|
||||||
done | sort
|
|
||||||
echo
|
|
||||||
}
|
|
||||||
|
|
||||||
# Help message
|
|
||||||
##############
|
|
||||||
|
|
||||||
function print_help()
|
|
||||||
{
|
|
||||||
cat << EOF
|
|
||||||
|
|
||||||
Usage:
|
|
||||||
qpackage -h | --help
|
|
||||||
qpackage -l | --list
|
|
||||||
qpackage run <program> <EZFIO_input>
|
|
||||||
qpackage reset <EZFIO_input>
|
|
||||||
|
|
||||||
Options:
|
|
||||||
-h --help Print help message
|
|
||||||
-l --list List executables
|
|
||||||
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
ARGS=$(getopt -o "hl" -l "help,list" -n $0 -- "$@")
|
|
||||||
|
|
||||||
[[ $? -eq 0 ]] || exit 1
|
|
||||||
|
|
||||||
eval set -- "$ARGS"
|
|
||||||
|
|
||||||
while true
|
|
||||||
do
|
|
||||||
case "$1" in
|
|
||||||
-h|--help)
|
|
||||||
print_help
|
|
||||||
exit 0
|
|
||||||
shift ;;
|
|
||||||
|
|
||||||
-l|--list)
|
|
||||||
print_list
|
|
||||||
exit 0
|
|
||||||
shift ;;
|
|
||||||
|
|
||||||
--)
|
|
||||||
shift
|
|
||||||
break;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
# Run commands
|
|
||||||
##############
|
|
||||||
|
|
||||||
function run()
|
|
||||||
{
|
|
||||||
# run $EXE $EZFIO
|
|
||||||
# Starts the executable in one process and
|
|
||||||
# displays the output files in stdout
|
|
||||||
if [[ -z $1 ]] ; then
|
|
||||||
echo "Please specify which executable to run"
|
|
||||||
print_list
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
EXE=${EXECUTABLES[$1]}
|
|
||||||
EZFIO=$2
|
|
||||||
if [[ -z $EXE ]] ; then
|
|
||||||
echo "Executable $1 not found"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
if [[ -z $EZFIO ]] ; then
|
|
||||||
echo "Please specify an EZFIO directory"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
date
|
|
||||||
rm -rf -- ${EZFIO}/output
|
|
||||||
${QPACKAGE_ROOT}/scripts/follow_output.py ${EZFIO} &
|
|
||||||
PID=$!
|
|
||||||
${EXE} ${EZFIO}
|
|
||||||
kill -2 $PID
|
|
||||||
if [[ $(jobs | wc -l) -gt 0 ]]
|
|
||||||
then
|
|
||||||
sleep 1
|
|
||||||
kill -9 $PID
|
|
||||||
fi
|
|
||||||
wait
|
|
||||||
date
|
|
||||||
}
|
|
||||||
|
|
||||||
function reset()
|
|
||||||
{
|
|
||||||
# reset $EZFIO
|
|
||||||
EZFIO=$1
|
|
||||||
if [[ -z ${EZFIO} ]] ; then
|
|
||||||
echo "Please specify an EZFIO directory"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
rm -rf -- ${EZFIO}/output/*.rst
|
|
||||||
rm -rf -- ${EZFIO}/determinants/{n_det,psi_det.gz,psi_coef.gz}
|
|
||||||
}
|
|
||||||
|
|
||||||
COMMAND=$1
|
|
||||||
shift
|
|
||||||
|
|
||||||
case "${COMMAND}" in
|
|
||||||
run)
|
|
||||||
run $1 $2
|
|
||||||
;;
|
|
||||||
reset)
|
|
||||||
reset $1
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
print_help
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -30,7 +30,6 @@ fi
|
|||||||
|
|
||||||
cat << EOF > quantum_package.rc
|
cat << EOF > quantum_package.rc
|
||||||
export IRPF90="${IRPF90}"
|
export IRPF90="${IRPF90}"
|
||||||
export OCAMLBREW_BASE="${OCAMLBREW_BASE}"
|
|
||||||
export QPACKAGE_ROOT=\$( cd \$(dirname "\${BASH_SOURCE}") ; pwd -P )
|
export QPACKAGE_ROOT=\$( cd \$(dirname "\${BASH_SOURCE}") ; pwd -P )
|
||||||
export LD_LIBRARY_PATH="\${QPACKAGE_ROOT}"/lib:\${LD_LIBRARY_PATH}
|
export LD_LIBRARY_PATH="\${QPACKAGE_ROOT}"/lib:\${LD_LIBRARY_PATH}
|
||||||
export LIBRARY_PATH="\${QPACKAGE_ROOT}"/lib:\${LIBRARY_PATH}
|
export LIBRARY_PATH="\${QPACKAGE_ROOT}"/lib:\${LIBRARY_PATH}
|
||||||
@ -40,7 +39,6 @@ export PATH=\${PATH}:"\${QPACKAGE_ROOT}"/scripts
|
|||||||
export PATH=\${PATH}:"\${QPACKAGE_ROOT}"/bin
|
export PATH=\${PATH}:"\${QPACKAGE_ROOT}"/bin
|
||||||
export PATH=\${PATH}:"\${QPACKAGE_ROOT}"/ocaml
|
export PATH=\${PATH}:"\${QPACKAGE_ROOT}"/ocaml
|
||||||
source "\${QPACKAGE_ROOT}"/bin/irpman &> /dev/null
|
source "\${QPACKAGE_ROOT}"/bin/irpman &> /dev/null
|
||||||
source "\${OCAMLBREW_BASE}"/ocaml-4*/etc/ocamlbrew.bashrc &> /dev/null
|
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
source quantum_package.rc
|
source quantum_package.rc
|
||||||
@ -76,6 +74,12 @@ source ${QPACKAGE_ROOT}/quantum_package.rc
|
|||||||
=======================================================
|
=======================================================
|
||||||
" $BLACK
|
" $BLACK
|
||||||
|
|
||||||
|
|
||||||
|
if [[ $1 == "--robot" ]] ;
|
||||||
|
then
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
source quantum_package.rc
|
source quantum_package.rc
|
||||||
exec bash
|
exec bash
|
||||||
|
fi
|
||||||
|
|
||||||
|
1
src/.gitignore
vendored
1
src/.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
Makefile.config
|
Makefile.config
|
||||||
|
ezfio_interface.irp.f
|
||||||
|
0
src/CAS_SD_selected/ASSUMPTIONS.rst
Normal file
0
src/CAS_SD_selected/ASSUMPTIONS.rst
Normal file
5
src/CAS_SD_selected/README.rst
Normal file
5
src/CAS_SD_selected/README.rst
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
======================
|
||||||
|
CAS_SD_selected Module
|
||||||
|
======================
|
||||||
|
|
||||||
|
Selected CAS + SD module
|
37
src/Full_CI/EZFIO.cfg
Normal file
37
src/Full_CI/EZFIO.cfg
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
[N_det_max_fci]
|
||||||
|
doc: Max number of determinants in the wave function
|
||||||
|
type: Det_number_max
|
||||||
|
default: 10000
|
||||||
|
|
||||||
|
[N_det_max_fci_property]
|
||||||
|
doc: Max number of determinants in the wave function when you select for a given property
|
||||||
|
type: Det_number_max
|
||||||
|
default: 10000
|
||||||
|
|
||||||
|
[do_pt2_end]
|
||||||
|
type: logical
|
||||||
|
doc: If true, compute the PT2 at the end of the selection
|
||||||
|
default: true
|
||||||
|
|
||||||
|
[PT2_max]
|
||||||
|
type: PT2_energy
|
||||||
|
doc: The selection process stops when the largest PT2 (for all the state is lower
|
||||||
|
than pt2_max in absolute value
|
||||||
|
default: 0.0001
|
||||||
|
|
||||||
|
[var_pt2_ratio]
|
||||||
|
type: Normalized_float
|
||||||
|
doc: The selection process stops when the energy ratio variational/(variational+PT2)
|
||||||
|
is equal to var_pt2_ratio
|
||||||
|
default: 0.75
|
||||||
|
|
||||||
|
[energy]
|
||||||
|
type: double precision
|
||||||
|
doc: "Calculated Full CI energy"
|
||||||
|
output: true
|
||||||
|
|
||||||
|
[energy_pt2]
|
||||||
|
type: double precision
|
||||||
|
doc: "Calculated Full CI energy"
|
||||||
|
output: true
|
||||||
|
|
@ -1,8 +0,0 @@
|
|||||||
full_ci
|
|
||||||
n_det_max_fci integer
|
|
||||||
n_det_max_fci_property integer
|
|
||||||
pt2_max double precision
|
|
||||||
do_pt2_end logical
|
|
||||||
energy double precision
|
|
||||||
energy_pt2 double precision
|
|
||||||
var_pt2_ratio double precision
|
|
@ -1,41 +0,0 @@
|
|||||||
BEGIN_SHELL [ /usr/bin/python ]
|
|
||||||
from ezfio_with_default import EZFIO_Provider
|
|
||||||
T = EZFIO_Provider()
|
|
||||||
T.set_type ( "integer" )
|
|
||||||
T.set_name ( "N_det_max_fci" )
|
|
||||||
T.set_doc ( "Max number of determinants in the wave function" )
|
|
||||||
T.set_ezfio_dir ( "full_ci" )
|
|
||||||
T.set_ezfio_name( "N_det_max_fci" )
|
|
||||||
T.set_output ( "output_full_ci" )
|
|
||||||
print T
|
|
||||||
|
|
||||||
T.set_type ( "integer" )
|
|
||||||
T.set_name ( "N_det_max_fci_property" )
|
|
||||||
T.set_doc ( "Max number of determinants in the wave function when you select for a given property" )
|
|
||||||
T.set_ezfio_dir ( "full_ci" )
|
|
||||||
T.set_ezfio_name( "N_det_max_fci_property" )
|
|
||||||
T.set_output ( "output_full_ci" )
|
|
||||||
print T
|
|
||||||
|
|
||||||
T.set_type ( "logical" )
|
|
||||||
T.set_name ( "do_pt2_end" )
|
|
||||||
T.set_doc ( "If true, compute the PT2 at the end of the selection" )
|
|
||||||
T.set_ezfio_name( "do_pt2_end" )
|
|
||||||
print T
|
|
||||||
|
|
||||||
T.set_type ( "double precision" )
|
|
||||||
T.set_name ( "pt2_max" )
|
|
||||||
T.set_doc ( """The selection process stops when the largest PT2 (for all the states)
|
|
||||||
is lower than pt2_max in absolute value""" )
|
|
||||||
T.set_ezfio_name( "pt2_max" )
|
|
||||||
print T
|
|
||||||
|
|
||||||
T.set_type ( "double precision" )
|
|
||||||
T.set_name ( "var_pt2_ratio" )
|
|
||||||
T.set_doc ( """The selection process stops when the energy ratio variational/(variational+PT2)
|
|
||||||
is equal to var_pt2_ratio""" )
|
|
||||||
T.set_ezfio_name( "var_pt2_ratio" )
|
|
||||||
print T
|
|
||||||
|
|
||||||
END_SHELL
|
|
||||||
|
|
76
src/Full_CI/target_pt2.irp.f
Normal file
76
src/Full_CI/target_pt2.irp.f
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
program var_pt2_ratio_run
|
||||||
|
implicit none
|
||||||
|
integer :: i,k
|
||||||
|
|
||||||
|
|
||||||
|
double precision, allocatable :: pt2(:), norm_pert(:), H_pert_diag(:)
|
||||||
|
integer :: N_st, degree
|
||||||
|
N_st = N_states
|
||||||
|
allocate (pt2(N_st), norm_pert(N_st),H_pert_diag(N_st))
|
||||||
|
character*(64) :: perturbation
|
||||||
|
|
||||||
|
double precision, allocatable :: psi_det_save(:,:,:), psi_coef_save(:,:)
|
||||||
|
|
||||||
|
double precision :: E_fci, E_var, ratio, E_ref
|
||||||
|
integer :: Nmin, Nmax
|
||||||
|
|
||||||
|
pt2 = -(pt2_max+1.d0)
|
||||||
|
diag_algorithm = "Lapack"
|
||||||
|
|
||||||
|
ratio = 0.d0
|
||||||
|
Nmin=1
|
||||||
|
do while (dabs(pt2(1)) > pt2_max)
|
||||||
|
call H_apply_FCI(pt2, norm_pert, H_pert_diag, N_st)
|
||||||
|
psi_det = psi_det_sorted
|
||||||
|
psi_coef = psi_coef_sorted
|
||||||
|
soft_touch N_det psi_det psi_coef
|
||||||
|
call diagonalize_CI
|
||||||
|
ratio = (CI_energy(1) - HF_energy) / (CI_energy(1)+pt2(1) - HF_energy)
|
||||||
|
enddo
|
||||||
|
|
||||||
|
threshold_selectors = 1.d0
|
||||||
|
threshold_generators = 0.999d0
|
||||||
|
call diagonalize_CI
|
||||||
|
call H_apply_FCI_PT2(pt2, norm_pert, H_pert_diag, N_st)
|
||||||
|
E_ref = CI_energy(1) + pt2(1)
|
||||||
|
threshold_selectors = 0.99d0
|
||||||
|
threshold_generators = 0.98d0
|
||||||
|
|
||||||
|
var_pt2_ratio = (E_ref + pt2_max - HF_energy) / (E_ref - HF_energy)
|
||||||
|
TOUCH var_pt2_ratio
|
||||||
|
|
||||||
|
Nmax=max(10000,3*N_det)
|
||||||
|
Nmin=1
|
||||||
|
do while (Nmax-Nmin > 1)
|
||||||
|
ratio = (CI_energy(1) - HF_energy) / (E_ref - HF_energy)
|
||||||
|
|
||||||
|
if (ratio < var_pt2_ratio) then
|
||||||
|
Nmin = N_det
|
||||||
|
! Nmax = max(Nmax,Nmin+10)
|
||||||
|
! Select new determinants
|
||||||
|
call H_apply_FCI(pt2, norm_pert, H_pert_diag, N_st)
|
||||||
|
N_det = min(N_det,Nmax)
|
||||||
|
else
|
||||||
|
Nmax = N_det
|
||||||
|
N_det = Nmin + (Nmax-Nmin)/2
|
||||||
|
endif
|
||||||
|
|
||||||
|
psi_det = psi_det_sorted
|
||||||
|
psi_coef = psi_coef_sorted
|
||||||
|
soft_touch N_det psi_det psi_coef
|
||||||
|
call diagonalize_CI
|
||||||
|
call save_wavefunction
|
||||||
|
print *, 'Det min, Det max: ', Nmin, Nmax
|
||||||
|
print *, 'Ratio : ', ratio, ' ~ ', var_pt2_ratio
|
||||||
|
print *, 'HF_energy = ', HF_energy
|
||||||
|
print *, 'Est FCI = ', E_ref
|
||||||
|
print *, 'PT2 = ', pt2(1)
|
||||||
|
print *, 'N_det = ', N_det
|
||||||
|
print *, 'E = ', CI_energy(1)
|
||||||
|
call ezfio_set_full_ci_energy(CI_energy)
|
||||||
|
if (abort_all) then
|
||||||
|
exit
|
||||||
|
endif
|
||||||
|
enddo
|
||||||
|
deallocate(pt2,norm_pert)
|
||||||
|
end
|
@ -15,8 +15,8 @@ $(info -------------------- Error --------------------)
|
|||||||
$(info QPACKAGE_ROOT undefined. Run the setup_environment.sh script)
|
$(info QPACKAGE_ROOT undefined. Run the setup_environment.sh script)
|
||||||
$(info -----------------------------------------------)
|
$(info -----------------------------------------------)
|
||||||
$(error )
|
$(error )
|
||||||
else
|
#else
|
||||||
$(info QPACKAGE_ROOT is defined.)
|
#$(info QPACKAGE_ROOT is defined.)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
@ -30,8 +30,8 @@ $(info You can create Makefile.config)
|
|||||||
$(info by modifying Makefile.config.example)
|
$(info by modifying Makefile.config.example)
|
||||||
$(info -----------------------------------------------)
|
$(info -----------------------------------------------)
|
||||||
$(error )
|
$(error )
|
||||||
else
|
#else
|
||||||
$(info Makefile.config is present.)
|
#$(info Makefile.config is present.)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
@ -50,8 +50,8 @@ $(info To upgrade IRPF90, run : )
|
|||||||
$(info $(QPACKAGE_ROOT)/scripts/upgrade_irpf90.sh )
|
$(info $(QPACKAGE_ROOT)/scripts/upgrade_irpf90.sh )
|
||||||
$(info -----------------------------------------------)
|
$(info -----------------------------------------------)
|
||||||
$(error )
|
$(error )
|
||||||
else
|
#else
|
||||||
$(info irpf90 version is OK.)
|
#$(info irpf90 version is OK.)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
@ -69,8 +69,8 @@ $(info Your NEEDED_MODULES file is inconsistent. It should be)
|
|||||||
$(info $(NEEDED_MODULES_OK))
|
$(info $(NEEDED_MODULES_OK))
|
||||||
$(info -----------------------------------------------)
|
$(info -----------------------------------------------)
|
||||||
$(error )
|
$(error )
|
||||||
else
|
#else
|
||||||
$(info NEEDED_MODULES files is consistent.)
|
#$(info NEEDED_MODULES files is consistent.)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
@ -91,8 +91,8 @@ $(info You should document it before you compile, as)
|
|||||||
$(info well as the ASSUMPTIONS.rst file.)
|
$(info well as the ASSUMPTIONS.rst file.)
|
||||||
$(info -----------------------------------------------)
|
$(info -----------------------------------------------)
|
||||||
$(error )
|
$(error )
|
||||||
else
|
#else
|
||||||
$(info README.rst is present.)
|
#$(info README.rst is present.)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
@ -104,8 +104,8 @@ $(info -------------------- Error --------------------)
|
|||||||
$(info This is a Bug. At that point, the ASSUMPTIONS.rst)
|
$(info This is a Bug. At that point, the ASSUMPTIONS.rst)
|
||||||
$(info file should exist.)
|
$(info file should exist.)
|
||||||
$(info -----------------------------------------------)
|
$(info -----------------------------------------------)
|
||||||
else
|
#else
|
||||||
$(info ASSUMPTIONS.rst is present.)
|
#$(info ASSUMPTIONS.rst is present.)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
@ -125,19 +125,27 @@ $(info To upgrade EZFIO, run : )
|
|||||||
$(info $(QPACKAGE_ROOT)/scripts/upgrade_ezfio.sh )
|
$(info $(QPACKAGE_ROOT)/scripts/upgrade_ezfio.sh )
|
||||||
$(info -----------------------------------------------)
|
$(info -----------------------------------------------)
|
||||||
$(error )
|
$(error )
|
||||||
else
|
#else
|
||||||
$(info EZFIO version is OK.)
|
#$(info EZFIO version is OK.)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Define the EZFIO rules
|
# Define the EZFIO rules
|
||||||
|
|
||||||
$(EZFIO): $(wildcard $(QPACKAGE_ROOT)/src/*.ezfio_config) $(wildcard $(QPACKAGE_ROOT)/src/*/*.ezfio_config)
|
$(EZFIO): $(wildcard $(QPACKAGE_ROOT)/src/*.ezfio_config) $(wildcard $(QPACKAGE_ROOT)/src/*/*.ezfio_config) $(wildcard $(QPACKAGE_ROOT)/src/*/EZFIO.cfg)
|
||||||
@echo Building EZFIO library
|
@echo Building EZFIO library
|
||||||
@cp $(wildcard $(QPACKAGE_ROOT)/src/*.ezfio_config) $(wildcard $(QPACKAGE_ROOT)/src/*/*.ezfio_config) $(EZFIO_DIR)/config
|
@echo =-=-=-=-=-=-=-=-=-=-=-
|
||||||
@cd $(EZFIO_DIR) ; export FC="$(FC)" ; export FCFLAGS="$(FCFLAGS)" ; export IRPF90="$(IRPF90)" ; $(MAKE) ; $(MAKE) Python
|
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)
|
ezfio: $(EZFIO)
|
||||||
|
|
||||||
|
|
||||||
# Create symbolic links of other modules
|
# Create symbolic links of other modules
|
||||||
|
|
||||||
ifneq ($(PWD),$(QPACKAGE_ROOT)/src)
|
ifneq ($(PWD),$(QPACKAGE_ROOT)/src)
|
||||||
|
1
src/Properties/ASSUMPTIONS.rst
Normal file
1
src/Properties/ASSUMPTIONS.rst
Normal file
@ -0,0 +1 @@
|
|||||||
|
THIS FILE HAS TO BE FILLED
|
Loading…
Reference in New Issue
Block a user