diff --git a/plugins/Full_CI/README.rst b/plugins/Full_CI/README.rst index 08a0d1ea..750db44c 100644 --- a/plugins/Full_CI/README.rst +++ b/plugins/Full_CI/README.rst @@ -107,6 +107,10 @@ h_apply_fci_pt2 excitations (of the same symmetry). Auto-generated by the ``generate_h_apply`` script. +h_apply_fci_pt2_collector + Collects results from the selection in an array of generators + + h_apply_fci_pt2_diexc Undocumented @@ -127,6 +131,19 @@ h_apply_fci_pt2_monoexc Assume N_int is already provided. +h_apply_fci_pt2_slave + 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_slave_inproc + Computes a buffer using threads + + +h_apply_fci_pt2_slave_tcp + Computes a buffer over the network + + 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. @@ -227,6 +244,18 @@ h_apply_select_mono_di_delta_rho_monoexc Assume N_int is already provided. +`micro_pt2 `_ + Helper program to compute the PT2 in distributed mode. + + +`provide_everything `_ + Undocumented + + +`run_wf `_ + Undocumented + + `var_pt2_ratio_run `_ Undocumented diff --git a/plugins/Full_CI/tree_dependency.png b/plugins/Full_CI/tree_dependency.png index caedb2e0..158a3945 100644 Binary files a/plugins/Full_CI/tree_dependency.png and b/plugins/Full_CI/tree_dependency.png differ diff --git a/src/Ezfio_files/ezfio.irp.f b/src/Ezfio_files/ezfio.irp.f index 9432020f..6d2beb0b 100644 --- a/src/Ezfio_files/ezfio.irp.f +++ b/src/Ezfio_files/ezfio.irp.f @@ -31,3 +31,12 @@ BEGIN_PROVIDER [ character*(128), ezfio_filename ] END_PROVIDER +BEGIN_PROVIDER [ character*(128), ezfio_work_dir ] + implicit none + BEGIN_DOC + ! EZFIO/work/ + END_DOC + call ezfio_set_work_empty(.False.) + ezfio_work_dir = trim(ezfio_filename)//'/work/' +END_PROVIDER + diff --git a/src/Integrals_Bielec/README.rst b/src/Integrals_Bielec/README.rst index a22d791d..d4471e2a 100644 --- a/src/Integrals_Bielec/README.rst +++ b/src/Integrals_Bielec/README.rst @@ -9,6 +9,12 @@ Here, all bi-electronic integrals (:math:`1/r_{12}`) are computed. As they have MO integral, use ``get_mo_bielec_integral(i,j,k,l,mo_integrals_map)`` or ``mo_bielec_integral(i,j,k,l)``. +The conventions are: + +* For AO integrals : (ik|jl) = (11|22) +* For MO integrals : = <12|12> + + Needed Modules ============== @@ -48,37 +54,41 @@ Documentation 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 `_ +`ao_bielec_integral_schwartz_accel `_ integral of the AO basis or (ij|kl) i(r1) j(r1) 1/r12 k(r2) l(r2) -`ao_bielec_integrals_in_map `_ +`ao_bielec_integrals_in_map `_ Map of Atomic integrals i(r1) j(r2) 1/r12 k(r1) l(r2) -`ao_bielec_integrals_in_map_collector `_ +`ao_bielec_integrals_in_map_collector `_ Collects results from the AO integral calculation -`ao_bielec_integrals_in_map_slave `_ +`ao_bielec_integrals_in_map_slave `_ Computes a buffer of integrals +`ao_bielec_integrals_in_map_slave_inproc `_ + Computes a buffer of integrals. i is the ID of the current thread. + + +`ao_bielec_integrals_in_map_slave_tcp `_ + Computes a buffer of integrals. i is the ID of the current thread. + + `ao_integrals_map `_ AO integrals -`ao_integrals_threshold `_ - If || < ao_integrals_threshold then is zero - - -`ao_l4 `_ +`ao_l4 `_ Computes the product of l values of i,j,k,and l @@ -98,39 +108,27 @@ Documentation Frees the memory of the AO map -`clear_mo_map `_ +`clear_mo_map `_ Frees the memory of the MO map -`compute_ao_bielec_integrals `_ +`compute_ao_bielec_integrals `_ Compute AO 1/r12 integrals for all i and fixed j,k,l -`compute_ao_integrals_jl `_ +`compute_ao_integrals_jl `_ Parallel client for AO integrals -`disk_access_ao_integrals `_ - Read/Write AO integrals from/to disk [ Write | Read | None ] - - -`disk_access_mo_integrals `_ - Read/Write MO integrals from/to disk [ Write | Read | None ] - - -`do_direct_integrals `_ - Compute integrals on the fly - - -`dump_ao_integrals `_ +`dump_ao_integrals `_ Save to disk the $ao integrals -`dump_mo_integrals `_ +`dump_mo_integrals `_ Save to disk the $ao integrals -`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) @@ -152,7 +150,7 @@ Documentation t_w(i,2,k) = t(i) -`general_primitive_integral `_ +`general_primitive_integral `_ Computes the integral where p,q,r,s are Gaussian primitives @@ -174,126 +172,126 @@ Documentation Returns the number of elements in the AO map -`get_mo_bielec_integral `_ +`get_mo_bielec_integral `_ Returns one integral in the MO basis -`get_mo_bielec_integral_schwartz `_ +`get_mo_bielec_integral_schwartz `_ Returns one integral in the MO basis -`get_mo_bielec_integrals `_ +`get_mo_bielec_integrals `_ Returns multiple integrals in the MO basis, all i for j,k,l fixed. -`get_mo_bielec_integrals_ij `_ +`get_mo_bielec_integrals_ij `_ Returns multiple integrals in the MO basis, all i(1)j(2) 1/r12 k(1)l(2) i, j for k,l fixed. -`get_mo_map_size `_ +`get_mo_map_size `_ Return the number of elements in the MO map -`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 -`insert_into_ao_integrals_map `_ +`insert_into_ao_integrals_map `_ Create new entry into AO map -`insert_into_mo_integrals_map `_ +`insert_into_mo_integrals_map `_ Create new entry into MO map, or accumulate in an existing entry -`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) -`load_ao_integrals `_ +`load_ao_integrals `_ Read from disk the $ao integrals -`load_mo_integrals `_ +`load_mo_integrals `_ Read from disk the $ao integrals -`mo_bielec_integral `_ +`mo_bielec_integral `_ Returns one integral in the MO basis -`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 -`mo_bielec_integral_schwartz `_ +`mo_bielec_integral_schwartz `_ Needed to compute Schwartz inequalities @@ -305,24 +303,36 @@ Documentation Computes an unique index for i,j,k,l integrals -`mo_integrals_map `_ +`mo_integrals_map `_ MO integrals -`mo_integrals_threshold `_ - If || < ao_integrals_threshold then is zero - - `n_pt_max_integrals_16 `_ Aligned n_pt_max_integrals -`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) +`provide_all_mo_integrals `_ + Undocumented + + +`pull_integrals `_ + How the collector pulls the computed integrals + + +`push_integrals `_ + Push integrals in the push socket + + +`qp_ao_ints `_ + Increments a running calculation to compute AO integrals + + `read_ao_integrals `_ One level of abstraction for disk_access_ao_integrals and disk_access_mo_integrals diff --git a/src/Integrals_Bielec/tree_dependency.png b/src/Integrals_Bielec/tree_dependency.png index 4161fd0a..92944e89 100644 Binary files a/src/Integrals_Bielec/tree_dependency.png and b/src/Integrals_Bielec/tree_dependency.png differ diff --git a/src/Integrals_Monoelec/EZFIO.cfg b/src/Integrals_Monoelec/EZFIO.cfg new file mode 100644 index 00000000..04e49ec1 --- /dev/null +++ b/src/Integrals_Monoelec/EZFIO.cfg @@ -0,0 +1,12 @@ +[disk_access_mo_one_integrals] +type: Disk_access +doc: Read/Write MO one-electron integrals from/to disk [ Write | Read | None ] +interface: ezfio,provider,ocaml +default: None + +[disk_access_ao_one_integrals] +type: Disk_access +doc: Read/Write AO one-electron integrals from/to disk [ Write | Read | None ] +interface: ezfio,provider,ocaml +default: None + diff --git a/src/Integrals_Monoelec/README.rst b/src/Integrals_Monoelec/README.rst index 1d2d158b..2f5efd4f 100644 --- a/src/Integrals_Monoelec/README.rst +++ b/src/Integrals_Monoelec/README.rst @@ -111,11 +111,11 @@ Documentation Pseudo-potential -`ao_pseudo_integral_local `_ +`ao_pseudo_integral_local `_ Local pseudo-potential -`ao_pseudo_integral_non_local `_ +`ao_pseudo_integral_non_local `_ Local pseudo-potential @@ -141,23 +141,31 @@ Documentation Undocumented +`disk_access_ao_one_integrals `_ + Read/Write AO one-electron integrals from/to disk [ Write | Read | None ] + + +`disk_access_mo_one_integrals `_ + Read/Write MO one-electron integrals from/to disk [ Write | Read | None ] + + `do_print `_ Undocumented -`give_polynom_mult_center_mono_elec `_ +`give_polynom_mult_center_mono_elec `_ Undocumented -`i_x1_pol_mult_mono_elec `_ +`i_x1_pol_mult_mono_elec `_ Undocumented -`i_x2_pol_mult_mono_elec `_ +`i_x2_pol_mult_mono_elec `_ Undocumented -`int_gaus_pol `_ +`int_gaus_pol `_ Undocumented @@ -237,7 +245,7 @@ Documentation array of the integrals of MO_i * z^2 MO_j -`nai_pol_mult `_ +`nai_pol_mult `_ Undocumented @@ -269,26 +277,74 @@ Documentation Undocumented +`pseudo_dz_k_transp `_ + Transposed arrays for pseudopotentials + + +`pseudo_dz_kl_transp `_ + Transposed arrays for pseudopotentials + + +`pseudo_n_k_transp `_ + Transposed arrays for pseudopotentials + + +`pseudo_n_kl_transp `_ + Transposed arrays for pseudopotentials + + +`pseudo_v_k_transp `_ + Transposed arrays for pseudopotentials + + +`pseudo_v_kl_transp `_ + Transposed arrays for pseudopotentials + + +`read_ao_one_integrals `_ + One level of abstraction for disk_access_ao_integrals and disk_access_mo_integrals + + +`read_mo_one_integrals `_ + One level of abstraction for disk_access_ao_integrals and disk_access_mo_integrals + + +`read_one_e_integrals `_ + Read the 1-electron integrals into in A(m,n) from file 'filename' + + `save_ortho_mos `_ Undocumented -`v_e_n `_ +`v_e_n `_ Undocumented -`v_phi `_ +`v_phi `_ Undocumented -`v_r `_ +`v_r `_ Undocumented -`v_theta `_ +`v_theta `_ Undocumented -`wallis `_ +`wallis `_ Undocumented + +`write_ao_one_integrals `_ + One level of abstraction for disk_access_ao_integrals and disk_access_mo_integrals + + +`write_mo_one_integrals `_ + One level of abstraction for disk_access_ao_integrals and disk_access_mo_integrals + + +`write_one_e_integrals `_ + Write the 1-electron integrals stored in A(m,n) into file 'filename' + diff --git a/src/Integrals_Monoelec/kin_ao_ints.irp.f b/src/Integrals_Monoelec/kin_ao_ints.irp.f index 10b065b4..e3e92348 100644 --- a/src/Integrals_Monoelec/kin_ao_ints.irp.f +++ b/src/Integrals_Monoelec/kin_ao_ints.irp.f @@ -123,26 +123,37 @@ END_PROVIDER BEGIN_PROVIDER [double precision, ao_kinetic_integral, (ao_num_align,ao_num)] - implicit none - BEGIN_DOC - ! array of the priminitve basis kinetic integrals - ! \langle \chi_i |\hat{T}| \chi_j \rangle - END_DOC - integer :: i,j,k,l - - !$OMP PARALLEL DO DEFAULT(NONE) & - !$OMP PRIVATE(i,j) & - !$OMP SHARED(ao_num, ao_num_align, ao_kinetic_integral,ao_deriv2_x,ao_deriv2_y,ao_deriv2_z) - do j = 1, ao_num - !DEC$ VECTOR ALWAYS - !DEC$ VECTOR ALIGNED - do i = 1, ao_num - ao_kinetic_integral(i,j) = -0.5d0 * (ao_deriv2_x(i,j) + ao_deriv2_y(i,j) + ao_deriv2_z(i,j) ) - enddo - do i = ao_num +1,ao_num_align - ao_kinetic_integral(i,j) = 0.d0 - enddo - enddo - !$OMP END PARALLEL DO + implicit none + BEGIN_DOC + ! array of the priminitve basis kinetic integrals + ! \langle \chi_i |\hat{T}| \chi_j \rangle + END_DOC + integer :: i,j,k,l + + if (read_ao_one_integrals) then + call read_one_e_integrals('ao_kinetic_integral', ao_kinetic_integral,& + size(ao_kinetic_integral,1), size(ao_kinetic_integral,2)) + print *, 'AO kinetic integrals read from disk' + else + !$OMP PARALLEL DO DEFAULT(NONE) & + !$OMP PRIVATE(i,j) & + !$OMP SHARED(ao_num, ao_num_align, ao_kinetic_integral,ao_deriv2_x,ao_deriv2_y,ao_deriv2_z) + do j = 1, ao_num + !DEC$ VECTOR ALWAYS + !DEC$ VECTOR ALIGNED + do i = 1, ao_num + ao_kinetic_integral(i,j) = -0.5d0 * (ao_deriv2_x(i,j) + ao_deriv2_y(i,j) + ao_deriv2_z(i,j) ) + enddo + do i = ao_num +1,ao_num_align + ao_kinetic_integral(i,j) = 0.d0 + enddo + enddo + !$OMP END PARALLEL DO + endif + if (write_ao_one_integrals) then + call write_one_e_integrals('ao_kinetic_integral', ao_kinetic_integral,& + size(ao_kinetic_integral,1), size(ao_kinetic_integral,2)) + print *, 'AO kinetic integrals written to disk' + endif END_PROVIDER diff --git a/src/Integrals_Monoelec/kin_mo_ints.irp.f b/src/Integrals_Monoelec/kin_mo_ints.irp.f index 2bcbd5df..2cd00376 100644 --- a/src/Integrals_Monoelec/kin_mo_ints.irp.f +++ b/src/Integrals_Monoelec/kin_mo_ints.irp.f @@ -1,25 +1,26 @@ - BEGIN_PROVIDER [double precision, mo_kinetic_integral, (mo_tot_num_align,mo_tot_num)] - implicit none - integer :: i1,j1,i,j - double precision :: c_i1 +BEGIN_PROVIDER [double precision, mo_kinetic_integral, (mo_tot_num_align,mo_tot_num)] + implicit none + BEGIN_DOC + ! Kinetic energy integrals in the MO basis + END_DOC + + if (read_mo_one_integrals) then + call read_one_e_integrals('mo_kinetic_integral', mo_kinetic_integral,& + size(mo_kinetic_integral,1), size(mo_kinetic_integral,2)) + print *, 'MO kinetic integrals read from disk' + else + call ao_to_mo( & + ao_kinetic_integral, & + size(ao_kinetic_integral,1), & + mo_kinetic_integral, & + size(mo_kinetic_integral,1), & + ) + endif + if (write_mo_one_integrals) then + call write_one_e_integrals('mo_kinetic_integral', mo_kinetic_integral,& + size(mo_kinetic_integral,1), size(mo_kinetic_integral,2)) + print *, 'MO kinetic integrals written to disk' + endif - mo_kinetic_integral = 0.d0 - !$OMP PARALLEL DO DEFAULT(none) & - !$OMP PRIVATE(i,j,i1,j1,c_i1) & - !$OMP SHARED(mo_tot_num,ao_num,mo_coef,ao_Kinetic_integral, & - !$OMP mo_kinetic_integral) - do i = 1,mo_tot_num - do j = 1,mo_tot_num - do i1 = 1,ao_num - c_i1 = mo_coef(i1,i) - !DIR$ VECTOR ALIGNED - do j1 = 1,ao_num - mo_kinetic_integral(j,i) = mo_kinetic_integral(j,i) + c_i1*mo_coef(j1,j) *& - ao_Kinetic_integral(j1,i1) - enddo - enddo - enddo - enddo - !$OMP END PARALLEL DO END_PROVIDER diff --git a/src/Integrals_Monoelec/mo_mono_ints.irp.f b/src/Integrals_Monoelec/mo_mono_ints.irp.f index 5bae9868..50ab7ffa 100644 --- a/src/Integrals_Monoelec/mo_mono_ints.irp.f +++ b/src/Integrals_Monoelec/mo_mono_ints.irp.f @@ -1,14 +1,15 @@ BEGIN_PROVIDER [ double precision, mo_mono_elec_integral,(mo_tot_num_align,mo_tot_num)] implicit none - integer :: i,j,n,l + integer :: i,j,n,l BEGIN_DOC - ! array of the mono electronic hamiltonian on the MOs basis - ! : sum of the kinetic and nuclear electronic potential + ! array of the mono electronic hamiltonian on the MOs basis : + ! sum of the kinetic and nuclear electronic potential END_DOC print*,'Providing the mono electronic integrals' do j = 1, mo_tot_num - do i = 1, mo_tot_num - mo_mono_elec_integral(i,j) = mo_nucl_elec_integral(i,j) + mo_kinetic_integral(i,j) + mo_pseudo_integral(i,j) - enddo + do i = 1, mo_tot_num + mo_mono_elec_integral(i,j) = mo_nucl_elec_integral(i,j) + & + mo_kinetic_integral(i,j) + mo_pseudo_integral(i,j) + enddo enddo END_PROVIDER diff --git a/src/Integrals_Monoelec/pot_ao_ints.irp.f b/src/Integrals_Monoelec/pot_ao_ints.irp.f index 9e64d5e2..45b9067a 100644 --- a/src/Integrals_Monoelec/pot_ao_ints.irp.f +++ b/src/Integrals_Monoelec/pot_ao_ints.irp.f @@ -1,73 +1,86 @@ - BEGIN_PROVIDER [ double precision, ao_nucl_elec_integral, (ao_num_align,ao_num)] - BEGIN_DOC -! interaction nuclear electron - END_DOC - implicit none - double precision :: alpha, beta, gama, delta - integer :: num_A,num_B - double precision :: A_center(3),B_center(3),C_center(3) - integer :: power_A(3),power_B(3) - integer :: i,j,k,l,n_pt_in,m - double precision ::overlap_x,overlap_y,overlap_z,overlap,dx,NAI_pol_mult - - ao_nucl_elec_integral = 0.d0 - - ! _ - ! /| / |_) - ! | / | \ - ! - - !$OMP PARALLEL & - !$OMP DEFAULT (NONE) & - !$OMP PRIVATE (i,j,k,l,m,alpha,beta,A_center,B_center,C_center,power_A,power_B, & - !$OMP num_A,num_B,Z,c,n_pt_in) & - !$OMP SHARED (ao_num,ao_prim_num,ao_expo_ordered_transp,ao_power,ao_nucl,nucl_coord,ao_coef_normalized_ordered_transp, & - !$OMP n_pt_max_integrals,ao_nucl_elec_integral,nucl_num,nucl_charge) - - n_pt_in = n_pt_max_integrals - - !$OMP DO SCHEDULE (dynamic) - - do j = 1, ao_num - num_A = ao_nucl(j) - power_A(1:3)= ao_power(j,1:3) - A_center(1:3) = nucl_coord(num_A,1:3) - - do i = 1, ao_num - - num_B = ao_nucl(i) - power_B(1:3)= ao_power(i,1:3) - B_center(1:3) = nucl_coord(num_B,1:3) - - do l=1,ao_prim_num(j) - alpha = ao_expo_ordered_transp(l,j) - - do m=1,ao_prim_num(i) - beta = ao_expo_ordered_transp(m,i) - - double precision :: c - c = 0.d0 - - do k = 1, nucl_num - double precision :: Z - Z = nucl_charge(k) - - C_center(1:3) = nucl_coord(k,1:3) - - c = c - Z*NAI_pol_mult(A_center,B_center,power_A,power_B,alpha,beta,C_center,n_pt_in) - - enddo - ao_nucl_elec_integral(i,j) = ao_nucl_elec_integral(i,j) + & - ao_coef_normalized_ordered_transp(l,j)*ao_coef_normalized_ordered_transp(m,i)*c - enddo - enddo - enddo - enddo - - !$OMP END DO - !$OMP END PARALLEL - - END_PROVIDER +BEGIN_PROVIDER [ double precision, ao_nucl_elec_integral, (ao_num_align,ao_num)] + BEGIN_DOC + ! interaction nuclear electron + END_DOC + implicit none + double precision :: alpha, beta, gama, delta + integer :: num_A,num_B + double precision :: A_center(3),B_center(3),C_center(3) + integer :: power_A(3),power_B(3) + integer :: i,j,k,l,n_pt_in,m + double precision :: overlap_x,overlap_y,overlap_z,overlap,dx,NAI_pol_mult + + if (read_ao_one_integrals) then + call read_one_e_integrals('ao_ne_integral', ao_nucl_elec_integral, & + size(ao_nucl_elec_integral,1), size(ao_nucl_elec_integral,2)) + print *, 'AO N-e integrals read from disk' + else + + ao_nucl_elec_integral = 0.d0 + + ! _ + ! /| / |_) + ! | / | \ + ! + + !$OMP PARALLEL & + !$OMP DEFAULT (NONE) & + !$OMP PRIVATE (i,j,k,l,m,alpha,beta,A_center,B_center,C_center,power_A,power_B,& + !$OMP num_A,num_B,Z,c,n_pt_in) & + !$OMP SHARED (ao_num,ao_prim_num,ao_expo_ordered_transp,ao_power,ao_nucl,nucl_coord,ao_coef_normalized_ordered_transp,& + !$OMP n_pt_max_integrals,ao_nucl_elec_integral,nucl_num,nucl_charge) + + n_pt_in = n_pt_max_integrals + + !$OMP DO SCHEDULE (dynamic) + + do j = 1, ao_num + num_A = ao_nucl(j) + power_A(1:3)= ao_power(j,1:3) + A_center(1:3) = nucl_coord(num_A,1:3) + + do i = 1, ao_num + + num_B = ao_nucl(i) + power_B(1:3)= ao_power(i,1:3) + B_center(1:3) = nucl_coord(num_B,1:3) + + do l=1,ao_prim_num(j) + alpha = ao_expo_ordered_transp(l,j) + + do m=1,ao_prim_num(i) + beta = ao_expo_ordered_transp(m,i) + + double precision :: c + c = 0.d0 + + do k = 1, nucl_num + double precision :: Z + Z = nucl_charge(k) + + C_center(1:3) = nucl_coord(k,1:3) + + c = c - Z*NAI_pol_mult(A_center,B_center,power_A,power_B,alpha,beta,C_center,n_pt_in) + + enddo + ao_nucl_elec_integral(i,j) = ao_nucl_elec_integral(i,j) +& + ao_coef_normalized_ordered_transp(l,j)*ao_coef_normalized_ordered_transp(m,i)*c + enddo + enddo + enddo + enddo + + !$OMP END DO + !$OMP END PARALLEL + endif + if (write_ao_one_integrals) then + call write_one_e_integrals('ao_ne_integral', ao_nucl_elec_integral, & + size(ao_nucl_elec_integral,1), size(ao_nucl_elec_integral,2)) + print *, 'AO N-e integrals written to disk' + endif + + +END_PROVIDER BEGIN_PROVIDER [ double precision, ao_nucl_elec_integral_per_atom, (ao_num_align,ao_num,nucl_num)] BEGIN_DOC diff --git a/src/Integrals_Monoelec/pot_ao_pseudo_ints.irp.f b/src/Integrals_Monoelec/pot_ao_pseudo_ints.irp.f index 789bc9ea..28437b27 100644 --- a/src/Integrals_Monoelec/pot_ao_pseudo_ints.irp.f +++ b/src/Integrals_Monoelec/pot_ao_pseudo_ints.irp.f @@ -1,17 +1,32 @@ BEGIN_PROVIDER [ double precision, ao_pseudo_integral, (ao_num_align,ao_num)] implicit none BEGIN_DOC -! Pseudo-potential + ! Pseudo-potential integrals END_DOC - ao_pseudo_integral = 0.d0 - if (do_pseudo) then - if (pseudo_klocmax > 0) then - ao_pseudo_integral += ao_pseudo_integral_local - endif - if (pseudo_kmax > 0) then - ao_pseudo_integral += ao_pseudo_integral_non_local + + if (read_ao_one_integrals) then + call read_one_e_integrals('ao_pseudo_integral', ao_pseudo_integral,& + size(ao_pseudo_integral,1), size(ao_pseudo_integral,2)) + print *, 'AO pseudopotential integrals read from disk' + else + + ao_pseudo_integral = 0.d0 + if (do_pseudo) then + if (pseudo_klocmax > 0) then + ao_pseudo_integral += ao_pseudo_integral_local + endif + if (pseudo_kmax > 0) then + ao_pseudo_integral += ao_pseudo_integral_non_local + endif endif endif + + if (write_ao_one_integrals) then + call write_one_e_integrals('ao_pseudo_integral', ao_pseudo_integral,& + size(ao_pseudo_integral,1), size(ao_pseudo_integral,2)) + print *, 'AO pseudopotential integrals written to disk' + endif + END_PROVIDER BEGIN_PROVIDER [ double precision, ao_pseudo_integral_local, (ao_num_align,ao_num)] diff --git a/src/Integrals_Monoelec/pot_mo_ints.irp.f b/src/Integrals_Monoelec/pot_mo_ints.irp.f index 50019abb..27be6906 100644 --- a/src/Integrals_Monoelec/pot_mo_ints.irp.f +++ b/src/Integrals_Monoelec/pot_mo_ints.irp.f @@ -6,24 +6,24 @@ BEGIN_PROVIDER [double precision, mo_nucl_elec_integral, (mo_tot_num_align,mo_to ! interaction nuclear electron on the MO basis END_DOC - mo_nucl_elec_integral = 0.d0 - !$OMP PARALLEL DO DEFAULT(none) & - !$OMP PRIVATE(i,j,i1,j1,c_j1,c_i1) & - !$OMP SHARED(mo_tot_num,ao_num,mo_coef, & - !$OMP mo_nucl_elec_integral, ao_nucl_elec_integral) - do i = 1, mo_tot_num - do j = 1, mo_tot_num - do i1 = 1,ao_num - c_i1 = mo_coef(i1,i) - do j1 = 1,ao_num - c_j1 = c_i1*mo_coef(j1,j) - mo_nucl_elec_integral(j,i) = mo_nucl_elec_integral(j,i) + & - c_j1 * ao_nucl_elec_integral(j1,i1) - enddo - enddo - enddo - enddo - !$OMP END PARALLEL DO + if (read_mo_one_integrals) then + call read_one_e_integrals('mo_ne_integral', mo_nucl_elec_integral, & + size(mo_nucl_elec_integral,1), size(mo_nucl_elec_integral,2)) + print *, 'MO N-e integrals read from disk' + else + call ao_to_mo( & + ao_nucl_elec_integral, & + size(ao_nucl_elec_integral,1), & + mo_nucl_elec_integral, & + size(mo_nucl_elec_integral,1), & + ) + endif + if (write_mo_one_integrals) then + call write_one_e_integrals('mo_ne_integral', mo_nucl_elec_integral, & + size(mo_nucl_elec_integral,1), size(mo_nucl_elec_integral,2)) + print *, 'MO N-e integrals written to disk' + endif + END_PROVIDER @@ -38,23 +38,12 @@ BEGIN_PROVIDER [double precision, mo_nucl_elec_integral_per_atom, (mo_tot_num_al mo_nucl_elec_integral_per_atom = 0.d0 do k = 1, nucl_num - !$OMP PARALLEL DO DEFAULT(none) & - !$OMP PRIVATE(i,j,i1,j1,c_j1,c_i1) & - !$OMP SHARED(mo_tot_num,ao_num,mo_coef, & - !$OMP mo_nucl_elec_integral_per_atom, ao_nucl_elec_integral_per_atom,k) - do i = 1, mo_tot_num - do j = 1, mo_tot_num - do i1 = 1,ao_num - c_i1 = mo_coef(i1,i) - do j1 = 1,ao_num - c_j1 = c_i1*mo_coef(j1,j) - mo_nucl_elec_integral_per_atom(j,i,k) = mo_nucl_elec_integral_per_atom(j,i,k) + & - c_j1 * ao_nucl_elec_integral_per_atom(j1,i1,k) - enddo - enddo - enddo - enddo - !$OMP END PARALLEL DO + call ao_to_mo( & + ao_nucl_elec_integral_per_atom(1,1,k), & + size(ao_nucl_elec_integral_per_atom,1), & + mo_nucl_elec_integral_per_atom(1,1,k), & + size(mo_nucl_elec_integral_per_atom,1), & + ) enddo END_PROVIDER diff --git a/src/Integrals_Monoelec/pot_mo_pseudo_ints.irp.f b/src/Integrals_Monoelec/pot_mo_pseudo_ints.irp.f index 6c412e4b..9553aa6d 100644 --- a/src/Integrals_Monoelec/pot_mo_pseudo_ints.irp.f +++ b/src/Integrals_Monoelec/pot_mo_pseudo_ints.irp.f @@ -1,33 +1,27 @@ BEGIN_PROVIDER [double precision, mo_pseudo_integral, (mo_tot_num_align,mo_tot_num)] implicit none - integer :: i1,j1,i,j - double precision :: c_i1,c_j1 BEGIN_DOC ! interaction nuclear electron on the MO basis END_DOC - mo_pseudo_integral = 0.d0 - - if (.not.do_pseudo) then - return + if (read_mo_one_integrals) then + call read_one_e_integrals('mo_pseudo_integral', mo_pseudo_integral,& + size(mo_pseudo_integral,1), size(mo_pseudo_integral,2)) + print *, 'MO pseudopotential integrals read from disk' + else + call ao_to_mo( & + ao_pseudo_integral, & + size(ao_pseudo_integral,1), & + mo_pseudo_integral, & + size(mo_pseudo_integral,1), & + ) endif - !$OMP PARALLEL DO DEFAULT(none) & - !$OMP PRIVATE(i,j,i1,j1,c_j1,c_i1) & - !$OMP SHARED(mo_tot_num,ao_num,mo_coef, & - !$OMP mo_pseudo_integral, ao_pseudo_integral) - do i = 1, mo_tot_num - do j = 1, mo_tot_num - do i1 = 1,ao_num - c_i1 = mo_coef(i1,i) - do j1 = 1,ao_num - c_j1 = c_i1*mo_coef(j1,j) - mo_pseudo_integral(j,i) = mo_pseudo_integral(j,i) + & - c_j1 * ao_pseudo_integral(j1,i1) - enddo - enddo - enddo - enddo - !$OMP END PARALLEL DO + if (write_mo_one_integrals) then + call write_one_e_integrals('mo_pseudo_integral', mo_pseudo_integral,& + size(mo_pseudo_integral,1), size(mo_pseudo_integral,2)) + print *, 'MO pseudopotential integrals written to disk' + endif + END_PROVIDER diff --git a/src/Integrals_Monoelec/read_write.irp.f b/src/Integrals_Monoelec/read_write.irp.f new file mode 100644 index 00000000..697bf356 --- /dev/null +++ b/src/Integrals_Monoelec/read_write.irp.f @@ -0,0 +1,84 @@ + BEGIN_PROVIDER [ logical, read_ao_one_integrals ] +&BEGIN_PROVIDER [ logical, read_mo_one_integrals ] +&BEGIN_PROVIDER [ logical, write_ao_one_integrals ] +&BEGIN_PROVIDER [ logical, write_mo_one_integrals ] + + BEGIN_DOC + ! One level of abstraction for disk_access_ao_integrals and disk_access_mo_integrals + END_DOC + implicit none + + if (disk_access_ao_one_integrals.EQ.'Read') then + read_ao_one_integrals = .True. + write_ao_one_integrals = .False. + + else if (disk_access_ao_one_integrals.EQ.'Write') then + read_ao_one_integrals = .False. + write_ao_one_integrals = .True. + + else if (disk_access_ao_one_integrals.EQ.'None') then + read_ao_one_integrals = .False. + write_ao_one_integrals = .False. + + else + print *, 'bielec_integrals/disk_access_ao_integrals has a wrong type' + stop 1 + + endif + + if (disk_access_mo_one_integrals.EQ.'Read') then + read_mo_one_integrals = .True. + write_mo_one_integrals = .False. + + else if (disk_access_mo_one_integrals.EQ.'Write') then + read_mo_one_integrals = .False. + write_mo_one_integrals = .True. + + else if (disk_access_mo_one_integrals.EQ.'None') then + read_mo_one_integrals = .False. + write_mo_one_integrals = .False. + + else + print *, 'bielec_integrals/disk_access_mo_integrals has a wrong type' + stop 1 + + endif + +END_PROVIDER + +subroutine write_one_e_integrals(filename, A, m, n) + implicit none + BEGIN_DOC +! Write the 1-electron integrals stored in A(m,n) into file 'filename' + END_DOC + character(len=*), intent(in) :: filename + integer, intent(in) :: m,n + double precision, intent(in) :: A(m,n) + + integer :: iunit + integer, external :: getUnitAndOpen + character*(256) :: f + + iunit = getUnitAndOpen( trim(ezfio_work_dir)//trim(filename), 'W' ) + write(iunit) A + close(iunit) +end + +subroutine read_one_e_integrals(filename, A, m, n) + implicit none + BEGIN_DOC +! Read the 1-electron integrals into in A(m,n) from file 'filename' + END_DOC + character(len=*), intent(in) :: filename + integer, intent(in) :: m,n + double precision, intent(out) :: A(m,n) + + integer :: iunit + integer, external :: getUnitAndOpen + character*(256) :: f + + iunit = getUnitAndOpen( trim(ezfio_work_dir)//trim(filename), 'R' ) + read(iunit) A + close(iunit) +end + diff --git a/src/Integrals_Monoelec/spread_dipole_mo.irp.f b/src/Integrals_Monoelec/spread_dipole_mo.irp.f index d7306727..da91bee5 100644 --- a/src/Integrals_Monoelec/spread_dipole_mo.irp.f +++ b/src/Integrals_Monoelec/spread_dipole_mo.irp.f @@ -7,30 +7,26 @@ ! array of the integrals of MO_i * z MO_j END_DOC implicit none - integer :: i1,j1,i,j - double precision :: c_i1,c_j1 - mo_dipole_x = 0.d0 - mo_dipole_y = 0.d0 - mo_dipole_z = 0.d0 - !$OMP PARALLEL DO DEFAULT(none) & - !$OMP PRIVATE(i,j,i1,j1,c_j1,c_i1) & - !$OMP SHARED(mo_tot_num,ao_num,mo_coef, & - !$OMP mo_dipole_x,mo_dipole_y,mo_dipole_z,ao_dipole_x,ao_dipole_y,ao_dipole_z) - do i = 1, mo_tot_num - do j = 1, mo_tot_num - do i1 = 1,ao_num - c_i1 = mo_coef(i1,i) - do j1 = 1,ao_num - c_j1 = c_i1*mo_coef(j1,j) - mo_dipole_x(j,i) = mo_dipole_x(j,i) + c_j1 * ao_dipole_x(j1,i1) - mo_dipole_y(j,i) = mo_dipole_y(j,i) + c_j1 * ao_dipole_y(j1,i1) - mo_dipole_z(j,i) = mo_dipole_z(j,i) + c_j1 * ao_dipole_z(j1,i1) - enddo - enddo - enddo - enddo - !$OMP END PARALLEL DO + call ao_to_mo( & + ao_dipole_x, & + size(ao_dipole_x,1), & + mo_dipole_x, & + size(mo_dipole_x,1), & + ) + call ao_to_mo( & + ao_dipole_y, & + size(ao_dipole_y,1), & + mo_dipole_y, & + size(mo_dipole_y,1), & + ) + call ao_to_mo( & + ao_dipole_z, & + size(ao_dipole_z,1), & + mo_dipole_z, & + size(mo_dipole_z,1), & + ) + END_PROVIDER BEGIN_PROVIDER [double precision, mo_spread_x , (mo_tot_num_align,mo_tot_num)] @@ -42,60 +38,23 @@ END_PROVIDER ! array of the integrals of MO_i * z^2 MO_j END_DOC implicit none - integer :: i1,j1,i,j - double precision :: c_i1,c_j1 - - mo_nucl_elec_integral = 0.d0 - !$OMP PARALLEL DO DEFAULT(none) & - !$OMP PRIVATE(i,j,i1,j1,c_j1,c_i1) & - !$OMP SHARED(mo_tot_num,ao_num,mo_coef, & - !$OMP mo_spread_x,mo_spread_y,mo_spread_z,ao_spread_x,ao_spread_y,ao_spread_z) - do i = 1, mo_tot_num - do j = 1, mo_tot_num - do i1 = 1,ao_num - c_i1 = mo_coef(i1,i) - do j1 = 1,ao_num - c_j1 = c_i1*mo_coef(j1,j) - mo_spread_x(j,i) = mo_spread_x(j,i) + c_j1 * ao_spread_x(j1,i1) - mo_spread_y(j,i) = mo_spread_y(j,i) + c_j1 * ao_spread_y(j1,i1) - mo_spread_z(j,i) = mo_spread_z(j,i) + c_j1 * ao_spread_z(j1,i1) - enddo - enddo - enddo - enddo - !$OMP END PARALLEL DO -END_PROVIDER - - BEGIN_PROVIDER [double precision, mo_deriv_1_x , (mo_tot_num_align,mo_tot_num)] -&BEGIN_PROVIDER [double precision, mo_deriv_1_y , (mo_tot_num_align,mo_tot_num)] -&BEGIN_PROVIDER [double precision, mo_deriv_1_z , (mo_tot_num_align,mo_tot_num)] - BEGIN_DOC - ! array of the integrals of MO_i * d/dx MO_j - ! array of the integrals of MO_i * d/dy MO_j - ! array of the integrals of MO_i * d/dz MO_j - END_DOC - implicit none - integer :: i1,j1,i,j - double precision :: c_i1,c_j1 - - mo_nucl_elec_integral = 0.d0 - !$OMP PARALLEL DO DEFAULT(none) & - !$OMP PRIVATE(i,j,i1,j1,c_j1,c_i1) & - !$OMP SHARED(mo_tot_num,ao_num,mo_coef, & - !$OMP mo_deriv_1_x,mo_deriv_1_y,mo_deriv_1_z,ao_spread_x,ao_spread_y,ao_spread_z) - do i = 1, mo_tot_num - do j = 1, mo_tot_num - do i1 = 1,ao_num - c_i1 = mo_coef(i1,i) - do j1 = 1,ao_num - c_j1 = c_i1*mo_coef(j1,j) - mo_deriv_1_x(j,i) = mo_deriv_1_x(j,i) + c_j1 * ao_spread_x(j1,i1) - mo_deriv_1_y(j,i) = mo_deriv_1_y(j,i) + c_j1 * ao_spread_y(j1,i1) - mo_deriv_1_z(j,i) = mo_deriv_1_z(j,i) + c_j1 * ao_spread_z(j1,i1) - enddo - enddo - enddo - enddo - !$OMP END PARALLEL DO + call ao_to_mo( & + ao_spread_x, & + size(ao_spread_x,1), & + mo_spread_x, & + size(mo_spread_x,1), & + ) + call ao_to_mo( & + ao_spread_y, & + size(ao_spread_y,1), & + mo_spread_y, & + size(mo_spread_y,1), & + ) + call ao_to_mo( & + ao_spread_z, & + size(ao_spread_z,1), & + mo_spread_z, & + size(mo_spread_z,1), & + ) END_PROVIDER