diff --git a/TODO b/TODO index 699823ae..f65202c7 100644 --- a/TODO +++ b/TODO @@ -58,3 +58,6 @@ Re-design de qp command Doc: plugins et qp_plugins Ajouter les symetries dans devel + + +# Parallelize i_H_psi diff --git a/ocaml/.gitignore b/ocaml/.gitignore deleted file mode 100644 index cfb5639a..00000000 --- a/ocaml/.gitignore +++ /dev/null @@ -1,37 +0,0 @@ -_build -element_create_db -element_create_db.byte -ezfio.ml -.gitignore -Git.ml -Input_ao_one_e_ints.ml -Input_ao_two_e_erf_ints.ml -Input_ao_two_e_ints.ml -Input_auto_generated.ml -Input_becke_numerical_grid.ml -Input_davidson.ml -Input_density_for_dft.ml -Input_determinants.ml -Input_dft_keywords.ml -Input_dressing.ml -Input_mo_one_e_ints.ml -Input_mo_two_e_erf_ints.ml -Input_mo_two_e_ints.ml -Input_new_functionals.ml -Input_nuclei.ml -Input_perturbation.ml -Input_pseudo.ml -Input_scf_utils.ml -qp_create_ezfio -qp_create_ezfio.native -qp_edit -qp_edit.ml -qp_edit.native -qp_print_basis -qp_print_basis.native -qp_run -qp_run.native -qp_set_mo_class -qp_set_mo_class.native -qptypes_generator.byte -Qptypes.ml diff --git a/src/dft_keywords/keywords.irp.f b/src/dft_keywords/keywords.irp.f index c5beab20..ac819ecb 100644 --- a/src/dft_keywords/keywords.irp.f +++ b/src/dft_keywords/keywords.irp.f @@ -17,3 +17,17 @@ BEGIN_PROVIDER [ character*(32), DFT_TYPE] DFT_TYPE = "GGA" endif END_PROVIDER + +BEGIN_PROVIDER [ logical, same_xc_func ] + BEGIN_DOC +! true if the exchange and correlation functionals are the same + END_DOC + implicit none + if(trim(correlation_functional).eq.trim(exchange_functional))then + same_xc_func = .True. + else + same_xc_func = .False. + endif + + +END_PROVIDER diff --git a/src/dft_one_e/pot_general.irp.f b/src/dft_one_e/pot_general.irp.f index 3437269e..2b9b23a6 100644 --- a/src/dft_one_e/pot_general.irp.f +++ b/src/dft_one_e/pot_general.irp.f @@ -133,3 +133,70 @@ END_PROVIDER END_PROVIDER + BEGIN_PROVIDER [double precision, Trace_v_xc_new, (N_states)] + implicit none + integer :: i,j,istate + double precision :: dm + BEGIN_DOC +! Trace_v_xc = \sum_{i,j} (rho_{ij}_\alpha v^{xc}_{ij}^\alpha + rho_{ij}_\beta v^{xc}_{ij}^\beta) + END_DOC + do istate = 1, N_states + Trace_v_xc_new(istate) = 0.d0 + do i = 1, mo_num + do j = 1, mo_num + Trace_v_xc_new(istate) += (potential_xc_alpha_mo(j,i,istate) ) * one_e_dm_mo_alpha_for_dft(j,i,istate) + Trace_v_xc_new(istate) += (potential_xc_beta_mo(j,i,istate) ) * one_e_dm_mo_beta_for_dft(j,i,istate) + enddo + enddo + enddo + +END_PROVIDER + + BEGIN_PROVIDER [double precision, potential_xc_alpha_mo,(mo_num,mo_num,N_states)] +&BEGIN_PROVIDER [double precision, potential_xc_beta_mo,(mo_num,mo_num,N_states)] + implicit none + integer :: istate + + do istate = 1, N_states + call ao_to_mo( & + potential_xc_alpha_ao(1,1,istate), & + size(potential_xc_alpha_ao,1), & + potential_xc_alpha_mo(1,1,istate), & + size(potential_xc_alpha_mo,1) & + ) + + call ao_to_mo( & + potential_xc_beta_ao(1,1,istate), & + size(potential_xc_beta_ao,1), & + potential_xc_beta_mo(1,1,istate), & + size(potential_xc_beta_mo,1) & + ) + enddo + +END_PROVIDER + + + BEGIN_PROVIDER [double precision, potential_xc_alpha_ao,(ao_num,ao_num,N_states)] +&BEGIN_PROVIDER [double precision, potential_xc_beta_ao,(ao_num,ao_num,N_states)] + implicit none + BEGIN_DOC +! general providers for the alpha/beta exchange/correlation potentials on the AO basis + END_DOC + + if(trim(exchange_functional)=="short_range_LDA")then + potential_xc_alpha_ao = potential_sr_xc_alpha_ao_LDA + potential_xc_beta_ao = potential_sr_xc_beta_ao_LDA + else if(trim(exchange_functional)=="LDA")then + potential_xc_alpha_ao = potential_xc_alpha_ao_LDA + potential_xc_beta_ao = potential_xc_beta_ao_LDA + else if(exchange_functional.EQ."None")then + potential_xc_alpha_ao = 0.d0 + potential_xc_beta_ao = 0.d0 + else + print*, 'Exchange functional required does not exist ...' + print*,'exchange_functional',exchange_functional + stop + endif + +END_PROVIDER + diff --git a/src/dft_utils_one_e/pot_ao.irp.f b/src/dft_utils_one_e/pot_ao.irp.f index 1cc7c51f..1cd5f536 100644 --- a/src/dft_utils_one_e/pot_ao.irp.f +++ b/src/dft_utils_one_e/pot_ao.irp.f @@ -1,63 +1,3 @@ - BEGIN_PROVIDER[double precision, aos_vc_alpha_LDA_w, (n_points_final_grid,ao_num,N_states)] -&BEGIN_PROVIDER[double precision, aos_vc_beta_LDA_w, (n_points_final_grid,ao_num,N_states)] -&BEGIN_PROVIDER[double precision, aos_vx_alpha_LDA_w, (n_points_final_grid,ao_num,N_states)] -&BEGIN_PROVIDER[double precision, aos_vx_beta_LDA_w, (n_points_final_grid,ao_num,N_states)] - implicit none - BEGIN_DOC -! aos_vxc_alpha_LDA_w(j,i) = ao_i(r_j) * (v^x_alpha(r_j) + v^c_alpha(r_j)) * W(r_j) - END_DOC - integer :: istate,i,j - double precision :: r(3) - double precision :: mu,weight - double precision :: e_c,vc_a,vc_b,e_x,vx_a,vx_b - double precision, allocatable :: rhoa(:),rhob(:) - double precision :: mu_local - mu_local = 1.d-9 - allocate(rhoa(N_states), rhob(N_states)) - do istate = 1, N_states - do j =1, ao_num - do i = 1, n_points_final_grid - r(1) = final_grid_points(1,i) - r(2) = final_grid_points(2,i) - r(3) = final_grid_points(3,i) - weight = final_weight_at_r_vector(i) - rhoa(istate) = one_e_dm_alpha_at_r(i,istate) - rhob(istate) = one_e_dm_beta_at_r(i,istate) - call ec_LDA_sr(mu_local,rhoa(istate),rhob(istate),e_c,vc_a,vc_b) - call ex_LDA_sr(mu_local,rhoa(istate),rhob(istate),e_x,vx_a,vx_b) - aos_vc_alpha_LDA_w(i,j,istate) = vc_a * aos_in_r_array_transp(i,j)*weight - aos_vc_beta_LDA_w(i,j,istate) = vc_b * aos_in_r_array_transp(i,j)*weight - aos_vx_alpha_LDA_w(i,j,istate) = vx_a * aos_in_r_array_transp(i,j)*weight - aos_vx_beta_LDA_w(i,j,istate) = vx_b * aos_in_r_array_transp(i,j)*weight - enddo - enddo - enddo - - END_PROVIDER - - - BEGIN_PROVIDER [double precision, potential_x_alpha_ao_LDA,(ao_num,ao_num,N_states)] -&BEGIN_PROVIDER [double precision, potential_x_beta_ao_LDA ,(ao_num,ao_num,N_states)] -&BEGIN_PROVIDER [double precision, potential_c_alpha_ao_LDA,(ao_num,ao_num,N_states)] -&BEGIN_PROVIDER [double precision, potential_c_beta_ao_LDA ,(ao_num,ao_num,N_states)] - implicit none - BEGIN_DOC -! short range exchange/correlation alpha/beta potentials with LDA functional on the AO basis - END_DOC - integer :: istate - double precision :: wall_1,wall_2 - call wall_time(wall_1) - do istate = 1, N_states - call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0,aos_in_r_array,ao_num,aos_vc_alpha_LDA_w(1,1,istate),n_points_final_grid,0.d0,potential_c_alpha_ao_LDA(1,1,istate),ao_num) - call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0,aos_in_r_array,ao_num,aos_vc_beta_LDA_w(1,1,istate) ,n_points_final_grid,0.d0,potential_c_beta_ao_LDA(1,1,istate),ao_num) - call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0,aos_in_r_array,ao_num,aos_vx_alpha_LDA_w(1,1,istate),n_points_final_grid,0.d0,potential_x_alpha_ao_LDA(1,1,istate),ao_num) - call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0,aos_in_r_array,ao_num,aos_vx_beta_LDA_w(1,1,istate) ,n_points_final_grid,0.d0,potential_x_beta_ao_LDA(1,1,istate),ao_num) - enddo - call wall_time(wall_2) - print*,'time to provide potential_x/c_alpha/beta_ao_LDA = ',wall_2 - wall_1 - - END_PROVIDER - BEGIN_PROVIDER[double precision, aos_vc_alpha_PBE_w , (ao_num,n_points_final_grid,N_states)] &BEGIN_PROVIDER[double precision, aos_vc_beta_PBE_w , (ao_num,n_points_final_grid,N_states)] &BEGIN_PROVIDER[double precision, aos_vx_alpha_PBE_w , (ao_num,n_points_final_grid,N_states)] diff --git a/src/dft_utils_one_e/pot_ao_lda_smashed.irp.f b/src/dft_utils_one_e/pot_ao_lda_smashed.irp.f new file mode 100644 index 00000000..c71f34bf --- /dev/null +++ b/src/dft_utils_one_e/pot_ao_lda_smashed.irp.f @@ -0,0 +1,53 @@ + + BEGIN_PROVIDER[double precision, aos_vxc_alpha_LDA_w, (n_points_final_grid,ao_num,N_states)] +&BEGIN_PROVIDER[double precision, aos_vxc_beta_LDA_w, (n_points_final_grid,ao_num,N_states)] + implicit none + BEGIN_DOC +! aos_vxc_alpha_LDA_w(j,i) = ao_i(r_j) * (v^x_alpha(r_j) + v^c_alpha(r_j)) * W(r_j) + END_DOC + integer :: istate,i,j + double precision :: r(3) + double precision :: mu,weight + double precision :: e_c,vc_a,vc_b,e_x,vx_a,vx_b + double precision, allocatable :: rhoa(:),rhob(:) + double precision :: mu_local + mu_local = 1.d-9 + allocate(rhoa(N_states), rhob(N_states)) + do istate = 1, N_states + do i = 1, n_points_final_grid + r(1) = final_grid_points(1,i) + r(2) = final_grid_points(2,i) + r(3) = final_grid_points(3,i) + weight = final_weight_at_r_vector(i) + rhoa(istate) = one_e_dm_alpha_at_r(i,istate) + rhob(istate) = one_e_dm_beta_at_r(i,istate) + call ec_LDA_sr(mu_local,rhoa(istate),rhob(istate),e_c,vc_a,vc_b) + call ex_LDA_sr(mu_local,rhoa(istate),rhob(istate),e_x,vx_a,vx_b) + do j =1, ao_num + aos_vxc_alpha_LDA_w(i,j,istate) = (vc_a + vx_a) * aos_in_r_array(j,i)*weight + aos_vxc_beta_LDA_w(i,j,istate) = (vc_b + vx_b) * aos_in_r_array(j,i)*weight + enddo + enddo + enddo + + END_PROVIDER + + + BEGIN_PROVIDER [double precision, potential_xc_alpha_ao_LDA,(ao_num,ao_num,N_states)] +&BEGIN_PROVIDER [double precision, potential_xc_beta_ao_LDA ,(ao_num,ao_num,N_states)] + implicit none + BEGIN_DOC +! short range exchange/correlation alpha/beta potentials with LDA functional on the AO basis + END_DOC + integer :: istate + double precision :: wall_1,wall_2 + call wall_time(wall_1) + print*,'providing the XC potentials LDA ' + do istate = 1, N_states + call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0,aos_in_r_array,ao_num,aos_vxc_alpha_LDA_w(1,1,istate),n_points_final_grid,0.d0,potential_xc_alpha_ao_LDA(1,1,istate),ao_num) + call dgemm('N','N',ao_num,ao_num,n_points_final_grid,1.d0,aos_in_r_array,ao_num,aos_vxc_beta_LDA_w(1,1,istate) ,n_points_final_grid,0.d0,potential_xc_beta_ao_LDA(1,1,istate),ao_num) + enddo + call wall_time(wall_2) + + END_PROVIDER + diff --git a/src/dft_utils_one_e/shifted_potential.irp.f b/src/dft_utils_one_e/shifted_potential.irp.f deleted file mode 100644 index 8cc1cf39..00000000 --- a/src/dft_utils_one_e/shifted_potential.irp.f +++ /dev/null @@ -1,16 +0,0 @@ -BEGIN_PROVIDER [double precision, shifting_constant, (N_states)] - implicit none - BEGIN_DOC - ! shifting_constant = (E_{Hxc} - <\Psi | V_{Hxc} | \Psi>) / N_elec - ! constant to add to the potential in order to obtain the variational energy as - ! the eigenvalue of the effective long-range Hamiltonian - ! (see original paper of Levy PRL 113, 113002 (2014), equation (17) ) - END_DOC - integer :: istate - do istate = 1, N_states - shifting_constant(istate) = energy_x(istate) + energy_c(istate) + short_range_Hartree(istate) - Trace_v_Hxc(istate) - enddo - shifting_constant = shifting_constant / dble(elec_num) - - -END_PROVIDER diff --git a/src/dft_utils_one_e/sr_pot_ao.irp.f b/src/dft_utils_one_e/sr_pot_ao.irp.f index 19f02a3c..5d540794 100644 --- a/src/dft_utils_one_e/sr_pot_ao.irp.f +++ b/src/dft_utils_one_e/sr_pot_ao.irp.f @@ -1,75 +1,3 @@ - BEGIN_PROVIDER[double precision, aos_sr_vc_alpha_LDA_w, (n_points_final_grid,ao_num,N_states)] -&BEGIN_PROVIDER[double precision, aos_sr_vc_beta_LDA_w, (n_points_final_grid,ao_num,N_states)] -&BEGIN_PROVIDER[double precision, aos_sr_vx_alpha_LDA_w, (n_points_final_grid,ao_num,N_states)] -&BEGIN_PROVIDER[double precision, aos_sr_vx_beta_LDA_w, (n_points_final_grid,ao_num,N_states)] - implicit none - BEGIN_DOC -! aos_sr_vxc_alpha_LDA_w(j,i) = ao_i(r_j) * (sr_v^x_alpha(r_j) + sr_v^c_alpha(r_j)) * W(r_j) - END_DOC - integer :: istate,i,j - double precision :: r(3) - double precision :: mu,weight - double precision :: e_c,sr_vc_a,sr_vc_b,e_x,sr_vx_a,sr_vx_b - double precision, allocatable :: rhoa(:),rhob(:) - allocate(rhoa(N_states), rhob(N_states)) - do istate = 1, N_states - do i = 1, n_points_final_grid - r(1) = final_grid_points(1,i) - r(2) = final_grid_points(2,i) - r(3) = final_grid_points(3,i) - weight=final_weight_at_r_vector(i) - rhoa(istate) = one_e_dm_alpha_at_r(i,istate) - rhob(istate) = one_e_dm_beta_at_r(i,istate) - call ec_LDA_sr(mu_erf_dft,rhoa(istate),rhob(istate),e_c,sr_vc_a,sr_vc_b) - call ex_LDA_sr(mu_erf_dft,rhoa(istate),rhob(istate),e_x,sr_vx_a,sr_vx_b) - do j =1, ao_num - aos_sr_vc_alpha_LDA_w(i,j,istate) = sr_vc_a * aos_in_r_array(j,i)*weight - aos_sr_vc_beta_LDA_w(i,j,istate) = sr_vc_b * aos_in_r_array(j,i)*weight - aos_sr_vx_alpha_LDA_w(i,j,istate) = sr_vx_a * aos_in_r_array(j,i)*weight - aos_sr_vx_beta_LDA_w(i,j,istate) = sr_vx_b * aos_in_r_array(j,i)*weight - enddo - enddo - enddo - - END_PROVIDER - - - BEGIN_PROVIDER [double precision, potential_sr_x_alpha_ao_LDA,(ao_num,ao_num,N_states)] -&BEGIN_PROVIDER [double precision, potential_sr_x_beta_ao_LDA,(ao_num,ao_num,N_states)] - implicit none - BEGIN_DOC - ! short range exchange alpha/beta potentials with LDA functional on the |AO| basis - END_DOC - ! Second dimension is given as ao_num * N_states so that Lapack does the loop over N_states. - call dgemm('N','N',ao_num,ao_num*N_states,n_points_final_grid,1.d0, & - aos_in_r_array,size(aos_in_r_array,1), & - aos_sr_vx_alpha_LDA_w,size(aos_sr_vx_alpha_LDA_w,1),0.d0,& - potential_sr_x_alpha_ao_LDA,size(potential_sr_x_alpha_ao_LDA,1)) - call dgemm('N','N',ao_num,ao_num*N_states,n_points_final_grid,1.d0, & - aos_in_r_array,size(aos_in_r_array,1), & - aos_sr_vx_beta_LDA_w,size(aos_sr_vx_beta_LDA_w,1),0.d0,& - potential_sr_x_beta_ao_LDA,size(potential_sr_x_beta_ao_LDA,1)) - -END_PROVIDER - - BEGIN_PROVIDER [double precision, potential_sr_c_alpha_ao_LDA,(ao_num,ao_num,N_states)] -&BEGIN_PROVIDER [double precision, potential_sr_c_beta_ao_LDA,(ao_num,ao_num,N_states)] - implicit none - BEGIN_DOC -! short range correlation alpha/beta potentials with LDA functional on the |AO| basis - END_DOC - ! Second dimension is given as ao_num * N_states so that Lapack does the loop over N_states. - call dgemm('N','N',ao_num,ao_num*N_states,n_points_final_grid,1.d0, & - aos_in_r_array,size(aos_in_r_array,1), & - aos_sr_vc_alpha_LDA_w,size(aos_sr_vc_alpha_LDA_w,1),0.d0,& - potential_sr_c_alpha_ao_LDA,size(potential_sr_c_alpha_ao_LDA,1)) - call dgemm('N','N',ao_num,ao_num*N_states,n_points_final_grid,1.d0, & - aos_in_r_array,size(aos_in_r_array,1), & - aos_sr_vc_beta_LDA_w,size(aos_sr_vc_beta_LDA_w,1),0.d0,& - potential_sr_c_beta_ao_LDA,size(potential_sr_c_beta_ao_LDA,1)) - -END_PROVIDER - BEGIN_PROVIDER[double precision, aos_sr_vc_alpha_PBE_w , (ao_num,n_points_final_grid,N_states)] !(n_points_final_grid,ao_num,N_states)] &BEGIN_PROVIDER[double precision, aos_sr_vc_beta_PBE_w , (ao_num,n_points_final_grid,N_states)]!(n_points_final_grid,ao_num,N_states)] &BEGIN_PROVIDER[double precision, aos_sr_vx_alpha_PBE_w , (ao_num,n_points_final_grid,N_states)] !(n_points_final_grid,ao_num,N_states)] diff --git a/src/dft_utils_one_e/sr_pot_ao_lda_smashed.irp.f b/src/dft_utils_one_e/sr_pot_ao_lda_smashed.irp.f new file mode 100644 index 00000000..cbb3424b --- /dev/null +++ b/src/dft_utils_one_e/sr_pot_ao_lda_smashed.irp.f @@ -0,0 +1,55 @@ + + BEGIN_PROVIDER[double precision, aos_sr_vxc_alpha_LDA_w, (ao_num,n_points_final_grid,N_states)] +&BEGIN_PROVIDER[double precision, aos_sr_vxc_beta_LDA_w, (ao_num,n_points_final_grid,N_states)] + implicit none + BEGIN_DOC +! aos_sr_vxc_alpha_LDA_w(j,i) = ao_i(r_j) * (v^x_alpha(r_j) + v^c_alpha(r_j)) * W(r_j) + END_DOC + integer :: istate,i,j + double precision :: r(3) + double precision :: mu,weight + double precision :: e_c,sr_vc_a,sr_vc_b,e_x,sr_vx_a,sr_vx_b + double precision, allocatable :: rhoa(:),rhob(:) + double precision :: mu_local + mu_local = mu_erf_dft + allocate(rhoa(N_states), rhob(N_states)) + do istate = 1, N_states + do i = 1, n_points_final_grid + r(1) = final_grid_points(1,i) + r(2) = final_grid_points(2,i) + r(3) = final_grid_points(3,i) + weight = final_weight_at_r_vector(i) + rhoa(istate) = one_e_dm_alpha_at_r(i,istate) + rhob(istate) = one_e_dm_beta_at_r(i,istate) + call ec_LDA_sr(mu_local,rhoa(istate),rhob(istate),e_c,sr_vc_a,sr_vc_b) + call ex_LDA_sr(mu_local,rhoa(istate),rhob(istate),e_x,sr_vx_a,sr_vx_b) + do j =1, ao_num + aos_sr_vxc_alpha_LDA_w(j,i,istate) = (sr_vc_a + sr_vx_a) * aos_in_r_array(j,i)*weight + aos_sr_vxc_beta_LDA_w(j,i,istate) = (sr_vc_b + sr_vx_b) * aos_in_r_array(j,i)*weight + enddo + enddo + enddo + + END_PROVIDER + + + BEGIN_PROVIDER [double precision, potential_sr_xc_alpha_ao_LDA,(ao_num,ao_num,N_states)] +&BEGIN_PROVIDER [double precision, potential_sr_xc_beta_ao_LDA ,(ao_num,ao_num,N_states)] + implicit none + BEGIN_DOC +! short range exchange/correlation alpha/beta potentials with LDA functional on the AO basis + END_DOC + + call dgemm('N','T',ao_num,ao_num*N_states,n_points_final_grid,1.d0, & + aos_in_r_array,size(aos_in_r_array,1), & + aos_sr_vxc_alpha_LDA_w,size(aos_sr_vxc_alpha_LDA_w,1),0.d0,& + potential_sr_xc_alpha_ao_LDA,size(potential_sr_xc_alpha_ao_LDA,1)) + + call dgemm('N','T',ao_num,ao_num*N_states,n_points_final_grid,1.d0, & + aos_in_r_array,size(aos_in_r_array,1), & + aos_sr_vxc_beta_LDA_w,size(aos_sr_vxc_beta_LDA_w,1),0.d0,& + potential_sr_xc_beta_ao_LDA,size(potential_sr_xc_beta_ao_LDA,1)) + + + END_PROVIDER + diff --git a/src/kohn_sham/fock_matrix_ks.irp.f b/src/kohn_sham/fock_matrix_ks.irp.f index 449fcef3..a11906db 100644 --- a/src/kohn_sham/fock_matrix_ks.irp.f +++ b/src/kohn_sham/fock_matrix_ks.irp.f @@ -109,10 +109,7 @@ integer(key_kind), allocatable :: keys(:) double precision, allocatable :: values(:) - - - - !$OMP PARALLEL DEFAULT(NONE) & + !$OMP PARALLEL DEFAULT(NONE) if (ao_num > 100) & !$OMP PRIVATE(i,j,l,k1,k,integral,ii,jj,kk,ll,i8,keys,values,n_elements_max, & !$OMP n_elements,ao_two_e_integral_alpha_tmp,ao_two_e_integral_beta_tmp)& !$OMP SHARED(ao_num,SCF_density_matrix_ao_alpha,SCF_density_matrix_ao_beta,& @@ -125,7 +122,7 @@ ao_two_e_integral_alpha_tmp = 0.d0 ao_two_e_integral_beta_tmp = 0.d0 - !$OMP DO SCHEDULE(dynamic,64) + !$OMP DO SCHEDULE(static,1) !DIR$ NOVECTOR do i8=0_8,ao_integrals_map%map_size n_elements = n_elements_max @@ -153,8 +150,6 @@ !$OMP END DO NOWAIT !$OMP CRITICAL ao_two_e_integral_alpha += ao_two_e_integral_alpha_tmp - !$OMP END CRITICAL - !$OMP CRITICAL ao_two_e_integral_beta += ao_two_e_integral_beta_tmp !$OMP END CRITICAL deallocate(keys,values,ao_two_e_integral_alpha_tmp,ao_two_e_integral_beta_tmp) diff --git a/src/kohn_sham/ks_scf.irp.f b/src/kohn_sham/ks_scf.irp.f index 891a1285..aa6efd52 100644 --- a/src/kohn_sham/ks_scf.irp.f +++ b/src/kohn_sham/ks_scf.irp.f @@ -36,7 +36,7 @@ subroutine check_coherence_functional ifound_c = index(correlation_functional,"short_range") endif print*,ifound_x,ifound_c - if(ifound_x .eq.0 .or. ifound_c .eq. 0)then + if(ifound_x .ne.0 .or. ifound_c .ne. 0)then print*,'YOU ARE USING THE RANGE SEPARATED KS PROGRAM BUT YOUR INPUT KEYWORD FOR ' print*,'exchange_functional is ',exchange_functional print*,'correlation_functional is ',correlation_functional diff --git a/src/kohn_sham/pot_functionals.irp.f b/src/kohn_sham/pot_functionals.irp.f index f89ffa18..c471da3b 100644 --- a/src/kohn_sham/pot_functionals.irp.f +++ b/src/kohn_sham/pot_functionals.irp.f @@ -4,12 +4,21 @@ integer :: i,j,k,l ao_potential_alpha_xc = 0.d0 ao_potential_beta_xc = 0.d0 - do i = 1, ao_num - do j = 1, ao_num - ao_potential_alpha_xc(i,j) = potential_c_alpha_ao(i,j,1) + potential_x_alpha_ao(i,j,1) - ao_potential_beta_xc(i,j) = potential_c_beta_ao(i,j,1) + potential_x_beta_ao(i,j,1) + if(same_xc_func)then + do i = 1, ao_num + do j = 1, ao_num + ao_potential_alpha_xc(i,j) = potential_xc_alpha_ao(i,j,1) + ao_potential_beta_xc(i,j) = potential_xc_beta_ao(i,j,1) + enddo enddo - enddo + else + do i = 1, ao_num + do j = 1, ao_num + ao_potential_alpha_xc(i,j) = potential_c_alpha_ao(i,j,1) + potential_x_alpha_ao(i,j,1) + ao_potential_beta_xc(i,j) = potential_c_beta_ao(i,j,1) + potential_x_beta_ao(i,j,1) + enddo + enddo + endif END_PROVIDER BEGIN_PROVIDER [double precision, e_exchange_dft] diff --git a/src/kohn_sham_rs/fock_matrix_rs_ks.irp.f b/src/kohn_sham_rs/fock_matrix_rs_ks.irp.f index 6bc0a715..2cfeb109 100644 --- a/src/kohn_sham_rs/fock_matrix_rs_ks.irp.f +++ b/src/kohn_sham_rs/fock_matrix_rs_ks.irp.f @@ -3,7 +3,7 @@ use map_module implicit none BEGIN_DOC - ! Alpha Fock matrix in AO basis set + ! Alpha Fock matrix in ao basis set END_DOC integer :: i,j,k,l,k1,r,s @@ -35,7 +35,7 @@ ao_two_e_integral_beta_tmp = 0.d0 q = ao_num*ao_num*ao_num*ao_num - !$OMP DO SCHEDULE(static,64) + !$OMP DO SCHEDULE(dynamic) do p=1_8,q call two_e_integrals_index_reverse(kk,ii,ll,jj,p) if ( (kk(1)>ao_num).or. & @@ -91,6 +91,8 @@ !$OMP END DO NOWAIT !$OMP CRITICAL ao_two_e_integral_alpha += ao_two_e_integral_alpha_tmp + !$OMP END CRITICAL + !$OMP CRITICAL ao_two_e_integral_beta += ao_two_e_integral_beta_tmp !$OMP END CRITICAL deallocate(keys,values,ao_two_e_integral_alpha_tmp,ao_two_e_integral_beta_tmp) @@ -203,19 +205,18 @@ END_PROVIDER - BEGIN_PROVIDER [ double precision, Fock_matrix_ao_alpha, (ao_num, ao_num) ] &BEGIN_PROVIDER [ double precision, Fock_matrix_ao_beta, (ao_num, ao_num) ] implicit none BEGIN_DOC - ! Alpha Fock matrix in AO basis set + ! Alpha Fock matrix in ao basis set END_DOC integer :: i,j do j=1,ao_num do i=1,ao_num Fock_matrix_ao_alpha(i,j) = Fock_matrix_alpha_no_xc_ao(i,j) + ao_potential_alpha_xc(i,j) - Fock_matrix_ao_beta (i,j) = Fock_matrix_beta_no_xc_ao(i,j) + ao_potential_beta_xc(i,j) + Fock_matrix_ao_beta(i,j) = Fock_matrix_beta_no_xc_ao(i,j) + ao_potential_beta_xc(i,j) enddo enddo @@ -226,7 +227,7 @@ END_PROVIDER &BEGIN_PROVIDER [ double precision, Fock_matrix_beta_no_xc_ao, (ao_num, ao_num) ] implicit none BEGIN_DOC - ! Mono electronic an Coulomb matrix in AO basis set + ! Mono electronic an Coulomb matrix in ao basis set END_DOC integer :: i,j diff --git a/src/kohn_sham_rs/pot_functionals.irp.f b/src/kohn_sham_rs/pot_functionals.irp.f index f89ffa18..517597be 100644 --- a/src/kohn_sham_rs/pot_functionals.irp.f +++ b/src/kohn_sham_rs/pot_functionals.irp.f @@ -4,12 +4,22 @@ integer :: i,j,k,l ao_potential_alpha_xc = 0.d0 ao_potential_beta_xc = 0.d0 - do i = 1, ao_num - do j = 1, ao_num - ao_potential_alpha_xc(i,j) = potential_c_alpha_ao(i,j,1) + potential_x_alpha_ao(i,j,1) - ao_potential_beta_xc(i,j) = potential_c_beta_ao(i,j,1) + potential_x_beta_ao(i,j,1) + !if(same_xc_func)then + ! do i = 1, ao_num + ! do j = 1, ao_num + ! ao_potential_alpha_xc(j,i) = potential_xc_alpha_ao(j,i,1) + ! ao_potential_beta_xc(j,i) = potential_xc_beta_ao(j,i,1) + ! enddo + ! enddo + !else + do i = 1, ao_num + do j = 1, ao_num + ao_potential_alpha_xc(j,i) = potential_c_alpha_ao(j,i,1) + potential_x_alpha_ao(j,i,1) + ao_potential_beta_xc(j,i) = potential_c_beta_ao(j,i,1) + potential_x_beta_ao(j,i,1) + enddo enddo - enddo + !endif + END_PROVIDER BEGIN_PROVIDER [double precision, e_exchange_dft]