diff --git a/.travis.yml b/.travis.yml index 46e8057f..0e78a8c6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,28 @@ -sudo: true -# -#cache: -# directories: -# - $HOME/.opam/ +#sudo: true +#before_script: +# - sudo apt-get update -q +# - sudo apt-get install gfortran liblapack-dev gcc +# - sudo apt-get install graphviz + +sudo: false + +addons: + apt: + packages: + - gfortran + - gcc + - liblapack-dev + - graphviz + +cache: + directories: + - $HOME/.opam/ language: python python: - "2.6" -before_script: - - sudo apt-get update -q - - sudo apt-get install gfortran liblapack-dev gcc - - sudo apt-get install graphviz + script: - ./configure --production ./config/gfortran.cfg diff --git a/README.md b/README.md index 8a43f486..4b288d85 100644 --- a/README.md +++ b/README.md @@ -160,4 +160,17 @@ size: 1 type: Strictly_negative_float doc: Calculated HF energy interface: ezfio -``` \ No newline at end of file +``` + +#FAQ + +### Error: ezfio_* is already defined. + +#### Why ? + +You have two or more ezfio configuration file for the same variable. Check in `$QP_ROOT/install/config/` + +#### Fix + + - rm $QP_ROOT/install/EZFIO/config/* + - ninja \ No newline at end of file diff --git a/configure b/configure index 41919e85..90f52769 100755 --- a/configure +++ b/configure @@ -63,7 +63,8 @@ d_dependency = { "gcc": [], "python": [], "ninja": ["gcc", "python"], - "make": [] + "make": [], + "p_graphviz": ["python"] } from collections import namedtuple @@ -128,10 +129,15 @@ ezfio = Info( description=' EZFIO', default_path=join(QP_ROOT_INSTALL, "EZFIO")) +p_graphviz = Info( + url='https://github.com/xflr6/graphviz/archive/master.tar.gz', + description=' Python library for graphviz', + default_path=join(QP_ROOT_INSTALL, "p_graphviz")) + d_info = dict() for m in ["ocaml", "m4", "curl", "zlib", "path", "irpf90", "docopt", - "resultsFile", "ninja", "emsl", "ezfio"]: + "resultsFile", "ninja", "emsl", "ezfio", "p_graphviz"]: exec ("d_info['{0}']={0}".format(m)) diff --git a/install/.gitignore b/install/.gitignore index 60fbede4..7f2396be 100644 --- a/install/.gitignore +++ b/install/.gitignore @@ -7,4 +7,5 @@ EZFIO irpf90 resultsFile zlib -build.ninja \ No newline at end of file +build.ninja +p_graphviz \ No newline at end of file diff --git a/install/scripts/install_p_graphviz.sh b/install/scripts/install_p_graphviz.sh new file mode 100755 index 00000000..68df04f8 --- /dev/null +++ b/install/scripts/install_p_graphviz.sh @@ -0,0 +1,10 @@ +#!/bin/bash -x + +TARGET=p_graphviz + +function _install() +{ + cp -R ${BUILD} . || exit 1 +} + +source scripts/build.sh diff --git a/plugins/Alavi/.gitignore b/plugins/Alavi/.gitignore new file mode 100644 index 00000000..e4e1a2ab --- /dev/null +++ b/plugins/Alavi/.gitignore @@ -0,0 +1,23 @@ +# Automatically created by $QP_ROOT/scripts/module/module_handler.py +.ninja_deps +.ninja_log +AO_Basis +Bitmask +Determinants +Electrons +Ezfio_files +IRPF90_man +IRPF90_temp +Integrals_Bielec +Integrals_Monoelec +MO_Basis +Makefile +Makefile.depend +Nuclei +Pseudo +Utils +alavi_graph +ezfio_interface.irp.f +irpf90.make +irpf90_entities +tags \ No newline at end of file diff --git a/plugins/Alavi/NEEDED_CHILDREN_MODULES b/plugins/Alavi/NEEDED_CHILDREN_MODULES new file mode 100644 index 00000000..aae89501 --- /dev/null +++ b/plugins/Alavi/NEEDED_CHILDREN_MODULES @@ -0,0 +1 @@ +Determinants diff --git a/plugins/Alavi/README.rst b/plugins/Alavi/README.rst new file mode 100644 index 00000000..f2194755 --- /dev/null +++ b/plugins/Alavi/README.rst @@ -0,0 +1,23 @@ +===== +alavi +===== + +Documentation +============= + +.. Do not edit this section. It was auto-generated from the +.. by the `update_README.py` script. + +`alavi_graph `_ + Undocumented + +Needed Modules +============== + +.. Do not edit this section. It was auto-generated from the +.. by the `update_README.py` script. + +.. image:: tree_dependency.png + +* `Determinants `_ + diff --git a/plugins/Alavi/alavi_graph.irp.f b/plugins/Alavi/alavi_graph.irp.f new file mode 100644 index 00000000..4e953add --- /dev/null +++ b/plugins/Alavi/alavi_graph.irp.f @@ -0,0 +1,28 @@ +program alavi_graph + implicit none + integer :: exc(0:2,2,2),h1,p1,h2,p2,s1,s2 + double precision :: phase + + read_wf = .True. + touch read_wf + + integer :: k,degree + double precision :: hii + + do k=1,N_det + call get_excitation_degree(psi_det(1,1,1),psi_det(1,1,k),degree,N_int) + call i_H_j(psi_det(1,1,k),psi_det(1,1,k),N_int,hii) + print*, k,abs(psi_coef(k,1)), hii,degree + +! if (degree == 2) then +! call get_excitation(psi_det(1,1,1),psi_det(1,1,k),exc,degree,phase,N_int) +! call decode_exc(exc,degree,h1,p1,h2,p2,s1,s2) +! print*, h1,h2,hii, abs(psi_coef(k,1)) +! endif +! + + + enddo +end + +!plot "test.dat" u (abs($2)):(abs($3)):4 w p palette \ No newline at end of file diff --git a/plugins/Alavi/tree_dependency.png b/plugins/Alavi/tree_dependency.png new file mode 100644 index 00000000..b4f0df8b Binary files /dev/null and b/plugins/Alavi/tree_dependency.png differ diff --git a/plugins/All_singles/ASSUMPTIONS.rst b/plugins/All_singles/ASSUMPTIONS.rst deleted file mode 100644 index e69de29b..00000000 diff --git a/plugins/All_singles/README.rst b/plugins/All_singles/README.rst deleted file mode 100644 index 24abb1ae..00000000 --- a/plugins/All_singles/README.rst +++ /dev/null @@ -1,4 +0,0 @@ -================== -All_singles Module -================== - diff --git a/plugins/CID/.gitignore b/plugins/CID/.gitignore index 638efebf..62ef7631 100644 --- a/plugins/CID/.gitignore +++ b/plugins/CID/.gitignore @@ -1,29 +1,28 @@ -# Automatically created by /home/razoa/quantum_package/scripts/module/module_handler.py -IRPF90_temp -IRPF90_man -irpf90_entities -tags -irpf90.make -Makefile -Makefile.depend -build.ninja -.ninja_log +# Automatically created by $QP_ROOT/scripts/module/module_handler.py .ninja_deps -ezfio_interface.irp.f -Ezfio_files -Determinants -Integrals_Monoelec -MO_Basis -Selectors_full -Utils -Pseudo +.ninja_log AO_Basis Bitmask -SingleRefMethod +Determinants Electrons -MOGuess -Nuclei +Ezfio_files Hartree_Fock +IRPF90_man +IRPF90_temp Integrals_Bielec +Integrals_Monoelec +MOGuess +MO_Basis +Makefile +Makefile.depend +Nuclei +Pseudo +Selectors_full +SingleRefMethod +Utils cid -cid_lapack \ No newline at end of file +cid_lapack +ezfio_interface.irp.f +irpf90.make +irpf90_entities +tags \ No newline at end of file diff --git a/plugins/CID/README.rst b/plugins/CID/README.rst index f6c930d0..385ef092 100644 --- a/plugins/CID/README.rst +++ b/plugins/CID/README.rst @@ -30,7 +30,7 @@ Documentation Undocumented -`h_apply_cid `_ +`h_apply_cid `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. @@ -41,7 +41,7 @@ Documentation Assume N_int is already provided. -`h_apply_cid_monoexc `_ +`h_apply_cid_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. @@ -51,143 +51,143 @@ Documentation Undocumented -`h_apply_cisd_selection_delta_rho_one_point `_ +`h_apply_cisd_selection_delta_rho_one_point `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_delta_rho_one_point_diexc `_ +`h_apply_cisd_selection_delta_rho_one_point_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_delta_rho_one_point_monoexc `_ +`h_apply_cisd_selection_delta_rho_one_point_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_dipole_moment_z `_ +`h_apply_cisd_selection_dipole_moment_z `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_dipole_moment_z_diexc `_ +`h_apply_cisd_selection_dipole_moment_z_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_dipole_moment_z_monoexc `_ +`h_apply_cisd_selection_dipole_moment_z_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet `_ +`h_apply_cisd_selection_epstein_nesbet `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_epstein_nesbet_2x2 `_ +`h_apply_cisd_selection_epstein_nesbet_2x2 `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_epstein_nesbet_2x2_diexc `_ +`h_apply_cisd_selection_epstein_nesbet_2x2_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_2x2_monoexc `_ +`h_apply_cisd_selection_epstein_nesbet_2x2_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_diexc `_ +`h_apply_cisd_selection_epstein_nesbet_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_monoexc `_ +`h_apply_cisd_selection_epstein_nesbet_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_sc2 `_ +`h_apply_cisd_selection_epstein_nesbet_sc2 `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_epstein_nesbet_sc2_diexc `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_sc2_monoexc `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_sc2_no_projected `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_no_projected `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_epstein_nesbet_sc2_no_projected_diexc `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_no_projected_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_sc2_no_projected_monoexc `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_no_projected_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_sc2_projected `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_projected `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_epstein_nesbet_sc2_projected_diexc `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_projected_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_sc2_projected_monoexc `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_projected_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_h_core `_ +`h_apply_cisd_selection_h_core `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_h_core_diexc `_ +`h_apply_cisd_selection_h_core_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_h_core_monoexc `_ +`h_apply_cisd_selection_h_core_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_moller_plesset `_ +`h_apply_cisd_selection_moller_plesset `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. @@ -198,7 +198,7 @@ Documentation Assume N_int is already provided. -`h_apply_cisd_selection_moller_plesset_monoexc `_ +`h_apply_cisd_selection_moller_plesset_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. diff --git a/plugins/CID_SC2_selected/.gitignore b/plugins/CID_SC2_selected/.gitignore index c030dc88..5761c0d3 100644 --- a/plugins/CID_SC2_selected/.gitignore +++ b/plugins/CID_SC2_selected/.gitignore @@ -1,32 +1,31 @@ -# Automatically created by /home/razoa/quantum_package/scripts/module/module_handler.py -IRPF90_temp +# Automatically created by $QP_ROOT/scripts/module/module_handler.py +.ninja_deps +.ninja_log +AO_Basis +Bitmask +CID +CID_selected +Determinants +Electrons +Ezfio_files +Hartree_Fock IRPF90_man -irpf90_entities -tags -irpf90.make +IRPF90_temp +Integrals_Bielec +Integrals_Monoelec +MOGuess +MO_Basis Makefile Makefile.depend -build.ninja -.ninja_log -.ninja_deps -ezfio_interface.irp.f -Ezfio_files +Nuclei Perturbation -Determinants -Integrals_Monoelec -MO_Basis +Properties +Pseudo Selectors_full SingleRefMethod Utils -CID -Pseudo -Properties -Bitmask -AO_Basis -Electrons -MOGuess -CID_selected -Nuclei -Hartree_Fock -Integrals_Bielec -cid_sc2_selection \ No newline at end of file +cid_sc2_selection +ezfio_interface.irp.f +irpf90.make +irpf90_entities +tags \ No newline at end of file diff --git a/plugins/CID_SC2_selected/README.rst b/plugins/CID_SC2_selected/README.rst index 49ad9aac..8ea5a902 100644 --- a/plugins/CID_SC2_selected/README.rst +++ b/plugins/CID_SC2_selected/README.rst @@ -12,7 +12,7 @@ Documentation Undocumented -`h_apply_pt2 `_ +`h_apply_pt2 `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. @@ -23,7 +23,7 @@ Documentation Assume N_int is already provided. -`h_apply_pt2_monoexc `_ +`h_apply_pt2_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. diff --git a/plugins/CID_selected/.gitignore b/plugins/CID_selected/.gitignore index 9a0bd11e..0da32ffe 100644 --- a/plugins/CID_selected/.gitignore +++ b/plugins/CID_selected/.gitignore @@ -1,31 +1,30 @@ -# Automatically created by /home/razoa/quantum_package/scripts/module/module_handler.py -IRPF90_temp -IRPF90_man -irpf90_entities -tags -irpf90.make -Makefile -Makefile.depend -build.ninja -.ninja_log +# Automatically created by $QP_ROOT/scripts/module/module_handler.py .ninja_deps -ezfio_interface.irp.f -Ezfio_files -Perturbation -Determinants -Utils -Integrals_Monoelec -MO_Basis -Selectors_full -Integrals_Bielec -CID -Pseudo +.ninja_log AO_Basis Bitmask -SingleRefMethod +CID +Determinants Electrons -MOGuess -Nuclei +Ezfio_files Hartree_Fock +IRPF90_man +IRPF90_temp +Integrals_Bielec +Integrals_Monoelec +MOGuess +MO_Basis +Makefile +Makefile.depend +Nuclei +Perturbation Properties -cid_selection \ No newline at end of file +Pseudo +Selectors_full +SingleRefMethod +Utils +cid_selection +ezfio_interface.irp.f +irpf90.make +irpf90_entities +tags \ No newline at end of file diff --git a/plugins/CID_selected/README.rst b/plugins/CID_selected/README.rst index 9cc3dd33..b21155b3 100644 --- a/plugins/CID_selected/README.rst +++ b/plugins/CID_selected/README.rst @@ -12,143 +12,143 @@ Documentation Undocumented -`h_apply_cisd_selection_delta_rho_one_point `_ +`h_apply_cisd_selection_delta_rho_one_point `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_delta_rho_one_point_diexc `_ +`h_apply_cisd_selection_delta_rho_one_point_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_delta_rho_one_point_monoexc `_ +`h_apply_cisd_selection_delta_rho_one_point_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_dipole_moment_z `_ +`h_apply_cisd_selection_dipole_moment_z `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_dipole_moment_z_diexc `_ +`h_apply_cisd_selection_dipole_moment_z_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_dipole_moment_z_monoexc `_ +`h_apply_cisd_selection_dipole_moment_z_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet `_ +`h_apply_cisd_selection_epstein_nesbet `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_epstein_nesbet_2x2 `_ +`h_apply_cisd_selection_epstein_nesbet_2x2 `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_epstein_nesbet_2x2_diexc `_ +`h_apply_cisd_selection_epstein_nesbet_2x2_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_2x2_monoexc `_ +`h_apply_cisd_selection_epstein_nesbet_2x2_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_diexc `_ +`h_apply_cisd_selection_epstein_nesbet_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_monoexc `_ +`h_apply_cisd_selection_epstein_nesbet_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_sc2 `_ +`h_apply_cisd_selection_epstein_nesbet_sc2 `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_epstein_nesbet_sc2_diexc `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_sc2_monoexc `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_sc2_no_projected `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_no_projected `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_epstein_nesbet_sc2_no_projected_diexc `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_no_projected_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_sc2_no_projected_monoexc `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_no_projected_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_sc2_projected `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_projected `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_epstein_nesbet_sc2_projected_diexc `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_projected_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_sc2_projected_monoexc `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_projected_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_h_core `_ +`h_apply_cisd_selection_h_core `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_h_core_diexc `_ +`h_apply_cisd_selection_h_core_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_h_core_monoexc `_ +`h_apply_cisd_selection_h_core_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_moller_plesset `_ +`h_apply_cisd_selection_moller_plesset `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. @@ -159,7 +159,7 @@ Documentation Assume N_int is already provided. -`h_apply_cisd_selection_moller_plesset_monoexc `_ +`h_apply_cisd_selection_moller_plesset_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. diff --git a/plugins/CIS/.gitignore b/plugins/CIS/.gitignore index eb36f1dc..9b9257d3 100644 --- a/plugins/CIS/.gitignore +++ b/plugins/CIS/.gitignore @@ -1,29 +1,28 @@ -# Automatically created by /home/razoa/quantum_package/scripts/module/module_handler.py -IRPF90_temp -IRPF90_man -irpf90_entities -tags -irpf90.make -Makefile -Makefile.depend -build.ninja -.ninja_log +# Automatically created by $QP_ROOT/scripts/module/module_handler.py .ninja_deps -ezfio_interface.irp.f -Ezfio_files -Determinants -Integrals_Monoelec -MO_Basis -Selectors_full -Utils -Pseudo +.ninja_log AO_Basis Bitmask -SingleRefMethod +Determinants Electrons -MOGuess -Nuclei +Ezfio_files Hartree_Fock +IRPF90_man +IRPF90_temp Integrals_Bielec +Integrals_Monoelec +MOGuess +MO_Basis +Makefile +Makefile.depend +Nuclei +Pseudo +Selectors_full +SingleRefMethod +Utils +cis +ezfio_interface.irp.f +irpf90.make +irpf90_entities super_ci -cis \ No newline at end of file +tags \ No newline at end of file diff --git a/plugins/CIS/README.rst b/plugins/CIS/README.rst index 5d8437e6..e35aa940 100644 --- a/plugins/CIS/README.rst +++ b/plugins/CIS/README.rst @@ -17,7 +17,7 @@ Documentation Undocumented -`h_apply_cis `_ +`h_apply_cis `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. @@ -28,7 +28,7 @@ Documentation Assume N_int is already provided. -`h_apply_cis_monoexc `_ +`h_apply_cis_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. diff --git a/plugins/CISD/.gitignore b/plugins/CISD/.gitignore index 0fd73f2c..5c7aee18 100644 --- a/plugins/CISD/.gitignore +++ b/plugins/CISD/.gitignore @@ -1,29 +1,28 @@ -# Automatically created by /home/giner/quantum_package/scripts/module/module_handler.py -IRPF90_temp -IRPF90_man -irpf90_entities -tags -irpf90.make -Makefile -Makefile.depend -build.ninja -.ninja_log +# Automatically created by $QP_ROOT/scripts/module/module_handler.py .ninja_deps -ezfio_interface.irp.f -Ezfio_files -Determinants -Integrals_Monoelec -MO_Basis -Selectors_full -Utils -Pseudo +.ninja_log AO_Basis Bitmask -SingleRefMethod +Determinants Electrons -MOGuess -Nuclei +Ezfio_files Hartree_Fock +IRPF90_man +IRPF90_temp Integrals_Bielec +Integrals_Monoelec +MOGuess +MO_Basis +Makefile +Makefile.depend +Nuclei +Pseudo +Selectors_full +SingleRefMethod +Utils +cisd cisd_lapack -cisd \ No newline at end of file +ezfio_interface.irp.f +irpf90.make +irpf90_entities +tags \ No newline at end of file diff --git a/plugins/CISD/README.rst b/plugins/CISD/README.rst index fa49ba62..a3168310 100644 --- a/plugins/CISD/README.rst +++ b/plugins/CISD/README.rst @@ -26,7 +26,7 @@ Documentation .. Do not edit this section. It was auto-generated from the .. by the `update_README.py` script. -`h_apply_cisd `_ +`h_apply_cisd `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. @@ -37,7 +37,7 @@ Documentation Assume N_int is already provided. -`h_apply_cisd_monoexc `_ +`h_apply_cisd_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. @@ -47,154 +47,154 @@ Documentation Undocumented -`h_apply_cisd_selection_delta_rho_one_point `_ +`h_apply_cisd_selection_delta_rho_one_point `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_delta_rho_one_point_diexc `_ +`h_apply_cisd_selection_delta_rho_one_point_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_delta_rho_one_point_monoexc `_ +`h_apply_cisd_selection_delta_rho_one_point_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_dipole_moment_z `_ +`h_apply_cisd_selection_dipole_moment_z `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_dipole_moment_z_diexc `_ +`h_apply_cisd_selection_dipole_moment_z_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_dipole_moment_z_monoexc `_ +`h_apply_cisd_selection_dipole_moment_z_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet `_ +`h_apply_cisd_selection_epstein_nesbet `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_epstein_nesbet_2x2 `_ +`h_apply_cisd_selection_epstein_nesbet_2x2 `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_epstein_nesbet_2x2_diexc `_ +`h_apply_cisd_selection_epstein_nesbet_2x2_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_2x2_monoexc `_ +`h_apply_cisd_selection_epstein_nesbet_2x2_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_diexc `_ +`h_apply_cisd_selection_epstein_nesbet_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_monoexc `_ +`h_apply_cisd_selection_epstein_nesbet_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_sc2 `_ +`h_apply_cisd_selection_epstein_nesbet_sc2 `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_epstein_nesbet_sc2_diexc `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_sc2_monoexc `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_sc2_no_projected `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_no_projected `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_epstein_nesbet_sc2_no_projected_diexc `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_no_projected_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_sc2_no_projected_monoexc `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_no_projected_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_sc2_projected `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_projected `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_epstein_nesbet_sc2_projected_diexc `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_projected_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_sc2_projected_monoexc `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_projected_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_h_core `_ +`h_apply_cisd_selection_h_core `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_h_core_diexc `_ +`h_apply_cisd_selection_h_core_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_h_core_monoexc `_ +`h_apply_cisd_selection_h_core_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_moller_plesset `_ +`h_apply_cisd_selection_moller_plesset `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_moller_plesset_diexc `_ +`h_apply_cisd_selection_moller_plesset_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_moller_plesset_monoexc `_ +`h_apply_cisd_selection_moller_plesset_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. diff --git a/plugins/CISD_SC2_selected/.gitignore b/plugins/CISD_SC2_selected/.gitignore index 096f5726..2f0e8bdd 100644 --- a/plugins/CISD_SC2_selected/.gitignore +++ b/plugins/CISD_SC2_selected/.gitignore @@ -1,32 +1,31 @@ -# Automatically created by /home/giner/quantum_package/scripts/module/module_handler.py -IRPF90_temp +# Automatically created by $QP_ROOT/scripts/module/module_handler.py +.ninja_deps +.ninja_log +AO_Basis +Bitmask +CISD +CISD_selected +Determinants +Electrons +Ezfio_files +Hartree_Fock IRPF90_man -irpf90_entities -tags -irpf90.make +IRPF90_temp +Integrals_Bielec +Integrals_Monoelec +MOGuess +MO_Basis Makefile Makefile.depend -build.ninja -.ninja_log -.ninja_deps -ezfio_interface.irp.f -Ezfio_files +Nuclei Perturbation -Determinants -Integrals_Monoelec -MO_Basis +Properties +Pseudo Selectors_full SingleRefMethod Utils -Pseudo -Properties -Bitmask -AO_Basis -Electrons -CISD_selected -MOGuess -CISD -Nuclei -Hartree_Fock -Integrals_Bielec -cisd_sc2_selection \ No newline at end of file +cisd_sc2_selection +ezfio_interface.irp.f +irpf90.make +irpf90_entities +tags \ No newline at end of file diff --git a/plugins/CISD_SC2_selected/README.rst b/plugins/CISD_SC2_selected/README.rst index 307063a6..a4ddd1bd 100644 --- a/plugins/CISD_SC2_selected/README.rst +++ b/plugins/CISD_SC2_selected/README.rst @@ -12,41 +12,41 @@ Documentation Undocumented -`h_apply_pt2 `_ +`h_apply_pt2 `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_pt2_diexc `_ +`h_apply_pt2_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_pt2_en_sc2 `_ +`h_apply_pt2_en_sc2 `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_pt2_en_sc2_diexc `_ +`h_apply_pt2_en_sc2_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_pt2_en_sc2_monoexc `_ +`h_apply_pt2_en_sc2_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_pt2_monoexc `_ +`h_apply_pt2_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_sc2_selected `_ +`h_apply_sc2_selected `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. @@ -57,7 +57,7 @@ Documentation Assume N_int is already provided. -`h_apply_sc2_selected_monoexc `_ +`h_apply_sc2_selected_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. diff --git a/plugins/CISD_selected/.gitignore b/plugins/CISD_selected/.gitignore index 8fead155..e9803984 100644 --- a/plugins/CISD_selected/.gitignore +++ b/plugins/CISD_selected/.gitignore @@ -1,31 +1,30 @@ -# Automatically created by /home/giner/quantum_package/scripts/module/module_handler.py -IRPF90_temp -IRPF90_man -irpf90_entities -tags -irpf90.make -Makefile -Makefile.depend -build.ninja -.ninja_log +# Automatically created by $QP_ROOT/scripts/module/module_handler.py .ninja_deps -ezfio_interface.irp.f -Ezfio_files -Perturbation -Determinants -Utils -Integrals_Monoelec -MO_Basis -Selectors_full -Integrals_Bielec -Pseudo +.ninja_log AO_Basis Bitmask -SingleRefMethod -Electrons -MOGuess CISD -Nuclei +Determinants +Electrons +Ezfio_files Hartree_Fock +IRPF90_man +IRPF90_temp +Integrals_Bielec +Integrals_Monoelec +MOGuess +MO_Basis +Makefile +Makefile.depend +Nuclei +Perturbation Properties -cisd_selection \ No newline at end of file +Pseudo +Selectors_full +SingleRefMethod +Utils +cisd_selection +ezfio_interface.irp.f +irpf90.make +irpf90_entities +tags \ No newline at end of file diff --git a/plugins/CISD_selected/README.rst b/plugins/CISD_selected/README.rst index 18bfe855..2ac23234 100644 --- a/plugins/CISD_selected/README.rst +++ b/plugins/CISD_selected/README.rst @@ -12,154 +12,154 @@ Documentation Undocumented -`h_apply_cisd_selection_delta_rho_one_point `_ +`h_apply_cisd_selection_delta_rho_one_point `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_delta_rho_one_point_diexc `_ +`h_apply_cisd_selection_delta_rho_one_point_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_delta_rho_one_point_monoexc `_ +`h_apply_cisd_selection_delta_rho_one_point_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_dipole_moment_z `_ +`h_apply_cisd_selection_dipole_moment_z `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_dipole_moment_z_diexc `_ +`h_apply_cisd_selection_dipole_moment_z_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_dipole_moment_z_monoexc `_ +`h_apply_cisd_selection_dipole_moment_z_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet `_ +`h_apply_cisd_selection_epstein_nesbet `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_epstein_nesbet_2x2 `_ +`h_apply_cisd_selection_epstein_nesbet_2x2 `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_epstein_nesbet_2x2_diexc `_ +`h_apply_cisd_selection_epstein_nesbet_2x2_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_2x2_monoexc `_ +`h_apply_cisd_selection_epstein_nesbet_2x2_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_diexc `_ +`h_apply_cisd_selection_epstein_nesbet_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_monoexc `_ +`h_apply_cisd_selection_epstein_nesbet_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_sc2 `_ +`h_apply_cisd_selection_epstein_nesbet_sc2 `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_epstein_nesbet_sc2_diexc `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_sc2_monoexc `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_sc2_no_projected `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_no_projected `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_epstein_nesbet_sc2_no_projected_diexc `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_no_projected_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_sc2_no_projected_monoexc `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_no_projected_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_sc2_projected `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_projected `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_epstein_nesbet_sc2_projected_diexc `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_projected_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_epstein_nesbet_sc2_projected_monoexc `_ +`h_apply_cisd_selection_epstein_nesbet_sc2_projected_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_h_core `_ +`h_apply_cisd_selection_h_core `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_h_core_diexc `_ +`h_apply_cisd_selection_h_core_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_h_core_monoexc `_ +`h_apply_cisd_selection_h_core_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_moller_plesset `_ +`h_apply_cisd_selection_moller_plesset `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cisd_selection_moller_plesset_diexc `_ +`h_apply_cisd_selection_moller_plesset_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cisd_selection_moller_plesset_monoexc `_ +`h_apply_cisd_selection_moller_plesset_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. diff --git a/plugins/Casino/.gitignore b/plugins/Casino/.gitignore index acf88165..14f48469 100644 --- a/plugins/Casino/.gitignore +++ b/plugins/Casino/.gitignore @@ -1,23 +1,23 @@ -# Automatically created by /home/razoa/quantum_package/scripts/module/module_handler.py -IRPF90_temp -IRPF90_man -irpf90_entities -tags -irpf90.make -Makefile -Makefile.depend -.ninja_log +# Automatically created by $QP_ROOT/scripts/module/module_handler.py .ninja_deps -ezfio_interface.irp.f -Ezfio_files +.ninja_log +AO_Basis +Bitmask Determinants +Electrons +Ezfio_files +IRPF90_man +IRPF90_temp +Integrals_Bielec Integrals_Monoelec MO_Basis -Utils -Pseudo -Bitmask -AO_Basis -Electrons +Makefile +Makefile.depend Nuclei -Integrals_Bielec -save_for_casino \ No newline at end of file +Pseudo +Utils +ezfio_interface.irp.f +irpf90.make +irpf90_entities +save_for_casino +tags \ No newline at end of file diff --git a/plugins/DDCI_selected/.gitignore b/plugins/DDCI_selected/.gitignore index 1a9fad06..d114cb7b 100644 --- a/plugins/DDCI_selected/.gitignore +++ b/plugins/DDCI_selected/.gitignore @@ -1,30 +1,29 @@ -# Automatically created by /home/giner/quantum_package/scripts/module/module_handler.py -IRPF90_temp +# Automatically created by $QP_ROOT/scripts/module/module_handler.py +.ninja_deps +.ninja_log +AO_Basis +Bitmask +Determinants +Electrons +Ezfio_files +Generators_CAS +Hartree_Fock IRPF90_man -irpf90_entities -tags -irpf90.make +IRPF90_temp +Integrals_Bielec +Integrals_Monoelec +MOGuess +MO_Basis Makefile Makefile.depend -build.ninja -.ninja_log -.ninja_deps -ezfio_interface.irp.f -Ezfio_files -Perturbation -Determinants -Utils -Integrals_Monoelec -MO_Basis -Selectors_full -Integrals_Bielec -Pseudo -Bitmask -Generators_CAS -AO_Basis -Electrons -MOGuess Nuclei -Hartree_Fock +Perturbation Properties -ddci \ No newline at end of file +Pseudo +Selectors_full +Utils +ddci +ezfio_interface.irp.f +irpf90.make +irpf90_entities +tags \ No newline at end of file diff --git a/plugins/DDCI_selected/README.rst b/plugins/DDCI_selected/README.rst index 471ebd21..59489e86 100644 --- a/plugins/DDCI_selected/README.rst +++ b/plugins/DDCI_selected/README.rst @@ -8,28 +8,28 @@ Documentation .. Do not edit this section. It was auto-generated from the .. by the `update_README.py` script. -`full_ci `_ +`ddci `_ Undocumented -`h_apply_ddci_pt2 `_ +`h_apply_ddci_pt2 `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_ddci_pt2_diexc `_ +`h_apply_ddci_pt2_diexc `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_ddci_pt2_monoexc `_ +`h_apply_ddci_pt2_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_ddci_selection `_ +`h_apply_ddci_selection `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. @@ -40,7 +40,7 @@ Documentation Assume N_int is already provided. -`h_apply_ddci_selection_monoexc `_ +`h_apply_ddci_selection_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. diff --git a/plugins/DensityMatrix/NEEDED_CHILDREN_MODULES b/plugins/DensityMatrix/NEEDED_CHILDREN_MODULES new file mode 100644 index 00000000..a953d6a6 --- /dev/null +++ b/plugins/DensityMatrix/NEEDED_CHILDREN_MODULES @@ -0,0 +1 @@ +Bitmask \ No newline at end of file diff --git a/plugins/FCIdump/.gitignore b/plugins/FCIdump/.gitignore index 795f6850..076918bf 100644 --- a/plugins/FCIdump/.gitignore +++ b/plugins/FCIdump/.gitignore @@ -6,7 +6,6 @@ tags irpf90.make Makefile Makefile.depend -build.ninja .ninja_log .ninja_deps ezfio_interface.irp.f diff --git a/plugins/Full_CI/.gitignore b/plugins/Full_CI/.gitignore index a806bcbc..2d978fa6 100644 --- a/plugins/Full_CI/.gitignore +++ b/plugins/Full_CI/.gitignore @@ -22,6 +22,7 @@ Properties Pseudo Selectors_full Utils +exc_degree ezfio_interface.irp.f full_ci full_ci_no_skip diff --git a/plugins/Generators_restart/tree_dependency.png b/plugins/Generators_restart/tree_dependency.png deleted file mode 100644 index 199a01b4..00000000 Binary files a/plugins/Generators_restart/tree_dependency.png and /dev/null differ diff --git a/plugins/Hartree_Fock/README.rst b/plugins/Hartree_Fock/README.rst index 4dacf17c..28b3aec1 100644 --- a/plugins/Hartree_Fock/README.rst +++ b/plugins/Hartree_Fock/README.rst @@ -29,7 +29,7 @@ Documentation Alpha Fock matrix in AO basis set -`create_guess `_ +`create_guess `_ Create an MO guess if no MOs are present in the EZFIO directory @@ -139,12 +139,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/plugins/Hartree_Fock/SCF.irp.f b/plugins/Hartree_Fock/SCF.irp.f index 33e1ac6c..864e9f3f 100644 --- a/plugins/Hartree_Fock/SCF.irp.f +++ b/plugins/Hartree_Fock/SCF.irp.f @@ -1,5 +1,10 @@ - program scf + BEGIN_DOC +! 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 + END_DOC call create_guess call orthonormalize_mos call run diff --git a/plugins/Hartree_Fock/huckel.irp.f b/plugins/Hartree_Fock/huckel.irp.f index 4ea8d93f..1b9e02aa 100644 --- a/plugins/Hartree_Fock/huckel.irp.f +++ b/plugins/Hartree_Fock/huckel.irp.f @@ -12,15 +12,17 @@ subroutine huckel_guess TOUCH mo_coef label = "Guess" call mo_as_eigvectors_of_mo_matrix(mo_mono_elec_integral, & - size(mo_mono_elec_integral,1),size(mo_mono_elec_integral,2),label) + size(mo_mono_elec_integral,1), & + size(mo_mono_elec_integral,2),label) TOUCH mo_coef c = 0.5d0 * 1.75d0 + do j=1,ao_num do i=1,ao_num - if (i/=j) then + if (i.ne.j) then Fock_matrix_ao(i,j) = c*ao_overlap(i,j)*(ao_mono_elec_integral(i,i) + & - ao_mono_elec_integral(j,j)) + ao_mono_elec_integral(j,j)) else Fock_matrix_ao(i,j) = Fock_matrix_alpha_ao(i,j) endif diff --git a/plugins/MP2/.gitignore b/plugins/MP2/.gitignore index 2b9a8b38..228b1c9d 100644 --- a/plugins/MP2/.gitignore +++ b/plugins/MP2/.gitignore @@ -1,30 +1,29 @@ -# Automatically created by /home/razoa/quantum_package/scripts/module/module_handler.py -IRPF90_temp -IRPF90_man -irpf90_entities -tags -irpf90.make -Makefile -Makefile.depend -build.ninja -.ninja_log +# Automatically created by $QP_ROOT/scripts/module/module_handler.py .ninja_deps -ezfio_interface.irp.f -Ezfio_files -Perturbation -Determinants -Utils -Integrals_Monoelec -MO_Basis -Selectors_full -Integrals_Bielec -Pseudo +.ninja_log AO_Basis Bitmask -SingleRefMethod +Determinants Electrons -MOGuess -Nuclei +Ezfio_files Hartree_Fock +IRPF90_man +IRPF90_temp +Integrals_Bielec +Integrals_Monoelec +MOGuess +MO_Basis +Makefile +Makefile.depend +Nuclei +Perturbation Properties -mp2 \ No newline at end of file +Pseudo +Selectors_full +SingleRefMethod +Utils +ezfio_interface.irp.f +irpf90.make +irpf90_entities +mp2 +tags \ No newline at end of file diff --git a/plugins/MP2/README.rst b/plugins/MP2/README.rst index 248c4815..98d84eeb 100644 --- a/plugins/MP2/README.rst +++ b/plugins/MP2/README.rst @@ -8,7 +8,7 @@ Documentation .. Do not edit this section. It was auto-generated from the .. by the `update_README.py` script. -`h_apply_mp2 `_ +`h_apply_mp2 `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. @@ -19,7 +19,7 @@ Documentation Assume N_int is already provided. -`h_apply_mp2_monoexc `_ +`h_apply_mp2_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. diff --git a/plugins/Perturbation/README.rst b/plugins/Perturbation/README.rst index 7be62489..9162e94b 100644 --- a/plugins/Perturbation/README.rst +++ b/plugins/Perturbation/README.rst @@ -85,92 +85,92 @@ Documentation Undocumented -`perturb_buffer_by_mono_delta_rho_one_point `_ +`perturb_buffer_by_mono_delta_rho_one_point `_ Applly pertubration ``delta_rho_one_point`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_by_mono_dipole_moment_z `_ +`perturb_buffer_by_mono_dipole_moment_z `_ Applly pertubration ``dipole_moment_z`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_by_mono_epstein_nesbet `_ +`perturb_buffer_by_mono_epstein_nesbet `_ Applly pertubration ``epstein_nesbet`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_by_mono_epstein_nesbet_2x2 `_ +`perturb_buffer_by_mono_epstein_nesbet_2x2 `_ Applly pertubration ``epstein_nesbet_2x2`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_by_mono_epstein_nesbet_sc2 `_ +`perturb_buffer_by_mono_epstein_nesbet_sc2 `_ Applly pertubration ``epstein_nesbet_sc2`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_by_mono_epstein_nesbet_sc2_no_projected `_ +`perturb_buffer_by_mono_epstein_nesbet_sc2_no_projected `_ Applly pertubration ``epstein_nesbet_sc2_no_projected`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_by_mono_epstein_nesbet_sc2_projected `_ +`perturb_buffer_by_mono_epstein_nesbet_sc2_projected `_ Applly pertubration ``epstein_nesbet_sc2_projected`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_by_mono_h_core `_ +`perturb_buffer_by_mono_h_core `_ Applly pertubration ``h_core`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_by_mono_moller_plesset `_ +`perturb_buffer_by_mono_moller_plesset `_ Applly pertubration ``moller_plesset`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_delta_rho_one_point `_ +`perturb_buffer_delta_rho_one_point `_ Applly pertubration ``delta_rho_one_point`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_dipole_moment_z `_ +`perturb_buffer_dipole_moment_z `_ Applly pertubration ``dipole_moment_z`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_epstein_nesbet `_ +`perturb_buffer_epstein_nesbet `_ Applly pertubration ``epstein_nesbet`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_epstein_nesbet_2x2 `_ +`perturb_buffer_epstein_nesbet_2x2 `_ Applly pertubration ``epstein_nesbet_2x2`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_epstein_nesbet_sc2 `_ +`perturb_buffer_epstein_nesbet_sc2 `_ Applly pertubration ``epstein_nesbet_sc2`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_epstein_nesbet_sc2_no_projected `_ +`perturb_buffer_epstein_nesbet_sc2_no_projected `_ Applly pertubration ``epstein_nesbet_sc2_no_projected`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_epstein_nesbet_sc2_projected `_ +`perturb_buffer_epstein_nesbet_sc2_projected `_ Applly pertubration ``epstein_nesbet_sc2_projected`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_h_core `_ +`perturb_buffer_h_core `_ Applly pertubration ``h_core`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_moller_plesset `_ +`perturb_buffer_moller_plesset `_ Applly pertubration ``moller_plesset`` to the buffer of determinants generated in the H_apply routine. diff --git a/plugins/QmcChem/.gitignore b/plugins/QmcChem/.gitignore index f2a19776..6ed62124 100644 --- a/plugins/QmcChem/.gitignore +++ b/plugins/QmcChem/.gitignore @@ -20,4 +20,4 @@ ezfio_interface.irp.f irpf90.make irpf90_entities save_for_qmcchem -tags \ No newline at end of file +tags diff --git a/plugins/Selectors_no_sorted/tree_dependency.png b/plugins/Selectors_no_sorted/tree_dependency.png deleted file mode 100644 index 59075c49..00000000 Binary files a/plugins/Selectors_no_sorted/tree_dependency.png and /dev/null differ diff --git a/plugins/loc_cele/.gitignore b/plugins/loc_cele/.gitignore new file mode 100644 index 00000000..6c8b96df --- /dev/null +++ b/plugins/loc_cele/.gitignore @@ -0,0 +1,18 @@ +# Automatically created by $QP_ROOT/scripts/module/module_handler.py +.ninja_deps +.ninja_log +AO_Basis +Electrons +Ezfio_files +IRPF90_man +IRPF90_temp +MO_Basis +Makefile +Makefile.depend +Nuclei +Utils +ezfio_interface.irp.f +irpf90.make +irpf90_entities +loc_cele +tags \ No newline at end of file diff --git a/plugins/loc_cele/README.rst b/plugins/loc_cele/README.rst index 2db141ee..c2bd983d 100644 --- a/plugins/loc_cele/README.rst +++ b/plugins/loc_cele/README.rst @@ -8,7 +8,7 @@ Documentation This program performs a localization of the active orbitals of a CASSCF wavefunction, reading the orbitals from a RASORB file of molcas. - id1=max number of MO in a given symmetry. + id1=max is the number of MO in a given symmetry. Needed Modules ============== diff --git a/scripts/compilation/qp_create_ninja.py b/scripts/compilation/qp_create_ninja.py index 242a2b63..f2b261ad 100755 --- a/scripts/compilation/qp_create_ninja.py +++ b/scripts/compilation/qp_create_ninja.py @@ -19,11 +19,14 @@ try: from read_compilation_cfg import get_compilation_option from docopt import docopt except ImportError: - f = os.path.realpath(os.path.join(os.path.dirname(__file__),"..","..","quantum_package.rc")) + f = os.path.realpath(os.path.join(os.path.dirname(__file__), + "..", + "..", + "quantum_package.rc")) print """ Error: source %s -"""%f +""" % f sys.exit(1) # __ @@ -83,7 +86,9 @@ def ninja_create_env_variable(pwd_config_file): FC, FCFLAGS, IRPF90, IRPF90_FLAGS The env variable is usefull for the generation of EZFIO, and IRPF90 """ - l_string = [] + l_string = ["builddir = {0}".format(os.path.dirname(ROOT_BUILD_NINJA)), + ""] + for flag in ["FC", "FCFLAGS", "IRPF90", "IRPF90_FLAGS"]: str_ = "{0} = {1}".format(flag, get_compilation_option(pwd_config_file, flag)) @@ -311,8 +316,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, @@ -334,20 +342,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 @@ -523,7 +533,7 @@ def ninja_readme_build(path_module, d_irp, dict_root_path): tags = join(root_module.abs, "tags") str_depend = " ".join(d_irp[path_module]["l_depend"]) - tree = join(root_module.abs, "tree_dependency.png") + tree = join(path_module.abs, "tree_dependency.png") l_string = ["build {0}: build_readme {1} {2} {3}".format(path_readme, tags, @@ -656,31 +666,24 @@ def ninja_binaries_build(path_module, l_children, d_binaries): # s t r i n g # # ~#~#~#~#~#~ # + path_readme = os.path.join(path_module.abs, "README.rst") + path_png = os.path.join(path_module.abs, "tree_dependency.png") + l_string = ["build {0}: build_binaries {1} {2}".format(" ".join(l_abs_bin), EZFIO_LIB, ninja_module_path), " module_abs = {0}".format(path_module.abs), " module_rel = {0}".format(path_module.rel), ""] - l_string += ["build module_{0}: phony {1}".format(path_module.rel, - " ".join(l_abs_bin)), ""] + l_string += ["build module_{0}: phony {1} {2} {3}".format(path_module.rel, + " ".join(l_abs_bin), + path_readme, + path_png + ), ""] return l_string -# -# |\/| _ _| | _ -# | | (_) (_| |_| | (/_ -# -def create_module_ninja(): - """ - In a module create a build.ninja - """ - - l_string = ["rule all:"] - return l_string - - # ___ # | ._ _ _ _| _ ._ _ ._ _| _ ._ _ o _ _ # | | (/_ (/_ (_| (/_ |_) (/_ | | (_| (/_ | | (_ | (/_ _> @@ -721,11 +724,13 @@ def ninja_dot_tree_build(path_module, l_module): # | | (_) (_| |_| | (/_ # def create_build_ninja_module(path_module): - - l_string = ["rule update_build_ninja_root", - " command = {0} update".format(__file__), + l_string = ["builddir = {0}".format(os.path.dirname(ROOT_BUILD_NINJA)), ""] + l_string += ["rule update_build_ninja_root", + " command = {0} update".format(__file__), + ""] + l_string += ["rule make_local_binaries", " command = ninja -f {0} module_{1}".format( ROOT_BUILD_NINJA, path_module.rel), " pool = console", @@ -753,7 +758,9 @@ def create_build_ninja_module(path_module): f.write("\n".join(l_string)) -def create_build_ninja_global(l_module): +def create_build_ninja_global(): + l_string = ["builddir = {0}".format(os.path.dirname(ROOT_BUILD_NINJA)), + ""] l_string = ["rule update_build_ninja_root", " command = {0} update".format(__file__), @@ -765,7 +772,7 @@ def create_build_ninja_global(l_module): ""] l_string += ["rule make_clean", - " command = module_handler.py clean {0}".format(" ".join([m.rel for m in l_module])), + " command = module_handler.py clean --all", " description = Cleaning all modules", ""] l_string += ["build dummy_target: update_build_ninja_root", @@ -862,14 +869,7 @@ if __name__ == "__main__": dict_root = module_instance.dict_root dict_root_path = dict_module_genelogy_path(dict_root) - l_module = d_genealogy_path.keys() - - for module in l_module: - # ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ # - # d o t _ t r e e & r e a d m e # - # ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ # - l_string += ninja_dot_tree_build(module, l_module) - l_string += ninja_readme_build(module, d_irp, dict_root_path) + l_all_module = d_genealogy_path.keys() # ~#~#~#~#~#~#~#~#~#~#~#~#~ # # M o d u l e _ t o _ i r p # @@ -877,15 +877,47 @@ if __name__ == "__main__": if arguments["--production"]: - d_binaries = get_dict_binaries(l_module, mode="production") + d_binaries = get_dict_binaries(l_all_module, mode="production") l_module = d_binaries.keys() elif arguments["--development"]: - d_binaries = get_dict_binaries(l_module, mode="development") + d_binaries = get_dict_binaries(l_all_module, mode="development") l_module = d_binaries.keys() - create_build_ninja_global(l_module) + for module in l_all_module: + # ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ # + # d o t _ t r e e & r e a d m e # + # ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ # + l_string += ninja_dot_tree_build(module, l_all_module) + l_string += ninja_readme_build(module, d_irp, dict_root_path) + + # ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ # + # C h e c k _ c o h e r e n c y # + # ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ # + + for module in dict_root_path.values(): + + if module not in d_binaries: + l_msg = ["{0} is a root module but he do not containt a main file", + "Is intolerable !", + "You need a main file:", + "- Create it in {0}", + "- Or delete {0} `qp_install_module.py uninstall {0}`", + "- Or install a module who need {0} with a main "] + + print "\n".join(l_msg).format(module.rel) + sys.exit(1) + + # ~#~#~#~#~#~#~#~#~#~#~#~ # + # G l o b a l _ b u i l d # + # ~#~#~#~#~#~#~#~#~#~#~#~ # + + create_build_ninja_global() + + # ~#~#~#~#~#~#~#~#~#~#~#~ # + # C r e a t e _ r u l e s # + # ~#~#~#~#~#~#~#~#~#~#~#~ # for module_to_compile in l_module: @@ -909,8 +941,13 @@ 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: + # ~#~#~#~#~ # + # S a v e s # + # ~#~#~#~#~ # + + with open(ROOT_BUILD_NINJA, "w+") as f: f.write(header) f.write("\n".join(l_string)) diff --git a/scripts/ezfio_interface/ei_handler.py b/scripts/ezfio_interface/ei_handler.py index 1be604da..b25ebe6f 100755 --- a/scripts/ezfio_interface/ei_handler.py +++ b/scripts/ezfio_interface/ei_handler.py @@ -86,6 +86,7 @@ from os.path import isdir, join, exists from qp_path import QP_ROOT, QP_SRC, QP_OCAML, QP_EZFIO Type = namedtuple('Type', 'fancy ocaml fortran') +Module = namedtuple('Module', 'path lower') def is_bool(str_): @@ -789,8 +790,6 @@ if __name__ == "__main__": l_module_with_ezfio = [] - Module = namedtuple('Module', 'path lower') - for f in l_module: path = join(QP_SRC, f, "EZFIO.cfg") if exists(path): diff --git a/scripts/module/module_handler.py b/scripts/module/module_handler.py index 1477195e..9160a49d 100755 --- a/scripts/module/module_handler.py +++ b/scripts/module/module_handler.py @@ -6,7 +6,7 @@ Module utilitary Usage: module_handler.py print_descendant [...] module_handler.py create_png [...] - module_handler.py clean [...] + module_handler.py clean [ --all | ...] module_handler.py create_git_ignore [...] Options: @@ -32,8 +32,7 @@ except ImportError: # Canot cache for namedtuple are not hashable def is_module(path_module): - return os.path.isfile(os.path.join(QP_SRC, - path_module, + return os.path.isfile(os.path.join(QP_SRC, path_module, "NEEDED_CHILDREN_MODULES")) @@ -84,15 +83,15 @@ 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, "`{0}` not submodule".format(module) - print >> sys.stderr, "Check the corresponding NEEDED_CHILDREN_MODULES" - raise + print >> sys.stderr, "Error: " + print >> sys.stderr, "`{0}` is not a submodule".format(module) + print >> sys.stderr, "Check the typo (orthograph, case, '/', etc.) " + sys.exit(1) return list(set(l)) class ModuleHandler(): - def __init__(self, l_root_abs=None): self.dict_child = get_dict_child(l_root_abs) @@ -110,7 +109,8 @@ class ModuleHandler(): d = {} for module_name in d_child: - d[module_name] = [i for i in d_child.keys() if module_name in d_child[i]] + d[module_name] = [i for i in d_child.keys() + if module_name in d_child[i]] return d @@ -124,11 +124,12 @@ class ModuleHandler(): d_child = self.dict_child for module_name in d_child: - try : + try: d[module_name] = get_l_module_descendant(d_child, d_child[module_name]) except KeyError: - print "Check NEEDED_CHILDREN_MODULES for {0}".format(module_name) + print "Check NEEDED_CHILDREN_MODULES for {0}".format( + module_name) sys.exit(1) return d @@ -147,7 +148,9 @@ class ModuleHandler(): dict_root = {} for module in l_all_module: - dict_root[module] = [ p for p in l_all_module if module in [p] + d_desc[p] and not d_asc[p]][0] + dict_root[module] = [p for p in l_all_module + if module in [p] + d_desc[p] and not d_asc[p] + ][0] return dict_root @@ -174,8 +177,17 @@ class ModuleHandler(): def create_png(self, l_module): """Create the png of the dependency tree for a l_module""" + basename = "tree_dependency" + path = '{0}.png'.format(basename) + # Init - import pydot + try: + from graphviz import Digraph + except: + with open(path, 'a'): + os.utime(path, None) + return + all_ready_done = [] def draw_module_edge(module, l_children): @@ -184,39 +196,31 @@ class ModuleHandler(): if module not in all_ready_done: for children in l_children: # Add Edge - edge = pydot.Edge(module, children) - graph.add_edge(edge) + graph.edge(module, children) # Recurs draw_module_edge(children, d_ref[children]) all_ready_done.append(module) - path = '{0}.png'.format("tree_dependency") - - # Init - try: - graph = pydot.Dot(graph_type='digraph') - except: - with open(path, 'a'): - os.utime(path, None) - return - + graph = Digraph(comment=l_module, format="png", filename=basename) d_ref = self.dict_child # Create all the edge for module in l_module: - node_a = pydot.Node(module, fontcolor="red") - graph.add_node(node_a) + graph.node(module, fontcolor="red") draw_module_edge(module, d_ref[module]) - # Save - graph.write_png(path) + graph.render(cleanup=True) if __name__ == '__main__': arguments = docopt(__doc__) - if not arguments['']: + if arguments['--all']: + l_module = [f for f in os.listdir(QP_SRC) + if os.path.isdir(os.path.join(QP_SRC, f))] + + elif not arguments['']: dir_ = os.getcwd() l_module = [os.path.basename(dir_)] else: @@ -241,14 +245,15 @@ if __name__ == '__main__': if arguments["clean"] or arguments["create_git_ignore"]: l_dir = ['IRPF90_temp', 'IRPF90_man'] - l_file = ["irpf90_entities", "tags", "irpf90.make", - "Makefile", "Makefile.depend", ".ninja_log", ".ninja_deps", + l_file = ["irpf90_entities", "tags", "irpf90.make", "Makefile", + "Makefile.depend", ".ninja_log", ".ninja_deps", "ezfio_interface.irp.f"] for module in l_module: module_abs = os.path.realpath(os.path.join(QP_SRC, module)) l_symlink = m.l_descendant_unique([module]) - l_exe = [f for f in os.listdir(module_abs) if is_exe(os.path.join(module_abs,f))] + l_exe = [f for f in os.listdir(module_abs) + if is_exe(os.path.join(module_abs, f))] if arguments["clean"]: for f in l_dir: diff --git a/scripts/module/qp_install_module.py b/scripts/module/qp_install_module.py index 3240e142..1c9911a6 100755 --- a/scripts/module/qp_install_module.py +++ b/scripts/module/qp_install_module.py @@ -1,12 +1,12 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- """ -Usage: +Usage: qp_install_module.py create -n [...] qp_install_module.py download -n [...] qp_install_module.py install ... qp_install_module.py list (--installed | --available-local) - qp_install_module.py uninstall ... [--and_ancestor] + qp_install_module.py uninstall ... Options: @@ -16,15 +16,16 @@ Options: import sys import os +import subprocess try: from docopt import docopt from module_handler import ModuleHandler, get_dict_child from module_handler import get_l_module_descendant from update_README import Doc_key, Needed_key - from qp_path import QP_SRC, QP_PLUGINS + from qp_path import QP_SRC, QP_PLUGINS, QP_ROOT except ImportError: - print "Please check if you have source the .quantum_package.rc" + print "Please check if you have sourced the .quantum_package.rc" print "(`source .quantum_package.rc`)" print sys.exit(1) @@ -79,7 +80,9 @@ if __name__ == '__main__': l_children = arguments[""] - path = os.path.join(QP_PLUGINS, arguments[""][0]) + name = arguments[""][0] + + path = os.path.join(QP_PLUGINS, name) print "You will create the module:" print path @@ -101,9 +104,13 @@ if __name__ == '__main__': print "This can be reduce to:" l_child_reduce = m_instance.l_reduce_tree(l_children) print l_child_reduce + print "Installation", save_new_module(path, l_child_reduce) - print "This was a plugin, you can install it now" + print " [ OK ]" + print "If this was a plugins, you can install it normaly. Type:" + print "` {0} install {1} `".format(os.path.basename(__file__), name) + elif arguments["download"]: pass # d_local = get_dict_child([QP_SRC]) @@ -152,8 +159,15 @@ if __name__ == '__main__': except OSError: print "Your src directory is broken. Please remove %s" % des raise - print "Done" + try: + subprocess.check_call(["qp_create_ninja.py", "update"]) + except: + raise + + print "[ OK ]" print "You can now compile as usual" + print "`cd {0} ; ninja` for exemple".format(QP_ROOT) + print " or --in developement mode-- you can cd in a directory and compile here" elif arguments["uninstall"]: @@ -164,24 +178,28 @@ 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) - else: - 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 + 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]] - else: - l_name_to_remove = l_name + print "You will remove all of:" + print l_name_to_remove - 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) + for module in set(l_name_to_remove): + + try: + subprocess.check_call(["module_handler.py", "clean", module]) + except: + raise + + for module in set(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" % module diff --git a/scripts/utility/pydot.py b/scripts/utility/pydot.py deleted file mode 100644 index c4a84bb6..00000000 --- a/scripts/utility/pydot.py +++ /dev/null @@ -1,2126 +0,0 @@ -# -*- coding: Latin-1 -*- -"""Graphviz's dot language Python interface. - -This module provides with a full interface to create handle modify -and process graphs in Graphviz's dot language. - -References: - -pydot Homepage: http://code.google.com/p/pydot/ -Graphviz: http://www.graphviz.org/ -DOT Language: http://www.graphviz.org/doc/info/lang.html - -Programmed and tested with Graphviz 2.26.3 and Python 2.6 on OSX 10.6.4 - -Copyright (c) 2005-2011 Ero Carrera - -Distributed under MIT license [http://opensource.org/licenses/mit-license.html]. -""" - -__author__ = 'Ero Carrera' -__version__ = '1.0.*' -__license__ = 'MIT' - -import os -import re -import subprocess -import tempfile -import copy -import sys - -try: - import dot_parser -except Exception as e: - pass - # print >> sys.stderr, "Couldn't import dot_parser, loading of dot files will not be possible." - - -GRAPH_ATTRIBUTES = set(['Damping', 'K', 'URL', 'aspect', 'bb', 'bgcolor', - 'center', 'charset', 'clusterrank', 'colorscheme', 'comment', 'compound', - 'concentrate', 'defaultdist', 'dim', 'dimen', 'diredgeconstraints', - 'dpi', 'epsilon', 'esep', 'fontcolor', 'fontname', 'fontnames', - 'fontpath', 'fontsize', 'id', 'label', 'labeljust', 'labelloc', - 'landscape', 'layers', 'layersep', 'layout', 'levels', 'levelsgap', - 'lheight', 'lp', 'lwidth', 'margin', 'maxiter', 'mclimit', 'mindist', - 'mode', 'model', 'mosek', 'nodesep', 'nojustify', 'normalize', 'nslimit', - 'nslimit1', 'ordering', 'orientation', 'outputorder', 'overlap', - 'overlap_scaling', 'pack', 'packmode', 'pad', 'page', 'pagedir', - 'quadtree', 'quantum', 'rankdir', 'ranksep', 'ratio', 'remincross', - 'repulsiveforce', 'resolution', 'root', 'rotate', 'searchsize', 'sep', - 'showboxes', 'size', 'smoothing', 'sortv', 'splines', 'start', - 'stylesheet', 'target', 'truecolor', 'viewport', 'voro_margin', - # for subgraphs - 'rank']) - - -EDGE_ATTRIBUTES = set(['URL', - 'arrowhead', - 'arrowsize', - 'arrowtail', - 'color', - 'colorscheme', - 'comment', - 'constraint', - 'decorate', - 'dir', - 'edgeURL', - 'edgehref', - 'edgetarget', - 'edgetooltip', - 'fontcolor', - 'fontname', - 'fontsize', - 'headURL', - 'headclip', - 'headhref', - 'headlabel', - 'headport', - 'headtarget', - 'headtooltip', - 'href', - 'id', - 'label', - 'labelURL', - 'labelangle', - 'labeldistance', - 'labelfloat', - 'labelfontcolor', - 'labelfontname', - 'labelfontsize', - 'labelhref', - 'labeltarget', - 'labeltooltip', - 'layer', - 'len', - 'lhead', - 'lp', - 'ltail', - 'minlen', - 'nojustify', - 'penwidth', - 'pos', - 'samehead', - 'sametail', - 'showboxes', - 'style', - 'tailURL', - 'tailclip', - 'tailhref', - 'taillabel', - 'tailport', - 'tailtarget', - 'tailtooltip', - 'target', - 'tooltip', - 'weight', - 'rank']) - - -NODE_ATTRIBUTES = set(['URL', 'color', 'colorscheme', 'comment', - 'distortion', 'fillcolor', 'fixedsize', 'fontcolor', 'fontname', - 'fontsize', 'group', 'height', 'id', 'image', 'imagescale', 'label', - 'labelloc', 'layer', 'margin', 'nojustify', 'orientation', 'penwidth', - 'peripheries', 'pin', 'pos', 'rects', 'regular', 'root', 'samplepoints', - 'shape', 'shapefile', 'showboxes', 'sides', 'skew', 'sortv', 'style', - 'target', 'tooltip', 'vertices', 'width', 'z', - # The following are attributes dot2tex - 'texlbl', 'texmode']) - - -CLUSTER_ATTRIBUTES = set(['K', - 'URL', - 'bgcolor', - 'color', - 'colorscheme', - 'fillcolor', - 'fontcolor', - 'fontname', - 'fontsize', - 'label', - 'labeljust', - 'labelloc', - 'lheight', - 'lp', - 'lwidth', - 'nojustify', - 'pencolor', - 'penwidth', - 'peripheries', - 'sortv', - 'style', - 'target', - 'tooltip']) - - -# -# Extented version of ASPN's Python Cookbook Recipe: -# Frozen dictionaries. -# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/414283 -# -# This version freezes dictionaries used as values within dictionaries. -# -class frozendict(dict): - - def _blocked_attribute(obj): - raise AttributeError("A frozendict cannot be modified.") - _blocked_attribute = property(_blocked_attribute) - - __delitem__ = __setitem__ = clear = _blocked_attribute - pop = popitem = setdefault = update = _blocked_attribute - - def __new__(cls, *args, **kw): - new = dict.__new__(cls) - - args_ = [] - for arg in args: - if isinstance(arg, dict): - arg = copy.copy(arg) - for k, v in arg.iteritems(): - if isinstance(v, frozendict): - arg[k] = v - elif isinstance(v, dict): - arg[k] = frozendict(v) - elif isinstance(v, list): - v_ = list() - for elm in v: - if isinstance(elm, dict): - v_.append(frozendict(elm)) - else: - v_.append(elm) - arg[k] = tuple(v_) - args_.append(arg) - else: - args_.append(arg) - - dict.__init__(new, *args_, **kw) - return new - - def __init__(self, *args, **kw): - pass - - def __hash__(self): - try: - return self._cached_hash - except AttributeError: - h = self._cached_hash = hash(tuple(sorted(self.iteritems()))) - return h - - def __repr__(self): - return "frozendict(%s)" % dict.__repr__(self) - - -dot_keywords = ['graph', 'subgraph', 'digraph', 'node', 'edge', 'strict'] - -id_re_alpha_nums = re.compile('^[_a-zA-Z][a-zA-Z0-9_,]*$', re.UNICODE) -id_re_alpha_nums_with_ports = re.compile( - '^[_a-zA-Z][a-zA-Z0-9_,:\"]*[a-zA-Z0-9_,\"]+$', - re.UNICODE) -id_re_num = re.compile('^[0-9,]+$', re.UNICODE) -id_re_with_port = re.compile('^([^:]*):([^:]*)$', re.UNICODE) -id_re_dbl_quoted = re.compile('^\".*\"$', re.S | re.UNICODE) -id_re_html = re.compile('^<.*>$', re.S | re.UNICODE) - - -def needs_quotes(s): - """Checks whether a string is a dot language ID. - - It will check whether the string is solely composed - by the characters allowed in an ID or not. - If the string is one of the reserved keywords it will - need quotes too but the user will need to add them - manually. - """ - - # If the name is a reserved keyword it will need quotes but pydot - # can't tell when it's being used as a keyword or when it's simply - # a name. Hence the user needs to supply the quotes when an element - # would use a reserved keyword as name. This function will return - # false indicating that a keyword string, if provided as-is, won't - # need quotes. - if s in dot_keywords: - return False - - chars = [ord(c) for c in s if ord(c) > 0x7f or ord(c) == 0] - if chars and not id_re_dbl_quoted.match(s) and not id_re_html.match(s): - return True - - for test_re in [ - id_re_alpha_nums, - id_re_num, - id_re_dbl_quoted, - id_re_html, - id_re_alpha_nums_with_ports]: - if test_re.match(s): - return False - - m = id_re_with_port.match(s) - if m: - return needs_quotes(m.group(1)) or needs_quotes(m.group(2)) - - return True - - -def quote_if_necessary(s): - - if isinstance(s, bool): - if s is True: - return 'True' - return 'False' - - if not isinstance(s, basestring): - return s - - if not s: - return s - - if needs_quotes(s): - replace = {'"': r'\"', - "\n": r'\n', - "\r": r'\r'} - for (a, b) in replace.items(): - s = s.replace(a, b) - - return '"' + s + '"' - - return s - - -def graph_from_dot_data(data): - """Load graph as defined by data in DOT format. - - The data is assumed to be in DOT format. It will - be parsed and a Dot class will be returned, - representing the graph. - """ - - return dot_parser.parse_dot_data(data) - - -def graph_from_dot_file(path): - """Load graph as defined by a DOT file. - - The file is assumed to be in DOT format. It will - be loaded, parsed and a Dot class will be returned, - representing the graph. - """ - - fd = file(path, 'rb') - data = fd.read() - fd.close() - - return graph_from_dot_data(data) - - -def graph_from_edges(edge_list, node_prefix='', directed=False): - """Creates a basic graph out of an edge list. - - The edge list has to be a list of tuples representing - the nodes connected by the edge. - The values can be anything: bool, int, float, str. - - If the graph is undirected by default, it is only - calculated from one of the symmetric halves of the matrix. - """ - - if directed: - graph = Dot(graph_type='digraph') - - else: - graph = Dot(graph_type='graph') - - for edge in edge_list: - - if isinstance(edge[0], str): - src = node_prefix + edge[0] - else: - src = node_prefix + str(edge[0]) - - if isinstance(edge[1], str): - dst = node_prefix + edge[1] - else: - dst = node_prefix + str(edge[1]) - - e = Edge(src, dst) - graph.add_edge(e) - - return graph - - -def graph_from_adjacency_matrix(matrix, node_prefix=u'', directed=False): - """Creates a basic graph out of an adjacency matrix. - - The matrix has to be a list of rows of values - representing an adjacency matrix. - The values can be anything: bool, int, float, as long - as they can evaluate to True or False. - """ - - node_orig = 1 - - if directed: - graph = Dot(graph_type='digraph') - else: - graph = Dot(graph_type='graph') - - for row in matrix: - if not directed: - skip = matrix.index(row) - r = row[skip:] - else: - skip = 0 - r = row - node_dest = skip + 1 - - for e in r: - if e: - graph.add_edge( - Edge(node_prefix + node_orig, - node_prefix + node_dest)) - node_dest += 1 - node_orig += 1 - - return graph - - -def graph_from_incidence_matrix(matrix, node_prefix='', directed=False): - """Creates a basic graph out of an incidence matrix. - - The matrix has to be a list of rows of values - representing an incidence matrix. - The values can be anything: bool, int, float, as long - as they can evaluate to True or False. - """ - - node_orig = 1 - - if directed: - graph = Dot(graph_type='digraph') - else: - graph = Dot(graph_type='graph') - - for row in matrix: - nodes = [] - c = 1 - - for node in row: - if node: - nodes.append(c * node) - c += 1 - nodes.sort() - - if len(nodes) == 2: - graph.add_edge( - Edge(node_prefix + abs(nodes[0]), - node_prefix + nodes[1])) - - if not directed: - graph.set_simplify(True) - - return graph - - -def __find_executables(path): - """Used by find_graphviz - - path - single directory as a string - - If any of the executables are found, it will return a dictionary - containing the program names as keys and their paths as values. - - Otherwise returns None - """ - - success = False - progs = { - 'dot': '', - 'twopi': '', - 'neato': '', - 'circo': '', - 'fdp': '', - 'sfdp': ''} - - was_quoted = False - path = path.strip() - if path.startswith('"') and path.endswith('"'): - path = path[1:-1] - was_quoted = True - - if os.path.isdir(path): - - for prg in progs.iterkeys(): - - if progs[prg]: - continue - - if os.path.exists(os.path.join(path, prg)): - - if was_quoted: - progs[prg] = '"' + os.path.join(path, prg) + '"' - else: - progs[prg] = os.path.join(path, prg) - - success = True - - elif os.path.exists(os.path.join(path, prg + '.exe')): - - if was_quoted: - progs[prg] = '"' + os.path.join(path, prg + '.exe') + '"' - else: - progs[prg] = os.path.join(path, prg + '.exe') - - success = True - - if success: - - return progs - - else: - - return None - - -# The multi-platform version of this 'find_graphviz' function was -# contributed by Peter Cock -# -def find_graphviz(): - """Locate Graphviz's executables in the system. - - Tries three methods: - - First: Windows Registry (Windows only) - This requires Mark Hammond's pywin32 is installed. - - Secondly: Search the path - It will look for 'dot', 'twopi' and 'neato' in all the directories - specified in the PATH environment variable. - - Thirdly: Default install location (Windows only) - It will look for 'dot', 'twopi' and 'neato' in the default install - location under the "Program Files" directory. - - It will return a dictionary containing the program names as keys - and their paths as values. - - If this fails, it returns None. - """ - - # Method 1 (Windows only) - # - if os.sys.platform == 'win32': - - HKEY_LOCAL_MACHINE = 0x80000002 - KEY_QUERY_VALUE = 0x0001 - - RegOpenKeyEx = None - RegQueryValueEx = None - RegCloseKey = None - - try: - import win32api - import win32con - RegOpenKeyEx = win32api.RegOpenKeyEx - RegQueryValueEx = win32api.RegQueryValueEx - RegCloseKey = win32api.RegCloseKey - - except ImportError: - # Print a messaged suggesting they install these? - # - pass - - try: - import ctypes - - def RegOpenKeyEx(key, subkey, opt, sam): - result = ctypes.c_uint(0) - ctypes.windll.advapi32.RegOpenKeyExA( - key, - subkey, - opt, - sam, - ctypes.byref(result)) - return result.value - - def RegQueryValueEx(hkey, valuename): - data_type = ctypes.c_uint(0) - data_len = ctypes.c_uint(1024) - data = ctypes.create_string_buffer(1024) - - res = ctypes.windll.advapi32.RegQueryValueExA( - hkey, - valuename, - 0, - ctypes.byref(data_type), - data, - ctypes.byref(data_len)) - - return data.value - - RegCloseKey = ctypes.windll.advapi32.RegCloseKey - - except ImportError: - # Print a messaged suggesting they install these? - # - pass - - if RegOpenKeyEx is not None: - - # Get the GraphViz install path from the registry - # - hkey = None - potentialKeys = [ - "SOFTWARE\\ATT\\Graphviz", - "SOFTWARE\\AT&T Research Labs\\Graphviz", - ] - for potentialKey in potentialKeys: - - try: - hkey = RegOpenKeyEx(HKEY_LOCAL_MACHINE, - potentialKey, 0, KEY_QUERY_VALUE) - - if hkey is not None: - path = RegQueryValueEx(hkey, "InstallPath") - RegCloseKey(hkey) - - # The regitry variable might exist, left by old installations - # but with no value, in those cases we keep - # searching... - if not path: - continue - - # Now append the "bin" subdirectory: - # - path = os.path.join(path, "bin") - progs = __find_executables(path) - if progs is not None: - # print "Used Windows registry" - return progs - - except Exception as excp: - #raise excp - pass - else: - break - - # Method 2 (Linux, Windows etc) - # - if 'PATH' in os.environ: - - for path in os.environ['PATH'].split(os.pathsep): - progs = __find_executables(path) - if progs is not None: - # print "Used path" - return progs - - # Method 3 (Windows only) - # - if os.sys.platform == 'win32': - - # Try and work out the equivalent of "C:\Program Files" on this - # machine (might be on drive D:, or in a different language) - # - - if 'PROGRAMFILES' in os.environ: - - # Note, we could also use the win32api to get this - # information, but win32api may not be installed. - - path = os.path.join( - os.environ['PROGRAMFILES'], - 'ATT', - 'GraphViz', - 'bin') - - else: - - # Just in case, try the default... - path = r"C:\Program Files\att\Graphviz\bin" - - progs = __find_executables(path) - - if progs is not None: - - # print "Used default install location" - return progs - - for path in ( - '/usr/bin', '/usr/local/bin', - '/opt/local/bin', - '/opt/bin', '/sw/bin', '/usr/share', - '/Applications/Graphviz.app/Contents/MacOS/'): - - progs = __find_executables(path) - if progs is not None: - # print "Used path" - return progs - - # Failed to find GraphViz - # - return None - - -class Common: - - """Common information to several classes. - - Should not be directly used, several classes are derived from - this one. - """ - - def __getstate__(self): - - dict = copy.copy(self.obj_dict) - - return dict - - def __setstate__(self, state): - - self.obj_dict = state - - def __get_attribute__(self, attr): - """Look for default attributes for this node""" - - attr_val = self.obj_dict['attributes'].get(attr, None) - - if attr_val is None: - # get the defaults for nodes/edges - - default_node_name = self.obj_dict['type'] - - # The defaults for graphs are set on a node named 'graph' - if default_node_name in ('subgraph', 'digraph', 'cluster'): - default_node_name = 'graph' - - g = self.get_parent_graph() - if g is not None: - defaults = g.get_node(default_node_name) - else: - return None - - # Multiple defaults could be set by having repeated 'graph [...]' - # 'node [...]', 'edge [...]' statements. In such case, if the - # same attribute is set in different statements, only the first - # will be returned. In order to get all, one would call the - # get_*_defaults() methods and handle those. Or go node by node - # (of the ones specifying defaults) and modify the attributes - # individually. - # - if not isinstance(defaults, (list, tuple)): - defaults = [defaults] - - for default in defaults: - attr_val = default.obj_dict['attributes'].get(attr, None) - if attr_val: - return attr_val - else: - return attr_val - - return None - - def set_parent_graph(self, parent_graph): - - self.obj_dict['parent_graph'] = parent_graph - - def get_parent_graph(self): - - return self.obj_dict.get('parent_graph', None) - - def set(self, name, value): - """Set an attribute value by name. - - Given an attribute 'name' it will set its value to 'value'. - There's always the possibility of using the methods: - - set_'name'(value) - - which are defined for all the existing attributes. - """ - - self.obj_dict['attributes'][name] = value - - def get(self, name): - """Get an attribute value by name. - - Given an attribute 'name' it will get its value. - There's always the possibility of using the methods: - - get_'name'() - - which are defined for all the existing attributes. - """ - - return self.obj_dict['attributes'].get(name, None) - - def get_attributes(self): - """""" - - return self.obj_dict['attributes'] - - def set_sequence(self, seq): - - self.obj_dict['sequence'] = seq - - def get_sequence(self): - - return self.obj_dict['sequence'] - - def create_attribute_methods(self, obj_attributes): - - # for attr in self.obj_dict['attributes']: - for attr in obj_attributes: - - # Generate all the Setter methods. - # - self.__setattr__( - 'set_' + - attr, - lambda x, - a=attr: self.obj_dict['attributes'].__setitem__( - a, - x)) - - # Generate all the Getter methods. - # - self.__setattr__( - 'get_' + attr, - lambda a=attr: self.__get_attribute__(a)) - - -class Error(Exception): - - """General error handling class. - """ - - def __init__(self, value): - self.value = value - - def __str__(self): - return self.value - - -class InvocationException(Exception): - - """To indicate that a ploblem occurred while running any of the GraphViz executables. - """ - - def __init__(self, value): - self.value = value - - def __str__(self): - return self.value - - -class Node(object, Common): - - """A graph node. - - This class represents a graph's node with all its attributes. - - node(name, attribute=value, ...) - - name: node's name - - All the attributes defined in the Graphviz dot language should - be supported. - """ - - def __init__(self, name='', obj_dict=None, **attrs): - - # - # Nodes will take attributes of all other types because the defaults - # for any GraphViz object are dealt with as if they were Node definitions - # - - if obj_dict is not None: - - self.obj_dict = obj_dict - - else: - - self.obj_dict = dict() - - # Copy the attributes - # - self.obj_dict['attributes'] = dict(attrs) - self.obj_dict['type'] = 'node' - self.obj_dict['parent_graph'] = None - self.obj_dict['parent_node_list'] = None - self.obj_dict['sequence'] = None - - # Remove the compass point - # - port = None - if isinstance(name, basestring) and not name.startswith('"'): - idx = name.find(':') - if idx > 0 and idx + 1 < len(name): - name, port = name[:idx], name[idx:] - - if isinstance(name, (long, int)): - name = str(name) - - self.obj_dict['name'] = quote_if_necessary(name) - self.obj_dict['port'] = port - - self.create_attribute_methods(NODE_ATTRIBUTES) - - def set_name(self, node_name): - """Set the node's name.""" - - self.obj_dict['name'] = node_name - - def get_name(self): - """Get the node's name.""" - - return self.obj_dict['name'] - - def get_port(self): - """Get the node's port.""" - - return self.obj_dict['port'] - - def add_style(self, style): - - styles = self.obj_dict['attributes'].get('style', None) - if not styles and style: - styles = [style] - else: - styles = styles.split(',') - styles.append(style) - - self.obj_dict['attributes']['style'] = ','.join(styles) - - def to_string(self): - """Returns a string representation of the node in dot language. - """ - - # RMF: special case defaults for node, edge and graph properties. - # - node = quote_if_necessary(self.obj_dict['name']) - - node_attr = list() - - for attr, value in self.obj_dict['attributes'].iteritems(): - if value is not None: - node_attr.append('%s=%s' % (attr, quote_if_necessary(value))) - else: - node_attr.append(attr) - - # No point in having nodes setting any defaults if the don't set - # any attributes... - # - if node in ('graph', 'node', 'edge') and len(node_attr) == 0: - return '' - - node_attr = ', '.join(node_attr) - - if node_attr: - node += ' [' + node_attr + ']' - - return node + ';' - - -class Edge(object, Common): - - """A graph edge. - - This class represents a graph's edge with all its attributes. - - edge(src, dst, attribute=value, ...) - - src: source node's name - dst: destination node's name - - All the attributes defined in the Graphviz dot language should - be supported. - - Attributes can be set through the dynamically generated methods: - - set_[attribute name], i.e. set_label, set_fontname - - or directly by using the instance's special dictionary: - - Edge.obj_dict['attributes'][attribute name], i.e. - - edge_instance.obj_dict['attributes']['label'] - edge_instance.obj_dict['attributes']['fontname'] - - """ - - def __init__(self, src='', dst='', obj_dict=None, **attrs): - - if isinstance(src, (list, tuple)) and dst == '': - src, dst = src - - if obj_dict is not None: - - self.obj_dict = obj_dict - - else: - - self.obj_dict = dict() - - # Copy the attributes - # - self.obj_dict['attributes'] = dict(attrs) - self.obj_dict['type'] = 'edge' - self.obj_dict['parent_graph'] = None - self.obj_dict['parent_edge_list'] = None - self.obj_dict['sequence'] = None - - if isinstance(src, Node): - src = src.get_name() - - if isinstance(dst, Node): - dst = dst.get_name() - - points = (quote_if_necessary(src), quote_if_necessary(dst)) - - self.obj_dict['points'] = points - - self.create_attribute_methods(EDGE_ATTRIBUTES) - - def get_source(self): - """Get the edges source node name.""" - - return self.obj_dict['points'][0] - - def get_destination(self): - """Get the edge's destination node name.""" - - return self.obj_dict['points'][1] - - def __hash__(self): - - return hash(hash(self.get_source()) + hash(self.get_destination())) - - def __eq__(self, edge): - """Compare two edges. - - If the parent graph is directed, arcs linking - node A to B are considered equal and A->B != B->A - - If the parent graph is undirected, any edge - connecting two nodes is equal to any other - edge connecting the same nodes, A->B == B->A - """ - - if not isinstance(edge, Edge): - raise Error("Can't compare and edge to a non-edge object.") - - if self.get_parent_graph().get_top_graph_type() == 'graph': - - # If the graph is undirected, the edge has neither - # source nor destination. - # - if ((self.get_source() == edge.get_source() and self.get_destination() == edge.get_destination()) or ( - edge.get_source() == self.get_destination() and edge.get_destination() == self.get_source())): - return True - - else: - - if self.get_source() == edge.get_source( - ) and self.get_destination() == edge.get_destination(): - return True - - return False - - def parse_node_ref(self, node_str): - - if not isinstance(node_str, str): - return node_str - - if node_str.startswith('"') and node_str.endswith('"'): - - return node_str - - node_port_idx = node_str.rfind(':') - - if node_port_idx > 0 and node_str[0] == '"' and node_str[ - node_port_idx - - 1] == '"': - - return node_str - - if node_port_idx > 0: - - a = node_str[:node_port_idx] - b = node_str[node_port_idx + 1:] - - node = quote_if_necessary(a) - - node += ':' + quote_if_necessary(b) - - return node - - return node_str - - def to_string(self): - """Returns a string representation of the edge in dot language. - """ - - src = self.parse_node_ref(self.get_source()) - dst = self.parse_node_ref(self.get_destination()) - - if isinstance(src, frozendict): - edge = [Subgraph(obj_dict=src).to_string()] - elif isinstance(src, (int, long)): - edge = [str(src)] - else: - edge = [src] - - if (self.get_parent_graph() and - self.get_parent_graph().get_top_graph_type() and - self.get_parent_graph().get_top_graph_type() == 'digraph'): - - edge.append('->') - - else: - edge.append('--') - - if isinstance(dst, frozendict): - edge.append(Subgraph(obj_dict=dst).to_string()) - elif isinstance(dst, (int, long)): - edge.append(str(dst)) - else: - edge.append(dst) - - edge_attr = list() - - for attr, value in self.obj_dict['attributes'].iteritems(): - - if value is not None: - edge_attr.append('%s=%s' % (attr, quote_if_necessary(value))) - else: - edge_attr.append(attr) - - edge_attr = ', '.join(edge_attr) - - if edge_attr: - edge.append(' [' + edge_attr + ']') - - return ' '.join(edge) + ';' - - -class Graph(object, Common): - - """Class representing a graph in Graphviz's dot language. - - This class implements the methods to work on a representation - of a graph in Graphviz's dot language. - - graph( graph_name='G', graph_type='digraph', - strict=False, suppress_disconnected=False, attribute=value, ...) - - graph_name: - the graph's name - graph_type: - can be 'graph' or 'digraph' - suppress_disconnected: - defaults to False, which will remove from the - graph any disconnected nodes. - simplify: - if True it will avoid displaying equal edges, i.e. - only one edge between two nodes. removing the - duplicated ones. - - All the attributes defined in the Graphviz dot language should - be supported. - - Attributes can be set through the dynamically generated methods: - - set_[attribute name], i.e. set_size, set_fontname - - or using the instance's attributes: - - Graph.obj_dict['attributes'][attribute name], i.e. - - graph_instance.obj_dict['attributes']['label'] - graph_instance.obj_dict['attributes']['fontname'] - """ - - def __init__( - self, - graph_name='G', - obj_dict=None, - graph_type='digraph', - strict=False, - suppress_disconnected=False, - simplify=False, - **attrs): - - if obj_dict is not None: - self.obj_dict = obj_dict - - else: - - self.obj_dict = dict() - - self.obj_dict['attributes'] = dict(attrs) - - if graph_type not in ['graph', 'digraph']: - raise Error( - 'Invalid type "%s". Accepted graph types are: graph, digraph, subgraph' % - graph_type) - - self.obj_dict['name'] = quote_if_necessary(graph_name) - self.obj_dict['type'] = graph_type - - self.obj_dict['strict'] = strict - self.obj_dict['suppress_disconnected'] = suppress_disconnected - self.obj_dict['simplify'] = simplify - - self.obj_dict['current_child_sequence'] = 1 - self.obj_dict['nodes'] = dict() - self.obj_dict['edges'] = dict() - self.obj_dict['subgraphs'] = dict() - - self.set_parent_graph(self) - - self.create_attribute_methods(GRAPH_ATTRIBUTES) - - def get_graph_type(self): - - return self.obj_dict['type'] - - def get_top_graph_type(self): - - parent = self - while True: - parent_ = parent.get_parent_graph() - if parent_ == parent: - break - parent = parent_ - - return parent.obj_dict['type'] - - def set_graph_defaults(self, **attrs): - - self.add_node(Node('graph', **attrs)) - - def get_graph_defaults(self, **attrs): - - graph_nodes = self.get_node('graph') - - if isinstance(graph_nodes, (list, tuple)): - return [node.get_attributes() for node in graph_nodes] - - return graph_nodes.get_attributes() - - def set_node_defaults(self, **attrs): - - self.add_node(Node('node', **attrs)) - - def get_node_defaults(self, **attrs): - - graph_nodes = self.get_node('node') - - if isinstance(graph_nodes, (list, tuple)): - return [node.get_attributes() for node in graph_nodes] - - return graph_nodes.get_attributes() - - def set_edge_defaults(self, **attrs): - - self.add_node(Node('edge', **attrs)) - - def get_edge_defaults(self, **attrs): - - graph_nodes = self.get_node('edge') - - if isinstance(graph_nodes, (list, tuple)): - return [node.get_attributes() for node in graph_nodes] - - return graph_nodes.get_attributes() - - def set_simplify(self, simplify): - """Set whether to simplify or not. - - If True it will avoid displaying equal edges, i.e. - only one edge between two nodes. removing the - duplicated ones. - """ - - self.obj_dict['simplify'] = simplify - - def get_simplify(self): - """Get whether to simplify or not. - - Refer to set_simplify for more information. - """ - - return self.obj_dict['simplify'] - - def set_type(self, graph_type): - """Set the graph's type, 'graph' or 'digraph'.""" - - self.obj_dict['type'] = graph_type - - def get_type(self): - """Get the graph's type, 'graph' or 'digraph'.""" - - return self.obj_dict['type'] - - def set_name(self, graph_name): - """Set the graph's name.""" - - self.obj_dict['name'] = graph_name - - def get_name(self): - """Get the graph's name.""" - - return self.obj_dict['name'] - - def set_strict(self, val): - """Set graph to 'strict' mode. - - This option is only valid for top level graphs. - """ - - self.obj_dict['strict'] = val - - def get_strict(self, val): - """Get graph's 'strict' mode (True, False). - - This option is only valid for top level graphs. - """ - - return self.obj_dict['strict'] - - def set_suppress_disconnected(self, val): - """Suppress disconnected nodes in the output graph. - - This option will skip nodes in the graph with no incoming or outgoing - edges. This option works also for subgraphs and has effect only in the - current graph/subgraph. - """ - - self.obj_dict['suppress_disconnected'] = val - - def get_suppress_disconnected(self, val): - """Get if suppress disconnected is set. - - Refer to set_suppress_disconnected for more information. - """ - - return self.obj_dict['suppress_disconnected'] - - def get_next_sequence_number(self): - - seq = self.obj_dict['current_child_sequence'] - - self.obj_dict['current_child_sequence'] += 1 - - return seq - - def add_node(self, graph_node): - """Adds a node object to the graph. - - It takes a node object as its only argument and returns - None. - """ - - if not isinstance(graph_node, Node): - raise TypeError( - 'add_node() received a non node class object: ' + - str(graph_node)) - - node = self.get_node(graph_node.get_name()) - - if not node: - - self.obj_dict['nodes'][ - graph_node.get_name()] = [ - graph_node.obj_dict] - - #self.node_dict[graph_node.get_name()] = graph_node.attributes - graph_node.set_parent_graph(self.get_parent_graph()) - - else: - - self.obj_dict['nodes'][ - graph_node.get_name()].append( - graph_node.obj_dict) - - graph_node.set_sequence(self.get_next_sequence_number()) - - def del_node(self, name, index=None): - """Delete a node from the graph. - - Given a node's name all node(s) with that same name - will be deleted if 'index' is not specified or set - to None. - If there are several nodes with that same name and - 'index' is given, only the node in that position - will be deleted. - - 'index' should be an integer specifying the position - of the node to delete. If index is larger than the - number of nodes with that name, no action is taken. - - If nodes are deleted it returns True. If no action - is taken it returns False. - """ - - if isinstance(name, Node): - name = name.get_name() - - if name in self.obj_dict['nodes']: - - if index is not None and index < len(self.obj_dict['nodes'][name]): - del self.obj_dict['nodes'][name][index] - return True - else: - del self.obj_dict['nodes'][name] - return True - - return False - - def get_node(self, name): - """Retrieve a node from the graph. - - Given a node's name the corresponding Node - instance will be returned. - - If one or more nodes exist with that name a list of - Node instances is returned. - An empty list is returned otherwise. - """ - - match = list() - - if name in self.obj_dict['nodes']: - - match.extend([Node(obj_dict=obj_dict) - for obj_dict in self.obj_dict['nodes'][name]]) - - return match - - def get_nodes(self): - """Get the list of Node instances.""" - - return self.get_node_list() - - def get_node_list(self): - """Get the list of Node instances. - - This method returns the list of Node instances - composing the graph. - """ - - node_objs = list() - - for node, obj_dict_list in self.obj_dict['nodes'].iteritems(): - node_objs.extend([Node(obj_dict=obj_d) for obj_d in obj_dict_list]) - - return node_objs - - def add_edge(self, graph_edge): - """Adds an edge object to the graph. - - It takes a edge object as its only argument and returns - None. - """ - - if not isinstance(graph_edge, Edge): - raise TypeError( - 'add_edge() received a non edge class object: ' + - str(graph_edge)) - - edge_points = (graph_edge.get_source(), graph_edge.get_destination()) - - if edge_points in self.obj_dict['edges']: - - edge_list = self.obj_dict['edges'][edge_points] - edge_list.append(graph_edge.obj_dict) - - else: - - self.obj_dict['edges'][edge_points] = [graph_edge.obj_dict] - - graph_edge.set_sequence(self.get_next_sequence_number()) - - graph_edge.set_parent_graph(self.get_parent_graph()) - - def del_edge(self, src_or_list, dst=None, index=None): - """Delete an edge from the graph. - - Given an edge's (source, destination) node names all - matching edges(s) will be deleted if 'index' is not - specified or set to None. - If there are several matching edges and 'index' is - given, only the edge in that position will be deleted. - - 'index' should be an integer specifying the position - of the edge to delete. If index is larger than the - number of matching edges, no action is taken. - - If edges are deleted it returns True. If no action - is taken it returns False. - """ - - if isinstance(src_or_list, (list, tuple)): - if dst is not None and isinstance(dst, (int, long)): - index = dst - src, dst = src_or_list - else: - src, dst = src_or_list, dst - - if isinstance(src, Node): - src = src.get_name() - - if isinstance(dst, Node): - dst = dst.get_name() - - if (src, dst) in self.obj_dict['edges']: - - if index is not None and index < len( - self.obj_dict['edges'][ - (src, dst)]): - del self.obj_dict['edges'][(src, dst)][index] - return True - else: - del self.obj_dict['edges'][(src, dst)] - return True - - return False - - def get_edge(self, src_or_list, dst=None): - """Retrieved an edge from the graph. - - Given an edge's source and destination the corresponding - Edge instance(s) will be returned. - - If one or more edges exist with that source and destination - a list of Edge instances is returned. - An empty list is returned otherwise. - """ - - if isinstance(src_or_list, (list, tuple)) and dst is None: - edge_points = tuple(src_or_list) - edge_points_reverse = (edge_points[1], edge_points[0]) - else: - edge_points = (src_or_list, dst) - edge_points_reverse = (dst, src_or_list) - - match = list() - - if edge_points in self.obj_dict['edges'] or ( - self.get_top_graph_type() == 'graph' and edge_points_reverse in self.obj_dict['edges']): - - edges_obj_dict = self.obj_dict['edges'].get( - edge_points, - self.obj_dict['edges'].get(edge_points_reverse, None)) - - for edge_obj_dict in edges_obj_dict: - match.append( - Edge( - edge_points[0], - edge_points[1], - obj_dict=edge_obj_dict)) - - return match - - def get_edges(self): - return self.get_edge_list() - - def get_edge_list(self): - """Get the list of Edge instances. - - This method returns the list of Edge instances - composing the graph. - """ - - edge_objs = list() - - for edge, obj_dict_list in self.obj_dict['edges'].iteritems(): - edge_objs.extend([Edge(obj_dict=obj_d) for obj_d in obj_dict_list]) - - return edge_objs - - def add_subgraph(self, sgraph): - """Adds an subgraph object to the graph. - - It takes a subgraph object as its only argument and returns - None. - """ - - if not isinstance( - sgraph, - Subgraph) and not isinstance( - sgraph, - Cluster): - raise TypeError( - 'add_subgraph() received a non subgraph class object:' + - str(sgraph)) - - if sgraph.get_name() in self.obj_dict['subgraphs']: - - sgraph_list = self.obj_dict['subgraphs'][sgraph.get_name()] - sgraph_list.append(sgraph.obj_dict) - - else: - self.obj_dict['subgraphs'][sgraph.get_name()] = [sgraph.obj_dict] - - sgraph.set_sequence(self.get_next_sequence_number()) - - sgraph.set_parent_graph(self.get_parent_graph()) - - def get_subgraph(self, name): - """Retrieved a subgraph from the graph. - - Given a subgraph's name the corresponding - Subgraph instance will be returned. - - If one or more subgraphs exist with the same name, a list of - Subgraph instances is returned. - An empty list is returned otherwise. - """ - - match = list() - - if name in self.obj_dict['subgraphs']: - - sgraphs_obj_dict = self.obj_dict['subgraphs'].get(name) - - for obj_dict_list in sgraphs_obj_dict: - #match.extend( Subgraph( obj_dict = obj_d ) for obj_d in obj_dict_list ) - match.append(Subgraph(obj_dict=obj_dict_list)) - - return match - - def get_subgraphs(self): - - return self.get_subgraph_list() - - def get_subgraph_list(self): - """Get the list of Subgraph instances. - - This method returns the list of Subgraph instances - in the graph. - """ - - sgraph_objs = list() - - for sgraph, obj_dict_list in self.obj_dict['subgraphs'].iteritems(): - sgraph_objs.extend([Subgraph(obj_dict=obj_d) - for obj_d in obj_dict_list]) - - return sgraph_objs - - def set_parent_graph(self, parent_graph): - - self.obj_dict['parent_graph'] = parent_graph - - for obj_list in self.obj_dict['nodes'].itervalues(): - for obj in obj_list: - obj['parent_graph'] = parent_graph - - for obj_list in self.obj_dict['edges'].itervalues(): - for obj in obj_list: - obj['parent_graph'] = parent_graph - - for obj_list in self.obj_dict['subgraphs'].itervalues(): - for obj in obj_list: - Graph(obj_dict=obj).set_parent_graph(parent_graph) - - def to_string(self): - """Returns a string representation of the graph in dot language. - - It will return the graph and all its subelements in string from. - """ - - graph = list() - - if self.obj_dict.get('strict', None) is not None: - - if self == self.get_parent_graph() and self.obj_dict['strict']: - - graph.append('strict ') - - if self.obj_dict['name'] == '': - if 'show_keyword' in self.obj_dict and self.obj_dict[ - 'show_keyword']: - graph.append('subgraph {\n') - else: - graph.append('{\n') - else: - graph.append( - '%s %s {\n' % - (self.obj_dict['type'], self.obj_dict['name'])) - - for attr in self.obj_dict['attributes'].iterkeys(): - - if self.obj_dict['attributes'].get(attr, None) is not None: - - val = self.obj_dict['attributes'].get(attr) - if val is not None: - graph.append('%s=%s' % (attr, quote_if_necessary(val))) - else: - graph.append(attr) - - graph.append(';\n') - - edges_done = set() - - edge_obj_dicts = list() - for e in self.obj_dict['edges'].itervalues(): - edge_obj_dicts.extend(e) - - if edge_obj_dicts: - edge_src_set, edge_dst_set = zip( - *[obj['points'] for obj in edge_obj_dicts]) - edge_src_set, edge_dst_set = set(edge_src_set), set(edge_dst_set) - else: - edge_src_set, edge_dst_set = set(), set() - - node_obj_dicts = list() - for e in self.obj_dict['nodes'].itervalues(): - node_obj_dicts.extend(e) - - sgraph_obj_dicts = list() - for sg in self.obj_dict['subgraphs'].itervalues(): - sgraph_obj_dicts.extend(sg) - - obj_list = sorted([(obj['sequence'], obj) for obj in ( - edge_obj_dicts + node_obj_dicts + sgraph_obj_dicts)]) - - for idx, obj in obj_list: - - if obj['type'] == 'node': - - node = Node(obj_dict=obj) - - if self.obj_dict.get('suppress_disconnected', False): - - if (node.get_name() not in edge_src_set and - node.get_name() not in edge_dst_set): - - continue - - graph.append(node.to_string() + '\n') - - elif obj['type'] == 'edge': - - edge = Edge(obj_dict=obj) - - if self.obj_dict.get('simplify', False) and edge in edges_done: - continue - - graph.append(edge.to_string() + '\n') - edges_done.add(edge) - - else: - - sgraph = Subgraph(obj_dict=obj) - - graph.append(sgraph.to_string() + '\n') - - graph.append('}\n') - - return ''.join(graph) - - -class Subgraph(Graph): - - """Class representing a subgraph in Graphviz's dot language. - - This class implements the methods to work on a representation - of a subgraph in Graphviz's dot language. - - subgraph(graph_name='subG', suppress_disconnected=False, attribute=value, ...) - - graph_name: - the subgraph's name - suppress_disconnected: - defaults to false, which will remove from the - subgraph any disconnected nodes. - All the attributes defined in the Graphviz dot language should - be supported. - - Attributes can be set through the dynamically generated methods: - - set_[attribute name], i.e. set_size, set_fontname - - or using the instance's attributes: - - Subgraph.obj_dict['attributes'][attribute name], i.e. - - subgraph_instance.obj_dict['attributes']['label'] - subgraph_instance.obj_dict['attributes']['fontname'] - """ - - # RMF: subgraph should have all the attributes of graph so it can be passed - # as a graph to all methods - # - def __init__( - self, - graph_name='', - obj_dict=None, - suppress_disconnected=False, - simplify=False, - **attrs): - - Graph.__init__( - self, - graph_name=graph_name, - obj_dict=obj_dict, - suppress_disconnected=suppress_disconnected, - simplify=simplify, - **attrs) - - if obj_dict is None: - - self.obj_dict['type'] = 'subgraph' - - -class Cluster(Graph): - - """Class representing a cluster in Graphviz's dot language. - - This class implements the methods to work on a representation - of a cluster in Graphviz's dot language. - - cluster(graph_name='subG', suppress_disconnected=False, attribute=value, ...) - - graph_name: - the cluster's name (the string 'cluster' will be always prepended) - suppress_disconnected: - defaults to false, which will remove from the - cluster any disconnected nodes. - All the attributes defined in the Graphviz dot language should - be supported. - - Attributes can be set through the dynamically generated methods: - - set_[attribute name], i.e. set_color, set_fontname - - or using the instance's attributes: - - Cluster.obj_dict['attributes'][attribute name], i.e. - - cluster_instance.obj_dict['attributes']['label'] - cluster_instance.obj_dict['attributes']['fontname'] - """ - - def __init__( - self, - graph_name='subG', - obj_dict=None, - suppress_disconnected=False, - simplify=False, - **attrs): - - Graph.__init__( - self, - graph_name=graph_name, - obj_dict=obj_dict, - suppress_disconnected=suppress_disconnected, - simplify=simplify, - **attrs) - - if obj_dict is None: - - self.obj_dict['type'] = 'subgraph' - self.obj_dict['name'] = 'cluster_' + graph_name - - self.create_attribute_methods(CLUSTER_ATTRIBUTES) - - -class Dot(Graph): - - """A container for handling a dot language file. - - This class implements methods to write and process - a dot language file. It is a derived class of - the base class 'Graph'. - """ - - def __init__(self, *argsl, **argsd): - Graph.__init__(self, *argsl, **argsd) - - self.shape_files = list() - - self.progs = None - - self.formats = [ - 'canon', - 'cmap', - 'cmapx', - 'cmapx_np', - 'dia', - 'dot', - 'fig', - 'gd', - 'gd2', - 'gif', - 'hpgl', - 'imap', - 'imap_np', - 'ismap', - 'jpe', - 'jpeg', - 'jpg', - 'mif', - 'mp', - 'pcl', - 'pdf', - 'pic', - 'plain', - 'plain-ext', - 'png', - 'ps', - 'ps2', - 'svg', - 'svgz', - 'vml', - 'vmlz', - 'vrml', - 'vtx', - 'wbmp', - 'xdot', - 'xlib'] - - self.prog = 'dot' - - # Automatically creates all the methods enabling the creation - # of output in any of the supported formats. - for frmt in self.formats: - self.__setattr__( - 'create_' + frmt, - lambda f=frmt, - prog=self.prog: self.create( - format=f, - prog=prog)) - f = self.__dict__['create_' + frmt] - f.__doc__ = '''Refer to the docstring accompanying the 'create' method for more information.''' - - for frmt in self.formats + ['raw']: - self.__setattr__( - 'write_' + frmt, - lambda path, - f=frmt, - prog=self.prog: self.write( - path, - format=f, - prog=prog)) - - f = self.__dict__['write_' + frmt] - f.__doc__ = '''Refer to the docstring accompanying the 'write' method for more information.''' - - def __getstate__(self): - - dict = copy.copy(self.obj_dict) - - return dict - - def __setstate__(self, state): - - self.obj_dict = state - - def set_shape_files(self, file_paths): - """Add the paths of the required image files. - - If the graph needs graphic objects to be used as shapes or otherwise - those need to be in the same folder as the graph is going to be rendered - from. Alternatively the absolute path to the files can be specified when - including the graphics in the graph. - - The files in the location pointed to by the path(s) specified as arguments - to this method will be copied to the same temporary location where the - graph is going to be rendered. - """ - - if isinstance(file_paths, basestring): - self.shape_files.append(file_paths) - - if isinstance(file_paths, (list, tuple)): - self.shape_files.extend(file_paths) - - def set_prog(self, prog): - """Sets the default program. - - Sets the default program in charge of processing - the dot file into a graph. - """ - self.prog = prog - - def set_graphviz_executables(self, paths): - """This method allows to manually specify the location of the GraphViz executables. - - The argument to this method should be a dictionary where the keys are as follows: - - {'dot': '', 'twopi': '', 'neato': '', 'circo': '', 'fdp': ''} - - and the values are the paths to the corresponding executable, including the name - of the executable itself. - """ - - self.progs = paths - - def write(self, path, prog=None, format='raw'): - """Writes a graph to a file. - - Given a filename 'path' it will open/create and truncate - such file and write on it a representation of the graph - defined by the dot object and in the format specified by - 'format'. - The format 'raw' is used to dump the string representation - of the Dot object, without further processing. - The output can be processed by any of graphviz tools, defined - in 'prog', which defaults to 'dot' - Returns True or False according to the success of the write - operation. - - There's also the preferred possibility of using: - - write_'format'(path, prog='program') - - which are automatically defined for all the supported formats. - [write_ps(), write_gif(), write_dia(), ...] - """ - - if prog is None: - prog = self.prog - - dot_fd = file(path, "w+b") - if format == 'raw': - data = self.to_string() - if isinstance(data, basestring): - if not isinstance(data, unicode): - try: - data = unicode(data, 'utf-8') - except: - pass - - try: - data = data.encode('utf-8') - except: - pass - dot_fd.write(data) - else: - dot_fd.write(self.create(prog, format)) - dot_fd.close() - - return True - - def create(self, prog=None, format='ps'): - """Creates and returns a Postscript representation of the graph. - - create will write the graph to a temporary dot file and process - it with the program given by 'prog' (which defaults to 'twopi'), - reading the Postscript output and returning it as a string is the - operation is successful. - On failure None is returned. - - There's also the preferred possibility of using: - - create_'format'(prog='program') - - which are automatically defined for all the supported formats. - [create_ps(), create_gif(), create_dia(), ...] - - If 'prog' is a list instead of a string the fist item is expected - to be the program name, followed by any optional command-line - arguments for it: - - [ 'twopi', '-Tdot', '-s10' ] - """ - - if prog is None: - prog = self.prog - - if isinstance(prog, (list, tuple)): - prog, args = prog[0], prog[1:] - else: - args = [] - - if self.progs is None: - self.progs = find_graphviz() - if self.progs is None: - raise InvocationException( - 'GraphViz\'s executables not found') - - if prog not in self.progs: - raise InvocationException( - 'GraphViz\'s executable "%s" not found' % prog) - - if not os.path.exists( - self.progs[prog]) or not os.path.isfile( - self.progs[prog]): - raise InvocationException( - 'GraphViz\'s executable "%s" is not a file or doesn\'t exist' % - self.progs[prog]) - - tmp_fd, tmp_name = tempfile.mkstemp() - os.close(tmp_fd) - self.write(tmp_name) - tmp_dir = os.path.dirname(tmp_name) - - # For each of the image files... - # - for img in self.shape_files: - - # Get its data - # - f = file(img, 'rb') - f_data = f.read() - f.close() - - # And copy it under a file with the same name in the temporary directory - # - f = file(os.path.join(tmp_dir, os.path.basename(img)), 'wb') - f.write(f_data) - f.close() - - cmdline = [self.progs[prog], '-T' + format, tmp_name] + args - - p = subprocess.Popen( - cmdline, - cwd=tmp_dir, - stderr=subprocess.PIPE, stdout=subprocess.PIPE) - - stderr = p.stderr - stdout = p.stdout - - stdout_output = list() - while True: - data = stdout.read() - if not data: - break - stdout_output.append(data) - stdout.close() - - stdout_output = ''.join(stdout_output) - - if not stderr.closed: - stderr_output = list() - while True: - data = stderr.read() - if not data: - break - stderr_output.append(data) - stderr.close() - - if stderr_output: - stderr_output = ''.join(stderr_output) - - #pid, status = os.waitpid(p.pid, 0) - status = p.wait() - - if status != 0: - raise InvocationException( - 'Program terminated with status: %d. stderr follows: %s' % ( - status, stderr_output)) - elif stderr_output: - print stderr_output - - # For each of the image files... - # - for img in self.shape_files: - - # remove it - # - os.unlink(os.path.join(tmp_dir, os.path.basename(img))) - - os.unlink(tmp_name) - - return stdout_output diff --git a/src/.gitignore b/src/.gitignore index 1e9f0bc4..535e4bd5 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -23,4 +23,6 @@ QmcChem Selectors_full Selectors_no_sorted SingleRefMethod -Casino \ No newline at end of file +Casino +loc_cele +Alavi \ No newline at end of file diff --git a/src/Determinants/README.rst b/src/Determinants/README.rst index b3e8b7a0..823cdd39 100644 --- a/src/Determinants/README.rst +++ b/src/Determinants/README.rst @@ -141,7 +141,7 @@ Documentation After calling this subroutine, N_det, psi_det and psi_coef need to be touched -`create_wf_of_psi_svd_matrix `_ +`create_wf_of_psi_svd_matrix `_ Matrix of wf coefficients. Outer product of alpha and beta determinants @@ -347,7 +347,7 @@ Documentation Determinants are taken from the psi_det_sorted_ab array -`generate_all_alpha_beta_det_products `_ +`generate_all_alpha_beta_det_products `_ Create a wave function from all possible alpha x beta determinants @@ -367,11 +367,11 @@ Documentation Applies get_excitation_degree to an array of determinants -`get_index_in_psi_det_alpha_unique `_ +`get_index_in_psi_det_alpha_unique `_ Returns the index of the determinant in the ``psi_det_alpha_unique`` array -`get_index_in_psi_det_beta_unique `_ +`get_index_in_psi_det_beta_unique `_ Returns the index of the determinant in the ``psi_det_beta_unique`` array @@ -520,11 +520,11 @@ Documentation Number of determinants in the wave function -`n_det_alpha_unique `_ +`n_det_alpha_unique `_ Unique alpha determinants -`n_det_beta_unique `_ +`n_det_beta_unique `_ Unique beta determinants @@ -697,19 +697,19 @@ Documentation is empty -`psi_det_alpha `_ +`psi_det_alpha `_ List of alpha determinants of psi_det -`psi_det_alpha_unique `_ +`psi_det_alpha_unique `_ Unique alpha determinants -`psi_det_beta `_ +`psi_det_beta `_ List of beta determinants of psi_det -`psi_det_beta_unique `_ +`psi_det_beta_unique `_ Unique beta determinants @@ -770,31 +770,31 @@ Documentation psi_occ_pattern(:,2,j) = jth occ_pattern of the wave function : represent all the double occupation -`psi_svd_alpha `_ +`psi_svd_alpha `_ SVD wave function -`psi_svd_beta `_ +`psi_svd_beta `_ SVD wave function -`psi_svd_coefs `_ +`psi_svd_coefs `_ SVD wave function -`psi_svd_matrix `_ +`psi_svd_matrix `_ Matrix of wf coefficients. Outer product of alpha and beta determinants -`psi_svd_matrix_columns `_ +`psi_svd_matrix_columns `_ Matrix of wf coefficients. Outer product of alpha and beta determinants -`psi_svd_matrix_rows `_ +`psi_svd_matrix_rows `_ Matrix of wf coefficients. Outer product of alpha and beta determinants -`psi_svd_matrix_values `_ +`psi_svd_matrix_values `_ Matrix of wf coefficients. Outer product of alpha and beta determinants @@ -910,6 +910,6 @@ Documentation Thresholds on selectors (fraction of the norm) -`write_spindeterminants `_ +`write_spindeterminants `_ Undocumented diff --git a/src/Ezfio_files/.gitignore b/src/Ezfio_files/.gitignore index 85ad9d4e..24230463 100644 --- a/src/Ezfio_files/.gitignore +++ b/src/Ezfio_files/.gitignore @@ -9,4 +9,5 @@ Makefile.depend build.ninja .ninja_log .ninja_deps -ezfio_interface.irp.f \ No newline at end of file +ezfio_interface.irp.f +README.rst \ No newline at end of file diff --git a/src/Ezfio_files/README.rst b/src/Ezfio_files/README.rst deleted file mode 100644 index 6a3a1f2b..00000000 --- a/src/Ezfio_files/README.rst +++ /dev/null @@ -1,160 +0,0 @@ -================== -Ezfio_files Module -================== - -This modules essentially contains the name of the EZFIO directory in the -``ezfio_filename`` variable. This is read as the first argument of the -command-line, or as the ``QPACKAGE_INPUT`` environment variable. -Documentation -============= - -.. Do not edit this section. It was auto-generated from the -.. by the `update_README.py` script. - -`ezfio_filename `_ - Name of EZFIO file. It is obtained from the QPACKAGE_INPUT environment - variable if it is set, or as the 1st argument of the command line. - - -`getunitandopen `_ - :f: - file name - .br - :mode: - 'R' : READ, UNFORMATTED - 'W' : WRITE, UNFORMATTED - 'r' : READ, FORMATTED - 'w' : WRITE, FORMATTED - 'a' : APPEND, FORMATTED - 'x' : READ/WRITE, FORMATTED - .br - - -`output_ao_basis `_ - Output file for AO_Basis - - -`output_bitmask `_ - Output file for Bitmask - - -`output_cas_sd `_ - Output file for CAS_SD - - -`output_cpu_time_0 `_ - Initial CPU and wall times when printing in the output files - - -`output_determinants `_ - Output file for Determinants - - -`output_electrons `_ - Output file for Electrons - - -`output_ezfio_files `_ - Output file for Ezfio_files - - -`output_full_ci `_ - Output file for Full_CI - - -`output_generators_cas `_ - Output file for Generators_CAS - - -`output_generators_full `_ - Output file for Generators_full - - -`output_hartree_fock `_ - Output file for Hartree_Fock - - -`output_integrals_bielec `_ - Output file for Integrals_Bielec - - -`output_integrals_monoelec `_ - Output file for Integrals_Monoelec - - -`output_mo_basis `_ - Output file for MO_Basis - - -`output_moguess `_ - Output file for MOGuess - - -`output_mrcc_cassd `_ - Output file for MRCC_CASSD - - -`output_mrcc_utils `_ - Output file for MRCC_Utils - - -`output_nuclei `_ - Output file for Nuclei - - -`output_perturbation `_ - Output file for Perturbation - - -`output_properties `_ - Output file for Properties - - -`output_pseudo `_ - Output file for Pseudo - - -`output_psiref_cas `_ - Output file for Psiref_CAS - - -`output_psiref_threshold `_ - Output file for Psiref_threshold - - -`output_psiref_utils `_ - Output file for Psiref_Utils - - -`output_qmcchem `_ - Output file for QmcChem - - -`output_selectors_full `_ - Output file for Selectors_full - - -`output_utils `_ - Output file for Utils - - -`output_wall_time_0 `_ - Initial CPU and wall times when printing in the output files - - -`write_bool `_ - Write an logical value in output - - -`write_double `_ - Write a double precision value in output - - -`write_int `_ - Write an integer value in output - - -`write_time `_ - Write a time stamp in the output for chronological reconstruction - - diff --git a/src/MOGuess/H_CORE_guess.irp.f b/src/MOGuess/H_CORE_guess.irp.f index 2e10dd94..1893c08b 100644 --- a/src/MOGuess/H_CORE_guess.irp.f +++ b/src/MOGuess/H_CORE_guess.irp.f @@ -1,11 +1,16 @@ program H_CORE_guess + BEGIN_DOC +! 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 + END_DOC implicit none character*(64) :: label mo_coef = ao_ortho_lowdin_coef TOUCH mo_coef label = "Guess" call mo_as_eigvectors_of_mo_matrix(mo_mono_elec_integral, & - size(mo_mono_elec_integral,1),size(mo_mono_elec_integral,2),label) + size(mo_mono_elec_integral,1), & + size(mo_mono_elec_integral,2),label) print *, 'save mos' call save_mos diff --git a/src/MOGuess/README.rst b/src/MOGuess/README.rst index 03ae8c15..d10b1ef5 100644 --- a/src/MOGuess/README.rst +++ b/src/MOGuess/README.rst @@ -34,5 +34,10 @@ Documentation `h_core_guess `_ - Undocumented + 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 diff --git a/src/MOGuess/h_core_guess_routine.irp.f b/src/MOGuess/h_core_guess_routine.irp.f new file mode 100644 index 00000000..566592ba --- /dev/null +++ b/src/MOGuess/h_core_guess_routine.irp.f @@ -0,0 +1,16 @@ +subroutine hcore_guess + BEGIN_DOC +! Produce `H_core` MO orbital + END_DOC + implicit none + character*(64) :: label + mo_coef = ao_ortho_lowdin_coef + TOUCH mo_coef + label = "Guess" + call mo_as_eigvectors_of_mo_matrix(mo_mono_elec_integral, & + size(mo_mono_elec_integral,1), & + size(mo_mono_elec_integral,2),label) + print *, 'save mos' + call save_mos + SOFT_TOUCH mo_coef mo_label +end