9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-12 22:53:29 +01:00

openmp version of state average dm work

This commit is contained in:
Emmanuel Giner 2020-03-20 11:04:36 +01:00
parent cac0146fe9
commit 244831673d
3 changed files with 42 additions and 19 deletions

View File

@ -52,6 +52,7 @@
! Therefore you don't necessayr have symmetry between electron 1 and 2
END_DOC
integer :: ispin
double precision :: wall_1, wall_2
! condition for alpha/beta spin
print*,''
print*,''
@ -60,8 +61,11 @@
ispin = 3
print*,'ispin = ',ispin
all_states_act_two_rdm_alpha_beta_mo = 0.d0
call wall_time(wall_1)
call orb_range_all_states_two_rdm(all_states_act_two_rdm_alpha_beta_mo,n_act_orb,n_act_orb,list_act,list_act_reverse,ispin,psi_coef,size(psi_coef,2),size(psi_coef,1))
call wall_time(wall_2)
print*,'Wall time to provide all_states_act_two_rdm_alpha_beta_mo',wall_2 - wall_1
END_PROVIDER

View File

@ -12,7 +12,11 @@
! condition for alpha/beta spin
ispin = 1
state_av_act_two_rdm_openmp_alpha_alpha_mo = 0.D0
call wall_time(wall_1)
double precision :: wall_1, wall_2
call orb_range_two_rdm_state_av_openmp(state_av_act_two_rdm_openmp_alpha_alpha_mo,n_act_orb,n_act_orb,list_act,state_weights,ispin,psi_coef,size(psi_coef,2),size(psi_coef,1))
call wall_time(wall_2)
print*,'Wall time to provide state_av_act_two_rdm_openmp_alpha_alpha_mo',wall_2 - wall_1
END_PROVIDER
@ -29,7 +33,11 @@
! condition for alpha/beta spin
ispin = 2
state_av_act_two_rdm_openmp_beta_beta_mo = 0.d0
call wall_time(wall_1)
double precision :: wall_1, wall_2
call orb_range_two_rdm_state_av_openmp(state_av_act_two_rdm_openmp_beta_beta_mo,n_act_orb,n_act_orb,list_act,state_weights,ispin,psi_coef,size(psi_coef,2),size(psi_coef,1))
call wall_time(wall_2)
print*,'Wall time to provide state_av_act_two_rdm_openmp_beta_beta_mo',wall_2 - wall_1
END_PROVIDER
@ -51,7 +59,11 @@
ispin = 3
print*,'ispin = ',ispin
state_av_act_two_rdm_openmp_alpha_beta_mo = 0.d0
call wall_time(wall_1)
double precision :: wall_1, wall_2
call orb_range_two_rdm_state_av_openmp(state_av_act_two_rdm_openmp_alpha_beta_mo,n_act_orb,n_act_orb,list_act,state_weights,ispin,psi_coef,size(psi_coef,2),size(psi_coef,1))
call wall_time(wall_2)
print*,'Wall time to provide state_av_act_two_rdm_openmp_alpha_beta_mo',wall_2 - wall_1
END_PROVIDER
@ -74,12 +86,12 @@
ispin = 4
state_av_act_two_rdm_openmp_spin_trace_mo = 0.d0
integer :: i
double precision :: wall_0,wall_1
call wall_time(wall_0)
print*,'providing the state average TWO-RDM ...'
call wall_time(wall_1)
double precision :: wall_1, wall_2
print*,'providing state_av_act_two_rdm_openmp_spin_trace_mo '
call orb_range_two_rdm_state_av_openmp(state_av_act_two_rdm_openmp_spin_trace_mo,n_act_orb,n_act_orb,list_act,state_weights,ispin,psi_coef,size(psi_coef,2),size(psi_coef,1))
call wall_time(wall_1)
print*,'Time to provide the state average TWO-RDM',wall_1 - wall_0
call wall_time(wall_2)
print*,'Time to provide state_av_act_two_rdm_openmp_spin_trace_mo',wall_2 - wall_1
END_PROVIDER

View File

@ -19,9 +19,11 @@ subroutine routine_active_only
double precision :: accu_ab_omp,rdmab_omp
double precision :: accu_bb_omp,rdmbb_omp
double precision :: accu_aa_omp,rdmaa_omp
double precision :: accu_tot_omp,rdmtot_omp
accu_ab_omp = 0.d0
accu_bb_omp = 0.d0
accu_aa_omp = 0.d0
accu_tot_omp = 0.d0
accu_aa = 0.d0
accu_ab = 0.d0
accu_bb = 0.d0
@ -40,21 +42,25 @@ subroutine routine_active_only
vijkl = get_two_e_integral(lorb,korb,jorb,iorb,mo_integrals_map)
rdmab_omp = state_av_act_two_rdm_openmp_alpha_beta_mo(l,k,j,i)
rdmbb_omp = state_av_act_two_rdm_openmp_beta_beta_mo(l,k,j,i)
rdmaa_omp = state_av_act_two_rdm_openmp_alpha_alpha_mo(l,k,j,i)
rdmaa = all_states_act_two_rdm_alpha_alpha_mo(l,k,j,i,istate)
rdmbb = all_states_act_two_rdm_beta_beta_mo(l,k,j,i,istate)
rdmab = all_states_act_two_rdm_alpha_beta_mo(l,k,j,i,istate)
rdmtot = all_states_act_two_rdm_spin_trace_mo(l,k,j,i,istate)
rdmab_omp = state_av_act_two_rdm_openmp_alpha_beta_mo(l,k,j,i)
rdmbb_omp = state_av_act_two_rdm_openmp_beta_beta_mo(l,k,j,i)
rdmaa_omp = state_av_act_two_rdm_openmp_alpha_alpha_mo(l,k,j,i)
rdmtot_omp = state_av_act_two_rdm_openmp_spin_trace_mo(l,k,j,i)
accu_ab_omp += vijkl * rdmab_omp
accu_bb_omp += vijkl * rdmbb_omp
accu_aa_omp += vijkl * rdmaa_omp
accu_ab(istate) += vijkl * rdmab
accu_aa(istate) += vijkl * rdmaa
accu_bb(istate) += vijkl * rdmbb
accu_tot(istate)+= vijkl * rdmtot
rdmaa = all_states_act_two_rdm_alpha_alpha_mo(l,k,j,i,istate)
rdmbb = all_states_act_two_rdm_beta_beta_mo(l,k,j,i,istate)
rdmab = all_states_act_two_rdm_alpha_beta_mo(l,k,j,i,istate)
rdmtot = all_states_act_two_rdm_spin_trace_mo(l,k,j,i,istate)
accu_ab_omp += vijkl * rdmab_omp
accu_bb_omp += vijkl * rdmbb_omp
accu_aa_omp += vijkl * rdmaa_omp
accu_tot_omp += vijkl * rdmtot_omp
accu_ab(istate) += vijkl * rdmab
accu_aa(istate) += vijkl * rdmaa
accu_bb(istate) += vijkl * rdmbb
accu_tot(istate) += vijkl * rdmtot
enddo
enddo
enddo
@ -70,6 +76,7 @@ subroutine routine_active_only
print*,''
print*,'sum (istate) = ',accu_aa(istate) + accu_bb(istate) + accu_ab(istate)
print*,'accu_tot(istate) = ',accu_tot(istate)
print*,'accu_tot_omp = ',accu_tot_omp
print*,'psi_energy_two_e(istate) = ',psi_energy_two_e(istate)
enddo