From 5bfc28b1f7ac1f9ecfa9dada9240c125b296c280 Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Wed, 15 Jul 2015 11:00:23 +0200 Subject: [PATCH] When uninstall module cleaning fist --- plugins/Hartree_Fock/.gitignore | 1 + plugins/Hartree_Fock/README.rst | 21 +++++++++++++--- scripts/compilation/qp_create_ninja.py | 28 +++++++++++++-------- scripts/module/qp_install_module.py | 35 +++++++++++++++++--------- src/MOGuess/README.rst | 4 +++ 5 files changed, 62 insertions(+), 27 deletions(-) diff --git a/plugins/Hartree_Fock/.gitignore b/plugins/Hartree_Fock/.gitignore index dbafb30b..189438ef 100644 --- a/plugins/Hartree_Fock/.gitignore +++ b/plugins/Hartree_Fock/.gitignore @@ -21,4 +21,5 @@ MOGuess Nuclei Utils Huckel_guess +test SCF \ No newline at end of file diff --git a/plugins/Hartree_Fock/README.rst b/plugins/Hartree_Fock/README.rst index 4dacf17c..7066f7c6 100644 --- a/plugins/Hartree_Fock/README.rst +++ b/plugins/Hartree_Fock/README.rst @@ -29,7 +29,17 @@ Documentation Alpha Fock matrix in AO basis set -`create_guess `_ +`big `_ + Produce `Huckel` MO orbital + output: mo_basis.mo_tot_num mo_basis.mo_label mo_basis.ao_md5 mo_basis.mo_coef mo_basis.mo_occ + Produce `Hartree_Fock` MO orbital + output: mo_basis.mo_tot_num mo_basis.mo_label mo_basis.ao_md5 mo_basis.mo_coef mo_basis.mo_occ + output: hartree_fock.energy + input: mo_basis.mo_coef + Run SCF calculation + + +`create_guess `_ Create an MO guess if no MOs are present in the EZFIO directory @@ -139,12 +149,15 @@ Documentation Maximum number of SCF iterations -`run `_ +`run `_ Run SCF calculation -`scf `_ - Undocumented +`scf `_ + Produce `Hartree_Fock` MO orbital + output: mo_basis.mo_tot_num mo_basis.mo_label mo_basis.ao_md5 mo_basis.mo_coef mo_basis.mo_occ + output: hartree_fock.energy + optional: mo_basis.mo_coef `thresh_scf `_ diff --git a/scripts/compilation/qp_create_ninja.py b/scripts/compilation/qp_create_ninja.py index 14d6811c..c49f4cc1 100755 --- a/scripts/compilation/qp_create_ninja.py +++ b/scripts/compilation/qp_create_ninja.py @@ -26,7 +26,7 @@ except ImportError: print """ Error: source %s -"""%f +""" % f sys.exit(1) header = r"""# @@ -313,8 +313,11 @@ def ninja_symlink_build(path_module, l_symlink): if not l_symlink: return [] - l_string = ["build l_symlink_{0} : phony {1}".format( - path_module.rel, " ".join([s.destination for s in l_symlink])), ""] + l_folder = [s.destination for s in l_symlink] + + l_string = ["build l_symlink_{0} : phony {1}".format(path_module.rel, + " ".join(l_folder)), + ""] for symlink in l_symlink: l_string += ["build {0}: build_symlink {1}".format(symlink.destination, @@ -336,20 +339,22 @@ def ninja_gitignore_rule(): " description = Create gitignore for $module_rel", ""] -def ninja_gitignore_build(path_module, d_binaries): +def ninja_gitignore_build(path_module, d_binaries, l_symlink): """ """ path_gitignore = join(path_module.abs, ".gitignore") l_b = [i.abs for i in d_binaries[path_module]] - l_sym = [i.destination for i in l_symlink] - l_string = ["build {0}: build_gitignore {1} || l_symlink_{2}".format(path_gitignore, - " ".join(l_b), - path_module.rel), - " module_rel = {0}".format(path_module.rel), - ""] + root = "build {0}: build_gitignore {1}".format(path_gitignore, + " ".join(l_b)) + if l_symlink: + l_string = ["{0} || l_symlink_{1}".format(root, path_module.rel)] + else: + l_string = ["{0}".format(root)] + + l_string.extend((" module_rel = {0}".format(path_module.rel), "")) return l_string @@ -911,7 +916,8 @@ if __name__ == "__main__": l_string += ninja_binaries_build(module_to_compile, l_children, d_binaries) - l_string += ninja_gitignore_build(module_to_compile, d_binaries) + l_string += ninja_gitignore_build(module_to_compile, d_binaries, + l_symlink) with open(join(QP_ROOT, "config", "build.ninja"), "w+") as f: f.write(header) diff --git a/scripts/module/qp_install_module.py b/scripts/module/qp_install_module.py index 3240e142..2cad51a9 100755 --- a/scripts/module/qp_install_module.py +++ b/scripts/module/qp_install_module.py @@ -16,6 +16,7 @@ Options: import sys import os +import subprocess try: from docopt import docopt @@ -152,6 +153,11 @@ if __name__ == '__main__': except OSError: print "Your src directory is broken. Please remove %s" % des raise + try: + import subprocess + subprocess.check_call(["qp_create_ninja.py", "update"]) + except: + raise print "Done" print "You can now compile as usual" @@ -164,24 +170,29 @@ if __name__ == '__main__': l_name = arguments[""] l_failed = [name for name in l_name if name not in d_local] + if l_failed: print "Modules not installed:" for name in sorted(l_failed): print "* %s" % name sys.exit(1) + + if arguments["--and_ancestor"]: + + 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 "You will remove all of:" + print l_name_to_remove else: - if arguments["--and_ancestor"]: + l_name_to_remove = l_name - 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 "You will remove all of:" - print l_name_to_remove + for module in l_name_to_remove: - else: - l_name_to_remove = l_name + try: + subprocess.check_call(["module_handler.py", "clean", module]) + except: + raise - def unlink(x): - try: - os.unlink(os.path.join(QP_SRC, x)) - except OSError: - print "%s is a core module which can not be renmoved" % x - map(unlink, l_name_to_remove) + try: + os.unlink(os.path.join(QP_SRC, module)) + except OSError: + print "%s is a core module which can not be renmoved" % x diff --git a/src/MOGuess/README.rst b/src/MOGuess/README.rst index e7280786..d10b1ef5 100644 --- a/src/MOGuess/README.rst +++ b/src/MOGuess/README.rst @@ -37,3 +37,7 @@ Documentation Produce `H_core` MO orbital output: mo_basis.mo_tot_num mo_basis.mo_label mo_basis.ao_md5 mo_basis.mo_coef mo_basis.mo_occ + +`hcore_guess `_ + Produce `H_core` MO orbital +