diff --git a/configure b/configure index 5047052c..52ff4216 100755 --- a/configure +++ b/configure @@ -61,7 +61,8 @@ d_dependency = { "gcc": [], "python": [], "ninja": ["gcc", "python"], - "make": [] + "make": [], + "p_graphviz": ["python"] } from collections import namedtuple @@ -126,10 +127,15 @@ ezfio = Info( description=' EZFIO', default_path=join(QP_ROOT_INSTALL, "EZFIO")) +p_graphviz = Info( + url='https://github.com/xflr6/graphviz/archive/master.zip', + 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/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..d4828c6a --- /dev/null +++ b/plugins/Alavi/.gitignore @@ -0,0 +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 +.ninja_deps +ezfio_interface.irp.f +Ezfio_files +Determinants +Integrals_Monoelec +MO_Basis +Utils +Pseudo +Bitmask +AO_Basis +Electrons +Nuclei +Integrals_Bielec +alavi_graph \ 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..f417a6bf --- /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.pdf + +* `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/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/CAS_SD/.gitignore b/plugins/CAS_SD/.gitignore index 81eda54a..ff4f60e7 100644 --- a/plugins/CAS_SD/.gitignore +++ b/plugins/CAS_SD/.gitignore @@ -1,4 +1,4 @@ -# Automatically created by /home/scemama/quantum_package/scripts/module/module_handler.py +# Automatically created by /home/razoa/quantum_package/scripts/module/module_handler.py IRPF90_temp IRPF90_man irpf90_entities diff --git a/plugins/CAS_SD/tree_dependency.png b/plugins/CAS_SD/tree_dependency.png deleted file mode 100644 index 6dd95cc4..00000000 Binary files a/plugins/CAS_SD/tree_dependency.png and /dev/null differ diff --git a/plugins/CID/tree_dependency.png b/plugins/CID/tree_dependency.png deleted file mode 100644 index 64876dcb..00000000 Binary files a/plugins/CID/tree_dependency.png and /dev/null differ diff --git a/plugins/CID_SC2_selected/.gitignore b/plugins/CID_SC2_selected/.gitignore index c030dc88..f0c15969 100644 --- a/plugins/CID_SC2_selected/.gitignore +++ b/plugins/CID_SC2_selected/.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/CID_SC2_selected/tree_dependency.png b/plugins/CID_SC2_selected/tree_dependency.png deleted file mode 100644 index b42aa4bf..00000000 Binary files a/plugins/CID_SC2_selected/tree_dependency.png and /dev/null differ diff --git a/plugins/CID_selected/tree_dependency.png b/plugins/CID_selected/tree_dependency.png deleted file mode 100644 index 753ae2eb..00000000 Binary files a/plugins/CID_selected/tree_dependency.png and /dev/null differ diff --git a/plugins/CIS/.gitignore b/plugins/CIS/.gitignore index eb36f1dc..cdcd6fbb 100644 --- a/plugins/CIS/.gitignore +++ b/plugins/CIS/.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/CIS/tree_dependency.png b/plugins/CIS/tree_dependency.png deleted file mode 100644 index 36856095..00000000 Binary files a/plugins/CIS/tree_dependency.png and /dev/null differ diff --git a/plugins/CISD/tree_dependency.png b/plugins/CISD/tree_dependency.png deleted file mode 100644 index fe371494..00000000 Binary files a/plugins/CISD/tree_dependency.png and /dev/null differ diff --git a/plugins/CISD_SC2_selected/.gitignore b/plugins/CISD_SC2_selected/.gitignore index db8abe23..aac63ca8 100644 --- a/plugins/CISD_SC2_selected/.gitignore +++ b/plugins/CISD_SC2_selected/.gitignore @@ -1,33 +1,31 @@ -# -# Do not modify this file. Add your ignored files to the gitignore -# (without the dot at the beginning) file. -# +# Automatically created by /home/razoa/quantum_package/scripts/module/module_handler.py IRPF90_temp IRPF90_man -irpf90.make -tags -Makefile.depend irpf90_entities -build.ninja +tags +irpf90.make +Makefile +Makefile.depend .ninja_log .ninja_deps -Pseudo -Integrals_Monoelec -Bitmask -Integrals_Bielec -CISD_selected -AOs -Selectors_full -MOs -Hartree_Fock -Perturbation -CISD -Determinants -Electrons -Utils -Properties -Nuclei -MOGuess -SingleRefMethod +ezfio_interface.irp.f Ezfio_files -cisd_sc2_selection +Perturbation +Determinants +Integrals_Monoelec +MO_Basis +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 diff --git a/plugins/CISD_SC2_selected/tree_dependency.png b/plugins/CISD_SC2_selected/tree_dependency.png deleted file mode 100644 index 3eb9b5fa..00000000 Binary files a/plugins/CISD_SC2_selected/tree_dependency.png and /dev/null differ diff --git a/plugins/CISD_selected/tree_dependency.png b/plugins/CISD_selected/tree_dependency.png deleted file mode 100644 index 6074420d..00000000 Binary files a/plugins/CISD_selected/tree_dependency.png and /dev/null differ diff --git a/plugins/Casino/README.rst b/plugins/Casino/README.rst index 02d9dc66..92ec9e00 100644 --- a/plugins/Casino/README.rst +++ b/plugins/Casino/README.rst @@ -21,7 +21,7 @@ Needed Modules .. Do not edit this section. It was auto-generated from the .. by the `update_README.py` script. -.. image:: tree_dependency.png +.. image:: tree_dependency.pdf * `Determinants `_ diff --git a/plugins/Casino/tree_dependency.pdf b/plugins/Casino/tree_dependency.pdf new file mode 100644 index 00000000..87e21d13 Binary files /dev/null and b/plugins/Casino/tree_dependency.pdf differ diff --git a/plugins/Casino/tree_dependency.png b/plugins/Casino/tree_dependency.png deleted file mode 100644 index 98994c93..00000000 Binary files a/plugins/Casino/tree_dependency.png and /dev/null differ diff --git a/plugins/DDCI_selected/.gitignore b/plugins/DDCI_selected/.gitignore index 22fb64a1..2240335e 100644 --- a/plugins/DDCI_selected/.gitignore +++ b/plugins/DDCI_selected/.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/DDCI_selected/tree_dependency.png b/plugins/DDCI_selected/tree_dependency.png deleted file mode 100644 index 6cfc1811..00000000 Binary files a/plugins/DDCI_selected/tree_dependency.png and /dev/null differ 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/FCIdump/tree_dependency.png b/plugins/FCIdump/tree_dependency.png deleted file mode 100644 index e99d0434..00000000 Binary files a/plugins/FCIdump/tree_dependency.png and /dev/null differ diff --git a/plugins/Full_CI/README.rst b/plugins/Full_CI/README.rst index d94675eb..b10c8e86 100644 --- a/plugins/Full_CI/README.rst +++ b/plugins/Full_CI/README.rst @@ -159,7 +159,7 @@ Needed Modules .. Do not edit this section. It was auto-generated from the .. by the `update_README.py` script. -.. image:: tree_dependency.png +.. image:: tree_dependency.pdf * `Perturbation `_ * `Selectors_full `_ diff --git a/plugins/Full_CI/tree_dependency.pdf b/plugins/Full_CI/tree_dependency.pdf new file mode 100644 index 00000000..da678ef8 Binary files /dev/null and b/plugins/Full_CI/tree_dependency.pdf differ diff --git a/plugins/Full_CI/tree_dependency.png b/plugins/Full_CI/tree_dependency.png deleted file mode 100644 index d9ccb24f..00000000 Binary files a/plugins/Full_CI/tree_dependency.png and /dev/null differ diff --git a/plugins/Generators_CAS/tree_dependency.png b/plugins/Generators_CAS/tree_dependency.png deleted file mode 100644 index 2f0b36b8..00000000 Binary files a/plugins/Generators_CAS/tree_dependency.png and /dev/null differ diff --git a/plugins/Generators_full/README.rst b/plugins/Generators_full/README.rst index dc6965e8..a4bdadf8 100644 --- a/plugins/Generators_full/README.rst +++ b/plugins/Generators_full/README.rst @@ -43,7 +43,7 @@ Needed Modules .. Do not edit this section. It was auto-generated from the .. by the `update_README.py` script. -.. image:: tree_dependency.png +.. image:: tree_dependency.pdf * `Determinants `_ * `Hartree_Fock `_ diff --git a/plugins/Generators_full/tree_dependency.pdf b/plugins/Generators_full/tree_dependency.pdf new file mode 100644 index 00000000..2f611a17 Binary files /dev/null and b/plugins/Generators_full/tree_dependency.pdf differ diff --git a/plugins/Generators_full/tree_dependency.png b/plugins/Generators_full/tree_dependency.png deleted file mode 100644 index d5b988f3..00000000 Binary files a/plugins/Generators_full/tree_dependency.png and /dev/null differ 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 7066f7c6..0ab4668c 100644 --- a/plugins/Hartree_Fock/README.rst +++ b/plugins/Hartree_Fock/README.rst @@ -10,7 +10,7 @@ Needed Modules .. Do not edit this section. It was auto-generated from the .. by the `update_README.py` script. -.. image:: tree_dependency.png +.. image:: tree_dependency.pdf * `Integrals_Bielec `_ * `MOGuess `_ @@ -29,16 +29,6 @@ Documentation Alpha Fock matrix in AO basis set -`big `_ - Produce `Huckel` MO orbital - output: mo_basis.mo_tot_num mo_basis.mo_label mo_basis.ao_md5 mo_basis.mo_coef mo_basis.mo_occ - Produce `Hartree_Fock` MO orbital - output: mo_basis.mo_tot_num mo_basis.mo_label mo_basis.ao_md5 mo_basis.mo_coef mo_basis.mo_occ - output: hartree_fock.energy - input: mo_basis.mo_coef - Run SCF calculation - - `create_guess `_ Create an MO guess if no MOs are present in the EZFIO directory diff --git a/plugins/Hartree_Fock/tree_dependency.pdf b/plugins/Hartree_Fock/tree_dependency.pdf new file mode 100644 index 00000000..70308143 Binary files /dev/null and b/plugins/Hartree_Fock/tree_dependency.pdf differ diff --git a/plugins/Hartree_Fock/tree_dependency.png b/plugins/Hartree_Fock/tree_dependency.png deleted file mode 100644 index e4708d5f..00000000 Binary files a/plugins/Hartree_Fock/tree_dependency.png and /dev/null differ diff --git a/plugins/MP2/.gitignore b/plugins/MP2/.gitignore index 2b9a8b38..4d7ba949 100644 --- a/plugins/MP2/.gitignore +++ b/plugins/MP2/.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/MP2/tree_dependency.png b/plugins/MP2/tree_dependency.png deleted file mode 100644 index 96b06f0b..00000000 Binary files a/plugins/MP2/tree_dependency.png and /dev/null differ diff --git a/plugins/MRCC/.gitignore b/plugins/MRCC/.gitignore index 89657629..b36a38a1 100644 --- a/plugins/MRCC/.gitignore +++ b/plugins/MRCC/.gitignore @@ -1,4 +1,4 @@ -# Automatically created by /home/scemama/quantum_package/scripts/module/module_handler.py +# Automatically created by /home/razoa/quantum_package/scripts/module/module_handler.py IRPF90_temp IRPF90_man irpf90_entities diff --git a/plugins/MRCC/mrcc_utils.irp.f b/plugins/MRCC/mrcc_utils.irp.f index b175d655..02147ba1 100644 --- a/plugins/MRCC/mrcc_utils.irp.f +++ b/plugins/MRCC/mrcc_utils.irp.f @@ -17,7 +17,6 @@ do i=1,N_det_non_cas lambda_mrcc(k,i) = psi_non_cas_coef(i,k)/ihpsi(k) if (dabs(ihpsi(k)).le.1.d-3) then lambda_mrcc(k,i) = 1.d0 / (psi_cas_energy_diagonalized(k)-hii) - icount_manu = icount_manu+1 cycle endif enddo diff --git a/plugins/MRCC/tree_dependency.png b/plugins/MRCC/tree_dependency.png deleted file mode 100644 index 87293361..00000000 Binary files a/plugins/MRCC/tree_dependency.png and /dev/null differ diff --git a/plugins/Molden/README.rst b/plugins/Molden/README.rst index 71639cad..64182d98 100644 --- a/plugins/Molden/README.rst +++ b/plugins/Molden/README.rst @@ -33,7 +33,7 @@ Needed Modules .. Do not edit this section. It was auto-generated from the .. by the `update_README.py` script. -.. image:: tree_dependency.png +.. image:: tree_dependency.pdf * `MO_Basis `_ * `Utils `_ diff --git a/plugins/Molden/tree_dependency.pdf b/plugins/Molden/tree_dependency.pdf new file mode 100644 index 00000000..66c1b465 Binary files /dev/null and b/plugins/Molden/tree_dependency.pdf differ diff --git a/plugins/Molden/tree_dependency.png b/plugins/Molden/tree_dependency.png deleted file mode 100644 index 2b9ffd86..00000000 Binary files a/plugins/Molden/tree_dependency.png and /dev/null differ diff --git a/plugins/Perturbation/README.rst b/plugins/Perturbation/README.rst index 9162e94b..51348ae6 100644 --- a/plugins/Perturbation/README.rst +++ b/plugins/Perturbation/README.rst @@ -356,7 +356,7 @@ Needed Modules .. Do not edit this section. It was auto-generated from the .. by the `update_README.py` script. -.. image:: tree_dependency.png +.. image:: tree_dependency.pdf * `Properties `_ * `Hartree_Fock `_ diff --git a/plugins/Perturbation/tree_dependency.pdf b/plugins/Perturbation/tree_dependency.pdf new file mode 100644 index 00000000..879082d8 Binary files /dev/null and b/plugins/Perturbation/tree_dependency.pdf differ diff --git a/plugins/Perturbation/tree_dependency.png b/plugins/Perturbation/tree_dependency.png deleted file mode 100644 index a2176cc3..00000000 Binary files a/plugins/Perturbation/tree_dependency.png and /dev/null differ diff --git a/plugins/Properties/README.rst b/plugins/Properties/README.rst index 5e5ab1cc..a303da3a 100644 --- a/plugins/Properties/README.rst +++ b/plugins/Properties/README.rst @@ -148,7 +148,7 @@ Needed Modules .. Do not edit this section. It was auto-generated from the .. by the `update_README.py` script. -.. image:: tree_dependency.png +.. image:: tree_dependency.pdf * `Determinants `_ diff --git a/plugins/Properties/tree_dependency.pdf b/plugins/Properties/tree_dependency.pdf new file mode 100644 index 00000000..bada32a5 Binary files /dev/null and b/plugins/Properties/tree_dependency.pdf differ diff --git a/plugins/Properties/tree_dependency.png b/plugins/Properties/tree_dependency.png deleted file mode 100644 index a2198952..00000000 Binary files a/plugins/Properties/tree_dependency.png and /dev/null differ diff --git a/plugins/QmcChem/.gitignore b/plugins/QmcChem/.gitignore index 94d13083..4abda663 100644 --- a/plugins/QmcChem/.gitignore +++ b/plugins/QmcChem/.gitignore @@ -1,4 +1,4 @@ -# Automatically created by /home/scemama/quantum_package/scripts/module/module_handler.py +# Automatically created by /home/razoa/quantum_package/scripts/module/module_handler.py IRPF90_temp IRPF90_man irpf90_entities diff --git a/plugins/QmcChem/tree_dependency.png b/plugins/QmcChem/tree_dependency.png deleted file mode 100644 index c546d455..00000000 Binary files a/plugins/QmcChem/tree_dependency.png and /dev/null differ diff --git a/plugins/Selectors_full/README.rst b/plugins/Selectors_full/README.rst index 33cbaf16..14c8a96c 100644 --- a/plugins/Selectors_full/README.rst +++ b/plugins/Selectors_full/README.rst @@ -181,7 +181,7 @@ Needed Modules .. Do not edit this section. It was auto-generated from the .. by the `update_README.py` script. -.. image:: tree_dependency.png +.. image:: tree_dependency.pdf * `Determinants `_ * `Hartree_Fock `_ diff --git a/plugins/Selectors_full/tree_dependency.pdf b/plugins/Selectors_full/tree_dependency.pdf new file mode 100644 index 00000000..0ec1e90f Binary files /dev/null and b/plugins/Selectors_full/tree_dependency.pdf differ diff --git a/plugins/Selectors_full/tree_dependency.png b/plugins/Selectors_full/tree_dependency.png deleted file mode 100644 index 727db901..00000000 Binary files a/plugins/Selectors_full/tree_dependency.png and /dev/null differ 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/SingleRefMethod/tree_dependency.png b/plugins/SingleRefMethod/tree_dependency.png deleted file mode 100644 index 0c44f3b2..00000000 Binary files a/plugins/SingleRefMethod/tree_dependency.png and /dev/null differ diff --git a/plugins/loc_cele/README.rst b/plugins/loc_cele/README.rst index c2bd983d..c9d0e9d2 100644 --- a/plugins/loc_cele/README.rst +++ b/plugins/loc_cele/README.rst @@ -16,7 +16,7 @@ Needed Modules .. Do not edit this section. It was auto-generated from the .. by the `update_README.py` script. -.. image:: tree_dependency.png +.. image:: tree_dependency.pdf * `MO_Basis `_ diff --git a/plugins/loc_cele/tree_dependency.pdf b/plugins/loc_cele/tree_dependency.pdf new file mode 100644 index 00000000..f1d4b64b Binary files /dev/null and b/plugins/loc_cele/tree_dependency.pdf differ diff --git a/plugins/loc_cele/tree_dependency.png b/plugins/loc_cele/tree_dependency.png deleted file mode 100644 index 9ab804fd..00000000 Binary files a/plugins/loc_cele/tree_dependency.png and /dev/null differ diff --git a/scripts/compilation/qp_create_ninja.py b/scripts/compilation/qp_create_ninja.py index c49f4cc1..a3e8aa00 100755 --- a/scripts/compilation/qp_create_ninja.py +++ b/scripts/compilation/qp_create_ninja.py @@ -530,7 +530,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(root_module.abs, "tree_dependency.pdf") l_string = ["build {0}: build_readme {1} {2} {3}".format(path_readme, tags, @@ -714,7 +714,7 @@ def ninja_dot_tree_rule(): def ninja_dot_tree_build(path_module, l_module): - path_tree = join(path_module.abs, "tree_dependency.png") + path_tree = join(path_module.abs, "tree_dependency.pdf") l_dep = [join(path.abs, "NEEDED_CHILDREN_MODULES") for path in l_module] l_string = ["build {0}: build_dot_tree {1}".format(path_tree, " ".join(l_dep)), " module_abs = {0}".format(path_module.abs), @@ -869,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 # @@ -884,14 +877,21 @@ 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() + 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_all_module) + l_string += ninja_readme_build(module, d_irp, dict_root_path) + create_build_ninja_global(l_module) for module_to_compile in l_module: diff --git a/scripts/module/module_handler.py b/scripts/module/module_handler.py index 30bdbdba..3043a025 100755 --- a/scripts/module/module_handler.py +++ b/scripts/module/module_handler.py @@ -177,7 +177,7 @@ class ModuleHandler(): # Init try: - import pydot + from graphviz import Digraph except: with open(path, 'a'): os.utime(path, None) @@ -191,23 +191,20 @@ 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) - graph = pydot.Dot(graph_type='digraph') + graph = Digraph(comment=l_module) 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('tree_dependency') if __name__ == '__main__': diff --git a/scripts/module/update_README.py b/scripts/module/update_README.py index 8cc102c3..ff1acd10 100755 --- a/scripts/module/update_README.py +++ b/scripts/module/update_README.py @@ -66,7 +66,7 @@ def update_needed(data): with open('NEEDED_CHILDREN_MODULES', 'r') as f: modules = f.read() - header_image = ".. image:: tree_dependency.png\n\n" + header_image = ".. image:: tree_dependency.pdf\n\n" if modules.strip(): modules = ['* `{0} <{1}>`_'.format(name, os.path.join(URL, name)) diff --git a/scripts/utility/dot_parser.py b/scripts/utility/dot_parser.py deleted file mode 100644 index c8601546..00000000 --- a/scripts/utility/dot_parser.py +++ /dev/null @@ -1,536 +0,0 @@ -# -*- coding: Latin-1 -*- -"""Graphviz's dot language parser. - -The dotparser parses graphviz files in dot and dot files and transforms them -into a class representation defined by pydot. - -The module needs pyparsing (tested with version 1.2.2) and pydot - -Author: Michael Krause -Fixes by: Ero Carrera -""" - -__author__ = ['Michael Krause', 'Ero Carrera'] -__license__ = 'MIT' - -import sys -import glob -import pydot -import re -import codecs - -from pyparsing import __version__ as pyparsing_version - -from pyparsing import ( - nestedExpr, Literal, CaselessLiteral, Word, Upcase, OneOrMore, ZeroOrMore, - Forward, NotAny, delimitedList, oneOf, Group, Optional, Combine, alphas, - nums, restOfLine, cStyleComment, nums, alphanums, printables, empty, - quotedString, ParseException, ParseResults, CharsNotIn, _noncomma, - dblQuotedString, QuotedString, ParserElement) - - -class P_AttrList: - def __init__(self, toks): - - self.attrs = {} - i = 0 - - while i < len(toks): - attrname = toks[i] - if i + 2 < len(toks) and toks[i + 1] == '=': - attrvalue = toks[i + 2] - i += 3 - else: - attrvalue = None - i += 1 - - self.attrs[attrname] = attrvalue - - def __repr__(self): - - return "%s(%r)" % (self.__class__.__name__, self.attrs) - - -class DefaultStatement(P_AttrList): - def __init__(self, default_type, attrs): - - self.default_type = default_type - self.attrs = attrs - - def __repr__(self): - - return "%s(%s, %r)" % (self.__class__.__name__, self.default_type, - self.attrs) - - -top_graphs = list() - - -def push_top_graph_stmt(str, loc, toks): - - attrs = {} - g = None - - for element in toks: - - if (isinstance(element, (ParseResults, tuple, list)) and - len(element) == 1 and isinstance(element[0], basestring)): - - element = element[0] - - if element == 'strict': - attrs['strict'] = True - - elif element in ['graph', 'digraph']: - - attrs = {} - - g = pydot.Dot(graph_type=element, **attrs) - attrs['type'] = element - - top_graphs.append(g) - - elif isinstance(element, basestring): - g.set_name(element) - - elif isinstance(element, pydot.Subgraph): - - g.obj_dict['attributes'].update(element.obj_dict['attributes']) - g.obj_dict['edges'].update(element.obj_dict['edges']) - g.obj_dict['nodes'].update(element.obj_dict['nodes']) - g.obj_dict['subgraphs'].update(element.obj_dict['subgraphs']) - - g.set_parent_graph(g) - - elif isinstance(element, P_AttrList): - attrs.update(element.attrs) - - elif isinstance(element, (ParseResults, list)): - add_elements(g, element) - - else: - raise ValueError, "Unknown element statement: %r " % element - - for g in top_graphs: - update_parent_graph_hierarchy(g) - - if len(top_graphs) == 1: - return top_graphs[0] - - return top_graphs - - -def update_parent_graph_hierarchy(g, parent_graph=None, level=0): - - if parent_graph is None: - parent_graph = g - - for key_name in ('edges', ): - - if isinstance(g, pydot.frozendict): - item_dict = g - else: - item_dict = g.obj_dict - - if not item_dict.has_key(key_name): - continue - - for key, objs in item_dict[key_name].items(): - for obj in objs: - if 'parent_graph' in obj and obj['parent_graph'].get_parent_graph( - ) == g: - if obj['parent_graph'] is g: - pass - else: - obj['parent_graph'].set_parent_graph(parent_graph) - - if key_name == 'edges' and len(key) == 2: - for idx, vertex in enumerate(obj['points']): - if isinstance(vertex, (pydot.Graph, pydot.Subgraph, - pydot.Cluster)): - vertex.set_parent_graph(parent_graph) - if isinstance(vertex, pydot.frozendict): - if vertex['parent_graph'] is g: - pass - else: - vertex['parent_graph'].set_parent_graph( - parent_graph) - - -def add_defaults(element, defaults): - - d = element.__dict__ - for key, value in defaults.items(): - if not d.get(key): - d[key] = value - - -def add_elements(g, toks, - defaults_graph=None, - defaults_node=None, - defaults_edge=None): - - if defaults_graph is None: - defaults_graph = {} - if defaults_node is None: - defaults_node = {} - if defaults_edge is None: - defaults_edge = {} - - for elm_idx, element in enumerate(toks): - - if isinstance(element, (pydot.Subgraph, pydot.Cluster)): - - add_defaults(element, defaults_graph) - g.add_subgraph(element) - - elif isinstance(element, pydot.Node): - - add_defaults(element, defaults_node) - g.add_node(element) - - elif isinstance(element, pydot.Edge): - - add_defaults(element, defaults_edge) - g.add_edge(element) - - elif isinstance(element, ParseResults): - - for e in element: - add_elements(g, [e], defaults_graph, defaults_node, - defaults_edge) - - elif isinstance(element, DefaultStatement): - - if element.default_type == 'graph': - - default_graph_attrs = pydot.Node('graph', **element.attrs) - g.add_node(default_graph_attrs) - - elif element.default_type == 'node': - - default_node_attrs = pydot.Node('node', **element.attrs) - g.add_node(default_node_attrs) - - elif element.default_type == 'edge': - - default_edge_attrs = pydot.Node('edge', **element.attrs) - g.add_node(default_edge_attrs) - defaults_edge.update(element.attrs) - - else: - raise ValueError, "Unknown DefaultStatement: %s " % element.default_type - - elif isinstance(element, P_AttrList): - - g.obj_dict['attributes'].update(element.attrs) - - else: - raise ValueError, "Unknown element statement: %r" % element - - -def push_graph_stmt(str, loc, toks): - - g = pydot.Subgraph('') - add_elements(g, toks) - return g - - -def push_subgraph_stmt(str, loc, toks): - - g = pydot.Subgraph('') - for e in toks: - if len(e) == 3: - e[2].set_name(e[1]) - if e[0] == 'subgraph': - e[2].obj_dict['show_keyword'] = True - return e[2] - else: - if e[0] == 'subgraph': - e[1].obj_dict['show_keyword'] = True - return e[1] - - return g - - -def push_default_stmt(str, loc, toks): - - # The pydot class instances should be marked as - # default statements to be inherited by actual - # graphs, nodes and edges. - # - default_type = toks[0][0] - if len(toks) > 1: - attrs = toks[1].attrs - else: - attrs = {} - - if default_type in ['graph', 'node', 'edge']: - return DefaultStatement(default_type, attrs) - else: - raise ValueError, "Unknown default statement: %r " % toks - - -def push_attr_list(str, loc, toks): - - p = P_AttrList(toks) - return p - - -def get_port(node): - - if len(node) > 1: - if isinstance(node[1], ParseResults): - if len(node[1][0]) == 2: - if node[1][0][0] == ':': - return node[1][0][1] - - return None - - -def do_node_ports(node): - - node_port = '' - if len(node) > 1: - node_port = ''.join([str(a) + str(b) for a, b in node[1]]) - - return node_port - - -def push_edge_stmt(str, loc, toks): - - tok_attrs = [a for a in toks if isinstance(a, P_AttrList)] - attrs = {} - for a in tok_attrs: - attrs.update(a.attrs) - - e = [] - - if isinstance(toks[0][0], pydot.Graph): - - n_prev = pydot.frozendict(toks[0][0].obj_dict) - else: - n_prev = toks[0][0] + do_node_ports(toks[0]) - - if isinstance(toks[2][0], ParseResults): - - n_next_list = [[n.get_name(), ] for n in toks[2][0]] - for n_next in [n for n in n_next_list]: - n_next_port = do_node_ports(n_next) - e.append(pydot.Edge(n_prev, n_next[0] + n_next_port, **attrs)) - - elif isinstance(toks[2][0], pydot.Graph): - - e.append(pydot.Edge(n_prev, pydot.frozendict(toks[2][0].obj_dict), ** - attrs)) - - elif isinstance(toks[2][0], pydot.Node): - - node = toks[2][0] - - if node.get_port() is not None: - name_port = node.get_name() + ":" + node.get_port() - else: - name_port = node.get_name() - - e.append(pydot.Edge(n_prev, name_port, **attrs)) - - elif isinstance(toks[2][0], type('')): - - for n_next in [n for n in tuple(toks)[2::2]]: - - if isinstance(n_next, P_AttrList) or not isinstance(n_next[0], - type('')): - continue - - n_next_port = do_node_ports(n_next) - e.append(pydot.Edge(n_prev, n_next[0] + n_next_port, **attrs)) - - n_prev = n_next[0] + n_next_port - - else: - # UNEXPECTED EDGE TYPE - pass - - return e - - -def push_node_stmt(s, loc, toks): - - if len(toks) == 2: - attrs = toks[1].attrs - else: - attrs = {} - - node_name = toks[0] - if isinstance(node_name, list) or isinstance(node_name, tuple): - if len(node_name) > 0: - node_name = node_name[0] - - n = pydot.Node(str(node_name), **attrs) - return n - - -graphparser = None - - -def graph_definition(): - - global graphparser - - if not graphparser: - - # punctuation - colon = Literal(":") - lbrace = Literal("{") - rbrace = Literal("}") - lbrack = Literal("[") - rbrack = Literal("]") - lparen = Literal("(") - rparen = Literal(")") - equals = Literal("=") - comma = Literal(",") - dot = Literal(".") - slash = Literal("/") - bslash = Literal("\\") - star = Literal("*") - semi = Literal(";") - at = Literal("@") - minus = Literal("-") - - # keywords - strict_ = CaselessLiteral("strict") - graph_ = CaselessLiteral("graph") - digraph_ = CaselessLiteral("digraph") - subgraph_ = CaselessLiteral("subgraph") - node_ = CaselessLiteral("node") - edge_ = CaselessLiteral("edge") - - # token definitions - - identifier = Word(alphanums + "_.").setName("identifier") - - double_quoted_string = QuotedString('"', - multiline=True, - unquoteResults=False - ) # dblQuotedString - - alphastring_ = OneOrMore(CharsNotIn(_noncomma + ' ')) - - def parse_html(s, loc, toks): - return '<%s>' % ''.join(toks[0]) - - opener = '<' - closer = '>' - html_text = nestedExpr(opener, closer, (CharsNotIn(opener + closer) - )).setParseAction(parse_html).leaveWhitespace() - - ID = (identifier | html_text | double_quoted_string | - #.setParseAction(strip_quotes) | - alphastring_).setName("ID") - - float_number = Combine( - Optional(minus) + OneOrMore(Word(nums + "."))).setName( - "float_number") - - righthand_id = (float_number | ID).setName("righthand_id") - - port_angle = (at + ID).setName("port_angle") - - port_location = (OneOrMore(Group(colon + ID)) | - Group(colon + lparen + ID + comma + ID + rparen) - ).setName("port_location") - - port = (Group(port_location + Optional(port_angle)) | - Group(port_angle + Optional(port_location))).setName("port") - - node_id = (ID + Optional(port)) - a_list = OneOrMore(ID + Optional(equals + righthand_id) + - Optional(comma.suppress())).setName("a_list") - - attr_list = OneOrMore( - lbrack.suppress() + Optional(a_list) + rbrack.suppress()).setName( - "attr_list") - - attr_stmt = (Group(graph_ | node_ | edge_) + attr_list).setName( - "attr_stmt") - - edgeop = (Literal("--") | Literal("->")).setName("edgeop") - - stmt_list = Forward() - graph_stmt = Group( - lbrace.suppress() + Optional(stmt_list) + rbrace.suppress() + - Optional(semi.suppress())).setName("graph_stmt") - - edge_point = Forward() - - edgeRHS = OneOrMore(edgeop + edge_point) - edge_stmt = edge_point + edgeRHS + Optional(attr_list) - - subgraph = Group(subgraph_ + Optional(ID) + graph_stmt).setName( - "subgraph") - - edge_point << Group(subgraph | graph_stmt | - node_id).setName('edge_point') - - node_stmt = (node_id + Optional(attr_list) + Optional(semi.suppress()) - ).setName("node_stmt") - - assignment = (ID + equals + righthand_id).setName("assignment") - stmt = (assignment | edge_stmt | attr_stmt | subgraph | graph_stmt | - node_stmt).setName("stmt") - stmt_list << OneOrMore(stmt + Optional(semi.suppress())) - - graphparser = OneOrMore((Optional(strict_) + Group( - (graph_ | digraph_)) + Optional(ID) + graph_stmt - ).setResultsName("graph")) - - singleLineComment = Group("//" + restOfLine) | Group("#" + restOfLine) - - # actions - - graphparser.ignore(singleLineComment) - graphparser.ignore(cStyleComment) - - assignment.setParseAction(push_attr_list) - a_list.setParseAction(push_attr_list) - edge_stmt.setParseAction(push_edge_stmt) - node_stmt.setParseAction(push_node_stmt) - attr_stmt.setParseAction(push_default_stmt) - - subgraph.setParseAction(push_subgraph_stmt) - graph_stmt.setParseAction(push_graph_stmt) - graphparser.setParseAction(push_top_graph_stmt) - - return graphparser - - -def parse_dot_data(data): - - global top_graphs - - top_graphs = list() - - if data.startswith(codecs.BOM_UTF8): - data = data.decode('utf-8') - - try: - - graphparser = graph_definition() - - if pyparsing_version >= '1.2': - graphparser.parseWithTabs() - - tokens = graphparser.parseString(data) - - if len(tokens) == 1: - return tokens[0] - else: - return [g for g in tokens] - - except ParseException, err: - - print err.line - print " " * (err.column - 1) + "^" - print err - return None diff --git a/scripts/utility/pydot.py b/scripts/utility/pydot.py deleted file mode 100644 index 07a5b4f5..00000000 --- a/scripts/utility/pydot.py +++ /dev/null @@ -1,2084 +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 dot_parser - -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/AO_Basis/README.rst b/src/AO_Basis/README.rst index 4a1aa1ef..2a49a4b8 100644 --- a/src/AO_Basis/README.rst +++ b/src/AO_Basis/README.rst @@ -36,7 +36,7 @@ Needed Modules .. Do not edit this section. It was auto-generated from the .. by the `update_README.py` script. -.. image:: tree_dependency.png +.. image:: tree_dependency.pdf * `Nuclei `_ diff --git a/src/AO_Basis/tree_dependency.pdf b/src/AO_Basis/tree_dependency.pdf new file mode 100644 index 00000000..15e79578 Binary files /dev/null and b/src/AO_Basis/tree_dependency.pdf differ diff --git a/src/AO_Basis/tree_dependency.png b/src/AO_Basis/tree_dependency.png deleted file mode 100644 index bdfa565b..00000000 Binary files a/src/AO_Basis/tree_dependency.png and /dev/null differ diff --git a/src/Bitmask/README.rst b/src/Bitmask/README.rst index f8d44248..77a66219 100644 --- a/src/Bitmask/README.rst +++ b/src/Bitmask/README.rst @@ -40,7 +40,7 @@ Needed Modules .. Do not edit this section. It was auto-generated from the .. by the `update_README.py` script. -.. image:: tree_dependency.png +.. image:: tree_dependency.pdf * `MO_Basis `_ diff --git a/src/Bitmask/tree_dependency.pdf b/src/Bitmask/tree_dependency.pdf new file mode 100644 index 00000000..5b4abac7 Binary files /dev/null and b/src/Bitmask/tree_dependency.pdf differ diff --git a/src/Bitmask/tree_dependency.png b/src/Bitmask/tree_dependency.png deleted file mode 100644 index 2bf26c7c..00000000 Binary files a/src/Bitmask/tree_dependency.png and /dev/null differ diff --git a/src/Determinants/README.rst b/src/Determinants/README.rst index 966dd14b..2c73e494 100644 --- a/src/Determinants/README.rst +++ b/src/Determinants/README.rst @@ -32,7 +32,7 @@ Needed Modules .. Do not edit this section. It was auto-generated from the .. by the `update_README.py` script. -.. image:: tree_dependency.png +.. image:: tree_dependency.pdf * `Integrals_Monoelec `_ * `Integrals_Bielec `_ diff --git a/src/Determinants/tree_dependency.pdf b/src/Determinants/tree_dependency.pdf new file mode 100644 index 00000000..b17e5b08 Binary files /dev/null and b/src/Determinants/tree_dependency.pdf differ diff --git a/src/Determinants/tree_dependency.png b/src/Determinants/tree_dependency.png deleted file mode 100644 index d47d4c23..00000000 Binary files a/src/Determinants/tree_dependency.png and /dev/null differ diff --git a/src/Electrons/README.rst b/src/Electrons/README.rst index 5c785e4e..8f0e4525 100644 --- a/src/Electrons/README.rst +++ b/src/Electrons/README.rst @@ -24,7 +24,7 @@ Needed Modules .. Do not edit this section. It was auto-generated from the .. by the `update_README.py` script. -.. image:: tree_dependency.png +.. image:: tree_dependency.pdf * `Ezfio_files `_ diff --git a/src/Electrons/tree_dependency.pdf b/src/Electrons/tree_dependency.pdf new file mode 100644 index 00000000..9f33dbf7 Binary files /dev/null and b/src/Electrons/tree_dependency.pdf differ diff --git a/src/Electrons/tree_dependency.png b/src/Electrons/tree_dependency.png deleted file mode 100644 index 8c7bb855..00000000 Binary files a/src/Electrons/tree_dependency.png and /dev/null differ diff --git a/src/Ezfio_files/README.rst b/src/Ezfio_files/README.rst index ba8f4c8e..b9ab3f2d 100644 --- a/src/Ezfio_files/README.rst +++ b/src/Ezfio_files/README.rst @@ -30,15 +30,19 @@ Documentation .br -`output_ao_basis `_ +`output_alavi `_ + Output file for Alavi + + +`output_ao_basis `_ Output file for AO_Basis -`output_bitmask `_ +`output_bitmask `_ Output file for Bitmask -`output_casino `_ +`output_casino `_ Output file for Casino @@ -46,75 +50,75 @@ Documentation Initial CPU and wall times when printing in the output files -`output_determinants `_ +`output_determinants `_ Output file for Determinants -`output_electrons `_ +`output_electrons `_ Output file for Electrons -`output_ezfio_files `_ +`output_ezfio_files `_ Output file for Ezfio_files -`output_full_ci `_ +`output_full_ci `_ Output file for Full_CI -`output_generators_full `_ +`output_generators_full `_ Output file for Generators_full -`output_hartree_fock `_ +`output_hartree_fock `_ Output file for Hartree_Fock -`output_integrals_bielec `_ +`output_integrals_bielec `_ Output file for Integrals_Bielec -`output_integrals_monoelec `_ +`output_integrals_monoelec `_ Output file for Integrals_Monoelec -`output_loc_cele `_ +`output_loc_cele `_ Output file for loc_cele -`output_mo_basis `_ +`output_mo_basis `_ Output file for MO_Basis -`output_moguess `_ +`output_moguess `_ Output file for MOGuess -`output_molden `_ +`output_molden `_ Output file for Molden -`output_nuclei `_ +`output_nuclei `_ Output file for Nuclei -`output_perturbation `_ +`output_perturbation `_ Output file for Perturbation -`output_properties `_ +`output_properties `_ Output file for Properties -`output_pseudo `_ +`output_pseudo `_ Output file for Pseudo -`output_selectors_full `_ +`output_selectors_full `_ Output file for Selectors_full -`output_utils `_ +`output_utils `_ Output file for Utils diff --git a/src/Ezfio_files/tree_dependency.pdf b/src/Ezfio_files/tree_dependency.pdf new file mode 100644 index 00000000..f73e66c9 Binary files /dev/null and b/src/Ezfio_files/tree_dependency.pdf differ diff --git a/src/Ezfio_files/tree_dependency.png b/src/Ezfio_files/tree_dependency.png deleted file mode 100644 index 4b0b9fd0..00000000 Binary files a/src/Ezfio_files/tree_dependency.png and /dev/null differ diff --git a/src/Integrals_Bielec/README.rst b/src/Integrals_Bielec/README.rst index eed456c4..6dcf79c3 100644 --- a/src/Integrals_Bielec/README.rst +++ b/src/Integrals_Bielec/README.rst @@ -16,7 +16,7 @@ Needed Modules .. Do not edit this section. It was auto-generated from the .. by the `update_README.py` script. -.. image:: tree_dependency.png +.. image:: tree_dependency.pdf * `Pseudo `_ * `Bitmask `_ diff --git a/src/Integrals_Bielec/tree_dependency.pdf b/src/Integrals_Bielec/tree_dependency.pdf new file mode 100644 index 00000000..4626a8c2 Binary files /dev/null and b/src/Integrals_Bielec/tree_dependency.pdf differ diff --git a/src/Integrals_Bielec/tree_dependency.png b/src/Integrals_Bielec/tree_dependency.png deleted file mode 100644 index fb08a8dd..00000000 Binary files a/src/Integrals_Bielec/tree_dependency.png and /dev/null differ diff --git a/src/Integrals_Monoelec/README.rst b/src/Integrals_Monoelec/README.rst index 98ec1331..a97278e8 100644 --- a/src/Integrals_Monoelec/README.rst +++ b/src/Integrals_Monoelec/README.rst @@ -4,7 +4,7 @@ Needed Modules .. Do not edit this section. It was auto-generated from the .. by the `update_README.py` script. -.. image:: tree_dependency.png +.. image:: tree_dependency.pdf * `MO_Basis `_ * `Pseudo `_ diff --git a/src/Integrals_Monoelec/tree_dependency.pdf b/src/Integrals_Monoelec/tree_dependency.pdf new file mode 100644 index 00000000..f9335958 Binary files /dev/null and b/src/Integrals_Monoelec/tree_dependency.pdf differ diff --git a/src/Integrals_Monoelec/tree_dependency.png b/src/Integrals_Monoelec/tree_dependency.png deleted file mode 100644 index 10fff3cb..00000000 Binary files a/src/Integrals_Monoelec/tree_dependency.png and /dev/null differ diff --git a/src/MOGuess/README.rst b/src/MOGuess/README.rst index d10b1ef5..8b20826c 100644 --- a/src/MOGuess/README.rst +++ b/src/MOGuess/README.rst @@ -8,7 +8,7 @@ Needed Modules .. Do not edit this section. It was auto-generated from the .. by the `update_README.py` script. -.. image:: tree_dependency.png +.. image:: tree_dependency.pdf * `Integrals_Monoelec `_ 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 diff --git a/src/MOGuess/tree_dependency.pdf b/src/MOGuess/tree_dependency.pdf new file mode 100644 index 00000000..a9fd22f0 Binary files /dev/null and b/src/MOGuess/tree_dependency.pdf differ diff --git a/src/MOGuess/tree_dependency.png b/src/MOGuess/tree_dependency.png deleted file mode 100644 index 31b8d39b..00000000 Binary files a/src/MOGuess/tree_dependency.png and /dev/null differ diff --git a/src/MO_Basis/README.rst b/src/MO_Basis/README.rst index 5cbe0165..875ea8b3 100644 --- a/src/MO_Basis/README.rst +++ b/src/MO_Basis/README.rst @@ -36,7 +36,7 @@ Needed Modules .. Do not edit this section. It was auto-generated from the .. by the `update_README.py` script. -.. image:: tree_dependency.png +.. image:: tree_dependency.pdf * `AO_Basis `_ * `Electrons `_ diff --git a/src/MO_Basis/tree_dependency.pdf b/src/MO_Basis/tree_dependency.pdf new file mode 100644 index 00000000..c65aa317 Binary files /dev/null and b/src/MO_Basis/tree_dependency.pdf differ diff --git a/src/MO_Basis/tree_dependency.png b/src/MO_Basis/tree_dependency.png deleted file mode 100644 index 028fc9bd..00000000 Binary files a/src/MO_Basis/tree_dependency.png and /dev/null differ diff --git a/src/Nuclei/README.rst b/src/Nuclei/README.rst index 9f0b15d9..2e32f472 100644 --- a/src/Nuclei/README.rst +++ b/src/Nuclei/README.rst @@ -12,7 +12,7 @@ Needed Modules .. Do not edit this section. It was auto-generated from the .. by the `update_README.py` script. -.. image:: tree_dependency.png +.. image:: tree_dependency.pdf * `Ezfio_files `_ * `Utils `_ diff --git a/src/Nuclei/tree_dependency.pdf b/src/Nuclei/tree_dependency.pdf new file mode 100644 index 00000000..74ad5491 Binary files /dev/null and b/src/Nuclei/tree_dependency.pdf differ diff --git a/src/Nuclei/tree_dependency.png b/src/Nuclei/tree_dependency.png deleted file mode 100644 index 569e6ac5..00000000 Binary files a/src/Nuclei/tree_dependency.png and /dev/null differ diff --git a/src/Pseudo/README.rst b/src/Pseudo/README.rst index 84a555da..7199cb90 100644 --- a/src/Pseudo/README.rst +++ b/src/Pseudo/README.rst @@ -8,7 +8,7 @@ Needed Modules .. Do not edit this section. It was auto-generated from the .. by the `update_README.py` script. -.. image:: tree_dependency.png +.. image:: tree_dependency.pdf * `Nuclei `_ diff --git a/src/Pseudo/tree_dependency.pdf b/src/Pseudo/tree_dependency.pdf new file mode 100644 index 00000000..b4e34fc9 Binary files /dev/null and b/src/Pseudo/tree_dependency.pdf differ diff --git a/src/Pseudo/tree_dependency.png b/src/Pseudo/tree_dependency.png deleted file mode 100644 index 954f5a22..00000000 Binary files a/src/Pseudo/tree_dependency.png and /dev/null differ diff --git a/src/Utils/tree_dependency.pdf b/src/Utils/tree_dependency.pdf new file mode 100644 index 00000000..4310a254 Binary files /dev/null and b/src/Utils/tree_dependency.pdf differ diff --git a/src/Utils/tree_dependency.png b/src/Utils/tree_dependency.png deleted file mode 100644 index 68f0c2ca..00000000 Binary files a/src/Utils/tree_dependency.png and /dev/null differ