9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-21 19:13:29 +01:00

Merge branch 'dev' of github.com:QuantumPackage/qp2 into dev

This commit is contained in:
Anthony Scemama 2020-03-18 16:43:44 +01:00
commit 95bf96feb9
61 changed files with 794 additions and 1810 deletions

View File

@ -25,8 +25,8 @@ sets all the environment variables required for the normal operation of the
Running this script will also tell you which external dependencies are missing Running this script will also tell you which external dependencies are missing
and need to be installed. and need to be installed.
When all dependencies have been installed, ( the :command:`configure` will tell you) When all dependencies have been installed, ( the :command:`configure` will tell you)
source the :file:`quantum_package.rc` in order to load all environment variables and compile the |QP|. source the :file:`quantum_package.rc` in order to load all environment variables and compile the |QP|.
Requirements Requirements
@ -36,7 +36,7 @@ Requirements
- Fortran compiler : GNU Fortran, Intel Fortran or IBM XL Fortran - Fortran compiler : GNU Fortran, Intel Fortran or IBM XL Fortran
- `GNU make`_ - `GNU make`_
- `Autoconf`_ - `Autoconf`_
- `Python`_ > 2.6 - `Python`_ > 3.0
- |IRPF90| : Fortran code generator - |IRPF90| : Fortran code generator
- |EZFIO| : Easy Fortran Input/Output library generator - |EZFIO| : Easy Fortran Input/Output library generator
- |BLAS| and |LAPACK| - |BLAS| and |LAPACK|
@ -44,7 +44,7 @@ Requirements
- `GNU Patch`_ - `GNU Patch`_
- |ZeroMQ| : networking library - |ZeroMQ| : networking library
- `GMP <https://gmplib.org/>`_ : Gnu Multiple Precision Arithmetic Library - `GMP <https://gmplib.org/>`_ : Gnu Multiple Precision Arithmetic Library
- |OCaml| compiler with |OPAM| package manager - |OCaml| compiler with |OPAM| package manager
- `Bubblewrap <https://github.com/projectatomic/bubblewrap>`_ : Sandboxing tool required by Opam - `Bubblewrap <https://github.com/projectatomic/bubblewrap>`_ : Sandboxing tool required by Opam
- `libcap <https://git.kernel.org/pub/scm/linux/kernel/git/morgan/libcap.git>`_ : POSIX capabilities required by Bubblewrap - `libcap <https://git.kernel.org/pub/scm/linux/kernel/git/morgan/libcap.git>`_ : POSIX capabilities required by Bubblewrap
- |Ninja| : a parallel build system - |Ninja| : a parallel build system
@ -74,29 +74,29 @@ Help for installing external dependencies
Using the :command:`configure` executable Using the :command:`configure` executable
----------------------------------------- -----------------------------------------
The :command:`configure` executable can help you in installing the minimal dependencies you will need to compile the |QP|. The :command:`configure` executable can help you in installing the minimal dependencies you will need to compile the |QP|.
The command is to be used as follows: The command is to be used as follows:
.. code:: bash .. code:: bash
./configure --install <package> ./configure --install <package>
The following packages are supported by the :command:`configure` installer: The following packages are supported by the :command:`configure` installer:
* ninja * ninja
* irpf90 * irpf90
* zeromq * zeromq
* f77zmq * f77zmq
* gmp * gmp
* libcap * libcap
* bwrap * bwrap
* ocaml ( :math:`\approx` 10 minutes) * ocaml ( :math:`\approx` 10 minutes)
* ezfio * ezfio
* docopt * docopt
* resultsFile * resultsFile
* bats * bats
Example: Example:
.. code:: bash .. code:: bash
@ -115,7 +115,7 @@ Example:
If the :command:`configure` executable fails to install a specific dependency If the :command:`configure` executable fails to install a specific dependency
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
If the :command:`configure` executable does not succeed to install a specific dependency, If the :command:`configure` executable does not succeed to install a specific dependency,
there are some proposition of how to download and install the minimal dependencies to compile and use the |QP|. there are some proposition of how to download and install the minimal dependencies to compile and use the |QP|.
@ -140,7 +140,7 @@ IRPF90
------ ------
*IRPF90* is a Fortran code generator for programming using the Implicit Reference *IRPF90* is a Fortran code generator for programming using the Implicit Reference
to Parameters (IRP) method. to Parameters (IRP) method.
* Download the latest version of IRPF90 * Download the latest version of IRPF90
here : `<https://gitlab.com/scemama/irpf90/-/archive/v1.7.2/irpf90-v1.7.2.tar.gz>`_ and move here : `<https://gitlab.com/scemama/irpf90/-/archive/v1.7.2/irpf90-v1.7.2.tar.gz>`_ and move
@ -312,26 +312,26 @@ OCaml
`<https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh>`_ `<https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh>`_
and move it in the :file:`${QP_ROOT}/external` directory and move it in the :file:`${QP_ROOT}/external` directory
* If you use OCaml only with the |qp|, you can install the OPAM directory * If you use OCaml only with the |qp|, you can install the OPAM directory
containing the compiler and all the installed libraries in the containing the compiler and all the installed libraries in the
:file:`${QP_ROOT}/external` directory as :file:`${QP_ROOT}/external` directory as
.. code:: bash .. code:: bash
export OPAMROOT=${QP_ROOT}/external/opam export OPAMROOT=${QP_ROOT}/external/opam
* Run the installer * Run the installer
.. code:: bash .. code:: bash
echo ${QP_ROOT}/bin echo ${QP_ROOT}/bin
${QP_ROOT}/external/opam_installer.sh --no-backup --fresh ${QP_ROOT}/external/opam_installer.sh --no-backup --fresh
The :command:`opam` command can be installed in the :file:`${QP_ROOT}/bin` The :command:`opam` command can be installed in the :file:`${QP_ROOT}/bin`
directory. To do this, take the output of ``echo ${QP_ROOT}/bin`` and directory. To do this, take the output of ``echo ${QP_ROOT}/bin`` and
use it as an answer to where :command:`opam` should be installed. use it as an answer to where :command:`opam` should be installed.
* Install the OCaml compiler * Install the OCaml compiler
@ -370,11 +370,11 @@ Docopt
*Docopt* is a Python package defining a command-line interface description language. *Docopt* is a Python package defining a command-line interface description language.
If you have *pip* for Python2, you can do If you have *pip* for Python3, you can do
.. code:: bash .. code:: bash
pip2 install --user docopt python3 -m pip install --user docopt
Otherwise, Otherwise,

969
REPLACE

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
@ -12,7 +12,7 @@ Usage:
""" """
from __future__ import print_function
import sys import sys
import os import os
import subprocess import subprocess

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2 #!/usr/bin/env python3
""" """
convert output of GAMESS/GAU$$IAN to ezfio convert output of GAMESS/GAU$$IAN to ezfio
@ -22,7 +22,7 @@ try:
QP_ROOT = os.environ["QP_ROOT"] QP_ROOT = os.environ["QP_ROOT"]
QP_EZFIO = os.environ["QP_EZFIO"] QP_EZFIO = os.environ["QP_EZFIO"]
except KeyError: except KeyError:
print "Error: QP_ROOT environment variable not found." print("Error: QP_ROOT environment variable not found.")
sys.exit(1) sys.exit(1)
else: else:
sys.path = [QP_EZFIO + "/Python", sys.path = [QP_EZFIO + "/Python",
@ -30,10 +30,11 @@ else:
QP_ROOT + "/install", QP_ROOT + "/install",
QP_ROOT + "/scripts"] + sys.path QP_ROOT + "/scripts"] + sys.path
from resultsFile import *
try: try:
from resultsFile import * from resultsFile import *
except: except:
print "Error: resultsFile Python library not installed" print("Error: resultsFile Python library not installed")
sys.exit(1) sys.exit(1)
@ -48,17 +49,17 @@ def write_ezfio(res, filename):
# |_ | _ _ _|_ ._ _ ._ _ # |_ | _ _ _|_ ._ _ ._ _
# |_ | (/_ (_ |_ | (_) | | _> # |_ | (/_ (_ |_ | (_) | | _>
# #
print "Electrons\t...\t", print("Electrons\t...\t", end=' ')
ezfio.set_electrons_elec_alpha_num(res.num_alpha) ezfio.set_electrons_elec_alpha_num(res.num_alpha)
ezfio.set_electrons_elec_beta_num(res.num_beta) ezfio.set_electrons_elec_beta_num(res.num_beta)
print "OK" print("OK")
# #
# |\ | _ | _ o # |\ | _ | _ o
# | \| |_| (_ | (/_ | # | \| |_| (_ | (/_ |
# #
print "Nuclei\t\t...\t", print("Nuclei\t\t...\t", end=' ')
# ~#~#~#~ # # ~#~#~#~ #
# I n i t # # I n i t #
# ~#~#~#~ # # ~#~#~#~ #
@ -93,24 +94,23 @@ def write_ezfio(res, filename):
# Transformt H1 into H # Transformt H1 into H
import re import re
p = re.compile(ur'(\d*)$') p = re.compile(r'(\d*)$')
label = [p.sub("", x.name).capitalize() for x in res.geometry] label = [p.sub("", x.name).capitalize() for x in res.geometry]
ezfio.set_nuclei_nucl_label(label) ezfio.set_nuclei_nucl_label(label)
ezfio.set_nuclei_nucl_coord(coord_x + coord_y + coord_z) ezfio.set_nuclei_nucl_coord(coord_x + coord_y + coord_z)
print "OK" print("OK")
# _ # _
# /\ _ _ |_) _. _ o _ # /\ _ _ |_) _. _ o _
# /--\ (_) _> |_) (_| _> | _> # /--\ (_) _> |_) (_| _> | _>
# #
print "AOS\t\t...\t", print("AOS\t\t...\t", end=' ')
# ~#~#~#~ # # ~#~#~#~ #
# I n i t # # I n i t #
# ~#~#~#~ # # ~#~#~#~ #
import string
at = [] at = []
num_prim = [] num_prim = []
power_x = [] power_x = []
@ -131,9 +131,9 @@ def write_ezfio(res, filename):
at.append(i + 1) at.append(i + 1)
num_prim.append(len(b.prim)) num_prim.append(len(b.prim))
s = b.sym s = b.sym
power_x.append(string.count(s, "x")) power_x.append(str.count(s, "x"))
power_y.append(string.count(s, "y")) power_y.append(str.count(s, "y"))
power_z.append(string.count(s, "z")) power_z.append(str.count(s, "z"))
coefficient.append(b.coef) coefficient.append(b.coef)
exponent.append([p.expo for p in b.prim]) exponent.append([p.expo for p in b.prim])
@ -175,14 +175,14 @@ def write_ezfio(res, filename):
ezfio.set_ao_basis_ao_expo(expo) ezfio.set_ao_basis_ao_expo(expo)
ezfio.set_ao_basis_ao_basis("Read by resultsFile") ezfio.set_ao_basis_ao_basis("Read by resultsFile")
print "OK" print("OK")
# _ # _
# |\/| _ _ |_) _. _ o _ # |\/| _ _ |_) _. _ o _
# | | (_) _> |_) (_| _> | _> # | | (_) _> |_) (_| _> | _>
# #
print "MOS\t\t...\t", print("MOS\t\t...\t", end=' ')
# ~#~#~#~ # # ~#~#~#~ #
# I n i t # # I n i t #
# ~#~#~#~ # # ~#~#~#~ #
@ -205,9 +205,9 @@ def write_ezfio(res, filename):
virtual = [] virtual = []
active = [(allMOs[i].eigenvalue, i) for i in range(len(allMOs))] active = [(allMOs[i].eigenvalue, i) for i in range(len(allMOs))]
closed = map(lambda x: x[1], closed) closed = [x[1] for x in closed]
active = map(lambda x: x[1], active) active = [x[1] for x in active]
virtual = map(lambda x: x[1], virtual) virtual = [x[1] for x in virtual]
MOindices = closed + active + virtual MOindices = closed + active + virtual
MOs = [] MOs = []
@ -223,7 +223,7 @@ def write_ezfio(res, filename):
MOmap[i] = MOindices.index(i) MOmap[i] = MOindices.index(i)
energies = [] energies = []
for i in xrange(mo_num): for i in range(mo_num):
energies.append(MOs[i].eigenvalue) energies.append(MOs[i].eigenvalue)
if res.occ_num is not None: if res.occ_num is not None:
@ -237,11 +237,11 @@ def write_ezfio(res, filename):
MoMatrix = [] MoMatrix = []
sym0 = [i.sym for i in res.mo_sets[MO_type]] sym0 = [i.sym for i in res.mo_sets[MO_type]]
sym = [i.sym for i in res.mo_sets[MO_type]] sym = [i.sym for i in res.mo_sets[MO_type]]
for i in xrange(len(sym)): for i in range(len(sym)):
sym[MOmap[i]] = sym0[i] sym[MOmap[i]] = sym0[i]
MoMatrix = [] MoMatrix = []
for i in xrange(len(MOs)): for i in range(len(MOs)):
m = MOs[i] m = MOs[i]
for coef in m.vector: for coef in m.vector:
MoMatrix.append(coef) MoMatrix.append(coef)
@ -256,10 +256,10 @@ def write_ezfio(res, filename):
ezfio.set_mo_basis_mo_num(mo_num) ezfio.set_mo_basis_mo_num(mo_num)
ezfio.set_mo_basis_mo_occ(OccNum) ezfio.set_mo_basis_mo_occ(OccNum)
ezfio.set_mo_basis_mo_coef(MoMatrix) ezfio.set_mo_basis_mo_coef(MoMatrix)
print "OK" print("OK")
print "Pseudos\t\t...\t", print("Pseudos\t\t...\t", end=' ')
try: try:
lmax = 0 lmax = 0
nucl_charge_remove = [] nucl_charge_remove = []
@ -327,7 +327,7 @@ def write_ezfio(res, filename):
else: else:
ezfio.set_pseudo_do_pseudo(True) ezfio.set_pseudo_do_pseudo(True)
print "OK" print("OK")
@ -354,15 +354,15 @@ if __name__ == '__main__':
except: except:
raise raise
else: else:
print FILE, 'recognized as', str(RES_FILE).split('.')[-1].split()[0] print(FILE, 'recognized as', str(RES_FILE).split('.')[-1].split()[0])
write_ezfio(RES_FILE, EZFIO_FILE) write_ezfio(RES_FILE, EZFIO_FILE)
sys.stdout.flush() sys.stdout.flush()
if os.system("qp_run save_ortho_mos "+EZFIO_FILE) != 0: if os.system("qp_run save_ortho_mos "+EZFIO_FILE) != 0:
print """Warning: You need to run print("""Warning: You need to run
qp run save_ortho_mos qp run save_ortho_mos
to be sure your MOs will be orthogonal, which is not the case when to be sure your MOs will be orthogonal, which is not the case when
the MOs are read from output files (not enough precision in output).""" the MOs are read from output files (not enough precision in output).""")

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2 #!/usr/bin/env python3
""" """
Displays the names of all the files in which the provider/subroutine/function Displays the names of all the files in which the provider/subroutine/function
@ -30,7 +30,7 @@ try:
from docopt import docopt from docopt import docopt
from qp_path import QP_SRC, QP_ROOT from qp_path import QP_SRC, QP_ROOT
except ImportError: except ImportError:
print "source .quantum_package.rc" print("source .quantum_package.rc")
raise raise
@ -38,7 +38,7 @@ def main(arguments):
"""Main function""" """Main function"""
# Check that name exist in */IRPF90_man # Check that name exist in */IRPF90_man
print "Checking that name exists..." print("Checking that name exists...")
all_modules = os.listdir(QP_SRC) all_modules = os.listdir(QP_SRC)
f = arguments["<name>"]+".l" f = arguments["<name>"]+".l"
@ -52,21 +52,21 @@ def main(arguments):
if found: break if found: break
if not found: if not found:
print "Error:" print("Error:")
print "The variable/subroutine/function \""+arguments["<name>"] \ print("The variable/subroutine/function \""+arguments["<name>"] \
+ "\" was not found in the sources." + "\" was not found in the sources.")
print "Did you compile the code at the root?" print("Did you compile the code at the root?")
print "Continue? [y/N] ", print("Continue? [y/N] ", end=' ')
cont = sys.stdin.read(1).strip() in ["y", "Y"] cont = sys.stdin.read(1).strip() in ["y", "Y"]
if not cont: if not cont:
print "Aborted" print("Aborted")
sys.exit(1) sys.exit(1)
# Now search in all the files # Now search in all the files
if arguments["--rename"]: if arguments["--rename"]:
print "Replacing..." print("Replacing...")
else: else:
print "Searching..." print("Searching...")
name = re.compile(r"\b"+arguments["<name>"]+r"\b", re.IGNORECASE) name = re.compile(r"\b"+arguments["<name>"]+r"\b", re.IGNORECASE)
@ -84,15 +84,15 @@ def main(arguments):
with open(filename, "r") as f: with open(filename, "r") as f:
f_in = f.read() f_in = f.read()
if name.search(f_in): if name.search(f_in):
print filename print(filename)
if arguments["--rename"]: if arguments["--rename"]:
f_new = name.sub(arguments["--rename"], f_in) f_new = name.sub(arguments["--rename"], f_in)
with open(filename, "w") as f: with open(filename, "w") as f:
f.write(f_new) f.write(f_new)
print "Done" print("Done")
with open(os.path.join(QP_ROOT, "REPLACE"), 'a') as f: with open(os.path.join(QP_ROOT, "REPLACE"), 'a') as f:
print >>f, "qp_name "+" ".join(sys.argv[1:]) print("qp_name "+" ".join(sys.argv[1:]), file=f)

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
Usage: Usage:
@ -43,9 +43,9 @@ try:
from module_handler import get_l_module_descendant from module_handler import get_l_module_descendant
from qp_path import QP_SRC, QP_PLUGINS, QP_DATA, QP_ROOT from qp_path import QP_SRC, QP_PLUGINS, QP_DATA, QP_ROOT
except ImportError: except ImportError:
print "Please check if you have sourced the ${QP_ROOT}/quantum_package.rc" print("Please check if you have sourced the ${QP_ROOT}/quantum_package.rc")
print "(`source ${QP_ROOT}/quantum_package.rc`)" print("(`source ${QP_ROOT}/quantum_package.rc`)")
print sys.exit(1) print(sys.exit(1))
def save_new_module(path, l_child): def save_new_module(path, l_child):
@ -58,7 +58,7 @@ def save_new_module(path, l_child):
try: try:
os.makedirs(path) os.makedirs(path)
except OSError: except OSError:
print "The module ({0}) already exists...".format(path) print("The module ({0}) already exists...".format(path))
sys.exit(1) sys.exit(1)
with open(os.path.join(path, "NEED"), "w") as f: with open(os.path.join(path, "NEED"), "w") as f:
@ -105,7 +105,7 @@ def main(arguments):
if arguments["list"]: if arguments["list"]:
if arguments["--repositories"]: if arguments["--repositories"]:
for repo in get_repositories(): for repo in get_repositories():
print repo print(repo)
else: else:
# Search in QP_PLUGINS all directories with a NEED file # Search in QP_PLUGINS all directories with a NEED file
@ -121,7 +121,7 @@ def main(arguments):
for (x, y) in l_tmp: for (x, y) in l_tmp:
d_tmp[x] = y d_tmp[x] = y
repo_of_plugin[y] = x.replace(QP_PLUGINS+'/','') repo_of_plugin[y] = x.replace(QP_PLUGINS+'/','')
l_repository = d_tmp.keys() l_repository = list(d_tmp.keys())
if l_repository == []: if l_repository == []:
l_result = [] l_result = []
else: else:
@ -142,7 +142,7 @@ def main(arguments):
l_result = [f for f in l_plugins if f not in l_installed] l_result = [f for f in l_plugins if f not in l_installed]
for module in sorted(l_result): for module in sorted(l_result):
print "%-30s %-30s"%(module, repo_of_plugin[module]) print("%-30s %-30s"%(module, repo_of_plugin[module]))
if arguments["create"]: if arguments["create"]:
@ -159,29 +159,29 @@ def main(arguments):
path = os.path.join(QP_PLUGINS, repository, name) path = os.path.join(QP_PLUGINS, repository, name)
print "Created plugin:" print("Created plugin:")
print path, '\n' print(path, '\n')
for children in l_children: for children in l_children:
if children not in m_instance.dict_descendant: if children not in m_instance.dict_descendant:
print "Error: {0} is not a valid module.".format(children) print("Error: {0} is not a valid module.".format(children))
sys.exit(1) sys.exit(1)
print "Needed modules:" print("Needed modules:")
print l_children, '\n' print(l_children, '\n')
print "This corresponds to using the following modules:" print("This corresponds to using the following modules:")
print l_children + m_instance.l_descendant_unique(l_children), '\n' print(l_children + m_instance.l_descendant_unique(l_children), '\n')
print "Which is reduced to:" print("Which is reduced to:")
l_child_reduce = m_instance.l_reduce_tree(l_children) l_child_reduce = m_instance.l_reduce_tree(l_children)
print l_child_reduce, '\n' print(l_child_reduce, '\n')
print "Installation", print("Installation", end=' ')
save_new_module(path, l_child_reduce) save_new_module(path, l_child_reduce)
print " [ OK ]" print(" [ OK ]")
print "" print("")
arguments["create"] = False arguments["create"] = False
arguments["install"] = True arguments["install"] = True
main(arguments) main(arguments)
@ -228,7 +228,7 @@ def main(arguments):
for (x, y) in [os.path.split(f) for f in l_tmp]: for (x, y) in [os.path.split(f) for f in l_tmp]:
d_repo_of_plugin[y] = x d_repo_of_plugin[y] = x
d_repo[x] = None d_repo[x] = None
l_repository = d_repo.keys() l_repository = list(d_repo.keys())
d_plugin = get_dict_child(l_repository) d_plugin = get_dict_child(l_repository)
@ -236,7 +236,7 @@ def main(arguments):
d_child.update(d_plugin) d_child.update(d_plugin)
normalize_case = {} normalize_case = {}
for name in d_local.keys() + d_plugin.keys(): for name in list(d_local.keys()) + list(d_plugin.keys()):
normalize_case[name.lower()] = name normalize_case[name.lower()] = name
l_name = [normalize_case[name.lower()] for name in arguments["<name>"]] l_name = [normalize_case[name.lower()] for name in arguments["<name>"]]
@ -244,7 +244,7 @@ def main(arguments):
for name in l_name: for name in l_name:
if name in d_local: if name in d_local:
print "{0} Is already installed".format(name) print("{0} Is already installed".format(name))
l_module_descendant = get_l_module_descendant(d_child, l_name) l_module_descendant = get_l_module_descendant(d_child, l_name)
@ -252,10 +252,10 @@ def main(arguments):
if l_module_to_cp: if l_module_to_cp:
print "Required dependencies:" print("Required dependencies:")
print l_module_to_cp print(l_module_to_cp)
print "Installation...", print("Installation...", end=' ')
for module_to_cp in l_module_to_cp: for module_to_cp in l_module_to_cp:
src = os.path.join(d_repo_of_plugin[module_to_cp], module_to_cp) src = os.path.join(d_repo_of_plugin[module_to_cp], module_to_cp)
@ -269,10 +269,10 @@ def main(arguments):
subprocess.check_call([install]) subprocess.check_call([install])
os.chdir(wd) os.chdir(wd)
except OSError: except OSError:
print "The src directory is broken. Please remove %s" % des print("The src directory is broken. Please remove %s" % des)
raise raise
subprocess.check_call(["qp_create_ninja", "update"]) subprocess.check_call(["qp_create_ninja", "update"])
print "[ OK ]" print("[ OK ]")
elif arguments["uninstall"]: elif arguments["uninstall"]:
@ -285,17 +285,17 @@ def main(arguments):
l_failed = [name for name in l_name if name not in d_local] l_failed = [name for name in l_name if name not in d_local]
if l_failed: if l_failed:
print "Plugins not installed:" print("Plugins not installed:")
for name in sorted(l_failed): for name in sorted(l_failed):
print "%s" % name print("%s" % name)
sys.exit(1) sys.exit(1)
l_name_to_remove = l_name + \ l_name_to_remove = l_name + \
[module for module in m_instance.l_module \ [module for module in m_instance.l_module \
for name in l_name if name in d_descendant[module]] for name in l_name if name in d_descendant[module]]
print "Removing plugins:" print("Removing plugins:")
print l_name_to_remove print(l_name_to_remove)
for module in set(l_name_to_remove): for module in set(l_name_to_remove):
@ -310,7 +310,7 @@ def main(arguments):
try: try:
os.unlink(os.path.join(QP_SRC, module)) os.unlink(os.path.join(QP_SRC, module))
except OSError: except OSError:
print "%s is a core module which can't be removed" % module print("%s is a core module which can't be removed" % module)
elif arguments["update"]: elif arguments["update"]:
@ -321,7 +321,7 @@ def main(arguments):
l_repositories = get_repositories() l_repositories = get_repositories()
for repo in l_repositories: for repo in l_repositories:
print "Updating ", repo print("Updating ", repo)
os.chdir(os.path.join(QP_PLUGINS,repo)) os.chdir(os.path.join(QP_PLUGINS,repo))
git_cmd=["git", "pull"] git_cmd=["git", "pull"]
subprocess.check_call(git_cmd) subprocess.check_call(git_cmd)

View File

@ -95,6 +95,7 @@ qp set_file $ezfio
if [[ $dets -eq 1 ]] ; then if [[ $dets -eq 1 ]] ; then
rm --force -- ${ezfio}/determinants/n_det rm --force -- ${ezfio}/determinants/n_det
rm --force -- ${ezfio}/determinants/psi_{det,coef}.gz rm --force -- ${ezfio}/determinants/psi_{det,coef}.gz
rm --force -- ${ezfio}/determinants/psi_{det,coef}_qp_edit.gz
fi fi
if [[ $mos -eq 1 ]] ; then if [[ $mos -eq 1 ]] ; then

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2 #!/usr/bin/env python3
""" """
@ -49,7 +49,7 @@ import os.path
try: try:
import qp_path import qp_path
except ImportError: except ImportError:
print "source .quantum_package.rc" print("source .quantum_package.rc")
raise raise
from docopt import docopt from docopt import docopt
@ -102,7 +102,7 @@ def main(arguments):
mo_num = ezfio.mo_basis_mo_num mo_num = ezfio.mo_basis_mo_num
if arguments["--query"]: if arguments["--query"]:
print n_frozen print(n_frozen)
sys.exit(0) sys.exit(0)
if n_frozen == 0: if n_frozen == 0:

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2 #!/usr/bin/env python3
""" """
@ -23,7 +23,7 @@ import os.path
try: try:
import qp_path import qp_path
except ImportError: except ImportError:
print "source .quantum_package.rc" print("source .quantum_package.rc")
raise raise
from docopt import docopt from docopt import docopt
@ -62,7 +62,7 @@ def main(arguments):
mo_num = ezfio.mo_basis_mo_num mo_num = ezfio.mo_basis_mo_num
if arguments["--query"]: if arguments["--query"]:
print n_frozen print(n_frozen)
sys.exit(0) sys.exit(0)
if n_frozen == 0: if n_frozen == 0:

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
@ -21,8 +21,8 @@ try:
from docopt import docopt from docopt import docopt
from qp_path import QP_SRC, QP_TESTS from qp_path import QP_SRC, QP_TESTS
except ImportError: except ImportError:
print "Please check if you have sourced the ${QP_ROOT}/quantum_package.rc" print("Please check if you have sourced the ${QP_ROOT}/quantum_package.rc")
print "(`source ${QP_ROOT}/quantum_package.rc`)" print("(`source ${QP_ROOT}/quantum_package.rc`)")
sys.exit(1) sys.exit(1)
@ -54,11 +54,11 @@ def main(arguments):
os.chdir(QP_TESTS) os.chdir(QP_TESTS)
for bats_file in l_bats: for bats_file in l_bats:
print "" print("")
print "-~-~-~-~-~-~" print("-~-~-~-~-~-~")
print "" print("")
print "Running tests for %s"%(bats_file) print("Running tests for %s"%(bats_file))
print "" print("")
if arguments["-v"]: if arguments["-v"]:
p = None p = None
if arguments["TEST"]: if arguments["TEST"]:
@ -66,7 +66,7 @@ def main(arguments):
else: else:
test = "" test = ""
try: try:
os.system(test+" python2 bats_to_sh.py "+bats_file+ os.system(test+" python3 bats_to_sh.py "+bats_file+
"| bash") "| bash")
except: except:
if p: if p:

View File

@ -9,14 +9,14 @@
FC : ifort -fpic FC : ifort -fpic
LAPACK_LIB : -mkl=parallel LAPACK_LIB : -mkl=parallel
IRPF90 : irpf90 IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32 IRPF90_FLAGS : --ninja --align=32
# Global options # Global options
################ ################
# #
# 1 : Activate # 1 : Activate
# 0 : Deactivate # 0 : Deactivate
# #
[OPTION] [OPTION]
MODE : OPT ; [ OPT | PROFILE | DEBUG ] : Chooses the section below MODE : OPT ; [ OPT | PROFILE | DEBUG ] : Chooses the section below
CACHE : 0 ; Enable cache_compile.py CACHE : 0 ; Enable cache_compile.py
@ -32,14 +32,14 @@ OPENMP : 1 ; Append OpenMP flags
# #
[OPT] [OPT]
FC : -traceback FC : -traceback
FCFLAGS : -xAVX -O2 -ip -ftz -g FCFLAGS : -mavx -axAVX -O2 -ip -ftz -g
# Profiling flags # Profiling flags
################# #################
# #
[PROFILE] [PROFILE]
FC : -p -g FC : -p -g
FCFLAGS : -xSSE4.2 -O2 -ip -ftz FCFLAGS : -xSSE4.2 -O2 -ip -ftz
# Debugging flags # Debugging flags
################# #################

View File

@ -9,14 +9,14 @@
FC : mpiifort -fpic FC : mpiifort -fpic
LAPACK_LIB : -mkl=parallel LAPACK_LIB : -mkl=parallel
IRPF90 : irpf90 IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32 -DMPI IRPF90_FLAGS : --ninja --align=32 -DMPI
# Global options # Global options
################ ################
# #
# 1 : Activate # 1 : Activate
# 0 : Deactivate # 0 : Deactivate
# #
[OPTION] [OPTION]
MODE : OPT ; [ OPT | PROFILE | DEBUG ] : Chooses the section below MODE : OPT ; [ OPT | PROFILE | DEBUG ] : Chooses the section below
CACHE : 0 ; Enable cache_compile.py CACHE : 0 ; Enable cache_compile.py
@ -31,14 +31,14 @@ OPENMP : 1 ; Append OpenMP flags
# -ftz : Flushes denormal results to zero # -ftz : Flushes denormal results to zero
# #
[OPT] [OPT]
FCFLAGS : -march=corei7-avx -O2 -ip -ftz -g -traceback FCFLAGS : -mavx -axAVX -O2 -ip -ftz -g -traceback
# Profiling flags # Profiling flags
################# #################
# #
[PROFILE] [PROFILE]
FC : -p -g FC : -p -g
FCFLAGS : -march=corei7 -O2 -ip -ftz FCFLAGS : -march=corei7 -O2 -ip -ftz
# Debugging flags # Debugging flags

View File

@ -32,7 +32,7 @@ OPENMP : 1 ; Append OpenMP flags
# #
[OPT] [OPT]
FC : -traceback FC : -traceback
FCFLAGS : -xSSE4.2 -O2 -ip -ftz -g FCFLAGS : -msse4.2 -O2 -ip -ftz -g
# Profiling flags # Profiling flags
@ -40,7 +40,7 @@ FCFLAGS : -xSSE4.2 -O2 -ip -ftz -g
# #
[PROFILE] [PROFILE]
FC : -p -g FC : -p -g
FCFLAGS : -xSSE4.2 -O2 -ip -ftz FCFLAGS : -msse4.2 -O2 -ip -ftz
# Debugging flags # Debugging flags
@ -50,11 +50,11 @@ FCFLAGS : -xSSE4.2 -O2 -ip -ftz
# -fpe0 : All floating point exaceptions # -fpe0 : All floating point exaceptions
# -C : Checks uninitialized variables, array subscripts, etc... # -C : Checks uninitialized variables, array subscripts, etc...
# -g : Extra debugging information # -g : Extra debugging information
# -xSSE2 : Valgrind needs a very simple x86 executable # -msse4.2 : Valgrind needs a very simple x86 executable
# #
[DEBUG] [DEBUG]
FC : -g -traceback FC : -g -traceback
FCFLAGS : -xSSE4.2 -C -fpe0 -implicitnone FCFLAGS : -msse4.2 -C -fpe0 -implicitnone
# OpenMP flags # OpenMP flags

View File

@ -1,63 +0,0 @@
# Common flags
##############
#
# -mkl=[parallel|sequential] : Use the MKL library
# --ninja : Allow the utilisation of ninja. It is mandatory !
# --align=32 : Align all provided arrays on a 32-byte boundary
#
[COMMON]
FC : ifort -fpic
LAPACK_LIB : -mkl=parallel
IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32
# Global options
################
#
# 1 : Activate
# 0 : Deactivate
#
[OPTION]
MODE : OPT ; [ OPT | PROFILE | DEBUG ] : Chooses the section below
CACHE : 0 ; Enable cache_compile.py
OPENMP : 1 ; Append OpenMP flags
# Optimization flags
####################
#
# -xHost : Compile a binary optimized for the current architecture
# -O2 : O3 not better than O2.
# -ip : Inter-procedural optimizations
# -ftz : Flushes denormal results to zero
#
[OPT]
FC : -traceback
FCFLAGS : -march=core-avx2 -O2 -ip -ftz -g
# Profiling flags
#################
#
[PROFILE]
FC : -p -g
FCFLAGS : -march=core-avx2 -O2 -ip -ftz
# Debugging flags
#################
#
# -traceback : Activate backtrace on runtime
# -fpe0 : All floating point exaceptions
# -C : Checks uninitialized variables, array subscripts, etc...
# -g : Extra debugging information
# -xSSE2 : Valgrind needs a very simple x86 executable
#
[DEBUG]
FC : -g -traceback
FCFLAGS : -xSSE2 -C -fpe0 -implicitnone
# OpenMP flags
#################
#
[OPENMP]
FC : -qopenmp
IRPF90_FLAGS : --openmp

View File

@ -9,14 +9,14 @@
FC : mpiifort -fpic FC : mpiifort -fpic
LAPACK_LIB : -mkl=parallel LAPACK_LIB : -mkl=parallel
IRPF90 : irpf90 IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32 -DMPI IRPF90_FLAGS : --ninja --align=32 -DMPI
# Global options # Global options
################ ################
# #
# 1 : Activate # 1 : Activate
# 0 : Deactivate # 0 : Deactivate
# #
[OPTION] [OPTION]
MODE : OPT ; [ OPT | PROFILE | DEBUG ] : Chooses the section below MODE : OPT ; [ OPT | PROFILE | DEBUG ] : Chooses the section below
CACHE : 0 ; Enable cache_compile.py CACHE : 0 ; Enable cache_compile.py
@ -31,14 +31,14 @@ OPENMP : 1 ; Append OpenMP flags
# -ftz : Flushes denormal results to zero # -ftz : Flushes denormal results to zero
# #
[OPT] [OPT]
FCFLAGS : -xSSE4.2 -O2 -ip -ftz -g -traceback FCFLAGS : -msse4.2 -O2 -ip -ftz -g -traceback
# Profiling flags # Profiling flags
################# #################
# #
[PROFILE] [PROFILE]
FC : -p -g FC : -p -g
FCFLAGS : -xSSE4.2 -O2 -ip -ftz FCFLAGS : -msse4.2 -O2 -ip -ftz
# Debugging flags # Debugging flags

91
configure vendored
View File

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
# #
# Quantum Package configuration script # Quantum Package configuration script
# #
@ -15,20 +15,20 @@ unset CCXX
export CC=gcc export CC=gcc
# When updating version, update also etc files # /!\ When updating version, update also etc files
EZFIO_TGZ="EZFIO.2.0.2.tar.gz"
BATS_URL="https://github.com/bats-core/bats-core/archive/v1.1.0.tar.gz" BATS_URL="https://github.com/bats-core/bats-core/archive/v1.1.0.tar.gz"
BUBBLE_URL="https://github.com/projectatomic/bubblewrap/releases/download/v0.3.3/bubblewrap-0.3.3.tar.xz" BUBBLE_URL="https://github.com/projectatomic/bubblewrap/releases/download/v0.3.3/bubblewrap-0.3.3.tar.xz"
DOCOPT_URL="https://github.com/docopt/docopt/archive/0.6.2.tar.gz" DOCOPT_URL="https://github.com/docopt/docopt/archive/0.6.2.tar.gz"
BSE_URL="https://github.com/MolSSI-BSE/basis_set_exchange/archive/v0.8.11.tar.gz" BSE_URL="https://github.com/MolSSI-BSE/basis_set_exchange/archive/v0.8.11.tar.gz"
EZFIO_URL="https://gitlab.com/scemama/EZFIO/-/archive/v1.6.1/EZFIO-v1.6.1.tar.gz"
F77ZMQ_URL="https://github.com/scemama/f77_zmq/archive/v4.2.5.tar.gz" F77ZMQ_URL="https://github.com/scemama/f77_zmq/archive/v4.2.5.tar.gz"
GMP_URL="ftp://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.bz2" GMP_URL="ftp://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.bz2"
IRPF90_URL="https://gitlab.com/scemama/irpf90/-/archive/v1.7.6/irpf90-v1.7.6.tar.gz" IRPF90_URL="https://gitlab.com/scemama/irpf90/-/archive/v2.0.0/irpf90-v2.0.0.tar.gz"
LIBCAP_URL="https://git.kernel.org/pub/scm/linux/kernel/git/morgan/libcap.git/snapshot/libcap-2.25.tar.gz" LIBCAP_URL="https://git.kernel.org/pub/scm/linux/kernel/git/morgan/libcap.git/snapshot/libcap-2.25.tar.gz"
NINJA_URL="https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip" NINJA_URL="https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip"
OCAML_URL="https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh" OCAML_URL="https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh"
RESULTS_URL="https://gitlab.com/scemama/resultsFile/-/archive/v1.0/resultsFile-v1.0.tar.gz" RESULTS_URL="https://gitlab.com/scemama/resultsFile/-/archive/v2.0/resultsFile-v2.0.tar.gz"
ZEROMQ_URL="https://github.com/zeromq/libzmq/releases/download/v4.2.5/zeromq-4.2.5.tar.gz" ZEROMQ_URL="https://github.com/zeromq/libzmq/releases/download/v4.2.5/zeromq-4.2.5.tar.gz"
ZLIB_URL="https://www.zlib.net/zlib-1.2.11.tar.gz" ZLIB_URL="https://www.zlib.net/zlib-1.2.11.tar.gz"
@ -45,7 +45,7 @@ Usage:
Options: Options:
-c, --config=<file> Define a COMPILATION configuration file, -c, --config=<file> Define a COMPILATION configuration file,
in "${QP_ROOT}/config/". in "${QP_ROOT}/config/".
-h, --help Print the HELP message -h, --help Print the HELP message
-i, --install=<package> INSTALL <package>. Use at your OWN RISK: -i, --install=<package> INSTALL <package>. Use at your OWN RISK:
no support will be provided for the installation of no support will be provided for the installation of
@ -73,7 +73,7 @@ function execute () {
while read -r line; do while read -r line; do
echo " " $line echo " " $line
_command+="${line} ;" _command+="${line} ;"
done done
sleep 1 sleep 1
echo "" echo ""
printf "\e[0;94m" printf "\e[0;94m"
@ -87,7 +87,7 @@ OCAML_PACKAGES="ocamlbuild cryptokit zmq sexplib ppx_sexp_conv ppx_deriving geto
while true ; do while true ; do
case "$1" in case "$1" in
-c|--config) -c|--config)
case "$2" in case "$2" in
"") help ; break;; "") help ; break;;
*) if [[ -f $2 ]] ; then *) if [[ -f $2 ]] ; then
@ -96,15 +96,15 @@ while true ; do
error "error: configuration file $2 not found." error "error: configuration file $2 not found."
exit 1 exit 1
fi fi
esac esac
shift 2;; shift 2;;
-i|--install) -i|--install)
case "$2" in case "$2" in
"") help ; break;; "") help ; break;;
*) PACKAGES="${PACKAGE} $2" *) PACKAGES="${PACKAGE} $2"
esac esac
shift 2;; shift 2;;
-h|-help|--help) -h|-help|--help)
help help
exit 0;; exit 0;;
--) shift ; break ;; --) shift ; break ;;
@ -154,7 +154,7 @@ function find_exe() {
} }
function find_python_lib() { function find_python_lib() {
python2 -c "import $1" &> /dev/null && echo "$1" || not_found python3 -c "import $1" &> /dev/null && echo "$1" || not_found
} }
function find_lib() { function find_lib() {
@ -178,6 +178,19 @@ function find_dir() {
} }
# Extract EZFIO if needed
EZFIO=$(find_dir "${QP_ROOT}"/external/ezfio)
if [[ ${EZFIO} = $(not_found) ]] ; then
execute << EOF
cd "\${QP_ROOT}"/external
tar --gunzip --extract --file ${EZFIO_TGZ}
rm -rf ezfio
mv EZFIO ezfio
EOF
fi
if [[ "${PACKAGES}.x" != ".x" ]] ; then if [[ "${PACKAGES}.x" != ".x" ]] ; then
printf "\e[0;31m" printf "\e[0;31m"
echo "" echo ""
@ -224,7 +237,7 @@ EOF
./configure --prefix=$QP_ROOT && make -j 8 ./configure --prefix=$QP_ROOT && make -j 8
make install make install
EOF EOF
elif [[ ${PACKAGE} = libcap ]] ; then elif [[ ${PACKAGE} = libcap ]] ; then
download ${LIBCAP_URL} "${QP_ROOT}"/external/libcap.tar.gz download ${LIBCAP_URL} "${QP_ROOT}"/external/libcap.tar.gz
@ -259,12 +272,14 @@ EOF
cd irpf90-* cd irpf90-*
make make
EOF EOF
elif [[ ${PACKAGE} = zeromq ]] ; then elif [[ ${PACKAGE} = zeromq ]] ; then
download ${ZEROMQ_URL} "${QP_ROOT}"/external/zeromq.tar.gz download ${ZEROMQ_URL} "${QP_ROOT}"/external/zeromq.tar.gz
execute << EOF execute << EOF
export CC=gcc
export CXX=g++
cd "\${QP_ROOT}"/external cd "\${QP_ROOT}"/external
tar --gunzip --extract --file zeromq.tar.gz tar --gunzip --extract --file zeromq.tar.gz
rm zeromq.tar.gz rm zeromq.tar.gz
@ -290,7 +305,7 @@ EOF
cp f77_zmq_free.h "\${QP_ROOT}"/include cp f77_zmq_free.h "\${QP_ROOT}"/include
EOF EOF
elif [[ ${PACKAGE} = ocaml ]] ; then elif [[ ${PACKAGE} = ocaml ]] ; then
download ${OCAML_URL} "${QP_ROOT}"/external/opam_installer.sh download ${OCAML_URL} "${QP_ROOT}"/external/opam_installer.sh
@ -303,7 +318,7 @@ EOF
rm -rf ${HOME}/.opam rm -rf ${HOME}/.opam
fi fi
export OPAMROOT=${HOME}/.opam export OPAMROOT=${HOME}/.opam
cat << EOF | bash ${QP_ROOT}/external/opam_installer.sh --no-backup cat << EOF | bash ${QP_ROOT}/external/opam_installer.sh --no-backup
${QP_ROOT}/bin ${QP_ROOT}/bin
@ -313,8 +328,8 @@ EOF
rm ${QP_ROOT}/external/opam_installer.sh rm ${QP_ROOT}/external/opam_installer.sh
# source ${OPAMROOT}/opam-init/init.sh > /dev/null 2> /dev/null || true # source ${OPAMROOT}/opam-init/init.sh > /dev/null 2> /dev/null || true
# #
# opam switch create ocaml-base-compiler.4.07.1 # opam switch create ocaml-base-compiler.4.10.0
opam init --verbose --yes --compiler=4.07.1 --disable-sandboxing opam init --verbose --yes --compiler=4.10.0 --disable-sandboxing
eval $(opam env) eval $(opam env)
opam install -y ${OCAML_PACKAGES} || exit 1 opam install -y ${OCAML_PACKAGES} || exit 1
@ -323,37 +338,25 @@ EOF
# Conventional commands # Conventional commands
execute << EOF execute << EOF
chmod +x "${QP_ROOT}"/external/opam_installer.sh chmod +x "${QP_ROOT}"/external/opam_installer.sh
"${QP_ROOT}"/external/opam_installer.sh --no-backup "${QP_ROOT}"/external/opam_installer.sh --no-backup
EOF EOF
execute << EOF execute << EOF
rm --force ${QP_ROOT}/bin/opam rm --force ${QP_ROOT}/bin/opam
export OPAMROOT=${OPAMROOT:-${QP_ROOT}/external/opam} export OPAMROOT=${OPAMROOT:-${QP_ROOT}/external/opam}
echo ${QP_ROOT}/bin \ echo ${QP_ROOT}/bin \
| sh ${QP_ROOT}/external/opam_installer.sh | sh ${QP_ROOT}/external/opam_installer.sh
EOF EOF
rm ${QP_ROOT}/external/opam_installer.sh rm ${QP_ROOT}/external/opam_installer.sh
# source ${OPAMROOT}/opam-init/init.sh > /dev/null 2> /dev/null || true # source ${OPAMROOT}/opam-init/init.sh > /dev/null 2> /dev/null || true
# opam switch create ocaml-base-compiler.4.07.1 || exit 1 # opam switch create ocaml-base-compiler.4.10.0 || exit 1
opam init --verbose --yes --compiler=4.07.1 --disable-sandboxing opam init --verbose --yes --compiler=4.10.0 --disable-sandboxing
eval $(opam env) eval $(opam env)
execute << EOF execute << EOF
opam install -y \${OCAML_PACKAGES} || exit 1 opam install -y \${OCAML_PACKAGES} || exit 1
EOF EOF
fi fi
elif [[ ${PACKAGE} = ezfio ]] ; then
download ${EZFIO_URL} "${QP_ROOT}"/external/ezfio.tar.gz
execute << EOF
cd "\${QP_ROOT}"/external
tar --gunzip --extract --file ezfio.tar.gz
rm -f ezfio.tar.gz
rm -rf ezfio
mv EZFIO-* ezfio
EOF
elif [[ ${PACKAGE} = bse ]] ; then elif [[ ${PACKAGE} = bse ]] ; then
@ -375,13 +378,13 @@ EOF
make && make install make && make install
EOF EOF
elif [[ ${PACKAGE} = docopt ]] ; then elif [[ ${PACKAGE} = docopt ]] ; then
download ${DOCOPT_URL} "${QP_ROOT}"/external/docopt.tar.gz download ${DOCOPT_URL} "${QP_ROOT}"/external/docopt.tar.gz
execute << EOF execute << EOF
cd "\${QP_ROOT}"/external cd "\${QP_ROOT}"/external
tar --gunzip --extract --file docopt.tar.gz tar --gunzip --extract --file docopt.tar.gz
mv docopt-*/docopt.py "\${QP_ROOT}/external/Python" mv docopt-*/docopt.py "\${QP_ROOT}/external/Python"
rm --recursive --force -- docopt-*/ docopt.tar.gz rm --recursive --force -- docopt-*/ docopt.tar.gz
EOF EOF
@ -392,7 +395,7 @@ EOF
download ${RESULTS_URL} "${QP_ROOT}"/external/resultsFile.tar.gz download ${RESULTS_URL} "${QP_ROOT}"/external/resultsFile.tar.gz
execute << EOF execute << EOF
cd "\${QP_ROOT}"/external cd "\${QP_ROOT}"/external
tar --gunzip --extract --file resultsFile.tar.gz tar --gunzip --extract --file resultsFile.tar.gz
mv resultsFile-*/resultsFile "\${QP_ROOT}/external/Python/" mv resultsFile-*/resultsFile "\${QP_ROOT}/external/Python/"
rm --recursive --force resultsFile-* resultsFile.tar.gz rm --recursive --force resultsFile-* resultsFile.tar.gz
EOF EOF
@ -402,7 +405,7 @@ EOF
download ${BATS_URL} "${QP_ROOT}"/external/bats.tar.gz download ${BATS_URL} "${QP_ROOT}"/external/bats.tar.gz
execute << EOF execute << EOF
cd "\${QP_ROOT}"/external cd "\${QP_ROOT}"/external
tar -zxf bats.tar.gz tar -zxf bats.tar.gz
( cd bats-core-1.1.0/ ; ./install.sh \${QP_ROOT}) ( cd bats-core-1.1.0/ ; ./install.sh \${QP_ROOT})
rm --recursive --force -- bats-core-1.1.0 \ "\${QP_ROOT}"/external/bats.tar.gz rm --recursive --force -- bats-core-1.1.0 \ "\${QP_ROOT}"/external/bats.tar.gz
EOF EOF
@ -468,12 +471,6 @@ if [[ ${OCAML} = $(not_found) ]] ; then
fail fail
fi fi
EZFIO=$(find_dir "${QP_ROOT}"/external/ezfio)
if [[ ${EZFIO} = $(not_found) ]] ; then
error "EZFIO (ezfio) is not installed."
fail
fi
ZLIB=$(find_lib -lz) ZLIB=$(find_lib -lz)
if [[ ${ZLIB} = $(not_found) ]] ; then if [[ ${ZLIB} = $(not_found) ]] ; then
error "Zlib (zlib) is not installed." error "Zlib (zlib) is not installed."
@ -520,15 +517,15 @@ fi
if [[ -f ${QP_ROOT}/build.ninja ]] ; then if [[ -f ${QP_ROOT}/build.ninja ]] ; then
[[ -z ${TRAVIS} ]] && echo "You can now run ./bin/qpsh to enter in the QP shell mode :)" [[ -z ${TRAVIS} ]] && echo "You can now run ./bin/qpsh to enter in the QP shell mode :)"
else else
echo "" echo ""
echo "${QP_ROOT}/build.ninja does not exist," echo "${QP_ROOT}/build.ninja does not exist,"
echo "you need to specify the COMPILATION configuration file." echo "you need to specify the COMPILATION configuration file."
echo "See ./configure --help for more details." echo "See ./configure --help for more details."
echo "" echo ""
fi fi
exit 0 exit 0

View File

@ -14,7 +14,7 @@ help:
.PHONY: help Makefile auto .PHONY: help Makefile auto
auto: auto:
cd source ; python2 auto_generate.py cd source ; python3 auto_generate.py
# Catch-all target: route all unknown targets to Sphinx using the new # Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).

View File

@ -1,9 +1,9 @@
#!/usr/bin/env python2 #!/usr/bin/env python2
from __future__ import print_function
import os import os
import sys import sys
import ConfigParser import configparser
from module_handler import get_binaries from module_handler import get_binaries
@ -27,7 +27,7 @@ def generate_modules(abs_module, entities):
EZFIO = os.path.join(abs_module,'EZFIO.cfg') EZFIO = os.path.join(abs_module,'EZFIO.cfg')
if os.path.exists(EZFIO): if os.path.exists(EZFIO):
rst += ["", "EZFIO parameters", "----------------", ""] rst += ["", "EZFIO parameters", "----------------", ""]
config_file = ConfigParser.ConfigParser() config_file = configparser.ConfigParser()
with open(EZFIO, 'r') as f: with open(EZFIO, 'r') as f:
config_file.readfp(f) config_file.readfp(f)
for section in config_file.sections(): for section in config_file.sections():

View File

@ -1,7 +1,7 @@
# Configuration of IRPF90 package # Configuration of IRPF90 package
# Set the path of IRPF90 here: # Set the path of IRPF90 here:
export IRPF90_PATH=${QP_ROOT}/external/irpf90-v1.7.6 export IRPF90_PATH=${QP_ROOT}/external/irpf90-v2.0.0
export PATH=${PATH}:${IRPF90_PATH}/bin export PATH=${PATH}:${IRPF90_PATH}/bin
export IRPF90=${IRPF90_PATH}/bin/irpf90 export IRPF90=${IRPF90_PATH}/bin/irpf90
@ -10,10 +10,10 @@ function source_if_exists() {
if [[ -f $1 ]]; then if [[ -f $1 ]]; then
cd $(dirname $1) ; source $(basename $1) ; cd - cd $(dirname $1) ; source $(basename $1) ; cd -
fi &> /dev/null fi &> /dev/null
} }
source ${QP_ROOT}/etc/autocomplete.rc source ${QP_ROOT}/etc/autocomplete.rc
source_if_exists "${IRPF90_PATH}/irpman-completions.bash" source_if_exists "${IRPF90_PATH}/irpman-completions.bash"

View File

@ -38,5 +38,6 @@ export LD_LIBRARY_PATH=$(qp_prepend_export "LD_LIBRARY_PATH" "${QP_ROOT}"/lib)
export LIBRARY_PATH=$(qp_prepend_export "LIBRARY_PATH" "${QP_ROOT}"/lib:"${QP_ROOT}"/lib64) export LIBRARY_PATH=$(qp_prepend_export "LIBRARY_PATH" "${QP_ROOT}"/lib:"${QP_ROOT}"/lib64)
export C_INCLUDE_PATH=$(qp_prepend_export "C_INCLUDE_PATH" "${QP_ROOT}"/include) export C_INCLUDE_PATH=$(qp_prepend_export "C_INCLUDE_PATH" "${QP_ROOT}"/include)
export CPATH=$(qp_prepend_export "CPATH" "${QP_ROOT}"/include)

BIN
external/EZFIO.2.0.2.tar.gz vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,46 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml
# Translations
*.mo
*.pot
# Django stuff:
*.log
# Sphinx documentation
docs/_build/
# PyBuilder
target/

View File

@ -21,10 +21,6 @@ let () =
doc="Downloads the EZFIO directory." ; doc="Downloads the EZFIO directory." ;
arg=Without_arg; } ; arg=Without_arg; } ;
{ short='v' ; long="verbose" ; opt=Optional ;
doc="Prints the transfer speed." ;
arg=Without_arg; } ;
anonymous anonymous
"(EZFIO_DIR|ADDRESS)" "(EZFIO_DIR|ADDRESS)"
Mandatory Mandatory
@ -150,45 +146,6 @@ let () =
Zmq.Socket.subscribe socket_in ""; Zmq.Socket.subscribe socket_in "";
(*
let action =
if verbose then
begin
match req_or_sub with
| REQ -> (fun () ->
let msg =
Zmq.Socket.recv_all socket_in
in
let t0 = Unix.gettimeofday () in
Zmq.Socket.send_all socket_out msg;
let in_size =
float_of_int ( List.fold_left (fun accu x -> accu + String.length x) 0 msg )
/. 8192. /. 1024.
in
let msg =
Zmq.Socket.recv_all socket_out
in
let t1 = Unix.gettimeofday () in
Zmq.Socket.send_all socket_in msg;
let in_time = t1 -. t0 in
in_time_sum := !in_time_sum +. in_time;
in_size_sum := !in_size_sum +. in_size;
Printf.printf " %16.2f MiB/s -- %16.2f MiB/s\n%!" (in_size /. in_time) (!in_size_sum /. !in_time_sum);
)
| SUB -> (fun () ->
Zmq.Socket.recv_all socket_in |> Zmq.Socket.send_all socket_out)
end
else
begin
match req_or_sub with
| REQ -> (fun () ->
Zmq.Socket.recv_all socket_in |> Zmq.Socket.send_all socket_out;
Zmq.Socket.recv_all socket_out |> Zmq.Socket.send_all socket_in )
| SUB -> (fun () ->
Zmq.Socket.recv_all socket_in |> Zmq.Socket.send_all socket_out)
end
in
*)
let action_in = let action_in =
match req_or_sub with match req_or_sub with

View File

@ -219,22 +219,19 @@ module Perturbation : sig
end = struct end = struct
type t = type t =
| EN | EN
| Barycentric | HF
| Variance
| SOP | SOP
[@@deriving sexp] [@@deriving sexp]
let to_string = function let to_string = function
| EN -> \"EN\" | EN -> \"EN\"
| Variance -> \"Variance\" | HF -> \"HF\"
| Barycentric -> \"Barycentric\"
| SOP -> \"SOP\" | SOP -> \"SOP\"
let of_string s = let of_string s =
match (String.lowercase_ascii s) with match (String.lowercase_ascii s) with
| \"sop\" -> SOP | \"sop\" -> SOP
| \"en\" -> EN | \"en\" -> EN
| \"variance\" -> Variance | \"hf\" -> HF
| \"barycentric\" -> Barycentric
| _ -> raise (Invalid_argument (\"Wrong Perturbation type : \"^s)) | _ -> raise (Invalid_argument (\"Wrong Perturbation type : \"^s))
end end
" "

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2 #!/usr/bin/env python3
""" """
Save the .o from a .f90 Save the .o from a .f90
and is the .o is asked a second time, retur it and is the .o is asked a second time, retur it
@ -13,9 +13,9 @@ import re
import shutil import shutil
import subprocess import subprocess
r = re.compile(ur'-c\s+(\S+\.[fF]90)\s+-o\s+(\S+\.o)') r = re.compile(r'-c\s+(\S+\.[fF]90)\s+-o\s+(\S+\.o)')
p = re.compile(ur'-I IRPF90_temp/\S*\s+') p = re.compile(r'-I IRPF90_temp/\S*\s+')
mod = re.compile(ur'module\s+(?P<mod>\S+).+end\s?module\s+(?P=mod)?', mod = re.compile(r'module\s+(?P<mod>\S+).+end\s?module\s+(?P=mod)?',
re.MULTILINE | re.IGNORECASE) re.MULTILINE | re.IGNORECASE)
tmpdir_root = os.environ.get("TMPDIR", failobj="/dev/shm") tmpdir_root = os.environ.get("TMPDIR", failobj="/dev/shm")

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
Usage: qp_create_ninja create <config_file> (--development | --production) Usage: qp_create_ninja create <config_file> (--development | --production)
@ -24,7 +24,7 @@ except ImportError:
"..", "..",
"quantum_package.rc")) "quantum_package.rc"))
print "\n".join(["", "Error:", "source %s" % f, ""]) print("\n".join(["", "Error:", "source %s" % f, ""]))
sys.exit(1) sys.exit(1)
# Compress path # Compress path
@ -124,7 +124,7 @@ def dict_module_genelogy_path(d_module_genelogy):
d_module_genelogy d_module_genelogy
""" """
d = dict() d = dict()
for module_rel, l_children_rel in d_module_genelogy.iteritems(): for module_rel, l_children_rel in d_module_genelogy.items():
module_abs = real_join(QP_SRC, module_rel) module_abs = real_join(QP_SRC, module_rel)
p = Path(module_abs, module_rel) p = Path(module_abs, module_rel)
@ -235,11 +235,11 @@ def ninja_ezfio_cfg_build(l_util):
""" """
l_string = [] l_string = []
for m in l_util.itervalues(): for m in l_util.values():
str_ = "build {1} {2}: build_ezfio_interface {0}" str_ = "build {1} {2}: build_ezfio_interface {0}"
l_string += [str_.format(*map(comp_path,(m.ez_cfg.abs, m.ez_interface.abs, l_string += [str_.format(*list(map(comp_path,(m.ez_cfg.abs, m.ez_interface.abs,
m.ez_config.abs)))] m.ez_config.abs))))]
l_string += [" sub_module = {0}".format(comp_path(m.ez_module.abs))] l_string += [" sub_module = {0}".format(comp_path(m.ez_module.abs))]
l_string += [""] l_string += [""]
@ -257,8 +257,8 @@ def ninja_ezfio_config_build(l_ezfio_config):
file_source = m.path_in_module file_source = m.path_in_module
file_create = m.path_in_ezfio file_create = m.path_in_ezfio
l_string += ["build {0}: build_ezfio_config {1}".format(*map(comp_path,(file_create, l_string += ["build {0}: build_ezfio_config {1}".format(*list(map(comp_path,(file_create,
file_source)))] file_source))))]
l_string += [""] l_string += [""]
return l_string return l_string
@ -291,7 +291,7 @@ def ninja_ezfio_build(l_ezfio_config, l_util):
""" """
l_ezfio_config = [i.path_in_ezfio for i in l_ezfio_config] l_ezfio_config = [i.path_in_ezfio for i in l_ezfio_config]
l_ezfio_from_cfg = [i.ez_config.abs for i in l_util.itervalues()] l_ezfio_from_cfg = [i.ez_config.abs for i in l_util.values()]
str_ = " ".join(map(comp_path,(l_ezfio_config + l_ezfio_from_cfg))) str_ = " ".join(map(comp_path,(l_ezfio_config + l_ezfio_from_cfg)))
l_string = ["build {0}: build_ezfio {1}".format(EZFIO_LIB, str_), ""] l_string = ["build {0}: build_ezfio {1}".format(EZFIO_LIB, str_), ""]
@ -335,7 +335,7 @@ def ninja_symlink_build(path_module, l_symlink):
""] ""]
for symlink in l_symlink: for symlink in l_symlink:
l_string += ["build {0}: build_symlink {1}".format(*map(comp_path,(symlink.destination, symlink.source))), ""] l_string += ["build {0}: build_symlink {1}".format(*list(map(comp_path,(symlink.destination, symlink.source)))), ""]
return l_string return l_string
@ -360,7 +360,7 @@ def ninja_gitignore_build(path_module, d_binaries, l_symlink):
path_gitignore = comp_path(join(path_module.abs, ".gitignore")) path_gitignore = comp_path(join(path_module.abs, ".gitignore"))
l_b = map(comp_path,[i.abs for i in d_binaries[path_module]]) l_b = list(map(comp_path,[i.abs for i in d_binaries[path_module]]))
root = "build {0}: build_gitignore {1}".format(path_gitignore, root = "build {0}: build_gitignore {1}".format(path_gitignore,
" ".join(l_b)) " ".join(l_b))
@ -420,9 +420,9 @@ def get_file_dependency(d_info_module):
""" """
d_irp = defaultdict(dict) d_irp = defaultdict(dict)
for module, l_children in d_info_module.iteritems(): for module, l_children in d_info_module.items():
for key, values in get_l_file_for_module(module).iteritems(): for key, values in get_l_file_for_module(module).items():
if key in ["l_src"]: if key in ["l_src"]:
values = [join(module.abs, o) for o in values] values = [join(module.abs, o) for o in values]
if key in ["l_obj"]: if key in ["l_obj"]:
@ -431,7 +431,7 @@ def get_file_dependency(d_info_module):
d_irp[module][key] = values d_irp[module][key] = values
for children in l_children: for children in l_children:
for key, values in get_l_file_for_module(children).iteritems(): for key, values in get_l_file_for_module(children).items():
if key in ["l_src"]: if key in ["l_src"]:
values = [join(module.abs, children.rel, o) values = [join(module.abs, children.rel, o)
for o in values] for o in values]
@ -495,10 +495,10 @@ def ninja_irpf90_make_build(path_module, l_needed_molule, d_irp):
# D e p e n d a n c y # # D e p e n d a n c y #
# ~#~#~#~#~#~#~#~#~#~ # # ~#~#~#~#~#~#~#~#~#~ #
l_depend = map(comp_path,d_irp[path_module]["l_depend"]) l_depend = list(map(comp_path,d_irp[path_module]["l_depend"]))
l_src = map(comp_path,d_irp[path_module]["l_src"]) l_src = list(map(comp_path,d_irp[path_module]["l_src"]))
l_obj = map(comp_path,d_irp[path_module]["l_obj"]) l_obj = list(map(comp_path,d_irp[path_module]["l_obj"]))
l_template = map(comp_path,d_irp[path_module]["l_template"]) l_template = list(map(comp_path,d_irp[path_module]["l_template"]))
if l_needed_molule: if l_needed_molule:
l_symlink = ["l_symlink_{0}".format(path_module.rel)] l_symlink = ["l_symlink_{0}".format(path_module.rel)]
@ -511,7 +511,7 @@ def ninja_irpf90_make_build(path_module, l_needed_molule, d_irp):
# N i n j a _ b u i l d # # N i n j a _ b u i l d #
# ~#~#~#~#~#~#~#~#~#~#~ # # ~#~#~#~#~#~#~#~#~#~#~ #
l_include_dir = ["-I {0}".format(m.rel) for m in l_needed_molule] l_include_dir = ["-I {0}".format(m.rel) for m in l_needed_molule]
l_string = [ l_string = [
"build {0}: build_irpf90.ninja {1}".format(str_creation, str_depend), "build {0}: build_irpf90.ninja {1}".format(str_creation, str_depend),
@ -544,6 +544,7 @@ def get_binaries(path_module):
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE) stderr=subprocess.PIPE)
stdout, stderr = process.communicate() stdout, stderr = process.communicate()
stdout = stdout.decode()
except OSError: except OSError:
return [] return []
else: else:
@ -641,7 +642,7 @@ def ninja_binaries_build(path_module, l_children, d_binaries):
# ~#~#~ # # ~#~#~ #
ninja_module_path = join(comp_path(path_module.abs), "IRPF90_temp/build.ninja") ninja_module_path = join(comp_path(path_module.abs), "IRPF90_temp/build.ninja")
l_abs_bin = map(comp_path,[binary.abs for binary in d_binaries[path_module]]) l_abs_bin = list(map(comp_path,[binary.abs for binary in d_binaries[path_module]]))
# ~#~#~#~#~#~ # # ~#~#~#~#~#~ #
# s t r i n g # # s t r i n g #
@ -658,7 +659,7 @@ def ninja_binaries_build(path_module, l_children, d_binaries):
def ninja_module_build(path_module, d_binaries): def ninja_module_build(path_module, d_binaries):
l_abs_bin = map(comp_path,[binary.abs for binary in d_binaries[path_module]]) l_abs_bin = list(map(comp_path,[binary.abs for binary in d_binaries[path_module]]))
path_readme = os.path.join(comp_path(path_module.abs), "README.rst") path_readme = os.path.join(comp_path(path_module.abs), "README.rst")
@ -829,14 +830,14 @@ if __name__ == "__main__":
dict_root = module_instance.dict_root dict_root = module_instance.dict_root
dict_root_path = dict_module_genelogy_path(dict_root) dict_root_path = dict_module_genelogy_path(dict_root)
l_all_module = d_genealogy_path.keys() l_all_module = list(d_genealogy_path.keys())
# ~#~#~#~#~#~#~#~#~#~#~#~#~ # # ~#~#~#~#~#~#~#~#~#~#~#~#~ #
# M o d u l e _ t o _ i r p # # M o d u l e _ t o _ i r p #
# ~#~#~#~#~#~#~#~#~#~#~#~#~ # # ~#~#~#~#~#~#~#~#~#~#~#~#~ #
d_binaries = get_dict_binaries(l_all_module, mode="development") d_binaries = get_dict_binaries(l_all_module, mode="development")
l_module = d_binaries.keys() l_module = list(d_binaries.keys())
# ~#~#~#~#~#~#~#~#~#~#~#~ # # ~#~#~#~#~#~#~#~#~#~#~#~ #

View File

@ -1,8 +1,8 @@
#!/usr/bin/env python2 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os, sys import os, sys
import ConfigParser import configparser
def get_l_option_section(config): def get_l_option_section(config):
@ -17,10 +17,10 @@ def get_compilation_option(pwd_cfg, flag_name):
Return the flag compilation of a compile.cfg located in pwd_cfg Return the flag compilation of a compile.cfg located in pwd_cfg
""" """
if not os.path.isfile(pwd_cfg): if not os.path.isfile(pwd_cfg):
print "Configuration file %s not found"%(pwd_cfg) print("Configuration file %s not found"%(pwd_cfg))
sys.exit(1) sys.exit(1)
config = ConfigParser.ConfigParser() config = configparser.ConfigParser(inline_comment_prefixes=(';','#'))
config.read(pwd_cfg) config.read(pwd_cfg)
if flag_name == "FC" and config.getboolean("OPTION","CACHE"): if flag_name == "FC" and config.getboolean("OPTION","CACHE"):
@ -33,7 +33,7 @@ def get_compilation_option(pwd_cfg, flag_name):
for section in ["COMMON"] + l_option_section: for section in ["COMMON"] + l_option_section:
try: try:
l.extend(config.get(section, flag_name).split()) l.extend(config.get(section, flag_name).split())
except ConfigParser.NoOptionError: except configparser.NoOptionError:
pass pass
return " ".join(l) return " ".join(l)
@ -43,5 +43,5 @@ if __name__ == '__main__':
qpackage_root = os.environ['QP_ROOT'] qpackage_root = os.environ['QP_ROOT']
pwd_cfg = os.path.join(qpackage_root, "config/ifort_gpi2.cfg") pwd_cfg = os.path.join(qpackage_root, "config/ifort_gpi2.cfg")
print get_compilation_option(pwd_cfg, "FC") print(get_compilation_option(pwd_cfg, "FC"))
print get_compilation_option(pwd_cfg, "FCFLAGS") print(get_compilation_option(pwd_cfg, "FCFLAGS"))

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
Welcome to the ei_handler. Welcome to the ei_handler.
@ -72,7 +72,7 @@ import sys
import os import os
import os.path import os.path
import ConfigParser import configparser
from collections import defaultdict from collections import defaultdict
from collections import namedtuple from collections import namedtuple
@ -220,8 +220,8 @@ def get_dict_config_file(module_obj):
# L o a d _ C o n f i g # # L o a d _ C o n f i g #
# ~#~#~#~#~#~#~#~#~#~#~ # # ~#~#~#~#~#~#~#~#~#~#~ #
config_file = ConfigParser.ConfigParser() config_file = configparser.ConfigParser()
config_file.readfp(open(module_obj.path)) config_file.read_file(open(module_obj.path))
# ~#~#~#~#~#~#~#~#~ # # ~#~#~#~#~#~#~#~#~ #
# F i l l _ d i c t # # F i l l _ d i c t #
@ -229,7 +229,7 @@ def get_dict_config_file(module_obj):
def error(o, p, c): def error(o, p, c):
"o option ; p provider_name ;c module_obj.path" "o option ; p provider_name ;c module_obj.path"
print "You need a {0} for {1} in {2}".format(o, p, c) print("You need a {0} for {1} in {2}".format(o, p, c))
for section in config_file.sections(): for section in config_file.sections():
# pvd = provider # pvd = provider
@ -245,13 +245,13 @@ def get_dict_config_file(module_obj):
# Check if type is avalaible # Check if type is avalaible
try: try:
type_ = config_file.get(section, "type").strip() type_ = config_file.get(section, "type").strip()
except ConfigParser.NoOptionError: except configparser.NoOptionError:
error("type", pvd, module_obj.path) error("type", pvd, module_obj.path)
sys.exit(1) sys.exit(1)
if type_ not in type_dict: if type_ not in type_dict:
print "{0} not avalaible. Choose in:".format(type_).strip() print("{0} not avalaible. Choose in:".format(type_).strip())
print ", ".join(sorted([i for i in type_dict])) print(", ".join(sorted([i for i in type_dict])))
sys.exit(1) sys.exit(1)
else: else:
d[pvd]["type"] = type_dict[type_] d[pvd]["type"] = type_dict[type_]
@ -259,18 +259,18 @@ def get_dict_config_file(module_obj):
# Fill the dict with REQUIRED information # Fill the dict with REQUIRED information
try: try:
d[pvd]["doc"] = config_file.get(section, "doc") d[pvd]["doc"] = config_file.get(section, "doc")
except ConfigParser.NoOptionError: except configparser.NoOptionError:
error("doc", pvd, module_obj.path) error("doc", pvd, module_obj.path)
sys.exit(1) sys.exit(1)
try: try:
interface = [i.lower().strip() for i in config_file.get(section, "interface").split(",")] interface = [i.lower().strip() for i in config_file.get(section, "interface").split(",")]
except ConfigParser.NoOptionError: except configparser.NoOptionError:
error("doc", pvd, module_obj.path) error("doc", pvd, module_obj.path)
sys.exit(1) sys.exit(1)
else: else:
if not any(i in ["ezfio", "provider", "ocaml"] for i in interface): if not any(i in ["ezfio", "provider", "ocaml"] for i in interface):
print "Bad keyword for interface for {0}".format(pvd) print("Bad keyword for interface for {0}".format(pvd))
sys.exit(1) sys.exit(1)
else: else:
d[pvd]["interface"] = interface d[pvd]["interface"] = interface
@ -279,7 +279,7 @@ def get_dict_config_file(module_obj):
for option in l_info_optional: for option in l_info_optional:
try: try:
d[pvd][option] = config_file.get(section, option).lower() d[pvd][option] = config_file.get(section, option).lower()
except ConfigParser.NoOptionError: except configparser.NoOptionError:
if option in d_default: if option in d_default:
d[pvd][option] = d_default[option] d[pvd][option] = d_default[option]
@ -287,7 +287,7 @@ def get_dict_config_file(module_obj):
try: try:
default_raw = config_file.get(section, "default") default_raw = config_file.get(section, "default")
except ConfigParser.NoOptionError: except configparser.NoOptionError:
if "ocaml" in d[pvd]["interface"]: if "ocaml" in d[pvd]["interface"]:
error("default", pvd, module_obj.path) error("default", pvd, module_obj.path)
sys.exit(1) sys.exit(1)
@ -322,7 +322,7 @@ def create_ezfio_provider(dict_ezfio_cfg):
dict_code_provider = dict() dict_code_provider = dict()
ez_p = EZFIO_Provider() ez_p = EZFIO_Provider()
for provider_name, dict_info in dict_ezfio_cfg.iteritems(): for provider_name, dict_info in dict_ezfio_cfg.items():
if "provider" in dict_info["interface"]: if "provider" in dict_info["interface"]:
ez_p.set_type(dict_info['type'].fortran) ez_p.set_type(dict_info['type'].fortran)
ez_p.set_name(provider_name) ez_p.set_name(provider_name)
@ -364,7 +364,7 @@ def save_ezfio_provider(path_head, dict_code_provider):
"! from file {0}/EZFIO.cfg".format(path_head), "! from file {0}/EZFIO.cfg".format(path_head),
"\n"] "\n"]
l_output += [code for code in dict_code_provider.values()] l_output += [code for code in list(dict_code_provider.values())]
output = "\n".join(l_output) output = "\n".join(l_output)
@ -381,22 +381,22 @@ def create_ezfio_stuff(dict_ezfio_cfg, config_or_default="config"):
def size_format_to_ezfio(size_raw): def size_format_to_ezfio(size_raw):
""" """
If size_raw == "=" is a formula -> do nothing; return If size_raw == "=" is a formula -> do nothing; return
Else convert the born of a multidimential array Else convert the range of a multidimential array
(12,begin:end) into (12,begin+end+1) for example (12,begin:end) into (12,begin+end+1) for example
If the value are between parenthses -> do nothing; return If the values are between parenthses -> do nothing; return
""" """
size_raw = str(size_raw) size_raw = str(size_raw)
if size_raw.startswith('='): if size_raw.startswith('='):
size_convert = size_raw.replace('.', '_') size_convert = size_raw.replace('.', '_')
else: else:
size_raw = provider_info["size"].translate(None, "()") size_raw = provider_info["size"].translate(str.maketrans("","","()"))
size_raw = size_raw.replace('.', '_') size_raw = size_raw.replace('.', '_')
a_size_raw = [] a_size_raw = []
for dim in size_raw.split(","): for dim in size_raw.split(","):
try: try:
(begin, end) = map(str.strip, dim.split(":")) (begin, end) = list(map(str.strip, dim.split(":")))
except ValueError: except ValueError:
a_size_raw.append(dim) a_size_raw.append(dim)
else: else:
@ -423,7 +423,7 @@ def create_ezfio_stuff(dict_ezfio_cfg, config_or_default="config"):
lenmax_name = max([len(i) for i in dict_ezfio_cfg]) lenmax_name = max([len(i) for i in dict_ezfio_cfg])
lenmax_type = max([len(i["type"].fortran) lenmax_type = max([len(i["type"].fortran)
for i in dict_ezfio_cfg.values()]) for i in list(dict_ezfio_cfg.values())])
str_name_format = create_format_string(lenmax_name + 2) str_name_format = create_format_string(lenmax_name + 2)
str_type_format = create_format_string(lenmax_type + 2) str_type_format = create_format_string(lenmax_type + 2)
@ -433,15 +433,15 @@ def create_ezfio_stuff(dict_ezfio_cfg, config_or_default="config"):
# ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~# # # ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~# #
# Checking is many ezfio_dir provided # Checking is many ezfio_dir provided
l_ezfio_dir = [d['ezfio_dir'] for d in dict_ezfio_cfg.values()] l_ezfio_dir = [d['ezfio_dir'] for d in list(dict_ezfio_cfg.values())]
if not l_ezfio_dir.count(l_ezfio_dir[0]) == len(l_ezfio_dir): if not l_ezfio_dir.count(l_ezfio_dir[0]) == len(l_ezfio_dir):
print >> sys.stderr, "You have many ezfio_dir. Not supported yet" print("You have many ezfio_dir. Not supported yet", file=sys.stderr)
raise TypeError raise TypeError
else: else:
result = [l_ezfio_dir[0]] result = [l_ezfio_dir[0]]
for provider_name, provider_info in sorted(dict_ezfio_cfg.iteritems()): for provider_name, provider_info in sorted(dict_ezfio_cfg.items()):
# Get the value from dict # Get the value from dict
name_raw = provider_info["ezfio_name"].lower() name_raw = provider_info["ezfio_name"].lower()
@ -532,7 +532,7 @@ def create_ocaml_input(dict_ezfio_cfg, module_lower):
l_type = [] l_type = []
l_doc = [] l_doc = []
for k, v in dict_ezfio_cfg.iteritems(): for k, v in dict_ezfio_cfg.items():
if "ocaml" in v['interface']: if "ocaml" in v['interface']:
l_ezfio_name.append(v['ezfio_name']) l_ezfio_name.append(v['ezfio_name'])
l_type.append(v["type"]) l_type.append(v["type"])
@ -580,7 +580,7 @@ def create_ocaml_input(dict_ezfio_cfg, module_lower):
'(* =~=~=~==~=~~=~=~=~=~=~=~=~ *)', '(* =~=~=~==~=~~=~=~=~=~=~=~=~ *)',
""] ""]
for provider_name, d_val in sorted(dict_ezfio_cfg.iteritems()): for provider_name, d_val in sorted(dict_ezfio_cfg.items()):
if 'default' not in d_val: if 'default' not in d_val:
continue continue
@ -655,7 +655,7 @@ def get_l_module_with_auto_generate_ocaml_lower():
l_module_lower = [] l_module_lower = []
import re import re
p = re.compile(ur'interface:.*ocaml') p = re.compile(r'interface:.*ocaml')
for f in l_folder: for f in l_folder:
path = "{0}/{1}/EZFIO.cfg".format(QP_SRC, f) path = "{0}/{1}/EZFIO.cfg".format(QP_SRC, f)
@ -782,7 +782,7 @@ if __name__ == "__main__":
# #
if arguments["list_supported_types"]: if arguments["list_supported_types"]:
for i in sorted(get_type_dict()): for i in sorted(get_type_dict()):
print i print(i)
sys.exit(0) sys.exit(0)
if arguments["ocaml_global"]: if arguments["ocaml_global"]:

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2 #!/usr/bin/env python3
""" """
This program generates all the This program generates all the
OCaml templates needed by qp_edit OCaml templates needed by qp_edit
@ -17,12 +17,12 @@ class EZFIO_ocaml(object):
def __init__(self, **kwargs): def __init__(self, **kwargs):
for k, v in kwargs.iteritems(): for k, v in kwargs.items():
try: try:
exec "self.{0} = {1}".format(k, v) exec("self.{0} = {1}".format(k, v))
except NameError: except NameError:
exec "self.{0} = '{1}'".format(k, v) exec("self.{0} = '{1}'".format(k, v))
@property @property
def Ocaml_type(self): def Ocaml_type(self):
@ -39,7 +39,7 @@ class EZFIO_ocaml(object):
def check_if_init(self, l_arg, name): def check_if_init(self, l_arg, name):
for i in l_arg: for i in l_arg:
try: try:
exec "self.{0}".format(i) exec("self.{0}".format(i))
except AttributeError: except AttributeError:
msg = "You need to provide a '{0}' for creating {1}" msg = "You need to provide a '{0}' for creating {1}"
raise KeyError(msg.format(i, name)) raise KeyError(msg.format(i, name))

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2 #!/usr/bin/env python3
__author__ = "Applencourt PEP8" __author__ = "Applencourt PEP8"
__date__ = "jeudi 26 mars 2015, 12:49:35 (UTC+0100)" __date__ = "jeudi 26 mars 2015, 12:49:35 (UTC+0100)"
@ -88,7 +88,7 @@ END_PROVIDER
def __init__(self): def __init__(self):
self.values = "type doc name ezfio_dir ezfio_name write output".split() self.values = "type doc name ezfio_dir ezfio_name write output".split()
for v in self.values: for v in self.values:
exec "self.{0} = None".format(v) exec("self.{0} = None".format(v))
def __repr__(self): def __repr__(self):
self.set_write() self.set_write()
@ -96,7 +96,7 @@ END_PROVIDER
for v in self.values: for v in self.values:
if not v: if not v:
msg = "Error : %s is not set in EZFIO.cfg" % (v) msg = "Error : %s is not set in EZFIO.cfg" % (v)
print >>sys.stderr, msg print(msg, file=sys.stderr)
sys.exit(1) sys.exit(1)
if "size" not in self.__dict__: if "size" not in self.__dict__:
self.__dict__["size"] = "" self.__dict__["size"] = ""
@ -167,7 +167,7 @@ def test_module():
T.set_ezfio_dir("Hartree_Fock") T.set_ezfio_dir("Hartree_Fock")
T.set_ezfio_name("thresh_SCF") T.set_ezfio_name("thresh_SCF")
T.set_output("output_Hartree_Fock") T.set_output("output_Hartree_Fock")
print T print(T)
if __name__ == '__main__': if __name__ == '__main__':
test_module() test_module()

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2 #!/usr/bin/env python3
import os import os
@ -105,7 +105,6 @@ class H_apply(object):
s["do_mono_excitations"] = d[do_mono_exc] s["do_mono_excitations"] = d[do_mono_exc]
s["do_double_excitations"] = d[do_double_exc] s["do_double_excitations"] = d[do_double_exc]
s["keys_work"] += "call fill_H_apply_buffer_no_selection(key_idx,keys_out,N_int,iproc)" s["keys_work"] += "call fill_H_apply_buffer_no_selection(key_idx,keys_out,N_int,iproc)"
s["filter_integrals"] = "array_pairs = .True." s["filter_integrals"] = "array_pairs = .True."
if SingleRef: if SingleRef:
s["filter_integrals"] = """ s["filter_integrals"] = """
@ -156,7 +155,7 @@ class H_apply(object):
def __repr__(self): def __repr__(self):
buffer = self.template buffer = self.template
for key,value in self.data.items(): for key,value in list(self.data.items()):
buffer = buffer.replace('$'+key, value) buffer = buffer.replace('$'+key, value)
return buffer return buffer

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2 #!/usr/bin/env python3
import random import random
@ -131,8 +131,8 @@ _ __ `/___ __ \__ ___/__ __ \
""" ] """ ]
print random.choice(hello) print(random.choice(hello))
print "\n -- Quantum Package Shell --\n" print("\n -- Quantum Package Shell --\n")

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
Module utilitary Module utilitary
@ -25,7 +25,7 @@ try:
from docopt import docopt from docopt import docopt
from qp_path import QP_SRC, QP_ROOT, QP_PLUGINS, QP_EZFIO from qp_path import QP_SRC, QP_ROOT, QP_PLUGINS, QP_EZFIO
except ImportError: except ImportError:
print "source .quantum_package.rc" print("source .quantum_package.rc")
raise raise
@ -50,6 +50,7 @@ def get_binaries(path_module):
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE) stderr=subprocess.PIPE)
stdout, stderr = process.communicate() stdout, stderr = process.communicate()
stdout = stdout.decode()
except OSError: except OSError:
return [] return []
else: else:
@ -106,9 +107,9 @@ def get_l_module_descendant(d_child, l_module):
try: try:
l.extend(get_l_module_descendant(d_child, d_child[module])) l.extend(get_l_module_descendant(d_child, d_child[module]))
except KeyError: except KeyError:
print >> sys.stderr, "Error: " print("Error: ", file=sys.stderr)
print >> sys.stderr, "`{0}` is not a submodule".format(module) print("`{0}` is not a submodule".format(module), file=sys.stderr)
print >> sys.stderr, "Check the typo (spelling, case, '/', etc.) " print("Check the typo (spelling, case, '/', etc.) ", file=sys.stderr)
sys.exit(1) sys.exit(1)
return list(set(l)) return list(set(l))
@ -120,7 +121,7 @@ class ModuleHandler():
@property @property
def l_module(self): def l_module(self):
return self.dict_child.keys() return list(self.dict_child.keys())
@property @property
def dict_parent(self): def dict_parent(self):
@ -132,7 +133,7 @@ class ModuleHandler():
d = {} d = {}
for module_name in d_child: for module_name in d_child:
d[module_name] = [i for i in d_child.keys() d[module_name] = [i for i in list(d_child.keys())
if module_name in d_child[i]] if module_name in d_child[i]]
return d return d
@ -151,8 +152,8 @@ class ModuleHandler():
d[module_name] = get_l_module_descendant(d_child, d[module_name] = get_l_module_descendant(d_child,
d_child[module_name]) d_child[module_name])
except KeyError: except KeyError:
print "Check NEED for {0}".format( print("Check NEED for {0}".format(
module_name) module_name))
sys.exit(1) sys.exit(1)
return d return d
@ -185,7 +186,7 @@ class ModuleHandler():
for e in d_desc[module]: for e in d_desc[module]:
d[e] = 1 d[e] = 1
return d.keys() return list(d.keys())
def l_reduce_tree(self, l_module): def l_reduce_tree(self, l_module):
"""For a list of module in input return only the root""" """For a list of module in input return only the root"""
@ -218,8 +219,8 @@ if __name__ == '__main__':
for module in l_module: for module in l_module:
if not is_module(module): if not is_module(module):
print "{0} is not a valid module. Abort".format(module) print("{0} is not a valid module. Abort".format(module))
print "No NEED in it" print("No NEED in it")
sys.exit(1) sys.exit(1)
m = ModuleHandler() m = ModuleHandler()
@ -227,7 +228,7 @@ if __name__ == '__main__':
if arguments['print_descendant']: if arguments['print_descendant']:
for module in l_module: for module in l_module:
print " ".join(sorted(m.l_descendant_unique([module]))) print(" ".join(sorted(m.l_descendant_unique([module]))))
if arguments["clean"]: if arguments["clean"]:

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2 #!/usr/bin/env python3
import os import os
from qp_path import QP_SRC from qp_path import QP_SRC
@ -7,7 +7,7 @@ Pert_dir = os.path.join(QP_SRC,"perturbation")
perturbations = [] perturbations = []
for filename in filter(lambda x: x.endswith(".irp.f"), os.listdir(Pert_dir)): for filename in [x for x in os.listdir(Pert_dir) if x.endswith(".irp.f")]:
filename = os.path.join(Pert_dir,filename) filename = os.path.join(Pert_dir,filename)
file = open(filename,'r') file = open(filename,'r')
@ -22,6 +22,6 @@ for filename in filter(lambda x: x.endswith(".irp.f"), os.listdir(Pert_dir)):
if __name__ == '__main__': if __name__ == '__main__':
print 'Perturbations:' print('Perturbations:')
for k in perturbations: for k in perturbations:
print '* ', k print('* ', k)

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python2 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import urllib import urllib.request, urllib.parse, urllib.error
import sys import sys
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
@ -35,11 +35,11 @@ def clean_up(text):
return False return False
else: else:
return y[0] in irred return y[0] in irred
data = filter(f,data)[:len(irred)] data = list(filter(f,data))[:len(irred)]
for line in data: for line in data:
s = line.replace('*','').split() s = line.replace('*','').split()
l = irred[s[0]] l = irred[s[0]]
data[l] = map(float,s[1:len(irred)+1]) data[l] = list(map(float,s[1:len(irred)+1]))
d = {} d = {}
e = {} e = {}
@ -48,23 +48,23 @@ def clean_up(text):
for k in sop: for k in sop:
e[sop[k]] = k e[sop[k]] = k
n = len(irred) n = len(irred)
print "Group\t", group, "\nn\t", n print("Group\t", group, "\nn\t", n)
print "\n \tIrred \tOperation" print("\n \tIrred \tOperation")
for i in range(n): for i in range(n):
print "%4d \t %s \t %s"%(i+1, d[i].ljust(10), e[i].ljust(10)) print("%4d \t %s \t %s"%(i+1, d[i].ljust(10), e[i].ljust(10)))
print "\nTable\n ", print("\nTable\n ", end=' ')
for j in range(n): for j in range(n):
print "%8s "%(str(j+1).center(8)), print("%8s "%(str(j+1).center(8)), end=' ')
for i in range(n): for i in range(n):
print "\n%4d "%(i+1), print("\n%4d "%(i+1), end=' ')
for j in range(n): for j in range(n):
print "%8.5f "%(data[i][j]), print("%8.5f "%(data[i][j]), end=' ')
print "\n" print("\n")
def main(): def main():
for group in sys.argv[1:]: for group in sys.argv[1:]:
f = urllib.urlopen(address%(group)) f = urllib.request.urlopen(address%(group))
html = f.read().split('\n',1)[1] html = f.read().split('\n',1)[1]
text = clean_up(html) text = clean_up(html)

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python2 #!/usr/bin/env python3
BIT_KIND_SIZE=64 BIT_KIND_SIZE=64

View File

@ -1,13 +1,14 @@
#!/usr/bin/env python2 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os import os
import sys import sys
try: try:
QP_ROOT = os.environ['QP_ROOT'] QP_ROOT = os.environ['QP_ROOT']
except: except:
print "source quantum_package.rc" print("source quantum_package.rc")
sys.exit(1) sys.exit(1)
else: else:
QP_EZFIO = os.environ["QP_EZFIO"] QP_EZFIO = os.environ["QP_EZFIO"]

View File

@ -108,6 +108,7 @@ subroutine run_cipsi
n_det_before = N_det n_det_before = N_det
to_select = int(sqrt(dble(N_states))*dble(N_det)*selection_factor) to_select = int(sqrt(dble(N_states))*dble(N_det)*selection_factor)
to_select = max(N_states_diag, to_select) to_select = max(N_states_diag, to_select)
to_select = max(to_select,1)
call ZMQ_selection(to_select, pt2, variance, norm) call ZMQ_selection(to_select, pt2, variance, norm)
PROVIDE psi_coef PROVIDE psi_coef

View File

@ -22,8 +22,6 @@ BEGIN_PROVIDER [ double precision, pt2_E0_denominator, (N_states) ]
enddo enddo
else if (h0_type == "Barycentric") then else if (h0_type == "Barycentric") then
pt2_E0_denominator(1:N_states) = barycentric_electronic_energy(1:N_states) pt2_E0_denominator(1:N_states) = barycentric_electronic_energy(1:N_states)
else if (h0_type == "Variance") then
pt2_E0_denominator(1:N_states) = psi_energy(1:N_states) !1.d0-nuclear_repulsion
else if (h0_type == "SOP") then else if (h0_type == "SOP") then
pt2_E0_denominator(1:N_states) = psi_energy(1:N_states) pt2_E0_denominator(1:N_states) = psi_energy(1:N_states)
else else

View File

@ -13,7 +13,7 @@ END_PROVIDER
BEGIN_PROVIDER [ double precision, variance_match_weight, (N_states) ] BEGIN_PROVIDER [ double precision, variance_match_weight, (N_states) ]
implicit none implicit none
BEGIN_DOC BEGIN_DOC
! Weights adjusted along the selection to make the variances ! Weights adjusted along the selection to make the variances
! of each state coincide. ! of each state coincide.
END_DOC END_DOC
variance_match_weight(:) = 1.d0 variance_match_weight(:) = 1.d0
@ -46,10 +46,10 @@ subroutine update_pt2_and_variance_weights(pt2, variance, norm, N_st)
i_iter = 1 i_iter = 1
endif endif
dt = 4.d0 dt = 4.d0
do k=1,N_st do k=1,N_st
rpt2(k) = pt2(k)/(1.d0 + norm(k)) rpt2(k) = pt2(k)/(1.d0 + norm(k))
enddo enddo
avg = sum(rpt2(1:N_st)) / dble(N_st) avg = sum(rpt2(1:N_st)) / dble(N_st)
@ -90,7 +90,7 @@ BEGIN_PROVIDER [ double precision, selection_weight, (N_states) ]
case (1) case (1)
print *, 'Using 1/c_max^2 weight in selection' print *, 'Using 1/c_max^2 weight in selection'
selection_weight(1:N_states) = c0_weight(1:N_states) selection_weight(1:N_states) = c0_weight(1:N_states)
case (2) case (2)
print *, 'Using pt2-matching weight in selection' print *, 'Using pt2-matching weight in selection'
@ -114,7 +114,7 @@ BEGIN_PROVIDER [ double precision, selection_weight, (N_states) ]
print *, '# var weight ', real(variance_match_weight(:),4) print *, '# var weight ', real(variance_match_weight(:),4)
case (6) case (6)
print *, 'Using CI coefficient-based selection' print *, 'Using CI coefficient-based selection'
selection_weight(1:N_states) = c0_weight(1:N_states) selection_weight(1:N_states) = c0_weight(1:N_states)
case (7) case (7)
@ -289,34 +289,34 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d
monoAdo = .true. monoAdo = .true.
monoBdo = .true. monoBdo = .true.
do k=1,N_int do k=1,N_int
hole (k,1) = iand(psi_det_generators(k,1,i_generator), hole_mask(k,1)) hole (k,1) = iand(psi_det_generators(k,1,i_generator), hole_mask(k,1))
hole (k,2) = iand(psi_det_generators(k,2,i_generator), hole_mask(k,2)) hole (k,2) = iand(psi_det_generators(k,2,i_generator), hole_mask(k,2))
particle(k,1) = iand(not(psi_det_generators(k,1,i_generator)), particle_mask(k,1)) particle(k,1) = iand(not(psi_det_generators(k,1,i_generator)), particle_mask(k,1))
particle(k,2) = iand(not(psi_det_generators(k,2,i_generator)), particle_mask(k,2)) particle(k,2) = iand(not(psi_det_generators(k,2,i_generator)), particle_mask(k,2))
enddo enddo
integer :: N_holes(2), N_particles(2) integer :: N_holes(2), N_particles(2)
integer :: hole_list(N_int*bit_kind_size,2) integer :: hole_list(N_int*bit_kind_size,2)
integer :: particle_list(N_int*bit_kind_size,2) integer :: particle_list(N_int*bit_kind_size,2)
call bitstring_to_list_ab(hole , hole_list , N_holes , N_int) call bitstring_to_list_ab(hole , hole_list , N_holes , N_int)
call bitstring_to_list_ab(particle, particle_list, N_particles, N_int) call bitstring_to_list_ab(particle, particle_list, N_particles, N_int)
integer :: l_a, nmax, idx integer :: l_a, nmax, idx
integer, allocatable :: indices(:), exc_degree(:), iorder(:) integer, allocatable :: indices(:), exc_degree(:), iorder(:)
allocate (indices(N_det), & allocate (indices(N_det), &
exc_degree(max(N_det_alpha_unique,N_det_beta_unique))) exc_degree(max(N_det_alpha_unique,N_det_beta_unique)))
k=1 k=1
do i=1,N_det_alpha_unique do i=1,N_det_alpha_unique
call get_excitation_degree_spin(psi_det_alpha_unique(1,i), & call get_excitation_degree_spin(psi_det_alpha_unique(1,i), &
psi_det_generators(1,1,i_generator), exc_degree(i), N_int) psi_det_generators(1,1,i_generator), exc_degree(i), N_int)
enddo enddo
do j=1,N_det_beta_unique do j=1,N_det_beta_unique
call get_excitation_degree_spin(psi_det_beta_unique(1,j), & call get_excitation_degree_spin(psi_det_beta_unique(1,j), &
psi_det_generators(1,2,i_generator), nt, N_int) psi_det_generators(1,2,i_generator), nt, N_int)
@ -332,12 +332,12 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d
endif endif
enddo enddo
enddo enddo
do i=1,N_det_beta_unique do i=1,N_det_beta_unique
call get_excitation_degree_spin(psi_det_beta_unique(1,i), & call get_excitation_degree_spin(psi_det_beta_unique(1,i), &
psi_det_generators(1,2,i_generator), exc_degree(i), N_int) psi_det_generators(1,2,i_generator), exc_degree(i), N_int)
enddo enddo
do j=1,N_det_alpha_unique do j=1,N_det_alpha_unique
call get_excitation_degree_spin(psi_det_alpha_unique(1,j), & call get_excitation_degree_spin(psi_det_alpha_unique(1,j), &
psi_det_generators(1,1,i_generator), nt, N_int) psi_det_generators(1,1,i_generator), nt, N_int)
@ -356,7 +356,7 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d
endif endif
enddo enddo
enddo enddo
deallocate(exc_degree) deallocate(exc_degree)
nmax=k-1 nmax=k-1
@ -366,18 +366,18 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d
enddo enddo
call isort(indices,iorder,nmax) call isort(indices,iorder,nmax)
deallocate(iorder) deallocate(iorder)
! Start with 32 elements. Size will double along with the filtering. ! Start with 32 elements. Size will double along with the filtering.
allocate(preinteresting(0:32), prefullinteresting(0:32), & allocate(preinteresting(0:32), prefullinteresting(0:32), &
interesting(0:32), fullinteresting(0:32)) interesting(0:32), fullinteresting(0:32))
preinteresting(:) = 0 preinteresting(:) = 0
prefullinteresting(:) = 0 prefullinteresting(:) = 0
do i=1,N_int do i=1,N_int
negMask(i,1) = not(psi_det_generators(i,1,i_generator)) negMask(i,1) = not(psi_det_generators(i,1,i_generator))
negMask(i,2) = not(psi_det_generators(i,2,i_generator)) negMask(i,2) = not(psi_det_generators(i,2,i_generator))
end do end do
do k=1,nmax do k=1,nmax
i = indices(k) i = indices(k)
mobMask(1,1) = iand(negMask(1,1), psi_det_sorted(1,1,i)) mobMask(1,1) = iand(negMask(1,1), psi_det_sorted(1,1,i))
@ -388,10 +388,10 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d
mobMask(j,2) = iand(negMask(j,2), psi_det_sorted(j,2,i)) mobMask(j,2) = iand(negMask(j,2), psi_det_sorted(j,2,i))
nt = nt + popcnt(mobMask(j, 1)) + popcnt(mobMask(j, 2)) nt = nt + popcnt(mobMask(j, 1)) + popcnt(mobMask(j, 2))
end do end do
if(nt <= 4) then if(nt <= 4) then
if(i <= N_det_selectors) then if(i <= N_det_selectors) then
sze = preinteresting(0) sze = preinteresting(0)
if (sze+1 == size(preinteresting)) then if (sze+1 == size(preinteresting)) then
allocate (tmp_array(0:sze)) allocate (tmp_array(0:sze))
tmp_array(0:sze) = preinteresting(0:sze) tmp_array(0:sze) = preinteresting(0:sze)
@ -403,7 +403,7 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d
preinteresting(0) = sze+1 preinteresting(0) = sze+1
preinteresting(sze+1) = i preinteresting(sze+1) = i
else if(nt <= 2) then else if(nt <= 2) then
sze = prefullinteresting(0) sze = prefullinteresting(0)
if (sze+1 == size(prefullinteresting)) then if (sze+1 == size(prefullinteresting)) then
allocate (tmp_array(0:sze)) allocate (tmp_array(0:sze))
tmp_array(0:sze) = prefullinteresting(0:sze) tmp_array(0:sze) = prefullinteresting(0:sze)
@ -422,17 +422,17 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d
! !$OMP CRITICAL ! !$OMP CRITICAL
! print *, 'Step1: ', i_generator, preinteresting(0) ! print *, 'Step1: ', i_generator, preinteresting(0)
! !$OMP END CRITICAL ! !$OMP END CRITICAL
allocate(banned(mo_num, mo_num,2), bannedOrb(mo_num, 2)) allocate(banned(mo_num, mo_num,2), bannedOrb(mo_num, 2))
allocate (mat(N_states, mo_num, mo_num)) allocate (mat(N_states, mo_num, mo_num))
maskInd = -1 maskInd = -1
integer :: nb_count, maskInd_save integer :: nb_count, maskInd_save
logical :: monoBdo_save logical :: monoBdo_save
logical :: found logical :: found
do s1=1,2 do s1=1,2
do i1=N_holes(s1),1,-1 ! Generate low excitations first do i1=N_holes(s1),1,-1 ! Generate low excitations first
found = .False. found = .False.
monoBdo_save = monoBdo monoBdo_save = monoBdo
maskInd_save = maskInd maskInd_save = maskInd
@ -447,21 +447,21 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d
enddo enddo
if(s1 /= s2) monoBdo = .false. if(s1 /= s2) monoBdo = .false.
enddo enddo
if (.not.found) cycle if (.not.found) cycle
monoBdo = monoBdo_save monoBdo = monoBdo_save
maskInd = maskInd_save maskInd = maskInd_save
h1 = hole_list(i1,s1) h1 = hole_list(i1,s1)
call apply_hole(psi_det_generators(1,1,i_generator), s1,h1, pmask, ok, N_int) call apply_hole(psi_det_generators(1,1,i_generator), s1,h1, pmask, ok, N_int)
negMask = not(pmask) negMask = not(pmask)
interesting(0) = 0 interesting(0) = 0
fullinteresting(0) = 0 fullinteresting(0) = 0
do ii=1,preinteresting(0) do ii=1,preinteresting(0)
i = preinteresting(ii) i = preinteresting(ii)
select case (N_int) select case (N_int)
case (1) case (1)
mobMask(1,1) = iand(negMask(1,1), psi_det_sorted(1,1,i)) mobMask(1,1) = iand(negMask(1,1), psi_det_sorted(1,1,i))
@ -515,9 +515,9 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d
endif endif
end do end do
end select end select
if(nt <= 4) then if(nt <= 4) then
sze = interesting(0) sze = interesting(0)
if (sze+1 == size(interesting)) then if (sze+1 == size(interesting)) then
allocate (tmp_array(0:sze)) allocate (tmp_array(0:sze))
tmp_array(0:sze) = interesting(0:sze) tmp_array(0:sze) = interesting(0:sze)
@ -529,7 +529,7 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d
interesting(0) = sze+1 interesting(0) = sze+1
interesting(sze+1) = i interesting(sze+1) = i
if(nt <= 2) then if(nt <= 2) then
sze = fullinteresting(0) sze = fullinteresting(0)
if (sze+1 == size(fullinteresting)) then if (sze+1 == size(fullinteresting)) then
allocate (tmp_array(0:sze)) allocate (tmp_array(0:sze))
tmp_array(0:sze) = fullinteresting(0:sze) tmp_array(0:sze) = fullinteresting(0:sze)
@ -542,9 +542,9 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d
fullinteresting(sze+1) = i fullinteresting(sze+1) = i
end if end if
end if end if
end do end do
do ii=1,prefullinteresting(0) do ii=1,prefullinteresting(0)
i = prefullinteresting(ii) i = prefullinteresting(ii)
nt = 0 nt = 0
@ -560,7 +560,7 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d
end do end do
if(nt <= 2) then if(nt <= 2) then
sze = fullinteresting(0) sze = fullinteresting(0)
if (sze+1 == size(fullinteresting)) then if (sze+1 == size(fullinteresting)) then
allocate (tmp_array(0:sze)) allocate (tmp_array(0:sze))
tmp_array(0:sze) = fullinteresting(0:sze) tmp_array(0:sze) = fullinteresting(0:sze)
@ -577,7 +577,7 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d
allocate (fullminilist (N_int, 2, fullinteresting(0)), & allocate (fullminilist (N_int, 2, fullinteresting(0)), &
minilist (N_int, 2, interesting(0)) ) minilist (N_int, 2, interesting(0)) )
if(pert_2rdm)then if(pert_2rdm)then
allocate(coef_fullminilist_rev(N_states,fullinteresting(0))) allocate(coef_fullminilist_rev(N_states,fullinteresting(0)))
do i=1,fullinteresting(0) do i=1,fullinteresting(0)
do j = 1, N_states do j = 1, N_states
coef_fullminilist_rev(j,i) = psi_coef_sorted(fullinteresting(i),j) coef_fullminilist_rev(j,i) = psi_coef_sorted(fullinteresting(i),j)
@ -588,7 +588,7 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d
do i=1,fullinteresting(0) do i=1,fullinteresting(0)
fullminilist(1:N_int,1:2,i) = psi_det_sorted(1:N_int,1:2,fullinteresting(i)) fullminilist(1:N_int,1:2,i) = psi_det_sorted(1:N_int,1:2,fullinteresting(i))
enddo enddo
do i=1,interesting(0) do i=1,interesting(0)
minilist(1:N_int,1:2,i) = psi_det_sorted(1:N_int,1:2,interesting(i)) minilist(1:N_int,1:2,i) = psi_det_sorted(1:N_int,1:2,interesting(i))
enddo enddo
@ -624,21 +624,21 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d
monoAdo = .false. monoAdo = .false.
end if end if
end if end if
maskInd = maskInd + 1 maskInd = maskInd + 1
if(mod(maskInd, csubset) == (subset-1)) then if(mod(maskInd, csubset) == (subset-1)) then
call spot_isinwf(mask, fullminilist, i_generator, fullinteresting(0), banned, fullMatch, fullinteresting) call spot_isinwf(mask, fullminilist, i_generator, fullinteresting(0), banned, fullMatch, fullinteresting)
if(fullMatch) cycle if(fullMatch) cycle
! !$OMP CRITICAL ! !$OMP CRITICAL
! print *, 'Step3: ', i_generator, h1, interesting(0) ! print *, 'Step3: ', i_generator, h1, interesting(0)
! !$OMP END CRITICAL ! !$OMP END CRITICAL
call splash_pq(mask, sp, minilist, i_generator, interesting(0), bannedOrb, banned, mat, interesting) call splash_pq(mask, sp, minilist, i_generator, interesting(0), bannedOrb, banned, mat, interesting)
if(.not.pert_2rdm)then if(.not.pert_2rdm)then
call fill_buffer_double(i_generator, sp, h1, h2, bannedOrb, banned, fock_diag_tmp, E0, pt2, variance, norm, mat, buf) call fill_buffer_double(i_generator, sp, h1, h2, bannedOrb, banned, fock_diag_tmp, E0, pt2, variance, norm, mat, buf)
else else
call fill_buffer_double_rdm(i_generator, sp, h1, h2, bannedOrb, banned, fock_diag_tmp, E0, pt2, variance, norm, mat, buf,fullminilist, coef_fullminilist_rev, fullinteresting(0)) call fill_buffer_double_rdm(i_generator, sp, h1, h2, bannedOrb, banned, fock_diag_tmp, E0, pt2, variance, norm, mat, buf,fullminilist, coef_fullminilist_rev, fullinteresting(0))
endif endif
end if end if
@ -682,7 +682,7 @@ subroutine fill_buffer_double(i_generator, sp, h1, h2, bannedOrb, banned, fock_d
double precision, allocatable :: values(:) double precision, allocatable :: values(:)
integer, allocatable :: keys(:,:) integer, allocatable :: keys(:,:)
integer :: nkeys integer :: nkeys
if(sp == 3) then if(sp == 3) then
s1 = 1 s1 = 1
@ -712,7 +712,7 @@ subroutine fill_buffer_double(i_generator, sp, h1, h2, bannedOrb, banned, fock_d
! to a determinant of the future. In that case, the determinant will be ! to a determinant of the future. In that case, the determinant will be
! detected as already generated when generating in the future with a ! detected as already generated when generating in the future with a
! double excitation. ! double excitation.
! !
! if (.not.do_singles) then ! if (.not.do_singles) then
! if ((h1 == p1) .or. (h2 == p2)) then ! if ((h1 == p1) .or. (h2 == p2)) then
! cycle ! cycle
@ -783,6 +783,8 @@ subroutine fill_buffer_double(i_generator, sp, h1, h2, bannedOrb, banned, fock_d
norm(istate) = norm(istate) + coef * coef norm(istate) = norm(istate) + coef * coef
!!!DEBUG !!!DEBUG
! pt2(istate) = pt2(istate) - e_pert + alpha_h_psi**2/delta_E
!
! integer :: k ! integer :: k
! double precision :: alpha_h_psi_2,hij ! double precision :: alpha_h_psi_2,hij
! alpha_h_psi_2 = 0.d0 ! alpha_h_psi_2 = 0.d0
@ -792,7 +794,7 @@ subroutine fill_buffer_double(i_generator, sp, h1, h2, bannedOrb, banned, fock_d
! enddo ! enddo
! if(dabs(alpha_h_psi_2 - alpha_h_psi).gt.1.d-12)then ! if(dabs(alpha_h_psi_2 - alpha_h_psi).gt.1.d-12)then
! call debug_det(psi_det_generators(1,1,i_generator),N_int) ! call debug_det(psi_det_generators(1,1,i_generator),N_int)
! call debug_det(det,N_int) ! call debug_det(det,N_int)
! print*,'alpha_h_psi,alpha_h_psi_2 = ',alpha_h_psi,alpha_h_psi_2 ! print*,'alpha_h_psi,alpha_h_psi_2 = ',alpha_h_psi,alpha_h_psi_2
! stop ! stop
! endif ! endif
@ -816,7 +818,7 @@ subroutine fill_buffer_double(i_generator, sp, h1, h2, bannedOrb, banned, fock_d
if(pseudo_sym)then if(pseudo_sym)then
if(dabs(mat(1, p1, p2)).lt.thresh_sym)then if(dabs(mat(1, p1, p2)).lt.thresh_sym)then
w = 0.d0 w = 0.d0
endif endif
endif endif
@ -857,7 +859,7 @@ subroutine splash_pq(mask, sp, det, i_gen, N_sel, bannedOrb, banned, mat, intere
negMask(i,2) = not(mask(i,2)) negMask(i,2) = not(mask(i,2))
end do end do
do i=1, N_sel do i=1, N_sel
if (interesting(i) < 0) then if (interesting(i) < 0) then
stop 'prefetch interesting(i) and det(i)' stop 'prefetch interesting(i) and det(i)'
endif endif
@ -1210,7 +1212,7 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs)
endif endif
end if end if
! enddo ! enddo
! !
putj = p2 putj = p2
! do puti=1,mo_num !HOT ! do puti=1,mo_num !HOT
if(.not. banned(putj,puti,bant)) then if(.not. banned(putj,puti,bant)) then
@ -1573,15 +1575,15 @@ subroutine get_d0_reference(gen, phasemask, bannedOrb, banned, mat, mask, h, p,
double precision, intent(in) :: coefs(N_states) double precision, intent(in) :: coefs(N_states)
double precision, intent(inout) :: mat(N_states, mo_num, mo_num) double precision, intent(inout) :: mat(N_states, mo_num, mo_num)
integer, intent(in) :: h(0:2,2), p(0:4,2), sp integer, intent(in) :: h(0:2,2), p(0:4,2), sp
integer :: i, j, s, h1, h2, p1, p2, puti, putj integer :: i, j, s, h1, h2, p1, p2, puti, putj
double precision :: hij, phase double precision :: hij, phase
double precision, external :: get_phase_bi, mo_two_e_integral double precision, external :: get_phase_bi, mo_two_e_integral
logical :: ok logical :: ok
integer :: bant integer :: bant
bant = 1 bant = 1
if(sp == 3) then ! AB if(sp == 3) then ! AB
h1 = p(1,1) h1 = p(1,1)
@ -1619,7 +1621,7 @@ subroutine get_d0_reference(gen, phasemask, bannedOrb, banned, mat, mask, h, p,
end do end do
end do end do
end if end if
end end
subroutine get_d1_reference(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) subroutine get_d1_reference(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs)
use bitmasks use bitmasks
@ -1639,27 +1641,27 @@ subroutine get_d1_reference(gen, phasemask, bannedOrb, banned, mat, mask, h, p,
logical, allocatable :: lbanned(:,:) logical, allocatable :: lbanned(:,:)
integer :: puti, putj, ma, mi, s1, s2, i, i1, i2, j integer :: puti, putj, ma, mi, s1, s2, i, i1, i2, j
integer :: hfix, pfix, h1, h2, p1, p2, ib integer :: hfix, pfix, h1, h2, p1, p2, ib
integer, parameter :: turn2(2) = (/2,1/) integer, parameter :: turn2(2) = (/2,1/)
integer, parameter :: turn3(2,3) = reshape((/2,3, 1,3, 1,2/), (/2,3/)) integer, parameter :: turn3(2,3) = reshape((/2,3, 1,3, 1,2/), (/2,3/))
integer :: bant integer :: bant
allocate (lbanned(mo_num, 2)) allocate (lbanned(mo_num, 2))
lbanned = bannedOrb lbanned = bannedOrb
do i=1, p(0,1) do i=1, p(0,1)
lbanned(p(i,1), 1) = .true. lbanned(p(i,1), 1) = .true.
end do end do
do i=1, p(0,2) do i=1, p(0,2)
lbanned(p(i,2), 2) = .true. lbanned(p(i,2), 2) = .true.
end do end do
ma = 1 ma = 1
if(p(0,2) >= 2) ma = 2 if(p(0,2) >= 2) ma = 2
mi = turn2(ma) mi = turn2(ma)
bant = 1 bant = 1
if(sp == 3) then if(sp == 3) then
@ -1682,7 +1684,7 @@ subroutine get_d1_reference(gen, phasemask, bannedOrb, banned, mat, mask, h, p,
tmp_row(1:N_states,putj) += hij * coefs(1:N_states) tmp_row(1:N_states,putj) += hij * coefs(1:N_states)
end do end do
if(ma == 1) then if(ma == 1) then
mat(1:N_states,1:mo_num,puti) += tmp_row(1:N_states,1:mo_num) mat(1:N_states,1:mo_num,puti) += tmp_row(1:N_states,1:mo_num)
else else
mat(1:N_states,puti,1:mo_num) += tmp_row(1:N_states,1:mo_num) mat(1:N_states,puti,1:mo_num) += tmp_row(1:N_states,1:mo_num)
@ -1701,14 +1703,14 @@ subroutine get_d1_reference(gen, phasemask, bannedOrb, banned, mat, mask, h, p,
hij = mo_two_e_integral(p2,pfix,hfix,puti) * get_phase_bi(phasemask, ma, mi, hfix, p2, puti, pfix, N_int) hij = mo_two_e_integral(p2,pfix,hfix,puti) * get_phase_bi(phasemask, ma, mi, hfix, p2, puti, pfix, N_int)
tmp_row(:,puti) += hij * coefs(:) tmp_row(:,puti) += hij * coefs(:)
end if end if
putj = p2 putj = p2
if(.not. banned(putj,puti,bant)) then if(.not. banned(putj,puti,bant)) then
hij = mo_two_e_integral(p1,pfix,hfix,puti) * get_phase_bi(phasemask, ma, mi, hfix, p1, puti, pfix, N_int) hij = mo_two_e_integral(p1,pfix,hfix,puti) * get_phase_bi(phasemask, ma, mi, hfix, p1, puti, pfix, N_int)
tmp_row2(:,puti) += hij * coefs(:) tmp_row2(:,puti) += hij * coefs(:)
end if end if
end do end do
if(mi == 1) then if(mi == 1) then
mat(:,:,p1) += tmp_row(:,:) mat(:,:,p1) += tmp_row(:,:)
mat(:,:,p2) += tmp_row2(:,:) mat(:,:,p2) += tmp_row2(:,:)
@ -1752,7 +1754,7 @@ subroutine get_d1_reference(gen, phasemask, bannedOrb, banned, mat, mask, h, p,
hij = mo_two_e_integral(pfix, p1, hfix, puti) * get_phase_bi(phasemask, mi, ma, hfix, pfix, puti, p1, N_int) hij = mo_two_e_integral(pfix, p1, hfix, puti) * get_phase_bi(phasemask, mi, ma, hfix, pfix, puti, p1, N_int)
tmp_row(:,puti) += hij * coefs(:) tmp_row(:,puti) += hij * coefs(:)
end if end if
putj = p1 putj = p1
if(.not. banned(puti,putj,1)) then if(.not. banned(puti,putj,1)) then
hij = mo_two_e_integral(pfix, p2, hfix, puti) * get_phase_bi(phasemask, mi, ma, hfix, pfix, puti, p2, N_int) hij = mo_two_e_integral(pfix, p2, hfix, puti) * get_phase_bi(phasemask, mi, ma, hfix, pfix, puti, p2, N_int)
@ -1788,7 +1790,7 @@ subroutine get_d1_reference(gen, phasemask, bannedOrb, banned, mat, mask, h, p,
mat(:, p1, p2) += coefs(:) * hij mat(:, p1, p2) += coefs(:) * hij
end do end do
end do end do
end end
subroutine get_d2_reference(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) subroutine get_d2_reference(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs)
use bitmasks use bitmasks
@ -1800,30 +1802,30 @@ subroutine get_d2_reference(gen, phasemask, bannedOrb, banned, mat, mask, h, p,
double precision, intent(in) :: coefs(N_states) double precision, intent(in) :: coefs(N_states)
double precision, intent(inout) :: mat(N_states, mo_num, mo_num) double precision, intent(inout) :: mat(N_states, mo_num, mo_num)
integer, intent(in) :: h(0:2,2), p(0:4,2), sp integer, intent(in) :: h(0:2,2), p(0:4,2), sp
double precision, external :: get_phase_bi, mo_two_e_integral double precision, external :: get_phase_bi, mo_two_e_integral
integer :: i, j, tip, ma, mi, puti, putj integer :: i, j, tip, ma, mi, puti, putj
integer :: h1, h2, p1, p2, i1, i2 integer :: h1, h2, p1, p2, i1, i2
double precision :: hij, phase double precision :: hij, phase
integer, parameter:: turn2d(2,3,4) = reshape((/0,0, 0,0, 0,0, 3,4, 0,0, 0,0, 2,4, 1,4, 0,0, 2,3, 1,3, 1,2 /), (/2,3,4/)) integer, parameter:: turn2d(2,3,4) = reshape((/0,0, 0,0, 0,0, 3,4, 0,0, 0,0, 2,4, 1,4, 0,0, 2,3, 1,3, 1,2 /), (/2,3,4/))
integer, parameter :: turn2(2) = (/2, 1/) integer, parameter :: turn2(2) = (/2, 1/)
integer, parameter :: turn3(2,3) = reshape((/2,3, 1,3, 1,2/), (/2,3/)) integer, parameter :: turn3(2,3) = reshape((/2,3, 1,3, 1,2/), (/2,3/))
integer :: bant integer :: bant
bant = 1 bant = 1
tip = p(0,1) * p(0,2) tip = p(0,1) * p(0,2)
ma = sp ma = sp
if(p(0,1) > p(0,2)) ma = 1 if(p(0,1) > p(0,2)) ma = 1
if(p(0,1) < p(0,2)) ma = 2 if(p(0,1) < p(0,2)) ma = 2
mi = mod(ma, 2) + 1 mi = mod(ma, 2) + 1
if(sp == 3) then if(sp == 3) then
if(ma == 2) bant = 2 if(ma == 2) bant = 2
if(tip == 3) then if(tip == 3) then
puti = p(1, mi) puti = p(1, mi)
do i = 1, 3 do i = 1, 3
@ -1835,7 +1837,7 @@ subroutine get_d2_reference(gen, phasemask, bannedOrb, banned, mat, mask, h, p,
p2 = p(i2, ma) p2 = p(i2, ma)
h1 = h(1, ma) h1 = h(1, ma)
h2 = h(2, ma) h2 = h(2, ma)
hij = (mo_two_e_integral(p1, p2, h1, h2) - mo_two_e_integral(p2,p1, h1, h2)) * get_phase_bi(phasemask, ma, ma, h1, p1, h2, p2, N_int) hij = (mo_two_e_integral(p1, p2, h1, h2) - mo_two_e_integral(p2,p1, h1, h2)) * get_phase_bi(phasemask, ma, ma, h1, p1, h2, p2, N_int)
if(ma == 1) then if(ma == 1) then
mat(:, putj, puti) += coefs(:) * hij mat(:, putj, puti) += coefs(:) * hij
@ -1851,10 +1853,10 @@ subroutine get_d2_reference(gen, phasemask, bannedOrb, banned, mat, mask, h, p,
p2 = p(turn2(j), 2) p2 = p(turn2(j), 2)
do i = 1,2 do i = 1,2
puti = p(i, 1) puti = p(i, 1)
if(banned(puti,putj,bant)) cycle if(banned(puti,putj,bant)) cycle
p1 = p(turn2(i), 1) p1 = p(turn2(i), 1)
hij = mo_two_e_integral(p1, p2, h1, h2) * get_phase_bi(phasemask, 1, 2, h1, p1, h2, p2,N_int) hij = mo_two_e_integral(p1, p2, h1, h2) * get_phase_bi(phasemask, 1, 2, h1, p1, h2, p2,N_int)
mat(:, puti, putj) += coefs(:) * hij mat(:, puti, putj) += coefs(:) * hij
end do end do
@ -1870,7 +1872,7 @@ subroutine get_d2_reference(gen, phasemask, bannedOrb, banned, mat, mask, h, p,
do j=i+1,4 do j=i+1,4
putj = p(j, ma) putj = p(j, ma)
if(banned(puti,putj,1)) cycle if(banned(puti,putj,1)) cycle
i1 = turn2d(1, i, j) i1 = turn2d(1, i, j)
i2 = turn2d(2, i, j) i2 = turn2d(2, i, j)
p1 = p(i1, ma) p1 = p(i1, ma)
@ -1888,7 +1890,7 @@ subroutine get_d2_reference(gen, phasemask, bannedOrb, banned, mat, mask, h, p,
putj = p(turn3(2,i), ma) putj = p(turn3(2,i), ma)
if(banned(puti,putj,1)) cycle if(banned(puti,putj,1)) cycle
p2 = p(i, ma) p2 = p(i, ma)
hij = mo_two_e_integral(p1, p2, h1, h2) * get_phase_bi(phasemask, mi, ma, h1, p1, h2, p2,N_int) hij = mo_two_e_integral(p1, p2, h1, h2) * get_phase_bi(phasemask, mi, ma, h1, p1, h2, p2,N_int)
mat(:, min(puti, putj), max(puti, putj)) += coefs(:) * hij mat(:, min(puti, putj), max(puti, putj)) += coefs(:) * hij
end do end do
@ -1905,6 +1907,6 @@ subroutine get_d2_reference(gen, phasemask, bannedOrb, banned, mat, mask, h, p,
end if end if
end if end if
end if end if
end end

View File

@ -64,7 +64,7 @@ function run() {
@test "SO" { # 1.9667s 2.91234s @test "SO" { # 1.9667s 2.91234s
[[ -n $TRAVIS ]] && skip [[ -n $TRAVIS ]] && skip
run so.ezfio -25.7502102903664 -25.586265109319484 -25.582920204099572 run so.ezfio -25.750224071640112 -25.586278842164113 -25.582933929660470
} }
@test "OH" { # 2.201s 2.65573s @test "OH" { # 2.201s 2.65573s

View File

@ -1,14 +1,14 @@
! Generates subroutine H_apply_cis ! Generates subroutine H_apply_cis
! -------------------------------- ! --------------------------------
BEGIN_SHELL [ /usr/bin/env python2 ] BEGIN_SHELL [ /usr/bin/env python3 ]
from generate_h_apply import H_apply from generate_h_apply import H_apply
H = H_apply("cis",do_double_exc=False) H = H_apply("cis",do_double_exc=False)
print H print(H)
H = H_apply("cis_sym",do_double_exc=False) H = H_apply("cis_sym",do_double_exc=False)
H.filter_only_connected_to_hf() H.filter_only_connected_to_hf()
print H print(H)
END_SHELL END_SHELL

View File

@ -1,13 +1,13 @@
! Generates subroutine H_apply_cisd ! Generates subroutine H_apply_cisd
! ---------------------------------- ! ----------------------------------
BEGIN_SHELL [ /usr/bin/env python2 ] BEGIN_SHELL [ /usr/bin/env python3 ]
from generate_h_apply import H_apply from generate_h_apply import H_apply
H = H_apply("cisd",do_double_exc=True) H = H_apply("cisd",do_double_exc=True)
print H print(H)
H = H_apply("cisd_sym",do_double_exc=True) H = H_apply("cisd_sym",do_double_exc=True)
H.filter_only_connected_to_hf() H.filter_only_connected_to_hf()
print H print(H)
END_SHELL END_SHELL

View File

@ -118,22 +118,22 @@ END_PROVIDER
call u_0_S2_u_0(s2_eigvalues,eigenvectors,N_det,psi_det,N_int,& call u_0_S2_u_0(s2_eigvalues,eigenvectors,N_det,psi_det,N_int,&
N_det,size(eigenvectors,1)) N_det,size(eigenvectors,1))
if (only_expected_s2) then if (only_expected_s2) then
do j=1,N_det do j=1,N_det
! Select at least n_states states with S^2 values closed to "expected_s2" ! Select at least n_states states with S^2 values closed to "expected_s2"
if(dabs(s2_eigvalues(j)-expected_s2).le.0.5d0)then if(dabs(s2_eigvalues(j)-expected_s2).le.0.5d0)then
i_state +=1 i_state +=1
index_good_state_array(i_state) = j index_good_state_array(i_state) = j
good_state_array(j) = .True.
endif
if(i_state.eq.N_states) then
exit
endif
enddo
else
do j=1,N_det
index_good_state_array(j) = j
good_state_array(j) = .True. good_state_array(j) = .True.
enddo endif
if(i_state.eq.N_states) then
exit
endif
enddo
else
do j=1,N_det
index_good_state_array(j) = j
good_state_array(j) = .True.
enddo
endif endif
if(i_state .ne.0)then if(i_state .ne.0)then
! Fill the first "i_state" states that have a correct S^2 value ! Fill the first "i_state" states that have a correct S^2 value
@ -163,7 +163,7 @@ END_PROVIDER
print*,'!!!!!!!! WARNING !!!!!!!!!' print*,'!!!!!!!! WARNING !!!!!!!!!'
print*,' Within the ',N_det,'determinants selected' print*,' Within the ',N_det,'determinants selected'
print*,' and the ',N_states_diag,'states requested' print*,' and the ',N_states_diag,'states requested'
print*,' We did not find any state with S^2 values close to ',expected_s2 print*,' We did not find only states with S^2 values close to ',expected_s2
print*,' We will then set the first N_states eigenvectors of the H matrix' print*,' We will then set the first N_states eigenvectors of the H matrix'
print*,' as the CI_eigenvectors' print*,' as the CI_eigenvectors'
print*,' You should consider more states and maybe ask for s2_eig to be .True. or just enlarge the CI space' print*,' You should consider more states and maybe ask for s2_eig to be .True. or just enlarge the CI space'
@ -179,11 +179,11 @@ END_PROVIDER
deallocate(index_good_state_array,good_state_array) deallocate(index_good_state_array,good_state_array)
deallocate(s2_eigvalues) deallocate(s2_eigvalues)
else else
call lapack_diag(eigenvalues,eigenvectors, & call lapack_diag(eigenvalues,eigenvectors, &
H_matrix_all_dets,size(H_matrix_all_dets,1),N_det) H_matrix_all_dets,size(H_matrix_all_dets,1),N_det)
CI_electronic_energy(:) = 0.d0 CI_electronic_energy(:) = 0.d0
call u_0_S2_u_0(CI_s2,eigenvectors,N_det,psi_det,N_int,& call u_0_S2_u_0(CI_s2,eigenvectors,N_det,psi_det,N_int, &
min(N_det,N_states_diag),size(eigenvectors,1)) min(N_det,N_states_diag),size(eigenvectors,1))
! Select the "N_states_diag" states of lowest energy ! Select the "N_states_diag" states of lowest energy
do j=1,min(N_det,N_states_diag) do j=1,min(N_det,N_states_diag)
do i=1,N_det do i=1,N_det
@ -213,7 +213,7 @@ subroutine diagonalize_CI
! Replace the coefficients of the |CI| states by the coefficients of the ! Replace the coefficients of the |CI| states by the coefficients of the
! eigenstates of the |CI| matrix. ! eigenstates of the |CI| matrix.
END_DOC END_DOC
integer :: i,j integer :: i,j
do j=1,N_states do j=1,N_states
do i=1,N_det do i=1,N_det
psi_coef(i,j) = CI_eigenvectors(i,j) psi_coef(i,j) = CI_eigenvectors(i,j)

View File

@ -1,25 +1,23 @@
[density_for_dft] [density_for_dft]
type: character*(32) type: character*(32)
doc: Type of density used for DFT calculation. If set to WFT , it uses the density of the wave function stored in (psi_det,psi_coef). If set to input_density it uses the one-body dm stored in aux_quantities/ . If set to damping_rs_dft it uses the damped density between WFT and input_density. In the ks_scf and rs_ks_scf programs, it is set to WFT. doc: Type of density used for DFT calculation. If set to WFT , it uses the density of the wave function stored in (psi_det,psi_coef). If set to input_density it uses the one-body dm stored in aux_quantities/ . If set to damping_rs_dft it uses the damped density between WFT and input_density. In the ks_scf and rs_ks_scf programs, it is set to WFT.
interface: ezfio, provider, ocaml interface: ezfio, provider, ocaml
default: WFT default: WFT
[damping_for_rs_dft] [damping_for_rs_dft]
type: double precision type: double precision
doc: damping factor for the density used in RSFT. doc: damping factor for the density used in RSFT.
interface: ezfio,provider,ocaml interface: ezfio,provider,ocaml
default: 0.5 default: 0.5
[no_core_density] [no_core_density]
type: character*(32) type: character*(32)
doc: Type of density doc: Type of density. If [no_core_dm] then all elements of the density matrix involving at least one orbital set as core are set to zero
doc: if [no_core_dm] then all elements of the density matrix involving at least one orbital set as core are set to zero
interface: ezfio, provider, ocaml interface: ezfio, provider, ocaml
default: full_density default: full_density
[normalize_dm] [normalize_dm]
type: logical type: logical
doc: Type of density doc: Type of density. If .True., then you normalize the no_core_dm to elec_alpha_num - n_core_orb and elec_beta_num - n_core_orb
doc: if .True., then you normalize the no_core_dm to elec_alpha_num - n_core_orb and elec_beta_num - n_core_orb
interface: ezfio, provider, ocaml interface: ezfio, provider, ocaml
default: True default: True

View File

@ -76,7 +76,6 @@ type: integer
interface: ezfio interface: ezfio
doc: Number of determinants to print in qp_edit doc: Number of determinants to print in qp_edit
type: integer type: integer
interface: ezfio
[psi_coef] [psi_coef]
interface: ezfio interface: ezfio

View File

@ -342,139 +342,3 @@ subroutine fill_H_apply_buffer_no_selection(n_selected,det_buffer,Nint,iproc)
call omp_unset_lock(H_apply_buffer_lock(1,iproc)) call omp_unset_lock(H_apply_buffer_lock(1,iproc))
end end
subroutine push_pt2(zmq_socket_push,pt2,norm_pert,H_pert_diag,i_generator,N_st,task_id)
use f77_zmq
implicit none
BEGIN_DOC
! Push |PT2| calculation to the collector
END_DOC
integer(ZMQ_PTR), intent(in) :: zmq_socket_push
integer, intent(in) :: N_st, i_generator
double precision, intent(in) :: pt2(N_st), norm_pert(N_st), H_pert_diag(N_st)
integer, intent(in) :: task_id
integer :: rc
rc = f77_zmq_send( zmq_socket_push, 1, 4, ZMQ_SNDMORE)
if (rc /= 4) then
print *, irp_here, 'f77_zmq_send( zmq_socket_push, 1, 4, ZMQ_SNDMORE)'
stop 'error'
endif
rc = f77_zmq_send( zmq_socket_push, pt2, 8*N_st, ZMQ_SNDMORE)
if (rc /= 8*N_st) then
print *, irp_here, 'f77_zmq_send( zmq_socket_push, pt2, 8*N_st, ZMQ_SNDMORE)'
stop 'error'
endif
rc = f77_zmq_send( zmq_socket_push, norm_pert, 8*N_st, ZMQ_SNDMORE)
if (rc /= 8*N_st) then
print *, irp_here, 'f77_zmq_send( zmq_socket_push, norm_pert, 8*N_st, ZMQ_SNDMORE)'
stop 'error'
endif
rc = f77_zmq_send( zmq_socket_push, H_pert_diag, 8*N_st, ZMQ_SNDMORE)
if (rc /= 8*N_st) then
print *, irp_here, 'f77_zmq_send( zmq_socket_push, H_pert_diag, 8*N_st, ZMQ_SNDMORE)'
stop 'error'
endif
rc = f77_zmq_send( zmq_socket_push, i_generator, 4, ZMQ_SNDMORE)
if (rc /= 4) then
print *, irp_here, 'f77_zmq_send( zmq_socket_push, i_generator, 4, 0)'
stop 'error'
endif
rc = f77_zmq_send( zmq_socket_push, task_id, 4, 0)
if (rc /= 4) then
print *, irp_here, 'f77_zmq_send( zmq_socket_push, task_id, 4, 0)'
stop 'error'
endif
! Activate if zmq_socket_push is a REQ
IRP_IF ZMQ_PUSH
IRP_ELSE
integer :: idummy
rc = f77_zmq_recv( zmq_socket_push, idummy, 4, 0)
if (rc /= 4) then
print *, irp_here, 'f77_zmq_send( zmq_socket_push, idummy, 4, 0)'
stop 'error'
endif
IRP_ENDIF
end
subroutine pull_pt2(zmq_socket_pull,pt2,norm_pert,H_pert_diag,i_generator,N_st,n,task_id)
use f77_zmq
implicit none
BEGIN_DOC
! Pull |PT2| calculation in the collector
END_DOC
integer(ZMQ_PTR), intent(in) :: zmq_socket_pull
integer, intent(in) :: N_st
double precision, intent(out) :: pt2(N_st), norm_pert(N_st), H_pert_diag(N_st)
integer, intent(out) :: task_id
integer, intent(out) :: n, i_generator
integer :: rc
n=0
rc = f77_zmq_recv( zmq_socket_pull, n, 4, 0)
if (rc == -1) then
n=9
return
endif
if (rc /= 4) then
print *, irp_here, 'f77_zmq_recv( zmq_socket_pull, n, 4, 0)'
stop 'error'
endif
if (n > 0) then
rc = f77_zmq_recv( zmq_socket_pull, pt2(1), 8*N_st, 0)
if (rc /= 8*N_st) then
print *, ''
print *, ''
print *, ''
print *, irp_here, 'f77_zmq_recv( zmq_socket_pull, pt2(1) , 8*N_st, 0)'
print *, rc
stop 'error'
endif
rc = f77_zmq_recv( zmq_socket_pull, norm_pert(1), 8*N_st, 0)
if (rc /= 8*N_st) then
print *, irp_here, 'f77_zmq_recv( zmq_socket_pull, norm_pert(1,1), 8*N_st)'
stop 'error'
endif
rc = f77_zmq_recv( zmq_socket_pull, H_pert_diag(1), 8*N_st, 0)
if (rc /= 8*N_st) then
print *, irp_here, 'f77_zmq_recv( zmq_socket_pull, H_pert_diag(1,1), 8*N_st)'
stop 'error'
endif
rc = f77_zmq_recv( zmq_socket_pull, i_generator, 4, 0)
if (rc /= 4) then
print *, irp_here, 'f77_zmq_recv( zmq_socket_pull, i_generator, 4, 0)'
stop 'error'
endif
rc = f77_zmq_recv( zmq_socket_pull, task_id, 4, 0)
if (rc /= 4) then
print *, irp_here, 'f77_zmq_recv( zmq_socket_pull, task_id, 4, 0)'
stop 'error'
endif
endif
! Activate if zmq_socket_pull is a REP
IRP_IF ZMQ_PUSH
IRP_ELSE
rc = f77_zmq_send( zmq_socket_pull, 0, 4, 0)
if (rc /= 4) then
print *, irp_here, 'f77_zmq_send( zmq_socket_pull, 0, 4, 0)'
stop 'error'
endif
IRP_ENDIF
end

View File

@ -243,7 +243,7 @@ subroutine $subroutine_diexcOrg(key_in,key_mask,hole_1,particl_1,hole_2, particl
! Build array of the non-zero integrals of second excitation ! Build array of the non-zero integrals of second excitation
$filter_integrals $filter_integrals
if (ispin == 1) then if (ispin == 1) then
integer :: jjj integer :: jjj
i=0 i=0
@ -285,7 +285,7 @@ subroutine $subroutine_diexcOrg(key_in,key_mask,hole_1,particl_1,hole_2, particl
$only_1h_double $only_1h_double
$only_1p_double $only_1p_double
$only_2h1p_double $only_2h1p_double
$filter_only_connected_to_hf_double $filter_only_connected_to_hf_double
key_idx += 1 key_idx += 1
do k=1,N_int do k=1,N_int
keys_out(k,1,key_idx) = key(k,1) keys_out(k,1,key_idx) = key(k,1)
@ -497,7 +497,7 @@ subroutine $subroutine_monoexc(key_in, hole_1,particl_1,fock_diag_tmp,i_generato
$filter_only_1h1p_single $filter_only_1h1p_single
$filter_only_1h2p_single $filter_only_1h2p_single
$filter_only_2h2p_single $filter_only_2h2p_single
$filter_only_connected_to_hf_single $filter_only_connected_to_hf_single
key_idx += 1 key_idx += 1
do k=1,N_int do k=1,N_int
keys_out(k,1,key_idx) = hole(k,1) keys_out(k,1,key_idx) = hole(k,1)

View File

@ -1,289 +0,0 @@
subroutine $subroutine($params_main)
implicit none
use omp_lib
use bitmasks
use f77_zmq
BEGIN_DOC
! Calls H_apply on the |HF| determinant and selects all connected single and double
! excitations (of the same symmetry). Auto-generated by the :file:`generate_h_apply` script.
END_DOC
$decls_main
integer :: i
integer :: i_generator
double precision :: wall_0, wall_1
integer(bit_kind), allocatable :: mask(:,:,:)
integer :: ispin, k
integer :: rc
character*(512) :: task
double precision, allocatable :: fock_diag_tmp(:,:)
$initialization
PROVIDE H_apply_buffer_allocated mo_two_e_integrals_in_map psi_det_generators psi_coef_generators
integer(ZMQ_PTR), external :: new_zmq_pair_socket
integer(ZMQ_PTR) :: zmq_socket_pair, zmq_socket_pull
integer(ZMQ_PTR) :: zmq_to_qp_run_socket
double precision, allocatable :: pt2_generators(:,:), norm_pert_generators(:,:)
double precision, allocatable :: H_pert_diag_generators(:,:)
double precision :: energy(N_st)
call new_parallel_job(zmq_to_qp_run_socket,zmq_socket_pull,'$subroutine')
zmq_socket_pair = new_zmq_pair_socket(.True.)
integer, external :: zmq_put_psi
integer, external :: zmq_put_N_det_generators
integer, external :: zmq_put_N_det_selectors
integer, external :: zmq_put_dvector
if (zmq_put_psi(zmq_to_qp_run_socket,1) == -1) then
stop 'Unable to put psi on ZMQ server'
endif
if (zmq_put_N_det_generators(zmq_to_qp_run_socket, 1) == -1) then
stop 'Unable to put N_det_generators on ZMQ server'
endif
if (zmq_put_N_det_selectors(zmq_to_qp_run_socket, 1) == -1) then
stop 'Unable to put N_det_selectors on ZMQ server'
endif
if (zmq_put_dvector(zmq_to_qp_run_socket,1,'energy',energy,size(energy)) == -1) then
stop 'Unable to put energy on ZMQ server'
endif
do i_generator=1,N_det_generators
$skip
write(task,*) i_generator
integer, external :: add_task_to_taskserver
if (add_task_to_taskserver(zmq_to_qp_run_socket,trim(task)) == -1) then
stop 'Unable to add task to taskserver'
endif
enddo
allocate ( pt2_generators(N_states,N_det_generators), &
norm_pert_generators(N_states,N_det_generators), &
H_pert_diag_generators(N_states,N_det_generators) )
PROVIDE nproc N_states
!$OMP PARALLEL DEFAULT(NONE) &
!$OMP PRIVATE(i) &
!$OMP SHARED(zmq_socket_pair,N_states, pt2_generators, norm_pert_generators, H_pert_diag_generators, n, task_id, i_generator,zmq_socket_pull) &
!$OMP num_threads(nproc+1)
i = omp_get_thread_num()
if (i == 0) then
call $subroutine_collector(zmq_socket_pull)
integer :: n, task_id
call pull_pt2(zmq_socket_pair, pt2_generators, norm_pert_generators, H_pert_diag_generators, i_generator, size(pt2_generators), n, task_id)
else
call $subroutine_slave_inproc(i)
endif
!$OMP END PARALLEL
call end_zmq_pair_socket(zmq_socket_pair)
call end_parallel_job(zmq_to_qp_run_socket,zmq_socket_pull,'$subroutine')
$copy_buffer
$generate_psi_guess
deallocate ( pt2_generators, norm_pert_generators, H_pert_diag_generators)
end
subroutine $subroutine_slave_tcp(iproc)
implicit none
integer, intent(in) :: iproc
BEGIN_DOC
! Computes a buffer over the network
END_DOC
call $subroutine_slave(0,iproc)
end
subroutine $subroutine_slave_inproc(iproc)
implicit none
integer, intent(in) :: iproc
BEGIN_DOC
! Computes a buffer using threads
END_DOC
call $subroutine_slave(1,iproc)
end
subroutine $subroutine_slave(thread, iproc)
implicit none
use omp_lib
use bitmasks
use f77_zmq
integer, intent(in) :: thread
BEGIN_DOC
! Calls H_apply on the HF determinant and selects all connected single and double
! excitations (of the same symmetry). Auto-generated by the :file:`generate_h_apply` script.
END_DOC
integer, intent(in) :: iproc
integer :: i_generator
double precision :: wall_0, wall_1
integer(bit_kind), allocatable :: mask(:,:,:)
integer :: ispin, k
double precision, allocatable :: fock_diag_tmp(:,:)
double precision, allocatable :: pt2(:), norm_pert(:), H_pert_diag(:)
integer :: worker_id, task_id, rc, N_st
character*(512) :: task
integer(ZMQ_PTR),external :: new_zmq_to_qp_run_socket
integer(ZMQ_PTR) :: zmq_to_qp_run_socket
integer(ZMQ_PTR),external :: new_zmq_push_socket
integer(ZMQ_PTR) :: zmq_socket_push
zmq_to_qp_run_socket = new_zmq_to_qp_run_socket()
integer, external :: connect_to_taskserver
if (connect_to_taskserver(zmq_to_qp_run_socket,worker_id,thread) == -1) then
call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket)
return
endif
zmq_socket_push = new_zmq_push_socket(thread)
N_st = N_states
allocate( pt2(N_st), norm_pert(N_st), H_pert_diag(N_st), &
mask(N_int,2,6), fock_diag_tmp(2,mo_num+1) )
do
integer, external :: get_task_from_taskserver
if (get_task_from_taskserver(zmq_to_qp_run_socket,worker_id, task_id, task) == -1) then
exit
endif
if (task_id == 0) exit
read(task,*) i_generator
! Compute diagonal of the Fock matrix
call build_fock_tmp(fock_diag_tmp,psi_det_generators(1,1,i_generator),N_int)
pt2 = 0.d0
norm_pert = 0.d0
H_pert_diag = 0.d0
! Create bit masks for holes and particles
do ispin=1,2
do k=1,N_int
mask(k,ispin,s_hole) = &
iand(generators_bitmask(k,ispin,s_hole,i_bitmask_gen), &
psi_det_generators(k,ispin,i_generator) )
mask(k,ispin,s_part) = &
iand(generators_bitmask(k,ispin,s_part,i_bitmask_gen), &
not(psi_det_generators(k,ispin,i_generator)) )
mask(k,ispin,d_hole1) = &
iand(generators_bitmask(k,ispin,d_hole1,i_bitmask_gen), &
psi_det_generators(k,ispin,i_generator) )
mask(k,ispin,d_part1) = &
iand(generators_bitmask(k,ispin,d_part1,i_bitmask_gen), &
not(psi_det_generators(k,ispin,i_generator)) )
mask(k,ispin,d_hole2) = &
iand(generators_bitmask(k,ispin,d_hole2,i_bitmask_gen), &
psi_det_generators(k,ispin,i_generator) )
mask(k,ispin,d_part2) = &
iand(generators_bitmask(k,ispin,d_part2,i_bitmask_gen), &
not (psi_det_generators(k,ispin,i_generator)) )
enddo
enddo
if($do_double_excitations)then
call $subroutine_diexc(psi_det_generators(1,1,i_generator), &
psi_det_generators(1,1,1), &
mask(1,1,d_hole1), mask(1,1,d_part1), &
mask(1,1,d_hole2), mask(1,1,d_part2), &
fock_diag_tmp, i_generator, iproc $params_post)
endif
if($do_mono_excitations)then
call $subroutine_monoexc(psi_det_generators(1,1,i_generator), &
mask(1,1,s_hole ), mask(1,1,s_part ), &
fock_diag_tmp, i_generator, iproc $params_post)
endif
integer, external :: task_done_to_taskserver
if (task_done_to_taskserver(zmq_to_qp_run_socket, worker_id, task_id) == -1) then
print *, irp_here, ': Unable to send task_done'
endif
call push_pt2(zmq_socket_push,pt2,norm_pert,H_pert_diag,i_generator,N_st,task_id)
enddo
deallocate( mask, fock_diag_tmp, pt2, norm_pert, H_pert_diag )
integer, external :: disconnect_from_taskserver
if (disconnect_from_taskserver(zmq_to_qp_run_socket,worker_id) == -1) then
continue
endif
call end_zmq_push_socket(zmq_socket_push,thread)
call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket)
end
subroutine $subroutine_collector(zmq_socket_pull)
use f77_zmq
implicit none
BEGIN_DOC
! Collects results from the selection in an array of generators
END_DOC
integer :: k, rc
integer(ZMQ_PTR), external :: new_zmq_pull_socket
integer(ZMQ_PTR), intent(in) :: zmq_socket_pull
integer*8 :: control, accu
integer :: n, more, task_id, i_generator
integer(ZMQ_PTR),external :: new_zmq_to_qp_run_socket
integer(ZMQ_PTR) :: zmq_to_qp_run_socket
zmq_to_qp_run_socket = new_zmq_to_qp_run_socket()
double precision, allocatable :: pt2(:), norm_pert(:), H_pert_diag(:)
double precision, allocatable :: pt2_result(:,:), norm_pert_result(:,:), H_pert_diag_result(:,:)
allocate (pt2(N_states), norm_pert(N_states), H_pert_diag(N_states))
allocate (pt2_result(N_states,N_det_generators), norm_pert_result(N_states,N_det_generators), &
H_pert_diag_result(N_states,N_det_generators))
pt2_result = 0.d0
norm_pert_result = 0.d0
H_pert_diag_result = 0.d0
accu = 0_8
more = 1
do while (more == 1)
call pull_pt2(zmq_socket_pull, pt2, norm_pert, H_pert_diag, i_generator, N_states, n, task_id)
if (n > 0) then
do k=1,N_states
pt2_result(k,i_generator) = pt2(k)
norm_pert_result(k,i_generator) = norm_pert(k)
H_pert_diag_result(k,i_generator) = H_pert_diag(k)
enddo
accu = accu + 1_8
integer, external :: zmq_delete_task
if (zmq_delete_task(zmq_to_qp_run_socket,zmq_socket_pull,task_id,more) == -1) then
stop 'Unable to delete task'
endif
endif
enddo
call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket)
integer(ZMQ_PTR), external :: new_zmq_pair_socket
integer(ZMQ_PTR) :: socket_result
socket_result = new_zmq_pair_socket(.False.)
call push_pt2(socket_result, pt2_result, norm_pert_result, H_pert_diag_result, i_generator, &
N_states*N_det_generators,0)
deallocate (pt2, norm_pert, H_pert_diag, pt2_result, norm_pert_result, H_pert_diag_result)
call end_zmq_pair_socket(socket_result)
end

View File

@ -424,7 +424,7 @@ BEGIN_PROVIDER [ double precision, weight_occ_pattern_average, (N_occ_pattern) ]
enddo enddo
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [ double precision, psi_occ_pattern_sorted, (N_int,2,N_occ_pattern) ] BEGIN_PROVIDER [ integer(bit_kind), psi_occ_pattern_sorted, (N_int,2,N_occ_pattern) ]
&BEGIN_PROVIDER [ double precision, weight_occ_pattern_average_sorted, (N_occ_pattern) ] &BEGIN_PROVIDER [ double precision, weight_occ_pattern_average_sorted, (N_occ_pattern) ]
&BEGIN_PROVIDER [ integer, psi_occ_pattern_sorted_order, (N_occ_pattern) ] &BEGIN_PROVIDER [ integer, psi_occ_pattern_sorted_order, (N_occ_pattern) ]
&BEGIN_PROVIDER [ integer, psi_occ_pattern_sorted_order_reverse, (N_occ_pattern) ] &BEGIN_PROVIDER [ integer, psi_occ_pattern_sorted_order_reverse, (N_occ_pattern) ]

View File

@ -3,8 +3,8 @@ BEGIN_PROVIDER [double precision, energy_x, (N_states)]
BEGIN_DOC BEGIN_DOC
! correlation energies general providers. ! correlation energies general providers.
END_DOC END_DOC
BEGIN_SHELL [ /usr/bin/env python2 ] BEGIN_SHELL [ /usr/bin/env python3 ]
import os import os
import glob import glob
from qp_path import QP_SRC from qp_path import QP_SRC
@ -13,32 +13,32 @@ os.chdir(funcdir)
functionals = map(lambda x : x.replace(".irp.f",""), glob.glob("*.irp.f")) functionals = map(lambda x : x.replace(".irp.f",""), glob.glob("*.irp.f"))
prefix = "" prefix = ""
for f in functionals: for f in functionals:
print """ print("""
%sif (trim(exchange_functional) == '%s') then %sif (trim(exchange_functional) == '%s') then
energy_x = (1.d0 - HF_exchange ) * energy_x_%s"""%(prefix, f, f) energy_x = (1.d0 - HF_exchange ) * energy_x_%s"""%(prefix, f, f))
prefix = "else " prefix = "else "
print """ print("""
else else
print *, 'exchange functional required does not exist ...' print *, 'exchange functional required does not exist ...'
print *, 'exchange_functional ',exchange_functional print *, 'exchange_functional ',exchange_functional
stop""" stop""")
print "endif" print("endif")
END_SHELL END_SHELL
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [double precision, energy_c, (N_states)] BEGIN_PROVIDER [double precision, energy_c, (N_states)]
implicit none implicit none
BEGIN_DOC BEGIN_DOC
! correlation and exchange energies general providers. ! correlation and exchange energies general providers.
END_DOC END_DOC
BEGIN_SHELL [ /usr/bin/env python2 ] BEGIN_SHELL [ /usr/bin/env python3 ]
import os import os
import glob import glob
from qp_path import QP_SRC from qp_path import QP_SRC
@ -47,19 +47,19 @@ os.chdir(funcdir)
functionals = map(lambda x : x.replace(".irp.f",""), glob.glob("*.irp.f")) functionals = map(lambda x : x.replace(".irp.f",""), glob.glob("*.irp.f"))
prefix = "" prefix = ""
for f in functionals: for f in functionals:
print """ print("""
%sif (trim(correlation_functional) == '%s') then %sif (trim(correlation_functional) == '%s') then
energy_c = energy_c_%s"""%(prefix, f, f) energy_c = energy_c_%s"""%(prefix, f, f) )
prefix = "else " prefix = "else "
print """ print("""
else else
print*, 'Correlation functional required does not exist ...' print*, 'Correlation functional required does not exist ...'
print*,'correlation_functional ',correlation_functional print*,'correlation_functional ',correlation_functional
stop""" stop""")
print "endif" print("endif")
END_SHELL END_SHELL
END_PROVIDER END_PROVIDER

View File

@ -4,8 +4,8 @@
BEGIN_DOC BEGIN_DOC
! general providers for the alpha/beta exchange potentials on the AO basis ! general providers for the alpha/beta exchange potentials on the AO basis
END_DOC END_DOC
BEGIN_SHELL [ /usr/bin/env python2 ] BEGIN_SHELL [ /usr/bin/env python3 ]
import os import os
import glob import glob
from qp_path import QP_SRC from qp_path import QP_SRC
@ -15,33 +15,33 @@ functionals = map(lambda x : x.replace(".irp.f",""), glob.glob("*.irp.f"))
prefix = "" prefix = ""
for f in functionals: for f in functionals:
print """ print("""
%sif (trim(exchange_functional) == '%s') then %sif (trim(exchange_functional) == '%s') then
potential_x_alpha_ao = ( 1.d0 - HF_exchange ) * potential_x_alpha_ao_%s potential_x_alpha_ao = ( 1.d0 - HF_exchange ) * potential_x_alpha_ao_%s
potential_x_beta_ao = ( 1.d0 - HF_exchange ) * potential_x_beta_ao_%s"""%(prefix, f, f, f) potential_x_beta_ao = ( 1.d0 - HF_exchange ) * potential_x_beta_ao_%s"""%(prefix, f, f, f) )
prefix = "else " prefix = "else "
print """ print("""
else else
print*, 'exchange functional required does not exist ...' print*, 'exchange functional required does not exist ...'
print*,'exchange_functional ',exchange_functional print*,'exchange_functional ',exchange_functional
stop""" stop""")
print "endif" print("endif")
END_SHELL END_SHELL
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [double precision, potential_c_alpha_ao,(ao_num,ao_num,N_states)] BEGIN_PROVIDER [double precision, potential_c_alpha_ao,(ao_num,ao_num,N_states)]
&BEGIN_PROVIDER [double precision, potential_c_beta_ao,(ao_num,ao_num,N_states)] &BEGIN_PROVIDER [double precision, potential_c_beta_ao,(ao_num,ao_num,N_states)]
implicit none implicit none
BEGIN_DOC BEGIN_DOC
! general providers for the alpha/beta correlation potentials on the AO basis ! general providers for the alpha/beta correlation potentials on the AO basis
END_DOC END_DOC
BEGIN_SHELL [ /usr/bin/env python2 ] BEGIN_SHELL [ /usr/bin/env python3 ]
import os import os
import glob import glob
from qp_path import QP_SRC from qp_path import QP_SRC
@ -51,27 +51,27 @@ functionals = map(lambda x : x.replace(".irp.f",""), glob.glob("*.irp.f"))
prefix = "" prefix = ""
for f in functionals: for f in functionals:
print """ print("""
%sif (trim(correlation_functional) == '%s') then %sif (trim(correlation_functional) == '%s') then
potential_c_alpha_ao = potential_c_alpha_ao_%s potential_c_alpha_ao = potential_c_alpha_ao_%s
potential_c_beta_ao = potential_c_beta_ao_%s"""%(prefix, f, f, f) potential_c_beta_ao = potential_c_beta_ao_%s"""%(prefix, f, f, f) )
prefix = "else " prefix = "else "
print """ print("""
else else
print*, 'Correlation functional required does not exist ...' print*, 'Correlation functional required does not exist ...'
print*,'correlation_functional ',correlation_functional print*,'correlation_functional ',correlation_functional
stop""" stop""" )
print "endif" print("endif")
END_SHELL END_SHELL
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [double precision, potential_x_alpha_mo,(mo_num,mo_num,N_states)] BEGIN_PROVIDER [double precision, potential_x_alpha_mo,(mo_num,mo_num,N_states)]
&BEGIN_PROVIDER [double precision, potential_x_beta_mo ,(mo_num,mo_num,N_states)] &BEGIN_PROVIDER [double precision, potential_x_beta_mo ,(mo_num,mo_num,N_states)]
implicit none implicit none
@ -86,7 +86,7 @@ print "endif"
potential_x_alpha_mo(1,1,istate), & potential_x_alpha_mo(1,1,istate), &
size(potential_x_alpha_mo,1) & size(potential_x_alpha_mo,1) &
) )
call ao_to_mo( & call ao_to_mo( &
potential_x_beta_ao(1,1,istate), & potential_x_beta_ao(1,1,istate), &
size(potential_x_beta_ao,1), & size(potential_x_beta_ao,1), &
@ -94,9 +94,9 @@ print "endif"
size(potential_x_beta_mo,1) & size(potential_x_beta_mo,1) &
) )
enddo enddo
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [double precision, potential_c_alpha_mo,(mo_num,mo_num,N_states)] BEGIN_PROVIDER [double precision, potential_c_alpha_mo,(mo_num,mo_num,N_states)]
&BEGIN_PROVIDER [double precision, potential_c_beta_mo, (mo_num,mo_num,N_states)] &BEGIN_PROVIDER [double precision, potential_c_beta_mo, (mo_num,mo_num,N_states)]
implicit none implicit none
@ -111,7 +111,7 @@ print "endif"
potential_c_alpha_mo(1,1,istate), & potential_c_alpha_mo(1,1,istate), &
size(potential_c_alpha_mo,1) & size(potential_c_alpha_mo,1) &
) )
call ao_to_mo( & call ao_to_mo( &
potential_c_beta_ao(1,1,istate), & potential_c_beta_ao(1,1,istate), &
size(potential_c_beta_ao,1), & size(potential_c_beta_ao,1), &
@ -119,7 +119,7 @@ print "endif"
size(potential_c_beta_mo,1) & size(potential_c_beta_mo,1) &
) )
enddo enddo
END_PROVIDER END_PROVIDER
@ -147,9 +147,9 @@ print "endif"
enddo enddo
Trace_v_Hxc(istate) = Trace_v_xc(istate) + Trace_v_H(istate) Trace_v_Hxc(istate) = Trace_v_xc(istate) + Trace_v_H(istate)
enddo enddo
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [double precision, Trace_v_xc_new, (N_states)] BEGIN_PROVIDER [double precision, Trace_v_xc_new, (N_states)]
implicit none implicit none
integer :: i,j,istate integer :: i,j,istate
@ -166,14 +166,14 @@ print "endif"
enddo enddo
enddo enddo
enddo enddo
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [double precision, potential_xc_alpha_mo,(mo_num,mo_num,N_states)] BEGIN_PROVIDER [double precision, potential_xc_alpha_mo,(mo_num,mo_num,N_states)]
&BEGIN_PROVIDER [double precision, potential_xc_beta_mo,(mo_num,mo_num,N_states)] &BEGIN_PROVIDER [double precision, potential_xc_beta_mo,(mo_num,mo_num,N_states)]
implicit none implicit none
integer :: istate integer :: istate
do istate = 1, N_states do istate = 1, N_states
call ao_to_mo( & call ao_to_mo( &
potential_xc_alpha_ao(1,1,istate), & potential_xc_alpha_ao(1,1,istate), &
@ -181,7 +181,7 @@ print "endif"
potential_xc_alpha_mo(1,1,istate), & potential_xc_alpha_mo(1,1,istate), &
size(potential_xc_alpha_mo,1) & size(potential_xc_alpha_mo,1) &
) )
call ao_to_mo( & call ao_to_mo( &
potential_xc_beta_ao(1,1,istate), & potential_xc_beta_ao(1,1,istate), &
size(potential_xc_beta_ao,1), & size(potential_xc_beta_ao,1), &
@ -189,18 +189,18 @@ print "endif"
size(potential_xc_beta_mo,1) & size(potential_xc_beta_mo,1) &
) )
enddo enddo
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [double precision, potential_xc_alpha_ao,(ao_num,ao_num,N_states)] BEGIN_PROVIDER [double precision, potential_xc_alpha_ao,(ao_num,ao_num,N_states)]
&BEGIN_PROVIDER [double precision, potential_xc_beta_ao,(ao_num,ao_num,N_states)] &BEGIN_PROVIDER [double precision, potential_xc_beta_ao,(ao_num,ao_num,N_states)]
implicit none implicit none
BEGIN_DOC BEGIN_DOC
! general providers for the alpha/beta exchange/correlation potentials on the AO basis ! general providers for the alpha/beta exchange/correlation potentials on the AO basis
END_DOC END_DOC
BEGIN_SHELL [ /usr/bin/env python2 ] BEGIN_SHELL [ /usr/bin/env python3 ]
import os import os
import glob import glob
from qp_path import QP_SRC from qp_path import QP_SRC
@ -210,19 +210,19 @@ functionals = map(lambda x : x.replace(".irp.f",""), glob.glob("*.irp.f"))
prefix = "" prefix = ""
for f in functionals: for f in functionals:
print """ print("""
%sif (trim(exchange_functional) == '%s') then %sif (trim(exchange_functional) == '%s') then
potential_xc_alpha_ao = potential_xc_alpha_ao_%s potential_xc_alpha_ao = potential_xc_alpha_ao_%s
potential_xc_beta_ao = potential_xc_beta_ao_%s"""%(prefix, f, f, f) potential_xc_beta_ao = potential_xc_beta_ao_%s"""%(prefix, f, f, f) )
prefix = "else " prefix = "else "
print """ print("""
else else
print*, 'exchange functional required does not exist ...' print*, 'exchange functional required does not exist ...'
print*,'exchange_functional ',exchange_functional print*,'exchange_functional ',exchange_functional
stop""" stop""")
print "endif" print("endif")
END_SHELL END_SHELL
END_PROVIDER END_PROVIDER

View File

@ -1,4 +1,4 @@
BEGIN_SHELL [ /usr/bin/env python2 ] BEGIN_SHELL [ /usr/bin/env python3 ]
from perturbation import perturbations from perturbation import perturbations
import os import os
@ -8,6 +8,6 @@ template = file.read()
file.close() file.close()
for p in perturbations: for p in perturbations:
print template.replace("$PERT",p) print(template.replace("$PERT",p))
END_SHELL END_SHELL

View File

@ -1,4 +1,4 @@
BEGIN_SHELL [ /usr/bin/env python2 ] BEGIN_SHELL [ /usr/bin/env python3 ]
import perturbation import perturbation
END_SHELL END_SHELL

View File

@ -7,11 +7,11 @@ BEGIN_PROVIDER [ double precision, eigenvectors_Fock_matrix_mo, (ao_num,mo_num)
integer :: i,j integer :: i,j
integer :: liwork, lwork, n, info integer :: liwork, lwork, n, info
integer, allocatable :: iwork(:) integer, allocatable :: iwork(:)
double precision, allocatable :: work(:), F(:,:), S(:,:) double precision, allocatable :: work(:), F(:,:), F_save(:,:)
double precision, allocatable :: diag(:) double precision, allocatable :: diag(:)
allocate( F(mo_num,mo_num) ) allocate( F(mo_num,mo_num), F_save(mo_num,mo_num) )
allocate (diag(mo_num) ) allocate (diag(mo_num) )
do j=1,mo_num do j=1,mo_num
@ -51,6 +51,7 @@ BEGIN_PROVIDER [ double precision, eigenvectors_Fock_matrix_mo, (ao_num,mo_num)
lwork = -1 lwork = -1
liwork = -1 liwork = -1
F_save = F
call dsyevd( 'V', 'U', mo_num, F, & call dsyevd( 'V', 'U', mo_num, F, &
size(F,1), diag, work, lwork, iwork, liwork, info) size(F,1), diag, work, lwork, iwork, liwork, info)
@ -71,6 +72,7 @@ BEGIN_PROVIDER [ double precision, eigenvectors_Fock_matrix_mo, (ao_num,mo_num)
if (info /= 0) then if (info /= 0) then
F = F_save
call dsyev( 'V', 'L', mo_num, F, & call dsyev( 'V', 'L', mo_num, F, &
size(F,1), diag, work, lwork, info) size(F,1), diag, work, lwork, info)
@ -83,7 +85,7 @@ BEGIN_PROVIDER [ double precision, eigenvectors_Fock_matrix_mo, (ao_num,mo_num)
call dgemm('N','N',ao_num,mo_num,mo_num, 1.d0, & call dgemm('N','N',ao_num,mo_num,mo_num, 1.d0, &
mo_coef, size(mo_coef,1), F, size(F,1), & mo_coef, size(mo_coef,1), F, size(F,1), &
0.d0, eigenvectors_Fock_matrix_mo, size(eigenvectors_Fock_matrix_mo,1)) 0.d0, eigenvectors_Fock_matrix_mo, size(eigenvectors_Fock_matrix_mo,1))
deallocate(work, F, diag) deallocate(work, F, F_save, diag)
END_PROVIDER END_PROVIDER

View File

@ -299,6 +299,7 @@ END_DOC
Fock_matrix_AO_(i,j) = 0.d0 Fock_matrix_AO_(i,j) = 0.d0
enddo enddo
do k=1,dim_DIIS do k=1,dim_DIIS
if (dabs(X_vector_DIIS(k)) < 1.d-10) cycle
do i=1,ao_num do i=1,ao_num
Fock_matrix_AO_(i,j) = Fock_matrix_AO_(i,j) + & Fock_matrix_AO_(i,j) = Fock_matrix_AO_(i,j) + &
X_vector_DIIS(k)*Fock_matrix_DIIS(i,j,dim_DIIS-k+1) X_vector_DIIS(k)*Fock_matrix_DIIS(i,j,dim_DIIS-k+1)

View File

@ -0,0 +1,34 @@
program print_energy
implicit none
BEGIN_DOC
! Prints the energy of the wave function stored in the |EZFIO| directory.
END_DOC
! this has to be done in order to be sure that N_det, psi_det and
! psi_coef_sorted are the wave function stored in the |EZFIO| directory.
read_wf = .True.
touch read_wf
call run
end
subroutine run
implicit none
integer :: i
double precision :: i_H_psi_array(N_states)
double precision :: E(N_states)
double precision :: norm(N_states)
E(:) = nuclear_repulsion
norm(:) = 0.d0
do i=1,N_det
call i_H_psi(psi_det(1,1,i), psi_det, psi_coef, N_int, N_det, &
size(psi_coef,1), N_states, i_H_psi_array)
norm(:) += psi_coef(i,:)**2
E(:) += i_H_psi_array(:) * psi_coef(i,:)
enddo
print *, 'Energy:'
do i=1,N_states
print *, E(i)/norm(i)
enddo
end

View File

@ -0,0 +1,29 @@
program print_hamiltonian
implicit none
BEGIN_DOC
! Prints the Hamiltonian matrix defined in the space of determinants
! present in the |EZFIO| directory.
END_DOC
! this has to be done in order to be sure that N_det, psi_det and
! psi_coef_sorted are the wave function stored in the |EZFIO| directory.
read_wf = .True.
touch read_wf
call run
end
subroutine run
implicit none
integer :: i, j
double precision :: hij
do j=1,N_det
do i=1,N_det
call i_H_j(psi_det(1,1,i), psi_det(1,1,j), N_int, hij)
if (dabs(hij) > 1.d-20) then
print *, i, j, hij
endif
enddo
enddo
end

View File

@ -1,4 +1,4 @@
module f77_zmq module f77_zmq
include 'f77_zmq.h' include 'f77_zmq_free.h'
end module end module

View File

@ -1,11 +1,11 @@
#!/usr/bin/env python2 #!/usr/bin/env python3
import sys import sys
with open(sys.argv[1],'r') as f: with open(sys.argv[1],'r') as f:
raw_data = f.read() raw_data = f.read()
print "set -x" print("set -x")
output = [] output = []
inside = False inside = False
@ -25,9 +25,9 @@ for i in raw_data:
level -= 1 level -= 1
output.append(new_i) output.append(new_i)
print "".join(output).replace("@test ", print("".join(output).replace("@test ",
"""[[ -z $BATS_TEST_NUMBER ]] && BATS_TEST_NUMBER=0 || ((++BATS_TEST_NUMBER)) ; """[[ -z $BATS_TEST_NUMBER ]] && BATS_TEST_NUMBER=0 || ((++BATS_TEST_NUMBER)) ;
export BATS_TEST_DESCRIPTION=""").replace("skip","return") export BATS_TEST_DESCRIPTION=""").replace("skip","return"))