From 59a2d2a56d36e515acd0f21517d477ce92e10673 Mon Sep 17 00:00:00 2001 From: Yann Garniron Date: Mon, 5 Oct 2015 14:27:18 +0200 Subject: [PATCH 01/20] Fix typo --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4b288d85..fece0eb0 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ For example you can type `./configure config/gfortran.cfg --production` This command have to purpose : - Download and install all the requirements. - Installing OCaml and the Core library may take somme time (up to 20min on an old machine). + Installing OCaml and the Core library may take some time (up to 20min on an old machine). - And create the file which contains all the tree dependencies for the binaries. It's not a Makefile, but a Ninja file (so don't type `make` is hopeless, type `ninja` instead) @@ -173,4 +173,4 @@ You have two or more ezfio configuration file for the same variable. Check in `$ #### Fix - rm $QP_ROOT/install/EZFIO/config/* - - ninja \ No newline at end of file + - ninja From bbbc72341a6c43b08b107e5a777601559b8c5edd Mon Sep 17 00:00:00 2001 From: Yann Garniron Date: Fri, 16 Oct 2015 13:06:19 +0200 Subject: [PATCH 02/20] minilist primitive/tri par alpha en cours --- config/gfortran.cfg | 4 +- ocaml/.gitignore | 56 +- plugins/CAS_SD/README.rst | 121 ++++ plugins/Full_CI/README.rst | 112 +++- plugins/Full_CI/full_ci.irp.f | 1 + plugins/Generators_CAS/README.rst | 37 ++ plugins/MRCC_CASSD/README.rst | 27 + plugins/MRCC_Utils/H_apply.irp.f | 2 +- plugins/MRCC_Utils/README.rst | 813 ++++++++++++++++++++++++ plugins/MRCC_Utils/mrcc_dress.irp.f | 178 +++++- plugins/Perturbation/README.rst | 28 +- plugins/Psiref_CAS/README.rst | 43 ++ plugins/Psiref_Utils/README.rst | 737 +++++++++++++++++++++ src/Determinants/H_apply.template.f | 123 +++- src/Determinants/README.rst | 24 +- src/Determinants/connected_to_ref.irp.f | 2 +- src/Determinants/slater_rules.irp.f | 1 + src/Ezfio_files/README.rst | 144 +++++ 18 files changed, 2364 insertions(+), 89 deletions(-) diff --git a/config/gfortran.cfg b/config/gfortran.cfg index 12cd6e0c..86f625c6 100644 --- a/config/gfortran.cfg +++ b/config/gfortran.cfg @@ -10,7 +10,7 @@ # # [COMMON] -FC : gfortran -ffree-line-length-none -I . +FC : gfortran -ffree-line-length-none -I . -mavx LAPACK_LIB : -llapack -lblas IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 @@ -35,7 +35,7 @@ OPENMP : 1 ; Append OpenMP flags # -ffast-math and the Fortran-specific # -fno-protect-parens and -fstack-arrays. [OPT] -FCFLAGS : -Ofast +FCFLAGS : -Ofast -g # Profiling flags ################# diff --git a/ocaml/.gitignore b/ocaml/.gitignore index cbd77939..732176bc 100644 --- a/ocaml/.gitignore +++ b/ocaml/.gitignore @@ -3,47 +3,47 @@ ezfio.ml Qptypes.ml qptypes_generator.byte _build -qp_basis_clean.native qp_create_ezfio_from_xyz.native -qp_edit.native -qp_print.native -qp_run.native qp_set_ddci.native -qp_set_mo_class.native +qp_print.native +qp_edit.native +qp_set_mo_class.native +qp_basis_clean.native +qp_run.native qp_edit.native -test_atom.byte -test_basis.byte -test_bitlist.byte -test_determinants.byte -test_elements.byte -test_excitation.byte -test_gto.byte test_mo_label.byte -test_molecule.byte test_point3d.byte -test_atom -test_basis -test_bitlist -test_determinants -test_elements -test_excitation -test_gto +test_gto.byte +test_excitation.byte +test_determinants.byte +test_basis.byte +test_molecule.byte +test_elements.byte +test_bitlist.byte +test_atom.byte test_mo_label -test_molecule test_point3d -qp_basis_clean +test_gto +test_excitation +test_determinants +test_basis +test_molecule +test_elements +test_bitlist +test_atom qp_create_ezfio_from_xyz -qp_edit -qp_print -qp_run qp_set_ddci +qp_print +qp_edit qp_set_mo_class +qp_basis_clean +qp_run Input_determinants.ml -Input_hartree_fock.ml Input_integrals_bielec.ml -Input_perturbation.ml -Input_properties.ml Input_pseudo.ml +Input_perturbation.ml +Input_hartree_fock.ml +Input_properties.ml qp_edit.ml qp_edit qp_edit.native diff --git a/plugins/CAS_SD/README.rst b/plugins/CAS_SD/README.rst index 63836195..c9fc83f2 100644 --- a/plugins/CAS_SD/README.rst +++ b/plugins/CAS_SD/README.rst @@ -96,3 +96,124 @@ Needed Modules * `Selectors_full `_ * `Generators_CAS `_ +Needed Modules +============== +.. Do not edit this section It was auto-generated +.. by the `update_README.py` script. + + +.. image:: tree_dependency.png + +* `Perturbation `_ +* `Selectors_full `_ +* `Generators_CAS `_ + +Documentation +============= +.. Do not edit this section It was auto-generated +.. by the `update_README.py` script. + + +`full_ci `_ + Undocumented + + +`h_apply_cas_sd `_ + Calls H_apply on the HF determinant and selects all connected single and double + excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. + + +`h_apply_cas_sd_diexc `_ + Undocumented + + +`h_apply_cas_sd_diexcorg `_ + Generate all double excitations of key_in using the bit masks of holes and + particles. + Assume N_int is already provided. + + +`h_apply_cas_sd_diexcp `_ + Undocumented + + +`h_apply_cas_sd_monoexc `_ + Generate all single excitations of key_in using the bit masks of holes and + particles. + Assume N_int is already provided. + + +`h_apply_cas_sd_pt2 `_ + Calls H_apply on the HF determinant and selects all connected single and double + excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. + + +`h_apply_cas_sd_pt2_diexc `_ + Undocumented + + +`h_apply_cas_sd_pt2_diexcorg `_ + Generate all double excitations of key_in using the bit masks of holes and + particles. + Assume N_int is already provided. + + +`h_apply_cas_sd_pt2_diexcp `_ + Undocumented + + +`h_apply_cas_sd_pt2_monoexc `_ + Generate all single excitations of key_in using the bit masks of holes and + particles. + Assume N_int is already provided. + + +`h_apply_cas_sd_selected `_ + Calls H_apply on the HF determinant and selects all connected single and double + excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. + + +`h_apply_cas_sd_selected_diexc `_ + Undocumented + + +`h_apply_cas_sd_selected_diexcorg `_ + Generate all double excitations of key_in using the bit masks of holes and + particles. + Assume N_int is already provided. + + +`h_apply_cas_sd_selected_diexcp `_ + Undocumented + + +`h_apply_cas_sd_selected_monoexc `_ + Generate all single excitations of key_in using the bit masks of holes and + particles. + Assume N_int is already provided. + + +`h_apply_cas_sd_selected_no_skip `_ + Calls H_apply on the HF determinant and selects all connected single and double + excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. + + +`h_apply_cas_sd_selected_no_skip_diexc `_ + Undocumented + + +`h_apply_cas_sd_selected_no_skip_diexcorg `_ + Generate all double excitations of key_in using the bit masks of holes and + particles. + Assume N_int is already provided. + + +`h_apply_cas_sd_selected_no_skip_diexcp `_ + Undocumented + + +`h_apply_cas_sd_selected_no_skip_monoexc `_ + Generate all single excitations of key_in using the bit masks of holes and + particles. + Assume N_int is already provided. + diff --git a/plugins/Full_CI/README.rst b/plugins/Full_CI/README.rst index 1af26ae6..be48aa3e 100644 --- a/plugins/Full_CI/README.rst +++ b/plugins/Full_CI/README.rst @@ -27,137 +27,201 @@ Documentation Undocumented -`h_apply_fci `_ +`h_apply_fci `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_fci_diexc `_ +`h_apply_fci_diexc `_ + Undocumented + + +`h_apply_fci_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_mono `_ +`h_apply_fci_diexcp `_ + Undocumented + + +`h_apply_fci_mono `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_fci_mono_diexc `_ +`h_apply_fci_mono_diexc `_ + Undocumented + + +`h_apply_fci_mono_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_mono_monoexc `_ +`h_apply_fci_mono_diexcp `_ + Undocumented + + +`h_apply_fci_mono_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_monoexc `_ +`h_apply_fci_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_no_skip `_ +`h_apply_fci_no_skip `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_fci_no_skip_diexc `_ +`h_apply_fci_no_skip_diexc `_ + Undocumented + + +`h_apply_fci_no_skip_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_no_skip_monoexc `_ +`h_apply_fci_no_skip_diexcp `_ + Undocumented + + +`h_apply_fci_no_skip_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_pt2 `_ +`h_apply_fci_pt2 `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_fci_pt2_diexc `_ +`h_apply_fci_pt2_diexc `_ + Undocumented + + +`h_apply_fci_pt2_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_pt2_monoexc `_ +`h_apply_fci_pt2_diexcp `_ + Undocumented + + +`h_apply_fci_pt2_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_pt2_mono_delta_rho `_ +`h_apply_pt2_mono_delta_rho `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_pt2_mono_delta_rho_diexc `_ +`h_apply_pt2_mono_delta_rho_diexc `_ + Undocumented + + +`h_apply_pt2_mono_delta_rho_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_pt2_mono_delta_rho_monoexc `_ +`h_apply_pt2_mono_delta_rho_diexcp `_ + Undocumented + + +`h_apply_pt2_mono_delta_rho_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_pt2_mono_di_delta_rho `_ +`h_apply_pt2_mono_di_delta_rho `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_pt2_mono_di_delta_rho_diexc `_ +`h_apply_pt2_mono_di_delta_rho_diexc `_ + Undocumented + + +`h_apply_pt2_mono_di_delta_rho_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_pt2_mono_di_delta_rho_monoexc `_ +`h_apply_pt2_mono_di_delta_rho_diexcp `_ + Undocumented + + +`h_apply_pt2_mono_di_delta_rho_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_select_mono_delta_rho `_ +`h_apply_select_mono_delta_rho `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_select_mono_delta_rho_diexc `_ +`h_apply_select_mono_delta_rho_diexc `_ + Undocumented + + +`h_apply_select_mono_delta_rho_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_select_mono_delta_rho_monoexc `_ +`h_apply_select_mono_delta_rho_diexcp `_ + Undocumented + + +`h_apply_select_mono_delta_rho_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_select_mono_di_delta_rho `_ +`h_apply_select_mono_di_delta_rho `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_select_mono_di_delta_rho_diexc `_ +`h_apply_select_mono_di_delta_rho_diexc `_ + Undocumented + + +`h_apply_select_mono_di_delta_rho_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_select_mono_di_delta_rho_monoexc `_ +`h_apply_select_mono_di_delta_rho_diexcp `_ + Undocumented + + +`h_apply_select_mono_di_delta_rho_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. diff --git a/plugins/Full_CI/full_ci.irp.f b/plugins/Full_CI/full_ci.irp.f index c7b8452d..074ec7e1 100644 --- a/plugins/Full_CI/full_ci.irp.f +++ b/plugins/Full_CI/full_ci.irp.f @@ -11,6 +11,7 @@ program full_ci pt2 = 1.d0 diag_algorithm = "Lapack" + if (N_det > N_det_max) then call diagonalize_CI call save_wavefunction diff --git a/plugins/Generators_CAS/README.rst b/plugins/Generators_CAS/README.rst index 9a361c8b..9d880b0d 100644 --- a/plugins/Generators_CAS/README.rst +++ b/plugins/Generators_CAS/README.rst @@ -49,3 +49,40 @@ Needed Modules * `Determinants `_ +Needed Modules +============== +.. Do not edit this section It was auto-generated +.. by the `update_README.py` script. + + +.. image:: tree_dependency.png + +* `Determinants `_ + +Documentation +============= +.. Do not edit this section It was auto-generated +.. by the `update_README.py` script. + + +`n_det_generators `_ + Number of generator detetrminants + + +`psi_coef_generators `_ + For Single reference wave functions, the generator is the + Hartree-Fock determinant + + +`psi_det_generators `_ + For Single reference wave functions, the generator is the + Hartree-Fock determinant + + +`select_max `_ + Memo to skip useless selectors + + +`size_select_max `_ + Size of the select_max array + diff --git a/plugins/MRCC_CASSD/README.rst b/plugins/MRCC_CASSD/README.rst index 5ef5db62..b2713b43 100644 --- a/plugins/MRCC_CASSD/README.rst +++ b/plugins/MRCC_CASSD/README.rst @@ -31,3 +31,30 @@ Documentation `print_cas_coefs `_ Undocumented +Needed Modules +============== +.. Do not edit this section It was auto-generated +.. by the `update_README.py` script. + + +.. image:: tree_dependency.png + +* `Perturbation `_ +* `Selectors_full `_ +* `Generators_full `_ +* `Psiref_CAS `_ +* `MRCC_Utils `_ + +Documentation +============= +.. Do not edit this section It was auto-generated +.. by the `update_README.py` script. + + +`mrcc `_ + Undocumented + + +`print_cas_coefs `_ + Undocumented + diff --git a/plugins/MRCC_Utils/H_apply.irp.f b/plugins/MRCC_Utils/H_apply.irp.f index 455c37da..7314674c 100644 --- a/plugins/MRCC_Utils/H_apply.irp.f +++ b/plugins/MRCC_Utils/H_apply.irp.f @@ -9,7 +9,7 @@ s.data["declarations"] += """ double precision, intent(in) :: delta_ij_(Ndet_ref,Ndet_non_ref,*) double precision, intent(in) :: delta_ii_(Ndet_ref,*) """ -s.data["keys_work"] = "call mrcc_dress(delta_ij_,delta_ii_,Ndet_ref,Ndet_non_ref,i_generator,key_idx,keys_out,N_int,iproc)" +s.data["keys_work"] = "call mrcc_dress(delta_ij_,delta_ii_,Ndet_ref,Ndet_non_ref,i_generator,key_idx,keys_out,N_int,iproc,key_mask)" s.data["params_post"] += ", delta_ij_, delta_ii_, Ndet_ref, Ndet_non_ref" s.data["params_main"] += "delta_ij_, delta_ii_, Ndet_ref, Ndet_non_ref" s.data["decls_main"] += """ diff --git a/plugins/MRCC_Utils/README.rst b/plugins/MRCC_Utils/README.rst index c396bae7..cbf32eb6 100644 --- a/plugins/MRCC_Utils/README.rst +++ b/plugins/MRCC_Utils/README.rst @@ -166,3 +166,816 @@ Documentation `set_generators_bitmasks_as_holes_and_particles `_ Undocumented +Needed Modules +============== +.. Do not edit this section It was auto-generated +.. by the `update_README.py` script. + + +.. image:: tree_dependency.png + +* `Perturbation `_ +* `Selectors_full `_ +* `Generators_full `_ +* `Psiref_Utils `_ + +Documentation +============= +.. Do not edit this section It was auto-generated +.. by the `update_README.py` script. + + +`a_coef `_ + Undocumented + + +`abort_all `_ + If True, all the calculation is aborted + + +`abort_here `_ + If True, all the calculation is aborted + + +`add_poly `_ + Add two polynomials + D(t) =! D(t) +( B(t)+C(t)) + + +`add_poly_multiply `_ + Add a polynomial multiplied by a constant + D(t) =! D(t) +( cst * B(t)) + + +`align_double `_ + Compute 1st dimension such that it is aligned for vectorization. + + +`apply_rotation `_ + Apply the rotation found by find_rotation + + +`approx_dble `_ + Undocumented + + +`b_coef `_ + Undocumented + + +`binom `_ + Binomial coefficients + + +`binom_func `_ + .. math :: + .br + \frac{i!}{j!(i-j)!} + .br + + +`binom_transp `_ + Binomial coefficients + + +`catch_signal `_ + What to do on Ctrl-C. If two Ctrl-C are pressed within 1 sec, the calculation if aborted. + + +`ci_eigenvectors_dressed `_ + Eigenvectors/values of the CI matrix + + +`ci_eigenvectors_s2_dressed `_ + Eigenvectors/values of the CI matrix + + +`ci_electronic_energy_dressed `_ + Eigenvectors/values of the CI matrix + + +`ci_energy_dressed `_ + N_states lowest eigenvalues of the dressed CI matrix + + +`create_minilist `_ + Undocumented + + +`davidson_diag_hjj_mrcc `_ + Davidson diagonalization with specific diagonal elements of the H matrix + .br + H_jj : specific diagonal H matrix elements to diagonalize de Davidson + .br + dets_in : bitmasks corresponding to determinants + .br + u_in : guess coefficients on the various states. Overwritten + on exit + .br + dim_in : leftmost dimension of u_in + .br + sze : Number of determinants + .br + N_st : Number of eigenstates + .br + iunit : Unit for the I/O + .br + Initial guess vectors are not necessarily orthonormal + + +`davidson_diag_mrcc `_ + Davidson diagonalization. + .br + dets_in : bitmasks corresponding to determinants + .br + u_in : guess coefficients on the various states. Overwritten + on exit + .br + dim_in : leftmost dimension of u_in + .br + sze : Number of determinants + .br + N_st : Number of eigenstates + .br + iunit : Unit number for the I/O + .br + Initial guess vectors are not necessarily orthonormal + + +`dble_fact `_ + Undocumented + + +`dble_fact_even `_ + n!! + + +`dble_fact_odd `_ + n!! + + +`dble_logfact `_ + n!! + + +`ddfact2 `_ + Undocumented + + +`delta_ii `_ + Dressing matrix in N_det basis + + +`delta_ij `_ + Dressing matrix in N_det basis + + +`det_inf `_ + Undocumented + + +`diagonalize_ci_dressed `_ + Replace the coefficients of the CI states by the coefficients of the + eigenstates of the CI matrix + + +`dset_order `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + + +`dset_order_big `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`dsort `_ + Sort array x(isize). + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`erf0 `_ + Undocumented + + +`f_integral `_ + function that calculates the following integral + \int_{\-infty}^{+\infty} x^n \exp(-p x^2) dx + + +`fact `_ + n! + + +`fact_inv `_ + 1/n! + + +`find_rotation `_ + Find A.C = B + + +`find_triples_and_quadruples `_ + Undocumented + + +`gammln `_ + Undocumented + + +`gammp `_ + Undocumented + + +`gaussian_product `_ + Gaussian product in 1D. + e^{-a (x-x_A)^2} e^{-b (x-x_B)^2} = K_{ab}^x e^{-p (x-x_P)^2} + + +`gaussian_product_x `_ + Gaussian product in 1D. + e^{-a (x-x_A)^2} e^{-b (x-x_B)^2} = K_{ab}^x e^{-p (x-x_P)^2} + + +`gcf `_ + Undocumented + + +`get_pseudo_inverse `_ + Find C = A^-1 + + +`give_explicit_poly_and_gaussian `_ + Transforms the product of + (x-x_A)^a(1) (x-x_B)^b(1) (x-x_A)^a(2) (y-y_B)^b(2) (z-z_A)^a(3) (z-z_B)^b(3) exp(-(r-A)^2 alpha) exp(-(r-B)^2 beta) + into + fact_k * [ sum (l_x = 0,i_order(1)) P_new(l_x,1) * (x-P_center(1))^l_x ] exp (- p (x-P_center(1))^2 ) + * [ sum (l_y = 0,i_order(2)) P_new(l_y,2) * (y-P_center(2))^l_y ] exp (- p (y-P_center(2))^2 ) + * [ sum (l_z = 0,i_order(3)) P_new(l_z,3) * (z-P_center(3))^l_z ] exp (- p (z-P_center(3))^2 ) + + +`give_explicit_poly_and_gaussian_double `_ + Transforms the product of + (x-x_A)^a(1) (x-x_B)^b(1) (x-x_A)^a(2) (y-y_B)^b(2) (z-z_A)^a(3) (z-z_B)^b(3) + exp(-(r-A)^2 alpha) exp(-(r-B)^2 beta) exp(-(r-Nucl_center)^2 gama + .br + into + fact_k * [ sum (l_x = 0,i_order(1)) P_new(l_x,1) * (x-P_center(1))^l_x ] exp (- p (x-P_center(1))^2 ) + * [ sum (l_y = 0,i_order(2)) P_new(l_y,2) * (y-P_center(2))^l_y ] exp (- p (y-P_center(2))^2 ) + * [ sum (l_z = 0,i_order(3)) P_new(l_z,3) * (z-P_center(3))^l_z ] exp (- p (z-P_center(3))^2 ) + + +`give_explicit_poly_and_gaussian_x `_ + Transform the product of + (x-x_A)^a(1) (x-x_B)^b(1) (x-x_A)^a(2) (y-y_B)^b(2) (z-z_A)^a(3) (z-z_B)^b(3) exp(-(r-A)^2 alpha) exp(-(r-B)^2 beta) + into + fact_k (x-x_P)^iorder(1) (y-y_P)^iorder(2) (z-z_P)^iorder(3) exp(-p(r-P)^2) + + +`gser `_ + Undocumented + + +`h_apply_mrcc `_ + Calls H_apply on the HF determinant and selects all connected single and double + excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. + + +`h_apply_mrcc_diexc `_ + Undocumented + + +`h_apply_mrcc_diexcorg `_ + Generate all double excitations of key_in using the bit masks of holes and + particles. + Assume N_int is already provided. + + +`h_apply_mrcc_diexcp `_ + Undocumented + + +`h_apply_mrcc_monoexc `_ + Generate all single excitations of key_in using the bit masks of holes and + particles. + Assume N_int is already provided. + + +`h_matrix_dressed `_ + Dressed H with Delta_ij + + +`h_u_0_mrcc `_ + Computes v_0 = H|u_0> + .br + n : number of determinants + .br + H_jj : array of + + +`heap_dsort `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`heap_dsort_big `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`heap_i2sort `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`heap_i2sort_big `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`heap_i8sort `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`heap_i8sort_big `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`heap_isort `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`heap_isort_big `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`heap_sort `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`heap_sort_big `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`hermite `_ + Hermite polynomial + + +`i2radix_sort `_ + Sort integer array x(isize) using the radix sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + iradix should be -1 in input. + + +`i2set_order `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + + +`i2set_order_big `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`i2sort `_ + Sort array x(isize). + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`i8radix_sort `_ + Sort integer array x(isize) using the radix sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + iradix should be -1 in input. + + +`i8radix_sort_big `_ + Sort integer array x(isize) using the radix sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + iradix should be -1 in input. + + +`i8set_order `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + + +`i8set_order_big `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`i8sort `_ + Sort array x(isize). + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`insertion_dsort `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`insertion_dsort_big `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`insertion_i2sort `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`insertion_i2sort_big `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`insertion_i8sort `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`insertion_i8sort_big `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`insertion_isort `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`insertion_isort_big `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`insertion_sort `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`insertion_sort_big `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`inv_int `_ + 1/i + + +`iradix_sort `_ + Sort integer array x(isize) using the radix sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + iradix should be -1 in input. + + +`iradix_sort_big `_ + Sort integer array x(isize) using the radix sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + iradix should be -1 in input. + + +`iset_order `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + + +`iset_order_big `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`isort `_ + Sort array x(isize). + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`lambda_mrcc `_ + cm/ or perturbative 1/Delta_E(m) + + +`lambda_mrcc_tmp `_ + Undocumented + + +`lambda_pert `_ + cm/ or perturbative 1/Delta_E(m) + + +`lapack_diag `_ + Diagonalize matrix H + .br + H is untouched between input and ouptut + .br + eigevalues(i) = ith lowest eigenvalue of the H matrix + .br + eigvectors(i,j) = where i is the basis function and psi_j is the j th eigenvector + .br + + +`lapack_diag_s2 `_ + Diagonalize matrix H + .br + H is untouched between input and ouptut + .br + eigevalues(i) = ith lowest eigenvalue of the H matrix + .br + eigvectors(i,j) = where i is the basis function and psi_j is the j th eigenvector + .br + + +`lapack_diagd `_ + Diagonalize matrix H + .br + H is untouched between input and ouptut + .br + eigevalues(i) = ith lowest eigenvalue of the H matrix + .br + eigvectors(i,j) = where i is the basis function and psi_j is the j th eigenvector + .br + + +`lapack_partial_diag `_ + Diagonalize matrix H + .br + H is untouched between input and ouptut + .br + eigevalues(i) = ith lowest eigenvalue of the H matrix + .br + eigvectors(i,j) = where i is the basis function and psi_j is the j th eigenvector + .br + + +`logfact `_ + n! + + +`mrcc_dress `_ + Undocumented + + +`mrcc_dress_simple `_ + Undocumented + + +`mrcc_iterations `_ + Undocumented + + +`multiply_poly `_ + Multiply two polynomials + D(t) =! D(t) +( B(t)*C(t)) + + +`normalize `_ + Normalizes vector u + u is expected to be aligned in memory. + + +`nproc `_ + Number of current OpenMP threads + + +`ortho_lowdin `_ + Compute C_new=C_old.S^-1/2 canonical orthogonalization. + .br + overlap : overlap matrix + .br + LDA : leftmost dimension of overlap array + .br + N : Overlap matrix is NxN (array is (LDA,N) ) + .br + C : Coefficients of the vectors to orthogonalize. On exit, + orthogonal vectors + .br + LDC : leftmost dimension of C + .br + m : Coefficients matrix is MxN, ( array is (LDC,N) ) + .br + + +`oscillations `_ + Undocumented + + +`overlap_a_b_c `_ + Undocumented + + +`overlap_gaussian_x `_ + .. math:: + .br + \sum_{-infty}^{+infty} (x-A_x)^ax (x-B_x)^bx exp(-alpha(x-A_x)^2) exp(-beta(x-B_X)^2) dx + .br + + +`overlap_gaussian_xyz `_ + .. math:: + .br + S_x = \int (x-A_x)^{a_x} exp(-\alpha(x-A_x)^2) (x-B_x)^{b_x} exp(-beta(x-B_x)^2) dx \\ + S = S_x S_y S_z + .br + + +`overlap_x_abs `_ + .. math :: + .br + \int_{-infty}^{+infty} (x-A_center)^(power_A) * (x-B_center)^power_B * exp(-alpha(x-A_center)^2) * exp(-beta(x-B_center)^2) dx + .br + + +`pert_determinants `_ + Undocumented + + +`progress_active `_ + Current status for displaying progress bars. Global variable. + + +`progress_bar `_ + Current status for displaying progress bars. Global variable. + + +`progress_timeout `_ + Current status for displaying progress bars. Global variable. + + +`progress_title `_ + Current status for displaying progress bars. Global variable. + + +`progress_value `_ + Current status for displaying progress bars. Global variable. + + +`psi_ref_lock `_ + Locks on ref determinants to fill delta_ij + + +`recentered_poly2 `_ + Recenter two polynomials + + +`rint `_ + .. math:: + .br + \int_0^1 dx \exp(-p x^2) x^n + .br + + +`rint1 `_ + Standard version of rint + + +`rint_large_n `_ + Version of rint for large values of n + + +`rint_sum `_ + Needed for the calculation of two-electron integrals. + + +`rinteg `_ + Undocumented + + +`rintgauss `_ + Undocumented + + +`run_mrcc `_ + Undocumented + + +`run_progress `_ + Display a progress bar with documentation of what is happening + + +`sabpartial `_ + Undocumented + + +`set_generators_bitmasks_as_holes_and_particles `_ + Undocumented + + +`set_order `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + + +`set_order_big `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`set_zero_extra_diag `_ + Undocumented + + +`sort `_ + Sort array x(isize). + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`sort_detlist `_ + Undocumented + + +`start_progress `_ + Starts the progress bar + + +`stop_progress `_ + Stop the progress bar + + +`tamiser `_ + Undocumented + + +`trap_signals `_ + What to do when a signal is caught. Here, trap Ctrl-C and call the control_C subroutine. + + +`u_dot_u `_ + Compute + + +`u_dot_v `_ + Compute + + +`wall_time `_ + The equivalent of cpu_time, but for the wall time. + + +`write_git_log `_ + Write the last git commit in file iunit. + diff --git a/plugins/MRCC_Utils/mrcc_dress.irp.f b/plugins/MRCC_Utils/mrcc_dress.irp.f index 8c86f7fa..59b20c5a 100644 --- a/plugins/MRCC_Utils/mrcc_dress.irp.f +++ b/plugins/MRCC_Utils/mrcc_dress.irp.f @@ -12,12 +12,161 @@ BEGIN_PROVIDER [ integer(omp_lock_kind), psi_ref_lock, (psi_det_size) ] END_PROVIDER -subroutine mrcc_dress(delta_ij_, delta_ii_, Ndet_ref, Ndet_non_ref,i_generator,n_selected,det_buffer,Nint,iproc) + +subroutine create_minilist(key_mask, fullList, miniList, idx_miniList, N_fullList, N_miniList, Nint) + use bitmasks + implicit none + + integer(bit_kind), intent(in) :: fullList(Nint, 2, N_fullList) + integer, intent(in) :: N_fullList + integer(bit_kind),intent(out) :: miniList(Nint, 2, N_fullList) + integer,intent(out) :: idx_miniList(N_fullList), N_miniList + integer, intent(in) :: Nint + integer(bit_kind) :: key_mask(Nint, 2) + integer :: ni, i, n_a, n_b, e_a, e_b + + + n_a = 0 + n_b = 0 + do ni=1,nint + n_a = n_a + popcnt(key_mask(ni,1)) + n_b = n_b + popcnt(key_mask(ni,2)) + end do + + if(n_a == 0) then + N_miniList = N_fullList + miniList(:,:,:) = fullList(:,:,:) + do i=1,N_fullList + idx_miniList(i) = i + end do + return + end if + + N_miniList = 0 + + do i=1,N_fullList + e_a = n_a + e_b = n_b + do ni=1,nint + e_a -= popcnt(iand(fullList(ni, 1, i), key_mask(ni, 1))) + e_b -= popcnt(iand(fullList(ni, 2, i), key_mask(ni, 2))) + end do + + if(e_a + e_b <= 2) then + N_miniList = N_miniList + 1 + miniList(:,:,N_miniList) = fullList(:,:,i) + idx_miniList(N_miniList) = i + end if + end do + +! if(N_miniList > 2) then +! call sort_detList(miniList, idx_miniList, N_miniList, Nint) +! end if +! +! shortcut(0) = 1 +! shortcut(1) = 1 +! do i=2,N_miniList +! do ni=1,nint +! if(miniList(ni,1,i) /= miniList(ni,1,i-1)) then +! shortcut(0) = shortcut(0) + 1 +! shortcut(shortcut(0)) = i +! exit +! end if +! end do +! end do + !print *, N_miniList_tot , " vers ", dik +end subroutine + + +subroutine det_inf(res, key1, key2, Nint) + use bitmasks + implicit none + integer(bit_kind),intent(in) :: key1(Nint, 2), key2(Nint, 2) + integer,intent(in) :: Nint + integer :: i,j + logical,intent(out) :: res + + res = .false. + + do i=1,2 + do j=Nint,1,-1 + if(key1(j,i) < key2(j,i)) then + res = .true. + return + else if(key1(j,i) > key2(j,i)) then + return + end if + end do + end do +end function + + +subroutine tamiser(key, idx, no, n, Nint, N_key) + use bitmasks + + implicit none + integer(bit_kind),intent(inout) :: key(Nint, 2, N_key) + integer,intent(in) :: no, n, Nint, N_key + integer,intent(inout) :: idx(N_key) + integer :: k,j,tmpidx + integer(bit_kind) :: tmp(Nint, 2) + logical :: inf + + k = no + j = 2*k + do while(j <= n) + call det_inf(inf, key(:,:,j), key(:,:,j+1), Nint) + if(j < n .and. inf) then + j = j+1 + end if + call det_inf(inf, key(:,:,k), key(:,:,j), Nint) + if(inf) then + tmp(:,:) = key(:,:,k) + key(:,:,k) = key(:,:,j) + key(:,:,j) = tmp(:,:) + tmpidx = idx(k) + idx(k) = idx(j) + idx(j) = tmpidx + k = j + j = 2*k + else + return + end if + end do +end subroutine + + +subroutine sort_detList(key, idx, N_key, Nint) + use bitmasks + implicit none + + integer(bit_kind),intent(inout) :: key(Nint,2,N_key) + integer,intent(inout) :: idx(N_key) + integer, intent(in) :: Nint, N_key + integer(bit_kind) :: tmp(Nint, 2) + integer :: tmpidx,i + + do i=N_key/2,1,-1 + !call tamiser(key, idx, i, N_key, Nint, N_key) + end do + + do i=N_key,2,-1 + tmp(:,:) = key(:,:,i) + key(:,:,i) = key(:,:,1) + key(:,:,1) = tmp(:,:) + tmpidx = idx(i) + idx(i) = idx(1) + idx(1) = tmpidx + !call tamiser(key, idx, 1, i-1, Nint, N_key) + end do +end subroutine + +subroutine mrcc_dress(delta_ij_, delta_ii_, Ndet_ref, Ndet_non_ref,i_generator,n_selected,det_buffer,Nint,iproc,key_mask) use bitmasks implicit none integer, intent(in) :: i_generator,n_selected, Nint, iproc - integer, intent(in) :: Ndet_ref, Ndet_non_ref + integer, intent(in) :: Ndet_ref, Ndet_non_ref double precision, intent(inout) :: delta_ij_(Ndet_ref,Ndet_non_ref,*) double precision, intent(inout) :: delta_ii_(Ndet_ref,*) @@ -40,7 +189,12 @@ subroutine mrcc_dress(delta_ij_, delta_ii_, Ndet_ref, Ndet_non_ref,i_generator,n integer(bit_kind) :: tmp_det(Nint,2) integer :: iint, ipos integer :: i_state, k_sd, l_sd, i_I, i_alpha - + + integer(bit_kind) :: miniList(Nint, 2, N_det_non_ref), key_mask(Nint, 2) + integer :: idx_miniList(N_det_non_ref), N_miniList + + + call find_triples_and_quadruples(i_generator,n_selected,det_buffer,Nint,tq,N_tq) allocate (dIa_hla(N_states,Ndet_non_ref)) @@ -48,9 +202,20 @@ subroutine mrcc_dress(delta_ij_, delta_ii_, Ndet_ref, Ndet_non_ref,i_generator,n ! |I> ! |alpha> + + if(N_tq > 0) then + call create_minilist(key_mask, psi_non_ref, miniList, idx_miniList, N_det_non_ref, N_minilist, Nint) + end if + + do i_alpha=1,N_tq - call get_excitation_degree_vector(psi_non_ref,tq(1,1,i_alpha),degree_alpha,Nint,N_det_non_ref,idx_alpha) - +! call get_excitation_degree_vector(psi_non_ref,tq(1,1,i_alpha),degree_alpha,Nint,N_det_non_ref,idx_alpha) + call get_excitation_degree_vector(miniList,tq(1,1,i_alpha),degree_alpha,Nint,N_minilist,idx_alpha) + + do j=1,idx_alpha(0) + idx_alpha(j) = idx_miniList(idx_alpha(j)) + end do + ! |I> do i_I=1,N_det_ref ! Find triples and quadruple grand parents @@ -233,7 +398,8 @@ subroutine find_triples_and_quadruples(i_generator,n_selected,det_buffer,Nint,tq ! Select determinants that are triple or quadruple excitations ! from the ref good = .True. - call get_excitation_degree_vector(psi_ref,det_buffer(1,1,i),degree,Nint,N_det_ref,idx) + call get_excitation_degree_vector(psi_ref,det_buffer(1,1,i),degree,Nint,N_det_ref,idx) + !good=(idx(0) == 0) tant que degree > 2 pas retourné par get_excitation_degree_vector do k=1,idx(0) if (degree(k) < 3) then good = .False. diff --git a/plugins/Perturbation/README.rst b/plugins/Perturbation/README.rst index 3f77b2a2..aa6ebf54 100644 --- a/plugins/Perturbation/README.rst +++ b/plugins/Perturbation/README.rst @@ -112,37 +112,37 @@ Documentation routine. -`perturb_buffer_by_mono_dipole_moment_z `_ +`perturb_buffer_by_mono_dipole_moment_z `_ Applly pertubration ``dipole_moment_z`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_by_mono_epstein_nesbet `_ +`perturb_buffer_by_mono_epstein_nesbet `_ Applly pertubration ``epstein_nesbet`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_by_mono_epstein_nesbet_2x2 `_ +`perturb_buffer_by_mono_epstein_nesbet_2x2 `_ Applly pertubration ``epstein_nesbet_2x2`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_by_mono_epstein_nesbet_sc2 `_ +`perturb_buffer_by_mono_epstein_nesbet_sc2 `_ Applly pertubration ``epstein_nesbet_sc2`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_by_mono_epstein_nesbet_sc2_no_projected `_ +`perturb_buffer_by_mono_epstein_nesbet_sc2_no_projected `_ Applly pertubration ``epstein_nesbet_sc2_no_projected`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_by_mono_epstein_nesbet_sc2_projected `_ +`perturb_buffer_by_mono_epstein_nesbet_sc2_projected `_ Applly pertubration ``epstein_nesbet_sc2_projected`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_by_mono_h_core `_ +`perturb_buffer_by_mono_h_core `_ Applly pertubration ``h_core`` to the buffer of determinants generated in the H_apply routine. @@ -157,37 +157,37 @@ Documentation routine. -`perturb_buffer_dipole_moment_z `_ +`perturb_buffer_dipole_moment_z `_ Applly pertubration ``dipole_moment_z`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_epstein_nesbet `_ +`perturb_buffer_epstein_nesbet `_ Applly pertubration ``epstein_nesbet`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_epstein_nesbet_2x2 `_ +`perturb_buffer_epstein_nesbet_2x2 `_ Applly pertubration ``epstein_nesbet_2x2`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_epstein_nesbet_sc2 `_ +`perturb_buffer_epstein_nesbet_sc2 `_ Applly pertubration ``epstein_nesbet_sc2`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_epstein_nesbet_sc2_no_projected `_ +`perturb_buffer_epstein_nesbet_sc2_no_projected `_ Applly pertubration ``epstein_nesbet_sc2_no_projected`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_epstein_nesbet_sc2_projected `_ +`perturb_buffer_epstein_nesbet_sc2_projected `_ Applly pertubration ``epstein_nesbet_sc2_projected`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_h_core `_ +`perturb_buffer_h_core `_ Applly pertubration ``h_core`` to the buffer of determinants generated in the H_apply routine. diff --git a/plugins/Psiref_CAS/README.rst b/plugins/Psiref_CAS/README.rst index b15aefb5..1715049a 100644 --- a/plugins/Psiref_CAS/README.rst +++ b/plugins/Psiref_CAS/README.rst @@ -49,3 +49,46 @@ Needed Modules * `Psiref_Utils `_ +Needed Modules +============== +.. Do not edit this section It was auto-generated +.. by the `update_README.py` script. + + +.. image:: tree_dependency.png + +* `Psiref_Utils `_ + +Documentation +============= +.. Do not edit this section It was auto-generated +.. by the `update_README.py` script. + + +`idx_ref `_ + CAS wave function, defined from the application of the CAS bitmask on the + determinants. idx_cas gives the indice of the CAS determinant in psi_det. + + +`n_det_ref `_ + CAS wave function, defined from the application of the CAS bitmask on the + determinants. idx_cas gives the indice of the CAS determinant in psi_det. + + +`psi_ref `_ + CAS wave function, defined from the application of the CAS bitmask on the + determinants. idx_cas gives the indice of the CAS determinant in psi_det. + + +`psi_ref_coef `_ + CAS wave function, defined from the application of the CAS bitmask on the + determinants. idx_cas gives the indice of the CAS determinant in psi_det. + + +`psi_ref_coef_restart `_ + Projection of the CAS wave function on the restart wave function. + + +`psi_ref_restart `_ + Projection of the CAS wave function on the restart wave function. + diff --git a/plugins/Psiref_Utils/README.rst b/plugins/Psiref_Utils/README.rst index 8b25e0a1..c30cdb11 100644 --- a/plugins/Psiref_Utils/README.rst +++ b/plugins/Psiref_Utils/README.rst @@ -119,3 +119,740 @@ Documentation Reference determinants sorted to accelerate the search of a random determinant in the wave function. +Documentation +============= +.. Do not edit this section It was auto-generated +.. by the `update_README.py` script. + + +`a_coef `_ + Undocumented + + +`abort_all `_ + If True, all the calculation is aborted + + +`abort_here `_ + If True, all the calculation is aborted + + +`add_poly `_ + Add two polynomials + D(t) =! D(t) +( B(t)+C(t)) + + +`add_poly_multiply `_ + Add a polynomial multiplied by a constant + D(t) =! D(t) +( cst * B(t)) + + +`align_double `_ + Compute 1st dimension such that it is aligned for vectorization. + + +`apply_rotation `_ + Apply the rotation found by find_rotation + + +`approx_dble `_ + Undocumented + + +`b_coef `_ + Undocumented + + +`binom `_ + Binomial coefficients + + +`binom_func `_ + .. math :: + .br + \frac{i!}{j!(i-j)!} + .br + + +`binom_transp `_ + Binomial coefficients + + +`catch_signal `_ + What to do on Ctrl-C. If two Ctrl-C are pressed within 1 sec, the calculation if aborted. + + +`dble_fact `_ + Undocumented + + +`dble_fact_even `_ + n!! + + +`dble_fact_odd `_ + n!! + + +`dble_logfact `_ + n!! + + +`ddfact2 `_ + Undocumented + + +`dset_order `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + + +`dset_order_big `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`dsort `_ + Sort array x(isize). + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`erf0 `_ + Undocumented + + +`f_integral `_ + function that calculates the following integral + \int_{\-infty}^{+\infty} x^n \exp(-p x^2) dx + + +`fact `_ + n! + + +`fact_inv `_ + 1/n! + + +`find_rotation `_ + Find A.C = B + + +`gammln `_ + Undocumented + + +`gammp `_ + Undocumented + + +`gaussian_product `_ + Gaussian product in 1D. + e^{-a (x-x_A)^2} e^{-b (x-x_B)^2} = K_{ab}^x e^{-p (x-x_P)^2} + + +`gaussian_product_x `_ + Gaussian product in 1D. + e^{-a (x-x_A)^2} e^{-b (x-x_B)^2} = K_{ab}^x e^{-p (x-x_P)^2} + + +`gcf `_ + Undocumented + + +`get_index_in_psi_ref_sorted_bit `_ + Returns the index of the determinant in the ``psi_ref_sorted_bit`` array + + +`get_pseudo_inverse `_ + Find C = A^-1 + + +`give_explicit_poly_and_gaussian `_ + Transforms the product of + (x-x_A)^a(1) (x-x_B)^b(1) (x-x_A)^a(2) (y-y_B)^b(2) (z-z_A)^a(3) (z-z_B)^b(3) exp(-(r-A)^2 alpha) exp(-(r-B)^2 beta) + into + fact_k * [ sum (l_x = 0,i_order(1)) P_new(l_x,1) * (x-P_center(1))^l_x ] exp (- p (x-P_center(1))^2 ) + * [ sum (l_y = 0,i_order(2)) P_new(l_y,2) * (y-P_center(2))^l_y ] exp (- p (y-P_center(2))^2 ) + * [ sum (l_z = 0,i_order(3)) P_new(l_z,3) * (z-P_center(3))^l_z ] exp (- p (z-P_center(3))^2 ) + + +`give_explicit_poly_and_gaussian_double `_ + Transforms the product of + (x-x_A)^a(1) (x-x_B)^b(1) (x-x_A)^a(2) (y-y_B)^b(2) (z-z_A)^a(3) (z-z_B)^b(3) + exp(-(r-A)^2 alpha) exp(-(r-B)^2 beta) exp(-(r-Nucl_center)^2 gama + .br + into + fact_k * [ sum (l_x = 0,i_order(1)) P_new(l_x,1) * (x-P_center(1))^l_x ] exp (- p (x-P_center(1))^2 ) + * [ sum (l_y = 0,i_order(2)) P_new(l_y,2) * (y-P_center(2))^l_y ] exp (- p (y-P_center(2))^2 ) + * [ sum (l_z = 0,i_order(3)) P_new(l_z,3) * (z-P_center(3))^l_z ] exp (- p (z-P_center(3))^2 ) + + +`give_explicit_poly_and_gaussian_x `_ + Transform the product of + (x-x_A)^a(1) (x-x_B)^b(1) (x-x_A)^a(2) (y-y_B)^b(2) (z-z_A)^a(3) (z-z_B)^b(3) exp(-(r-A)^2 alpha) exp(-(r-B)^2 beta) + into + fact_k (x-x_P)^iorder(1) (y-y_P)^iorder(2) (z-z_P)^iorder(3) exp(-p(r-P)^2) + + +`gser `_ + Undocumented + + +`h_matrix_ref `_ + Undocumented + + +`heap_dsort `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`heap_dsort_big `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`heap_i2sort `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`heap_i2sort_big `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`heap_i8sort `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`heap_i8sort_big `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`heap_isort `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`heap_isort_big `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`heap_sort `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`heap_sort_big `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`hermite `_ + Hermite polynomial + + +`holes_operators `_ + holes_operators represents an array of integers where all the holes have + been done going from psi_ref to psi_non_ref + particles_operators represents an array of integers where all the particles have + been done going from psi_ref to psi_non_ref + + +`i2radix_sort `_ + Sort integer array x(isize) using the radix sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + iradix should be -1 in input. + + +`i2set_order `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + + +`i2set_order_big `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`i2sort `_ + Sort array x(isize). + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`i8radix_sort `_ + Sort integer array x(isize) using the radix sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + iradix should be -1 in input. + + +`i8radix_sort_big `_ + Sort integer array x(isize) using the radix sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + iradix should be -1 in input. + + +`i8set_order `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + + +`i8set_order_big `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`i8sort `_ + Sort array x(isize). + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`idx_non_ref `_ + Set of determinants which are not part of the reference, defined from the application + of the reference bitmask on the determinants. + idx_non_ref gives the indice of the determinant in psi_det. + idx_non_ref_rev gives the reverse. + + +`idx_non_ref_rev `_ + Set of determinants which are not part of the reference, defined from the application + of the reference bitmask on the determinants. + idx_non_ref gives the indice of the determinant in psi_det. + idx_non_ref_rev gives the reverse. + + +`insertion_dsort `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`insertion_dsort_big `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`insertion_i2sort `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`insertion_i2sort_big `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`insertion_i8sort `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`insertion_i8sort_big `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`insertion_isort `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`insertion_isort_big `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`insertion_sort `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`insertion_sort_big `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`inv_int `_ + 1/i + + +`iradix_sort `_ + Sort integer array x(isize) using the radix sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + iradix should be -1 in input. + + +`iradix_sort_big `_ + Sort integer array x(isize) using the radix sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + iradix should be -1 in input. + + +`is_in_psi_ref `_ + True if the determinant ``det`` is in the wave function + + +`iset_order `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + + +`iset_order_big `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`isort `_ + Sort array x(isize). + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`lapack_diag `_ + Diagonalize matrix H + .br + H is untouched between input and ouptut + .br + eigevalues(i) = ith lowest eigenvalue of the H matrix + .br + eigvectors(i,j) = where i is the basis function and psi_j is the j th eigenvector + .br + + +`lapack_diag_s2 `_ + Diagonalize matrix H + .br + H is untouched between input and ouptut + .br + eigevalues(i) = ith lowest eigenvalue of the H matrix + .br + eigvectors(i,j) = where i is the basis function and psi_j is the j th eigenvector + .br + + +`lapack_diagd `_ + Diagonalize matrix H + .br + H is untouched between input and ouptut + .br + eigevalues(i) = ith lowest eigenvalue of the H matrix + .br + eigvectors(i,j) = where i is the basis function and psi_j is the j th eigenvector + .br + + +`lapack_partial_diag `_ + Diagonalize matrix H + .br + H is untouched between input and ouptut + .br + eigevalues(i) = ith lowest eigenvalue of the H matrix + .br + eigvectors(i,j) = where i is the basis function and psi_j is the j th eigenvector + .br + + +`logfact `_ + n! + + +`multiply_poly `_ + Multiply two polynomials + D(t) =! D(t) +( B(t)*C(t)) + + +`n_det_non_ref `_ + Set of determinants which are not part of the reference, defined from the application + of the reference bitmask on the determinants. + idx_non_ref gives the indice of the determinant in psi_det. + idx_non_ref_rev gives the reverse. + + +`normalize `_ + Normalizes vector u + u is expected to be aligned in memory. + + +`nproc `_ + Number of current OpenMP threads + + +`ortho_lowdin `_ + Compute C_new=C_old.S^-1/2 canonical orthogonalization. + .br + overlap : overlap matrix + .br + LDA : leftmost dimension of overlap array + .br + N : Overlap matrix is NxN (array is (LDA,N) ) + .br + C : Coefficients of the vectors to orthogonalize. On exit, + orthogonal vectors + .br + LDC : leftmost dimension of C + .br + m : Coefficients matrix is MxN, ( array is (LDC,N) ) + .br + + +`overlap_a_b_c `_ + Undocumented + + +`overlap_gaussian_x `_ + .. math:: + .br + \sum_{-infty}^{+infty} (x-A_x)^ax (x-B_x)^bx exp(-alpha(x-A_x)^2) exp(-beta(x-B_X)^2) dx + .br + + +`overlap_gaussian_xyz `_ + .. math:: + .br + S_x = \int (x-A_x)^{a_x} exp(-\alpha(x-A_x)^2) (x-B_x)^{b_x} exp(-beta(x-B_x)^2) dx \\ + S = S_x S_y S_z + .br + + +`overlap_x_abs `_ + .. math :: + .br + \int_{-infty}^{+infty} (x-A_center)^(power_A) * (x-B_center)^power_B * exp(-alpha(x-A_center)^2) * exp(-beta(x-B_center)^2) dx + .br + + +`particles_operators `_ + holes_operators represents an array of integers where all the holes have + been done going from psi_ref to psi_non_ref + particles_operators represents an array of integers where all the particles have + been done going from psi_ref to psi_non_ref + + +`progress_active `_ + Current status for displaying progress bars. Global variable. + + +`progress_bar `_ + Current status for displaying progress bars. Global variable. + + +`progress_timeout `_ + Current status for displaying progress bars. Global variable. + + +`progress_title `_ + Current status for displaying progress bars. Global variable. + + +`progress_value `_ + Current status for displaying progress bars. Global variable. + + +`psi_coef_ref_diagonalized `_ + Undocumented + + +`psi_non_ref `_ + Set of determinants which are not part of the reference, defined from the application + of the reference bitmask on the determinants. + idx_non_ref gives the indice of the determinant in psi_det. + idx_non_ref_rev gives the reverse. + + +`psi_non_ref_coef `_ + Set of determinants which are not part of the reference, defined from the application + of the reference bitmask on the determinants. + idx_non_ref gives the indice of the determinant in psi_det. + idx_non_ref_rev gives the reverse. + + +`psi_non_ref_coef_restart `_ + Set of determinants which are not part of the reference, defined from the application + of the reference bitmask on the determinants. + idx_non_ref gives the indice of the determinant in psi_det. + But this is with respect to the restart wave function. + + +`psi_non_ref_coef_sorted_bit `_ + Reference determinants sorted to accelerate the search of a random determinant in the wave + function. + + +`psi_non_ref_restart `_ + Set of determinants which are not part of the reference, defined from the application + of the reference bitmask on the determinants. + idx_non_ref gives the indice of the determinant in psi_det. + But this is with respect to the restart wave function. + + +`psi_non_ref_sorted_bit `_ + Reference determinants sorted to accelerate the search of a random determinant in the wave + function. + + +`psi_ref_coef_sorted_bit `_ + Reference determinants sorted to accelerate the search of a random determinant in the wave + function. + + +`psi_ref_energy `_ + Undocumented + + +`psi_ref_energy_diagonalized `_ + Undocumented + + +`psi_ref_sorted_bit `_ + Reference determinants sorted to accelerate the search of a random determinant in the wave + function. + + +`recentered_poly2 `_ + Recenter two polynomials + + +`rint `_ + .. math:: + .br + \int_0^1 dx \exp(-p x^2) x^n + .br + + +`rint1 `_ + Standard version of rint + + +`rint_large_n `_ + Version of rint for large values of n + + +`rint_sum `_ + Needed for the calculation of two-electron integrals. + + +`rinteg `_ + Undocumented + + +`rintgauss `_ + Undocumented + + +`run_progress `_ + Display a progress bar with documentation of what is happening + + +`sabpartial `_ + Undocumented + + +`set_order `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + + +`set_order_big `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`set_zero_extra_diag `_ + Undocumented + + +`sort `_ + Sort array x(isize). + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`start_progress `_ + Starts the progress bar + + +`stop_progress `_ + Stop the progress bar + + +`trap_signals `_ + What to do when a signal is caught. Here, trap Ctrl-C and call the control_C subroutine. + + +`u_dot_u `_ + Compute + + +`u_dot_v `_ + Compute + + +`wall_time `_ + The equivalent of cpu_time, but for the wall time. + + +`write_git_log `_ + Write the last git commit in file iunit. + diff --git a/src/Determinants/H_apply.template.f b/src/Determinants/H_apply.template.f index 3a05ee0d..00d82996 100644 --- a/src/Determinants/H_apply.template.f +++ b/src/Determinants/H_apply.template.f @@ -1,4 +1,116 @@ + + subroutine $subroutine_diexc(key_in, hole_1,particl_1, hole_2, particl_2, i_generator, iproc_in $parameters ) + + integer(bit_kind), intent(in) :: key_in(N_int, 2), hole_1(N_int, 2), hole_2(N_int, 2) + integer(bit_kind), intent(in) :: particl_1(N_int, 2), particl_2(N_int, 2) + integer(bit_kind) :: p1_mask(N_int, 2), p2_mask(N_int, 2) + integer,intent(in) :: i_generator,iproc_in + integer(bit_kind) :: status(N_int*bit_kind_size, 2) + integer :: highest, p1,p2,sp,ni,i,mi + $declarations + + + highest = 0 + status(:,:) = 0 + do sp=1,2 + do ni=1,N_int + do i=1,bit_kind_size + if(iand(1,ishft(key_in(ni, sp), -(i-1))) == 0) then + cycle + end if + mi = (ni-1)*bit_kind_size+i + status(mi, sp) = iand(1,ishft(hole_1(ni, sp), -(i-1))) + status(mi, sp) = status(mi, sp) + 2*iand(1,ishft(hole_2(ni, sp), -(i-1))) + if(status(mi, sp) /= 0 .and. mi > highest) then + highest = mi + end if + end do + end do + end do + + do sp=1,2 + do p1=1,highest + if(status(p1, sp) == 0) then + cycle + end if + do p2=1,highest + if(status(p2, sp) == 0) then + cycle + end if + if((status(p1, sp) == 1 .and. status(p2, sp) > 1) .or. & + (status(p1, sp) == 2 .and. status(p2, sp) == 3) .or. & + (status(p1, sp) == 3 .and. status(p2, sp) == 3 .and. p2 > p1)) then + call $subroutine_diexcP(key_in, sp, p1, particl_1, sp, p2, particl_2, i_generator, iproc_in $parameters ) + end if + end do + end do + end do + do p1=1,highest + if(status(p1, 1) == 0) then + cycle + end if + do p2=1,highest + if(status(p2, 2) == 0) then + cycle + end if + if((status(p1, 1) == 3) .or. & + (status(p1, 1) == 1 .and. status(p2, 2) >= 2) .or. & + (status(p1, 1) == 2 .and. status(p2, 2) /= 2)) then + + call $subroutine_diexcP(key_in, 1, p1, particl_1, 2, p2, particl_2, i_generator, iproc_in $parameters ) + end if + end do + end do +end subroutine + + +subroutine $subroutine_diexcP(key_in, fs1, fh1, particl_1, fs2, fh2, particl_2, i_generator, iproc_in $parameters ) + + integer(bit_kind), intent(in) :: key_in(N_int, 2), particl_1(N_int, 2), particl_2(N_int, 2) + integer(bit_kind) :: p1_mask(N_int, 2), p2_mask(N_int, 2), key_mask(N_int, 2) + integer,intent(in) :: fh1,fh2,fs1,fs2,i_generator,iproc_in + integer(bit_kind) :: miniList(N_int, 2, N_det) + integer :: n_minilist, n_alpha, n_beta, deg(2), i, ni + $declarations + + p1_mask(:,:) = 0 + p2_mask(:,:) = 0 + p1_mask(fh1/bit_kind_size + 1, fs1) = 2**(mod(fh1-1,bit_kind_size)) + p2_mask(fh2/bit_kind_size + 1, fs2) = 2**(mod(fh2-1,bit_kind_size)) + +! n_alpha = 0 +! n_beta = 0 + key_mask(:,:) = key_in(:,:) + key_mask(fh1/bit_kind_size + 1, fs1) -= 2**(mod(fh1-1,bit_kind_size)) + key_mask(fh2/bit_kind_size + 1, fs2) -= 2**(mod(fh2-1,bit_kind_size)) +! +! do i=1,N_int +! n_alpha = n_alpha + popcnt(key_mask(i, 1)) +! n_beta = n_beta + popcnt(key_mask(i, 2)) +! end do +! +! do i=1, N_det +! deg(1) = n_alpha +! deg(2) = n_beta +! +! do ni = 1, N_int +! ! deg(1) = deg(1) - popcnt(iand(key_mask(ni, 1), psi_non_ref(ni, 1, i))) +! ! deg(2) = deg(2) - popcnt(iand(key_mask(ni, 2), psi_non_ref(ni, 2, i))) +! end do +! +! +! if(deg(1) + deg(2) <= 2) then +! ! ndet_out = ndet_out + 1 +! ! idx(ndet_out) = i +! end if +! end do + + call $subroutine_diexcOrg(key_in, key_mask, p1_mask, particl_1, p2_mask, particl_2, i_generator, iproc_in $parameters ) +end subroutine + + +subroutine $subroutine_diexcOrg(key_in,key_mask,hole_1,particl_1,hole_2, particl_2, i_generator, iproc_in $parameters ) use omp_lib use bitmasks implicit none @@ -10,7 +122,7 @@ subroutine $subroutine_diexc(key_in, hole_1,particl_1, hole_2, particl_2, i_gene integer,parameter :: size_max = $size_max $declarations integer ,intent(in) :: i_generator - integer(bit_kind),intent(in) :: key_in(N_int,2) + integer(bit_kind),intent(in) :: key_in(N_int,2), key_mask(N_int, 2) integer(bit_kind),allocatable :: keys_out(:,:,:) integer(bit_kind), intent(in) :: hole_1(N_int,2), particl_1(N_int,2) integer(bit_kind), intent(in) :: hole_2(N_int,2), particl_2(N_int,2) @@ -290,13 +402,18 @@ subroutine $subroutine_monoexc(key_in, hole_1,particl_1,i_generator,iproc_in $pa double precision :: diag_H_mat_elem integer(omp_lock_kind), save :: lck, ifirst=0 integer :: iproc - + + integer(bit_kind) :: key_mask(N_int, 2) + logical :: check_double_excitation + + key_mask(:,:) = 0_8 + iproc = iproc_in check_double_excitation = .True. $check_double_excitation - + if (ifirst == 0) then ifirst=1 diff --git a/src/Determinants/README.rst b/src/Determinants/README.rst index 2c2759ae..8d1a9e4d 100644 --- a/src/Determinants/README.rst +++ b/src/Determinants/README.rst @@ -54,7 +54,11 @@ Documentation .. by the `update_README.py` script. +`a_operator `_ Needed for diag_H_mat_elem + + +`abs_psi_coef_max `_ Max and min values of the coefficients @@ -62,7 +66,7 @@ Documentation Max and min values of the coefficients -`ac_operator `_ +`ac_operator `_ Needed for diag_H_mat_elem @@ -225,7 +229,7 @@ Documentation det_coef -`det_connections `_ +`det_connections `_ Build connection proxy between determinants @@ -249,7 +253,7 @@ Documentation Diagonalization algorithm (Davidson or Lapack) -`diag_h_mat_elem `_ +`diag_h_mat_elem `_ Computes @@ -367,7 +371,7 @@ Documentation Returns the excitation degree between two determinants -`get_excitation_degree_vector `_ +`get_excitation_degree_vector `_ Applies get_excitation_degree to an array of determinants @@ -387,7 +391,7 @@ Documentation Returns the excitation operator between two singly excited determinants and the phase -`get_occ_from_key `_ +`get_occ_from_key `_ Returns a list of occupation numbers from a bitstring @@ -421,7 +425,7 @@ Documentation Undocumented -`h_u_0 `_ +`h_u_0 `_ Computes v_0 = H|u_0> .br n : number of determinants @@ -445,7 +449,7 @@ Documentation for the various Nstates -`i_h_psi_sc2 `_ +`i_h_psi_sc2 `_ for the various Nstate .br returns in addition @@ -459,7 +463,7 @@ Documentation to repeat the excitations -`i_h_psi_sc2_verbose `_ +`i_h_psi_sc2_verbose `_ for the various Nstate .br returns in addition @@ -473,7 +477,7 @@ Documentation to repeat the excitations -`i_h_psi_sec_ord `_ +`i_h_psi_sec_ord `_ for the various Nstates @@ -520,7 +524,7 @@ Documentation Energy of the reference bitmask used in Slater rules -`n_con_int `_ +`n_con_int `_ Number of integers to represent the connections between determinants diff --git a/src/Determinants/connected_to_ref.irp.f b/src/Determinants/connected_to_ref.irp.f index 49a3604a..8f594738 100644 --- a/src/Determinants/connected_to_ref.irp.f +++ b/src/Determinants/connected_to_ref.irp.f @@ -169,7 +169,7 @@ integer function connected_to_ref(key,keys,Nint,N_past_in,Ndet) ! output : 0 : not connected ! i : connected to determinant i of the past - ! -i : is the ith determinant of the refernce wf keys + ! -i : is the ith determinant of the reference wf keys ASSERT (Nint > 0) ASSERT (Nint == N_int) diff --git a/src/Determinants/slater_rules.irp.f b/src/Determinants/slater_rules.irp.f index 04fd983e..40d65562 100644 --- a/src/Determinants/slater_rules.irp.f +++ b/src/Determinants/slater_rules.irp.f @@ -787,6 +787,7 @@ subroutine i_H_psi(key,keys,coef,Nint,Ndet,Ndet_max,Nstate,i_H_psi_array) ASSERT (Ndet > 0) ASSERT (Ndet_max >= Ndet) i_H_psi_array = 0.d0 + call filter_connected_i_H_psi0(keys,key,Nint,Ndet,idx) do ii=1,idx(0) i = idx(ii) diff --git a/src/Ezfio_files/README.rst b/src/Ezfio_files/README.rst index c97e6268..a612dcc7 100644 --- a/src/Ezfio_files/README.rst +++ b/src/Ezfio_files/README.rst @@ -170,3 +170,147 @@ Documentation Write a time stamp in the output for chronological reconstruction +Documentation +============= +.. Do not edit this section It was auto-generated +.. by the `update_README.py` script. + + +`ezfio_filename `_ + Name of EZFIO file. It is obtained from the QPACKAGE_INPUT environment + variable if it is set, or as the 1st argument of the command line. + + +`getunitandopen `_ + :f: + file name + .br + :mode: + 'R' : READ, UNFORMATTED + 'W' : WRITE, UNFORMATTED + 'r' : READ, FORMATTED + 'w' : WRITE, FORMATTED + 'a' : APPEND, FORMATTED + 'x' : READ/WRITE, FORMATTED + .br + + +`output_ao_basis `_ + Output file for AO_Basis + + +`output_bitmask `_ + Output file for Bitmask + + +`output_cas_sd `_ + Output file for CAS_SD + + +`output_cpu_time_0 `_ + Initial CPU and wall times when printing in the output files + + +`output_determinants `_ + Output file for Determinants + + +`output_electrons `_ + Output file for Electrons + + +`output_ezfio_files `_ + Output file for Ezfio_files + + +`output_full_ci `_ + Output file for Full_CI + + +`output_generators_cas `_ + Output file for Generators_CAS + + +`output_generators_full `_ + Output file for Generators_full + + +`output_hartree_fock `_ + Output file for Hartree_Fock + + +`output_integrals_bielec `_ + Output file for Integrals_Bielec + + +`output_integrals_monoelec `_ + Output file for Integrals_Monoelec + + +`output_mo_basis `_ + Output file for MO_Basis + + +`output_moguess `_ + Output file for MOGuess + + +`output_mrcc_cassd `_ + Output file for MRCC_CASSD + + +`output_mrcc_utils `_ + Output file for MRCC_Utils + + +`output_nuclei `_ + Output file for Nuclei + + +`output_perturbation `_ + Output file for Perturbation + + +`output_properties `_ + Output file for Properties + + +`output_pseudo `_ + Output file for Pseudo + + +`output_psiref_cas `_ + Output file for Psiref_CAS + + +`output_psiref_utils `_ + Output file for Psiref_Utils + + +`output_selectors_full `_ + Output file for Selectors_full + + +`output_utils `_ + Output file for Utils + + +`output_wall_time_0 `_ + Initial CPU and wall times when printing in the output files + + +`write_bool `_ + Write an logical value in output + + +`write_double `_ + Write a double precision value in output + + +`write_int `_ + Write an integer value in output + + +`write_time `_ + Write a time stamp in the output for chronological reconstruction + From 4af7cf1104bacff7c860c9a1893235e5d3799698 Mon Sep 17 00:00:00 2001 From: Yann Garniron Date: Fri, 16 Oct 2015 13:14:19 +0200 Subject: [PATCH 03/20] minilist simple pour mrcc_dress --- plugins/MRCC_Utils/mrcc_dress.irp.f | 100 ---------------------------- 1 file changed, 100 deletions(-) diff --git a/plugins/MRCC_Utils/mrcc_dress.irp.f b/plugins/MRCC_Utils/mrcc_dress.irp.f index 59b20c5a..3a4717ed 100644 --- a/plugins/MRCC_Utils/mrcc_dress.irp.f +++ b/plugins/MRCC_Utils/mrcc_dress.irp.f @@ -58,109 +58,9 @@ subroutine create_minilist(key_mask, fullList, miniList, idx_miniList, N_fullLis idx_miniList(N_miniList) = i end if end do - -! if(N_miniList > 2) then -! call sort_detList(miniList, idx_miniList, N_miniList, Nint) -! end if -! -! shortcut(0) = 1 -! shortcut(1) = 1 -! do i=2,N_miniList -! do ni=1,nint -! if(miniList(ni,1,i) /= miniList(ni,1,i-1)) then -! shortcut(0) = shortcut(0) + 1 -! shortcut(shortcut(0)) = i -! exit -! end if -! end do -! end do - !print *, N_miniList_tot , " vers ", dik end subroutine -subroutine det_inf(res, key1, key2, Nint) - use bitmasks - implicit none - integer(bit_kind),intent(in) :: key1(Nint, 2), key2(Nint, 2) - integer,intent(in) :: Nint - integer :: i,j - logical,intent(out) :: res - - res = .false. - - do i=1,2 - do j=Nint,1,-1 - if(key1(j,i) < key2(j,i)) then - res = .true. - return - else if(key1(j,i) > key2(j,i)) then - return - end if - end do - end do -end function - - -subroutine tamiser(key, idx, no, n, Nint, N_key) - use bitmasks - - implicit none - integer(bit_kind),intent(inout) :: key(Nint, 2, N_key) - integer,intent(in) :: no, n, Nint, N_key - integer,intent(inout) :: idx(N_key) - integer :: k,j,tmpidx - integer(bit_kind) :: tmp(Nint, 2) - logical :: inf - - k = no - j = 2*k - do while(j <= n) - call det_inf(inf, key(:,:,j), key(:,:,j+1), Nint) - if(j < n .and. inf) then - j = j+1 - end if - call det_inf(inf, key(:,:,k), key(:,:,j), Nint) - if(inf) then - tmp(:,:) = key(:,:,k) - key(:,:,k) = key(:,:,j) - key(:,:,j) = tmp(:,:) - tmpidx = idx(k) - idx(k) = idx(j) - idx(j) = tmpidx - k = j - j = 2*k - else - return - end if - end do -end subroutine - - -subroutine sort_detList(key, idx, N_key, Nint) - use bitmasks - implicit none - - integer(bit_kind),intent(inout) :: key(Nint,2,N_key) - integer,intent(inout) :: idx(N_key) - integer, intent(in) :: Nint, N_key - integer(bit_kind) :: tmp(Nint, 2) - integer :: tmpidx,i - - do i=N_key/2,1,-1 - !call tamiser(key, idx, i, N_key, Nint, N_key) - end do - - do i=N_key,2,-1 - tmp(:,:) = key(:,:,i) - key(:,:,i) = key(:,:,1) - key(:,:,1) = tmp(:,:) - tmpidx = idx(i) - idx(i) = idx(1) - idx(1) = tmpidx - !call tamiser(key, idx, 1, i-1, Nint, N_key) - end do -end subroutine - subroutine mrcc_dress(delta_ij_, delta_ii_, Ndet_ref, Ndet_non_ref,i_generator,n_selected,det_buffer,Nint,iproc,key_mask) use bitmasks implicit none From fa8a983681949852fb495f294f424a564ea83a95 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Sat, 17 Oct 2015 15:49:58 +0200 Subject: [PATCH 04/20] Removed -mavx --- config/gfortran.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/gfortran.cfg b/config/gfortran.cfg index 86f625c6..6137c3dd 100644 --- a/config/gfortran.cfg +++ b/config/gfortran.cfg @@ -10,7 +10,7 @@ # # [COMMON] -FC : gfortran -ffree-line-length-none -I . -mavx +FC : gfortran -g -ffree-line-length-none -I . #-mavx LAPACK_LIB : -llapack -lblas IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 @@ -35,7 +35,7 @@ OPENMP : 1 ; Append OpenMP flags # -ffast-math and the Fortran-specific # -fno-protect-parens and -fstack-arrays. [OPT] -FCFLAGS : -Ofast -g +FCFLAGS : -Ofast # Profiling flags ################# From efe8cbe28de1d78070686adbcdc0f066e8edf765 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Sat, 17 Oct 2015 15:54:29 +0200 Subject: [PATCH 05/20] Sort gitignore in ocaml --- ocaml/.gitignore | 92 +++++++++++++++++++++++------------------------- ocaml/Makefile | 2 +- 2 files changed, 46 insertions(+), 48 deletions(-) diff --git a/ocaml/.gitignore b/ocaml/.gitignore index 0cf01652..5618a6c0 100644 --- a/ocaml/.gitignore +++ b/ocaml/.gitignore @@ -1,49 +1,47 @@ -.gitignore -ezfio.ml -Qptypes.ml -qptypes_generator.byte _build -qp_create_ezfio_from_xyz.native -qp_set_ddci.native -qp_print.native -qp_edit.native -qp_set_mo_class.native -qp_basis_clean.native -qp_run.native -qp_edit.native -test_mo_label.byte -test_point3d.byte -test_gto.byte -test_excitation.byte -test_determinants.byte -test_basis.byte -test_molecule.byte -test_elements.byte -test_bitlist.byte -test_atom.byte -test_mo_label -test_point3d -test_gto -test_excitation -test_determinants -test_basis -test_molecule -test_elements -test_bitlist -test_atom -qp_create_ezfio_from_xyz -qp_set_ddci -qp_print -qp_edit -qp_set_mo_class -qp_basis_clean -qp_run -Input_determinants.ml -Input_integrals_bielec.ml -Input_pseudo.ml -Input_perturbation.ml -Input_pseudo.ml -qp_edit.ml -qp_edit -qp_edit.native +ezfio.ml +.gitignore Input_auto_generated.ml +Input_determinants.ml +Input_hartree_fock.ml +Input_integrals_bielec.ml +Input_perturbation.ml +Input_properties.ml +Input_pseudo.ml +qp_basis_clean +qp_basis_clean.native +qp_create_ezfio_from_xyz +qp_create_ezfio_from_xyz.native +qp_edit +qp_edit.ml +qp_edit.native +qp_print +qp_print.native +qp_run +qp_run.native +qp_set_ddci +qp_set_ddci.native +qp_set_mo_class +qp_set_mo_class.native +qptypes_generator.byte +Qptypes.ml +test_atom +test_atom.byte +test_basis +test_basis.byte +test_bitlist +test_bitlist.byte +test_determinants +test_determinants.byte +test_elements +test_elements.byte +test_excitation +test_excitation.byte +test_gto +test_gto.byte +test_mo_label +test_mo_label.byte +test_molecule +test_molecule.byte +test_point3d +test_point3d.byte diff --git a/ocaml/Makefile b/ocaml/Makefile index 07803368..dce21ca5 100644 --- a/ocaml/Makefile +++ b/ocaml/Makefile @@ -30,7 +30,7 @@ default: $(ALL_TESTS) $(ALL_EXE) .gitignore qp_edit.ml qp_edit qp_edit.native Input_auto_generated.ml;\ do \ echo $$i ; \ - done > .gitignore + done |sort | uniq > .gitignore executables: $(QP_ROOT)/data/executables From 26f5d4fdd14a60abacfa8e8f79b15653f6ce336b Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Sat, 17 Oct 2015 15:59:22 +0200 Subject: [PATCH 06/20] Update gfortran.cfg --- config/gfortran.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/gfortran.cfg b/config/gfortran.cfg index 6137c3dd..c1032aa1 100644 --- a/config/gfortran.cfg +++ b/config/gfortran.cfg @@ -10,7 +10,7 @@ # # [COMMON] -FC : gfortran -g -ffree-line-length-none -I . #-mavx +FC : gfortran -g -ffree-line-length-none -I . LAPACK_LIB : -llapack -lblas IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 From adbfd7c90e18a5525450ba35bd3a1f67d841b069 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Sat, 17 Oct 2015 16:19:50 +0200 Subject: [PATCH 07/20] bit_kind --- src/Determinants/H_apply.template.f | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Determinants/H_apply.template.f b/src/Determinants/H_apply.template.f index 00d82996..3d1de6b5 100644 --- a/src/Determinants/H_apply.template.f +++ b/src/Determinants/H_apply.template.f @@ -74,8 +74,8 @@ subroutine $subroutine_diexcP(key_in, fs1, fh1, particl_1, fs2, fh2, particl_2, integer :: n_minilist, n_alpha, n_beta, deg(2), i, ni $declarations - p1_mask(:,:) = 0 - p2_mask(:,:) = 0 + p1_mask(:,:) = 0_bit_kind + p2_mask(:,:) = 0_bit_kind p1_mask(fh1/bit_kind_size + 1, fs1) = 2**(mod(fh1-1,bit_kind_size)) p2_mask(fh2/bit_kind_size + 1, fs2) = 2**(mod(fh2-1,bit_kind_size)) @@ -84,7 +84,7 @@ subroutine $subroutine_diexcP(key_in, fs1, fh1, particl_1, fs2, fh2, particl_2, key_mask(:,:) = key_in(:,:) key_mask(fh1/bit_kind_size + 1, fs1) -= 2**(mod(fh1-1,bit_kind_size)) key_mask(fh2/bit_kind_size + 1, fs2) -= 2**(mod(fh2-1,bit_kind_size)) -! + ! do i=1,N_int ! n_alpha = n_alpha + popcnt(key_mask(i, 1)) ! n_beta = n_beta + popcnt(key_mask(i, 2)) @@ -407,7 +407,7 @@ subroutine $subroutine_monoexc(key_in, hole_1,particl_1,i_generator,iproc_in $pa logical :: check_double_excitation - key_mask(:,:) = 0_8 + key_mask(:,:) = 0_bit_kind iproc = iproc_in From b6000270ca1cac82ba742a38a328f8226788ff14 Mon Sep 17 00:00:00 2001 From: Yann Garniron Date: Wed, 21 Oct 2015 15:50:15 +0200 Subject: [PATCH 08/20] tri alpha/beta simple pour filter_connected_davidson --- .gitignore | 3 +- plugins/CAS_SD/README.rst | 38 ++--- plugins/Full_CI/README.rst | 78 +++++------ plugins/MRCC_Utils/README.rst | 44 +++--- plugins/MRCC_Utils/davidson.irp.f | 175 +++++++++++++++++++++++- plugins/MRCC_Utils/mrcc_dress.irp.f | 3 +- src/Determinants/H_apply.template.f | 68 ++++----- src/Determinants/README.rst | 80 +++++++---- src/Determinants/davidson.irp.f | 117 +++++++++++++++- src/Determinants/filter_connected.irp.f | 157 ++++++++++++++++++++- src/Determinants/slater_rules.irp.f | 102 ++++++++++++-- 11 files changed, 703 insertions(+), 162 deletions(-) diff --git a/.gitignore b/.gitignore index 9d79d718..1f8223f8 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ build.ninja .ninja_deps bin/ lib/ -config/qp_create_ninja.pickle \ No newline at end of file +config/qp_create_ninja.pickle +*/*/README.rst diff --git a/plugins/CAS_SD/README.rst b/plugins/CAS_SD/README.rst index c9fc83f2..c030ac5e 100644 --- a/plugins/CAS_SD/README.rst +++ b/plugins/CAS_SD/README.rst @@ -118,7 +118,7 @@ Documentation Undocumented -`h_apply_cas_sd `_ +`h_apply_cas_sd `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. @@ -127,92 +127,92 @@ Documentation Undocumented -`h_apply_cas_sd_diexcorg `_ +`h_apply_cas_sd_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cas_sd_diexcp `_ +`h_apply_cas_sd_diexcp `_ Undocumented -`h_apply_cas_sd_monoexc `_ +`h_apply_cas_sd_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cas_sd_pt2 `_ +`h_apply_cas_sd_pt2 `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cas_sd_pt2_diexc `_ +`h_apply_cas_sd_pt2_diexc `_ Undocumented -`h_apply_cas_sd_pt2_diexcorg `_ +`h_apply_cas_sd_pt2_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cas_sd_pt2_diexcp `_ +`h_apply_cas_sd_pt2_diexcp `_ Undocumented -`h_apply_cas_sd_pt2_monoexc `_ +`h_apply_cas_sd_pt2_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cas_sd_selected `_ +`h_apply_cas_sd_selected `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cas_sd_selected_diexc `_ +`h_apply_cas_sd_selected_diexc `_ Undocumented -`h_apply_cas_sd_selected_diexcorg `_ +`h_apply_cas_sd_selected_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cas_sd_selected_diexcp `_ +`h_apply_cas_sd_selected_diexcp `_ Undocumented -`h_apply_cas_sd_selected_monoexc `_ +`h_apply_cas_sd_selected_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cas_sd_selected_no_skip `_ +`h_apply_cas_sd_selected_no_skip `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cas_sd_selected_no_skip_diexc `_ +`h_apply_cas_sd_selected_no_skip_diexc `_ Undocumented -`h_apply_cas_sd_selected_no_skip_diexcorg `_ +`h_apply_cas_sd_selected_no_skip_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cas_sd_selected_no_skip_diexcp `_ +`h_apply_cas_sd_selected_no_skip_diexcp `_ Undocumented -`h_apply_cas_sd_selected_no_skip_monoexc `_ +`h_apply_cas_sd_selected_no_skip_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. diff --git a/plugins/Full_CI/README.rst b/plugins/Full_CI/README.rst index be48aa3e..5b0f04db 100644 --- a/plugins/Full_CI/README.rst +++ b/plugins/Full_CI/README.rst @@ -27,7 +27,7 @@ Documentation Undocumented -`h_apply_fci `_ +`h_apply_fci `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. @@ -36,192 +36,192 @@ Documentation Undocumented -`h_apply_fci_diexcorg `_ +`h_apply_fci_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_diexcp `_ +`h_apply_fci_diexcp `_ Undocumented -`h_apply_fci_mono `_ +`h_apply_fci_mono `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_fci_mono_diexc `_ +`h_apply_fci_mono_diexc `_ Undocumented -`h_apply_fci_mono_diexcorg `_ +`h_apply_fci_mono_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_mono_diexcp `_ +`h_apply_fci_mono_diexcp `_ Undocumented -`h_apply_fci_mono_monoexc `_ +`h_apply_fci_mono_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_monoexc `_ +`h_apply_fci_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_no_skip `_ +`h_apply_fci_no_skip `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_fci_no_skip_diexc `_ +`h_apply_fci_no_skip_diexc `_ Undocumented -`h_apply_fci_no_skip_diexcorg `_ +`h_apply_fci_no_skip_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_no_skip_diexcp `_ +`h_apply_fci_no_skip_diexcp `_ Undocumented -`h_apply_fci_no_skip_monoexc `_ +`h_apply_fci_no_skip_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_pt2 `_ +`h_apply_fci_pt2 `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_fci_pt2_diexc `_ +`h_apply_fci_pt2_diexc `_ Undocumented -`h_apply_fci_pt2_diexcorg `_ +`h_apply_fci_pt2_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_pt2_diexcp `_ +`h_apply_fci_pt2_diexcp `_ Undocumented -`h_apply_fci_pt2_monoexc `_ +`h_apply_fci_pt2_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_pt2_mono_delta_rho `_ +`h_apply_pt2_mono_delta_rho `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_pt2_mono_delta_rho_diexc `_ +`h_apply_pt2_mono_delta_rho_diexc `_ Undocumented -`h_apply_pt2_mono_delta_rho_diexcorg `_ +`h_apply_pt2_mono_delta_rho_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_pt2_mono_delta_rho_diexcp `_ +`h_apply_pt2_mono_delta_rho_diexcp `_ Undocumented -`h_apply_pt2_mono_delta_rho_monoexc `_ +`h_apply_pt2_mono_delta_rho_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_pt2_mono_di_delta_rho `_ +`h_apply_pt2_mono_di_delta_rho `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_pt2_mono_di_delta_rho_diexc `_ +`h_apply_pt2_mono_di_delta_rho_diexc `_ Undocumented -`h_apply_pt2_mono_di_delta_rho_diexcorg `_ +`h_apply_pt2_mono_di_delta_rho_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_pt2_mono_di_delta_rho_diexcp `_ +`h_apply_pt2_mono_di_delta_rho_diexcp `_ Undocumented -`h_apply_pt2_mono_di_delta_rho_monoexc `_ +`h_apply_pt2_mono_di_delta_rho_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_select_mono_delta_rho `_ +`h_apply_select_mono_delta_rho `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_select_mono_delta_rho_diexc `_ +`h_apply_select_mono_delta_rho_diexc `_ Undocumented -`h_apply_select_mono_delta_rho_diexcorg `_ +`h_apply_select_mono_delta_rho_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_select_mono_delta_rho_diexcp `_ +`h_apply_select_mono_delta_rho_diexcp `_ Undocumented -`h_apply_select_mono_delta_rho_monoexc `_ +`h_apply_select_mono_delta_rho_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_select_mono_di_delta_rho `_ +`h_apply_select_mono_di_delta_rho `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_select_mono_di_delta_rho_diexc `_ +`h_apply_select_mono_di_delta_rho_diexc `_ Undocumented -`h_apply_select_mono_di_delta_rho_diexcorg `_ +`h_apply_select_mono_di_delta_rho_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_select_mono_di_delta_rho_diexcp `_ +`h_apply_select_mono_di_delta_rho_diexcp `_ Undocumented -`h_apply_select_mono_di_delta_rho_monoexc `_ +`h_apply_select_mono_di_delta_rho_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. diff --git a/plugins/MRCC_Utils/README.rst b/plugins/MRCC_Utils/README.rst index cbf32eb6..626a35a2 100644 --- a/plugins/MRCC_Utils/README.rst +++ b/plugins/MRCC_Utils/README.rst @@ -258,11 +258,11 @@ Documentation N_states lowest eigenvalues of the dressed CI matrix -`create_minilist `_ +`create_minilist `_ Undocumented -`davidson_diag_hjj_mrcc `_ +`davidson_diag_hjj_mrcc `_ Davidson diagonalization with specific diagonal elements of the H matrix .br H_jj : specific diagonal H matrix elements to diagonalize de Davidson @@ -283,7 +283,7 @@ Documentation Initial guess vectors are not necessarily orthonormal -`davidson_diag_mrcc `_ +`davidson_diag_mrcc `_ Davidson diagonalization. .br dets_in : bitmasks corresponding to determinants @@ -330,10 +330,6 @@ Documentation Dressing matrix in N_det basis -`det_inf `_ - Undocumented - - `diagonalize_ci_dressed `_ Replace the coefficients of the CI states by the coefficients of the eigenstates of the CI matrix @@ -378,7 +374,7 @@ Documentation Find A.C = B -`find_triples_and_quadruples `_ +`find_triples_and_quadruples `_ Undocumented @@ -439,7 +435,7 @@ Documentation Undocumented -`h_apply_mrcc `_ +`h_apply_mrcc `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. @@ -448,17 +444,17 @@ Documentation Undocumented -`h_apply_mrcc_diexcorg `_ +`h_apply_mrcc_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_mrcc_diexcp `_ +`h_apply_mrcc_diexcp `_ Undocumented -`h_apply_mrcc_monoexc `_ +`h_apply_mrcc_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. @@ -468,7 +464,15 @@ Documentation Dressed H with Delta_ij -`h_u_0_mrcc `_ +`h_u_0_mrcc `_ + Computes v_0 = H|u_0> + .br + n : number of determinants + .br + H_jj : array of + + +`h_u_0_mrcc_org `_ Computes v_0 = H|u_0> .br n : number of determinants @@ -773,11 +777,11 @@ Documentation n! -`mrcc_dress `_ +`mrcc_dress `_ Undocumented -`mrcc_dress_simple `_ +`mrcc_dress_simple `_ Undocumented @@ -871,7 +875,7 @@ Documentation Current status for displaying progress bars. Global variable. -`psi_ref_lock `_ +`psi_ref_lock `_ Locks on ref determinants to fill delta_ij @@ -944,10 +948,6 @@ Documentation contains the new order of the elements. -`sort_detlist `_ - Undocumented - - `start_progress `_ Starts the progress bar @@ -956,10 +956,6 @@ Documentation Stop the progress bar -`tamiser `_ - Undocumented - - `trap_signals `_ What to do when a signal is caught. Here, trap Ctrl-C and call the control_C subroutine. diff --git a/plugins/MRCC_Utils/davidson.irp.f b/plugins/MRCC_Utils/davidson.irp.f index d9e697a1..e5f16329 100644 --- a/plugins/MRCC_Utils/davidson.irp.f +++ b/plugins/MRCC_Utils/davidson.irp.f @@ -1,3 +1,6 @@ + + + subroutine davidson_diag_mrcc(dets_in,u_in,energies,dim_in,sze,N_st,Nint,iunit,istate) use bitmasks implicit none @@ -102,6 +105,9 @@ subroutine davidson_diag_hjj_mrcc(dets_in,u_in,H_jj,energies,dim_in,sze,N_st,Nin double precision :: to_print(2,N_st) double precision :: cpu, wall + integer(bit_kind) :: dets_in_sorted(Nint,2,sze) + integer :: idx(sze), shortcut(0:sze+1),sh,ii,tmp + PROVIDE det_connections call write_time(iunit) @@ -147,6 +153,9 @@ subroutine davidson_diag_hjj_mrcc(dets_in,u_in,H_jj,energies,dim_in,sze,N_st,Nin ! Initialization ! ============== + dets_in_sorted(:,:,:) = dets_in(:,:,:) + call sort_dets_ab(dets_in_sorted, idx, shortcut, sze, Nint) + k_pairs=0 do l=1,N_st do k=1,l @@ -205,7 +214,8 @@ subroutine davidson_diag_hjj_mrcc(dets_in,u_in,H_jj,energies,dim_in,sze,N_st,Nin ! ---------------------- do k=1,N_st - call H_u_0_mrcc(W(1,k,iter),U(1,k,iter),H_jj,sze,dets_in,Nint,istate) + call H_u_0_mrcc(W(1,k,iter),U(1,k,iter),H_jj,sze,dets_in_sorted,shortcut,idx,Nint,istate) + !call H_u_0_mrcc_org(W(1,k,iter),U(1,k,iter),H_jj,sze,dets_in,Nint,istate) enddo ! Compute h_kl = = @@ -357,7 +367,7 @@ subroutine davidson_diag_hjj_mrcc(dets_in,u_in,H_jj,energies,dim_in,sze,N_st,Nin abort_here = abort_all end -subroutine H_u_0_mrcc(v_0,u_0,H_jj,n,keys_tmp,Nint,istate) +subroutine H_u_0_mrcc(v_0,u_0,H_jj,n,keys_tmp,shortcut,sort_idx,Nint,istate) use bitmasks implicit none BEGIN_DOC @@ -377,6 +387,166 @@ subroutine H_u_0_mrcc(v_0,u_0,H_jj,n,keys_tmp,Nint,istate) double precision, allocatable :: vt(:) integer :: i,j,k,l, jj,ii integer :: i0, j0 + + integer,intent(in) :: shortcut(0:n+1), sort_idx(n) + integer :: tmp, warp(2,0:n+1), sh, ni +! + + ASSERT (Nint > 0) + ASSERT (Nint == N_int) + ASSERT (n>0) + PROVIDE ref_bitmask_energy delta_ij + integer, parameter :: block_size = 157 + + + !$OMP PARALLEL DEFAULT(NONE) & + !$OMP PRIVATE(i,hij,j,k,idx,jj,vt,ii,warp,tmp,sh) & + !$OMP SHARED(n_det_ref,n_det_non_ref,idx_ref,idx_non_ref,n,H_jj,u_0,keys_tmp,Nint,v_0,istate,delta_ij,shortcut,sort_idx) + + !$OMP DO SCHEDULE(static) + do i=1,n + v_0(i) = H_jj(i) * u_0(i) + enddo + !$OMP END DO + + allocate(idx(0:n), vt(n)) + Vt = 0.d0 + !$OMP DO SCHEDULE(dynamic) + do sh=1,shortcut(0) + warp(1,0) = 0 + do ii=1,sh!shortcut(0) + tmp = 0 + do ni=1,Nint + tmp = popcnt(xor(keys_tmp(ni,1, shortcut(ii)), keys_tmp(ni,1,shortcut(sh)))) + end do + if(tmp <= 4) then + tmp = warp(1,0) + 1 + warp(1,0) = tmp + warp(1,tmp) = shortcut(ii) + warp(2,tmp) = shortcut(ii+1)-1 + end if + end do + + do ii=shortcut(sh),shortcut(sh+1)-1 + idx(0) = ii + + + !call filter_connected_davidson_mwen(keys_tmp,shortcut,keys_tmp(1,1,ii),Nint,ii-1,idx) + call filter_connected_davidson_warp(keys_tmp,warp,keys_tmp(1,1,ii),Nint,ii-1,idx) + i = sort_idx(ii) + + do jj=1,idx(0) + j = sort_idx(idx(jj)) + !j = idx(jj) + if ( (dabs(u_0(j)) > 1.d-7).or.((dabs(u_0(i)) > 1.d-7)) ) then + call i_H_j(keys_tmp(1,1,idx(jj)),keys_tmp(1,1,ii),Nint,hij) + vt (i) = vt (i) + hij*u_0(j) + vt (j) = vt (j) + hij*u_0(i) + endif + enddo + enddo + enddo + !$OMP END DO + + + + !$OMP DO SCHEDULE(guided) + do ii=1,n_det_ref + i = idx_ref(ii) + do jj = 1, n_det_non_ref + j = idx_non_ref(jj) + vt (i) = vt (i) + delta_ij(ii,jj,istate)*u_0(j) + vt (j) = vt (j) + delta_ij(ii,jj,istate)*u_0(i) + enddo + enddo + !$OMP END DO + !$OMP CRITICAL + do i=1,n + v_0(i) = v_0(i) + vt(i) + enddo + !$OMP END CRITICAL + deallocate(idx,vt) + !$OMP END PARALLEL +! +! +! +! ASSERT (Nint > 0) +! ASSERT (Nint == N_int) +! ASSERT (n>0) +! PROVIDE ref_bitmask_energy delta_ij +! integer, parameter :: block_size = 157 +! !$OMP PARALLEL DEFAULT(NONE) & +! !$OMP PRIVATE(i,hij,j,k,idx,jj,ii,vt) & +! !$OMP SHARED(n_det_ref,n_det_non_ref,idx_ref,idx_non_ref,n,H_jj,u_0,keys_tmp,Nint,v_0,istate,delta_ij) +! !$OMP DO SCHEDULE(static) +! do i=1,n +! v_0(i) = H_jj(i) * u_0(i) +! enddo +! !$OMP END DO +! allocate(idx(0:n), vt(n)) +! Vt = 0.d0 +! !$OMP DO SCHEDULE(guided) +! do i=1,n +! idx(0) = i +! call filter_connected_davidson(keys_tmp,keys_tmp(1,1,i),Nint,i-1,idx) +! do jj=1,idx(0) +! j = idx(jj) +! ! if ( (dabs(u_0(j)) > 1.d-7).or.((dabs(u_0(i)) > 1.d-7)) ) then +! call i_H_j(keys_tmp(1,1,j),keys_tmp(1,1,i),Nint,hij) +! hij = hij +! vt (i) = vt (i) + hij*u_0(j) +! vt (j) = vt (j) + hij*u_0(i) +! ! endif +! enddo +! enddo +! !$OMP END DO +! +! !$OMP DO SCHEDULE(guided) +! do ii=1,n_det_ref +! i = idx_ref(ii) +! do jj = 1, n_det_non_ref +! j = idx_non_ref(jj) +! vt (i) = vt (i) + delta_ij(ii,jj,istate)*u_0(j) +! vt (j) = vt (j) + delta_ij(ii,jj,istate)*u_0(i) +! enddo +! enddo +! !$OMP END DO +! !$OMP CRITICAL +! do i=1,n +! v_0(i) = v_0(i) + vt(i) +! enddo +! !$OMP END CRITICAL +! deallocate(idx,vt) +! !$OMP END PARALLEL +end + + + +subroutine H_u_0_mrcc_org(v_0,u_0,H_jj,n,keys_tmp,Nint,istate) + use bitmasks + implicit none + BEGIN_DOC + ! Computes v_0 = H|u_0> + ! + ! n : number of determinants + ! + ! H_jj : array of + END_DOC + integer, intent(in) :: n,Nint,istate + double precision, intent(out) :: v_0(n) + double precision, intent(in) :: u_0(n) + double precision, intent(in) :: H_jj(n) + integer(bit_kind),intent(in) :: keys_tmp(Nint,2,n) + integer, allocatable :: idx(:) + double precision :: hij + double precision, allocatable :: vt(:) + integer :: i,j,k,l, jj,ii + integer :: i0, j0 + + + + + ASSERT (Nint > 0) ASSERT (Nint == N_int) ASSERT (n>0) @@ -427,4 +597,3 @@ subroutine H_u_0_mrcc(v_0,u_0,H_jj,n,keys_tmp,Nint,istate) !$OMP END PARALLEL end - diff --git a/plugins/MRCC_Utils/mrcc_dress.irp.f b/plugins/MRCC_Utils/mrcc_dress.irp.f index 3a4717ed..f427c81f 100644 --- a/plugins/MRCC_Utils/mrcc_dress.irp.f +++ b/plugins/MRCC_Utils/mrcc_dress.irp.f @@ -1,4 +1,5 @@ use omp_lib +use bitmasks BEGIN_PROVIDER [ integer(omp_lock_kind), psi_ref_lock, (psi_det_size) ] implicit none @@ -94,7 +95,6 @@ subroutine mrcc_dress(delta_ij_, delta_ii_, Ndet_ref, Ndet_non_ref,i_generator,n integer :: idx_miniList(N_det_non_ref), N_miniList - call find_triples_and_quadruples(i_generator,n_selected,det_buffer,Nint,tq,N_tq) allocate (dIa_hla(N_states,Ndet_non_ref)) @@ -285,6 +285,7 @@ subroutine find_triples_and_quadruples(i_generator,n_selected,det_buffer,Nint,tq integer, intent(out) :: N_tq integer :: c_ref integer :: connected_to_ref + N_tq = 0 do i=1,N_selected diff --git a/src/Determinants/H_apply.template.f b/src/Determinants/H_apply.template.f index 00d82996..6bc6ec99 100644 --- a/src/Determinants/H_apply.template.f +++ b/src/Determinants/H_apply.template.f @@ -1,13 +1,15 @@ -subroutine $subroutine_diexc(key_in, hole_1,particl_1, hole_2, particl_2, i_generator, iproc_in $parameters ) +subroutine $subroutine_diexc(key_in, key_prev, hole_1,particl_1, hole_2, particl_2, i_generator, iproc_in $parameters ) integer(bit_kind), intent(in) :: key_in(N_int, 2), hole_1(N_int, 2), hole_2(N_int, 2) integer(bit_kind), intent(in) :: particl_1(N_int, 2), particl_2(N_int, 2) - integer(bit_kind) :: p1_mask(N_int, 2), p2_mask(N_int, 2) + integer(bit_kind) :: p1_mask(N_int, 2), p2_mask(N_int, 2), tmp integer,intent(in) :: i_generator,iproc_in integer(bit_kind) :: status(N_int*bit_kind_size, 2) - integer :: highest, p1,p2,sp,ni,i,mi + integer :: highest, p1,p2,sp,ni,i,mi,nt,ns + + integer(bit_kind), intent(in) :: key_prev(N_int, 2, *) $declarations @@ -29,6 +31,32 @@ subroutine $subroutine_diexc(key_in, hole_1,particl_1, hole_2, particl_2, i_gene end do end do +! GEL D'ELECTRONS +! nt = 0 +! do i=1,i_generator-1 +! if(key_in(1,1) == key_prev(1,1,i)) then +! tmp = xor(key_in(1,2), key_prev(1,2,i)) +! if(popcnt(tmp) == 2) then +! ns = 1+trailz(iand(tmp, key_in(1,2))) +! if(status(ns, 2) /= 0) then +! nt += 1 +! end if +! status(ns, 2) = 0 +! end if +! else if(key_in(1,2) == key_prev(1,2,i)) then +! tmp = xor(key_in(1,1), key_prev(1,1,i)) +! if(popcnt(tmp) == 2) then +! ns = 1+trailz(iand(tmp, key_in(1,1))) +! if(status(ns, 1) /= 0) then +! nt += 1 +! end if +! status(ns, 1) = 0 +! end if +! end if +! end do +! print *, "nt", nt, i_generator + + do sp=1,2 do p1=1,highest if(status(p1, sp) == 0) then @@ -76,35 +104,12 @@ subroutine $subroutine_diexcP(key_in, fs1, fh1, particl_1, fs2, fh2, particl_2, p1_mask(:,:) = 0 p2_mask(:,:) = 0 - p1_mask(fh1/bit_kind_size + 1, fs1) = 2**(mod(fh1-1,bit_kind_size)) - p2_mask(fh2/bit_kind_size + 1, fs2) = 2**(mod(fh2-1,bit_kind_size)) + p1_mask(ishft(fh1,-bit_kind_shift) + 1, fs1) = ishft(1,iand(fh1-1,bit_kind_size-1)) + p2_mask(ishft(fh2,-bit_kind_shift) + 1, fs2) = ishft(1,iand(fh2-1,bit_kind_size-1)) -! n_alpha = 0 -! n_beta = 0 key_mask(:,:) = key_in(:,:) - key_mask(fh1/bit_kind_size + 1, fs1) -= 2**(mod(fh1-1,bit_kind_size)) - key_mask(fh2/bit_kind_size + 1, fs2) -= 2**(mod(fh2-1,bit_kind_size)) -! -! do i=1,N_int -! n_alpha = n_alpha + popcnt(key_mask(i, 1)) -! n_beta = n_beta + popcnt(key_mask(i, 2)) -! end do -! -! do i=1, N_det -! deg(1) = n_alpha -! deg(2) = n_beta -! -! do ni = 1, N_int -! ! deg(1) = deg(1) - popcnt(iand(key_mask(ni, 1), psi_non_ref(ni, 1, i))) -! ! deg(2) = deg(2) - popcnt(iand(key_mask(ni, 2), psi_non_ref(ni, 2, i))) -! end do -! -! -! if(deg(1) + deg(2) <= 2) then -! ! ndet_out = ndet_out + 1 -! ! idx(ndet_out) = i -! end if -! end do + key_mask(ishft(fh1,-bit_kind_shift) + 1, fs1) -= ishft(1,iand(fh1-1,bit_kind_size-1)) + key_mask(ishft(fh2,-bit_kind_shift) + 1, fs2) -= ishft(1,iand(fh2-1,bit_kind_size-1)) call $subroutine_diexcOrg(key_in, key_mask, p1_mask, particl_1, p2_mask, particl_2, i_generator, iproc_in $parameters ) end subroutine @@ -529,7 +534,6 @@ subroutine $subroutine($params_main) nmax = mod( N_det_generators,nproc ) - !$ call omp_init_lock(lck) call start_progress(N_det_generators,'Selection (norm)',0.d0) @@ -572,6 +576,7 @@ subroutine $subroutine($params_main) enddo if($do_double_excitations)then call $subroutine_diexc(psi_det_generators(1,1,i_generator), & + psi_det_generators(1,1,1), & mask(1,1,d_hole1), mask(1,1,d_part1), & mask(1,1,d_hole2), mask(1,1,d_part2), & i_generator, iproc $params_post) @@ -632,6 +637,7 @@ subroutine $subroutine($params_main) if($do_double_excitations)then call $subroutine_diexc(psi_det_generators(1,1,i_generator), & + psi_det_generators(1,1,1), & mask(1,1,d_hole1), mask(1,1,d_part1), & mask(1,1,d_hole2), mask(1,1,d_part2), & i_generator, iproc $params_post) diff --git a/src/Determinants/README.rst b/src/Determinants/README.rst index 8d1a9e4d..64e24f00 100644 --- a/src/Determinants/README.rst +++ b/src/Determinants/README.rst @@ -54,7 +54,7 @@ Documentation .. by the `update_README.py` script. -`a_operator `_ +`a_operator `_ Needed for diag_H_mat_elem @@ -66,7 +66,7 @@ Documentation Max and min values of the coefficients -`ac_operator `_ +`ac_operator `_ Needed for diag_H_mat_elem @@ -157,11 +157,11 @@ Documentation of alpha and beta determinants -`davidson_converged `_ +`davidson_converged `_ True if the Davidson algorithm is converged -`davidson_criterion `_ +`davidson_criterion `_ Can be : [ energy | residual | both | wall_time | cpu_time | iterations ] @@ -184,7 +184,7 @@ Documentation Initial guess vectors are not necessarily orthonormal -`davidson_diag_hjj `_ +`davidson_diag_hjj `_ Davidson diagonalization with specific diagonal elements of the H matrix .br H_jj : specific diagonal H matrix elements to diagonalize de Davidson @@ -213,7 +213,7 @@ Documentation Max number of Davidson sizes -`davidson_threshold `_ +`davidson_threshold `_ Can be : [ energy | residual | both | wall_time | cpu_time | iterations ] @@ -229,10 +229,14 @@ Documentation det_coef -`det_connections `_ +`det_connections `_ Build connection proxy between determinants +`det_inf `_ + Undocumented + + `det_num `_ det_num @@ -253,7 +257,7 @@ Documentation Diagonalization algorithm (Davidson or Lapack) -`diag_h_mat_elem `_ +`diag_h_mat_elem `_ Computes @@ -313,7 +317,7 @@ Documentation idx(0) is the number of determinants that interact with key1 -`filter_connected_davidson `_ +`filter_connected_davidson `_ Filters out the determinants that are not connected by H returns the array idx which contains the index of the determinants in the array key1 that interact @@ -323,7 +327,27 @@ Documentation key1 should come from psi_det_sorted_ab. -`filter_connected_i_h_psi0 `_ +`filter_connected_davidson_shortcut `_ + Filters out the determinants that are not connected by H + returns the array idx which contains the index of the + determinants in the array key1 that interact + via the H operator with key2. + .br + idx(0) is the number of determinants that interact with key1 + key1 should come from psi_det_sorted_ab. + + +`filter_connected_davidson_warp `_ + Filters out the determinants that are not connected by H + returns the array idx which contains the index of the + determinants in the array key1 that interact + via the H operator with key2. + .br + idx(0) is the number of determinants that interact with key1 + key1 should come from psi_det_sorted_ab. + + +`filter_connected_i_h_psi0 `_ returns the array idx which contains the index of the .br determinants in the array key1 that interact @@ -333,7 +357,7 @@ Documentation idx(0) is the number of determinants that interact with key1 -`filter_connected_i_h_psi0_sc2 `_ +`filter_connected_i_h_psi0_sc2 `_ standard filter_connected_i_H_psi but returns in addition .br the array of the index of the non connected determinants to key1 @@ -359,7 +383,7 @@ Documentation Create a wave function from all possible alpha x beta determinants -`get_double_excitation `_ +`get_double_excitation `_ Returns the two excitation operators between two doubly excited determinants and the phase @@ -371,7 +395,7 @@ Documentation Returns the excitation degree between two determinants -`get_excitation_degree_vector `_ +`get_excitation_degree_vector `_ Applies get_excitation_degree to an array of determinants @@ -387,11 +411,11 @@ Documentation Returns the index of the determinant in the ``psi_det_sorted_bit`` array -`get_mono_excitation `_ +`get_mono_excitation `_ Returns the excitation operator between two singly excited determinants and the phase -`get_occ_from_key `_ +`get_occ_from_key `_ Returns a list of occupation numbers from a bitstring @@ -425,7 +449,7 @@ Documentation Undocumented -`h_u_0 `_ +`h_u_0 `_ Computes v_0 = H|u_0> .br n : number of determinants @@ -433,23 +457,23 @@ Documentation H_jj : array of -`i_h_j `_ +`i_h_j `_ Returns where i and j are determinants -`i_h_j_phase_out `_ +`i_h_j_phase_out `_ Returns where i and j are determinants -`i_h_j_verbose `_ +`i_h_j_verbose `_ Returns where i and j are determinants -`i_h_psi `_ +`i_h_psi `_ for the various Nstates -`i_h_psi_sc2 `_ +`i_h_psi_sc2 `_ for the various Nstate .br returns in addition @@ -463,7 +487,7 @@ Documentation to repeat the excitations -`i_h_psi_sc2_verbose `_ +`i_h_psi_sc2_verbose `_ for the various Nstate .br returns in addition @@ -477,7 +501,7 @@ Documentation to repeat the excitations -`i_h_psi_sec_ord `_ +`i_h_psi_sec_ord `_ for the various Nstates @@ -524,7 +548,7 @@ Documentation Energy of the reference bitmask used in Slater rules -`n_con_int `_ +`n_con_int `_ Number of integers to represent the connections between determinants @@ -889,6 +913,10 @@ Documentation for a given couple of hole/particle excitations i. +`sort_dets_ab `_ + Undocumented + + `sort_dets_by_3_highest_electrons `_ Determinants on which we apply . They are sorted by the 3 highest electrons in the alpha part, @@ -910,6 +938,10 @@ Documentation Weights in the state-average calculation of the density matrix +`tamiser `_ + Undocumented + + `threshold_convergence_sc2 `_ convergence of the correlation energy of SC2 iterations diff --git a/src/Determinants/davidson.irp.f b/src/Determinants/davidson.irp.f index 0c5610ae..29223c61 100644 --- a/src/Determinants/davidson.irp.f +++ b/src/Determinants/davidson.irp.f @@ -65,6 +65,106 @@ subroutine davidson_diag(dets_in,u_in,energies,dim_in,sze,N_st,Nint,iunit) deallocate (H_jj) end + +logical function det_inf(key1, key2, Nint) + use bitmasks + implicit none + integer(bit_kind),intent(in) :: key1(Nint, 2), key2(Nint, 2) + integer,intent(in) :: Nint + integer :: i,j + + det_inf = .false. + + do i=1,2 + do j=Nint,1,-1 + if(key1(j,i) < key2(j,i)) then + det_inf = .true. + return + else if(key1(j,i) > key2(j,i)) then + return + end if + end do + end do +end function + + +subroutine tamiser(key, idx, no, n, Nint, N_key) + use bitmasks + + implicit none + integer(bit_kind),intent(inout) :: key(Nint, 2, N_key) + integer,intent(in) :: no, n, Nint, N_key + integer,intent(inout) :: idx(N_key) + integer :: k,j,tmpidx + integer(bit_kind) :: tmp(Nint, 2) + logical :: det_inf + + k = no + j = 2*k + do while(j <= n) + if(j < n .and. det_inf(key(:,:,j), key(:,:,j+1), Nint)) then + j = j+1 + end if + if(det_inf(key(:,:,k), key(:,:,j), Nint)) then + tmp(:,:) = key(:,:,k) + key(:,:,k) = key(:,:,j) + key(:,:,j) = tmp(:,:) + tmpidx = idx(k) + idx(k) = idx(j) + idx(j) = tmpidx + k = j + j = 2*k + else + return + end if + end do +end subroutine + + +subroutine sort_dets_ab(key, idx, shortcut, N_key, Nint) + use bitmasks + implicit none + + integer(bit_kind),intent(inout) :: key(Nint,2,N_key) + integer,intent(out) :: idx(N_key) + integer,intent(out) :: shortcut(0:N_key+1) + integer, intent(in) :: Nint, N_key + integer(bit_kind) :: tmp(Nint, 2) + integer :: tmpidx,i,ni + + do i=1,N_key + idx(i) = i + end do + + do i=N_key/2,1,-1 + call tamiser(key, idx, i, N_key, Nint, N_key) + end do + + do i=N_key,2,-1 + tmp(:,:) = key(:,:,i) + key(:,:,i) = key(:,:,1) + key(:,:,1) = tmp(:,:) + tmpidx = idx(i) + idx(i) = idx(1) + idx(1) = tmpidx + call tamiser(key, idx, 1, i-1, Nint, N_key) + end do + + shortcut(0) = 1 + shortcut(1) = 1 + do i=2,N_key + do ni=1,nint + if(key(ni,1,i) /= key(ni,1,i-1)) then + shortcut(0) = shortcut(0) + 1 + shortcut(shortcut(0)) = i + exit + end if + end do + end do + shortcut(shortcut(0)+1) = N_key+1 +end subroutine + + subroutine davidson_diag_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,N_st,Nint,iunit) use bitmasks implicit none @@ -106,7 +206,7 @@ subroutine davidson_diag_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,N_st,Nint,iun integer :: k_pairs, kl integer :: iter2 - double precision, allocatable :: W(:,:,:), U(:,:,:), R(:,:) + double precision, allocatable :: W(:,:,:), U(:,:,:), R(:,:), Wt(:) double precision, allocatable :: y(:,:,:,:), h(:,:,:,:), lambda(:) double precision :: diag_h_mat_elem double precision :: residual_norm(N_st) @@ -114,6 +214,9 @@ subroutine davidson_diag_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,N_st,Nint,iun double precision :: to_print(2,N_st) double precision :: cpu, wall + integer(bit_kind) :: dets_in_sorted(Nint, 2, sze) + integer :: idx(sze), shortcut(0:sze+1) + PROVIDE det_connections call write_time(iunit) @@ -145,6 +248,7 @@ subroutine davidson_diag_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,N_st,Nint,iun allocate( & kl_pairs(2,N_st*(N_st+1)/2), & W(sze,N_st,davidson_sze_max), & + Wt(sze), & U(sze,N_st,davidson_sze_max), & R(sze,N_st), & h(N_st,davidson_sze_max,N_st,davidson_sze_max), & @@ -159,6 +263,9 @@ subroutine davidson_diag_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,N_st,Nint,iun ! Initialization ! ============== + dets_in_sorted(:,:,:) = dets_in(:,:,:) + call sort_dets_ab(dets_in_sorted, idx, shortcut, sze, Nint) + k_pairs=0 do l=1,N_st do k=1,l @@ -170,7 +277,7 @@ subroutine davidson_diag_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,N_st,Nint,iun !$OMP PARALLEL DEFAULT(NONE) & !$OMP SHARED(U,sze,N_st,overlap,kl_pairs,k_pairs, & - !$OMP Nint,dets_in,u_in) & + !$OMP Nint,dets_in_sorted,dets_in,u_in) & !$OMP PRIVATE(k,l,kl,i) @@ -217,9 +324,10 @@ subroutine davidson_diag_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,N_st,Nint,iun ! ---------------------- do k=1,N_st - call H_u_0(W(1,k,iter),U(1,k,iter),H_jj,sze,dets_in,Nint) + call H_u_0(W(1,k,iter),U(1,k,iter),H_jj,sze,dets_in_sorted,shortcut,idx,Nint) enddo + ! Compute h_kl = = ! ------------------------------------------- @@ -274,7 +382,7 @@ subroutine davidson_diag_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,N_st,Nint,iun to_print(1,k) = lambda(k) + nuclear_repulsion to_print(2,k) = residual_norm(k) enddo - + write(iunit,'(X,I3,X,100(X,F16.10,X,E16.6))'), iter, to_print(:,1:N_st) call davidson_converged(lambda,residual_norm,wall,iter,cpu,N_st,converged) if (converged) then @@ -360,6 +468,7 @@ subroutine davidson_diag_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,N_st,Nint,iun deallocate ( & kl_pairs, & W, & + Wt, & U, & R, & h, & diff --git a/src/Determinants/filter_connected.irp.f b/src/Determinants/filter_connected.irp.f index c3d333ad..574da28e 100644 --- a/src/Determinants/filter_connected.irp.f +++ b/src/Determinants/filter_connected.irp.f @@ -158,7 +158,162 @@ subroutine filter_connected_sorted_ab(key1,key2,next,Nint,sze,idx) end +subroutine filter_connected_davidson_warp(key1,warp,key2,Nint,sze,idx) + use bitmasks + implicit none + BEGIN_DOC + ! Filters out the determinants that are not connected by H + ! returns the array idx which contains the index of the + ! determinants in the array key1 that interact + ! via the H operator with key2. + ! + ! idx(0) is the number of determinants that interact with key1 + ! key1 should come from psi_det_sorted_ab. + END_DOC + integer, intent(in) :: Nint, sze + integer(bit_kind), intent(in) :: key1(Nint,2,sze) + integer(bit_kind), intent(in) :: key2(Nint,2) + integer, intent(out) :: idx(0:sze) + + integer,intent(in) :: warp(2,0:sze+1) + + integer :: i,j,k,l + integer :: degree_x2 + integer :: i_alpha, i_beta, exc_a, exc_b, endloop, ni + integer(bit_kind) :: tmp1, tmp2 + + ASSERT (Nint > 0) + ASSERT (sze >= 0) + l=1 + i_alpha = 0 + + + if (Nint /= 1) then + do while(i_alpha < warp(1,0) .and. warp(1,i_alpha+1) <= sze) + i_alpha = i_alpha + 1 + exc_a = 0 + do ni=1,Nint + exc_a += popcnt(xor(key1(ni,1,warp(1,i_alpha)), key2(ni,1))) + end do + endloop = min(warp(2,i_alpha), sze) + if(exc_a == 4) then + do i_beta=warp(1,i_alpha),endloop + do ni=1,Nint + if(key1(ni,2,i_beta) /= key2(ni,2)) then + exit + else if(ni == Nint) then + idx(l) = i_beta + l = l + 1 + end if + end do + end do + else + do i_beta=warp(1,i_alpha),endloop + exc_b = 0 + do ni=1,Nint + exc_b += popcnt(xor(key1(ni,2,i_beta), key2(ni,2))) + end do + if(exc_b + exc_a <= 4) then + idx(l) = i_beta + l = l + 1 + end if + end do + end if + end do + else + do while(i_alpha < warp(1,0) .and. warp(1,i_alpha+1) <= sze) + i_alpha = i_alpha + 1 + exc_a = popcnt(xor(key1(1,1,warp(1,i_alpha)), key2(1,1))) + endloop = min(warp(2,i_alpha), sze) + if(exc_a == 4) then + do i_beta=warp(1,i_alpha),endloop + if(key1(1,2,i_beta) == key2(1,2)) then + idx(l) = i_beta + l = l + 1 + exit + end if + end do + else + do i_beta=warp(1,i_alpha),endloop + exc_b = popcnt(xor(key1(1,2,i_beta), key2(1,2))) + if(exc_b + exc_a <= 4) then + idx(l) = i_beta + l = l + 1 + end if + end do + end if + end do + end if + + idx(0) = l-1 +end + + +subroutine filter_connected_davidson_shortcut(key1,shortcut,key2,Nint,sze,idx) + use bitmasks + implicit none + BEGIN_DOC + ! Filters out the determinants that are not connected by H + ! returns the array idx which contains the index of the + ! determinants in the array key1 that interact + ! via the H operator with key2. + ! + ! idx(0) is the number of determinants that interact with key1 + ! key1 should come from psi_det_sorted_ab. + END_DOC + integer, intent(in) :: Nint, sze + integer(bit_kind), intent(in) :: key1(Nint,2,sze) + integer(bit_kind), intent(in) :: key2(Nint,2) + integer, intent(out) :: idx(0:sze) + + integer,intent(in) :: shortcut(0:sze+1) + + integer :: i,j,k,l + integer :: degree_x2 + integer :: i_alpha, i_beta, exc_a, exc_b, endloop + integer(bit_kind) :: tmp1, tmp2 + + ASSERT (Nint > 0) + ASSERT (sze >= 0) + + l=1 + i_alpha = 0 + + if (Nint==1) then + do while(shortcut(i_alpha+1) < sze) + i_alpha = i_alpha + 1 + !print *, i_alpha, shortcut(i_alpha), sze + exc_a = popcnt(xor(key1(1,1,shortcut(i_alpha)), key2(1,1))) + if(exc_a > 4) then + cycle + end if + endloop = min(shortcut(i_alpha+1)-1, sze) + if(exc_a == 4) then + do i_beta = shortcut(i_alpha), endloop + if(key1(1,2,i_beta) == key2(1,2)) then + idx(l) = i_beta + l = l + 1 + exit + end if + end do + else + do i_beta = shortcut(i_alpha), endloop + exc_b = popcnt(xor(key1(1,2,i_beta), key2(1,2))) + if(exc_b + exc_a <= 4) then + idx(l) = i_beta + l = l + 1 + end if + end do + end if + end do + else + print *, "TBD : filter_connected_davidson_shortcut Nint>1" + stop + end if + + idx(0) = l-1 +end subroutine filter_connected_davidson(key1,key2,Nint,sze,idx) use bitmasks @@ -190,7 +345,7 @@ subroutine filter_connected_davidson(key1,key2,Nint,sze,idx) if (Nint==1) then - i = idx(0) + i = idx(0) ! lecture dans un intent(out) ? do j_int=1,N_con_int itmp = det_connections(j_int,i) do while (itmp /= 0_8) diff --git a/src/Determinants/slater_rules.irp.f b/src/Determinants/slater_rules.irp.f index 40d65562..097ea6ed 100644 --- a/src/Determinants/slater_rules.irp.f +++ b/src/Determinants/slater_rules.irp.f @@ -138,6 +138,52 @@ subroutine decode_exc(exc,degree,h1,p1,h2,p2,s1,s2) end select end +! +! subroutine get_double_excitation(det1, det2, exc, phase, Nint) +! integer, intent(in) :: Nint +! integer(bit_kind), intent(in) :: det1(Nint,2) +! integer(bit_kind), intent(in) :: det2(Nint,2) +! integer, intent(out) :: exc(0:2,2,2) +! double precision, intent(out) :: phase +! +! integer(bit_kind) :: detp, deth, detp_f, deth_f, tmp +! integer :: i,sp,hole_fnd +! +! fi(:) = 0 +! fs(:) = 0 +! fn = 0 +! detp = 0 +! deth = 0 +! tmp = 0 +! deth_f = 0 +! detp_f = 0 +! do sp=1,2 +! do i=1,Nint +! tmp = xor(det1(i,sp), det2(i,sp)) +! if(tmp == 0) then +! cycle +! end if +! detp = iand(det2(i,sp), tmp) +! deth = iand(det1(i,sp), tmp) +! +! detp_f = ior(detp_f, detp) +! deth_f = ior(deth_f, deth) +! +! if(detp /= 0) then +! fn = fn + 1 +! fs(fn) = sp +! fi(fn) = i +! end if +! end do +! end do +! if(fn /= 2) then +! print *, "WHUUUUT??" +! stop 1 +! end if +! +! end subroutine + + subroutine get_double_excitation(det1,det2,exc,phase,Nint) use bitmasks implicit none @@ -1215,7 +1261,7 @@ subroutine get_occ_from_key(key,occ,Nint) end -subroutine H_u_0(v_0,u_0,H_jj,n,keys_tmp,Nint) +subroutine H_u_0(v_0,u_0,H_jj,n,keys_tmp,shortcut,sort_idx,Nint) use bitmasks implicit none BEGIN_DOC @@ -1233,29 +1279,55 @@ subroutine H_u_0(v_0,u_0,H_jj,n,keys_tmp,Nint) integer, allocatable :: idx(:) double precision :: hij double precision, allocatable :: vt(:) - integer :: i,j,k,l, jj + integer :: i,j,k,l, jj,ii,sh integer :: i0, j0 + + integer,intent(in) :: shortcut(0:n+1), sort_idx(n) + integer :: tmp, warp(2,0:n+1), ni + + ASSERT (Nint > 0) ASSERT (Nint == N_int) ASSERT (n>0) PROVIDE ref_bitmask_energy !$OMP PARALLEL DEFAULT(NONE) & - !$OMP PRIVATE(i,hij,j,k,idx,jj,vt) & - !$OMP SHARED(n,H_jj,u_0,keys_tmp,Nint,v_0,davidson_threshold) + !$OMP PRIVATE(i,hij,j,k,idx,jj,vt,ii,warp,tmp,sh) & + !$OMP SHARED(n,H_jj,u_0,keys_tmp,Nint,v_0,davidson_threshold,shortcut,sort_idx) allocate(idx(0:n), vt(n)) Vt = 0.d0 v_0 = 0.d0 !$OMP DO SCHEDULE(guided) - do i=1,n - idx(0) = i - call filter_connected_davidson(keys_tmp,keys_tmp(1,1,i),Nint,i-1,idx) - do jj=1,idx(0) - j = idx(jj) - if ( dabs(u_0(j)) + dabs(u_0(i)) > davidson_threshold ) then - call i_H_j(keys_tmp(1,1,j),keys_tmp(1,1,i),Nint,hij) - vt (i) = vt (i) + hij*u_0(j) - vt (j) = vt (j) + hij*u_0(i) - endif + + + do sh=1,shortcut(0) + warp(1,0) = 0 + do ii=1,sh!shortcut(0) + tmp = 0 + do ni=1,Nint + tmp = popcnt(xor(keys_tmp(ni,1, shortcut(ii)), keys_tmp(ni,1,shortcut(sh)))) + end do + if(tmp <= 4) then + warp(1,0) = warp(1,0) + 1 + warp(1,warp(1,0)) = shortcut(ii) + warp(2,warp(1,0)) = shortcut(ii+1)-1 + end if + end do + + + do ii=shortcut(sh),shortcut(sh+1)-1 + idx(0) = ii + + call filter_connected_davidson_warp(keys_tmp,warp,keys_tmp(1,1,ii),Nint,ii-1,idx) + i = sort_idx(ii) + + do jj=1,idx(0) + j = sort_idx(idx(jj)) + if ( dabs(u_0(j)) + dabs(u_0(i)) > davidson_threshold ) then + call i_H_j(keys_tmp(1,1,idx(jj)),keys_tmp(1,1,ii),Nint,hij) + vt (i) = vt (i) + hij*u_0(j) + vt (j) = vt (j) + hij*u_0(i) + endif + enddo enddo enddo !$OMP END DO @@ -1267,7 +1339,7 @@ subroutine H_u_0(v_0,u_0,H_jj,n,keys_tmp,Nint) deallocate(idx,vt) !$OMP END PARALLEL do i=1,n - v_0(i) += H_jj(i) * u_0(i) + v_0(i) += H_jj(i) * u_0(i) enddo end From 9186be8c5657ac0ee386047c88500f1dfca33ded Mon Sep 17 00:00:00 2001 From: Yann Garniron Date: Thu, 22 Oct 2015 11:10:20 +0200 Subject: [PATCH 09/20] tri alpha/beta simple pour filter_connected_davidson --- plugins/MRCC_Utils/davidson.irp.f | 52 +---------- src/Determinants/davidson.irp.f | 1 + src/Determinants/filter_connected.irp.f | 13 ++- src/Determinants/slater_rules.irp.f | 115 ++++++++++++++---------- 4 files changed, 77 insertions(+), 104 deletions(-) diff --git a/plugins/MRCC_Utils/davidson.irp.f b/plugins/MRCC_Utils/davidson.irp.f index e5f16329..2fa09575 100644 --- a/plugins/MRCC_Utils/davidson.irp.f +++ b/plugins/MRCC_Utils/davidson.irp.f @@ -153,6 +153,7 @@ subroutine davidson_diag_hjj_mrcc(dets_in,u_in,H_jj,energies,dim_in,sze,N_st,Nin ! Initialization ! ============== + dets_in_sorted(:,:,:) = dets_in(:,:,:) call sort_dets_ab(dets_in_sorted, idx, shortcut, sze, Nint) @@ -467,57 +468,6 @@ subroutine H_u_0_mrcc(v_0,u_0,H_jj,n,keys_tmp,shortcut,sort_idx,Nint,istate) !$OMP END CRITICAL deallocate(idx,vt) !$OMP END PARALLEL -! -! -! -! ASSERT (Nint > 0) -! ASSERT (Nint == N_int) -! ASSERT (n>0) -! PROVIDE ref_bitmask_energy delta_ij -! integer, parameter :: block_size = 157 -! !$OMP PARALLEL DEFAULT(NONE) & -! !$OMP PRIVATE(i,hij,j,k,idx,jj,ii,vt) & -! !$OMP SHARED(n_det_ref,n_det_non_ref,idx_ref,idx_non_ref,n,H_jj,u_0,keys_tmp,Nint,v_0,istate,delta_ij) -! !$OMP DO SCHEDULE(static) -! do i=1,n -! v_0(i) = H_jj(i) * u_0(i) -! enddo -! !$OMP END DO -! allocate(idx(0:n), vt(n)) -! Vt = 0.d0 -! !$OMP DO SCHEDULE(guided) -! do i=1,n -! idx(0) = i -! call filter_connected_davidson(keys_tmp,keys_tmp(1,1,i),Nint,i-1,idx) -! do jj=1,idx(0) -! j = idx(jj) -! ! if ( (dabs(u_0(j)) > 1.d-7).or.((dabs(u_0(i)) > 1.d-7)) ) then -! call i_H_j(keys_tmp(1,1,j),keys_tmp(1,1,i),Nint,hij) -! hij = hij -! vt (i) = vt (i) + hij*u_0(j) -! vt (j) = vt (j) + hij*u_0(i) -! ! endif -! enddo -! enddo -! !$OMP END DO -! -! !$OMP DO SCHEDULE(guided) -! do ii=1,n_det_ref -! i = idx_ref(ii) -! do jj = 1, n_det_non_ref -! j = idx_non_ref(jj) -! vt (i) = vt (i) + delta_ij(ii,jj,istate)*u_0(j) -! vt (j) = vt (j) + delta_ij(ii,jj,istate)*u_0(i) -! enddo -! enddo -! !$OMP END DO -! !$OMP CRITICAL -! do i=1,n -! v_0(i) = v_0(i) + vt(i) -! enddo -! !$OMP END CRITICAL -! deallocate(idx,vt) -! !$OMP END PARALLEL end diff --git a/src/Determinants/davidson.irp.f b/src/Determinants/davidson.irp.f index 29223c61..626ecec3 100644 --- a/src/Determinants/davidson.irp.f +++ b/src/Determinants/davidson.irp.f @@ -324,6 +324,7 @@ subroutine davidson_diag_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,N_st,Nint,iun ! ---------------------- do k=1,N_st +! call H_u_0_org(W(1,k,iter),U(1,k,iter),H_jj,sze,dets_in,Nint) call H_u_0(W(1,k,iter),U(1,k,iter),H_jj,sze,dets_in_sorted,shortcut,idx,Nint) enddo diff --git a/src/Determinants/filter_connected.irp.f b/src/Determinants/filter_connected.irp.f index 574da28e..f55643bd 100644 --- a/src/Determinants/filter_connected.irp.f +++ b/src/Determinants/filter_connected.irp.f @@ -198,16 +198,15 @@ subroutine filter_connected_davidson_warp(key1,warp,key2,Nint,sze,idx) end do endloop = min(warp(2,i_alpha), sze) if(exc_a == 4) then - do i_beta=warp(1,i_alpha),endloop + beta_loop : do i_beta=warp(1,i_alpha),endloop do ni=1,Nint if(key1(ni,2,i_beta) /= key2(ni,2)) then - exit - else if(ni == Nint) then - idx(l) = i_beta - l = l + 1 + cycle beta_loop end if end do - end do + idx(l) = i_beta + l = l + 1 + end do beta_loop else do i_beta=warp(1,i_alpha),endloop exc_b = 0 @@ -283,7 +282,6 @@ subroutine filter_connected_davidson_shortcut(key1,shortcut,key2,Nint,sze,idx) if (Nint==1) then do while(shortcut(i_alpha+1) < sze) i_alpha = i_alpha + 1 - !print *, i_alpha, shortcut(i_alpha), sze exc_a = popcnt(xor(key1(1,1,shortcut(i_alpha)), key2(1,1))) if(exc_a > 4) then cycle @@ -338,6 +336,7 @@ subroutine filter_connected_davidson(key1,key2,Nint,sze,idx) integer*8 :: itmp PROVIDE N_con_int det_connections + ASSERT (Nint > 0) ASSERT (sze >= 0) diff --git a/src/Determinants/slater_rules.irp.f b/src/Determinants/slater_rules.irp.f index 097ea6ed..08c65ddf 100644 --- a/src/Determinants/slater_rules.irp.f +++ b/src/Determinants/slater_rules.irp.f @@ -138,51 +138,6 @@ subroutine decode_exc(exc,degree,h1,p1,h2,p2,s1,s2) end select end -! -! subroutine get_double_excitation(det1, det2, exc, phase, Nint) -! integer, intent(in) :: Nint -! integer(bit_kind), intent(in) :: det1(Nint,2) -! integer(bit_kind), intent(in) :: det2(Nint,2) -! integer, intent(out) :: exc(0:2,2,2) -! double precision, intent(out) :: phase -! -! integer(bit_kind) :: detp, deth, detp_f, deth_f, tmp -! integer :: i,sp,hole_fnd -! -! fi(:) = 0 -! fs(:) = 0 -! fn = 0 -! detp = 0 -! deth = 0 -! tmp = 0 -! deth_f = 0 -! detp_f = 0 -! do sp=1,2 -! do i=1,Nint -! tmp = xor(det1(i,sp), det2(i,sp)) -! if(tmp == 0) then -! cycle -! end if -! detp = iand(det2(i,sp), tmp) -! deth = iand(det1(i,sp), tmp) -! -! detp_f = ior(detp_f, detp) -! deth_f = ior(deth_f, deth) -! -! if(detp /= 0) then -! fn = fn + 1 -! fs(fn) = sp -! fi(fn) = i -! end if -! end do -! end do -! if(fn /= 2) then -! print *, "WHUUUUT??" -! stop 1 -! end if -! -! end subroutine - subroutine get_double_excitation(det1,det2,exc,phase,Nint) use bitmasks @@ -1296,7 +1251,7 @@ subroutine H_u_0(v_0,u_0,H_jj,n,keys_tmp,shortcut,sort_idx,Nint) allocate(idx(0:n), vt(n)) Vt = 0.d0 v_0 = 0.d0 - !$OMP DO SCHEDULE(guided) + !$OMP DO SCHEDULE(dynamic) do sh=1,shortcut(0) @@ -1344,6 +1299,74 @@ subroutine H_u_0(v_0,u_0,H_jj,n,keys_tmp,shortcut,sort_idx,Nint) end +subroutine H_u_0_org(v_0,u_0,H_jj,n,keys_tmp,Nint) + use bitmasks + implicit none + BEGIN_DOC + ! Computes v_0 = H|u_0> + ! + ! n : number of determinants + ! + ! H_jj : array of + END_DOC + integer, intent(in) :: n,Nint + double precision, intent(out) :: v_0(n) + double precision, intent(in) :: u_0(n) + double precision, intent(in) :: H_jj(n) + integer(bit_kind),intent(in) :: keys_tmp(Nint,2,n) + integer, allocatable :: idx(:) + double precision :: hij + double precision, allocatable :: vt(:) + integer :: i,j,k,l, jj,ii,sh + integer :: i0, j0 + + + + ASSERT (Nint > 0) + ASSERT (Nint == N_int) + ASSERT (n>0) + PROVIDE ref_bitmask_energy + !$OMP PARALLEL DEFAULT(NONE) & + !$OMP PRIVATE(i,hij,j,k,idx,jj,vt,ii) & + !$OMP SHARED(n,H_jj,u_0,keys_tmp,Nint,v_0,davidson_threshold) + allocate(idx(0:n), vt(n)) + Vt = 0.d0 + v_0 = 0.d0 + !$OMP DO SCHEDULE(guided) + + + + + + do ii=1,n + idx(0) = ii + i = ii + call filter_connected_davidson(keys_tmp,keys_tmp(1,1,ii),Nint,ii-1,idx) + + do jj=1,idx(0) + j = idx(jj) + if ( dabs(u_0(j)) + dabs(u_0(i)) > davidson_threshold ) then + call i_H_j(keys_tmp(1,1,idx(jj)),keys_tmp(1,1,ii),Nint,hij) + vt (i) = vt (i) + hij*u_0(j) + vt (j) = vt (j) + hij*u_0(i) + endif + enddo + enddo + + !$OMP END DO + !$OMP CRITICAL + do i=1,n + v_0(i) = v_0(i) + vt(i) + enddo + !$OMP END CRITICAL + deallocate(idx,vt) + !$OMP END PARALLEL + do i=1,n + v_0(i) += H_jj(i) * u_0(i) + enddo +end + + BEGIN_PROVIDER [ integer, N_con_int ] implicit none From 47cc54f668b52b3bc857556fa83e4d7b6c5c1c59 Mon Sep 17 00:00:00 2001 From: Yann Garniron Date: Thu, 22 Oct 2015 11:24:04 +0200 Subject: [PATCH 10/20] filter_connected_davidson sans proxy --- .gitignore | 3 +- plugins/MRCC_Utils/README.rst | 4 +- src/Determinants/README.rst | 82 ++++++++++------------------------- 3 files changed, 26 insertions(+), 63 deletions(-) diff --git a/.gitignore b/.gitignore index 1f8223f8..9d79d718 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,4 @@ build.ninja .ninja_deps bin/ lib/ -config/qp_create_ninja.pickle -*/*/README.rst +config/qp_create_ninja.pickle \ No newline at end of file diff --git a/plugins/MRCC_Utils/README.rst b/plugins/MRCC_Utils/README.rst index 626a35a2..80622496 100644 --- a/plugins/MRCC_Utils/README.rst +++ b/plugins/MRCC_Utils/README.rst @@ -464,7 +464,7 @@ Documentation Dressed H with Delta_ij -`h_u_0_mrcc `_ +`h_u_0_mrcc `_ Computes v_0 = H|u_0> .br n : number of determinants @@ -472,7 +472,7 @@ Documentation H_jj : array of -`h_u_0_mrcc_org `_ +`h_u_0_mrcc_org `_ Computes v_0 = H|u_0> .br n : number of determinants diff --git a/src/Determinants/README.rst b/src/Determinants/README.rst index 64e24f00..2c2759ae 100644 --- a/src/Determinants/README.rst +++ b/src/Determinants/README.rst @@ -54,11 +54,7 @@ Documentation .. by the `update_README.py` script. -`a_operator `_ Needed for diag_H_mat_elem - - -`abs_psi_coef_max `_ Max and min values of the coefficients @@ -66,7 +62,7 @@ Documentation Max and min values of the coefficients -`ac_operator `_ +`ac_operator `_ Needed for diag_H_mat_elem @@ -157,11 +153,11 @@ Documentation of alpha and beta determinants -`davidson_converged `_ +`davidson_converged `_ True if the Davidson algorithm is converged -`davidson_criterion `_ +`davidson_criterion `_ Can be : [ energy | residual | both | wall_time | cpu_time | iterations ] @@ -184,7 +180,7 @@ Documentation Initial guess vectors are not necessarily orthonormal -`davidson_diag_hjj `_ +`davidson_diag_hjj `_ Davidson diagonalization with specific diagonal elements of the H matrix .br H_jj : specific diagonal H matrix elements to diagonalize de Davidson @@ -213,7 +209,7 @@ Documentation Max number of Davidson sizes -`davidson_threshold `_ +`davidson_threshold `_ Can be : [ energy | residual | both | wall_time | cpu_time | iterations ] @@ -229,14 +225,10 @@ Documentation det_coef -`det_connections `_ +`det_connections `_ Build connection proxy between determinants -`det_inf `_ - Undocumented - - `det_num `_ det_num @@ -257,7 +249,7 @@ Documentation Diagonalization algorithm (Davidson or Lapack) -`diag_h_mat_elem `_ +`diag_h_mat_elem `_ Computes @@ -317,7 +309,7 @@ Documentation idx(0) is the number of determinants that interact with key1 -`filter_connected_davidson `_ +`filter_connected_davidson `_ Filters out the determinants that are not connected by H returns the array idx which contains the index of the determinants in the array key1 that interact @@ -327,27 +319,7 @@ Documentation key1 should come from psi_det_sorted_ab. -`filter_connected_davidson_shortcut `_ - Filters out the determinants that are not connected by H - returns the array idx which contains the index of the - determinants in the array key1 that interact - via the H operator with key2. - .br - idx(0) is the number of determinants that interact with key1 - key1 should come from psi_det_sorted_ab. - - -`filter_connected_davidson_warp `_ - Filters out the determinants that are not connected by H - returns the array idx which contains the index of the - determinants in the array key1 that interact - via the H operator with key2. - .br - idx(0) is the number of determinants that interact with key1 - key1 should come from psi_det_sorted_ab. - - -`filter_connected_i_h_psi0 `_ +`filter_connected_i_h_psi0 `_ returns the array idx which contains the index of the .br determinants in the array key1 that interact @@ -357,7 +329,7 @@ Documentation idx(0) is the number of determinants that interact with key1 -`filter_connected_i_h_psi0_sc2 `_ +`filter_connected_i_h_psi0_sc2 `_ standard filter_connected_i_H_psi but returns in addition .br the array of the index of the non connected determinants to key1 @@ -383,7 +355,7 @@ Documentation Create a wave function from all possible alpha x beta determinants -`get_double_excitation `_ +`get_double_excitation `_ Returns the two excitation operators between two doubly excited determinants and the phase @@ -395,7 +367,7 @@ Documentation Returns the excitation degree between two determinants -`get_excitation_degree_vector `_ +`get_excitation_degree_vector `_ Applies get_excitation_degree to an array of determinants @@ -411,11 +383,11 @@ Documentation Returns the index of the determinant in the ``psi_det_sorted_bit`` array -`get_mono_excitation `_ +`get_mono_excitation `_ Returns the excitation operator between two singly excited determinants and the phase -`get_occ_from_key `_ +`get_occ_from_key `_ Returns a list of occupation numbers from a bitstring @@ -449,7 +421,7 @@ Documentation Undocumented -`h_u_0 `_ +`h_u_0 `_ Computes v_0 = H|u_0> .br n : number of determinants @@ -457,23 +429,23 @@ Documentation H_jj : array of -`i_h_j `_ +`i_h_j `_ Returns where i and j are determinants -`i_h_j_phase_out `_ +`i_h_j_phase_out `_ Returns where i and j are determinants -`i_h_j_verbose `_ +`i_h_j_verbose `_ Returns where i and j are determinants -`i_h_psi `_ +`i_h_psi `_ for the various Nstates -`i_h_psi_sc2 `_ +`i_h_psi_sc2 `_ for the various Nstate .br returns in addition @@ -487,7 +459,7 @@ Documentation to repeat the excitations -`i_h_psi_sc2_verbose `_ +`i_h_psi_sc2_verbose `_ for the various Nstate .br returns in addition @@ -501,7 +473,7 @@ Documentation to repeat the excitations -`i_h_psi_sec_ord `_ +`i_h_psi_sec_ord `_ for the various Nstates @@ -548,7 +520,7 @@ Documentation Energy of the reference bitmask used in Slater rules -`n_con_int `_ +`n_con_int `_ Number of integers to represent the connections between determinants @@ -913,10 +885,6 @@ Documentation for a given couple of hole/particle excitations i. -`sort_dets_ab `_ - Undocumented - - `sort_dets_by_3_highest_electrons `_ Determinants on which we apply . They are sorted by the 3 highest electrons in the alpha part, @@ -938,10 +906,6 @@ Documentation Weights in the state-average calculation of the density matrix -`tamiser `_ - Undocumented - - `threshold_convergence_sc2 `_ convergence of the correlation energy of SC2 iterations From 0232df92af3f589ac7b8122c3b7b45f9a70e03cd Mon Sep 17 00:00:00 2001 From: Yann Garniron Date: Fri, 23 Oct 2015 10:00:24 +0200 Subject: [PATCH 11/20] Merging and update doc --- plugins/MRCC_Utils/README.rst | 40 +++++++++---- plugins/Perturbation/README.rst | 32 +++++------ src/Determinants/H_apply.template.f | 22 -------- src/Determinants/README.rst | 88 +++++++++++++++++++++-------- src/Ezfio_files/README.rst | 54 +++++++----------- 5 files changed, 129 insertions(+), 107 deletions(-) diff --git a/plugins/MRCC_Utils/README.rst b/plugins/MRCC_Utils/README.rst index 62eba2d1..56b519f2 100644 --- a/plugins/MRCC_Utils/README.rst +++ b/plugins/MRCC_Utils/README.rst @@ -258,7 +258,11 @@ Documentation N_states lowest eigenvalues of the dressed CI matrix -`davidson_diag_hjj_mrcc `_ +`create_minilist `_ + Undocumented + + +`davidson_diag_hjj_mrcc `_ Davidson diagonalization with specific diagonal elements of the H matrix .br H_jj : specific diagonal H matrix elements to diagonalize de Davidson @@ -279,7 +283,7 @@ Documentation Initial guess vectors are not necessarily orthonormal -`davidson_diag_mrcc `_ +`davidson_diag_mrcc `_ Davidson diagonalization. .br dets_in : bitmasks corresponding to determinants @@ -370,7 +374,7 @@ Documentation Find A.C = B -`find_triples_and_quadruples `_ +`find_triples_and_quadruples `_ Undocumented @@ -431,18 +435,26 @@ Documentation Undocumented -`h_apply_mrcc `_ +`h_apply_mrcc `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_mrcc_diexc `_ +`h_apply_mrcc_diexc `_ + Undocumented + + +`h_apply_mrcc_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_mrcc_monoexc `_ +`h_apply_mrcc_diexcp `_ + Undocumented + + +`h_apply_mrcc_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. @@ -452,7 +464,15 @@ Documentation Dressed H with Delta_ij -`h_u_0_mrcc `_ +`h_u_0_mrcc `_ + Computes v_0 = H|u_0> + .br + n : number of determinants + .br + H_jj : array of + + +`h_u_0_mrcc_org `_ Computes v_0 = H|u_0> .br n : number of determinants @@ -757,11 +777,11 @@ Documentation n! -`mrcc_dress `_ +`mrcc_dress `_ Undocumented -`mrcc_dress_simple `_ +`mrcc_dress_simple `_ Undocumented @@ -855,7 +875,7 @@ Documentation Current status for displaying progress bars. Global variable. -`psi_ref_lock `_ +`psi_ref_lock `_ Locks on ref determinants to fill delta_ij diff --git a/plugins/Perturbation/README.rst b/plugins/Perturbation/README.rst index 507e843c..aa6ebf54 100644 --- a/plugins/Perturbation/README.rst +++ b/plugins/Perturbation/README.rst @@ -112,42 +112,42 @@ Documentation routine. -`perturb_buffer_by_mono_dipole_moment_z `_ +`perturb_buffer_by_mono_dipole_moment_z `_ Applly pertubration ``dipole_moment_z`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_by_mono_epstein_nesbet `_ +`perturb_buffer_by_mono_epstein_nesbet `_ Applly pertubration ``epstein_nesbet`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_by_mono_epstein_nesbet_2x2 `_ +`perturb_buffer_by_mono_epstein_nesbet_2x2 `_ Applly pertubration ``epstein_nesbet_2x2`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_by_mono_epstein_nesbet_sc2 `_ +`perturb_buffer_by_mono_epstein_nesbet_sc2 `_ Applly pertubration ``epstein_nesbet_sc2`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_by_mono_epstein_nesbet_sc2_no_projected `_ +`perturb_buffer_by_mono_epstein_nesbet_sc2_no_projected `_ Applly pertubration ``epstein_nesbet_sc2_no_projected`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_by_mono_epstein_nesbet_sc2_projected `_ +`perturb_buffer_by_mono_epstein_nesbet_sc2_projected `_ Applly pertubration ``epstein_nesbet_sc2_projected`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_by_mono_h_core `_ +`perturb_buffer_by_mono_h_core `_ Applly pertubration ``h_core`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_by_mono_moller_plesset `_ +`perturb_buffer_by_mono_moller_plesset `_ Applly pertubration ``moller_plesset`` to the buffer of determinants generated in the H_apply routine. @@ -157,42 +157,42 @@ Documentation routine. -`perturb_buffer_dipole_moment_z `_ +`perturb_buffer_dipole_moment_z `_ Applly pertubration ``dipole_moment_z`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_epstein_nesbet `_ +`perturb_buffer_epstein_nesbet `_ Applly pertubration ``epstein_nesbet`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_epstein_nesbet_2x2 `_ +`perturb_buffer_epstein_nesbet_2x2 `_ Applly pertubration ``epstein_nesbet_2x2`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_epstein_nesbet_sc2 `_ +`perturb_buffer_epstein_nesbet_sc2 `_ Applly pertubration ``epstein_nesbet_sc2`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_epstein_nesbet_sc2_no_projected `_ +`perturb_buffer_epstein_nesbet_sc2_no_projected `_ Applly pertubration ``epstein_nesbet_sc2_no_projected`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_epstein_nesbet_sc2_projected `_ +`perturb_buffer_epstein_nesbet_sc2_projected `_ Applly pertubration ``epstein_nesbet_sc2_projected`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_h_core `_ +`perturb_buffer_h_core `_ Applly pertubration ``h_core`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_moller_plesset `_ +`perturb_buffer_moller_plesset `_ Applly pertubration ``moller_plesset`` to the buffer of determinants generated in the H_apply routine. diff --git a/src/Determinants/H_apply.template.f b/src/Determinants/H_apply.template.f index 047cd3f1..fe360a96 100644 --- a/src/Determinants/H_apply.template.f +++ b/src/Determinants/H_apply.template.f @@ -112,28 +112,6 @@ subroutine $subroutine_diexcP(key_in, fs1, fh1, particl_1, fs2, fh2, particl_2, key_mask(ishft(fh1,-bit_kind_shift) + 1, fs1) -= ishft(1,iand(fh1-1,bit_kind_size-1)) key_mask(ishft(fh2,-bit_kind_shift) + 1, fs2) -= ishft(1,iand(fh2-1,bit_kind_size-1)) -! do i=1,N_int -! n_alpha = n_alpha + popcnt(key_mask(i, 1)) -! n_beta = n_beta + popcnt(key_mask(i, 2)) -! end do -! -! do i=1, N_det -! deg(1) = n_alpha -! deg(2) = n_beta -! -! do ni = 1, N_int -! ! deg(1) = deg(1) - popcnt(iand(key_mask(ni, 1), psi_non_ref(ni, 1, i))) -! ! deg(2) = deg(2) - popcnt(iand(key_mask(ni, 2), psi_non_ref(ni, 2, i))) -! end do -! -! -! if(deg(1) + deg(2) <= 2) then -! ! ndet_out = ndet_out + 1 -! ! idx(ndet_out) = i -! end if -! end do ->>>>>>> 9107aee5ac0e251a0c91d82ef9c686fcef599fb5 - call $subroutine_diexcOrg(key_in, key_mask, p1_mask, particl_1, p2_mask, particl_2, i_generator, iproc_in $parameters ) end subroutine diff --git a/src/Determinants/README.rst b/src/Determinants/README.rst index 62b035fc..d12d8426 100644 --- a/src/Determinants/README.rst +++ b/src/Determinants/README.rst @@ -54,7 +54,7 @@ Documentation .. by the `update_README.py` script. -`a_operator `_ +`a_operator `_ Needed for diag_H_mat_elem @@ -66,7 +66,7 @@ Documentation Max and min values of the coefficients -`ac_operator `_ +`ac_operator `_ Needed for diag_H_mat_elem @@ -157,11 +157,11 @@ Documentation of alpha and beta determinants -`davidson_converged `_ +`davidson_converged `_ True if the Davidson algorithm is converged -`davidson_criterion `_ +`davidson_criterion `_ Can be : [ energy | residual | both | wall_time | cpu_time | iterations ] @@ -184,7 +184,7 @@ Documentation Initial guess vectors are not necessarily orthonormal -`davidson_diag_hjj `_ +`davidson_diag_hjj `_ Davidson diagonalization with specific diagonal elements of the H matrix .br H_jj : specific diagonal H matrix elements to diagonalize de Davidson @@ -213,7 +213,7 @@ Documentation Max number of Davidson sizes -`davidson_threshold `_ +`davidson_threshold `_ Can be : [ energy | residual | both | wall_time | cpu_time | iterations ] @@ -229,10 +229,14 @@ Documentation det_coef -`det_connections `_ +`det_connections `_ Build connection proxy between determinants +`det_inf `_ + Undocumented + + `det_num `_ det_num @@ -253,7 +257,7 @@ Documentation Diagonalization algorithm (Davidson or Lapack) -`diag_h_mat_elem `_ +`diag_h_mat_elem `_ Computes @@ -313,7 +317,7 @@ Documentation idx(0) is the number of determinants that interact with key1 -`filter_connected_davidson `_ +`filter_connected_davidson `_ Filters out the determinants that are not connected by H returns the array idx which contains the index of the determinants in the array key1 that interact @@ -323,7 +327,27 @@ Documentation key1 should come from psi_det_sorted_ab. -`filter_connected_i_h_psi0 `_ +`filter_connected_davidson_shortcut `_ + Filters out the determinants that are not connected by H + returns the array idx which contains the index of the + determinants in the array key1 that interact + via the H operator with key2. + .br + idx(0) is the number of determinants that interact with key1 + key1 should come from psi_det_sorted_ab. + + +`filter_connected_davidson_warp `_ + Filters out the determinants that are not connected by H + returns the array idx which contains the index of the + determinants in the array key1 that interact + via the H operator with key2. + .br + idx(0) is the number of determinants that interact with key1 + key1 should come from psi_det_sorted_ab. + + +`filter_connected_i_h_psi0 `_ returns the array idx which contains the index of the .br determinants in the array key1 that interact @@ -333,7 +357,7 @@ Documentation idx(0) is the number of determinants that interact with key1 -`filter_connected_i_h_psi0_sc2 `_ +`filter_connected_i_h_psi0_sc2 `_ standard filter_connected_i_H_psi but returns in addition .br the array of the index of the non connected determinants to key1 @@ -359,7 +383,7 @@ Documentation Create a wave function from all possible alpha x beta determinants -`get_double_excitation `_ +`get_double_excitation `_ Returns the two excitation operators between two doubly excited determinants and the phase @@ -371,7 +395,7 @@ Documentation Returns the excitation degree between two determinants -`get_excitation_degree_vector `_ +`get_excitation_degree_vector `_ Applies get_excitation_degree to an array of determinants @@ -387,11 +411,11 @@ Documentation Returns the index of the determinant in the ``psi_det_sorted_bit`` array -`get_mono_excitation `_ +`get_mono_excitation `_ Returns the excitation operator between two singly excited determinants and the phase -`get_occ_from_key `_ +`get_occ_from_key `_ Returns a list of occupation numbers from a bitstring @@ -425,7 +449,7 @@ Documentation Undocumented -`h_u_0 `_ +`h_u_0 `_ Computes v_0 = H|u_0> .br n : number of determinants @@ -433,23 +457,31 @@ Documentation H_jj : array of -`i_h_j `_ +`h_u_0_org `_ + Computes v_0 = H|u_0> + .br + n : number of determinants + .br + H_jj : array of + + +`i_h_j `_ Returns where i and j are determinants -`i_h_j_phase_out `_ +`i_h_j_phase_out `_ Returns where i and j are determinants -`i_h_j_verbose `_ +`i_h_j_verbose `_ Returns where i and j are determinants -`i_h_psi `_ +`i_h_psi `_ for the various Nstates -`i_h_psi_sc2 `_ +`i_h_psi_sc2 `_ for the various Nstate .br returns in addition @@ -463,7 +495,7 @@ Documentation to repeat the excitations -`i_h_psi_sc2_verbose `_ +`i_h_psi_sc2_verbose `_ for the various Nstate .br returns in addition @@ -477,7 +509,7 @@ Documentation to repeat the excitations -`i_h_psi_sec_ord `_ +`i_h_psi_sec_ord `_ for the various Nstates @@ -524,7 +556,7 @@ Documentation Energy of the reference bitmask used in Slater rules -`n_con_int `_ +`n_con_int `_ Number of integers to represent the connections between determinants @@ -889,6 +921,10 @@ Documentation for a given couple of hole/particle excitations i. +`sort_dets_ab `_ + Undocumented + + `sort_dets_by_3_highest_electrons `_ Determinants on which we apply . They are sorted by the 3 highest electrons in the alpha part, @@ -910,6 +946,10 @@ Documentation Weights in the state-average calculation of the density matrix +`tamiser `_ + Undocumented + + `threshold_convergence_sc2 `_ convergence of the correlation energy of SC2 iterations diff --git a/src/Ezfio_files/README.rst b/src/Ezfio_files/README.rst index f361c168..986d7216 100644 --- a/src/Ezfio_files/README.rst +++ b/src/Ezfio_files/README.rst @@ -203,99 +203,83 @@ Documentation Output file for Bitmask -`output_cisd `_ - Output file for CISD - - `output_cpu_time_0 `_ 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 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_mo_basis `_ +`output_mo_basis `_ Output file for MO_Basis -`output_moguess `_ +`output_moguess `_ Output file for MOGuess -`output_mrcc_cassd `_ +`output_mrcc_cassd `_ Output file for MRCC_CASSD -`output_mrcc_utils `_ +`output_mrcc_utils `_ Output file for MRCC_Utils -`output_myhartreefock `_ - Output file for MyHartreeFock - - -`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_psiref_cas `_ +`output_psiref_cas `_ Output file for Psiref_CAS -`output_psiref_utils `_ +`output_psiref_utils `_ Output file for Psiref_Utils -`output_selectors_full `_ +`output_selectors_full `_ Output file for Selectors_full -`output_singlerefmethod `_ - Output file for SingleRefMethod - - -`output_utils `_ +`output_utils `_ Output file for Utils From d1c1ae8cb43f1e25e322c983ef71f39499dc00dc Mon Sep 17 00:00:00 2001 From: Yann Garniron Date: Fri, 23 Oct 2015 15:58:43 +0200 Subject: [PATCH 12/20] connected_to_ref --- .travis.yml | 2 +- config/gfortran.cfg | 2 +- plugins/CAS_SD/README.rst | 56 +++++++++++--- plugins/Full_CI/README.rst | 112 ++++++++++++++++++++++------ plugins/MRCC_Utils/README.rst | 26 ++++++- plugins/MRCC_Utils/mrcc_dress.irp.f | 49 +++++++++++- src/Determinants/H_apply.template.f | 18 ++--- src/Determinants/README.rst | 20 +++-- src/Determinants/davidson.irp.f | 18 +++++ src/Determinants/slater_rules.irp.f | 3 +- src/Ezfio_files/README.rst | 50 ++++++++----- 11 files changed, 279 insertions(+), 77 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0e78a8c6..56c55504 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,7 @@ python: script: - ./configure --production ./config/gfortran.cfg - source ./quantum_package.rc - - qp_install_module.py install Full_CI Hartree_Fock + - qp_install_module.py install Full_CI Hartree_Fock CAS_SD MRCC_CASSD - ninja - cd ocaml ; make ; cd - - cd testing_no_regression ; ./unit_test.py diff --git a/config/gfortran.cfg b/config/gfortran.cfg index c1032aa1..192e6d49 100644 --- a/config/gfortran.cfg +++ b/config/gfortran.cfg @@ -10,7 +10,7 @@ # # [COMMON] -FC : gfortran -g -ffree-line-length-none -I . +FC : gfortran -g -ffree-line-length-none -mavx -I . LAPACK_LIB : -llapack -lblas IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 diff --git a/plugins/CAS_SD/README.rst b/plugins/CAS_SD/README.rst index 258410a1..c6707c3e 100644 --- a/plugins/CAS_SD/README.rst +++ b/plugins/CAS_SD/README.rst @@ -118,69 +118,101 @@ Documentation Undocumented -`h_apply_cas_sd `_ +`h_apply_cas_sd `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cas_sd_diexc `_ +`h_apply_cas_sd_diexc `_ + Undocumented + + +`h_apply_cas_sd_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cas_sd_monoexc `_ +`h_apply_cas_sd_diexcp `_ + Undocumented + + +`h_apply_cas_sd_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cas_sd_pt2 `_ +`h_apply_cas_sd_pt2 `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cas_sd_pt2_diexc `_ +`h_apply_cas_sd_pt2_diexc `_ + Undocumented + + +`h_apply_cas_sd_pt2_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cas_sd_pt2_monoexc `_ +`h_apply_cas_sd_pt2_diexcp `_ + Undocumented + + +`h_apply_cas_sd_pt2_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cas_sd_selected `_ +`h_apply_cas_sd_selected `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cas_sd_selected_diexc `_ +`h_apply_cas_sd_selected_diexc `_ + Undocumented + + +`h_apply_cas_sd_selected_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cas_sd_selected_monoexc `_ +`h_apply_cas_sd_selected_diexcp `_ + Undocumented + + +`h_apply_cas_sd_selected_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cas_sd_selected_no_skip `_ +`h_apply_cas_sd_selected_no_skip `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cas_sd_selected_no_skip_diexc `_ +`h_apply_cas_sd_selected_no_skip_diexc `_ + Undocumented + + +`h_apply_cas_sd_selected_no_skip_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cas_sd_selected_no_skip_monoexc `_ +`h_apply_cas_sd_selected_no_skip_diexcp `_ + Undocumented + + +`h_apply_cas_sd_selected_no_skip_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. diff --git a/plugins/Full_CI/README.rst b/plugins/Full_CI/README.rst index bc2307cd..949f97c5 100644 --- a/plugins/Full_CI/README.rst +++ b/plugins/Full_CI/README.rst @@ -27,137 +27,201 @@ Documentation Undocumented -`h_apply_fci `_ +`h_apply_fci `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_fci_diexc `_ +`h_apply_fci_diexc `_ + Undocumented + + +`h_apply_fci_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_mono `_ +`h_apply_fci_diexcp `_ + Undocumented + + +`h_apply_fci_mono `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_fci_mono_diexc `_ +`h_apply_fci_mono_diexc `_ + Undocumented + + +`h_apply_fci_mono_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_mono_monoexc `_ +`h_apply_fci_mono_diexcp `_ + Undocumented + + +`h_apply_fci_mono_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_monoexc `_ +`h_apply_fci_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_no_skip `_ +`h_apply_fci_no_skip `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_fci_no_skip_diexc `_ +`h_apply_fci_no_skip_diexc `_ + Undocumented + + +`h_apply_fci_no_skip_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_no_skip_monoexc `_ +`h_apply_fci_no_skip_diexcp `_ + Undocumented + + +`h_apply_fci_no_skip_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_pt2 `_ +`h_apply_fci_pt2 `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_fci_pt2_diexc `_ +`h_apply_fci_pt2_diexc `_ + Undocumented + + +`h_apply_fci_pt2_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_pt2_monoexc `_ +`h_apply_fci_pt2_diexcp `_ + Undocumented + + +`h_apply_fci_pt2_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_pt2_mono_delta_rho `_ +`h_apply_pt2_mono_delta_rho `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_pt2_mono_delta_rho_diexc `_ +`h_apply_pt2_mono_delta_rho_diexc `_ + Undocumented + + +`h_apply_pt2_mono_delta_rho_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_pt2_mono_delta_rho_monoexc `_ +`h_apply_pt2_mono_delta_rho_diexcp `_ + Undocumented + + +`h_apply_pt2_mono_delta_rho_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_pt2_mono_di_delta_rho `_ +`h_apply_pt2_mono_di_delta_rho `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_pt2_mono_di_delta_rho_diexc `_ +`h_apply_pt2_mono_di_delta_rho_diexc `_ + Undocumented + + +`h_apply_pt2_mono_di_delta_rho_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_pt2_mono_di_delta_rho_monoexc `_ +`h_apply_pt2_mono_di_delta_rho_diexcp `_ + Undocumented + + +`h_apply_pt2_mono_di_delta_rho_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_select_mono_delta_rho `_ +`h_apply_select_mono_delta_rho `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_select_mono_delta_rho_diexc `_ +`h_apply_select_mono_delta_rho_diexc `_ + Undocumented + + +`h_apply_select_mono_delta_rho_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_select_mono_delta_rho_monoexc `_ +`h_apply_select_mono_delta_rho_diexcp `_ + Undocumented + + +`h_apply_select_mono_delta_rho_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_select_mono_di_delta_rho `_ +`h_apply_select_mono_di_delta_rho `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_select_mono_di_delta_rho_diexc `_ +`h_apply_select_mono_di_delta_rho_diexc `_ + Undocumented + + +`h_apply_select_mono_di_delta_rho_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_select_mono_di_delta_rho_monoexc `_ +`h_apply_select_mono_di_delta_rho_diexcp `_ + Undocumented + + +`h_apply_select_mono_di_delta_rho_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. diff --git a/plugins/MRCC_Utils/README.rst b/plugins/MRCC_Utils/README.rst index 56b519f2..815f0c30 100644 --- a/plugins/MRCC_Utils/README.rst +++ b/plugins/MRCC_Utils/README.rst @@ -374,7 +374,7 @@ Documentation Find A.C = B -`find_triples_and_quadruples `_ +`find_triples_and_quadruples `_ Undocumented @@ -400,6 +400,30 @@ Documentation Undocumented +`generator_idx_a `_ + Undocumented + + +`generator_idx_b `_ + Undocumented + + +`generator_shortcut_a `_ + Undocumented + + +`generator_shortcut_b `_ + Undocumented + + +`generator_sorted_a `_ + Undocumented + + +`generator_sorted_b `_ + Undocumented + + `get_pseudo_inverse `_ Find C = A^-1 diff --git a/plugins/MRCC_Utils/mrcc_dress.irp.f b/plugins/MRCC_Utils/mrcc_dress.irp.f index f427c81f..ac959c38 100644 --- a/plugins/MRCC_Utils/mrcc_dress.irp.f +++ b/plugins/MRCC_Utils/mrcc_dress.irp.f @@ -268,6 +268,21 @@ subroutine mrcc_dress_simple(delta_ij_non_ref_,Ndet_non_ref,i_generator,n_select end + BEGIN_PROVIDER [ integer(bit_kind), gen_det_sorted, (N_int,2,N_det_generators,2) ] +&BEGIN_PROVIDER [ integer, gen_det_shortcut, (0:N_det_generators,2) ] +&BEGIN_PROVIDER [ integer, gen_det_idx, (N_det_generators,2) ] + + !integer(bit_kind) :: aa(N_int,2,N_det_generators), bb(N_int,2,N_det_generators) + + gen_det_sorted(:,:,:,1) = psi_det_generators(:,:,:N_det_generators) + gen_det_sorted(:,:,:,2) = psi_det_generators(:,:,:N_det_generators) + call sort_dets_ab(gen_det_sorted(:,:,:,1), gen_det_idx(0:,1), gen_det_shortcut(:,1), N_det_generators, Nint) + call sort_dets_ba(gen_det_sorted(:,:,:,2), gen_det_idx(0:,2), gen_det_shortcut(:,2), N_det_generators, Nint) + + +END_PROVIDER + + subroutine find_triples_and_quadruples(i_generator,n_selected,det_buffer,Nint,tq,N_tq) use bitmasks implicit none @@ -286,9 +301,41 @@ subroutine find_triples_and_quadruples(i_generator,n_selected,det_buffer,Nint,tq integer :: c_ref integer :: connected_to_ref - + + integer :: na, nt, mex, lex, sh,ni,i,j + + !provide generator_sorted_a, generator_sorted_b, generator_shortcut_a, generator_shortcut_b + N_tq = 0 do i=1,N_selected + na = popcnt(iand(det_buffer(1,1,i), not(ishft(1,elec_alpha_num)-1))) + nb = popcnt(iand(det_buffer(1,1,i), not(ishft(1,elec_beta_num)-1))) + if(na > nb) then ! alpha + exite + mex = 1 + lex = 2 + else + mex = 2 + lex = 1 + end if + + do sh = 1,gen_det_shortcut(0,mex) + na = 0 + do i=1,ni + na += popcnt(xor(det_buffer(ni,mex,i), gen_det_sorted(gen_det_shortcut(sh, mex)))) + end do + if(na > 4) then + cycle + end if + do j=get_det_shortcut(sh, mex), gen_det_shortcut(sh+1,mex)-1 + if(gen_get_idx(j,mex + nt = na + do i=1,ni + nt += popcnt(xor(det_buffer(ni,mex,i), gen_det_sorted(gen_det_shortcut(sh, mex)))) + end do + if(na < + end do + end do + c_ref = connected_to_ref(det_buffer(1,1,i),psi_det_generators,Nint, & i_generator,N_det_generators) diff --git a/src/Determinants/H_apply.template.f b/src/Determinants/H_apply.template.f index fe360a96..f90eb0c8 100644 --- a/src/Determinants/H_apply.template.f +++ b/src/Determinants/H_apply.template.f @@ -31,30 +31,30 @@ subroutine $subroutine_diexc(key_in, key_prev, hole_1,particl_1, hole_2, particl end do end do -! GEL D'ELECTRONS -! nt = 0 +! ! GEL D'ELECTRONS +! ! nt = 0 ! do i=1,i_generator-1 ! if(key_in(1,1) == key_prev(1,1,i)) then ! tmp = xor(key_in(1,2), key_prev(1,2,i)) ! if(popcnt(tmp) == 2) then ! ns = 1+trailz(iand(tmp, key_in(1,2))) -! if(status(ns, 2) /= 0) then -! nt += 1 -! end if +! ! if(status(ns, 2) /= 0) then +! ! nt += 1 +! ! end if ! status(ns, 2) = 0 ! end if ! else if(key_in(1,2) == key_prev(1,2,i)) then ! tmp = xor(key_in(1,1), key_prev(1,1,i)) ! if(popcnt(tmp) == 2) then ! ns = 1+trailz(iand(tmp, key_in(1,1))) -! if(status(ns, 1) /= 0) then -! nt += 1 -! end if +! ! if(status(ns, 1) /= 0) then +! ! nt += 1 +! ! end if ! status(ns, 1) = 0 ! end if ! end if ! end do -! print *, "nt", nt, i_generator +! ! print *, "nt", nt, i_generator do sp=1,2 diff --git a/src/Determinants/README.rst b/src/Determinants/README.rst index d12d8426..0f7b1237 100644 --- a/src/Determinants/README.rst +++ b/src/Determinants/README.rst @@ -157,11 +157,11 @@ Documentation of alpha and beta determinants -`davidson_converged `_ +`davidson_converged `_ True if the Davidson algorithm is converged -`davidson_criterion `_ +`davidson_criterion `_ Can be : [ energy | residual | both | wall_time | cpu_time | iterations ] @@ -184,7 +184,7 @@ Documentation Initial guess vectors are not necessarily orthonormal -`davidson_diag_hjj `_ +`davidson_diag_hjj `_ Davidson diagonalization with specific diagonal elements of the H matrix .br H_jj : specific diagonal H matrix elements to diagonalize de Davidson @@ -213,7 +213,7 @@ Documentation Max number of Davidson sizes -`davidson_threshold `_ +`davidson_threshold `_ Can be : [ energy | residual | both | wall_time | cpu_time | iterations ] @@ -229,7 +229,7 @@ Documentation det_coef -`det_connections `_ +`det_connections `_ Build connection proxy between determinants @@ -457,7 +457,7 @@ Documentation H_jj : array of -`h_u_0_org `_ +`h_u_0_org `_ Computes v_0 = H|u_0> .br n : number of determinants @@ -556,7 +556,7 @@ Documentation Energy of the reference bitmask used in Slater rules -`n_con_int `_ +`n_con_int `_ Number of integers to represent the connections between determinants @@ -921,7 +921,11 @@ Documentation for a given couple of hole/particle excitations i. -`sort_dets_ab `_ +`sort_dets_ab `_ + Undocumented + + +`sort_dets_ba `_ Undocumented diff --git a/src/Determinants/davidson.irp.f b/src/Determinants/davidson.irp.f index 626ecec3..c2fce1cf 100644 --- a/src/Determinants/davidson.irp.f +++ b/src/Determinants/davidson.irp.f @@ -120,6 +120,24 @@ subroutine tamiser(key, idx, no, n, Nint, N_key) end do end subroutine +subroutine sort_dets_ba(key, idx, shortcut, N_key, Nint) + use bitmasks + implicit none + integer(bit_kind),intent(inout) :: key(Nint,2,N_key) + integer,intent(out) :: idx(N_key) + integer,intent(out) :: shortcut(0:N_key+1) + integer, intent(in) :: Nint, N_key + integer(bit_kind) :: tmp(Nint, 2,N_key) + + tmp(:,1,:N_key) = key(:,2,:N_key) + tmp(:,2,:N_key) = key(:,1,:N_key) + + call sort_dets_ab(tmp, idx, shortcut, N_key, Nint) + + key(:,1,:N_key) = tmp(:,2,:N_key) + key(:,2,:N_key) = tmp(:,1,:N_key) +end subroutine + subroutine sort_dets_ab(key, idx, shortcut, N_key, Nint) use bitmasks diff --git a/src/Determinants/slater_rules.irp.f b/src/Determinants/slater_rules.irp.f index 72615089..06dcb9b7 100644 --- a/src/Determinants/slater_rules.irp.f +++ b/src/Determinants/slater_rules.irp.f @@ -1251,9 +1251,10 @@ subroutine H_u_0(v_0,u_0,H_jj,n,keys_tmp,shortcut,sort_idx,Nint) allocate(idx(0:n), vt(n)) Vt = 0.d0 v_0 = 0.d0 + !$OMP DO SCHEDULE(dynamic) - + do sh=1,shortcut(0) warp(1,0) = 0 do ii=1,sh!shortcut(0) diff --git a/src/Ezfio_files/README.rst b/src/Ezfio_files/README.rst index 986d7216..a612dcc7 100644 --- a/src/Ezfio_files/README.rst +++ b/src/Ezfio_files/README.rst @@ -203,83 +203,95 @@ Documentation Output file for Bitmask +`output_cas_sd `_ + Output file for CAS_SD + + `output_cpu_time_0 `_ Initial CPU and wall times when printing in the output files -`output_determinants `_ +`output_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_generators_full `_ +`output_full_ci `_ + Output file for Full_CI + + +`output_generators_cas `_ + Output file for Generators_CAS + + +`output_generators_full `_ Output file for Generators_full -`output_hartree_fock `_ +`output_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_mo_basis `_ +`output_mo_basis `_ Output file for MO_Basis -`output_moguess `_ +`output_moguess `_ Output file for MOGuess -`output_mrcc_cassd `_ +`output_mrcc_cassd `_ Output file for MRCC_CASSD -`output_mrcc_utils `_ +`output_mrcc_utils `_ Output file for MRCC_Utils -`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_psiref_cas `_ +`output_psiref_cas `_ Output file for Psiref_CAS -`output_psiref_utils `_ +`output_psiref_utils `_ Output file for Psiref_Utils -`output_selectors_full `_ +`output_selectors_full `_ Output file for Selectors_full -`output_utils `_ +`output_utils `_ Output file for Utils From cad30f56f9626d47fea51f683aed5001a70aff8c Mon Sep 17 00:00:00 2001 From: Yann Garniron Date: Fri, 23 Oct 2015 15:58:43 +0200 Subject: [PATCH 13/20] connected_to_ref --- .travis.yml | 2 +- plugins/CAS_SD/README.rst | 56 ++++-- plugins/Full_CI/README.rst | 112 +++++++++--- plugins/MRCC_Utils/README.rst | 22 ++- plugins/MRCC_Utils/mrcc_dress.irp.f | 267 +++++++++++++++++++++++----- plugins/Perturbation/README.rst | 20 +-- src/Determinants/H_apply.template.f | 18 +- src/Determinants/README.rst | 24 ++- src/Determinants/davidson.irp.f | 65 +++++++ src/Determinants/slater_rules.irp.f | 3 +- src/Ezfio_files/README.rst | 50 ++++-- 11 files changed, 503 insertions(+), 136 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0e78a8c6..56c55504 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,7 @@ python: script: - ./configure --production ./config/gfortran.cfg - source ./quantum_package.rc - - qp_install_module.py install Full_CI Hartree_Fock + - qp_install_module.py install Full_CI Hartree_Fock CAS_SD MRCC_CASSD - ninja - cd ocaml ; make ; cd - - cd testing_no_regression ; ./unit_test.py diff --git a/plugins/CAS_SD/README.rst b/plugins/CAS_SD/README.rst index 258410a1..c6707c3e 100644 --- a/plugins/CAS_SD/README.rst +++ b/plugins/CAS_SD/README.rst @@ -118,69 +118,101 @@ Documentation Undocumented -`h_apply_cas_sd `_ +`h_apply_cas_sd `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cas_sd_diexc `_ +`h_apply_cas_sd_diexc `_ + Undocumented + + +`h_apply_cas_sd_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cas_sd_monoexc `_ +`h_apply_cas_sd_diexcp `_ + Undocumented + + +`h_apply_cas_sd_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cas_sd_pt2 `_ +`h_apply_cas_sd_pt2 `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cas_sd_pt2_diexc `_ +`h_apply_cas_sd_pt2_diexc `_ + Undocumented + + +`h_apply_cas_sd_pt2_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cas_sd_pt2_monoexc `_ +`h_apply_cas_sd_pt2_diexcp `_ + Undocumented + + +`h_apply_cas_sd_pt2_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cas_sd_selected `_ +`h_apply_cas_sd_selected `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cas_sd_selected_diexc `_ +`h_apply_cas_sd_selected_diexc `_ + Undocumented + + +`h_apply_cas_sd_selected_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cas_sd_selected_monoexc `_ +`h_apply_cas_sd_selected_diexcp `_ + Undocumented + + +`h_apply_cas_sd_selected_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cas_sd_selected_no_skip `_ +`h_apply_cas_sd_selected_no_skip `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_cas_sd_selected_no_skip_diexc `_ +`h_apply_cas_sd_selected_no_skip_diexc `_ + Undocumented + + +`h_apply_cas_sd_selected_no_skip_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_cas_sd_selected_no_skip_monoexc `_ +`h_apply_cas_sd_selected_no_skip_diexcp `_ + Undocumented + + +`h_apply_cas_sd_selected_no_skip_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. diff --git a/plugins/Full_CI/README.rst b/plugins/Full_CI/README.rst index bc2307cd..949f97c5 100644 --- a/plugins/Full_CI/README.rst +++ b/plugins/Full_CI/README.rst @@ -27,137 +27,201 @@ Documentation Undocumented -`h_apply_fci `_ +`h_apply_fci `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_fci_diexc `_ +`h_apply_fci_diexc `_ + Undocumented + + +`h_apply_fci_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_mono `_ +`h_apply_fci_diexcp `_ + Undocumented + + +`h_apply_fci_mono `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_fci_mono_diexc `_ +`h_apply_fci_mono_diexc `_ + Undocumented + + +`h_apply_fci_mono_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_mono_monoexc `_ +`h_apply_fci_mono_diexcp `_ + Undocumented + + +`h_apply_fci_mono_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_monoexc `_ +`h_apply_fci_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_no_skip `_ +`h_apply_fci_no_skip `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_fci_no_skip_diexc `_ +`h_apply_fci_no_skip_diexc `_ + Undocumented + + +`h_apply_fci_no_skip_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_no_skip_monoexc `_ +`h_apply_fci_no_skip_diexcp `_ + Undocumented + + +`h_apply_fci_no_skip_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_pt2 `_ +`h_apply_fci_pt2 `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_fci_pt2_diexc `_ +`h_apply_fci_pt2_diexc `_ + Undocumented + + +`h_apply_fci_pt2_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_fci_pt2_monoexc `_ +`h_apply_fci_pt2_diexcp `_ + Undocumented + + +`h_apply_fci_pt2_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_pt2_mono_delta_rho `_ +`h_apply_pt2_mono_delta_rho `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_pt2_mono_delta_rho_diexc `_ +`h_apply_pt2_mono_delta_rho_diexc `_ + Undocumented + + +`h_apply_pt2_mono_delta_rho_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_pt2_mono_delta_rho_monoexc `_ +`h_apply_pt2_mono_delta_rho_diexcp `_ + Undocumented + + +`h_apply_pt2_mono_delta_rho_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_pt2_mono_di_delta_rho `_ +`h_apply_pt2_mono_di_delta_rho `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_pt2_mono_di_delta_rho_diexc `_ +`h_apply_pt2_mono_di_delta_rho_diexc `_ + Undocumented + + +`h_apply_pt2_mono_di_delta_rho_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_pt2_mono_di_delta_rho_monoexc `_ +`h_apply_pt2_mono_di_delta_rho_diexcp `_ + Undocumented + + +`h_apply_pt2_mono_di_delta_rho_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_select_mono_delta_rho `_ +`h_apply_select_mono_delta_rho `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_select_mono_delta_rho_diexc `_ +`h_apply_select_mono_delta_rho_diexc `_ + Undocumented + + +`h_apply_select_mono_delta_rho_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_select_mono_delta_rho_monoexc `_ +`h_apply_select_mono_delta_rho_diexcp `_ + Undocumented + + +`h_apply_select_mono_delta_rho_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_select_mono_di_delta_rho `_ +`h_apply_select_mono_di_delta_rho `_ Calls H_apply on the HF determinant and selects all connected single and double excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. -`h_apply_select_mono_di_delta_rho_diexc `_ +`h_apply_select_mono_di_delta_rho_diexc `_ + Undocumented + + +`h_apply_select_mono_di_delta_rho_diexcorg `_ Generate all double excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. -`h_apply_select_mono_di_delta_rho_monoexc `_ +`h_apply_select_mono_di_delta_rho_diexcp `_ + Undocumented + + +`h_apply_select_mono_di_delta_rho_monoexc `_ Generate all single excitations of key_in using the bit masks of holes and particles. Assume N_int is already provided. diff --git a/plugins/MRCC_Utils/README.rst b/plugins/MRCC_Utils/README.rst index 56b519f2..7e7088a2 100644 --- a/plugins/MRCC_Utils/README.rst +++ b/plugins/MRCC_Utils/README.rst @@ -374,7 +374,7 @@ Documentation Find A.C = B -`find_triples_and_quadruples `_ +`find_triples_and_quadruples `_ Undocumented @@ -400,6 +400,22 @@ Documentation Undocumented +`gen_det_idx `_ + Undocumented + + +`gen_det_shortcut `_ + Undocumented + + +`gen_det_sorted `_ + Undocumented + + +`gen_det_version `_ + Undocumented + + `get_pseudo_inverse `_ Find C = A^-1 @@ -781,10 +797,6 @@ Documentation Undocumented -`mrcc_dress_simple `_ - Undocumented - - `mrcc_iterations `_ Undocumented diff --git a/plugins/MRCC_Utils/mrcc_dress.irp.f b/plugins/MRCC_Utils/mrcc_dress.irp.f index f427c81f..ef87d52a 100644 --- a/plugins/MRCC_Utils/mrcc_dress.irp.f +++ b/plugins/MRCC_Utils/mrcc_dress.irp.f @@ -95,7 +95,20 @@ subroutine mrcc_dress(delta_ij_, delta_ii_, Ndet_ref, Ndet_non_ref,i_generator,n integer :: idx_miniList(N_det_non_ref), N_miniList - call find_triples_and_quadruples(i_generator,n_selected,det_buffer,Nint,tq,N_tq) + +! N_miniList = 0 +! do i=i_generator-1,1,-1 +! k = popcnt(key_mask(1,1)) + popcnt(key_mask(1,2)) - popcnt(iand(key_mask(1,1), psi_det_generators(1,1,i))) - popcnt(iand(key_mask(1,2), psi_det_generators(1,2,i))) +! if(k == 0) then +! return +! end if +! if(k <= 2) then +! N_minilist += 1 +! miniList(:,:,N_minilist) = psi_det_generators(:,:,i) +! end if +! end do + + call find_triples_and_quadruples(i_generator,n_selected,det_buffer,Nint,tq,N_tq,miniList,N_minilist) allocate (dIa_hla(N_states,Ndet_non_ref)) @@ -222,53 +235,67 @@ end -subroutine mrcc_dress_simple(delta_ij_non_ref_,Ndet_non_ref,i_generator,n_selected,det_buffer,Nint,iproc) - use bitmasks - implicit none - - integer, intent(in) :: i_generator,n_selected, Nint, iproc - integer, intent(in) :: Ndet_non_ref - double precision, intent(inout) :: delta_ij_non_ref_(Ndet_non_ref,Ndet_non_ref,*) - - integer(bit_kind), intent(in) :: det_buffer(Nint,2,n_selected) - integer :: i,j,k,m - integer :: new_size - integer :: degree(psi_det_size) - integer :: idx(0:psi_det_size) - logical :: good - - integer(bit_kind) :: tq(Nint,2,n_selected) - integer :: N_tq, c_ref - integer :: connected_to_ref - - call find_triples_and_quadruples(i_generator,n_selected,det_buffer,Nint,tq,N_tq) - - ! Compute / (E0 - Haa) - double precision :: hka, haa - double precision :: haj - double precision :: f(N_states) - - do i=1,N_tq - call get_excitation_degree_vector(psi_non_ref,tq(1,1,i),degree,Nint,Ndet_non_ref,idx) - call i_h_j(tq(1,1,i),tq(1,1,i),Nint,haa) - do m=1,N_states - f(m) = 1.d0/(ci_electronic_energy(m)-haa) - enddo - do k=1,idx(0) - call i_h_j(tq(1,1,i),psi_non_ref(1,1,idx(k)),Nint,hka) - do j=k,idx(0) - call i_h_j(tq(1,1,i),psi_non_ref(1,1,idx(j)),Nint,haj) - do m=1,N_states - delta_ij_non_ref_(idx(k), idx(j),m) += haj*hka* f(m) - delta_ij_non_ref_(idx(j), idx(k),m) += haj*hka* f(m) - enddo - enddo - enddo - enddo -end +! subroutine mrcc_dress_simple(delta_ij_non_ref_,Ndet_non_ref,i_generator,n_selected,det_buffer,Nint,iproc) +! use bitmasks +! implicit none +! +! integer, intent(in) :: i_generator,n_selected, Nint, iproc +! integer, intent(in) :: Ndet_non_ref +! double precision, intent(inout) :: delta_ij_non_ref_(Ndet_non_ref,Ndet_non_ref,*) +! +! integer(bit_kind), intent(in) :: det_buffer(Nint,2,n_selected) +! integer :: i,j,k,m +! integer :: new_size +! integer :: degree(psi_det_size) +! integer :: idx(0:psi_det_size) +! logical :: good +! +! integer(bit_kind) :: tq(Nint,2,n_selected) +! integer :: N_tq, c_ref +! integer :: connected_to_ref +! +! +! call find_triples_and_quadruples(i_generator,n_selected,det_buffer,Nint,tq,N_tq) +! +! ! Compute / (E0 - Haa) +! double precision :: hka, haa +! double precision :: haj +! double precision :: f(N_states) +! +! do i=1,N_tq +! call get_excitation_degree_vector(psi_non_ref,tq(1,1,i),degree,Nint,Ndet_non_ref,idx) +! call i_h_j(tq(1,1,i),tq(1,1,i),Nint,haa) +! do m=1,N_states +! f(m) = 1.d0/(ci_electronic_energy(m)-haa) +! enddo +! do k=1,idx(0) +! call i_h_j(tq(1,1,i),psi_non_ref(1,1,idx(k)),Nint,hka) +! do j=k,idx(0) +! call i_h_j(tq(1,1,i),psi_non_ref(1,1,idx(j)),Nint,haj) +! do m=1,N_states +! delta_ij_non_ref_(idx(k), idx(j),m) += haj*hka* f(m) +! delta_ij_non_ref_(idx(j), idx(k),m) += haj*hka* f(m) +! enddo +! enddo +! enddo +! enddo +! end -subroutine find_triples_and_quadruples(i_generator,n_selected,det_buffer,Nint,tq,N_tq) + BEGIN_PROVIDER [ integer(bit_kind), gen_det_sorted, (N_int,2,N_det_generators,2) ] +&BEGIN_PROVIDER [ integer, gen_det_shortcut, (0:N_det_generators,2) ] +&BEGIN_PROVIDER [ integer, gen_det_version, (N_int, N_det_generators,2) ] +&BEGIN_PROVIDER [ integer, gen_det_idx, (N_det_generators,2) ] + + gen_det_sorted(:,:,:,1) = psi_det_generators(:,:,:N_det_generators) + gen_det_sorted(:,:,:,2) = psi_det_generators(:,:,:N_det_generators) + call sort_dets_ab_v(gen_det_sorted(:,:,:,1), gen_det_idx(:,1), gen_det_shortcut(0:,1), gen_det_version(:,:,1), N_det_generators, N_int) + call sort_dets_ba_v(gen_det_sorted(:,:,:,2), gen_det_idx(:,2), gen_det_shortcut(0:,2), gen_det_version(:,:,2), N_det_generators, N_int) + print *, " *********************** ", gen_det_shortcut(0,:) +END_PROVIDER + + +subroutine find_triples_and_quadruples(i_generator,n_selected,det_buffer,Nint,tq,N_tq,miniList,N_miniList) use bitmasks implicit none @@ -286,12 +313,158 @@ subroutine find_triples_and_quadruples(i_generator,n_selected,det_buffer,Nint,tq integer :: c_ref integer :: connected_to_ref - + + integer :: na, nb, nt,mex, lex, sh,ni + + + integer(bit_kind),intent(in) :: miniList(Nint,2,N_det_generators) + integer,intent(in) :: N_miniList + + + + N_tq = 0 do i=1,N_selected +! c_ref = 0 +! do j=1,N_miniList +! na = popcnt(xor(miniList(1,1,j), det_buffer(1,1,i))) +! nb = popcnt(xor(miniList(1,2,j), det_buffer(1,2,i))) +! if(na+nb <= 4) then +! c_ref = 1 +! exit +! end if +! end do + + +! +! if(Nint /= 1) then +! c_ref = 0 +! na = 0 +! nb = 0 +! do ni=1,Nint +! na += popcnt(xor(det_buffer(ni,1,i), psi_ref(ni,1,1))) +! nb += popcnt(xor(det_buffer(ni,2,i), psi_ref(ni,2,1))) +! end do +! if(na > nb) then +! mex = 1 +! lex = 2 +! else +! mex = 2 +! lex = 1 +! end if +! +! +! sh_loop : do sh=1,gen_det_shortcut(0,lex) +! do ni=1,Nint +! if(det_buffer(ni,lex,i) /= gen_det_sorted(ni,lex,gen_det_shortcut(sh, lex),lex)) then +! cycle sh_loop +! end if +! end do +! do j=gen_det_shortcut(sh,lex),gen_det_shortcut(sh+1,lex)-1 +! if(gen_det_idx(j,lex) >= i_generator) then +! cycle +! end if +! nt = 0 +! do ni=1,nint +! nt += popcnt(xor(det_buffer(ni,mex,i), gen_det_sorted(ni,mex,j,lex))) +! end do +! if(nt <= 4) then +! ! if(gen_det_idx(j,lex) < i_generator) then +! c_ref = 1!gen_det_idx(j,lex) +! exit sh_loop +! ! end if +! end if +! end do +! exit sh_loop +! end do sh_loop +! +! if(c_ref == 0) then +! sh_loop2 : do sh = 1,gen_det_shortcut(0,mex) +! na = 0 +! do ni=1,Nint +! na += popcnt(xor(det_buffer(ni,mex,i), gen_det_sorted(ni,mex,gen_det_shortcut(sh, mex),mex))) +! end do +! if(na > 2) then +! cycle +! end if + +! do j=gen_det_shortcut(sh, mex), gen_det_shortcut(sh+1,mex)-1 +! if(gen_det_idx(j,mex) >= i_generator) then +! cycle +! end if +! nt = na +! do ni=1,Nint +! nt += popcnt(xor(det_buffer(ni,lex,i), gen_det_sorted(ni,lex,j,mex))) +! end do +! if(nt <= 4) then +! ! if(gen_det_idx(j,mex) < i_generator) then +! c_ref = 2!gen_det_idx(j,mex) +! exit sh_loop2 +! ! end if +! end if +! end do +! end do sh_loop2 +! end if +! else +! c_ref = 0 +! na = popcnt(xor(det_buffer(1,1,i), psi_ref(1,1,1))) +! nb = popcnt(xor(det_buffer(1,2,i), psi_ref(1,2,1))) +! if(na > nb) then +! mex = 1 +! lex = 2 +! else +! mex = 2 +! lex = 1 +! end if +! +! +! sh_loop3 : do sh=1,gen_det_shortcut(0,lex) +! if(det_buffer(1,lex,i) /= gen_det_version(1,sh,lex)) then!gen_det_sorted(1,lex,gen_det_shortcut(sh, lex),lex)) then +! cycle sh_loop3 +! end if +! do j=gen_det_shortcut(sh,lex),gen_det_shortcut(sh+1,lex)-1 +! if(gen_det_idx(j,lex) >= i_generator) then +! cycle +! end if +! nt = popcnt(xor(det_buffer(1,mex,i), gen_det_sorted(1,mex,j,lex))) +! if(nt <= 4) then +! ! if(gen_det_idx(j,lex) < i_generator) then +! c_ref = 1!gen_det_idx(j,lex) +! exit sh_loop3 +! ! end if +! end if +! end do +! exit sh_loop3 +! end do sh_loop3 +! +! if(c_ref == 0) then +! sh_loop4 : do sh = 1,gen_det_shortcut(0,mex) +! na = popcnt(xor(det_buffer(1,mex,i),gen_det_version(1,sh,mex)))! gen_det_sorted(1,mex,gen_det_shortcut(sh, mex),mex))) +! if(na > 2) then +! cycle sh_loop4 +! end if +! do j=gen_det_shortcut(sh, mex), gen_det_shortcut(sh+1,mex)-1 +! if(gen_det_idx(j,mex) >= i_generator) then +! cycle +! end if +! nt = na +! nt += popcnt(xor(det_buffer(1,lex,i), gen_det_sorted(1,lex,j,mex))) +! if(nt <= 4) then +! ! if(gen_det_idx(j,mex) < i_generator) then +! c_ref = 2!gen_det_idx(j,mex) +! exit sh_loop4 +! ! end if +! end if +! end do +! end do sh_loop4 +! end if +! end if + + c_ref = connected_to_ref(det_buffer(1,1,i),psi_det_generators,Nint, & i_generator,N_det_generators) + if (c_ref /= 0) then cycle endif diff --git a/plugins/Perturbation/README.rst b/plugins/Perturbation/README.rst index aa6ebf54..0307ec12 100644 --- a/plugins/Perturbation/README.rst +++ b/plugins/Perturbation/README.rst @@ -107,22 +107,22 @@ Documentation Undocumented -`perturb_buffer_by_mono_delta_rho_one_point `_ +`perturb_buffer_by_mono_delta_rho_one_point `_ Applly pertubration ``delta_rho_one_point`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_by_mono_dipole_moment_z `_ +`perturb_buffer_by_mono_dipole_moment_z `_ Applly pertubration ``dipole_moment_z`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_by_mono_epstein_nesbet `_ +`perturb_buffer_by_mono_epstein_nesbet `_ Applly pertubration ``epstein_nesbet`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_by_mono_epstein_nesbet_2x2 `_ +`perturb_buffer_by_mono_epstein_nesbet_2x2 `_ Applly pertubration ``epstein_nesbet_2x2`` to the buffer of determinants generated in the H_apply routine. @@ -142,7 +142,7 @@ Documentation routine. -`perturb_buffer_by_mono_h_core `_ +`perturb_buffer_by_mono_h_core `_ Applly pertubration ``h_core`` to the buffer of determinants generated in the H_apply routine. @@ -152,22 +152,22 @@ Documentation routine. -`perturb_buffer_delta_rho_one_point `_ +`perturb_buffer_delta_rho_one_point `_ Applly pertubration ``delta_rho_one_point`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_dipole_moment_z `_ +`perturb_buffer_dipole_moment_z `_ Applly pertubration ``dipole_moment_z`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_epstein_nesbet `_ +`perturb_buffer_epstein_nesbet `_ Applly pertubration ``epstein_nesbet`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_epstein_nesbet_2x2 `_ +`perturb_buffer_epstein_nesbet_2x2 `_ Applly pertubration ``epstein_nesbet_2x2`` to the buffer of determinants generated in the H_apply routine. @@ -187,7 +187,7 @@ Documentation routine. -`perturb_buffer_h_core `_ +`perturb_buffer_h_core `_ Applly pertubration ``h_core`` to the buffer of determinants generated in the H_apply routine. diff --git a/src/Determinants/H_apply.template.f b/src/Determinants/H_apply.template.f index fe360a96..f90eb0c8 100644 --- a/src/Determinants/H_apply.template.f +++ b/src/Determinants/H_apply.template.f @@ -31,30 +31,30 @@ subroutine $subroutine_diexc(key_in, key_prev, hole_1,particl_1, hole_2, particl end do end do -! GEL D'ELECTRONS -! nt = 0 +! ! GEL D'ELECTRONS +! ! nt = 0 ! do i=1,i_generator-1 ! if(key_in(1,1) == key_prev(1,1,i)) then ! tmp = xor(key_in(1,2), key_prev(1,2,i)) ! if(popcnt(tmp) == 2) then ! ns = 1+trailz(iand(tmp, key_in(1,2))) -! if(status(ns, 2) /= 0) then -! nt += 1 -! end if +! ! if(status(ns, 2) /= 0) then +! ! nt += 1 +! ! end if ! status(ns, 2) = 0 ! end if ! else if(key_in(1,2) == key_prev(1,2,i)) then ! tmp = xor(key_in(1,1), key_prev(1,1,i)) ! if(popcnt(tmp) == 2) then ! ns = 1+trailz(iand(tmp, key_in(1,1))) -! if(status(ns, 1) /= 0) then -! nt += 1 -! end if +! ! if(status(ns, 1) /= 0) then +! ! nt += 1 +! ! end if ! status(ns, 1) = 0 ! end if ! end if ! end do -! print *, "nt", nt, i_generator +! ! print *, "nt", nt, i_generator do sp=1,2 diff --git a/src/Determinants/README.rst b/src/Determinants/README.rst index d12d8426..cc9e7ca3 100644 --- a/src/Determinants/README.rst +++ b/src/Determinants/README.rst @@ -157,11 +157,11 @@ Documentation of alpha and beta determinants -`davidson_converged `_ +`davidson_converged `_ True if the Davidson algorithm is converged -`davidson_criterion `_ +`davidson_criterion `_ Can be : [ energy | residual | both | wall_time | cpu_time | iterations ] @@ -184,7 +184,7 @@ Documentation Initial guess vectors are not necessarily orthonormal -`davidson_diag_hjj `_ +`davidson_diag_hjj `_ Davidson diagonalization with specific diagonal elements of the H matrix .br H_jj : specific diagonal H matrix elements to diagonalize de Davidson @@ -213,7 +213,7 @@ Documentation Max number of Davidson sizes -`davidson_threshold `_ +`davidson_threshold `_ Can be : [ energy | residual | both | wall_time | cpu_time | iterations ] @@ -229,7 +229,7 @@ Documentation det_coef -`det_connections `_ +`det_connections `_ Build connection proxy between determinants @@ -457,7 +457,7 @@ Documentation H_jj : array of -`h_u_0_org `_ +`h_u_0_org `_ Computes v_0 = H|u_0> .br n : number of determinants @@ -556,7 +556,7 @@ Documentation Energy of the reference bitmask used in Slater rules -`n_con_int `_ +`n_con_int `_ Number of integers to represent the connections between determinants @@ -921,7 +921,15 @@ Documentation for a given couple of hole/particle excitations i. -`sort_dets_ab `_ +`sort_dets_ab `_ + Undocumented + + +`sort_dets_ab_v `_ + Undocumented + + +`sort_dets_ba_v `_ Undocumented diff --git a/src/Determinants/davidson.irp.f b/src/Determinants/davidson.irp.f index 626ecec3..7a2f6401 100644 --- a/src/Determinants/davidson.irp.f +++ b/src/Determinants/davidson.irp.f @@ -120,6 +120,71 @@ subroutine tamiser(key, idx, no, n, Nint, N_key) end do end subroutine +subroutine sort_dets_ba_v(key, idx, shortcut, version, N_key, Nint) + use bitmasks + implicit none + integer(bit_kind),intent(inout) :: key(Nint,2,N_key) + integer,intent(out) :: idx(N_key) + integer,intent(out) :: shortcut(0:N_key+1) + integer(bit_kind),intent(out) :: version(Nint,N_key+1) + integer, intent(in) :: Nint, N_key + integer(bit_kind) :: tmp(Nint, 2,N_key) + + tmp(:,1,:N_key) = key(:,2,:N_key) + tmp(:,2,:N_key) = key(:,1,:N_key) + + call sort_dets_ab_v(tmp, idx, shortcut, version, N_key, Nint) + + key(:,1,:N_key) = tmp(:,2,:N_key) + key(:,2,:N_key) = tmp(:,1,:N_key) +end subroutine + + +subroutine sort_dets_ab_v(key, idx, shortcut, version, N_key, Nint) + use bitmasks + implicit none + + integer(bit_kind),intent(inout) :: key(Nint,2,N_key) + integer,intent(out) :: idx(N_key) + integer,intent(out) :: shortcut(0:N_key+1) + integer(bit_kind),intent(out) :: version(Nint,N_key+1) + integer, intent(in) :: Nint, N_key + integer(bit_kind) :: tmp(Nint, 2) + integer :: tmpidx,i,ni + + do i=1,N_key + idx(i) = i + end do + + do i=N_key/2,1,-1 + call tamiser(key, idx, i, N_key, Nint, N_key) + end do + + do i=N_key,2,-1 + tmp(:,:) = key(:,:,i) + key(:,:,i) = key(:,:,1) + key(:,:,1) = tmp(:,:) + tmpidx = idx(i) + idx(i) = idx(1) + idx(1) = tmpidx + call tamiser(key, idx, 1, i-1, Nint, N_key) + end do + + shortcut(0) = 1 + shortcut(1) = 1 + do i=2,N_key + do ni=1,nint + if(key(ni,1,i) /= key(ni,1,i-1)) then + shortcut(0) = shortcut(0) + 1 + shortcut(shortcut(0)) = i + version(:,shortcut(0)) = key(:,1,i) + exit + end if + end do + end do + shortcut(shortcut(0)+1) = N_key+1 +end subroutine + subroutine sort_dets_ab(key, idx, shortcut, N_key, Nint) use bitmasks diff --git a/src/Determinants/slater_rules.irp.f b/src/Determinants/slater_rules.irp.f index 72615089..06dcb9b7 100644 --- a/src/Determinants/slater_rules.irp.f +++ b/src/Determinants/slater_rules.irp.f @@ -1251,9 +1251,10 @@ subroutine H_u_0(v_0,u_0,H_jj,n,keys_tmp,shortcut,sort_idx,Nint) allocate(idx(0:n), vt(n)) Vt = 0.d0 v_0 = 0.d0 + !$OMP DO SCHEDULE(dynamic) - + do sh=1,shortcut(0) warp(1,0) = 0 do ii=1,sh!shortcut(0) diff --git a/src/Ezfio_files/README.rst b/src/Ezfio_files/README.rst index 986d7216..a612dcc7 100644 --- a/src/Ezfio_files/README.rst +++ b/src/Ezfio_files/README.rst @@ -203,83 +203,95 @@ Documentation Output file for Bitmask +`output_cas_sd `_ + Output file for CAS_SD + + `output_cpu_time_0 `_ Initial CPU and wall times when printing in the output files -`output_determinants `_ +`output_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_generators_full `_ +`output_full_ci `_ + Output file for Full_CI + + +`output_generators_cas `_ + Output file for Generators_CAS + + +`output_generators_full `_ Output file for Generators_full -`output_hartree_fock `_ +`output_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_mo_basis `_ +`output_mo_basis `_ Output file for MO_Basis -`output_moguess `_ +`output_moguess `_ Output file for MOGuess -`output_mrcc_cassd `_ +`output_mrcc_cassd `_ Output file for MRCC_CASSD -`output_mrcc_utils `_ +`output_mrcc_utils `_ Output file for MRCC_Utils -`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_psiref_cas `_ +`output_psiref_cas `_ Output file for Psiref_CAS -`output_psiref_utils `_ +`output_psiref_utils `_ Output file for Psiref_Utils -`output_selectors_full `_ +`output_selectors_full `_ Output file for Selectors_full -`output_utils `_ +`output_utils `_ Output file for Utils From 1064e7470ba7229a1897ea81961de06a552c9768 Mon Sep 17 00:00:00 2001 From: Yann Garniron Date: Thu, 29 Oct 2015 11:39:26 +0100 Subject: [PATCH 14/20] no more connected_to_ref in mrcc_dress + cleaning --- config/gfortran.cfg | 2 +- plugins/MRCC_Utils/README.rst | 821 +++++++++++++++++++++ plugins/MRCC_Utils/davidson.irp.f | 1 - plugins/MRCC_Utils/mrcc_dress.irp.f | 267 ++----- src/Determinants/README.rst | 926 ++++++++++++++++++++++++ src/Determinants/filter_connected.irp.f | 60 +- 6 files changed, 1799 insertions(+), 278 deletions(-) diff --git a/config/gfortran.cfg b/config/gfortran.cfg index 192e6d49..c1032aa1 100644 --- a/config/gfortran.cfg +++ b/config/gfortran.cfg @@ -10,7 +10,7 @@ # # [COMMON] -FC : gfortran -g -ffree-line-length-none -mavx -I . +FC : gfortran -g -ffree-line-length-none -I . LAPACK_LIB : -llapack -lblas IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 diff --git a/plugins/MRCC_Utils/README.rst b/plugins/MRCC_Utils/README.rst index e69de29b..a332ad0c 100644 --- a/plugins/MRCC_Utils/README.rst +++ b/plugins/MRCC_Utils/README.rst @@ -0,0 +1,821 @@ +Needed Modules +============== +.. Do not edit this section It was auto-generated +.. by the `update_README.py` script. + + +.. image:: tree_dependency.png + +* `Perturbation `_ +* `Selectors_full `_ +* `Generators_full `_ +* `Psiref_Utils `_ + +Documentation +============= +.. Do not edit this section It was auto-generated +.. by the `update_README.py` script. + + +`a_coef `_ + Undocumented + + +`abort_all `_ + If True, all the calculation is aborted + + +`abort_here `_ + If True, all the calculation is aborted + + +`add_poly `_ + Add two polynomials + D(t) =! D(t) +( B(t)+C(t)) + + +`add_poly_multiply `_ + Add a polynomial multiplied by a constant + D(t) =! D(t) +( cst * B(t)) + + +`align_double `_ + Compute 1st dimension such that it is aligned for vectorization. + + +`apply_rotation `_ + Apply the rotation found by find_rotation + + +`approx_dble `_ + Undocumented + + +`b_coef `_ + Undocumented + + +`binom `_ + Binomial coefficients + + +`binom_func `_ + .. math :: + .br + \frac{i!}{j!(i-j)!} + .br + + +`binom_transp `_ + Binomial coefficients + + +`catch_signal `_ + What to do on Ctrl-C. If two Ctrl-C are pressed within 1 sec, the calculation if aborted. + + +`ci_eigenvectors_dressed `_ + Eigenvectors/values of the CI matrix + + +`ci_eigenvectors_s2_dressed `_ + Eigenvectors/values of the CI matrix + + +`ci_electronic_energy_dressed `_ + Eigenvectors/values of the CI matrix + + +`ci_energy_dressed `_ + N_states lowest eigenvalues of the dressed CI matrix + + +`create_minilist `_ + Undocumented + + +`davidson_diag_hjj_mrcc `_ + Davidson diagonalization with specific diagonal elements of the H matrix + .br + H_jj : specific diagonal H matrix elements to diagonalize de Davidson + .br + dets_in : bitmasks corresponding to determinants + .br + u_in : guess coefficients on the various states. Overwritten + on exit + .br + dim_in : leftmost dimension of u_in + .br + sze : Number of determinants + .br + N_st : Number of eigenstates + .br + iunit : Unit for the I/O + .br + Initial guess vectors are not necessarily orthonormal + + +`davidson_diag_mrcc `_ + Davidson diagonalization. + .br + dets_in : bitmasks corresponding to determinants + .br + u_in : guess coefficients on the various states. Overwritten + on exit + .br + dim_in : leftmost dimension of u_in + .br + sze : Number of determinants + .br + N_st : Number of eigenstates + .br + iunit : Unit number for the I/O + .br + Initial guess vectors are not necessarily orthonormal + + +`dble_fact `_ + Undocumented + + +`dble_fact_even `_ + n!! + + +`dble_fact_odd `_ + n!! + + +`dble_logfact `_ + n!! + + +`ddfact2 `_ + Undocumented + + +`delta_ii `_ + Dressing matrix in N_det basis + + +`delta_ij `_ + Dressing matrix in N_det basis + + +`diagonalize_ci_dressed `_ + Replace the coefficients of the CI states by the coefficients of the + eigenstates of the CI matrix + + +`dset_order `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + + +`dset_order_big `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`dsort `_ + Sort array x(isize). + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`erf0 `_ + Undocumented + + +`f_integral `_ + function that calculates the following integral + \int_{\-infty}^{+\infty} x^n \exp(-p x^2) dx + + +`fact `_ + n! + + +`fact_inv `_ + 1/n! + + +`find_rotation `_ + Find A.C = B + + +`find_triples_and_quadruples `_ + Undocumented + + +`gammln `_ + Undocumented + + +`gammp `_ + Undocumented + + +`gaussian_product `_ + Gaussian product in 1D. + e^{-a (x-x_A)^2} e^{-b (x-x_B)^2} = K_{ab}^x e^{-p (x-x_P)^2} + + +`gaussian_product_x `_ + Gaussian product in 1D. + e^{-a (x-x_A)^2} e^{-b (x-x_B)^2} = K_{ab}^x e^{-p (x-x_P)^2} + + +`gcf `_ + Undocumented + + +`gen_det_idx `_ + Undocumented + + +`gen_det_shortcut `_ + Undocumented + + +`gen_det_sorted `_ + Undocumented + + +`gen_det_version `_ + Undocumented + + +`get_pseudo_inverse `_ + Find C = A^-1 + + +`give_explicit_poly_and_gaussian `_ + Transforms the product of + (x-x_A)^a(1) (x-x_B)^b(1) (x-x_A)^a(2) (y-y_B)^b(2) (z-z_A)^a(3) (z-z_B)^b(3) exp(-(r-A)^2 alpha) exp(-(r-B)^2 beta) + into + fact_k * [ sum (l_x = 0,i_order(1)) P_new(l_x,1) * (x-P_center(1))^l_x ] exp (- p (x-P_center(1))^2 ) + * [ sum (l_y = 0,i_order(2)) P_new(l_y,2) * (y-P_center(2))^l_y ] exp (- p (y-P_center(2))^2 ) + * [ sum (l_z = 0,i_order(3)) P_new(l_z,3) * (z-P_center(3))^l_z ] exp (- p (z-P_center(3))^2 ) + + +`give_explicit_poly_and_gaussian_double `_ + Transforms the product of + (x-x_A)^a(1) (x-x_B)^b(1) (x-x_A)^a(2) (y-y_B)^b(2) (z-z_A)^a(3) (z-z_B)^b(3) + exp(-(r-A)^2 alpha) exp(-(r-B)^2 beta) exp(-(r-Nucl_center)^2 gama + .br + into + fact_k * [ sum (l_x = 0,i_order(1)) P_new(l_x,1) * (x-P_center(1))^l_x ] exp (- p (x-P_center(1))^2 ) + * [ sum (l_y = 0,i_order(2)) P_new(l_y,2) * (y-P_center(2))^l_y ] exp (- p (y-P_center(2))^2 ) + * [ sum (l_z = 0,i_order(3)) P_new(l_z,3) * (z-P_center(3))^l_z ] exp (- p (z-P_center(3))^2 ) + + +`give_explicit_poly_and_gaussian_x `_ + Transform the product of + (x-x_A)^a(1) (x-x_B)^b(1) (x-x_A)^a(2) (y-y_B)^b(2) (z-z_A)^a(3) (z-z_B)^b(3) exp(-(r-A)^2 alpha) exp(-(r-B)^2 beta) + into + fact_k (x-x_P)^iorder(1) (y-y_P)^iorder(2) (z-z_P)^iorder(3) exp(-p(r-P)^2) + + +`gser `_ + Undocumented + + +`h_apply_mrcc `_ + Calls H_apply on the HF determinant and selects all connected single and double + excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. + + +`h_apply_mrcc_diexc `_ + Undocumented + + +`h_apply_mrcc_diexcorg `_ + Generate all double excitations of key_in using the bit masks of holes and + particles. + Assume N_int is already provided. + + +`h_apply_mrcc_diexcp `_ + Undocumented + + +`h_apply_mrcc_monoexc `_ + Generate all single excitations of key_in using the bit masks of holes and + particles. + Assume N_int is already provided. + + +`h_matrix_dressed `_ + Dressed H with Delta_ij + + +`h_u_0_mrcc `_ + Computes v_0 = H|u_0> + .br + n : number of determinants + .br + H_jj : array of + + +`h_u_0_mrcc_org `_ + Computes v_0 = H|u_0> + .br + n : number of determinants + .br + H_jj : array of + + +`heap_dsort `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`heap_dsort_big `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`heap_i2sort `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`heap_i2sort_big `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`heap_i8sort `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`heap_i8sort_big `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`heap_isort `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`heap_isort_big `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`heap_sort `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`heap_sort_big `_ + Sort array x(isize) using the heap sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`hermite `_ + Hermite polynomial + + +`i2radix_sort `_ + Sort integer array x(isize) using the radix sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + iradix should be -1 in input. + + +`i2set_order `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + + +`i2set_order_big `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`i2sort `_ + Sort array x(isize). + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`i8radix_sort `_ + Sort integer array x(isize) using the radix sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + iradix should be -1 in input. + + +`i8radix_sort_big `_ + Sort integer array x(isize) using the radix sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + iradix should be -1 in input. + + +`i8set_order `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + + +`i8set_order_big `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`i8sort `_ + Sort array x(isize). + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`insertion_dsort `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`insertion_dsort_big `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`insertion_i2sort `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`insertion_i2sort_big `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`insertion_i8sort `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`insertion_i8sort_big `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`insertion_isort `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`insertion_isort_big `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`insertion_sort `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`insertion_sort_big `_ + Sort array x(isize) using the insertion sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`inv_int `_ + 1/i + + +`iradix_sort `_ + Sort integer array x(isize) using the radix sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + iradix should be -1 in input. + + +`iradix_sort_big `_ + Sort integer array x(isize) using the radix sort algorithm. + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + iradix should be -1 in input. + + +`iset_order `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + + +`iset_order_big `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`isort `_ + Sort array x(isize). + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`lambda_mrcc `_ + cm/ or perturbative 1/Delta_E(m) + + +`lambda_mrcc_tmp `_ + Undocumented + + +`lambda_pert `_ + cm/ or perturbative 1/Delta_E(m) + + +`lapack_diag `_ + Diagonalize matrix H + .br + H is untouched between input and ouptut + .br + eigevalues(i) = ith lowest eigenvalue of the H matrix + .br + eigvectors(i,j) = where i is the basis function and psi_j is the j th eigenvector + .br + + +`lapack_diag_s2 `_ + Diagonalize matrix H + .br + H is untouched between input and ouptut + .br + eigevalues(i) = ith lowest eigenvalue of the H matrix + .br + eigvectors(i,j) = where i is the basis function and psi_j is the j th eigenvector + .br + + +`lapack_diagd `_ + Diagonalize matrix H + .br + H is untouched between input and ouptut + .br + eigevalues(i) = ith lowest eigenvalue of the H matrix + .br + eigvectors(i,j) = where i is the basis function and psi_j is the j th eigenvector + .br + + +`lapack_partial_diag `_ + Diagonalize matrix H + .br + H is untouched between input and ouptut + .br + eigevalues(i) = ith lowest eigenvalue of the H matrix + .br + eigvectors(i,j) = where i is the basis function and psi_j is the j th eigenvector + .br + + +`logfact `_ + n! + + +`mrcc_dress `_ + Undocumented + + +`mrcc_iterations `_ + Undocumented + + +`multiply_poly `_ + Multiply two polynomials + D(t) =! D(t) +( B(t)*C(t)) + + +`normalize `_ + Normalizes vector u + u is expected to be aligned in memory. + + +`nproc `_ + Number of current OpenMP threads + + +`ortho_lowdin `_ + Compute C_new=C_old.S^-1/2 canonical orthogonalization. + .br + overlap : overlap matrix + .br + LDA : leftmost dimension of overlap array + .br + N : Overlap matrix is NxN (array is (LDA,N) ) + .br + C : Coefficients of the vectors to orthogonalize. On exit, + orthogonal vectors + .br + LDC : leftmost dimension of C + .br + m : Coefficients matrix is MxN, ( array is (LDC,N) ) + .br + + +`oscillations `_ + Undocumented + + +`overlap_a_b_c `_ + Undocumented + + +`overlap_gaussian_x `_ + .. math:: + .br + \sum_{-infty}^{+infty} (x-A_x)^ax (x-B_x)^bx exp(-alpha(x-A_x)^2) exp(-beta(x-B_X)^2) dx + .br + + +`overlap_gaussian_xyz `_ + .. math:: + .br + S_x = \int (x-A_x)^{a_x} exp(-\alpha(x-A_x)^2) (x-B_x)^{b_x} exp(-beta(x-B_x)^2) dx \\ + S = S_x S_y S_z + .br + + +`overlap_x_abs `_ + .. math :: + .br + \int_{-infty}^{+infty} (x-A_center)^(power_A) * (x-B_center)^power_B * exp(-alpha(x-A_center)^2) * exp(-beta(x-B_center)^2) dx + .br + + +`pert_determinants `_ + Undocumented + + +`progress_active `_ + Current status for displaying progress bars. Global variable. + + +`progress_bar `_ + Current status for displaying progress bars. Global variable. + + +`progress_timeout `_ + Current status for displaying progress bars. Global variable. + + +`progress_title `_ + Current status for displaying progress bars. Global variable. + + +`progress_value `_ + Current status for displaying progress bars. Global variable. + + +`psi_ref_lock `_ + Locks on ref determinants to fill delta_ij + + +`recentered_poly2 `_ + Recenter two polynomials + + +`rint `_ + .. math:: + .br + \int_0^1 dx \exp(-p x^2) x^n + .br + + +`rint1 `_ + Standard version of rint + + +`rint_large_n `_ + Version of rint for large values of n + + +`rint_sum `_ + Needed for the calculation of two-electron integrals. + + +`rinteg `_ + Undocumented + + +`rintgauss `_ + Undocumented + + +`run_mrcc `_ + Undocumented + + +`run_progress `_ + Display a progress bar with documentation of what is happening + + +`sabpartial `_ + Undocumented + + +`set_generators_bitmasks_as_holes_and_particles `_ + Undocumented + + +`set_order `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + + +`set_order_big `_ + array A has already been sorted, and iorder has contains the new order of + elements of A. This subroutine changes the order of x to match the new order of A. + This is a version for very large arrays where the indices need + to be in integer*8 format + + +`set_zero_extra_diag `_ + Undocumented + + +`sort `_ + Sort array x(isize). + iorder in input should be (1,2,3,...,isize), and in output + contains the new order of the elements. + + +`start_progress `_ + Starts the progress bar + + +`stop_progress `_ + Stop the progress bar + + +`trap_signals `_ + What to do when a signal is caught. Here, trap Ctrl-C and call the control_C subroutine. + + +`u_dot_u `_ + Compute + + +`u_dot_v `_ + Compute + + +`wall_time `_ + The equivalent of cpu_time, but for the wall time. + + +`write_git_log `_ + Write the last git commit in file iunit. + diff --git a/plugins/MRCC_Utils/davidson.irp.f b/plugins/MRCC_Utils/davidson.irp.f index 2fa09575..abf1b63a 100644 --- a/plugins/MRCC_Utils/davidson.irp.f +++ b/plugins/MRCC_Utils/davidson.irp.f @@ -431,7 +431,6 @@ subroutine H_u_0_mrcc(v_0,u_0,H_jj,n,keys_tmp,shortcut,sort_idx,Nint,istate) do ii=shortcut(sh),shortcut(sh+1)-1 idx(0) = ii - !call filter_connected_davidson_mwen(keys_tmp,shortcut,keys_tmp(1,1,ii),Nint,ii-1,idx) call filter_connected_davidson_warp(keys_tmp,warp,keys_tmp(1,1,ii),Nint,ii-1,idx) i = sort_idx(ii) diff --git a/plugins/MRCC_Utils/mrcc_dress.irp.f b/plugins/MRCC_Utils/mrcc_dress.irp.f index 09b34033..7fb04144 100644 --- a/plugins/MRCC_Utils/mrcc_dress.irp.f +++ b/plugins/MRCC_Utils/mrcc_dress.irp.f @@ -91,22 +91,42 @@ subroutine mrcc_dress(delta_ij_, delta_ii_, Ndet_ref, Ndet_non_ref,i_generator,n integer :: iint, ipos integer :: i_state, k_sd, l_sd, i_I, i_alpha - integer(bit_kind) :: miniList(Nint, 2, N_det_non_ref), key_mask(Nint, 2) - integer :: idx_miniList(N_det_non_ref), N_miniList + integer(bit_kind),allocatable :: miniList(:,:,:) + integer(bit_kind),intent(in) :: key_mask(Nint, 2) + integer,allocatable :: idx_miniList(:) + integer :: N_miniList, ni -! N_miniList = 0 -! do i=i_generator-1,1,-1 -! k = popcnt(key_mask(1,1)) + popcnt(key_mask(1,2)) - popcnt(iand(key_mask(1,1), psi_det_generators(1,1,i))) - popcnt(iand(key_mask(1,2), psi_det_generators(1,2,i))) -! if(k == 0) then -! return -! end if -! if(k <= 2) then -! N_minilist += 1 -! miniList(:,:,N_minilist) = psi_det_generators(:,:,i) -! end if -! end do + allocate(miniList(Nint, 2, max(N_det_generators, N_det_non_ref)), idx_miniList(max(N_det_generators, N_det_non_ref))) + + l = 0 + do ni = 1,Nint + l += popcnt(key_mask(ni,1)) + popcnt(key_mask(ni,2)) + end do + + if(l == 0) then + N_miniList = i_generator-1 + miniList(:,:,:N_miniList) = psi_det_generators(:,:,:N_minilist) + else + N_miniList = 0 + do i=i_generator-1,1,-1 + k = l + do ni=1,nint + k -= popcnt(iand(key_mask(ni,1), psi_det_generators(ni,1,i))) + popcnt(iand(key_mask(ni,2), psi_det_generators(ni,2,i))) + end do + + if(k == 0) then + deallocate(miniList, idx_miniList) + return + end if + if(k <= 2) then + N_minilist += 1 + miniList(:,:,N_minilist) = psi_det_generators(:,:,i) + end if + end do + end if + call find_triples_and_quadruples(i_generator,n_selected,det_buffer,Nint,tq,N_tq,miniList,N_minilist) @@ -227,71 +247,19 @@ subroutine mrcc_dress(delta_ij_, delta_ii_, Ndet_ref, Ndet_non_ref,i_generator,n enddo enddo deallocate (dIa_hla) + deallocate(miniList, idx_miniList) end - - - - -! subroutine mrcc_dress_simple(delta_ij_non_ref_,Ndet_non_ref,i_generator,n_selected,det_buffer,Nint,iproc) -! use bitmasks -! implicit none -! -! integer, intent(in) :: i_generator,n_selected, Nint, iproc -! integer, intent(in) :: Ndet_non_ref -! double precision, intent(inout) :: delta_ij_non_ref_(Ndet_non_ref,Ndet_non_ref,*) -! -! integer(bit_kind), intent(in) :: det_buffer(Nint,2,n_selected) -! integer :: i,j,k,m -! integer :: new_size -! integer :: degree(psi_det_size) -! integer :: idx(0:psi_det_size) -! logical :: good -! -! integer(bit_kind) :: tq(Nint,2,n_selected) -! integer :: N_tq, c_ref -! integer :: connected_to_ref -! -! -! call find_triples_and_quadruples(i_generator,n_selected,det_buffer,Nint,tq,N_tq) -! -! ! Compute / (E0 - Haa) -! double precision :: hka, haa -! double precision :: haj -! double precision :: f(N_states) -! -! do i=1,N_tq -! call get_excitation_degree_vector(psi_non_ref,tq(1,1,i),degree,Nint,Ndet_non_ref,idx) -! call i_h_j(tq(1,1,i),tq(1,1,i),Nint,haa) -! do m=1,N_states -! f(m) = 1.d0/(ci_electronic_energy(m)-haa) -! enddo -! do k=1,idx(0) -! call i_h_j(tq(1,1,i),psi_non_ref(1,1,idx(k)),Nint,hka) -! do j=k,idx(0) -! call i_h_j(tq(1,1,i),psi_non_ref(1,1,idx(j)),Nint,haj) -! do m=1,N_states -! delta_ij_non_ref_(idx(k), idx(j),m) += haj*hka* f(m) -! delta_ij_non_ref_(idx(j), idx(k),m) += haj*hka* f(m) -! enddo -! enddo -! enddo -! enddo -! end - - BEGIN_PROVIDER [ integer(bit_kind), gen_det_sorted, (N_int,2,N_det_generators,2) ] &BEGIN_PROVIDER [ integer, gen_det_shortcut, (0:N_det_generators,2) ] &BEGIN_PROVIDER [ integer, gen_det_version, (N_int, N_det_generators,2) ] &BEGIN_PROVIDER [ integer, gen_det_idx, (N_det_generators,2) ] - gen_det_sorted(:,:,:,1) = psi_det_generators(:,:,:N_det_generators) gen_det_sorted(:,:,:,2) = psi_det_generators(:,:,:N_det_generators) call sort_dets_ab_v(gen_det_sorted(:,:,:,1), gen_det_idx(:,1), gen_det_shortcut(0:,1), gen_det_version(:,:,1), N_det_generators, N_int) call sort_dets_ba_v(gen_det_sorted(:,:,:,2), gen_det_idx(:,2), gen_det_shortcut(0:,2), gen_det_version(:,:,2), N_det_generators, N_int) - print *, " *********************** ", gen_det_shortcut(0,:) END_PROVIDER @@ -311,166 +279,32 @@ subroutine find_triples_and_quadruples(i_generator,n_selected,det_buffer,Nint,tq integer(bit_kind), intent(out) :: tq(Nint,2,n_selected) integer, intent(out) :: N_tq - integer :: c_ref - integer :: connected_to_ref - integer :: na, nb, nt,mex, lex, sh,ni + integer :: nt,ni - integer(bit_kind),intent(in) :: miniList(Nint,2,N_det_generators) + integer(bit_kind),intent(in) :: miniList(Nint,2,N_det_generators) integer,intent(in) :: N_miniList - N_tq = 0 - do i=1,N_selected -! c_ref = 0 -! do j=1,N_miniList -! na = popcnt(xor(miniList(1,1,j), det_buffer(1,1,i))) -! nb = popcnt(xor(miniList(1,2,j), det_buffer(1,2,i))) -! if(na+nb <= 4) then -! c_ref = 1 -! exit -! end if -! end do - - -! -! if(Nint /= 1) then -! c_ref = 0 -! na = 0 -! nb = 0 -! do ni=1,Nint -! na += popcnt(xor(det_buffer(ni,1,i), psi_ref(ni,1,1))) -! nb += popcnt(xor(det_buffer(ni,2,i), psi_ref(ni,2,1))) -! end do -! if(na > nb) then -! mex = 1 -! lex = 2 -! else -! mex = 2 -! lex = 1 -! end if -! -! -! sh_loop : do sh=1,gen_det_shortcut(0,lex) -! do ni=1,Nint -! if(det_buffer(ni,lex,i) /= gen_det_sorted(ni,lex,gen_det_shortcut(sh, lex),lex)) then -! cycle sh_loop -! end if -! end do -! do j=gen_det_shortcut(sh,lex),gen_det_shortcut(sh+1,lex)-1 -! if(gen_det_idx(j,lex) >= i_generator) then -! cycle -! end if -! nt = 0 -! do ni=1,nint -! nt += popcnt(xor(det_buffer(ni,mex,i), gen_det_sorted(ni,mex,j,lex))) -! end do -! if(nt <= 4) then -! ! if(gen_det_idx(j,lex) < i_generator) then -! c_ref = 1!gen_det_idx(j,lex) -! exit sh_loop -! ! end if -! end if -! end do -! exit sh_loop -! end do sh_loop -! -! if(c_ref == 0) then -! sh_loop2 : do sh = 1,gen_det_shortcut(0,mex) -! na = 0 -! do ni=1,Nint -! na += popcnt(xor(det_buffer(ni,mex,i), gen_det_sorted(ni,mex,gen_det_shortcut(sh, mex),mex))) -! end do -! if(na > 2) then -! cycle -! end if - -! do j=gen_det_shortcut(sh, mex), gen_det_shortcut(sh+1,mex)-1 -! if(gen_det_idx(j,mex) >= i_generator) then -! cycle -! end if -! nt = na -! do ni=1,Nint -! nt += popcnt(xor(det_buffer(ni,lex,i), gen_det_sorted(ni,lex,j,mex))) -! end do -! if(nt <= 4) then -! ! if(gen_det_idx(j,mex) < i_generator) then -! c_ref = 2!gen_det_idx(j,mex) -! exit sh_loop2 -! ! end if -! end if -! end do -! end do sh_loop2 -! end if -! else -! c_ref = 0 -! na = popcnt(xor(det_buffer(1,1,i), psi_ref(1,1,1))) -! nb = popcnt(xor(det_buffer(1,2,i), psi_ref(1,2,1))) -! if(na > nb) then -! mex = 1 -! lex = 2 -! else -! mex = 2 -! lex = 1 -! end if -! -! -! sh_loop3 : do sh=1,gen_det_shortcut(0,lex) -! if(det_buffer(1,lex,i) /= gen_det_version(1,sh,lex)) then!gen_det_sorted(1,lex,gen_det_shortcut(sh, lex),lex)) then -! cycle sh_loop3 -! end if -! do j=gen_det_shortcut(sh,lex),gen_det_shortcut(sh+1,lex)-1 -! if(gen_det_idx(j,lex) >= i_generator) then -! cycle -! end if -! nt = popcnt(xor(det_buffer(1,mex,i), gen_det_sorted(1,mex,j,lex))) -! if(nt <= 4) then -! ! if(gen_det_idx(j,lex) < i_generator) then -! c_ref = 1!gen_det_idx(j,lex) -! exit sh_loop3 -! ! end if -! end if -! end do -! exit sh_loop3 -! end do sh_loop3 -! -! if(c_ref == 0) then -! sh_loop4 : do sh = 1,gen_det_shortcut(0,mex) -! na = popcnt(xor(det_buffer(1,mex,i),gen_det_version(1,sh,mex)))! gen_det_sorted(1,mex,gen_det_shortcut(sh, mex),mex))) -! if(na > 2) then -! cycle sh_loop4 -! end if -! do j=gen_det_shortcut(sh, mex), gen_det_shortcut(sh+1,mex)-1 -! if(gen_det_idx(j,mex) >= i_generator) then -! cycle -! end if -! nt = na -! nt += popcnt(xor(det_buffer(1,lex,i), gen_det_sorted(1,lex,j,mex))) -! if(nt <= 4) then -! ! if(gen_det_idx(j,mex) < i_generator) then -! c_ref = 2!gen_det_idx(j,mex) -! exit sh_loop4 -! ! end if -! end if -! end do -! end do sh_loop4 -! end if + i_loop : do i=1,N_selected + do j=1,N_miniList + nt = 0 + do ni=1,Nint + nt += popcnt(xor(miniList(ni,1,j), det_buffer(ni,1,i))) + popcnt(xor(miniList(ni,2,j), det_buffer(ni,2,i))) + end do + if(nt <= 4) then + cycle i_loop + end if + end do +! if(connected_to_ref(det_buffer(1,1,i),psi_det_generators,Nint, & +! i_generator,N_det_generators) /= 0) then +! cycle i_loop ! end if - - - c_ref = connected_to_ref(det_buffer(1,1,i),psi_det_generators,Nint, & - i_generator,N_det_generators) - - - if (c_ref /= 0) then - cycle - endif - ! Select determinants that are triple or quadruple excitations ! from the ref good = .True. @@ -491,8 +325,7 @@ subroutine find_triples_and_quadruples(i_generator,n_selected,det_buffer,Nint,tq enddo endif endif - enddo - + enddo i_loop end diff --git a/src/Determinants/README.rst b/src/Determinants/README.rst index e69de29b..17b69577 100644 --- a/src/Determinants/README.rst +++ b/src/Determinants/README.rst @@ -0,0 +1,926 @@ +Needed Modules +============== +.. Do not edit this section It was auto-generated +.. by the `update_README.py` script. + + +.. image:: tree_dependency.png + +* `Integrals_Monoelec `_ +* `Integrals_Bielec `_ + +Documentation +============= +.. Do not edit this section It was auto-generated +.. by the `update_README.py` script. + + +`a_operator `_ + Needed for diag_H_mat_elem + + +`abs_psi_coef_max `_ + Max and min values of the coefficients + + +`abs_psi_coef_min `_ + Max and min values of the coefficients + + +`ac_operator `_ + Needed for diag_H_mat_elem + + +`apply_mono `_ + Undocumented + + +`bi_elec_ref_bitmask_energy `_ + Energy of the reference bitmask used in Slater rules + + +`ci_eigenvectors `_ + Eigenvectors/values of the CI matrix + + +`ci_eigenvectors_mono `_ + Eigenvectors/values of the CI matrix + + +`ci_eigenvectors_s2 `_ + Eigenvectors/values of the CI matrix + + +`ci_eigenvectors_s2_mono `_ + Eigenvectors/values of the CI matrix + + +`ci_electronic_energy `_ + Eigenvectors/values of the CI matrix + + +`ci_electronic_energy_mono `_ + Eigenvectors/values of the CI matrix + + +`ci_energy `_ + N_states lowest eigenvalues of the CI matrix + + +`ci_sc2_eigenvectors `_ + Eigenvectors/values of the CI matrix + + +`ci_sc2_electronic_energy `_ + Eigenvectors/values of the CI matrix + + +`ci_sc2_energy `_ + N_states_diag lowest eigenvalues of the CI matrix + + +`cisd `_ + Undocumented + + +`cisd_sc2 `_ + CISD+SC2 method :: take off all the disconnected terms of a CISD (selected or not) + .br + dets_in : bitmasks corresponding to determinants + .br + u_in : guess coefficients on the various states. Overwritten + on exit + .br + dim_in : leftmost dimension of u_in + .br + sze : Number of determinants + .br + N_st : Number of eigenstates + .br + Initial guess vectors are not necessarily orthonormal + + +`connected_to_ref `_ + Undocumented + + +`connected_to_ref_by_mono `_ + Undocumented + + +`copy_h_apply_buffer_to_wf `_ + Copies the H_apply buffer to psi_coef. + After calling this subroutine, N_det, psi_det and psi_coef need to be touched + + +`create_wf_of_psi_bilinear_matrix `_ + Generate a wave function containing all possible products + of alpha and beta determinants + + +`davidson_converged `_ + True if the Davidson algorithm is converged + + +`davidson_criterion `_ + Can be : [ energy | residual | both | wall_time | cpu_time | iterations ] + + +`davidson_diag `_ + Davidson diagonalization. + .br + dets_in : bitmasks corresponding to determinants + .br + u_in : guess coefficients on the various states. Overwritten + on exit + .br + dim_in : leftmost dimension of u_in + .br + sze : Number of determinants + .br + N_st : Number of eigenstates + .br + iunit : Unit number for the I/O + .br + Initial guess vectors are not necessarily orthonormal + + +`davidson_diag_hjj `_ + Davidson diagonalization with specific diagonal elements of the H matrix + .br + H_jj : specific diagonal H matrix elements to diagonalize de Davidson + .br + dets_in : bitmasks corresponding to determinants + .br + u_in : guess coefficients on the various states. Overwritten + on exit + .br + dim_in : leftmost dimension of u_in + .br + sze : Number of determinants + .br + N_st : Number of eigenstates + .br + iunit : Unit for the I/O + .br + Initial guess vectors are not necessarily orthonormal + + +`davidson_iter_max `_ + Max number of Davidson iterations + + +`davidson_sze_max `_ + Max number of Davidson sizes + + +`davidson_threshold `_ + Can be : [ energy | residual | both | wall_time | cpu_time | iterations ] + + +`decode_exc `_ + Decodes the exc arrays returned by get_excitation. + h1,h2 : Holes + p1,p2 : Particles + s1,s2 : Spins (1:alpha, 2:beta) + degree : Degree of excitation + + +`det_coef `_ + det_coef + + +`det_connections `_ + Build connection proxy between determinants + + +`det_inf `_ + Undocumented + + +`det_num `_ + det_num + + +`det_occ `_ + det_occ + + +`det_search_key `_ + Return an integer*8 corresponding to a determinant index for searching + + +`det_to_occ_pattern `_ + Transform a determinant to an occupation pattern + + +`diag_algorithm `_ + Diagonalization algorithm (Davidson or Lapack) + + +`diag_h_mat_elem `_ + Computes + + +`diagonalize_ci `_ + Replace the coefficients of the CI states by the coefficients of the + eigenstates of the CI matrix + + +`diagonalize_ci_mono `_ + Replace the coefficients of the CI states by the coefficients of the + eigenstates of the CI matrix + + +`diagonalize_ci_sc2 `_ + Replace the coefficients of the CI states_diag by the coefficients of the + eigenstates of the CI matrix + + +`do_mono_excitation `_ + Apply the mono excitation operator : a^{dager}_(i_particle) a_(i_hole) of spin = ispin + on key_in + ispin = 1 == alpha + ispin = 2 == beta + i_ok = 1 == the excitation is possible + i_ok = -1 == the excitation is not possible + + +`double_exc_bitmask `_ + double_exc_bitmask(:,1,i) is the bitmask for holes of excitation 1 + double_exc_bitmask(:,2,i) is the bitmask for particles of excitation 1 + double_exc_bitmask(:,3,i) is the bitmask for holes of excitation 2 + double_exc_bitmask(:,4,i) is the bitmask for particles of excitation 2 + for a given couple of hole/particle excitations i. + + +`expected_s2 `_ + Expected value of S2 : S*(S+1) + + +`fill_h_apply_buffer_no_selection `_ + Fill the H_apply buffer with determiants for CISD + + +`filter_3_highest_electrons `_ + Returns a determinant with only the 3 highest electrons + + +`filter_connected `_ + Filters out the determinants that are not connected by H + .br + returns the array idx which contains the index of the + .br + determinants in the array key1 that interact + .br + via the H operator with key2. + .br + idx(0) is the number of determinants that interact with key1 + + +`filter_connected_davidson `_ + Filters out the determinants that are not connected by H + returns the array idx which contains the index of the + determinants in the array key1 that interact + via the H operator with key2. + .br + idx(0) is the number of determinants that interact with key1 + key1 should come from psi_det_sorted_ab. + + +`filter_connected_davidson_shortcut `_ + Filters out the determinants that are not connected by H + returns the array idx which contains the index of the + determinants in the array key1 that interact + via the H operator with key2. + .br + idx(0) is the number of determinants that interact with key1 + key1 should come from psi_det_sorted_ab. + + +`filter_connected_davidson_warp `_ + Filters out the determinants that are not connected by H + returns the array idx which contains the index of the + determinants in the array key1 that interact + via the H operator with key2. + .br + idx(0) is the number of determinants that interact with key1 + key1 should come from psi_det_sorted_ab. + + +`filter_connected_i_h_psi0 `_ + returns the array idx which contains the index of the + .br + determinants in the array key1 that interact + .br + via the H operator with key2. + .br + idx(0) is the number of determinants that interact with key1 + + +`filter_connected_i_h_psi0_sc2 `_ + standard filter_connected_i_H_psi but returns in addition + .br + the array of the index of the non connected determinants to key1 + .br + in order to know what double excitation can be repeated on key1 + .br + idx_repeat(0) is the number of determinants that can be used + .br + to repeat the excitations + + +`generate_all_alpha_beta_det_products `_ + Create a wave function from all possible alpha x beta determinants + + +`get_double_excitation `_ + Returns the two excitation operators between two doubly excited determinants and the phase + + +`get_excitation `_ + Returns the excitation operators between two determinants and the phase + + +`get_excitation_degree `_ + Returns the excitation degree between two determinants + + +`get_excitation_degree_vector `_ + Applies get_excitation_degree to an array of determinants + + +`get_index_in_psi_det_alpha_unique `_ + Returns the index of the determinant in the ``psi_det_alpha_unique`` array + + +`get_index_in_psi_det_beta_unique `_ + Returns the index of the determinant in the ``psi_det_beta_unique`` array + + +`get_index_in_psi_det_sorted_bit `_ + Returns the index of the determinant in the ``psi_det_sorted_bit`` array + + +`get_mono_excitation `_ + Returns the excitation operator between two singly excited determinants and the phase + + +`get_occ_from_key `_ + Returns a list of occupation numbers from a bitstring + + +`get_s2 `_ + Returns + + +`get_s2_u0 `_ + Undocumented + + +`get_s2_u0_old `_ + Undocumented + + +`h_apply_buffer_allocated `_ + Buffer of determinants/coefficients/perturbative energy for H_apply. + Uninitialized. Filled by H_apply subroutines. + + +`h_apply_buffer_lock `_ + Buffer of determinants/coefficients/perturbative energy for H_apply. + Uninitialized. Filled by H_apply subroutines. + + +`h_matrix_all_dets `_ + H matrix on the basis of the slater determinants defined by psi_det + + +`h_matrix_cas `_ + Undocumented + + +`h_u_0 `_ + Computes v_0 = H|u_0> + .br + n : number of determinants + .br + H_jj : array of + + +`h_u_0_org `_ + Computes v_0 = H|u_0> + .br + n : number of determinants + .br + H_jj : array of + + +`i_h_j `_ + Returns where i and j are determinants + + +`i_h_j_phase_out `_ + Returns where i and j are determinants + + +`i_h_j_verbose `_ + Returns where i and j are determinants + + +`i_h_psi `_ + for the various Nstates + + +`i_h_psi_sc2 `_ + for the various Nstate + .br + returns in addition + .br + the array of the index of the non connected determinants to key1 + .br + in order to know what double excitation can be repeated on key1 + .br + idx_repeat(0) is the number of determinants that can be used + .br + to repeat the excitations + + +`i_h_psi_sc2_verbose `_ + for the various Nstate + .br + returns in addition + .br + the array of the index of the non connected determinants to key1 + .br + in order to know what double excitation can be repeated on key1 + .br + idx_repeat(0) is the number of determinants that can be used + .br + to repeat the excitations + + +`i_h_psi_sec_ord `_ + for the various Nstates + + +`idx_cas `_ + CAS wave function, defined from the application of the CAS bitmask on the + determinants. idx_cas gives the indice of the CAS determinant in psi_det. + + +`idx_non_cas `_ + Set of determinants which are not part of the CAS, defined from the application + of the CAS bitmask on the determinants. + idx_non_cas gives the indice of the determinant in psi_det. + + +`int_of_3_highest_electrons `_ + Returns an integer*8 as : + .br + |_<--- 21 bits ---><--- 21 bits ---><--- 21 bits --->| + .br + |0<--- i1 ---><--- i2 ---><--- i3 --->| + .br + It encodes the value of the indices of the 3 highest MOs + in descending order + .br + + +`is_in_wavefunction `_ + True if the determinant ``det`` is in the wave function + + +`kinetic_ref_bitmask_energy `_ + Energy of the reference bitmask used in Slater rules + + +`make_s2_eigenfunction `_ + Undocumented + + +`max_degree_exc `_ + Maximum degree of excitation in the wf + + +`mono_elec_ref_bitmask_energy `_ + Energy of the reference bitmask used in Slater rules + + +`n_con_int `_ + Number of integers to represent the connections between determinants + + +`n_det `_ + Number of determinants in the wave function + + +`n_det_alpha_unique `_ + Unique alpha determinants + + +`n_det_beta_unique `_ + Unique beta determinants + + +`n_det_cas `_ + CAS wave function, defined from the application of the CAS bitmask on the + determinants. idx_cas gives the indice of the CAS determinant in psi_det. + + +`n_det_max `_ + Max number of determinants in the wave function + + +`n_det_max_jacobi `_ + Maximum number of determinants diagonalized by Jacobi + + +`n_det_max_property `_ + Max number of determinants in the wave function when you select for a given property + + +`n_det_non_cas `_ + Set of determinants which are not part of the CAS, defined from the application + of the CAS bitmask on the determinants. + idx_non_cas gives the indice of the determinant in psi_det. + + +`n_double_exc_bitmasks `_ + Number of double excitation bitmasks + + +`n_occ_pattern `_ + array of the occ_pattern present in the wf + psi_occ_pattern(:,1,j) = jth occ_pattern of the wave function : represent all the single occupation + psi_occ_pattern(:,2,j) = jth occ_pattern of the wave function : represent all the double occupation + + +`n_single_exc_bitmasks `_ + Number of single excitation bitmasks + + +`n_states `_ + Number of states to consider + + +`n_states_diag `_ + Number of states to consider for the diagonalization + + +`nucl_elec_ref_bitmask_energy `_ + Energy of the reference bitmask used in Slater rules + + +`occ_pattern_search_key `_ + Return an integer*8 corresponding to a determinant index for searching + + +`occ_pattern_to_dets `_ + Generate all possible determinants for a give occ_pattern + + +`occ_pattern_to_dets_size `_ + Number of possible determinants for a given occ_pattern + + +`one_body_dm_mo `_ + One-body density matrix + + +`one_body_dm_mo_alpha `_ + Alpha and beta one-body density matrix for each state + + +`one_body_dm_mo_beta `_ + Alpha and beta one-body density matrix for each state + + +`one_body_single_double_dm_mo_alpha `_ + Alpha and beta one-body density matrix for each state + + +`one_body_single_double_dm_mo_beta `_ + Alpha and beta one-body density matrix for each state + + +`one_body_spin_density_mo `_ + rho(alpha) - rho(beta) + + +`only_single_double_dm `_ + If true, The One body DM is calculated with ignoring the Double<->Doubles extra diag elements + + +`pouet `_ + Undocumented + + +`psi_average_norm_contrib `_ + Contribution of determinants to the state-averaged density + + +`psi_average_norm_contrib_sorted `_ + Wave function sorted by determinants contribution to the norm (state-averaged) + + +`psi_bilinear_matrix `_ + Coefficient matrix if the wave function is expressed in a bilinear form : + D_a^t C D_b + + +`psi_bilinear_matrix_columns `_ + Sparse coefficient matrix if the wave function is expressed in a bilinear form : + D_a^t C D_b + + +`psi_bilinear_matrix_rows `_ + Sparse coefficient matrix if the wave function is expressed in a bilinear form : + D_a^t C D_b + + +`psi_bilinear_matrix_values `_ + Sparse coefficient matrix if the wave function is expressed in a bilinear form : + D_a^t C D_b + + +`psi_cas `_ + CAS wave function, defined from the application of the CAS bitmask on the + determinants. idx_cas gives the indice of the CAS determinant in psi_det. + + +`psi_cas_coef `_ + CAS wave function, defined from the application of the CAS bitmask on the + determinants. idx_cas gives the indice of the CAS determinant in psi_det. + + +`psi_cas_coef_sorted_bit `_ + CAS determinants sorted to accelerate the search of a random determinant in the wave + function. + + +`psi_cas_energy `_ + Undocumented + + +`psi_cas_energy_diagonalized `_ + Undocumented + + +`psi_cas_sorted_bit `_ + CAS determinants sorted to accelerate the search of a random determinant in the wave + function. + + +`psi_coef `_ + The wave function coefficients. Initialized with Hartree-Fock if the EZFIO file + is empty + + +`psi_coef_cas_diagonalized `_ + Undocumented + + +`psi_coef_max `_ + Max and min values of the coefficients + + +`psi_coef_min `_ + Max and min values of the coefficients + + +`psi_coef_sorted `_ + Wave function sorted by determinants contribution to the norm (state-averaged) + + +`psi_coef_sorted_ab `_ + Determinants on which we apply . + They are sorted by the 3 highest electrons in the alpha part, + then by the 3 highest electrons in the beta part to accelerate + the research of connected determinants. + + +`psi_coef_sorted_bit `_ + Determinants on which we apply for perturbation. + They are sorted by determinants interpreted as integers. Useful + to accelerate the search of a random determinant in the wave + function. + + +`psi_det `_ + The wave function determinants. Initialized with Hartree-Fock if the EZFIO file + is empty + + +`psi_det_alpha `_ + List of alpha determinants of psi_det + + +`psi_det_alpha_unique `_ + Unique alpha determinants + + +`psi_det_beta `_ + List of beta determinants of psi_det + + +`psi_det_beta_unique `_ + Unique beta determinants + + +`psi_det_size `_ + Size of the psi_det/psi_coef arrays + + +`psi_det_sorted `_ + Wave function sorted by determinants contribution to the norm (state-averaged) + + +`psi_det_sorted_ab `_ + Determinants on which we apply . + They are sorted by the 3 highest electrons in the alpha part, + then by the 3 highest electrons in the beta part to accelerate + the research of connected determinants. + + +`psi_det_sorted_bit `_ + Determinants on which we apply for perturbation. + They are sorted by determinants interpreted as integers. Useful + to accelerate the search of a random determinant in the wave + function. + + +`psi_det_sorted_next_ab `_ + Determinants on which we apply . + They are sorted by the 3 highest electrons in the alpha part, + then by the 3 highest electrons in the beta part to accelerate + the research of connected determinants. + + +`psi_non_cas `_ + Set of determinants which are not part of the CAS, defined from the application + of the CAS bitmask on the determinants. + idx_non_cas gives the indice of the determinant in psi_det. + + +`psi_non_cas_coef `_ + Set of determinants which are not part of the CAS, defined from the application + of the CAS bitmask on the determinants. + idx_non_cas gives the indice of the determinant in psi_det. + + +`psi_non_cas_coef_sorted_bit `_ + CAS determinants sorted to accelerate the search of a random determinant in the wave + function. + + +`psi_non_cas_sorted_bit `_ + CAS determinants sorted to accelerate the search of a random determinant in the wave + function. + + +`psi_occ_pattern `_ + array of the occ_pattern present in the wf + psi_occ_pattern(:,1,j) = jth occ_pattern of the wave function : represent all the single occupation + psi_occ_pattern(:,2,j) = jth occ_pattern of the wave function : represent all the double occupation + + +`put_gess `_ + Undocumented + + +`read_dets `_ + Reads the determinants from the EZFIO file + + +`read_wf `_ + If true, read the wave function from the EZFIO file + + +`rec_occ_pattern_to_dets `_ + Undocumented + + +`ref_bitmask_energy `_ + Energy of the reference bitmask used in Slater rules + + +`remove_duplicates_in_psi_det `_ + Removes duplicate determinants in the wave function. + + +`resize_h_apply_buffer `_ + Resizes the H_apply buffer of proc iproc. The buffer lock should + be set before calling this function. + + +`routine `_ + Undocumented + + +`s2_eig `_ + Force the wave function to be an eigenfunction of S^2 + + +`s2_values `_ + array of the averaged values of the S^2 operator on the various states + + +`s_z `_ + z component of the Spin + + +`s_z2_sz `_ + z component of the Spin + + +`save_natorb `_ + Undocumented + + +`save_natural_mos `_ + Save natural orbitals, obtained by diagonalization of the one-body density matrix in the MO basis + + +`save_wavefunction `_ + Save the wave function into the EZFIO file + + +`save_wavefunction_general `_ + Save the wave function into the EZFIO file + + +`save_wavefunction_specified `_ + Save the wave function into the EZFIO file + + +`save_wavefunction_unsorted `_ + Save the wave function into the EZFIO file + + +`set_bite_to_integer `_ + Undocumented + + +`set_natural_mos `_ + Set natural orbitals, obtained by diagonalization of the one-body density matrix in the MO basis + + +`single_exc_bitmask `_ + single_exc_bitmask(:,1,i) is the bitmask for holes + single_exc_bitmask(:,2,i) is the bitmask for particles + for a given couple of hole/particle excitations i. + + +`sort_dets_ab `_ + Undocumented + + +`sort_dets_ab_v `_ + Undocumented + + +`sort_dets_ba_v `_ + Undocumented + + +`sort_dets_by_3_highest_electrons `_ + Determinants on which we apply . + They are sorted by the 3 highest electrons in the alpha part, + then by the 3 highest electrons in the beta part to accelerate + the research of connected determinants. + + +`sort_dets_by_det_search_key `_ + Determinants are sorted are sorted according to their det_search_key. + Useful to accelerate the search of a random determinant in the wave + function. + + +`spin_det_search_key `_ + Return an integer*8 corresponding to a determinant index for searching + + +`state_average_weight `_ + Weights in the state-average calculation of the density matrix + + +`tamiser `_ + Undocumented + + +`threshold_convergence_sc2 `_ + convergence of the correlation energy of SC2 iterations + + +`threshold_generators `_ + Thresholds on generators (fraction of the norm) + + +`threshold_selectors `_ + Thresholds on selectors (fraction of the norm) + + +`write_spindeterminants `_ + Undocumented + diff --git a/src/Determinants/filter_connected.irp.f b/src/Determinants/filter_connected.irp.f index f55643bd..ed4f092e 100644 --- a/src/Determinants/filter_connected.irp.f +++ b/src/Determinants/filter_connected.irp.f @@ -98,65 +98,6 @@ subroutine filter_connected(key1,key2,Nint,sze,idx) end -subroutine filter_connected_sorted_ab(key1,key2,next,Nint,sze,idx) - use bitmasks - implicit none - BEGIN_DOC - ! Filters out the determinants that are not connected by H - ! returns the array idx which contains the index of the - ! determinants in the array key1 that interact - ! via the H operator with key2. - ! idx(0) is the number of determinants that interact with key1 - ! - ! Determinants are taken from the psi_det_sorted_ab array - END_DOC - integer, intent(in) :: Nint, sze - integer, intent(in) :: next(2,N_det) - integer(bit_kind), intent(in) :: key1(Nint,2,sze) - integer(bit_kind), intent(in) :: key2(Nint,2) - integer, intent(out) :: idx(0:sze) - - integer :: i,j,l - integer :: degree_x2 - integer(bit_kind) :: det3_1(Nint,2), det3_2(Nint,2) - - ASSERT (Nint > 0) - ASSERT (sze >= 0) - - l=1 - - call filter_3_highest_electrons( key2(1,1), det3_2(1,1), Nint) - if (Nint==1) then - - i = 1 - do while ( i<= sze ) - call filter_3_highest_electrons( key1(1,1,i), det3_1(1,1), Nint) - degree_x2 = popcnt( xor( det3_1(1,1), det3_2(1,1))) - if (degree_x2 > 4) then - i = next(1,i) - cycle - else - degree_x2 = popcnt( xor( key1(1,1,i), key2(1,1)) ) - if (degree_x2 <= 4) then - degree_x2 += popcnt( xor( key1(1,2,i), key2(1,2)) ) - if (degree_x2 <= 4) then - idx(l) = i - l += 1 - endif - endif - i += 1 - endif - enddo - - else - - print *, 'Not implemented', irp_here - stop 1 - - endif - idx(0) = l-1 -end - subroutine filter_connected_davidson_warp(key1,warp,key2,Nint,sze,idx) use bitmasks @@ -337,6 +278,7 @@ subroutine filter_connected_davidson(key1,key2,Nint,sze,idx) PROVIDE N_con_int det_connections + ASSERT (Nint > 0) ASSERT (sze >= 0) From 3eec2f5683cd320d69f15fd492ebce20dd6cbc71 Mon Sep 17 00:00:00 2001 From: Yann Garniron Date: Sat, 31 Oct 2015 18:42:46 +0100 Subject: [PATCH 15/20] det_connections removed - some useless functions commented out --- plugins/MRCC_Utils/davidson.irp.f | 153 ++++---- src/Determinants/davidson.irp.f | 2 +- src/Determinants/filter_connected.irp.f | 391 ++++++++++---------- src/Determinants/s2.irp.f | 103 +++++- src/Determinants/slater_rules.irp.f | 463 ++++++++++++------------ 5 files changed, 594 insertions(+), 518 deletions(-) diff --git a/plugins/MRCC_Utils/davidson.irp.f b/plugins/MRCC_Utils/davidson.irp.f index abf1b63a..33aa8ee5 100644 --- a/plugins/MRCC_Utils/davidson.irp.f +++ b/plugins/MRCC_Utils/davidson.irp.f @@ -108,7 +108,7 @@ subroutine davidson_diag_hjj_mrcc(dets_in,u_in,H_jj,energies,dim_in,sze,N_st,Nin integer(bit_kind) :: dets_in_sorted(Nint,2,sze) integer :: idx(sze), shortcut(0:sze+1),sh,ii,tmp - PROVIDE det_connections + !PROVIDE det_connections call write_time(iunit) call wall_time(wall) @@ -430,7 +430,6 @@ subroutine H_u_0_mrcc(v_0,u_0,H_jj,n,keys_tmp,shortcut,sort_idx,Nint,istate) do ii=shortcut(sh),shortcut(sh+1)-1 idx(0) = ii - !call filter_connected_davidson_mwen(keys_tmp,shortcut,keys_tmp(1,1,ii),Nint,ii-1,idx) call filter_connected_davidson_warp(keys_tmp,warp,keys_tmp(1,1,ii),Nint,ii-1,idx) i = sort_idx(ii) @@ -470,79 +469,79 @@ subroutine H_u_0_mrcc(v_0,u_0,H_jj,n,keys_tmp,shortcut,sort_idx,Nint,istate) end - -subroutine H_u_0_mrcc_org(v_0,u_0,H_jj,n,keys_tmp,Nint,istate) - use bitmasks - implicit none - BEGIN_DOC - ! Computes v_0 = H|u_0> - ! - ! n : number of determinants - ! - ! H_jj : array of - END_DOC - integer, intent(in) :: n,Nint,istate - double precision, intent(out) :: v_0(n) - double precision, intent(in) :: u_0(n) - double precision, intent(in) :: H_jj(n) - integer(bit_kind),intent(in) :: keys_tmp(Nint,2,n) - integer, allocatable :: idx(:) - double precision :: hij - double precision, allocatable :: vt(:) - integer :: i,j,k,l, jj,ii - integer :: i0, j0 - - - - - - ASSERT (Nint > 0) - ASSERT (Nint == N_int) - ASSERT (n>0) - PROVIDE ref_bitmask_energy delta_ij - integer, parameter :: block_size = 157 - !$OMP PARALLEL DEFAULT(NONE) & - !$OMP PRIVATE(i,hij,j,k,idx,jj,ii,vt) & - !$OMP SHARED(n_det_ref,n_det_non_ref,idx_ref,idx_non_ref,n,H_jj,u_0,keys_tmp,Nint,v_0,istate,delta_ij) - !$OMP DO SCHEDULE(static) - do i=1,n - v_0(i) = H_jj(i) * u_0(i) - enddo - !$OMP END DO - allocate(idx(0:n), vt(n)) - Vt = 0.d0 - !$OMP DO SCHEDULE(guided) - do i=1,n - idx(0) = i - call filter_connected_davidson(keys_tmp,keys_tmp(1,1,i),Nint,i-1,idx) - do jj=1,idx(0) - j = idx(jj) -! if ( (dabs(u_0(j)) > 1.d-7).or.((dabs(u_0(i)) > 1.d-7)) ) then - call i_H_j(keys_tmp(1,1,j),keys_tmp(1,1,i),Nint,hij) - hij = hij - vt (i) = vt (i) + hij*u_0(j) - vt (j) = vt (j) + hij*u_0(i) -! endif - enddo - enddo - !$OMP END DO - - !$OMP DO SCHEDULE(guided) - do ii=1,n_det_ref - i = idx_ref(ii) - do jj = 1, n_det_non_ref - j = idx_non_ref(jj) - vt (i) = vt (i) + delta_ij(ii,jj,istate)*u_0(j) - vt (j) = vt (j) + delta_ij(ii,jj,istate)*u_0(i) - enddo - enddo - !$OMP END DO - !$OMP CRITICAL - do i=1,n - v_0(i) = v_0(i) + vt(i) - enddo - !$OMP END CRITICAL - deallocate(idx,vt) - !$OMP END PARALLEL -end +! +! subroutine H_u_0_mrcc_org(v_0,u_0,H_jj,n,keys_tmp,Nint,istate) +! use bitmasks +! implicit none +! BEGIN_DOC +! ! Computes v_0 = H|u_0> +! ! +! ! n : number of determinants +! ! +! ! H_jj : array of +! END_DOC +! integer, intent(in) :: n,Nint,istate +! double precision, intent(out) :: v_0(n) +! double precision, intent(in) :: u_0(n) +! double precision, intent(in) :: H_jj(n) +! integer(bit_kind),intent(in) :: keys_tmp(Nint,2,n) +! integer, allocatable :: idx(:) +! double precision :: hij +! double precision, allocatable :: vt(:) +! integer :: i,j,k,l, jj,ii +! integer :: i0, j0 +! +! +! +! +! +! ASSERT (Nint > 0) +! ASSERT (Nint == N_int) +! ASSERT (n>0) +! PROVIDE ref_bitmask_energy delta_ij +! integer, parameter :: block_size = 157 +! !$OMP PARALLEL DEFAULT(NONE) & +! !$OMP PRIVATE(i,hij,j,k,idx,jj,ii,vt) & +! !$OMP SHARED(n_det_ref,n_det_non_ref,idx_ref,idx_non_ref,n,H_jj,u_0,keys_tmp,Nint,v_0,istate,delta_ij) +! !$OMP DO SCHEDULE(static) +! do i=1,n +! v_0(i) = H_jj(i) * u_0(i) +! enddo +! !$OMP END DO +! allocate(idx(0:n), vt(n)) +! Vt = 0.d0 +! !$OMP DO SCHEDULE(guided) +! do i=1,n +! idx(0) = i +! call filter_connected_davidson(keys_tmp,keys_tmp(1,1,i),Nint,i-1,idx) +! do jj=1,idx(0) +! j = idx(jj) +! ! if ( (dabs(u_0(j)) > 1.d-7).or.((dabs(u_0(i)) > 1.d-7)) ) then +! call i_H_j(keys_tmp(1,1,j),keys_tmp(1,1,i),Nint,hij) +! hij = hij +! vt (i) = vt (i) + hij*u_0(j) +! vt (j) = vt (j) + hij*u_0(i) +! ! endif +! enddo +! enddo +! !$OMP END DO +! +! !$OMP DO SCHEDULE(guided) +! do ii=1,n_det_ref +! i = idx_ref(ii) +! do jj = 1, n_det_non_ref +! j = idx_non_ref(jj) +! vt (i) = vt (i) + delta_ij(ii,jj,istate)*u_0(j) +! vt (j) = vt (j) + delta_ij(ii,jj,istate)*u_0(i) +! enddo +! enddo +! !$OMP END DO +! !$OMP CRITICAL +! do i=1,n +! v_0(i) = v_0(i) + vt(i) +! enddo +! !$OMP END CRITICAL +! deallocate(idx,vt) +! !$OMP END PARALLEL +! end diff --git a/src/Determinants/davidson.irp.f b/src/Determinants/davidson.irp.f index 03a699c7..b017570a 100644 --- a/src/Determinants/davidson.irp.f +++ b/src/Determinants/davidson.irp.f @@ -288,7 +288,7 @@ subroutine davidson_diag_hjj(dets_in,u_in,H_jj,energies,dim_in,sze,N_st,Nint,iun integer(bit_kind) :: dets_in_sorted(Nint, 2, sze) integer :: idx(sze), shortcut(0:sze+1) - PROVIDE det_connections + !PROVIDE det_connections call write_time(iunit) call wall_time(wall) diff --git a/src/Determinants/filter_connected.irp.f b/src/Determinants/filter_connected.irp.f index ed4f092e..3028e32a 100644 --- a/src/Determinants/filter_connected.irp.f +++ b/src/Determinants/filter_connected.irp.f @@ -147,6 +147,7 @@ subroutine filter_connected_davidson_warp(key1,warp,key2,Nint,sze,idx) end do idx(l) = i_beta l = l + 1 + exit beta_loop end do beta_loop else do i_beta=warp(1,i_alpha),endloop @@ -190,201 +191,201 @@ subroutine filter_connected_davidson_warp(key1,warp,key2,Nint,sze,idx) end -subroutine filter_connected_davidson_shortcut(key1,shortcut,key2,Nint,sze,idx) - use bitmasks - implicit none - BEGIN_DOC - ! Filters out the determinants that are not connected by H - ! returns the array idx which contains the index of the - ! determinants in the array key1 that interact - ! via the H operator with key2. - ! - ! idx(0) is the number of determinants that interact with key1 - ! key1 should come from psi_det_sorted_ab. - END_DOC - integer, intent(in) :: Nint, sze - integer(bit_kind), intent(in) :: key1(Nint,2,sze) - integer(bit_kind), intent(in) :: key2(Nint,2) - integer, intent(out) :: idx(0:sze) - - integer,intent(in) :: shortcut(0:sze+1) - - integer :: i,j,k,l - integer :: degree_x2 - integer :: i_alpha, i_beta, exc_a, exc_b, endloop - integer(bit_kind) :: tmp1, tmp2 - - ASSERT (Nint > 0) - ASSERT (sze >= 0) - - l=1 - i_alpha = 0 - - if (Nint==1) then - do while(shortcut(i_alpha+1) < sze) - i_alpha = i_alpha + 1 - exc_a = popcnt(xor(key1(1,1,shortcut(i_alpha)), key2(1,1))) - if(exc_a > 4) then - cycle - end if - endloop = min(shortcut(i_alpha+1)-1, sze) - if(exc_a == 4) then - do i_beta = shortcut(i_alpha), endloop - if(key1(1,2,i_beta) == key2(1,2)) then - idx(l) = i_beta - l = l + 1 - exit - end if - end do - else - do i_beta = shortcut(i_alpha), endloop - exc_b = popcnt(xor(key1(1,2,i_beta), key2(1,2))) - if(exc_b + exc_a <= 4) then - idx(l) = i_beta - l = l + 1 - end if - end do - end if - end do - else - print *, "TBD : filter_connected_davidson_shortcut Nint>1" - stop - end if - - idx(0) = l-1 -end - -subroutine filter_connected_davidson(key1,key2,Nint,sze,idx) - use bitmasks - implicit none - BEGIN_DOC - ! Filters out the determinants that are not connected by H - ! returns the array idx which contains the index of the - ! determinants in the array key1 that interact - ! via the H operator with key2. - ! - ! idx(0) is the number of determinants that interact with key1 - ! key1 should come from psi_det_sorted_ab. - END_DOC - integer, intent(in) :: Nint, sze - integer(bit_kind), intent(in) :: key1(Nint,2,sze) - integer(bit_kind), intent(in) :: key2(Nint,2) - integer, intent(out) :: idx(0:sze) - - integer :: i,j,k,l - integer :: degree_x2 - integer :: j_int, j_start - integer*8 :: itmp - - PROVIDE N_con_int det_connections - - - ASSERT (Nint > 0) - ASSERT (sze >= 0) - - l=1 - - if (Nint==1) then - - i = idx(0) ! lecture dans un intent(out) ? - do j_int=1,N_con_int - itmp = det_connections(j_int,i) - do while (itmp /= 0_8) - j_start = ishft(j_int-1,11) + ishft(trailz(itmp),5) - do j = j_start+1, min(j_start+32,i-1) - degree_x2 = popcnt(xor( key1(1,1,j), key2(1,1))) + & - popcnt(xor( key1(1,2,j), key2(1,2))) - if (degree_x2 > 4) then - cycle - else - idx(l) = j - l = l+1 - endif - enddo - itmp = iand(itmp-1_8,itmp) - enddo - enddo - - else if (Nint==2) then - - - i = idx(0) - do j_int=1,N_con_int - itmp = det_connections(j_int,i) - do while (itmp /= 0_8) - j_start = ishft(j_int-1,11) + ishft(trailz(itmp),5) - do j = j_start+1, min(j_start+32,i-1) - degree_x2 = popcnt(xor( key1(1,1,j), key2(1,1))) + & - popcnt(xor( key1(2,1,j), key2(2,1))) + & - popcnt(xor( key1(1,2,j), key2(1,2))) + & - popcnt(xor( key1(2,2,j), key2(2,2))) - if (degree_x2 > 4) then - cycle - else - idx(l) = j - l = l+1 - endif - enddo - itmp = iand(itmp-1_8,itmp) - enddo - enddo - - else if (Nint==3) then - - i = idx(0) - !DIR$ LOOP COUNT (1000) - do j_int=1,N_con_int - itmp = det_connections(j_int,i) - do while (itmp /= 0_8) - j_start = ishft(j_int-1,11) + ishft(trailz(itmp),5) - do j = j_start+1, min(j_start+32,i-1) - degree_x2 = popcnt(xor( key1(1,1,j), key2(1,1))) + & - popcnt(xor( key1(1,2,j), key2(1,2))) + & - popcnt(xor( key1(2,1,j), key2(2,1))) + & - popcnt(xor( key1(2,2,j), key2(2,2))) + & - popcnt(xor( key1(3,1,j), key2(3,1))) + & - popcnt(xor( key1(3,2,j), key2(3,2))) - if (degree_x2 > 4) then - cycle - else - idx(l) = j - l = l+1 - endif - enddo - itmp = iand(itmp-1_8,itmp) - enddo - enddo - - else - - i = idx(0) - !DIR$ LOOP COUNT (1000) - do j_int=1,N_con_int - itmp = det_connections(j_int,i) - do while (itmp /= 0_8) - j_start = ishft(j_int-1,11) + ishft(trailz(itmp),5) - do j = j_start+1, min(j_start+32,i-1) - degree_x2 = 0 - !DEC$ LOOP COUNT MIN(4) - do k=1,Nint - degree_x2 = degree_x2+ popcnt(xor( key1(k,1,j), key2(k,1))) +& - popcnt(xor( key1(k,2,j), key2(k,2))) - if (degree_x2 > 4) then - exit - endif - enddo - if (degree_x2 <= 5) then - idx(l) = j - l = l+1 - endif - enddo - itmp = iand(itmp-1_8,itmp) - enddo - enddo - - endif - idx(0) = l-1 -end +! subroutine filter_connected_davidson_shortcut(key1,shortcut,key2,Nint,sze,idx) +! use bitmasks +! implicit none +! BEGIN_DOC +! ! Filters out the determinants that are not connected by H +! ! returns the array idx which contains the index of the +! ! determinants in the array key1 that interact +! ! via the H operator with key2. +! ! +! ! idx(0) is the number of determinants that interact with key1 +! ! key1 should come from psi_det_sorted_ab. +! END_DOC +! integer, intent(in) :: Nint, sze +! integer(bit_kind), intent(in) :: key1(Nint,2,sze) +! integer(bit_kind), intent(in) :: key2(Nint,2) +! integer, intent(out) :: idx(0:sze) +! +! integer,intent(in) :: shortcut(0:sze+1) +! +! integer :: i,j,k,l +! integer :: degree_x2 +! integer :: i_alpha, i_beta, exc_a, exc_b, endloop +! integer(bit_kind) :: tmp1, tmp2 +! +! ASSERT (Nint > 0) +! ASSERT (sze >= 0) +! +! l=1 +! i_alpha = 0 +! +! if (Nint==1) then +! do while(shortcut(i_alpha+1) < sze) +! i_alpha = i_alpha + 1 +! exc_a = popcnt(xor(key1(1,1,shortcut(i_alpha)), key2(1,1))) +! if(exc_a > 4) then +! cycle +! end if +! endloop = min(shortcut(i_alpha+1)-1, sze) +! if(exc_a == 4) then +! do i_beta = shortcut(i_alpha), endloop +! if(key1(1,2,i_beta) == key2(1,2)) then +! idx(l) = i_beta +! l = l + 1 +! exit +! end if +! end do +! else +! do i_beta = shortcut(i_alpha), endloop +! exc_b = popcnt(xor(key1(1,2,i_beta), key2(1,2))) +! if(exc_b + exc_a <= 4) then +! idx(l) = i_beta +! l = l + 1 +! end if +! end do +! end if +! end do +! else +! print *, "TBD : filter_connected_davidson_shortcut Nint>1" +! stop +! end if +! +! idx(0) = l-1 +! end +! +! subroutine filter_connected_davidson(key1,key2,Nint,sze,idx) +! use bitmasks +! implicit none +! BEGIN_DOC +! ! Filters out the determinants that are not connected by H +! ! returns the array idx which contains the index of the +! ! determinants in the array key1 that interact +! ! via the H operator with key2. +! ! +! ! idx(0) is the number of determinants that interact with key1 +! ! key1 should come from psi_det_sorted_ab. +! END_DOC +! integer, intent(in) :: Nint, sze +! integer(bit_kind), intent(in) :: key1(Nint,2,sze) +! integer(bit_kind), intent(in) :: key2(Nint,2) +! integer, intent(inout) :: idx(0:sze) +! +! integer :: i,j,k,l +! integer :: degree_x2 +! integer :: j_int, j_start +! integer*8 :: itmp +! +! PROVIDE N_con_int det_connections +! +! +! ASSERT (Nint > 0) +! ASSERT (sze >= 0) +! +! l=1 +! +! if (Nint==1) then +! +! i = idx(0) ! lecture dans un intent(out) ? +! do j_int=1,N_con_int +! itmp = det_connections(j_int,i) +! do while (itmp /= 0_8) +! j_start = ishft(j_int-1,11) + ishft(trailz(itmp),5) +! do j = j_start+1, min(j_start+32,i-1) +! degree_x2 = popcnt(xor( key1(1,1,j), key2(1,1))) + & +! popcnt(xor( key1(1,2,j), key2(1,2))) +! if (degree_x2 > 4) then +! cycle +! else +! idx(l) = j +! l = l+1 +! endif +! enddo +! itmp = iand(itmp-1_8,itmp) +! enddo +! enddo +! +! else if (Nint==2) then +! +! +! i = idx(0) +! do j_int=1,N_con_int +! itmp = det_connections(j_int,i) +! do while (itmp /= 0_8) +! j_start = ishft(j_int-1,11) + ishft(trailz(itmp),5) +! do j = j_start+1, min(j_start+32,i-1) +! degree_x2 = popcnt(xor( key1(1,1,j), key2(1,1))) + & +! popcnt(xor( key1(2,1,j), key2(2,1))) + & +! popcnt(xor( key1(1,2,j), key2(1,2))) + & +! popcnt(xor( key1(2,2,j), key2(2,2))) +! if (degree_x2 > 4) then +! cycle +! else +! idx(l) = j +! l = l+1 +! endif +! enddo +! itmp = iand(itmp-1_8,itmp) +! enddo +! enddo +! +! else if (Nint==3) then +! +! i = idx(0) +! !DIR$ LOOP COUNT (1000) +! do j_int=1,N_con_int +! itmp = det_connections(j_int,i) +! do while (itmp /= 0_8) +! j_start = ishft(j_int-1,11) + ishft(trailz(itmp),5) +! do j = j_start+1, min(j_start+32,i-1) +! degree_x2 = popcnt(xor( key1(1,1,j), key2(1,1))) + & +! popcnt(xor( key1(1,2,j), key2(1,2))) + & +! popcnt(xor( key1(2,1,j), key2(2,1))) + & +! popcnt(xor( key1(2,2,j), key2(2,2))) + & +! popcnt(xor( key1(3,1,j), key2(3,1))) + & +! popcnt(xor( key1(3,2,j), key2(3,2))) +! if (degree_x2 > 4) then +! cycle +! else +! idx(l) = j +! l = l+1 +! endif +! enddo +! itmp = iand(itmp-1_8,itmp) +! enddo +! enddo +! +! else +! +! i = idx(0) +! !DIR$ LOOP COUNT (1000) +! do j_int=1,N_con_int +! itmp = det_connections(j_int,i) +! do while (itmp /= 0_8) +! j_start = ishft(j_int-1,11) + ishft(trailz(itmp),5) +! do j = j_start+1, min(j_start+32,i-1) +! degree_x2 = 0 +! !DEC$ LOOP COUNT MIN(4) +! do k=1,Nint +! degree_x2 = degree_x2+ popcnt(xor( key1(k,1,j), key2(k,1))) +& +! popcnt(xor( key1(k,2,j), key2(k,2))) +! if (degree_x2 > 4) then +! exit +! endif +! enddo +! if (degree_x2 <= 5) then +! idx(l) = j +! l = l+1 +! endif +! enddo +! itmp = iand(itmp-1_8,itmp) +! enddo +! enddo +! +! endif +! idx(0) = l-1 +! end subroutine filter_connected_i_H_psi0(key1,key2,Nint,sze,idx) use bitmasks diff --git a/src/Determinants/s2.irp.f b/src/Determinants/s2.irp.f index 72c1b9aa..33b3c45d 100644 --- a/src/Determinants/s2.irp.f +++ b/src/Determinants/s2.irp.f @@ -106,6 +106,7 @@ subroutine get_s2_u0_old(psi_keys_tmp,psi_coefs_tmp,n,nmax,s2) s2 += S_z2_Sz end + subroutine get_s2_u0(psi_keys_tmp,psi_coefs_tmp,n,nmax,s2) implicit none use bitmasks @@ -114,35 +115,107 @@ subroutine get_s2_u0(psi_keys_tmp,psi_coefs_tmp,n,nmax,s2) double precision, intent(in) :: psi_coefs_tmp(nmax) double precision, intent(out) :: s2 double precision :: s2_tmp - integer :: i,j,l,jj + integer :: i,j,l,jj,ii integer, allocatable :: idx(:) + + integer(bit_kind) :: psi_keys_srt(N_int,2,n) + integer :: shortcut(0:n+1), sort_idx(n), warp(2,0:n+1), ni, sh, tmp + + + print *, "totolacitrouille" + call write_time(6) + psi_keys_srt(:,:,:) = psi_keys_tmp(:,:,:) + call sort_dets_ab(psi_keys_srt, sort_idx, shortcut, n, N_int) + print *, "totolacitrouille 2" s2 = 0.d0 !$OMP PARALLEL DEFAULT(NONE) & - !$OMP PRIVATE(i,j,s2_tmp,idx) & - !$OMP SHARED(n,psi_coefs_tmp,psi_keys_tmp,N_int,davidson_threshold)& + !$OMP PRIVATE(i,j,s2_tmp,idx,warp,tmp) & + !$OMP SHARED(n,psi_coefs_tmp,psi_keys_tmp,N_int,davidson_threshold,shortcut,psi_keys_srt,sort_idx)& !$OMP REDUCTION(+:s2) allocate(idx(0:n)) !$OMP DO SCHEDULE(dynamic) - do i=1,n - idx(0) = i - call filter_connected_davidson(psi_keys_tmp,psi_keys_tmp(1,1,i),N_int,i-1,idx) - do jj=1,idx(0) - j = idx(jj) - if ( dabs(psi_coefs_tmp(j)) + dabs(psi_coefs_tmp(i)) & - > davidson_threshold ) then - call get_s2(psi_keys_tmp(1,1,i),psi_keys_tmp(1,1,j),s2_tmp,N_int) - s2 = s2 + psi_coefs_tmp(i)*psi_coefs_tmp(j)*s2_tmp - endif - enddo + + do sh=1,shortcut(0) + warp(1,0) = 0 + do ii=1,sh!shortcut(0) + tmp = 0 + do ni=1,N_int + tmp = popcnt(xor(psi_keys_tmp(ni,1, shortcut(ii)), psi_keys_tmp(ni,1,shortcut(sh)))) + end do + if(tmp <= 4) then + tmp = warp(1,0) + 1 + warp(1,0) = tmp + warp(1,tmp) = shortcut(ii) + warp(2,tmp) = shortcut(ii+1)-1 + end if + end do + + do ii=shortcut(sh),shortcut(sh+1)-1 + !do ii=1,n + idx(0) = ii + call filter_connected_davidson_warp(psi_keys_srt,warp,psi_keys_srt(1,1,ii),N_int,ii-1,idx) + i = sort_idx(ii) + do jj=1,idx(0) + j = sort_idx(idx(jj)) + if ( dabs(psi_coefs_tmp(j)) + dabs(psi_coefs_tmp(i)) & + > davidson_threshold ) then + call get_s2(psi_keys_srt(1,1,ii),psi_keys_srt(1,1,idx(jj)),s2_tmp,N_int) + s2 = s2 + psi_coefs_tmp(i)*psi_coefs_tmp(j)*s2_tmp + endif + enddo + end do enddo !$OMP END DO deallocate(idx) !$OMP END PARALLEL s2 = s2+s2 do i=1,n - call get_s2(psi_keys_tmp(1,1,i),psi_keys_tmp(1,1,i),s2_tmp,N_int) + call get_s2(psi_keys_srt(1,1,sort_idx(i)),psi_keys_srt(1,1,sort_idx(i)),s2_tmp,N_int) s2 = s2 + psi_coefs_tmp(i)*psi_coefs_tmp(i)*s2_tmp enddo s2 = s2 + S_z2_Sz + print *, "totolacitrouille 3" + call write_time(6) end +! +! subroutine get_s2_u0_org(psi_keys_tmp,psi_coefs_tmp,n,nmax,s2) +! implicit none +! use bitmasks +! integer(bit_kind), intent(in) :: psi_keys_tmp(N_int,2,nmax) +! integer, intent(in) :: n,nmax +! double precision, intent(in) :: psi_coefs_tmp(nmax) +! double precision, intent(out) :: s2 +! double precision :: s2_tmp +! integer :: i,j,l,jj +! integer, allocatable :: idx(:) +! s2 = 0.d0 +! !$OMP PARALLEL DEFAULT(NONE) & +! !$OMP PRIVATE(i,j,s2_tmp,idx) & +! !$OMP SHARED(n,psi_coefs_tmp,psi_keys_tmp,N_int,davidson_threshold)& +! !$OMP REDUCTION(+:s2) +! allocate(idx(0:n)) +! !$OMP DO SCHEDULE(dynamic) +! do i=1,n +! idx(0) = i +! call filter_connected_davidson(psi_keys_tmp,psi_keys_tmp(1,1,i),N_int,i-1,idx) +! do jj=1,idx(0) +! j = idx(jj) +! if ( dabs(psi_coefs_tmp(j)) + dabs(psi_coefs_tmp(i)) & +! > davidson_threshold ) then +! call get_s2(psi_keys_tmp(1,1,i),psi_keys_tmp(1,1,j),s2_tmp,N_int) +! s2 = s2 + psi_coefs_tmp(i)*psi_coefs_tmp(j)*s2_tmp +! endif +! enddo +! enddo +! !$OMP END DO +! deallocate(idx) +! !$OMP END PARALLEL +! s2 = s2+s2 +! do i=1,n +! call get_s2(psi_keys_tmp(1,1,i),psi_keys_tmp(1,1,i),s2_tmp,N_int) +! s2 = s2 + psi_coefs_tmp(i)*psi_coefs_tmp(i)*s2_tmp +! enddo +! s2 = s2 + S_z2_Sz +! end +! diff --git a/src/Determinants/slater_rules.irp.f b/src/Determinants/slater_rules.irp.f index 06dcb9b7..1c8573dd 100644 --- a/src/Determinants/slater_rules.irp.f +++ b/src/Determinants/slater_rules.irp.f @@ -1299,74 +1299,74 @@ subroutine H_u_0(v_0,u_0,H_jj,n,keys_tmp,shortcut,sort_idx,Nint) enddo end - -subroutine H_u_0_org(v_0,u_0,H_jj,n,keys_tmp,Nint) - use bitmasks - implicit none - BEGIN_DOC - ! Computes v_0 = H|u_0> - ! - ! n : number of determinants - ! - ! H_jj : array of - END_DOC - integer, intent(in) :: n,Nint - double precision, intent(out) :: v_0(n) - double precision, intent(in) :: u_0(n) - double precision, intent(in) :: H_jj(n) - integer(bit_kind),intent(in) :: keys_tmp(Nint,2,n) - integer, allocatable :: idx(:) - double precision :: hij - double precision, allocatable :: vt(:) - integer :: i,j,k,l, jj,ii,sh - integer :: i0, j0 - - - - ASSERT (Nint > 0) - ASSERT (Nint == N_int) - ASSERT (n>0) - PROVIDE ref_bitmask_energy - !$OMP PARALLEL DEFAULT(NONE) & - !$OMP PRIVATE(i,hij,j,k,idx,jj,vt,ii) & - !$OMP SHARED(n,H_jj,u_0,keys_tmp,Nint,v_0,davidson_threshold) - allocate(idx(0:n), vt(n)) - Vt = 0.d0 - v_0 = 0.d0 - !$OMP DO SCHEDULE(guided) - - - - - - do ii=1,n - idx(0) = ii - i = ii - call filter_connected_davidson(keys_tmp,keys_tmp(1,1,ii),Nint,ii-1,idx) - - do jj=1,idx(0) - j = idx(jj) - if ( dabs(u_0(j)) + dabs(u_0(i)) > davidson_threshold ) then - call i_H_j(keys_tmp(1,1,idx(jj)),keys_tmp(1,1,ii),Nint,hij) - vt (i) = vt (i) + hij*u_0(j) - vt (j) = vt (j) + hij*u_0(i) - endif - enddo - enddo - - !$OMP END DO - !$OMP CRITICAL - do i=1,n - v_0(i) = v_0(i) + vt(i) - enddo - !$OMP END CRITICAL - deallocate(idx,vt) - !$OMP END PARALLEL - do i=1,n - v_0(i) += H_jj(i) * u_0(i) - enddo -end - +! +! subroutine H_u_0_org(v_0,u_0,H_jj,n,keys_tmp,Nint) +! use bitmasks +! implicit none +! BEGIN_DOC +! ! Computes v_0 = H|u_0> +! ! +! ! n : number of determinants +! ! +! ! H_jj : array of +! END_DOC +! integer, intent(in) :: n,Nint +! double precision, intent(out) :: v_0(n) +! double precision, intent(in) :: u_0(n) +! double precision, intent(in) :: H_jj(n) +! integer(bit_kind),intent(in) :: keys_tmp(Nint,2,n) +! integer, allocatable :: idx(:) +! double precision :: hij +! double precision, allocatable :: vt(:) +! integer :: i,j,k,l, jj,ii,sh +! integer :: i0, j0 +! +! +! +! ASSERT (Nint > 0) +! ASSERT (Nint == N_int) +! ASSERT (n>0) +! PROVIDE ref_bitmask_energy +! !$OMP PARALLEL DEFAULT(NONE) & +! !$OMP PRIVATE(i,hij,j,k,idx,jj,vt,ii) & +! !$OMP SHARED(n,H_jj,u_0,keys_tmp,Nint,v_0,davidson_threshold) +! allocate(idx(0:n), vt(n)) +! Vt = 0.d0 +! v_0 = 0.d0 +! !$OMP DO SCHEDULE(guided) +! +! +! +! +! +! do ii=1,n +! idx(0) = ii +! i = ii +! call filter_connected_davidson(keys_tmp,keys_tmp(1,1,ii),Nint,ii-1,idx) +! +! do jj=1,idx(0) +! j = idx(jj) +! if ( dabs(u_0(j)) + dabs(u_0(i)) > davidson_threshold ) then +! call i_H_j(keys_tmp(1,1,idx(jj)),keys_tmp(1,1,ii),Nint,hij) +! vt (i) = vt (i) + hij*u_0(j) +! vt (j) = vt (j) + hij*u_0(i) +! endif +! enddo +! enddo +! +! !$OMP END DO +! !$OMP CRITICAL +! do i=1,n +! v_0(i) = v_0(i) + vt(i) +! enddo +! !$OMP END CRITICAL +! deallocate(idx,vt) +! !$OMP END PARALLEL +! do i=1,n +! v_0(i) += H_jj(i) * u_0(i) +! enddo +! end +! BEGIN_PROVIDER [ integer, N_con_int ] @@ -1377,166 +1377,169 @@ BEGIN_PROVIDER [ integer, N_con_int ] N_con_int = 1 + ishft(N_det-1,-11) END_PROVIDER -BEGIN_PROVIDER [ integer*8, det_connections, (N_con_int,N_det) ] - implicit none - BEGIN_DOC - ! Build connection proxy between determinants - END_DOC - integer :: i,j - integer :: degree - integer :: j_int, j_k, j_l - integer, allocatable :: idx(:) - integer :: thread_num - integer :: omp_get_thread_num - - PROVIDE progress_bar - call start_progress(N_det,'Det connections',0.d0) - - select case(N_int) - - case(1) - - - !$OMP PARALLEL DEFAULT (NONE) & - !$OMP SHARED(N_det, N_con_int, psi_det,N_int, det_connections, & - !$OMP progress_bar,progress_value)& - !$OMP PRIVATE(i,j_int,j_k,j_l,j,degree,idx,thread_num) - - !$ thread_num = omp_get_thread_num() - allocate (idx(0:N_det)) - !$OMP DO SCHEDULE(guided) - do i=1,N_det - if (thread_num == 0) then - progress_bar(1) = i - progress_value = dble(i) - endif - do j_int=1,N_con_int - det_connections(j_int,i) = 0_8 - j_k = ishft(j_int-1,11) - do j_l = j_k,min(j_k+2047,N_det), 32 - do j = j_l+1,min(j_l+32,i) - degree = popcnt(xor( psi_det(1,1,i),psi_det(1,1,j))) + & - popcnt(xor( psi_det(1,2,i),psi_det(1,2,j))) - if (degree < 5) then - det_connections(j_int,i) = ibset( det_connections(j_int,i), iand(63,ishft(j_l,-5)) ) - exit - endif - enddo - enddo - enddo - enddo - !$OMP ENDDO - deallocate(idx) - !$OMP END PARALLEL - - case(2) - - !$OMP PARALLEL DEFAULT (NONE) & - !$OMP SHARED(N_det, N_con_int, psi_det,N_int, det_connections,& - !$OMP progress_bar,progress_value)& - !$OMP PRIVATE(i,j_int,j_k,j_l,j,degree,idx,thread_num) - !$ thread_num = omp_get_thread_num() - allocate (idx(0:N_det)) - !$OMP DO SCHEDULE(guided) - do i=1,N_det - if (thread_num == 0) then - progress_bar(1) = i - progress_value = dble(i) - endif - do j_int=1,N_con_int - det_connections(j_int,i) = 0_8 - j_k = ishft(j_int-1,11) - do j_l = j_k,min(j_k+2047,N_det), 32 - do j = j_l+1,min(j_l+32,i) - degree = popcnt(xor( psi_det(1,1,i),psi_det(1,1,j))) + & - popcnt(xor( psi_det(1,2,i),psi_det(1,2,j))) + & - popcnt(xor( psi_det(2,1,i),psi_det(2,1,j))) + & - popcnt(xor( psi_det(2,2,i),psi_det(2,2,j))) - if (degree < 5) then - det_connections(j_int,i) = ibset( det_connections(j_int,i), iand(63,ishft(j_l,-5)) ) - exit - endif - enddo - enddo - enddo - enddo - !$OMP ENDDO - deallocate(idx) - !$OMP END PARALLEL - - case(3) - - !$OMP PARALLEL DEFAULT (NONE) & - !$OMP SHARED(N_det, N_con_int, psi_det,N_int, det_connections,& - !$OMP progress_bar,progress_value)& - !$OMP PRIVATE(i,j_int,j_k,j_l,j,degree,idx,thread_num) - !$ thread_num = omp_get_thread_num() - allocate (idx(0:N_det)) - !$OMP DO SCHEDULE(guided) - do i=1,N_det - if (thread_num == 0) then - progress_bar(1) = i - progress_value = dble(i) - endif - do j_int=1,N_con_int - det_connections(j_int,i) = 0_8 - j_k = ishft(j_int-1,11) - do j_l = j_k,min(j_k+2047,N_det), 32 - do j = j_l+1,min(j_l+32,i) - degree = popcnt(xor( psi_det(1,1,i),psi_det(1,1,j))) + & - popcnt(xor( psi_det(1,2,i),psi_det(1,2,j))) + & - popcnt(xor( psi_det(2,1,i),psi_det(2,1,j))) + & - popcnt(xor( psi_det(2,2,i),psi_det(2,2,j))) + & - popcnt(xor( psi_det(3,1,i),psi_det(3,1,j))) + & - popcnt(xor( psi_det(3,2,i),psi_det(3,2,j))) - if (degree < 5) then - det_connections(j_int,i) = ibset( det_connections(j_int,i), iand(63,ishft(j_l,-5)) ) - exit - endif - enddo - enddo - enddo - enddo - !$OMP ENDDO - deallocate(idx) - !$OMP END PARALLEL - - case default - - - !$OMP PARALLEL DEFAULT (NONE) & - !$OMP SHARED(N_det, N_con_int, psi_det,N_int, det_connections,& - !$OMP progress_bar,progress_value)& - !$OMP PRIVATE(i,j_int,j_k,j_l,j,degree,idx,thread_num) - !$ thread_num = omp_get_thread_num() - allocate (idx(0:N_det)) - !$OMP DO SCHEDULE(guided) - do i=1,N_det - if (thread_num == 0) then - progress_bar(1) = i - progress_value = dble(i) - endif - do j_int=1,N_con_int - det_connections(j_int,i) = 0_8 - j_k = ishft(j_int-1,11) - do j_l = j_k,min(j_k+2047,N_det), 32 - do j = j_l+1,min(j_l+32,i) - !DIR$ FORCEINLINE - call get_excitation_degree(psi_det(1,1,i),psi_det(1,1,j),degree,N_int) - if (degree < 3) then - det_connections(j_int,i) = ibset( det_connections(j_int,i), iand(63,ishft(j_l,-5)) ) - exit - endif - enddo - enddo - enddo - enddo - !$OMP ENDDO - deallocate(idx) - !$OMP END PARALLEL - - end select - call stop_progress - -END_PROVIDER +! BEGIN_PROVIDER [ integer*8, det_connectionsqsd, (N_con_int,N_det) ] +! implicit none +! BEGIN_DOC +! ! Build connection proxy between determinants +! END_DOC +! integer :: i,j +! integer :: degree +! integer :: j_int, j_k, j_l +! integer, allocatable :: idx(:) +! integer :: thread_num +! integer :: omp_get_thread_num +! +! PROVIDE progress_bar +! +! print *,"totolabanane" +! +! call start_progress(N_det,'Det connections',0.d0) +! +! select case(N_int) +! +! case(1) +! +! +! !$OMP PARALLEL DEFAULT (NONE) & +! !$OMP SHARED(N_det, N_con_int, psi_det,N_int, det_connections, & +! !$OMP progress_bar,progress_value)& +! !$OMP PRIVATE(i,j_int,j_k,j_l,j,degree,idx,thread_num) +! +! !$ thread_num = omp_get_thread_num() +! allocate (idx(0:N_det)) +! !$OMP DO SCHEDULE(guided) +! do i=1,N_det +! if (thread_num == 0) then +! progress_bar(1) = i +! progress_value = dble(i) +! endif +! do j_int=1,N_con_int +! det_connections(j_int,i) = 0_8 +! j_k = ishft(j_int-1,11) +! do j_l = j_k,min(j_k+2047,N_det), 32 +! do j = j_l+1,min(j_l+32,i) +! degree = popcnt(xor( psi_det(1,1,i),psi_det(1,1,j))) + & +! popcnt(xor( psi_det(1,2,i),psi_det(1,2,j))) +! if (degree < 5) then +! det_connections(j_int,i) = ibset( det_connections(j_int,i), iand(63,ishft(j_l,-5)) ) +! exit +! endif +! enddo +! enddo +! enddo +! enddo +! !$OMP ENDDO +! deallocate(idx) +! !$OMP END PARALLEL +! +! case(2) +! +! !$OMP PARALLEL DEFAULT (NONE) & +! !$OMP SHARED(N_det, N_con_int, psi_det,N_int, det_connections,& +! !$OMP progress_bar,progress_value)& +! !$OMP PRIVATE(i,j_int,j_k,j_l,j,degree,idx,thread_num) +! !$ thread_num = omp_get_thread_num() +! allocate (idx(0:N_det)) +! !$OMP DO SCHEDULE(guided) +! do i=1,N_det +! if (thread_num == 0) then +! progress_bar(1) = i +! progress_value = dble(i) +! endif +! do j_int=1,N_con_int +! det_connections(j_int,i) = 0_8 +! j_k = ishft(j_int-1,11) +! do j_l = j_k,min(j_k+2047,N_det), 32 +! do j = j_l+1,min(j_l+32,i) +! degree = popcnt(xor( psi_det(1,1,i),psi_det(1,1,j))) + & +! popcnt(xor( psi_det(1,2,i),psi_det(1,2,j))) + & +! popcnt(xor( psi_det(2,1,i),psi_det(2,1,j))) + & +! popcnt(xor( psi_det(2,2,i),psi_det(2,2,j))) +! if (degree < 5) then +! det_connections(j_int,i) = ibset( det_connections(j_int,i), iand(63,ishft(j_l,-5)) ) +! exit +! endif +! enddo +! enddo +! enddo +! enddo +! !$OMP ENDDO +! deallocate(idx) +! !$OMP END PARALLEL +! +! case(3) +! +! !$OMP PARALLEL DEFAULT (NONE) & +! !$OMP SHARED(N_det, N_con_int, psi_det,N_int, det_connections,& +! !$OMP progress_bar,progress_value)& +! !$OMP PRIVATE(i,j_int,j_k,j_l,j,degree,idx,thread_num) +! !$ thread_num = omp_get_thread_num() +! allocate (idx(0:N_det)) +! !$OMP DO SCHEDULE(guided) +! do i=1,N_det +! if (thread_num == 0) then +! progress_bar(1) = i +! progress_value = dble(i) +! endif +! do j_int=1,N_con_int +! det_connections(j_int,i) = 0_8 +! j_k = ishft(j_int-1,11) +! do j_l = j_k,min(j_k+2047,N_det), 32 +! do j = j_l+1,min(j_l+32,i) +! degree = popcnt(xor( psi_det(1,1,i),psi_det(1,1,j))) + & +! popcnt(xor( psi_det(1,2,i),psi_det(1,2,j))) + & +! popcnt(xor( psi_det(2,1,i),psi_det(2,1,j))) + & +! popcnt(xor( psi_det(2,2,i),psi_det(2,2,j))) + & +! popcnt(xor( psi_det(3,1,i),psi_det(3,1,j))) + & +! popcnt(xor( psi_det(3,2,i),psi_det(3,2,j))) +! if (degree < 5) then +! det_connections(j_int,i) = ibset( det_connections(j_int,i), iand(63,ishft(j_l,-5)) ) +! exit +! endif +! enddo +! enddo +! enddo +! enddo +! !$OMP ENDDO +! deallocate(idx) +! !$OMP END PARALLEL +! +! case default +! +! +! !$OMP PARALLEL DEFAULT (NONE) & +! !$OMP SHARED(N_det, N_con_int, psi_det,N_int, det_connections,& +! !$OMP progress_bar,progress_value)& +! !$OMP PRIVATE(i,j_int,j_k,j_l,j,degree,idx,thread_num) +! !$ thread_num = omp_get_thread_num() +! allocate (idx(0:N_det)) +! !$OMP DO SCHEDULE(guided) +! do i=1,N_det +! if (thread_num == 0) then +! progress_bar(1) = i +! progress_value = dble(i) +! endif +! do j_int=1,N_con_int +! det_connections(j_int,i) = 0_8 +! j_k = ishft(j_int-1,11) +! do j_l = j_k,min(j_k+2047,N_det), 32 +! do j = j_l+1,min(j_l+32,i) +! !DIR$ FORCEINLINE +! call get_excitation_degree(psi_det(1,1,i),psi_det(1,1,j),degree,N_int) +! if (degree < 3) then +! det_connections(j_int,i) = ibset( det_connections(j_int,i), iand(63,ishft(j_l,-5)) ) +! exit +! endif +! enddo +! enddo +! enddo +! enddo +! !$OMP ENDDO +! deallocate(idx) +! !$OMP END PARALLEL +! +! end select +! call stop_progress +! +! END_PROVIDER From 67836776e1646f008bbab9da48f3f121e011e525 Mon Sep 17 00:00:00 2001 From: Yann Garniron Date: Sun, 1 Nov 2015 08:57:01 +0100 Subject: [PATCH 16/20] optimized H_u_0_mrcc and get_s2_u0 - some unused functions commented out --- plugins/MRCC_Utils/davidson.irp.f | 132 +++++++++++++++++- src/Determinants/davidson.irp.f | 24 ++-- src/Determinants/s2.irp.f | 224 ++++++++++++++++++++++-------- 3 files changed, 307 insertions(+), 73 deletions(-) diff --git a/plugins/MRCC_Utils/davidson.irp.f b/plugins/MRCC_Utils/davidson.irp.f index 33aa8ee5..1757305c 100644 --- a/plugins/MRCC_Utils/davidson.irp.f +++ b/plugins/MRCC_Utils/davidson.irp.f @@ -215,8 +215,9 @@ subroutine davidson_diag_hjj_mrcc(dets_in,u_in,H_jj,energies,dim_in,sze,N_st,Nin ! ---------------------- do k=1,N_st - call H_u_0_mrcc(W(1,k,iter),U(1,k,iter),H_jj,sze,dets_in_sorted,shortcut,idx,Nint,istate) + !call H_u_0_mrcc(W(1,k,iter),U(1,k,iter),H_jj,sze,dets_in_sorted,shortcut,idx,Nint,istate) !call H_u_0_mrcc_org(W(1,k,iter),U(1,k,iter),H_jj,sze,dets_in,Nint,istate) + call H_u_0_mrcc(W(1,k,iter),U(1,k,iter),H_jj,sze,dets_in,Nint,istate) enddo ! Compute h_kl = = @@ -368,7 +369,9 @@ subroutine davidson_diag_hjj_mrcc(dets_in,u_in,H_jj,energies,dim_in,sze,N_st,Nin abort_here = abort_all end -subroutine H_u_0_mrcc(v_0,u_0,H_jj,n,keys_tmp,shortcut,sort_idx,Nint,istate) + + +subroutine H_u_0_mrcc_myold(v_0,u_0,H_jj,n,keys_tmp,shortcut,sort_idx,Nint,istate) use bitmasks implicit none BEGIN_DOC @@ -449,6 +452,131 @@ subroutine H_u_0_mrcc(v_0,u_0,H_jj,n,keys_tmp,shortcut,sort_idx,Nint,istate) + !$OMP DO SCHEDULE(guided) + do ii=1,n_det_ref + i = idx_ref(ii) + do jj = 1, n_det_non_ref + j = idx_non_ref(jj) + vt (i) = vt (i) + delta_ij(ii,jj,istate)*u_0(j) + vt (j) = vt (j) + delta_ij(ii,jj,istate)*u_0(i) + enddo + enddo + !$OMP END DO + !$OMP CRITICAL + do i=1,n + v_0(i) = v_0(i) + vt(i) + enddo + !$OMP END CRITICAL + deallocate(idx,vt) + !$OMP END PARALLEL +end + + +subroutine H_u_0_mrcc(v_0,u_0,H_jj,n,keys_tmp,Nint,istate) + use bitmasks + implicit none + BEGIN_DOC + ! Computes v_0 = H|u_0> + ! + ! n : number of determinants + ! + ! H_jj : array of + END_DOC + integer, intent(in) :: n,Nint,istate + double precision, intent(out) :: v_0(n) + double precision, intent(in) :: u_0(n) + double precision, intent(in) :: H_jj(n) + integer(bit_kind),intent(in) :: keys_tmp(Nint,2,n) + integer, allocatable :: idx(:) + double precision :: hij + double precision, allocatable :: vt(:) + integer :: i,j,k,l, jj,ii + integer :: i0, j0 + + integer :: shortcut(0:n+1), sort_idx(n) + integer(bit_kind) :: sorted(Nint,n), version(Nint,n) + integer :: sh, sh2, ni, exa, ext, org_i, org_j, endi, pass +! + + ASSERT (Nint > 0) + ASSERT (Nint == N_int) + ASSERT (n>0) + PROVIDE ref_bitmask_energy delta_ij + integer, parameter :: block_size = 157 + + + !$OMP PARALLEL DEFAULT(NONE) & + !$OMP PRIVATE(i,hij,j,k,idx,jj,vt,ii,sh, sh2, ni, exa, ext, org_i, org_j, endi, pass) & + !$OMP SHARED(n_det_ref,n_det_non_ref,idx_ref,idx_non_ref,n,H_jj,u_0,keys_tmp,Nint,v_0,istate,delta_ij,sorted,shortcut,sort_idx,version) + + + + !$OMP DO SCHEDULE(static) + do i=1,n + v_0(i) = H_jj(i) * u_0(i) + enddo + !$OMP END DO + + allocate(idx(0:n), vt(n)) + Vt = 0.d0 + + do pass=1,2 + if(pass == 1) then + call sort_dets_ab_v(keys_tmp, sorted, sort_idx, shortcut, version, n, Nint) + else + call sort_dets_ba_v(keys_tmp, sorted, sort_idx, shortcut, version, n, Nint) + end if + + + !$OMP DO SCHEDULE(dynamic) + do sh=1,shortcut(0) + + if(pass == 2) then + endi = sh + else + endi = 1 + end if + + do sh2=endi,sh + exa = 0 + do ni=1,Nint + exa += popcnt(xor(version(ni,sh), version(ni,sh2))) + end do + if(exa > 2) then + cycle + end if + + do i=shortcut(sh),shortcut(sh+1)-1 + if(sh==sh2) then + endi = i-1 + else + endi = shortcut(sh2+1)-1 + end if + + do j=shortcut(sh2),endi + ext = exa + do ni=1,Nint + ext += popcnt(xor(sorted(ni,i), sorted(ni,j))) + end do + if(ext <= 4) then + org_i = sort_idx(i) + org_j = sort_idx(j) + if ( (dabs(u_0(org_j)) > 1.d-7).or.((dabs(u_0(org_i)) > 1.d-7)) ) then + call i_H_j(keys_tmp(1,1,org_j),keys_tmp(1,1,org_i),Nint,hij) + vt (org_i) = vt (org_i) + hij*u_0(org_j) + vt (org_j) = vt (org_j) + hij*u_0(org_i) + endif + end if + end do + end do + end do + enddo + !$OMP END DO + end do + + + + !$OMP DO SCHEDULE(guided) do ii=1,n_det_ref i = idx_ref(ii) diff --git a/src/Determinants/davidson.irp.f b/src/Determinants/davidson.irp.f index b017570a..ebc30e99 100644 --- a/src/Determinants/davidson.irp.f +++ b/src/Determinants/davidson.irp.f @@ -121,35 +121,35 @@ subroutine tamiser(key, idx, no, n, Nint, N_key) end subroutine -subroutine sort_dets_ba_v(key, idx, shortcut, version, N_key, Nint) +subroutine sort_dets_ba_v(key_in, key_out, idx, shortcut, version, N_key, Nint) use bitmasks implicit none - integer(bit_kind),intent(inout) :: key(Nint,2,N_key) + integer(bit_kind),intent(in) :: key_in(Nint,2,N_key) + integer(bit_kind) :: key(Nint,2,N_key) + integer(bit_kind),intent(out) :: key_out(Nint,N_key) integer,intent(out) :: idx(N_key) integer,intent(out) :: shortcut(0:N_key+1) integer(bit_kind),intent(out) :: version(Nint,N_key+1) integer, intent(in) :: Nint, N_key integer(bit_kind) :: tmp(Nint, 2,N_key) - tmp(:,1,:N_key) = key(:,2,:N_key) - tmp(:,2,:N_key) = key(:,1,:N_key) + key(:,1,:N_key) = key_in(:,2,:N_key) + key(:,2,:N_key) = key_in(:,1,:N_key) - call sort_dets_ab_v(tmp, idx, shortcut, version, N_key, Nint) - - - key(:,1,:N_key) = tmp(:,2,:N_key) - key(:,2,:N_key) = tmp(:,1,:N_key) + call sort_dets_ab_v(key, key_out, idx, shortcut, version, N_key, Nint) end subroutine -subroutine sort_dets_ab_v(key, idx, shortcut, version, N_key, Nint) +subroutine sort_dets_ab_v(key_in, key_out, idx, shortcut, version, N_key, Nint) use bitmasks implicit none - integer(bit_kind),intent(inout) :: key(Nint,2,N_key) + integer(bit_kind),intent(in) :: key_in(Nint,2,N_key) + integer(bit_kind) :: key(Nint,2,N_key) + integer(bit_kind),intent(out) :: key_out(Nint,N_key) integer,intent(out) :: idx(N_key) integer,intent(out) :: shortcut(0:N_key+1) integer(bit_kind),intent(out) :: version(Nint,N_key+1) @@ -157,6 +157,7 @@ subroutine sort_dets_ab_v(key, idx, shortcut, version, N_key, Nint) integer(bit_kind) :: tmp(Nint, 2) integer :: tmpidx,i,ni + key(:,:,:) = key_in(:,:,:) do i=1,N_key idx(i) = i end do @@ -188,6 +189,7 @@ subroutine sort_dets_ab_v(key, idx, shortcut, version, N_key, Nint) end do end do shortcut(shortcut(0)+1) = N_key+1 + key_out(:,:) = key(:,2,:) end subroutine c diff --git a/src/Determinants/s2.irp.f b/src/Determinants/s2.irp.f index 33b3c45d..89d0a72b 100644 --- a/src/Determinants/s2.irp.f +++ b/src/Determinants/s2.irp.f @@ -106,78 +106,182 @@ subroutine get_s2_u0_old(psi_keys_tmp,psi_coefs_tmp,n,nmax,s2) s2 += S_z2_Sz end - subroutine get_s2_u0(psi_keys_tmp,psi_coefs_tmp,n,nmax,s2) - implicit none - use bitmasks - integer(bit_kind), intent(in) :: psi_keys_tmp(N_int,2,nmax) - integer, intent(in) :: n,nmax - double precision, intent(in) :: psi_coefs_tmp(nmax) - double precision, intent(out) :: s2 - double precision :: s2_tmp - integer :: i,j,l,jj,ii - integer, allocatable :: idx(:) + implicit none + use bitmasks + integer(bit_kind), intent(in) :: psi_keys_tmp(N_int,2,nmax) + integer, intent(in) :: n,nmax + double precision, intent(in) :: psi_coefs_tmp(nmax) + double precision, intent(out) :: s2 + double precision :: s2_tmp + integer :: i,j,l,jj,ii + integer, allocatable :: idx(:) - integer(bit_kind) :: psi_keys_srt(N_int,2,n) - integer :: shortcut(0:n+1), sort_idx(n), warp(2,0:n+1), ni, sh, tmp - - - print *, "totolacitrouille" - call write_time(6) - psi_keys_srt(:,:,:) = psi_keys_tmp(:,:,:) - call sort_dets_ab(psi_keys_srt, sort_idx, shortcut, n, N_int) - print *, "totolacitrouille 2" - s2 = 0.d0 - !$OMP PARALLEL DEFAULT(NONE) & - !$OMP PRIVATE(i,j,s2_tmp,idx,warp,tmp) & - !$OMP SHARED(n,psi_coefs_tmp,psi_keys_tmp,N_int,davidson_threshold,shortcut,psi_keys_srt,sort_idx)& - !$OMP REDUCTION(+:s2) - allocate(idx(0:n)) - !$OMP DO SCHEDULE(dynamic) - - do sh=1,shortcut(0) - warp(1,0) = 0 - do ii=1,sh!shortcut(0) - tmp = 0 - do ni=1,N_int - tmp = popcnt(xor(psi_keys_tmp(ni,1, shortcut(ii)), psi_keys_tmp(ni,1,shortcut(sh)))) - end do - if(tmp <= 4) then - tmp = warp(1,0) + 1 - warp(1,0) = tmp - warp(1,tmp) = shortcut(ii) - warp(2,tmp) = shortcut(ii+1)-1 - end if - end do + integer :: shortcut(0:n+1), sort_idx(n) + integer(bit_kind) :: sorted(N_int,n), version(N_int,n) + integer :: sh, sh2, ni, exa, ext, org_i, org_j, endi, pass + double precision :: davidson_threshold_bis + + !PROVIDE davidson_threshold + + s2 = 0.d0 + davidson_threshold_bis = davidson_threshold + !$OMP PARALLEL DEFAULT(NONE) & + !$OMP PRIVATE(i,j,s2_tmp,idx,sh, sh2, ni, exa, ext, org_i, org_j, endi, pass) & + !$OMP SHARED(n,psi_coefs_tmp,psi_keys_tmp,N_int,davidson_threshold,shortcut,sorted,sort_idx,version)& + !$OMP REDUCTION(+:s2) + allocate(idx(0:n)) + + do pass=1,2 + if(pass == 1) then + call sort_dets_ab_v(psi_keys_tmp, sorted, sort_idx, shortcut, version, n, N_int) + else + call sort_dets_ba_v(psi_keys_tmp, sorted, sort_idx, shortcut, version, n, N_int) + end if - do ii=shortcut(sh),shortcut(sh+1)-1 - !do ii=1,n - idx(0) = ii - call filter_connected_davidson_warp(psi_keys_srt,warp,psi_keys_srt(1,1,ii),N_int,ii-1,idx) - i = sort_idx(ii) - do jj=1,idx(0) - j = sort_idx(idx(jj)) - if ( dabs(psi_coefs_tmp(j)) + dabs(psi_coefs_tmp(i)) & - > davidson_threshold ) then - call get_s2(psi_keys_srt(1,1,ii),psi_keys_srt(1,1,idx(jj)),s2_tmp,N_int) - s2 = s2 + psi_coefs_tmp(i)*psi_coefs_tmp(j)*s2_tmp - endif - enddo - end do - enddo - !$OMP END DO + + !$OMP DO SCHEDULE(dynamic) + do sh=1,shortcut(0) + + if(pass == 2) then + endi = sh + else + endi = 1 + end if + + do sh2=endi,sh + exa = 0 + do ni=1,N_int + exa += popcnt(xor(version(ni,sh), version(ni,sh2))) + end do + if(exa > 2) then + cycle + end if + + do i=shortcut(sh),shortcut(sh+1)-1 + if(sh==sh2) then + endi = i-1 + else + endi = shortcut(sh2+1)-1 + end if + + do j=shortcut(sh2),endi + ext = exa + do ni=1,N_int + ext += popcnt(xor(sorted(ni,i), sorted(ni,j))) + end do + if(ext <= 4) then + org_i = sort_idx(i) + org_j = sort_idx(j) + + + if ( dabs(psi_coefs_tmp(org_j)) + dabs(psi_coefs_tmp(org_i)) & + > davidson_threshold ) then + call get_s2(psi_keys_tmp(1,1,org_i),psi_keys_tmp(1,1,org_j),s2_tmp,N_int) + s2 = s2 + psi_coefs_tmp(org_i)*psi_coefs_tmp(org_j)*s2_tmp + endif + + end if + end do + end do + end do + enddo + !$OMP END DO + end do deallocate(idx) !$OMP END PARALLEL s2 = s2+s2 do i=1,n - call get_s2(psi_keys_srt(1,1,sort_idx(i)),psi_keys_srt(1,1,sort_idx(i)),s2_tmp,N_int) + call get_s2(psi_keys_tmp(1,1,i),psi_keys_tmp(1,1,i),s2_tmp,N_int) s2 = s2 + psi_coefs_tmp(i)*psi_coefs_tmp(i)*s2_tmp enddo s2 = s2 + S_z2_Sz - print *, "totolacitrouille 3" - call write_time(6) end + + + +! subroutine get_s2_u0(psi_keys_tmp,psi_coefs_tmp,n,nmax,s2) +! implicit none +! use bitmasks +! integer(bit_kind), intent(in) :: psi_keys_tmp(N_int,2,nmax) +! integer, intent(in) :: n,nmax +! double precision, intent(in) :: psi_coefs_tmp(nmax) +! double precision, intent(out) :: s2 +! double precision :: s2_tmp +! integer :: i,j,l,jj,ii +! integer, allocatable :: idx(:) +! +! integer(bit_kind) :: psi_keys_srt(N_int,2,n) +! integer :: shortcut(0:n+1), sort_idx(n), warp(2,0:n+1), ni, sh, tmp +! integer :: mon, bie, egz +! +! +! psi_keys_srt(:,:,:) = psi_keys_tmp(:,:,:) +! call sort_dets_ab(psi_keys_srt, sort_idx, shortcut, n, N_int) +! +! s2 = 0.d0 +! !$OMP PARALLEL DEFAULT(NONE) & +! !$OMP PRIVATE(i,j,s2_tmp,idx,warp,tmp,mon,bie,egz) & +! !$OMP SHARED(n,psi_coefs_tmp,psi_keys_tmp,N_int,davidson_threshold,shortcut,psi_keys_srt,sort_idx)& +! !$OMP REDUCTION(+:s2) +! allocate(idx(0:n)) +! !$OMP DO SCHEDULE(dynamic) +! +! do sh=1,shortcut(0) +! mon = 0 +! bie = 0 +! +! warp(1,0) = 0 +! do ii=1,sh!shortcut(0) +! tmp = 0 +! do ni=1,N_int +! tmp += popcnt(xor(psi_keys_tmp(ni,1, shortcut(ii)), psi_keys_tmp(ni,1,shortcut(sh)))) +! end do +! egz = tmp +! if(tmp <= 4) then +! tmp = warp(1,0) + 1 +! warp(1,0) = tmp +! warp(1,tmp) = shortcut(ii) +! warp(2,tmp) = shortcut(ii+1)-1 +! if(egz == 4) then +! bie = bie + shortcut(ii+1) - shortcut(ii) +! else +! mon = mon + shortcut(ii+1) - shortcut(ii) +! end if +! end if +! end do +! +! if(shortcut(sh+1) - shortcut(sh) /= 1) then +! print *, shortcut(sh+1) - shortcut(sh), shortcut(sh+1), mon, bie +! end if +! +! do ii=shortcut(sh),shortcut(sh+1)-1 +! !do ii=1,n +! idx(0) = ii +! call filter_connected_davidson_warp(psi_keys_srt,warp,psi_keys_srt(1,1,ii),N_int,ii-1,idx) +! i = sort_idx(ii) +! do jj=1,idx(0) +! j = sort_idx(idx(jj)) +! if ( dabs(psi_coefs_tmp(j)) + dabs(psi_coefs_tmp(i)) & +! > davidson_threshold ) then +! call get_s2(psi_keys_srt(1,1,ii),psi_keys_srt(1,1,idx(jj)),s2_tmp,N_int) +! s2 = s2 + psi_coefs_tmp(i)*psi_coefs_tmp(j)*s2_tmp +! endif +! enddo +! end do +! enddo +! !$OMP END DO +! deallocate(idx) +! !$OMP END PARALLEL +! s2 = s2+s2 +! do i=1,n +! call get_s2(psi_keys_srt(1,1,sort_idx(i)),psi_keys_srt(1,1,sort_idx(i)),s2_tmp,N_int) +! s2 = s2 + psi_coefs_tmp(i)*psi_coefs_tmp(i)*s2_tmp +! enddo +! s2 = s2 + S_z2_Sz +! end + ! ! subroutine get_s2_u0_org(psi_keys_tmp,psi_coefs_tmp,n,nmax,s2) ! implicit none From 4eed037ecf8a1d2828b19845525fe33655c7f645 Mon Sep 17 00:00:00 2001 From: Yann Garniron Date: Mon, 2 Nov 2015 20:56:02 +0100 Subject: [PATCH 17/20] corrected parallelism bug --- plugins/MRCC_Utils/davidson.irp.f | 103 +++++++++++++++------------ src/Determinants/davidson.irp.f | 1 + src/Determinants/s2.irp.f | 112 +++++++++++++++++------------- 3 files changed, 123 insertions(+), 93 deletions(-) diff --git a/plugins/MRCC_Utils/davidson.irp.f b/plugins/MRCC_Utils/davidson.irp.f index 1757305c..9216877c 100644 --- a/plugins/MRCC_Utils/davidson.irp.f +++ b/plugins/MRCC_Utils/davidson.irp.f @@ -495,6 +495,8 @@ subroutine H_u_0_mrcc(v_0,u_0,H_jj,n,keys_tmp,Nint,istate) integer :: shortcut(0:n+1), sort_idx(n) integer(bit_kind) :: sorted(Nint,n), version(Nint,n) + + integer :: sh, sh2, ni, exa, ext, org_i, org_j, endi, pass ! @@ -520,61 +522,72 @@ subroutine H_u_0_mrcc(v_0,u_0,H_jj,n,keys_tmp,Nint,istate) allocate(idx(0:n), vt(n)) Vt = 0.d0 - do pass=1,2 - if(pass == 1) then - call sort_dets_ab_v(keys_tmp, sorted, sort_idx, shortcut, version, n, Nint) - else - call sort_dets_ba_v(keys_tmp, sorted, sort_idx, shortcut, version, n, Nint) - end if - + + !$OMP SINGLE + call sort_dets_ab_v(keys_tmp, sorted, sort_idx, shortcut, version, n, Nint) + !$OMP END SINGLE + - !$OMP DO SCHEDULE(dynamic) - do sh=1,shortcut(0) - - if(pass == 2) then - endi = sh - else - endi = 1 + !$OMP DO SCHEDULE(dynamic) + do sh=1,shortcut(0) + do sh2=1,sh + exa = 0 + do ni=1,Nint + exa += popcnt(xor(version(ni,sh), version(ni,sh2))) + end do + if(exa > 2) then + cycle end if - do sh2=endi,sh - exa = 0 - do ni=1,Nint - exa += popcnt(xor(version(ni,sh), version(ni,sh2))) - end do - if(exa > 2) then - cycle + do i=shortcut(sh),shortcut(sh+1)-1 + if(sh==sh2) then + endi = i-1 + else + endi = shortcut(sh2+1)-1 end if - do i=shortcut(sh),shortcut(sh+1)-1 - if(sh==sh2) then - endi = i-1 - else - endi = shortcut(sh2+1)-1 - end if - - do j=shortcut(sh2),endi - ext = exa - do ni=1,Nint - ext += popcnt(xor(sorted(ni,i), sorted(ni,j))) - end do - if(ext <= 4) then - org_i = sort_idx(i) - org_j = sort_idx(j) - if ( (dabs(u_0(org_j)) > 1.d-7).or.((dabs(u_0(org_i)) > 1.d-7)) ) then - call i_H_j(keys_tmp(1,1,org_j),keys_tmp(1,1,org_i),Nint,hij) - vt (org_i) = vt (org_i) + hij*u_0(org_j) - vt (org_j) = vt (org_j) + hij*u_0(org_i) - endif - end if + do j=shortcut(sh2),endi + ext = exa + do ni=1,Nint + ext += popcnt(xor(sorted(ni,i), sorted(ni,j))) end do + if(ext <= 4) then + org_i = sort_idx(i) + org_j = sort_idx(j) + + call i_H_j(keys_tmp(1,1,org_j),keys_tmp(1,1,org_i),Nint,hij) + vt (org_i) = vt (org_i) + hij*u_0(org_j) + vt (org_j) = vt (org_j) + hij*u_0(org_i) + end if end do end do - enddo - !$OMP END DO end do - + enddo + !$OMP END DO + !$OMP SINGLE + call sort_dets_ba_v(keys_tmp, sorted, sort_idx, shortcut, version, n, Nint) + !$OMP END SINGLE + + !$OMP DO SCHEDULE(dynamic) + do sh=1,shortcut(0) + do i=shortcut(sh),shortcut(sh+1)-1 + do j=shortcut(sh),i-1 + ext = 0 + do ni=1,Nint + ext += popcnt(xor(sorted(ni,i), sorted(ni,j))) + end do + if(ext <= 4) then + org_i = sort_idx(i) + org_j = sort_idx(j) + call i_H_j(keys_tmp(1,1,org_j),keys_tmp(1,1,org_i),Nint,hij) + vt (org_i) = vt (org_i) + hij*u_0(org_j) + vt (org_j) = vt (org_j) + hij*u_0(org_i) + end if + end do + end do + enddo + !$OMP END DO !$OMP DO SCHEDULE(guided) diff --git a/src/Determinants/davidson.irp.f b/src/Determinants/davidson.irp.f index ebc30e99..5e931f14 100644 --- a/src/Determinants/davidson.irp.f +++ b/src/Determinants/davidson.irp.f @@ -178,6 +178,7 @@ subroutine sort_dets_ab_v(key_in, key_out, idx, shortcut, version, N_key, Nint) shortcut(0) = 1 shortcut(1) = 1 + version(:,1) = key(:,1,1) do i=2,N_key do ni=1,nint if(key(ni,1,i) /= key(ni,1,i-1)) then diff --git a/src/Determinants/s2.irp.f b/src/Determinants/s2.irp.f index 89d0a72b..c11b2161 100644 --- a/src/Determinants/s2.irp.f +++ b/src/Determinants/s2.irp.f @@ -132,62 +132,78 @@ subroutine get_s2_u0(psi_keys_tmp,psi_coefs_tmp,n,nmax,s2) !$OMP REDUCTION(+:s2) allocate(idx(0:n)) - do pass=1,2 - if(pass == 1) then - call sort_dets_ab_v(psi_keys_tmp, sorted, sort_idx, shortcut, version, n, N_int) - else - call sort_dets_ba_v(psi_keys_tmp, sorted, sort_idx, shortcut, version, n, N_int) + + !$OMP SINGLE + call sort_dets_ab_v(psi_keys_tmp, sorted, sort_idx, shortcut, version, n, N_int) + !$OMP END SINGLE + + !$OMP DO SCHEDULE(dynamic) + do sh=1,shortcut(0) + + do sh2=1,sh + exa = 0 + do ni=1,N_int + exa += popcnt(xor(version(ni,sh), version(ni,sh2))) + end do + if(exa > 2) then + cycle end if - - !$OMP DO SCHEDULE(dynamic) - do sh=1,shortcut(0) - - if(pass == 2) then - endi = sh - else - endi = 1 - end if - - do sh2=endi,sh - exa = 0 - do ni=1,N_int - exa += popcnt(xor(version(ni,sh), version(ni,sh2))) - end do - if(exa > 2) then - cycle + do i=shortcut(sh),shortcut(sh+1)-1 + if(sh==sh2) then + endi = i-1 + else + endi = shortcut(sh2+1)-1 end if - do i=shortcut(sh),shortcut(sh+1)-1 - if(sh==sh2) then - endi = i-1 - else - endi = shortcut(sh2+1)-1 - end if - - do j=shortcut(sh2),endi - ext = exa - do ni=1,N_int - ext += popcnt(xor(sorted(ni,i), sorted(ni,j))) - end do - if(ext <= 4) then - org_i = sort_idx(i) - org_j = sort_idx(j) - - - if ( dabs(psi_coefs_tmp(org_j)) + dabs(psi_coefs_tmp(org_i)) & - > davidson_threshold ) then - call get_s2(psi_keys_tmp(1,1,org_i),psi_keys_tmp(1,1,org_j),s2_tmp,N_int) - s2 = s2 + psi_coefs_tmp(org_i)*psi_coefs_tmp(org_j)*s2_tmp - endif - - end if + do j=shortcut(sh2),endi + ext = exa + do ni=1,N_int + ext += popcnt(xor(sorted(ni,i), sorted(ni,j))) end do + if(ext <= 4) then + org_i = sort_idx(i) + org_j = sort_idx(j) + + if ( dabs(psi_coefs_tmp(org_j)) + dabs(psi_coefs_tmp(org_i)) & + > davidson_threshold ) then + call get_s2(psi_keys_tmp(1,1,org_i),psi_keys_tmp(1,1,org_j),s2_tmp,N_int) + s2 = s2 + psi_coefs_tmp(org_i)*psi_coefs_tmp(org_j)*s2_tmp + endif + end if end do end do - enddo - !$OMP END DO end do + enddo + !$OMP END DO + + !$OMP SINGLE + call sort_dets_ba_v(psi_keys_tmp, sorted, sort_idx, shortcut, version, n, N_int) + !$OMP END SINGLE + + !$OMP DO SCHEDULE(dynamic) + do sh=1,shortcut(0) + do i=shortcut(sh),shortcut(sh+1)-1 + do j=shortcut(sh),i-1 + ext = 0 + do ni=1,N_int + ext += popcnt(xor(sorted(ni,i), sorted(ni,j))) + end do + if(ext <= 4) then + org_i = sort_idx(i) + org_j = sort_idx(j) + + if ( dabs(psi_coefs_tmp(org_j)) + dabs(psi_coefs_tmp(org_i)) & + > davidson_threshold ) then + call get_s2(psi_keys_tmp(1,1,org_i),psi_keys_tmp(1,1,org_j),s2_tmp,N_int) + s2 = s2 + psi_coefs_tmp(org_i)*psi_coefs_tmp(org_j)*s2_tmp + endif + end if + end do + end do + enddo + !$OMP END DO + deallocate(idx) !$OMP END PARALLEL s2 = s2+s2 From c3bbbd60ded73cd3f217adf389380768aa696479 Mon Sep 17 00:00:00 2001 From: Yann Garniron Date: Wed, 4 Nov 2015 11:37:13 +0100 Subject: [PATCH 18/20] corrected bug in H_u_0_mrcc and get_s2_u0 --- plugins/MRCC_Utils/davidson.irp.f | 2 +- src/Determinants/s2.irp.f | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/MRCC_Utils/davidson.irp.f b/plugins/MRCC_Utils/davidson.irp.f index 9216877c..f1cff31a 100644 --- a/plugins/MRCC_Utils/davidson.irp.f +++ b/plugins/MRCC_Utils/davidson.irp.f @@ -577,7 +577,7 @@ subroutine H_u_0_mrcc(v_0,u_0,H_jj,n,keys_tmp,Nint,istate) do ni=1,Nint ext += popcnt(xor(sorted(ni,i), sorted(ni,j))) end do - if(ext <= 4) then + if(ext == 4) then org_i = sort_idx(i) org_j = sort_idx(j) call i_H_j(keys_tmp(1,1,org_j),keys_tmp(1,1,org_i),Nint,hij) diff --git a/src/Determinants/s2.irp.f b/src/Determinants/s2.irp.f index c11b2161..252810f3 100644 --- a/src/Determinants/s2.irp.f +++ b/src/Determinants/s2.irp.f @@ -189,7 +189,7 @@ subroutine get_s2_u0(psi_keys_tmp,psi_coefs_tmp,n,nmax,s2) do ni=1,N_int ext += popcnt(xor(sorted(ni,i), sorted(ni,j))) end do - if(ext <= 4) then + if(ext == 4) then org_i = sort_idx(i) org_j = sort_idx(j) From 238a5d6dd6877431a05f3b63002a183174f93a8a Mon Sep 17 00:00:00 2001 From: Yann Garniron Date: Wed, 4 Nov 2015 16:21:21 +0100 Subject: [PATCH 19/20] removed some unused functions --- plugins/MRCC_Utils/davidson.irp.f | 178 -------------------- src/Determinants/davidson.irp.f | 1 - src/Determinants/s2.irp.f | 124 -------------- src/Determinants/slater_rules.irp.f | 243 ---------------------------- 4 files changed, 546 deletions(-) diff --git a/plugins/MRCC_Utils/davidson.irp.f b/plugins/MRCC_Utils/davidson.irp.f index f1cff31a..db2fe26e 100644 --- a/plugins/MRCC_Utils/davidson.irp.f +++ b/plugins/MRCC_Utils/davidson.irp.f @@ -371,107 +371,6 @@ end -subroutine H_u_0_mrcc_myold(v_0,u_0,H_jj,n,keys_tmp,shortcut,sort_idx,Nint,istate) - use bitmasks - implicit none - BEGIN_DOC - ! Computes v_0 = H|u_0> - ! - ! n : number of determinants - ! - ! H_jj : array of - END_DOC - integer, intent(in) :: n,Nint,istate - double precision, intent(out) :: v_0(n) - double precision, intent(in) :: u_0(n) - double precision, intent(in) :: H_jj(n) - integer(bit_kind),intent(in) :: keys_tmp(Nint,2,n) - integer, allocatable :: idx(:) - double precision :: hij - double precision, allocatable :: vt(:) - integer :: i,j,k,l, jj,ii - integer :: i0, j0 - - integer,intent(in) :: shortcut(0:n+1), sort_idx(n) - integer :: tmp, warp(2,0:n+1), sh, ni -! - - ASSERT (Nint > 0) - ASSERT (Nint == N_int) - ASSERT (n>0) - PROVIDE ref_bitmask_energy delta_ij - integer, parameter :: block_size = 157 - - - !$OMP PARALLEL DEFAULT(NONE) & - !$OMP PRIVATE(i,hij,j,k,idx,jj,vt,ii,warp,tmp,sh) & - !$OMP SHARED(n_det_ref,n_det_non_ref,idx_ref,idx_non_ref,n,H_jj,u_0,keys_tmp,Nint,v_0,istate,delta_ij,shortcut,sort_idx) - - !$OMP DO SCHEDULE(static) - do i=1,n - v_0(i) = H_jj(i) * u_0(i) - enddo - !$OMP END DO - - allocate(idx(0:n), vt(n)) - Vt = 0.d0 - !$OMP DO SCHEDULE(dynamic) - do sh=1,shortcut(0) - warp(1,0) = 0 - do ii=1,sh!shortcut(0) - tmp = 0 - do ni=1,Nint - tmp = popcnt(xor(keys_tmp(ni,1, shortcut(ii)), keys_tmp(ni,1,shortcut(sh)))) - end do - if(tmp <= 4) then - tmp = warp(1,0) + 1 - warp(1,0) = tmp - warp(1,tmp) = shortcut(ii) - warp(2,tmp) = shortcut(ii+1)-1 - end if - end do - - do ii=shortcut(sh),shortcut(sh+1)-1 - idx(0) = ii - !call filter_connected_davidson_mwen(keys_tmp,shortcut,keys_tmp(1,1,ii),Nint,ii-1,idx) - call filter_connected_davidson_warp(keys_tmp,warp,keys_tmp(1,1,ii),Nint,ii-1,idx) - i = sort_idx(ii) - - do jj=1,idx(0) - j = sort_idx(idx(jj)) - !j = idx(jj) - if ( (dabs(u_0(j)) > 1.d-7).or.((dabs(u_0(i)) > 1.d-7)) ) then - call i_H_j(keys_tmp(1,1,idx(jj)),keys_tmp(1,1,ii),Nint,hij) - vt (i) = vt (i) + hij*u_0(j) - vt (j) = vt (j) + hij*u_0(i) - endif - enddo - enddo - enddo - !$OMP END DO - - - - !$OMP DO SCHEDULE(guided) - do ii=1,n_det_ref - i = idx_ref(ii) - do jj = 1, n_det_non_ref - j = idx_non_ref(jj) - vt (i) = vt (i) + delta_ij(ii,jj,istate)*u_0(j) - vt (j) = vt (j) + delta_ij(ii,jj,istate)*u_0(i) - enddo - enddo - !$OMP END DO - !$OMP CRITICAL - do i=1,n - v_0(i) = v_0(i) + vt(i) - enddo - !$OMP END CRITICAL - deallocate(idx,vt) - !$OMP END PARALLEL -end - - subroutine H_u_0_mrcc(v_0,u_0,H_jj,n,keys_tmp,Nint,istate) use bitmasks implicit none @@ -609,80 +508,3 @@ subroutine H_u_0_mrcc(v_0,u_0,H_jj,n,keys_tmp,Nint,istate) !$OMP END PARALLEL end - -! -! subroutine H_u_0_mrcc_org(v_0,u_0,H_jj,n,keys_tmp,Nint,istate) -! use bitmasks -! implicit none -! BEGIN_DOC -! ! Computes v_0 = H|u_0> -! ! -! ! n : number of determinants -! ! -! ! H_jj : array of -! END_DOC -! integer, intent(in) :: n,Nint,istate -! double precision, intent(out) :: v_0(n) -! double precision, intent(in) :: u_0(n) -! double precision, intent(in) :: H_jj(n) -! integer(bit_kind),intent(in) :: keys_tmp(Nint,2,n) -! integer, allocatable :: idx(:) -! double precision :: hij -! double precision, allocatable :: vt(:) -! integer :: i,j,k,l, jj,ii -! integer :: i0, j0 -! -! -! -! -! -! ASSERT (Nint > 0) -! ASSERT (Nint == N_int) -! ASSERT (n>0) -! PROVIDE ref_bitmask_energy delta_ij -! integer, parameter :: block_size = 157 -! !$OMP PARALLEL DEFAULT(NONE) & -! !$OMP PRIVATE(i,hij,j,k,idx,jj,ii,vt) & -! !$OMP SHARED(n_det_ref,n_det_non_ref,idx_ref,idx_non_ref,n,H_jj,u_0,keys_tmp,Nint,v_0,istate,delta_ij) -! !$OMP DO SCHEDULE(static) -! do i=1,n -! v_0(i) = H_jj(i) * u_0(i) -! enddo -! !$OMP END DO -! allocate(idx(0:n), vt(n)) -! Vt = 0.d0 -! !$OMP DO SCHEDULE(guided) -! do i=1,n -! idx(0) = i -! call filter_connected_davidson(keys_tmp,keys_tmp(1,1,i),Nint,i-1,idx) -! do jj=1,idx(0) -! j = idx(jj) -! ! if ( (dabs(u_0(j)) > 1.d-7).or.((dabs(u_0(i)) > 1.d-7)) ) then -! call i_H_j(keys_tmp(1,1,j),keys_tmp(1,1,i),Nint,hij) -! hij = hij -! vt (i) = vt (i) + hij*u_0(j) -! vt (j) = vt (j) + hij*u_0(i) -! ! endif -! enddo -! enddo -! !$OMP END DO -! -! !$OMP DO SCHEDULE(guided) -! do ii=1,n_det_ref -! i = idx_ref(ii) -! do jj = 1, n_det_non_ref -! j = idx_non_ref(jj) -! vt (i) = vt (i) + delta_ij(ii,jj,istate)*u_0(j) -! vt (j) = vt (j) + delta_ij(ii,jj,istate)*u_0(i) -! enddo -! enddo -! !$OMP END DO -! !$OMP CRITICAL -! do i=1,n -! v_0(i) = v_0(i) + vt(i) -! enddo -! !$OMP END CRITICAL -! deallocate(idx,vt) -! !$OMP END PARALLEL -! end - diff --git a/src/Determinants/davidson.irp.f b/src/Determinants/davidson.irp.f index 5e931f14..87605964 100644 --- a/src/Determinants/davidson.irp.f +++ b/src/Determinants/davidson.irp.f @@ -122,7 +122,6 @@ end subroutine subroutine sort_dets_ba_v(key_in, key_out, idx, shortcut, version, N_key, Nint) - use bitmasks implicit none integer(bit_kind),intent(in) :: key_in(Nint,2,N_key) diff --git a/src/Determinants/s2.irp.f b/src/Determinants/s2.irp.f index 252810f3..e836d25d 100644 --- a/src/Determinants/s2.irp.f +++ b/src/Determinants/s2.irp.f @@ -215,127 +215,3 @@ subroutine get_s2_u0(psi_keys_tmp,psi_coefs_tmp,n,nmax,s2) end - - -! subroutine get_s2_u0(psi_keys_tmp,psi_coefs_tmp,n,nmax,s2) -! implicit none -! use bitmasks -! integer(bit_kind), intent(in) :: psi_keys_tmp(N_int,2,nmax) -! integer, intent(in) :: n,nmax -! double precision, intent(in) :: psi_coefs_tmp(nmax) -! double precision, intent(out) :: s2 -! double precision :: s2_tmp -! integer :: i,j,l,jj,ii -! integer, allocatable :: idx(:) -! -! integer(bit_kind) :: psi_keys_srt(N_int,2,n) -! integer :: shortcut(0:n+1), sort_idx(n), warp(2,0:n+1), ni, sh, tmp -! integer :: mon, bie, egz -! -! -! psi_keys_srt(:,:,:) = psi_keys_tmp(:,:,:) -! call sort_dets_ab(psi_keys_srt, sort_idx, shortcut, n, N_int) -! -! s2 = 0.d0 -! !$OMP PARALLEL DEFAULT(NONE) & -! !$OMP PRIVATE(i,j,s2_tmp,idx,warp,tmp,mon,bie,egz) & -! !$OMP SHARED(n,psi_coefs_tmp,psi_keys_tmp,N_int,davidson_threshold,shortcut,psi_keys_srt,sort_idx)& -! !$OMP REDUCTION(+:s2) -! allocate(idx(0:n)) -! !$OMP DO SCHEDULE(dynamic) -! -! do sh=1,shortcut(0) -! mon = 0 -! bie = 0 -! -! warp(1,0) = 0 -! do ii=1,sh!shortcut(0) -! tmp = 0 -! do ni=1,N_int -! tmp += popcnt(xor(psi_keys_tmp(ni,1, shortcut(ii)), psi_keys_tmp(ni,1,shortcut(sh)))) -! end do -! egz = tmp -! if(tmp <= 4) then -! tmp = warp(1,0) + 1 -! warp(1,0) = tmp -! warp(1,tmp) = shortcut(ii) -! warp(2,tmp) = shortcut(ii+1)-1 -! if(egz == 4) then -! bie = bie + shortcut(ii+1) - shortcut(ii) -! else -! mon = mon + shortcut(ii+1) - shortcut(ii) -! end if -! end if -! end do -! -! if(shortcut(sh+1) - shortcut(sh) /= 1) then -! print *, shortcut(sh+1) - shortcut(sh), shortcut(sh+1), mon, bie -! end if -! -! do ii=shortcut(sh),shortcut(sh+1)-1 -! !do ii=1,n -! idx(0) = ii -! call filter_connected_davidson_warp(psi_keys_srt,warp,psi_keys_srt(1,1,ii),N_int,ii-1,idx) -! i = sort_idx(ii) -! do jj=1,idx(0) -! j = sort_idx(idx(jj)) -! if ( dabs(psi_coefs_tmp(j)) + dabs(psi_coefs_tmp(i)) & -! > davidson_threshold ) then -! call get_s2(psi_keys_srt(1,1,ii),psi_keys_srt(1,1,idx(jj)),s2_tmp,N_int) -! s2 = s2 + psi_coefs_tmp(i)*psi_coefs_tmp(j)*s2_tmp -! endif -! enddo -! end do -! enddo -! !$OMP END DO -! deallocate(idx) -! !$OMP END PARALLEL -! s2 = s2+s2 -! do i=1,n -! call get_s2(psi_keys_srt(1,1,sort_idx(i)),psi_keys_srt(1,1,sort_idx(i)),s2_tmp,N_int) -! s2 = s2 + psi_coefs_tmp(i)*psi_coefs_tmp(i)*s2_tmp -! enddo -! s2 = s2 + S_z2_Sz -! end - -! -! subroutine get_s2_u0_org(psi_keys_tmp,psi_coefs_tmp,n,nmax,s2) -! implicit none -! use bitmasks -! integer(bit_kind), intent(in) :: psi_keys_tmp(N_int,2,nmax) -! integer, intent(in) :: n,nmax -! double precision, intent(in) :: psi_coefs_tmp(nmax) -! double precision, intent(out) :: s2 -! double precision :: s2_tmp -! integer :: i,j,l,jj -! integer, allocatable :: idx(:) -! s2 = 0.d0 -! !$OMP PARALLEL DEFAULT(NONE) & -! !$OMP PRIVATE(i,j,s2_tmp,idx) & -! !$OMP SHARED(n,psi_coefs_tmp,psi_keys_tmp,N_int,davidson_threshold)& -! !$OMP REDUCTION(+:s2) -! allocate(idx(0:n)) -! !$OMP DO SCHEDULE(dynamic) -! do i=1,n -! idx(0) = i -! call filter_connected_davidson(psi_keys_tmp,psi_keys_tmp(1,1,i),N_int,i-1,idx) -! do jj=1,idx(0) -! j = idx(jj) -! if ( dabs(psi_coefs_tmp(j)) + dabs(psi_coefs_tmp(i)) & -! > davidson_threshold ) then -! call get_s2(psi_keys_tmp(1,1,i),psi_keys_tmp(1,1,j),s2_tmp,N_int) -! s2 = s2 + psi_coefs_tmp(i)*psi_coefs_tmp(j)*s2_tmp -! endif -! enddo -! enddo -! !$OMP END DO -! deallocate(idx) -! !$OMP END PARALLEL -! s2 = s2+s2 -! do i=1,n -! call get_s2(psi_keys_tmp(1,1,i),psi_keys_tmp(1,1,i),s2_tmp,N_int) -! s2 = s2 + psi_coefs_tmp(i)*psi_coefs_tmp(i)*s2_tmp -! enddo -! s2 = s2 + S_z2_Sz -! end -! diff --git a/src/Determinants/slater_rules.irp.f b/src/Determinants/slater_rules.irp.f index 1c8573dd..acffeb3d 100644 --- a/src/Determinants/slater_rules.irp.f +++ b/src/Determinants/slater_rules.irp.f @@ -1299,247 +1299,4 @@ subroutine H_u_0(v_0,u_0,H_jj,n,keys_tmp,shortcut,sort_idx,Nint) enddo end -! -! subroutine H_u_0_org(v_0,u_0,H_jj,n,keys_tmp,Nint) -! use bitmasks -! implicit none -! BEGIN_DOC -! ! Computes v_0 = H|u_0> -! ! -! ! n : number of determinants -! ! -! ! H_jj : array of -! END_DOC -! integer, intent(in) :: n,Nint -! double precision, intent(out) :: v_0(n) -! double precision, intent(in) :: u_0(n) -! double precision, intent(in) :: H_jj(n) -! integer(bit_kind),intent(in) :: keys_tmp(Nint,2,n) -! integer, allocatable :: idx(:) -! double precision :: hij -! double precision, allocatable :: vt(:) -! integer :: i,j,k,l, jj,ii,sh -! integer :: i0, j0 -! -! -! -! ASSERT (Nint > 0) -! ASSERT (Nint == N_int) -! ASSERT (n>0) -! PROVIDE ref_bitmask_energy -! !$OMP PARALLEL DEFAULT(NONE) & -! !$OMP PRIVATE(i,hij,j,k,idx,jj,vt,ii) & -! !$OMP SHARED(n,H_jj,u_0,keys_tmp,Nint,v_0,davidson_threshold) -! allocate(idx(0:n), vt(n)) -! Vt = 0.d0 -! v_0 = 0.d0 -! !$OMP DO SCHEDULE(guided) -! -! -! -! -! -! do ii=1,n -! idx(0) = ii -! i = ii -! call filter_connected_davidson(keys_tmp,keys_tmp(1,1,ii),Nint,ii-1,idx) -! -! do jj=1,idx(0) -! j = idx(jj) -! if ( dabs(u_0(j)) + dabs(u_0(i)) > davidson_threshold ) then -! call i_H_j(keys_tmp(1,1,idx(jj)),keys_tmp(1,1,ii),Nint,hij) -! vt (i) = vt (i) + hij*u_0(j) -! vt (j) = vt (j) + hij*u_0(i) -! endif -! enddo -! enddo -! -! !$OMP END DO -! !$OMP CRITICAL -! do i=1,n -! v_0(i) = v_0(i) + vt(i) -! enddo -! !$OMP END CRITICAL -! deallocate(idx,vt) -! !$OMP END PARALLEL -! do i=1,n -! v_0(i) += H_jj(i) * u_0(i) -! enddo -! end -! - - -BEGIN_PROVIDER [ integer, N_con_int ] - implicit none - BEGIN_DOC - ! Number of integers to represent the connections between determinants - END_DOC - N_con_int = 1 + ishft(N_det-1,-11) -END_PROVIDER - -! BEGIN_PROVIDER [ integer*8, det_connectionsqsd, (N_con_int,N_det) ] -! implicit none -! BEGIN_DOC -! ! Build connection proxy between determinants -! END_DOC -! integer :: i,j -! integer :: degree -! integer :: j_int, j_k, j_l -! integer, allocatable :: idx(:) -! integer :: thread_num -! integer :: omp_get_thread_num -! -! PROVIDE progress_bar -! -! print *,"totolabanane" -! -! call start_progress(N_det,'Det connections',0.d0) -! -! select case(N_int) -! -! case(1) -! -! -! !$OMP PARALLEL DEFAULT (NONE) & -! !$OMP SHARED(N_det, N_con_int, psi_det,N_int, det_connections, & -! !$OMP progress_bar,progress_value)& -! !$OMP PRIVATE(i,j_int,j_k,j_l,j,degree,idx,thread_num) -! -! !$ thread_num = omp_get_thread_num() -! allocate (idx(0:N_det)) -! !$OMP DO SCHEDULE(guided) -! do i=1,N_det -! if (thread_num == 0) then -! progress_bar(1) = i -! progress_value = dble(i) -! endif -! do j_int=1,N_con_int -! det_connections(j_int,i) = 0_8 -! j_k = ishft(j_int-1,11) -! do j_l = j_k,min(j_k+2047,N_det), 32 -! do j = j_l+1,min(j_l+32,i) -! degree = popcnt(xor( psi_det(1,1,i),psi_det(1,1,j))) + & -! popcnt(xor( psi_det(1,2,i),psi_det(1,2,j))) -! if (degree < 5) then -! det_connections(j_int,i) = ibset( det_connections(j_int,i), iand(63,ishft(j_l,-5)) ) -! exit -! endif -! enddo -! enddo -! enddo -! enddo -! !$OMP ENDDO -! deallocate(idx) -! !$OMP END PARALLEL -! -! case(2) -! -! !$OMP PARALLEL DEFAULT (NONE) & -! !$OMP SHARED(N_det, N_con_int, psi_det,N_int, det_connections,& -! !$OMP progress_bar,progress_value)& -! !$OMP PRIVATE(i,j_int,j_k,j_l,j,degree,idx,thread_num) -! !$ thread_num = omp_get_thread_num() -! allocate (idx(0:N_det)) -! !$OMP DO SCHEDULE(guided) -! do i=1,N_det -! if (thread_num == 0) then -! progress_bar(1) = i -! progress_value = dble(i) -! endif -! do j_int=1,N_con_int -! det_connections(j_int,i) = 0_8 -! j_k = ishft(j_int-1,11) -! do j_l = j_k,min(j_k+2047,N_det), 32 -! do j = j_l+1,min(j_l+32,i) -! degree = popcnt(xor( psi_det(1,1,i),psi_det(1,1,j))) + & -! popcnt(xor( psi_det(1,2,i),psi_det(1,2,j))) + & -! popcnt(xor( psi_det(2,1,i),psi_det(2,1,j))) + & -! popcnt(xor( psi_det(2,2,i),psi_det(2,2,j))) -! if (degree < 5) then -! det_connections(j_int,i) = ibset( det_connections(j_int,i), iand(63,ishft(j_l,-5)) ) -! exit -! endif -! enddo -! enddo -! enddo -! enddo -! !$OMP ENDDO -! deallocate(idx) -! !$OMP END PARALLEL -! -! case(3) -! -! !$OMP PARALLEL DEFAULT (NONE) & -! !$OMP SHARED(N_det, N_con_int, psi_det,N_int, det_connections,& -! !$OMP progress_bar,progress_value)& -! !$OMP PRIVATE(i,j_int,j_k,j_l,j,degree,idx,thread_num) -! !$ thread_num = omp_get_thread_num() -! allocate (idx(0:N_det)) -! !$OMP DO SCHEDULE(guided) -! do i=1,N_det -! if (thread_num == 0) then -! progress_bar(1) = i -! progress_value = dble(i) -! endif -! do j_int=1,N_con_int -! det_connections(j_int,i) = 0_8 -! j_k = ishft(j_int-1,11) -! do j_l = j_k,min(j_k+2047,N_det), 32 -! do j = j_l+1,min(j_l+32,i) -! degree = popcnt(xor( psi_det(1,1,i),psi_det(1,1,j))) + & -! popcnt(xor( psi_det(1,2,i),psi_det(1,2,j))) + & -! popcnt(xor( psi_det(2,1,i),psi_det(2,1,j))) + & -! popcnt(xor( psi_det(2,2,i),psi_det(2,2,j))) + & -! popcnt(xor( psi_det(3,1,i),psi_det(3,1,j))) + & -! popcnt(xor( psi_det(3,2,i),psi_det(3,2,j))) -! if (degree < 5) then -! det_connections(j_int,i) = ibset( det_connections(j_int,i), iand(63,ishft(j_l,-5)) ) -! exit -! endif -! enddo -! enddo -! enddo -! enddo -! !$OMP ENDDO -! deallocate(idx) -! !$OMP END PARALLEL -! -! case default -! -! -! !$OMP PARALLEL DEFAULT (NONE) & -! !$OMP SHARED(N_det, N_con_int, psi_det,N_int, det_connections,& -! !$OMP progress_bar,progress_value)& -! !$OMP PRIVATE(i,j_int,j_k,j_l,j,degree,idx,thread_num) -! !$ thread_num = omp_get_thread_num() -! allocate (idx(0:N_det)) -! !$OMP DO SCHEDULE(guided) -! do i=1,N_det -! if (thread_num == 0) then -! progress_bar(1) = i -! progress_value = dble(i) -! endif -! do j_int=1,N_con_int -! det_connections(j_int,i) = 0_8 -! j_k = ishft(j_int-1,11) -! do j_l = j_k,min(j_k+2047,N_det), 32 -! do j = j_l+1,min(j_l+32,i) -! !DIR$ FORCEINLINE -! call get_excitation_degree(psi_det(1,1,i),psi_det(1,1,j),degree,N_int) -! if (degree < 3) then -! det_connections(j_int,i) = ibset( det_connections(j_int,i), iand(63,ishft(j_l,-5)) ) -! exit -! endif -! enddo -! enddo -! enddo -! enddo -! !$OMP ENDDO -! deallocate(idx) -! !$OMP END PARALLEL -! -! end select -! call stop_progress -! -! END_PROVIDER From 2d3ba8003b05cb406674cc93a9bfc917d94db7fc Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Sat, 7 Nov 2015 01:21:54 +0100 Subject: [PATCH 20/20] Accelerated CIPSI reducing buffers in generate_h_apply --- plugins/MRCC_Utils/README.rst | 10 +------ plugins/Perturbation/README.rst | 20 ++++++------- scripts/generate_h_apply.py | 4 +-- src/Determinants/README.rst | 52 +++++---------------------------- src/Ezfio_files/README.rst | 48 +++++++++++++----------------- 5 files changed, 41 insertions(+), 93 deletions(-) diff --git a/plugins/MRCC_Utils/README.rst b/plugins/MRCC_Utils/README.rst index a332ad0c..3e14ba52 100644 --- a/plugins/MRCC_Utils/README.rst +++ b/plugins/MRCC_Utils/README.rst @@ -312,15 +312,7 @@ Documentation Dressed H with Delta_ij -`h_u_0_mrcc `_ - Computes v_0 = H|u_0> - .br - n : number of determinants - .br - H_jj : array of - - -`h_u_0_mrcc_org `_ +`h_u_0_mrcc `_ Computes v_0 = H|u_0> .br n : number of determinants diff --git a/plugins/Perturbation/README.rst b/plugins/Perturbation/README.rst index 0307ec12..aa6ebf54 100644 --- a/plugins/Perturbation/README.rst +++ b/plugins/Perturbation/README.rst @@ -107,22 +107,22 @@ Documentation Undocumented -`perturb_buffer_by_mono_delta_rho_one_point `_ +`perturb_buffer_by_mono_delta_rho_one_point `_ Applly pertubration ``delta_rho_one_point`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_by_mono_dipole_moment_z `_ +`perturb_buffer_by_mono_dipole_moment_z `_ Applly pertubration ``dipole_moment_z`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_by_mono_epstein_nesbet `_ +`perturb_buffer_by_mono_epstein_nesbet `_ Applly pertubration ``epstein_nesbet`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_by_mono_epstein_nesbet_2x2 `_ +`perturb_buffer_by_mono_epstein_nesbet_2x2 `_ Applly pertubration ``epstein_nesbet_2x2`` to the buffer of determinants generated in the H_apply routine. @@ -142,7 +142,7 @@ Documentation routine. -`perturb_buffer_by_mono_h_core `_ +`perturb_buffer_by_mono_h_core `_ Applly pertubration ``h_core`` to the buffer of determinants generated in the H_apply routine. @@ -152,22 +152,22 @@ Documentation routine. -`perturb_buffer_delta_rho_one_point `_ +`perturb_buffer_delta_rho_one_point `_ Applly pertubration ``delta_rho_one_point`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_dipole_moment_z `_ +`perturb_buffer_dipole_moment_z `_ Applly pertubration ``dipole_moment_z`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_epstein_nesbet `_ +`perturb_buffer_epstein_nesbet `_ Applly pertubration ``epstein_nesbet`` to the buffer of determinants generated in the H_apply routine. -`perturb_buffer_epstein_nesbet_2x2 `_ +`perturb_buffer_epstein_nesbet_2x2 `_ Applly pertubration ``epstein_nesbet_2x2`` to the buffer of determinants generated in the H_apply routine. @@ -187,7 +187,7 @@ Documentation routine. -`perturb_buffer_h_core `_ +`perturb_buffer_h_core `_ Applly pertubration ``h_core`` to the buffer of determinants generated in the H_apply routine. diff --git a/scripts/generate_h_apply.py b/scripts/generate_h_apply.py index 51ef5090..b22797f9 100755 --- a/scripts/generate_h_apply.py +++ b/scripts/generate_h_apply.py @@ -99,7 +99,7 @@ class H_apply(object): deallocate(H_jj,iorder) """ - s["size_max"] = str(1024*128) + s["size_max"] = "256" s["copy_buffer"] = """call copy_H_apply_buffer_to_wf if (s2_eig) then call make_s2_eigenfunction @@ -266,7 +266,7 @@ class H_apply(object): double precision, intent(inout) :: select_max_out""" self.data["params_post"] += ", select_max(min(i_generator,size(select_max,1)))" - self.data["size_max"] = str(1024*128) + self.data["size_max"] = "256" self.data["copy_buffer"] = """ call copy_H_apply_buffer_to_wf if (s2_eig) then diff --git a/src/Determinants/README.rst b/src/Determinants/README.rst index 17b69577..1032042c 100644 --- a/src/Determinants/README.rst +++ b/src/Determinants/README.rst @@ -118,11 +118,11 @@ Documentation of alpha and beta determinants -`davidson_converged `_ +`davidson_converged `_ True if the Davidson algorithm is converged -`davidson_criterion `_ +`davidson_criterion `_ Can be : [ energy | residual | both | wall_time | cpu_time | iterations ] @@ -145,7 +145,7 @@ Documentation Initial guess vectors are not necessarily orthonormal -`davidson_diag_hjj `_ +`davidson_diag_hjj `_ Davidson diagonalization with specific diagonal elements of the H matrix .br H_jj : specific diagonal H matrix elements to diagonalize de Davidson @@ -174,7 +174,7 @@ Documentation Max number of Davidson sizes -`davidson_threshold `_ +`davidson_threshold `_ Can be : [ energy | residual | both | wall_time | cpu_time | iterations ] @@ -190,10 +190,6 @@ Documentation det_coef -`det_connections `_ - Build connection proxy between determinants - - `det_inf `_ Undocumented @@ -278,26 +274,6 @@ Documentation idx(0) is the number of determinants that interact with key1 -`filter_connected_davidson `_ - Filters out the determinants that are not connected by H - returns the array idx which contains the index of the - determinants in the array key1 that interact - via the H operator with key2. - .br - idx(0) is the number of determinants that interact with key1 - key1 should come from psi_det_sorted_ab. - - -`filter_connected_davidson_shortcut `_ - Filters out the determinants that are not connected by H - returns the array idx which contains the index of the - determinants in the array key1 that interact - via the H operator with key2. - .br - idx(0) is the number of determinants that interact with key1 - key1 should come from psi_det_sorted_ab. - - `filter_connected_davidson_warp `_ Filters out the determinants that are not connected by H returns the array idx which contains the index of the @@ -308,7 +284,7 @@ Documentation key1 should come from psi_det_sorted_ab. -`filter_connected_i_h_psi0 `_ +`filter_connected_i_h_psi0 `_ returns the array idx which contains the index of the .br determinants in the array key1 that interact @@ -318,7 +294,7 @@ Documentation idx(0) is the number of determinants that interact with key1 -`filter_connected_i_h_psi0_sc2 `_ +`filter_connected_i_h_psi0_sc2 `_ standard filter_connected_i_H_psi but returns in addition .br the array of the index of the non connected determinants to key1 @@ -408,14 +384,6 @@ Documentation H_jj : array of -`h_u_0_org `_ - Computes v_0 = H|u_0> - .br - n : number of determinants - .br - H_jj : array of - - `i_h_j `_ Returns where i and j are determinants @@ -507,10 +475,6 @@ Documentation Energy of the reference bitmask used in Slater rules -`n_con_int `_ - Number of integers to represent the connections between determinants - - `n_det `_ Number of determinants in the wave function @@ -872,11 +836,11 @@ Documentation for a given couple of hole/particle excitations i. -`sort_dets_ab `_ +`sort_dets_ab `_ Undocumented -`sort_dets_ab_v `_ +`sort_dets_ab_v `_ Undocumented diff --git a/src/Ezfio_files/README.rst b/src/Ezfio_files/README.rst index a612dcc7..c2d6281e 100644 --- a/src/Ezfio_files/README.rst +++ b/src/Ezfio_files/README.rst @@ -203,95 +203,87 @@ Documentation Output file for Bitmask -`output_cas_sd `_ - Output file for CAS_SD - - `output_cpu_time_0 `_ Initial CPU and wall times when printing in the output files -`output_determinants `_ +`output_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_cas `_ - Output file for Generators_CAS - - -`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_mo_basis `_ +`output_mo_basis `_ Output file for MO_Basis -`output_moguess `_ +`output_moguess `_ Output file for MOGuess -`output_mrcc_cassd `_ +`output_mrcc_cassd `_ Output file for MRCC_CASSD -`output_mrcc_utils `_ +`output_mrcc_utils `_ Output file for MRCC_Utils -`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_psiref_cas `_ +`output_psiref_cas `_ Output file for Psiref_CAS -`output_psiref_utils `_ +`output_psiref_utils `_ Output file for Psiref_Utils -`output_selectors_full `_ +`output_selectors_full `_ Output file for Selectors_full -`output_utils `_ +`output_utils `_ Output file for Utils