10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-03 20:54:00 +01:00

Acceleration of Davidson for Nint>1

This commit is contained in:
Anthony Scemama 2016-12-06 11:31:15 +01:00
parent e6c8cf2e25
commit c07b0381b7

View File

@ -89,8 +89,11 @@ subroutine H_u_0_nstates(v_0,u_0,H_jj,n,keys_tmp,Nint,N_st,sze_8)
!$OMP DO SCHEDULE(dynamic) !$OMP DO SCHEDULE(dynamic)
do sh=1,shortcut(0,1) do sh=1,shortcut(0,1)
do sh2=sh,shortcut(0,1) do sh2=sh,shortcut(0,1)
exa = 0 exa = popcnt(xor(version(1,sh,1), version(1,sh2,1)))
do ni=1,Nint if(exa > 2) then
cycle
end if
do ni=2,Nint
exa = exa + popcnt(xor(version(ni,sh,1), version(ni,sh2,1))) exa = exa + popcnt(xor(version(ni,sh,1), version(ni,sh2,1)))
end do end do
if(exa > 2) then if(exa > 2) then
@ -108,20 +111,24 @@ subroutine H_u_0_nstates(v_0,u_0,H_jj,n,keys_tmp,Nint,N_st,sze_8)
sorted_i(ni) = sorted(ni,i,1) sorted_i(ni) = sorted(ni,i,1)
enddo enddo
do j=shortcut(sh2,1),endi jloop: do j=shortcut(sh2,1),endi
org_j = sort_idx(j,1) org_j = sort_idx(j,1)
ext = exa ext = exa + popcnt(xor(sorted_i(1), sorted(1,j,1)))
do ni=1,Nint if(ext > 4) then
ext = ext + popcnt(xor(sorted_i(ni), sorted(ni,j,1))) cycle jloop
end do
if(ext <= 4) then
call i_H_j(keys_tmp(1,1,org_j),keys_tmp(1,1,org_i),Nint,hij)
do istate=1,N_st
vt (istate,org_i) = vt (istate,org_i) + hij*ut(istate,org_j)
vt (istate,org_j) = vt (istate,org_j) + hij*ut(istate,org_i)
enddo
endif endif
enddo do ni=2,Nint
ext = ext + popcnt(xor(sorted_i(ni), sorted(ni,j,1)))
if(ext > 4) then
cycle jloop
endif
end do
call i_H_j(keys_tmp(1,1,org_j),keys_tmp(1,1,org_i),Nint,hij)
do istate=1,N_st
vt (istate,org_i) = vt (istate,org_i) + hij*ut(istate,org_j)
vt (istate,org_j) = vt (istate,org_j) + hij*ut(istate,org_i)
enddo
enddo jloop
enddo enddo
enddo enddo
enddo enddo
@ -133,17 +140,18 @@ subroutine H_u_0_nstates(v_0,u_0,H_jj,n,keys_tmp,Nint,N_st,sze_8)
org_i = sort_idx(i,2) org_i = sort_idx(i,2)
do j=shortcut(sh,2),i-1 do j=shortcut(sh,2),i-1
org_j = sort_idx(j,2) org_j = sort_idx(j,2)
ext = 0 ext = popcnt(xor(sorted(1,i,2), sorted(1,j,2)))
do ni=1,Nint do ni=2,Nint
ext = ext + popcnt(xor(sorted(ni,i,2), sorted(ni,j,2))) ext = ext + popcnt(xor(sorted(ni,i,2), sorted(ni,j,2)))
end do end do
if(ext == 4) then if(ext /= 4) then
call i_H_j(keys_tmp(1,1,org_j),keys_tmp(1,1,org_i),Nint,hij) cycle
do istate=1,N_st endif
vt (istate,org_i) = vt (istate,org_i) + hij*ut(istate,org_j) call i_H_j(keys_tmp(1,1,org_j),keys_tmp(1,1,org_i),Nint,hij)
vt (istate,org_j) = vt (istate,org_j) + hij*ut(istate,org_i) do istate=1,N_st
enddo vt (istate,org_i) = vt (istate,org_i) + hij*ut(istate,org_j)
end if vt (istate,org_j) = vt (istate,org_j) + hij*ut(istate,org_i)
enddo
end do end do
end do end do
enddo enddo
@ -350,8 +358,9 @@ subroutine H_S2_u_0_nstates(v_0,s_0,u_0,H_jj,S2_jj,n,keys_tmp,Nint,N_st,sze_8)
org_i = sort_idx(i,2) org_i = sort_idx(i,2)
do j=shortcut(sh,2),i-1 do j=shortcut(sh,2),i-1
org_j = sort_idx(j,2) org_j = sort_idx(j,2)
ext = 0 ext = popcnt(xor(sorted(1,i,2), sorted(1,j,2)))
do ni=1,Nint if (ext > 4) cycle
do ni=2,Nint
ext = ext + popcnt(xor(sorted(ni,i,2), sorted(ni,j,2))) ext = ext + popcnt(xor(sorted(ni,i,2), sorted(ni,j,2)))
if (ext > 4) exit if (ext > 4) exit
end do end do
@ -392,8 +401,9 @@ subroutine H_S2_u_0_nstates(v_0,s_0,u_0,H_jj,S2_jj,n,keys_tmp,Nint,N_st,sze_8)
enddo enddo
do j=shortcut(sh2,1),endi do j=shortcut(sh2,1),endi
ext = exa ext = exa + popcnt(xor(sorted_i(1), sorted(1,j,1)))
do ni=1,Nint if (ext > 4) cycle
do ni=2,Nint
ext = ext + popcnt(xor(sorted_i(ni), sorted(ni,j,1))) ext = ext + popcnt(xor(sorted_i(ni), sorted(ni,j,1)))
if (ext > 4) exit if (ext > 4) exit
end do end do