10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-22 20:34:58 +01:00

changed the read/write two_rdm

This commit is contained in:
Emmanuel Giner 2021-01-07 14:20:11 +01:00
parent 5b8580fe2d
commit 970f846a4d
2 changed files with 45 additions and 8 deletions

View File

@ -22,6 +22,8 @@
END_DOC
integer :: ispin
double precision :: wall_1, wall_2
character*(128) :: name_file
name_file = 'act_2_rdm_ab_mo'
! condition for alpha/beta spin
print*,''
print*,'Providing act_2_rdm_ab_mo '
@ -31,13 +33,13 @@
call wall_time(wall_1)
if(read_two_body_rdm_ab)then
print*,'Reading act_2_rdm_ab_mo from disk ...'
call ezfio_get_two_body_rdm_two_rdm_ab_disk(act_2_rdm_ab_mo)
call read_array_two_rdm(n_act_orb,N_states,act_2_rdm_ab_mo,name_file)
else
call orb_range_2_rdm_openmp(act_2_rdm_ab_mo,n_act_orb,n_act_orb,list_act,ispin,psi_coef,size(psi_coef,2),size(psi_coef,1))
endif
if(write_two_body_rdm_ab)then
print*,'Writing act_2_rdm_ab_mo on disk ...'
call ezfio_set_two_body_rdm_two_rdm_ab_disk(act_2_rdm_ab_mo)
call write_array_two_rdm(n_act_orb,n_states,act_2_rdm_ab_mo,name_file)
call ezfio_set_two_body_rdm_io_two_body_rdm_ab("Read")
endif
call wall_time(wall_2)
@ -63,18 +65,20 @@
! condition for alpha/beta spin
print*,''
print*,'Providing act_2_rdm_aa_mo '
character*(128) :: name_file
name_file = 'act_2_rdm_aa_mo'
ispin = 1
act_2_rdm_aa_mo = 0.d0
call wall_time(wall_1)
if(read_two_body_rdm_aa)then
print*,'Reading act_2_rdm_aa_mo from disk ...'
call ezfio_get_two_body_rdm_two_rdm_aa_disk(act_2_rdm_aa_mo)
call read_array_two_rdm(n_act_orb,N_states,act_2_rdm_aa_mo,name_file)
else
call orb_range_2_rdm_openmp(act_2_rdm_aa_mo,n_act_orb,n_act_orb,list_act,ispin,psi_coef,size(psi_coef,2),size(psi_coef,1))
endif
if(write_two_body_rdm_aa)then
print*,'Writing act_2_rdm_aa_mo on disk ...'
call ezfio_set_two_body_rdm_two_rdm_aa_disk(act_2_rdm_aa_mo)
call write_array_two_rdm(n_act_orb,n_states,act_2_rdm_aa_mo,name_file)
call ezfio_set_two_body_rdm_io_two_body_rdm_aa("Read")
endif
@ -101,18 +105,20 @@
! condition for beta/beta spin
print*,''
print*,'Providing act_2_rdm_bb_mo '
character*(128) :: name_file
name_file = 'act_2_rdm_bb_mo'
ispin = 2
act_2_rdm_bb_mo = 0.d0
call wall_time(wall_1)
if(read_two_body_rdm_bb)then
print*,'Reading act_2_rdm_bb_mo from disk ...'
call ezfio_get_two_body_rdm_two_rdm_bb_disk(act_2_rdm_bb_mo)
call read_array_two_rdm(n_act_orb,N_states,act_2_rdm_bb_mo,name_file)
else
call orb_range_2_rdm_openmp(act_2_rdm_bb_mo,n_act_orb,n_act_orb,list_act,ispin,psi_coef,size(psi_coef,2),size(psi_coef,1))
endif
if(write_two_body_rdm_bb)then
print*,'Writing act_2_rdm_bb_mo on disk ...'
call ezfio_set_two_body_rdm_two_rdm_bb_disk(act_2_rdm_bb_mo)
call write_array_two_rdm(n_act_orb,n_states,act_2_rdm_bb_mo,name_file)
call ezfio_set_two_body_rdm_io_two_body_rdm_bb("Read")
endif
@ -138,18 +144,20 @@
! condition for beta/beta spin
print*,''
print*,'Providing act_2_rdm_spin_trace_mo '
character*(128) :: name_file
name_file = 'act_2_rdm_spin_trace_mo'
ispin = 4
act_2_rdm_spin_trace_mo = 0.d0
call wall_time(wall_1)
if(read_two_body_rdm_spin_trace)then
print*,'Reading act_2_rdm_spin_trace_mo from disk ...'
call ezfio_get_two_body_rdm_two_rdm_spin_trace_disk(act_2_rdm_spin_trace_mo)
call read_array_two_rdm(n_act_orb,N_states,act_2_rdm_spin_trace_mo,name_file)
else
call orb_range_2_rdm_openmp(act_2_rdm_spin_trace_mo,n_act_orb,n_act_orb,list_act,ispin,psi_coef,size(psi_coef,2),size(psi_coef,1))
endif
if(write_two_body_rdm_spin_trace)then
print*,'Writing act_2_rdm_spin_trace_mo on disk ...'
call ezfio_set_two_body_rdm_two_rdm_spin_trace_disk(act_2_rdm_spin_trace_mo)
call write_array_two_rdm(n_act_orb,n_states,act_2_rdm_spin_trace_mo,name_file)
call ezfio_set_two_body_rdm_io_two_body_rdm_spin_trace("Read")
endif

View File

@ -0,0 +1,29 @@
subroutine write_array_two_rdm(n_orb,nstates,array_tmp,name_file)
implicit none
integer, intent(in) :: n_orb,nstates
character*(128), intent(in) :: name_file
double precision, intent(in) :: array_tmp(n_orb,n_orb,n_orb,n_orb,nstates)
character*(128) :: output
integer :: i_unit_output,getUnitAndOpen
PROVIDE ezfio_filename
output=trim(ezfio_filename)//'/work/'//trim(name_file)
i_unit_output = getUnitAndOpen(output,'W')
write(i_unit_output)array_tmp
close(unit=i_unit_output)
end
subroutine read_array_two_rdm(n_orb,nstates,array_tmp,name_file)
implicit none
character*(128) :: output
integer :: i_unit_output,getUnitAndOpen
integer, intent(in) :: n_orb,nstates
character*(128), intent(in) :: name_file
double precision, intent(out) :: array_tmp(n_orb,n_orb,n_orb,n_orb,N_states)
PROVIDE ezfio_filename
output=trim(ezfio_filename)//'/work/'//trim(name_file)
i_unit_output = getUnitAndOpen(output,'R')
read(i_unit_output)array_tmp
close(unit=i_unit_output)
end