mirror of
https://github.com/QuantumPackage/qp2.git
synced 2024-12-21 11:03:29 +01:00
First python3 3 working installation
This commit is contained in:
parent
3d3c7fbc1a
commit
79f47d024b
@ -36,7 +36,7 @@ Requirements
|
||||
- Fortran compiler : GNU Fortran, Intel Fortran or IBM XL Fortran
|
||||
- `GNU make`_
|
||||
- `Autoconf`_
|
||||
- `Python`_ > 2.6
|
||||
- `Python`_ > 3.0
|
||||
- |IRPF90| : Fortran code generator
|
||||
- |EZFIO| : Easy Fortran Input/Output library generator
|
||||
- |BLAS| and |LAPACK|
|
||||
@ -370,11 +370,11 @@ Docopt
|
||||
|
||||
*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
|
||||
|
||||
pip2 install --user docopt
|
||||
python3 -m pip install --user docopt
|
||||
|
||||
Otherwise,
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
@ -12,7 +12,7 @@ Usage:
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import sys
|
||||
import os
|
||||
import subprocess
|
||||
|
28
bin/qp_name
28
bin/qp_name
@ -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
|
||||
@ -30,7 +30,7 @@ try:
|
||||
from docopt import docopt
|
||||
from qp_path import QP_SRC, QP_ROOT
|
||||
except ImportError:
|
||||
print "source .quantum_package.rc"
|
||||
print("source .quantum_package.rc")
|
||||
raise
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ def main(arguments):
|
||||
"""Main function"""
|
||||
|
||||
# Check that name exist in */IRPF90_man
|
||||
print "Checking that name exists..."
|
||||
print("Checking that name exists...")
|
||||
all_modules = os.listdir(QP_SRC)
|
||||
|
||||
f = arguments["<name>"]+".l"
|
||||
@ -52,21 +52,21 @@ def main(arguments):
|
||||
if found: break
|
||||
|
||||
if not found:
|
||||
print "Error:"
|
||||
print "The variable/subroutine/function \""+arguments["<name>"] \
|
||||
+ "\" was not found in the sources."
|
||||
print "Did you compile the code at the root?"
|
||||
print "Continue? [y/N] ",
|
||||
print("Error:")
|
||||
print("The variable/subroutine/function \""+arguments["<name>"] \
|
||||
+ "\" was not found in the sources.")
|
||||
print("Did you compile the code at the root?")
|
||||
print("Continue? [y/N] ", end=' ')
|
||||
cont = sys.stdin.read(1).strip() in ["y", "Y"]
|
||||
if not cont:
|
||||
print "Aborted"
|
||||
print("Aborted")
|
||||
sys.exit(1)
|
||||
|
||||
# Now search in all the files
|
||||
if arguments["--rename"]:
|
||||
print "Replacing..."
|
||||
print("Replacing...")
|
||||
else:
|
||||
print "Searching..."
|
||||
print("Searching...")
|
||||
|
||||
name = re.compile(r"\b"+arguments["<name>"]+r"\b", re.IGNORECASE)
|
||||
|
||||
@ -84,15 +84,15 @@ def main(arguments):
|
||||
with open(filename, "r") as f:
|
||||
f_in = f.read()
|
||||
if name.search(f_in):
|
||||
print filename
|
||||
print(filename)
|
||||
if arguments["--rename"]:
|
||||
f_new = name.sub(arguments["--rename"], f_in)
|
||||
with open(filename, "w") as f:
|
||||
f.write(f_new)
|
||||
|
||||
print "Done"
|
||||
print("Done")
|
||||
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)
|
||||
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Usage:
|
||||
@ -43,9 +43,9 @@ try:
|
||||
from module_handler import get_l_module_descendant
|
||||
from qp_path import QP_SRC, QP_PLUGINS, QP_DATA, QP_ROOT
|
||||
except ImportError:
|
||||
print "Please check if you have sourced the ${QP_ROOT}/quantum_package.rc"
|
||||
print "(`source ${QP_ROOT}/quantum_package.rc`)"
|
||||
print sys.exit(1)
|
||||
print("Please check if you have sourced the ${QP_ROOT}/quantum_package.rc")
|
||||
print("(`source ${QP_ROOT}/quantum_package.rc`)")
|
||||
print(sys.exit(1))
|
||||
|
||||
|
||||
def save_new_module(path, l_child):
|
||||
@ -58,7 +58,7 @@ def save_new_module(path, l_child):
|
||||
try:
|
||||
os.makedirs(path)
|
||||
except OSError:
|
||||
print "The module ({0}) already exists...".format(path)
|
||||
print("The module ({0}) already exists...".format(path))
|
||||
sys.exit(1)
|
||||
|
||||
with open(os.path.join(path, "NEED"), "w") as f:
|
||||
@ -105,7 +105,7 @@ def main(arguments):
|
||||
if arguments["list"]:
|
||||
if arguments["--repositories"]:
|
||||
for repo in get_repositories():
|
||||
print repo
|
||||
print(repo)
|
||||
|
||||
else:
|
||||
# Search in QP_PLUGINS all directories with a NEED file
|
||||
@ -121,7 +121,7 @@ def main(arguments):
|
||||
for (x, y) in l_tmp:
|
||||
d_tmp[x] = y
|
||||
repo_of_plugin[y] = x.replace(QP_PLUGINS+'/','')
|
||||
l_repository = d_tmp.keys()
|
||||
l_repository = list(d_tmp.keys())
|
||||
if l_repository == []:
|
||||
l_result = []
|
||||
else:
|
||||
@ -142,7 +142,7 @@ def main(arguments):
|
||||
l_result = [f for f in l_plugins if f not in l_installed]
|
||||
|
||||
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"]:
|
||||
@ -159,29 +159,29 @@ def main(arguments):
|
||||
|
||||
path = os.path.join(QP_PLUGINS, repository, name)
|
||||
|
||||
print "Created plugin:"
|
||||
print path, '\n'
|
||||
print("Created plugin:")
|
||||
print(path, '\n')
|
||||
|
||||
for children in l_children:
|
||||
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)
|
||||
|
||||
print "Needed modules:"
|
||||
print l_children, '\n'
|
||||
print("Needed modules:")
|
||||
print(l_children, '\n')
|
||||
|
||||
print "This corresponds to using the following modules:"
|
||||
print l_children + m_instance.l_descendant_unique(l_children), '\n'
|
||||
print("This corresponds to using the following modules:")
|
||||
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)
|
||||
print l_child_reduce, '\n'
|
||||
print(l_child_reduce, '\n')
|
||||
|
||||
print "Installation",
|
||||
print("Installation", end=' ')
|
||||
save_new_module(path, l_child_reduce)
|
||||
|
||||
print " [ OK ]"
|
||||
print ""
|
||||
print(" [ OK ]")
|
||||
print("")
|
||||
arguments["create"] = False
|
||||
arguments["install"] = True
|
||||
main(arguments)
|
||||
@ -228,7 +228,7 @@ def main(arguments):
|
||||
for (x, y) in [os.path.split(f) for f in l_tmp]:
|
||||
d_repo_of_plugin[y] = x
|
||||
d_repo[x] = None
|
||||
l_repository = d_repo.keys()
|
||||
l_repository = list(d_repo.keys())
|
||||
|
||||
d_plugin = get_dict_child(l_repository)
|
||||
|
||||
@ -236,7 +236,7 @@ def main(arguments):
|
||||
d_child.update(d_plugin)
|
||||
|
||||
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
|
||||
|
||||
l_name = [normalize_case[name.lower()] for name in arguments["<name>"]]
|
||||
@ -244,7 +244,7 @@ def main(arguments):
|
||||
for name in l_name:
|
||||
|
||||
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)
|
||||
|
||||
@ -252,10 +252,10 @@ def main(arguments):
|
||||
|
||||
if l_module_to_cp:
|
||||
|
||||
print "Required dependencies:"
|
||||
print l_module_to_cp
|
||||
print("Required dependencies:")
|
||||
print(l_module_to_cp)
|
||||
|
||||
print "Installation...",
|
||||
print("Installation...", end=' ')
|
||||
|
||||
for module_to_cp in l_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])
|
||||
os.chdir(wd)
|
||||
except OSError:
|
||||
print "The src directory is broken. Please remove %s" % des
|
||||
print("The src directory is broken. Please remove %s" % des)
|
||||
raise
|
||||
subprocess.check_call(["qp_create_ninja", "update"])
|
||||
print "[ OK ]"
|
||||
print("[ OK ]")
|
||||
|
||||
elif arguments["uninstall"]:
|
||||
|
||||
@ -285,17 +285,17 @@ def main(arguments):
|
||||
l_failed = [name for name in l_name if name not in d_local]
|
||||
|
||||
if l_failed:
|
||||
print "Plugins not installed:"
|
||||
print("Plugins not installed:")
|
||||
for name in sorted(l_failed):
|
||||
print "%s" % name
|
||||
print("%s" % name)
|
||||
sys.exit(1)
|
||||
|
||||
l_name_to_remove = l_name + \
|
||||
[module for module in m_instance.l_module \
|
||||
for name in l_name if name in d_descendant[module]]
|
||||
|
||||
print "Removing plugins:"
|
||||
print l_name_to_remove
|
||||
print("Removing plugins:")
|
||||
print(l_name_to_remove)
|
||||
|
||||
for module in set(l_name_to_remove):
|
||||
|
||||
@ -310,7 +310,7 @@ def main(arguments):
|
||||
try:
|
||||
os.unlink(os.path.join(QP_SRC, module))
|
||||
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"]:
|
||||
@ -321,7 +321,7 @@ def main(arguments):
|
||||
l_repositories = get_repositories()
|
||||
|
||||
for repo in l_repositories:
|
||||
print "Updating ", repo
|
||||
print("Updating ", repo)
|
||||
os.chdir(os.path.join(QP_PLUGINS,repo))
|
||||
git_cmd=["git", "pull"]
|
||||
subprocess.check_call(git_cmd)
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
|
||||
|
||||
"""
|
||||
@ -23,7 +23,7 @@ import os.path
|
||||
try:
|
||||
import qp_path
|
||||
except ImportError:
|
||||
print "source .quantum_package.rc"
|
||||
print("source .quantum_package.rc")
|
||||
raise
|
||||
|
||||
from docopt import docopt
|
||||
@ -62,7 +62,7 @@ def main(arguments):
|
||||
mo_num = ezfio.mo_basis_mo_num
|
||||
|
||||
if arguments["--query"]:
|
||||
print n_frozen
|
||||
print(n_frozen)
|
||||
sys.exit(0)
|
||||
|
||||
if n_frozen == 0:
|
||||
|
18
bin/qp_test
18
bin/qp_test
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
@ -21,8 +21,8 @@ try:
|
||||
from docopt import docopt
|
||||
from qp_path import QP_SRC, QP_TESTS
|
||||
except ImportError:
|
||||
print "Please check if you have sourced the ${QP_ROOT}/quantum_package.rc"
|
||||
print "(`source ${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`)")
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
@ -54,11 +54,11 @@ def main(arguments):
|
||||
os.chdir(QP_TESTS)
|
||||
|
||||
for bats_file in l_bats:
|
||||
print ""
|
||||
print "-~-~-~-~-~-~"
|
||||
print ""
|
||||
print "Running tests for %s"%(bats_file)
|
||||
print ""
|
||||
print("")
|
||||
print("-~-~-~-~-~-~")
|
||||
print("")
|
||||
print("Running tests for %s"%(bats_file))
|
||||
print("")
|
||||
if arguments["-v"]:
|
||||
p = None
|
||||
if arguments["TEST"]:
|
||||
@ -66,7 +66,7 @@ def main(arguments):
|
||||
else:
|
||||
test = ""
|
||||
try:
|
||||
os.system(test+" python2 bats_to_sh.py "+bats_file+
|
||||
os.system(test+" python3 bats_to_sh.py "+bats_file+
|
||||
"| bash")
|
||||
except:
|
||||
if p:
|
||||
|
6
configure
vendored
6
configure
vendored
@ -17,14 +17,14 @@ export CC=gcc
|
||||
|
||||
# /!\ When updating version, update also etc files
|
||||
|
||||
EZFIO_TGZ="EZFIO.1.6.2.tar.gz"
|
||||
EZFIO_TGZ="EZFIO.2.0.2.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"
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
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"
|
||||
@ -154,7 +154,7 @@ function find_exe() {
|
||||
}
|
||||
|
||||
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() {
|
||||
|
@ -14,7 +14,7 @@ help:
|
||||
.PHONY: help Makefile 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
|
||||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||
|
@ -1,9 +1,9 @@
|
||||
#!/usr/bin/env python2
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
import ConfigParser
|
||||
import configparser
|
||||
|
||||
from module_handler import get_binaries
|
||||
|
||||
@ -27,7 +27,7 @@ def generate_modules(abs_module, entities):
|
||||
EZFIO = os.path.join(abs_module,'EZFIO.cfg')
|
||||
if os.path.exists(EZFIO):
|
||||
rst += ["", "EZFIO parameters", "----------------", ""]
|
||||
config_file = ConfigParser.ConfigParser()
|
||||
config_file = configparser.ConfigParser()
|
||||
with open(EZFIO, 'r') as f:
|
||||
config_file.readfp(f)
|
||||
for section in config_file.sections():
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Configuration of IRPF90 package
|
||||
|
||||
# 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 IRPF90=${IRPF90_PATH}/bin/irpf90
|
||||
|
BIN
external/EZFIO.1.6.2.tar.gz
vendored
BIN
external/EZFIO.1.6.2.tar.gz
vendored
Binary file not shown.
BIN
external/EZFIO.2.0.2.tar.gz
vendored
Normal file
BIN
external/EZFIO.2.0.2.tar.gz
vendored
Normal file
Binary file not shown.
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Save the .o from a .f90
|
||||
and is the .o is asked a second time, retur it
|
||||
@ -13,9 +13,9 @@ import re
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
r = re.compile(ur'-c\s+(\S+\.[fF]90)\s+-o\s+(\S+\.o)')
|
||||
p = re.compile(ur'-I IRPF90_temp/\S*\s+')
|
||||
mod = re.compile(ur'module\s+(?P<mod>\S+).+end\s?module\s+(?P=mod)?',
|
||||
r = re.compile(r'-c\s+(\S+\.[fF]90)\s+-o\s+(\S+\.o)')
|
||||
p = re.compile(r'-I IRPF90_temp/\S*\s+')
|
||||
mod = re.compile(r'module\s+(?P<mod>\S+).+end\s?module\s+(?P=mod)?',
|
||||
re.MULTILINE | re.IGNORECASE)
|
||||
|
||||
tmpdir_root = os.environ.get("TMPDIR", failobj="/dev/shm")
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Usage: qp_create_ninja create <config_file> (--development | --production)
|
||||
@ -24,7 +24,7 @@ except ImportError:
|
||||
"..",
|
||||
"quantum_package.rc"))
|
||||
|
||||
print "\n".join(["", "Error:", "source %s" % f, ""])
|
||||
print("\n".join(["", "Error:", "source %s" % f, ""]))
|
||||
sys.exit(1)
|
||||
|
||||
# Compress path
|
||||
@ -124,7 +124,7 @@ def dict_module_genelogy_path(d_module_genelogy):
|
||||
d_module_genelogy
|
||||
"""
|
||||
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)
|
||||
|
||||
p = Path(module_abs, module_rel)
|
||||
@ -235,11 +235,11 @@ def ninja_ezfio_cfg_build(l_util):
|
||||
"""
|
||||
l_string = []
|
||||
|
||||
for m in l_util.itervalues():
|
||||
for m in l_util.values():
|
||||
|
||||
str_ = "build {1} {2}: build_ezfio_interface {0}"
|
||||
l_string += [str_.format(*map(comp_path,(m.ez_cfg.abs, m.ez_interface.abs,
|
||||
m.ez_config.abs)))]
|
||||
l_string += [str_.format(*list(map(comp_path,(m.ez_cfg.abs, m.ez_interface.abs,
|
||||
m.ez_config.abs))))]
|
||||
|
||||
l_string += [" sub_module = {0}".format(comp_path(m.ez_module.abs))]
|
||||
l_string += [""]
|
||||
@ -257,8 +257,8 @@ def ninja_ezfio_config_build(l_ezfio_config):
|
||||
file_source = m.path_in_module
|
||||
file_create = m.path_in_ezfio
|
||||
|
||||
l_string += ["build {0}: build_ezfio_config {1}".format(*map(comp_path,(file_create,
|
||||
file_source)))]
|
||||
l_string += ["build {0}: build_ezfio_config {1}".format(*list(map(comp_path,(file_create,
|
||||
file_source))))]
|
||||
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_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)))
|
||||
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:
|
||||
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
|
||||
|
||||
@ -360,7 +360,7 @@ def ninja_gitignore_build(path_module, d_binaries, l_symlink):
|
||||
|
||||
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,
|
||||
" ".join(l_b))
|
||||
@ -420,9 +420,9 @@ def get_file_dependency(d_info_module):
|
||||
"""
|
||||
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"]:
|
||||
values = [join(module.abs, o) for o in values]
|
||||
if key in ["l_obj"]:
|
||||
@ -431,7 +431,7 @@ def get_file_dependency(d_info_module):
|
||||
d_irp[module][key] = values
|
||||
|
||||
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"]:
|
||||
values = [join(module.abs, children.rel, o)
|
||||
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 #
|
||||
# ~#~#~#~#~#~#~#~#~#~ #
|
||||
|
||||
l_depend = map(comp_path,d_irp[path_module]["l_depend"])
|
||||
l_src = map(comp_path,d_irp[path_module]["l_src"])
|
||||
l_obj = map(comp_path,d_irp[path_module]["l_obj"])
|
||||
l_template = map(comp_path,d_irp[path_module]["l_template"])
|
||||
l_depend = list(map(comp_path,d_irp[path_module]["l_depend"]))
|
||||
l_src = list(map(comp_path,d_irp[path_module]["l_src"]))
|
||||
l_obj = list(map(comp_path,d_irp[path_module]["l_obj"]))
|
||||
l_template = list(map(comp_path,d_irp[path_module]["l_template"]))
|
||||
|
||||
if l_needed_molule:
|
||||
l_symlink = ["l_symlink_{0}".format(path_module.rel)]
|
||||
@ -544,6 +544,7 @@ def get_binaries(path_module):
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
stdout, stderr = process.communicate()
|
||||
stdout = stdout.decode()
|
||||
except OSError:
|
||||
return []
|
||||
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")
|
||||
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 #
|
||||
@ -658,7 +659,7 @@ def ninja_binaries_build(path_module, l_children, 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")
|
||||
|
||||
@ -829,14 +830,14 @@ if __name__ == "__main__":
|
||||
dict_root = module_instance.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 #
|
||||
# ~#~#~#~#~#~#~#~#~#~#~#~#~ #
|
||||
|
||||
d_binaries = get_dict_binaries(l_all_module, mode="development")
|
||||
l_module = d_binaries.keys()
|
||||
l_module = list(d_binaries.keys())
|
||||
|
||||
|
||||
# ~#~#~#~#~#~#~#~#~#~#~#~ #
|
||||
|
@ -1,8 +1,8 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os, sys
|
||||
import ConfigParser
|
||||
import configparser
|
||||
|
||||
|
||||
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
|
||||
"""
|
||||
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)
|
||||
|
||||
config = ConfigParser.ConfigParser()
|
||||
config = configparser.ConfigParser(inline_comment_prefixes=(';','#'))
|
||||
config.read(pwd_cfg)
|
||||
|
||||
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:
|
||||
try:
|
||||
l.extend(config.get(section, flag_name).split())
|
||||
except ConfigParser.NoOptionError:
|
||||
except configparser.NoOptionError:
|
||||
pass
|
||||
|
||||
return " ".join(l)
|
||||
@ -43,5 +43,5 @@ if __name__ == '__main__':
|
||||
qpackage_root = os.environ['QP_ROOT']
|
||||
pwd_cfg = os.path.join(qpackage_root, "config/ifort_gpi2.cfg")
|
||||
|
||||
print get_compilation_option(pwd_cfg, "FC")
|
||||
print get_compilation_option(pwd_cfg, "FCFLAGS")
|
||||
print(get_compilation_option(pwd_cfg, "FC"))
|
||||
print(get_compilation_option(pwd_cfg, "FCFLAGS"))
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Welcome to the ei_handler.
|
||||
@ -72,7 +72,7 @@ import sys
|
||||
import os
|
||||
import os.path
|
||||
|
||||
import ConfigParser
|
||||
import configparser
|
||||
|
||||
from collections import defaultdict
|
||||
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 #
|
||||
# ~#~#~#~#~#~#~#~#~#~#~ #
|
||||
|
||||
config_file = ConfigParser.ConfigParser()
|
||||
config_file.readfp(open(module_obj.path))
|
||||
config_file = configparser.ConfigParser()
|
||||
config_file.read_file(open(module_obj.path))
|
||||
|
||||
# ~#~#~#~#~#~#~#~#~ #
|
||||
# F i l l _ d i c t #
|
||||
@ -229,7 +229,7 @@ def get_dict_config_file(module_obj):
|
||||
|
||||
def error(o, p, c):
|
||||
"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():
|
||||
# pvd = provider
|
||||
@ -245,13 +245,13 @@ def get_dict_config_file(module_obj):
|
||||
# Check if type is avalaible
|
||||
try:
|
||||
type_ = config_file.get(section, "type").strip()
|
||||
except ConfigParser.NoOptionError:
|
||||
except configparser.NoOptionError:
|
||||
error("type", pvd, module_obj.path)
|
||||
sys.exit(1)
|
||||
|
||||
if type_ not in type_dict:
|
||||
print "{0} not avalaible. Choose in:".format(type_).strip()
|
||||
print ", ".join(sorted([i for i in type_dict]))
|
||||
print("{0} not avalaible. Choose in:".format(type_).strip())
|
||||
print(", ".join(sorted([i for i in type_dict])))
|
||||
sys.exit(1)
|
||||
else:
|
||||
d[pvd]["type"] = type_dict[type_]
|
||||
@ -259,18 +259,18 @@ def get_dict_config_file(module_obj):
|
||||
# Fill the dict with REQUIRED information
|
||||
try:
|
||||
d[pvd]["doc"] = config_file.get(section, "doc")
|
||||
except ConfigParser.NoOptionError:
|
||||
except configparser.NoOptionError:
|
||||
error("doc", pvd, module_obj.path)
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
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)
|
||||
sys.exit(1)
|
||||
else:
|
||||
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)
|
||||
else:
|
||||
d[pvd]["interface"] = interface
|
||||
@ -279,7 +279,7 @@ def get_dict_config_file(module_obj):
|
||||
for option in l_info_optional:
|
||||
try:
|
||||
d[pvd][option] = config_file.get(section, option).lower()
|
||||
except ConfigParser.NoOptionError:
|
||||
except configparser.NoOptionError:
|
||||
if option in d_default:
|
||||
d[pvd][option] = d_default[option]
|
||||
|
||||
@ -287,7 +287,7 @@ def get_dict_config_file(module_obj):
|
||||
|
||||
try:
|
||||
default_raw = config_file.get(section, "default")
|
||||
except ConfigParser.NoOptionError:
|
||||
except configparser.NoOptionError:
|
||||
if "ocaml" in d[pvd]["interface"]:
|
||||
error("default", pvd, module_obj.path)
|
||||
sys.exit(1)
|
||||
@ -322,7 +322,7 @@ def create_ezfio_provider(dict_ezfio_cfg):
|
||||
dict_code_provider = dict()
|
||||
|
||||
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"]:
|
||||
ez_p.set_type(dict_info['type'].fortran)
|
||||
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),
|
||||
"\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)
|
||||
|
||||
@ -381,22 +381,22 @@ def create_ezfio_stuff(dict_ezfio_cfg, config_or_default="config"):
|
||||
def size_format_to_ezfio(size_raw):
|
||||
"""
|
||||
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
|
||||
If the value are between parenthses -> do nothing; return
|
||||
If the values are between parenthses -> do nothing; return
|
||||
"""
|
||||
|
||||
size_raw = str(size_raw)
|
||||
if size_raw.startswith('='):
|
||||
size_convert = size_raw.replace('.', '_')
|
||||
else:
|
||||
size_raw = provider_info["size"].translate(None, "()")
|
||||
size_raw = provider_info["size"].translate(str.maketrans("","","()"))
|
||||
size_raw = size_raw.replace('.', '_')
|
||||
|
||||
a_size_raw = []
|
||||
for dim in size_raw.split(","):
|
||||
try:
|
||||
(begin, end) = map(str.strip, dim.split(":"))
|
||||
(begin, end) = list(map(str.strip, dim.split(":")))
|
||||
except ValueError:
|
||||
a_size_raw.append(dim)
|
||||
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_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_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
|
||||
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):
|
||||
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
|
||||
else:
|
||||
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
|
||||
name_raw = provider_info["ezfio_name"].lower()
|
||||
@ -532,7 +532,7 @@ def create_ocaml_input(dict_ezfio_cfg, module_lower):
|
||||
l_type = []
|
||||
l_doc = []
|
||||
|
||||
for k, v in dict_ezfio_cfg.iteritems():
|
||||
for k, v in dict_ezfio_cfg.items():
|
||||
if "ocaml" in v['interface']:
|
||||
l_ezfio_name.append(v['ezfio_name'])
|
||||
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:
|
||||
continue
|
||||
@ -655,7 +655,7 @@ def get_l_module_with_auto_generate_ocaml_lower():
|
||||
|
||||
l_module_lower = []
|
||||
import re
|
||||
p = re.compile(ur'interface:.*ocaml')
|
||||
p = re.compile(r'interface:.*ocaml')
|
||||
|
||||
for f in l_folder:
|
||||
path = "{0}/{1}/EZFIO.cfg".format(QP_SRC, f)
|
||||
@ -782,7 +782,7 @@ if __name__ == "__main__":
|
||||
#
|
||||
if arguments["list_supported_types"]:
|
||||
for i in sorted(get_type_dict()):
|
||||
print i
|
||||
print(i)
|
||||
sys.exit(0)
|
||||
|
||||
if arguments["ocaml_global"]:
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
This program generates all the
|
||||
OCaml templates needed by qp_edit
|
||||
@ -17,12 +17,12 @@ class EZFIO_ocaml(object):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
|
||||
for k, v in kwargs.iteritems():
|
||||
for k, v in kwargs.items():
|
||||
|
||||
try:
|
||||
exec "self.{0} = {1}".format(k, v)
|
||||
exec("self.{0} = {1}".format(k, v))
|
||||
except NameError:
|
||||
exec "self.{0} = '{1}'".format(k, v)
|
||||
exec("self.{0} = '{1}'".format(k, v))
|
||||
|
||||
@property
|
||||
def Ocaml_type(self):
|
||||
@ -39,7 +39,7 @@ class EZFIO_ocaml(object):
|
||||
def check_if_init(self, l_arg, name):
|
||||
for i in l_arg:
|
||||
try:
|
||||
exec "self.{0}".format(i)
|
||||
exec("self.{0}".format(i))
|
||||
except AttributeError:
|
||||
msg = "You need to provide a '{0}' for creating {1}"
|
||||
raise KeyError(msg.format(i, name))
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
|
||||
__author__ = "Applencourt PEP8"
|
||||
__date__ = "jeudi 26 mars 2015, 12:49:35 (UTC+0100)"
|
||||
@ -88,7 +88,7 @@ END_PROVIDER
|
||||
def __init__(self):
|
||||
self.values = "type doc name ezfio_dir ezfio_name write output".split()
|
||||
for v in self.values:
|
||||
exec "self.{0} = None".format(v)
|
||||
exec("self.{0} = None".format(v))
|
||||
|
||||
def __repr__(self):
|
||||
self.set_write()
|
||||
@ -96,7 +96,7 @@ END_PROVIDER
|
||||
for v in self.values:
|
||||
if not v:
|
||||
msg = "Error : %s is not set in EZFIO.cfg" % (v)
|
||||
print >>sys.stderr, msg
|
||||
print(msg, file=sys.stderr)
|
||||
sys.exit(1)
|
||||
if "size" not in self.__dict__:
|
||||
self.__dict__["size"] = ""
|
||||
@ -167,7 +167,7 @@ def test_module():
|
||||
T.set_ezfio_dir("Hartree_Fock")
|
||||
T.set_ezfio_name("thresh_SCF")
|
||||
T.set_output("output_Hartree_Fock")
|
||||
print T
|
||||
print(T)
|
||||
|
||||
if __name__ == '__main__':
|
||||
test_module()
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
|
||||
@ -155,7 +155,7 @@ class H_apply(object):
|
||||
|
||||
def __repr__(self):
|
||||
buffer = self.template
|
||||
for key,value in self.data.items():
|
||||
for key,value in list(self.data.items()):
|
||||
buffer = buffer.replace('$'+key, value)
|
||||
return buffer
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import random
|
||||
|
||||
@ -131,8 +131,8 @@ _ __ `/___ __ \__ ___/__ __ \
|
||||
|
||||
""" ]
|
||||
|
||||
print random.choice(hello)
|
||||
print "\n -- Quantum Package Shell --\n"
|
||||
print(random.choice(hello))
|
||||
print("\n -- Quantum Package Shell --\n")
|
||||
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Module utilitary
|
||||
@ -25,7 +25,7 @@ try:
|
||||
from docopt import docopt
|
||||
from qp_path import QP_SRC, QP_ROOT, QP_PLUGINS, QP_EZFIO
|
||||
except ImportError:
|
||||
print "source .quantum_package.rc"
|
||||
print("source .quantum_package.rc")
|
||||
raise
|
||||
|
||||
|
||||
@ -50,6 +50,7 @@ def get_binaries(path_module):
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
stdout, stderr = process.communicate()
|
||||
stdout = stdout.decode()
|
||||
except OSError:
|
||||
return []
|
||||
else:
|
||||
@ -106,9 +107,9 @@ def get_l_module_descendant(d_child, l_module):
|
||||
try:
|
||||
l.extend(get_l_module_descendant(d_child, d_child[module]))
|
||||
except KeyError:
|
||||
print >> sys.stderr, "Error: "
|
||||
print >> sys.stderr, "`{0}` is not a submodule".format(module)
|
||||
print >> sys.stderr, "Check the typo (spelling, case, '/', etc.) "
|
||||
print("Error: ", file=sys.stderr)
|
||||
print("`{0}` is not a submodule".format(module), file=sys.stderr)
|
||||
print("Check the typo (spelling, case, '/', etc.) ", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
return list(set(l))
|
||||
@ -120,7 +121,7 @@ class ModuleHandler():
|
||||
|
||||
@property
|
||||
def l_module(self):
|
||||
return self.dict_child.keys()
|
||||
return list(self.dict_child.keys())
|
||||
|
||||
@property
|
||||
def dict_parent(self):
|
||||
@ -132,7 +133,7 @@ class ModuleHandler():
|
||||
d = {}
|
||||
|
||||
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]]
|
||||
|
||||
return d
|
||||
@ -151,8 +152,8 @@ class ModuleHandler():
|
||||
d[module_name] = get_l_module_descendant(d_child,
|
||||
d_child[module_name])
|
||||
except KeyError:
|
||||
print "Check NEED for {0}".format(
|
||||
module_name)
|
||||
print("Check NEED for {0}".format(
|
||||
module_name))
|
||||
sys.exit(1)
|
||||
|
||||
return d
|
||||
@ -185,7 +186,7 @@ class ModuleHandler():
|
||||
for e in d_desc[module]:
|
||||
d[e] = 1
|
||||
|
||||
return d.keys()
|
||||
return list(d.keys())
|
||||
|
||||
def l_reduce_tree(self, l_module):
|
||||
"""For a list of module in input return only the root"""
|
||||
@ -218,8 +219,8 @@ if __name__ == '__main__':
|
||||
|
||||
for module in l_module:
|
||||
if not is_module(module):
|
||||
print "{0} is not a valid module. Abort".format(module)
|
||||
print "No NEED in it"
|
||||
print("{0} is not a valid module. Abort".format(module))
|
||||
print("No NEED in it")
|
||||
sys.exit(1)
|
||||
|
||||
m = ModuleHandler()
|
||||
@ -227,7 +228,7 @@ if __name__ == '__main__':
|
||||
if arguments['print_descendant']:
|
||||
|
||||
for module in l_module:
|
||||
print " ".join(sorted(m.l_descendant_unique([module])))
|
||||
print(" ".join(sorted(m.l_descendant_unique([module]))))
|
||||
|
||||
if arguments["clean"]:
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
from qp_path import QP_SRC
|
||||
@ -7,7 +7,7 @@ Pert_dir = os.path.join(QP_SRC,"perturbation")
|
||||
|
||||
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)
|
||||
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__':
|
||||
print 'Perturbations:'
|
||||
print('Perturbations:')
|
||||
for k in perturbations:
|
||||
print '* ', k
|
||||
print('* ', k)
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import urllib
|
||||
import urllib.request, urllib.parse, urllib.error
|
||||
import sys
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
@ -35,11 +35,11 @@ def clean_up(text):
|
||||
return False
|
||||
else:
|
||||
return y[0] in irred
|
||||
data = filter(f,data)[:len(irred)]
|
||||
data = list(filter(f,data))[:len(irred)]
|
||||
for line in data:
|
||||
s = line.replace('*','').split()
|
||||
l = irred[s[0]]
|
||||
data[l] = map(float,s[1:len(irred)+1])
|
||||
data[l] = list(map(float,s[1:len(irred)+1]))
|
||||
|
||||
d = {}
|
||||
e = {}
|
||||
@ -48,23 +48,23 @@ def clean_up(text):
|
||||
for k in sop:
|
||||
e[sop[k]] = k
|
||||
n = len(irred)
|
||||
print "Group\t", group, "\nn\t", n
|
||||
print "\n \tIrred \tOperation"
|
||||
print("Group\t", group, "\nn\t", n)
|
||||
print("\n \tIrred \tOperation")
|
||||
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):
|
||||
print "%8s "%(str(j+1).center(8)),
|
||||
print("%8s "%(str(j+1).center(8)), end=' ')
|
||||
for i in range(n):
|
||||
print "\n%4d "%(i+1),
|
||||
print("\n%4d "%(i+1), end=' ')
|
||||
for j in range(n):
|
||||
print "%8.5f "%(data[i][j]),
|
||||
print "\n"
|
||||
print("%8.5f "%(data[i][j]), end=' ')
|
||||
print("\n")
|
||||
|
||||
def main():
|
||||
for group in sys.argv[1:]:
|
||||
f = urllib.urlopen(address%(group))
|
||||
f = urllib.request.urlopen(address%(group))
|
||||
html = f.read().split('\n',1)[1]
|
||||
text = clean_up(html)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
|
||||
BIT_KIND_SIZE=64
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
! Generates subroutine H_apply_cis
|
||||
! --------------------------------
|
||||
|
||||
BEGIN_SHELL [ /usr/bin/env python2 ]
|
||||
BEGIN_SHELL [ /usr/bin/env python3 ]
|
||||
from generate_h_apply import H_apply
|
||||
H = H_apply("cis",do_double_exc=False)
|
||||
print H
|
||||
print(H)
|
||||
|
||||
H = H_apply("cis_sym",do_double_exc=False)
|
||||
H.filter_only_connected_to_hf()
|
||||
print H
|
||||
print(H)
|
||||
|
||||
END_SHELL
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
! Generates subroutine H_apply_cisd
|
||||
! ----------------------------------
|
||||
|
||||
BEGIN_SHELL [ /usr/bin/env python2 ]
|
||||
BEGIN_SHELL [ /usr/bin/env python3 ]
|
||||
from generate_h_apply import H_apply
|
||||
H = H_apply("cisd",do_double_exc=True)
|
||||
print H
|
||||
print(H)
|
||||
|
||||
H = H_apply("cisd_sym",do_double_exc=True)
|
||||
H.filter_only_connected_to_hf()
|
||||
print H
|
||||
print(H)
|
||||
END_SHELL
|
||||
|
||||
|
@ -12,14 +12,12 @@ default: 0.5
|
||||
|
||||
[no_core_density]
|
||||
type: character*(32)
|
||||
doc: Type of density
|
||||
doc: if [no_core_dm] then all elements of the density matrix involving at least one orbital set as core are set to zero
|
||||
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
|
||||
interface: ezfio, provider, ocaml
|
||||
default: full_density
|
||||
|
||||
[normalize_dm]
|
||||
type: logical
|
||||
doc: Type of density
|
||||
doc: if .True., then you normalize the no_core_dm to elec_alpha_num - n_core_orb and elec_beta_num - n_core_orb
|
||||
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
|
||||
interface: ezfio, provider, ocaml
|
||||
default: True
|
||||
|
@ -76,7 +76,6 @@ type: integer
|
||||
interface: ezfio
|
||||
doc: Number of determinants to print in qp_edit
|
||||
type: integer
|
||||
interface: ezfio
|
||||
|
||||
[psi_coef]
|
||||
interface: ezfio
|
||||
|
@ -4,7 +4,7 @@ BEGIN_PROVIDER [double precision, energy_x, (N_states)]
|
||||
! correlation energies general providers.
|
||||
END_DOC
|
||||
|
||||
BEGIN_SHELL [ /usr/bin/env python2 ]
|
||||
BEGIN_SHELL [ /usr/bin/env python3 ]
|
||||
import os
|
||||
import glob
|
||||
from qp_path import QP_SRC
|
||||
@ -13,16 +13,16 @@ os.chdir(funcdir)
|
||||
functionals = map(lambda x : x.replace(".irp.f",""), glob.glob("*.irp.f"))
|
||||
prefix = ""
|
||||
for f in functionals:
|
||||
print """
|
||||
print("""
|
||||
%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 "
|
||||
print """
|
||||
print("""
|
||||
else
|
||||
print *, 'exchange functional required does not exist ...'
|
||||
print *, 'exchange_functional ',exchange_functional
|
||||
stop"""
|
||||
print "endif"
|
||||
stop""")
|
||||
print("endif")
|
||||
|
||||
END_SHELL
|
||||
|
||||
@ -38,7 +38,7 @@ print "endif"
|
||||
! correlation and exchange energies general providers.
|
||||
END_DOC
|
||||
|
||||
BEGIN_SHELL [ /usr/bin/env python2 ]
|
||||
BEGIN_SHELL [ /usr/bin/env python3 ]
|
||||
import os
|
||||
import glob
|
||||
from qp_path import QP_SRC
|
||||
@ -47,17 +47,17 @@ os.chdir(funcdir)
|
||||
functionals = map(lambda x : x.replace(".irp.f",""), glob.glob("*.irp.f"))
|
||||
prefix = ""
|
||||
for f in functionals:
|
||||
print """
|
||||
print("""
|
||||
%sif (trim(correlation_functional) == '%s') then
|
||||
energy_c = energy_c_%s"""%(prefix, f, f)
|
||||
energy_c = energy_c_%s"""%(prefix, f, f) )
|
||||
prefix = "else "
|
||||
|
||||
print """
|
||||
print("""
|
||||
else
|
||||
print*, 'Correlation functional required does not exist ...'
|
||||
print*,'correlation_functional ',correlation_functional
|
||||
stop"""
|
||||
print "endif"
|
||||
stop""")
|
||||
print("endif")
|
||||
|
||||
END_SHELL
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
! general providers for the alpha/beta exchange potentials on the AO basis
|
||||
END_DOC
|
||||
|
||||
BEGIN_SHELL [ /usr/bin/env python2 ]
|
||||
BEGIN_SHELL [ /usr/bin/env python3 ]
|
||||
import os
|
||||
import glob
|
||||
from qp_path import QP_SRC
|
||||
@ -15,17 +15,17 @@ functionals = map(lambda x : x.replace(".irp.f",""), glob.glob("*.irp.f"))
|
||||
|
||||
prefix = ""
|
||||
for f in functionals:
|
||||
print """
|
||||
print("""
|
||||
%sif (trim(exchange_functional) == '%s') then
|
||||
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 "
|
||||
print """
|
||||
print("""
|
||||
else
|
||||
print*, 'exchange functional required does not exist ...'
|
||||
print*,'exchange_functional ',exchange_functional
|
||||
stop"""
|
||||
print "endif"
|
||||
stop""")
|
||||
print("endif")
|
||||
|
||||
END_SHELL
|
||||
|
||||
@ -41,7 +41,7 @@ print "endif"
|
||||
! general providers for the alpha/beta correlation potentials on the AO basis
|
||||
END_DOC
|
||||
|
||||
BEGIN_SHELL [ /usr/bin/env python2 ]
|
||||
BEGIN_SHELL [ /usr/bin/env python3 ]
|
||||
import os
|
||||
import glob
|
||||
from qp_path import QP_SRC
|
||||
@ -51,18 +51,18 @@ functionals = map(lambda x : x.replace(".irp.f",""), glob.glob("*.irp.f"))
|
||||
|
||||
prefix = ""
|
||||
for f in functionals:
|
||||
print """
|
||||
print("""
|
||||
%sif (trim(correlation_functional) == '%s') then
|
||||
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 "
|
||||
|
||||
print """
|
||||
print("""
|
||||
else
|
||||
print*, 'Correlation functional required does not exist ...'
|
||||
print*,'correlation_functional ',correlation_functional
|
||||
stop"""
|
||||
print "endif"
|
||||
stop""" )
|
||||
print("endif")
|
||||
|
||||
END_SHELL
|
||||
|
||||
@ -200,7 +200,7 @@ print "endif"
|
||||
! general providers for the alpha/beta exchange/correlation potentials on the AO basis
|
||||
END_DOC
|
||||
|
||||
BEGIN_SHELL [ /usr/bin/env python2 ]
|
||||
BEGIN_SHELL [ /usr/bin/env python3 ]
|
||||
import os
|
||||
import glob
|
||||
from qp_path import QP_SRC
|
||||
@ -210,17 +210,17 @@ functionals = map(lambda x : x.replace(".irp.f",""), glob.glob("*.irp.f"))
|
||||
|
||||
prefix = ""
|
||||
for f in functionals:
|
||||
print """
|
||||
print("""
|
||||
%sif (trim(exchange_functional) == '%s') then
|
||||
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 "
|
||||
print """
|
||||
print("""
|
||||
else
|
||||
print*, 'exchange functional required does not exist ...'
|
||||
print*,'exchange_functional ',exchange_functional
|
||||
stop"""
|
||||
print "endif"
|
||||
stop""")
|
||||
print("endif")
|
||||
|
||||
END_SHELL
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
BEGIN_SHELL [ /usr/bin/env python2 ]
|
||||
BEGIN_SHELL [ /usr/bin/env python3 ]
|
||||
from perturbation import perturbations
|
||||
import os
|
||||
|
||||
@ -8,6 +8,6 @@ template = file.read()
|
||||
file.close()
|
||||
|
||||
for p in perturbations:
|
||||
print template.replace("$PERT",p)
|
||||
print(template.replace("$PERT",p))
|
||||
|
||||
END_SHELL
|
||||
|
@ -1,4 +1,4 @@
|
||||
BEGIN_SHELL [ /usr/bin/env python2 ]
|
||||
BEGIN_SHELL [ /usr/bin/env python3 ]
|
||||
import perturbation
|
||||
END_SHELL
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user