From b2a6161083692d0b12611683af3b9f7ac5757e74 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 4 May 2015 15:20:14 +0200 Subject: [PATCH 1/4] No more SVD in spindeterminants --- scripts/generate_h_apply.py | 2 +- src/Bielec_integrals/README.rst | 38 ++++----- src/Bielec_integrals/ao_bi_integrals.irp.f | 1 + src/Bielec_integrals/mo_bi_integrals.irp.f | 1 + src/Dets/spindeterminants.irp.f | 92 +++++++++++----------- 5 files changed, 68 insertions(+), 66 deletions(-) diff --git a/scripts/generate_h_apply.py b/scripts/generate_h_apply.py index 280c9f72..3731df77 100755 --- a/scripts/generate_h_apply.py +++ b/scripts/generate_h_apply.py @@ -141,7 +141,7 @@ class H_apply(object): def set_filter_2h_2p(self): self["filter2h2p"] = """ ! ! DIR$ FORCEINLINE - if(is_a_two_holes_two_particles(key))cycle + if (is_a_two_holes_two_particles(key)) cycle """ diff --git a/src/Bielec_integrals/README.rst b/src/Bielec_integrals/README.rst index 38dc9e96..b2f96eb3 100644 --- a/src/Bielec_integrals/README.rst +++ b/src/Bielec_integrals/README.rst @@ -36,7 +36,7 @@ Documentation integral of the AO basis or (ij|kl) i(r1) j(r1) 1/r12 k(r2) l(r2) -`ao_bielec_integral_schwartz `_ +`ao_bielec_integral_schwartz `_ Needed to compute Schwartz inequalities `ao_bielec_integral_schwartz_accel `_ @@ -53,48 +53,48 @@ Documentation `compute_ao_bielec_integrals `_ Compute AO 1/r12 integrals for all i and fixed j,k,l -`eri `_ +`eri `_ ATOMIC PRIMTIVE bielectronic integral between the 4 primitives :: primitive_1 = x1**(a_x) y1**(a_y) z1**(a_z) exp(-alpha * r1**2) primitive_2 = x1**(b_x) y1**(b_y) z1**(b_z) exp(- beta * r1**2) primitive_3 = x2**(c_x) y2**(c_y) z2**(c_z) exp(-delta * r2**2) primitive_4 = x2**(d_x) y2**(d_y) z2**(d_z) exp(- gama * r2**2) -`general_primitive_integral `_ +`general_primitive_integral `_ Computes the integral where p,q,r,s are Gaussian primitives -`give_polynom_mult_center_x `_ +`give_polynom_mult_center_x `_ subroutine that returns the explicit polynom in term of the "t" variable of the following polynomw : I_x1(a_x, d_x,p,q) * I_x1(a_y, d_y,p,q) * I_x1(a_z, d_z,p,q) -`i_x1_new `_ +`i_x1_new `_ recursive function involved in the bielectronic integral -`i_x1_pol_mult `_ +`i_x1_pol_mult `_ recursive function involved in the bielectronic integral -`i_x1_pol_mult_a1 `_ +`i_x1_pol_mult_a1 `_ recursive function involved in the bielectronic integral -`i_x1_pol_mult_a2 `_ +`i_x1_pol_mult_a2 `_ recursive function involved in the bielectronic integral -`i_x1_pol_mult_recurs `_ +`i_x1_pol_mult_recurs `_ recursive function involved in the bielectronic integral -`i_x2_new `_ +`i_x2_new `_ recursive function involved in the bielectronic integral -`i_x2_pol_mult `_ +`i_x2_pol_mult `_ recursive function involved in the bielectronic integral -`integrale_new `_ +`integrale_new `_ calculate the integral of the polynom :: I_x1(a_x+b_x, c_x+d_x,p,q) * I_x1(a_y+b_y, c_y+d_y,p,q) * I_x1(a_z+b_z, c_z+d_z,p,q) between ( 0 ; 1) -`n_pt_sup `_ +`n_pt_sup `_ Returns the upper boundary of the degree of the polynomial involved in the bielctronic integral : Ix(a_x,b_x,c_x,d_x) * Iy(a_y,b_y,c_y,d_y) * Iz(a_z,b_z,c_z,d_z) @@ -172,32 +172,32 @@ Documentation `add_integrals_to_map `_ Adds integrals to tha MO map according to some bitmask -`mo_bielec_integral_jj `_ +`mo_bielec_integral_jj `_ mo_bielec_integral_jj(i,j) = J_ij mo_bielec_integral_jj_exchange(i,j) = K_ij mo_bielec_integral_jj_anti(i,j) = J_ij - K_ij -`mo_bielec_integral_jj_anti `_ +`mo_bielec_integral_jj_anti `_ mo_bielec_integral_jj(i,j) = J_ij mo_bielec_integral_jj_exchange(i,j) = K_ij mo_bielec_integral_jj_anti(i,j) = J_ij - K_ij -`mo_bielec_integral_jj_anti_from_ao `_ +`mo_bielec_integral_jj_anti_from_ao `_ mo_bielec_integral_jj_from_ao(i,j) = J_ij mo_bielec_integral_jj_exchange_from_ao(i,j) = J_ij mo_bielec_integral_jj_anti_from_ao(i,j) = J_ij - K_ij -`mo_bielec_integral_jj_exchange `_ +`mo_bielec_integral_jj_exchange `_ mo_bielec_integral_jj(i,j) = J_ij mo_bielec_integral_jj_exchange(i,j) = K_ij mo_bielec_integral_jj_anti(i,j) = J_ij - K_ij -`mo_bielec_integral_jj_exchange_from_ao `_ +`mo_bielec_integral_jj_exchange_from_ao `_ mo_bielec_integral_jj_from_ao(i,j) = J_ij mo_bielec_integral_jj_exchange_from_ao(i,j) = J_ij mo_bielec_integral_jj_anti_from_ao(i,j) = J_ij - K_ij -`mo_bielec_integral_jj_from_ao `_ +`mo_bielec_integral_jj_from_ao `_ mo_bielec_integral_jj_from_ao(i,j) = J_ij mo_bielec_integral_jj_exchange_from_ao(i,j) = J_ij mo_bielec_integral_jj_anti_from_ao(i,j) = J_ij - K_ij diff --git a/src/Bielec_integrals/ao_bi_integrals.irp.f b/src/Bielec_integrals/ao_bi_integrals.irp.f index 0da76021..4fa1a525 100644 --- a/src/Bielec_integrals/ao_bi_integrals.irp.f +++ b/src/Bielec_integrals/ao_bi_integrals.irp.f @@ -481,6 +481,7 @@ IRP_ENDIF COARRAY ao_bielec_integrals_in_map = .True. if (write_ao_integrals) then call dump_ao_integrals(trim(ezfio_filename)//'/work/ao_integrals.bin') + call ezfio_set_bielec_integrals_disk_access_ao_integrals(.True.) endif END_PROVIDER diff --git a/src/Bielec_integrals/mo_bi_integrals.irp.f b/src/Bielec_integrals/mo_bi_integrals.irp.f index 5adc980b..4e4c70aa 100644 --- a/src/Bielec_integrals/mo_bi_integrals.irp.f +++ b/src/Bielec_integrals/mo_bi_integrals.irp.f @@ -312,6 +312,7 @@ IRP_ENDIF if (write_mo_integrals) then call dump_mo_integrals(trim(ezfio_filename)//'/work/mo_integrals.bin') + call ezfio_set_bielec_integrals_disk_access_mo_integrals(.True.) endif diff --git a/src/Dets/spindeterminants.irp.f b/src/Dets/spindeterminants.irp.f index ffd28f85..afe88880 100644 --- a/src/Dets/spindeterminants.irp.f +++ b/src/Dets/spindeterminants.irp.f @@ -337,52 +337,52 @@ subroutine write_spindeterminants call ezfio_set_spindeterminants_psi_coef_matrix_rows(psi_svd_matrix_rows) call ezfio_set_spindeterminants_psi_coef_matrix_columns(psi_svd_matrix_columns) - integer :: n_svd_coefs - double precision :: norm, f - f = 1.d0/dble(N_states) - norm = 1.d0 - do n_svd_coefs=1,N_det_alpha_unique - do k=1,N_states - norm -= psi_svd_coefs(n_svd_coefs,k)*psi_svd_coefs(n_svd_coefs,k) - enddo - if (norm < 1.d-4) then - exit - endif - enddo - n_svd_coefs -= 1 - call ezfio_set_spindeterminants_n_svd_coefs(n_svd_coefs) - - double precision, allocatable :: dtmp(:,:,:) - allocate(dtmp(N_det_alpha_unique,n_svd_coefs,N_states)) - do k=1,N_states - do j=1,n_svd_coefs - do i=1,N_det_alpha_unique - dtmp(i,j,k) = psi_svd_alpha(i,j,k) - enddo - enddo - enddo - call ezfio_set_spindeterminants_psi_svd_alpha(dtmp) - deallocate(dtmp) - - allocate(dtmp(N_det_beta_unique,n_svd_coefs,N_states)) - do k=1,N_states - do j=1,n_svd_coefs - do i=1,N_det_beta_unique - dtmp(i,j,k) = psi_svd_beta(i,j,k) - enddo - enddo - enddo - call ezfio_set_spindeterminants_psi_svd_beta(dtmp) - deallocate(dtmp) - - allocate(dtmp(n_svd_coefs,N_states,1)) - do k=1,N_states - do j=1,n_svd_coefs - dtmp(j,k,1) = psi_svd_coefs(j,k) - enddo - enddo - call ezfio_set_spindeterminants_psi_svd_coefs(dtmp) - deallocate(dtmp) +! integer :: n_svd_coefs +! double precision :: norm, f +! f = 1.d0/dble(N_states) +! norm = 1.d0 +! do n_svd_coefs=1,N_det_alpha_unique +! do k=1,N_states +! norm -= psi_svd_coefs(n_svd_coefs,k)*psi_svd_coefs(n_svd_coefs,k) +! enddo +! if (norm < 1.d-4) then +! exit +! endif +! enddo +! n_svd_coefs -= 1 +! call ezfio_set_spindeterminants_n_svd_coefs(n_svd_coefs) +! +! double precision, allocatable :: dtmp(:,:,:) +! allocate(dtmp(N_det_alpha_unique,n_svd_coefs,N_states)) +! do k=1,N_states +! do j=1,n_svd_coefs +! do i=1,N_det_alpha_unique +! dtmp(i,j,k) = psi_svd_alpha(i,j,k) +! enddo +! enddo +! enddo +! call ezfio_set_spindeterminants_psi_svd_alpha(dtmp) +! deallocate(dtmp) +! +! allocate(dtmp(N_det_beta_unique,n_svd_coefs,N_states)) +! do k=1,N_states +! do j=1,n_svd_coefs +! do i=1,N_det_beta_unique +! dtmp(i,j,k) = psi_svd_beta(i,j,k) +! enddo +! enddo +! enddo +! call ezfio_set_spindeterminants_psi_svd_beta(dtmp) +! deallocate(dtmp) +! +! allocate(dtmp(n_svd_coefs,N_states,1)) +! do k=1,N_states +! do j=1,n_svd_coefs +! dtmp(j,k,1) = psi_svd_coefs(j,k) +! enddo +! enddo +! call ezfio_set_spindeterminants_psi_svd_coefs(dtmp) +! deallocate(dtmp) end From 3b30e4fa4a47111fa093e18d3dd420ccee19fcff Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 4 May 2015 19:44:09 +0200 Subject: [PATCH 2/4] Fixed PATH error --- scripts/install/install_resultsFile.sh | 1 + setup_environment.sh | 6 +++--- src/AOs/README.rst | 2 ++ src/Determinants/README.rst | 6 +++--- src/FCIdump/README.rst | 3 --- src/MOs/README.rst | 12 ++++++++++++ tests/unit_test/unit_test.py | 2 +- 7 files changed, 22 insertions(+), 10 deletions(-) diff --git a/scripts/install/install_resultsFile.sh b/scripts/install/install_resultsFile.sh index 4b5debc0..6f279ffa 100755 --- a/scripts/install/install_resultsFile.sh +++ b/scripts/install/install_resultsFile.sh @@ -16,6 +16,7 @@ fi cd ${QPACKAGE_ROOT} +rm -rf resultsFile-master ${QPACKAGE_ROOT}/scripts/fetch_from_web.py ${URL} ${QPACKAGE_ROOT}/resultsFile.tar.gz tar -zxf resultsFile.tar.gz && rm resultsFile.tar.gz ||exit 1 mv resultsFile-master resultsFile diff --git a/setup_environment.sh b/setup_environment.sh index 657573c0..878c23e1 100755 --- a/setup_environment.sh +++ b/setup_environment.sh @@ -12,15 +12,15 @@ QPACKAGE_ROOT="$( cd "$(dirname "$BASH_SOURCE")" ; pwd -P )" cat << EOF > quantum_package.rc -export IRPF90="${IRPF90}" export QPACKAGE_ROOT=\$( cd \$(dirname "\${BASH_SOURCE}") ; pwd -P ) +export IRPF90="\${QPACKAGE_ROOT}/bin/irpf90" export LD_LIBRARY_PATH="\${QPACKAGE_ROOT}"/lib:\${LD_LIBRARY_PATH} export LIBRARY_PATH="\${QPACKAGE_ROOT}"/lib:\${LIBRARY_PATH} export C_INCLUDE_PATH="\${QPACKAGE_ROOT}"/include:\${C_INCLUDE_PATH} -export PYTHONPATH=\${PYTHONPATH}\$(find "${QPACKAGE_ROOT}"/scripts -type d -printf ":%p") +export PYTHONPATH=\${PYTHONPATH}\$(find "\${QPACKAGE_ROOT}"/scripts -type d -printf ":%p") -export PATH=\${PATH}\$(find "${QPACKAGE_ROOT}"/scripts -type d -printf ":%p") +export PATH=\${PATH}\$(find "\${QPACKAGE_ROOT}"/scripts -type d -printf ":%p") export PATH=\${PATH}:"\${QPACKAGE_ROOT}"/bin export PATH=\${PATH}:"\${QPACKAGE_ROOT}"/ocaml source "\${QPACKAGE_ROOT}"/bin/irpman &> /dev/null diff --git a/src/AOs/README.rst b/src/AOs/README.rst index f5cb8707..3b1675ba 100644 --- a/src/AOs/README.rst +++ b/src/AOs/README.rst @@ -30,6 +30,8 @@ Assumptions .. Do not edit this section. It was auto-generated from the .. NEEDED_MODULES file. +* The AO coefficients in the EZFIO files are not necessarily normalized and are normalized after reading + Needed Modules ============== diff --git a/src/Determinants/README.rst b/src/Determinants/README.rst index 37baa392..69f7abc3 100644 --- a/src/Determinants/README.rst +++ b/src/Determinants/README.rst @@ -45,10 +45,10 @@ Documentation after calling this function. After calling this subroutine, N_det, psi_det and psi_coef need to be touched -`debug_unicity_of_determinants `_ +`debug_unicity_of_determinants `_ This subroutine checks that there are no repetitions in the wave function -`fill_h_apply_buffer_no_selection `_ +`fill_h_apply_buffer_no_selection `_ Fill the H_apply buffer with determiants for CISD `h_apply_buffer_allocated `_ @@ -329,7 +329,7 @@ Documentation `ci_sc2_energy `_ N_states_diag lowest eigenvalues of the CI matrix -`diagonalize_ci_sc2 `_ +`diagonalize_ci_sc2 `_ Replace the coefficients of the CI states_diag by the coefficients of the eigenstates of the CI matrix diff --git a/src/FCIdump/README.rst b/src/FCIdump/README.rst index 8a467b16..faf69203 100644 --- a/src/FCIdump/README.rst +++ b/src/FCIdump/README.rst @@ -10,9 +10,6 @@ Documentation .. Do not edit this section. It was auto-generated from the .. NEEDED_MODULES file. -`fcidump `_ - Undocumented - Needed Modules diff --git a/src/MOs/README.rst b/src/MOs/README.rst index 5086e4b8..5ddd7928 100644 --- a/src/MOs/README.rst +++ b/src/MOs/README.rst @@ -18,6 +18,18 @@ When saving the MOs, the ``mo_basis`` directory of the EZFIO file is copied in the ``save`` directory, named by the current ``mo_label``. All this is done with the script named ``save_current_mos.sh`` in the ``scripts`` directory. +Assumptions +=========== + +.. Do not edit this section. It was auto-generated from the +.. NEEDED_MODULES file. + +ASSUMPTONS +========== + +* The AO basis functions are normalized. + + Needed Modules ============== diff --git a/tests/unit_test/unit_test.py b/tests/unit_test/unit_test.py index f9049d82..d9498700 100755 --- a/tests/unit_test/unit_test.py +++ b/tests/unit_test/unit_test.py @@ -17,7 +17,7 @@ from collections import defaultdict # O p t # # ~#~#~ # -precision = 5.e-8 +precision = 1.e-7 # A test get a geo file and a basis file. # A global dict containt the result for this test From 8fab38fcc07a315b3cc7e7eddce6eefc5b0f4626 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 4 May 2015 20:19:59 +0200 Subject: [PATCH 3/4] InteRgrals corrected --- ocaml/qp_create_ezfio_from_xyz.ml | 12 ++++++++---- scripts/pseudo/put_pseudo_in_ezfio.py | 20 ++++++++++---------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/ocaml/qp_create_ezfio_from_xyz.ml b/ocaml/qp_create_ezfio_from_xyz.ml index 8370fb1f..4a85a1ec 100644 --- a/ocaml/qp_create_ezfio_from_xyz.ml +++ b/ocaml/qp_create_ezfio_from_xyz.ml @@ -13,8 +13,8 @@ let spec = ~doc:"int Total charge of the molecule. Default is 0." +> flag "m" (optional_with_default 1 int) ~doc:"int Spin multiplicity (2S+1) of the molecule. Default is 1." - +> flag "p" (optional_with_default 0 int) - ~doc:"Using pseudo. Default is not (aka 0)" + +> flag "p" no_arg + ~doc:"Using pseudo." +> anon ("xyz_file" %: string) ;; @@ -62,7 +62,7 @@ let run ?o b c m p xyz_file = | None -> (* Principal basis *) let basis = elem_and_basis_name in let command = - if (p = 0) then + if (p) then Qpackage.root ^ "/scripts/get_basis.sh \"" ^ temp_filename ^ "\" \"" ^ basis ^"\"" else @@ -254,7 +254,11 @@ let run ?o b c m p xyz_file = (* Doesn't work... *) - (* if p = 1 then Qpackage.root ^ "scripts/pseudo/put_pseudo_in_ezfio.py" ezfio_file.to_string; *) + if (p) then + begin + Qpackage.root ^ "/scripts/pseudo/put_pseudo_in_ezfio.py " ^ ezfio_file + |> Sys.command_exn + end; match Input.Ao_basis.read () with | None -> failwith "Error in basis" diff --git a/scripts/pseudo/put_pseudo_in_ezfio.py b/scripts/pseudo/put_pseudo_in_ezfio.py index 87db7845..1f8594c5 100755 --- a/scripts/pseudo/put_pseudo_in_ezfio.py +++ b/scripts/pseudo/put_pseudo_in_ezfio.py @@ -311,11 +311,11 @@ if __name__ == "__main__": # ~#~#~#~#~ # klocmax = max([len(i) for i in v_k]) - ezfio.pseudo_intergrals_klocmax = klocmax + ezfio.pseudo_integrals_klocmax = klocmax - ezfio.pseudo_intergrals_v_k = zip(*v_k) - ezfio.pseudo_intergrals_n_k = zip(*n_k) - ezfio.pseudo_intergrals_dz_k = zip(*dz_k) + ezfio.pseudo_integrals_v_k = zip(*v_k) + ezfio.pseudo_integrals_n_k = zip(*n_k) + ezfio.pseudo_integrals_dz_k = zip(*dz_k) # ~#~#~#~#~#~#~#~#~ # # N o n _ L o c a l # @@ -324,15 +324,15 @@ if __name__ == "__main__": lmax = max([len(i) for i in v_kl]) kmax = max([len(sublist) for list_ in v_kl for sublist in list_]) - ezfio.pseudo_intergrals_lmaxpo = lmax - ezfio.pseudo_intergrals_kmax = kmax + ezfio.pseudo_integrals_lmaxpo = lmax + ezfio.pseudo_integrals_kmax = kmax v_kl = make_it_square(v_kl, [lmax, kmax]) n_kl = make_it_square(n_kl, [lmax, kmax], int) dz_kl = make_it_square(dz_kl, [lmax, kmax]) - ezfio.pseudo_intergrals_v_kl = zip(*v_kl) - ezfio.pseudo_intergrals_n_kl = zip(*n_kl) - ezfio.pseudo_intergrals_dz_kl = zip(*dz_kl) + ezfio.pseudo_integrals_v_kl = zip(*v_kl) + ezfio.pseudo_integrals_n_kl = zip(*n_kl) + ezfio.pseudo_integrals_dz_kl = zip(*dz_kl) - ezfio.pseudo_intergrals_do_pseudo = True + ezfio.pseudo_integrals_do_pseudo = True From 92209e7df9c709f02190d21551107a6a8acfa93a Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 4 May 2015 20:23:06 +0200 Subject: [PATCH 4/4] -p option for pseudos OK --- ocaml/qp_create_ezfio_from_xyz.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ocaml/qp_create_ezfio_from_xyz.ml b/ocaml/qp_create_ezfio_from_xyz.ml index 4a85a1ec..6ec6e0d0 100644 --- a/ocaml/qp_create_ezfio_from_xyz.ml +++ b/ocaml/qp_create_ezfio_from_xyz.ml @@ -64,10 +64,10 @@ let run ?o b c m p xyz_file = let command = if (p) then Qpackage.root ^ "/scripts/get_basis.sh \"" ^ temp_filename - ^ "\" \"" ^ basis ^"\"" + ^ "\" \"" ^ basis ^"\" pseudo" else Qpackage.root ^ "/scripts/get_basis.sh \"" ^ temp_filename - ^ "\" \"" ^ basis ^"\" pseudo" + ^ "\" \"" ^ basis ^"\"" in begin let filename =