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

Optimized get_all_spin_doubles_1

This commit is contained in:
Anthony Scemama 2021-03-31 01:50:53 +02:00
parent 882d8ee350
commit 697fbddde6
2 changed files with 16 additions and 18 deletions

View File

@ -438,7 +438,7 @@ subroutine H_S2_u_0_nstates_zmq(v_0,s_0,u_0,N_st,sze)
ipos=1
do imin=1,N_det,tasksize
imax = min(N_det,imin-1+tasksize)
if (imin==1) then
if (imin<=N_det/2) then
istep = 2
else
istep = 1
@ -505,7 +505,9 @@ subroutine H_S2_u_0_nstates_zmq(v_0,s_0,u_0,N_st,sze)
print *, irp_here, ': Failed in zmq_set_running'
endif
call omp_set_max_active_levels(4)
call omp_set_max_active_levels(5)
!$OMP PARALLEL DEFAULT(shared) NUM_THREADS(2) PRIVATE(ithread)
ithread = omp_get_thread_num()
if (ithread == 0 ) then

View File

@ -1075,19 +1075,17 @@ subroutine get_all_spin_singles_and_doubles_1(buffer, idx, spindet, size_buffer,
integer :: i
include 'utils/constants.include.F'
integer :: degree
integer :: add_double(0:64) = (/ 0, 0, 0, 0, 1, (0, i=1,60) /)
integer :: add_single(0:64) = (/ 0, 0, 1, 0, 0, (0, i=1,60) /)
n_singles = 1
n_doubles = 1
do i=1,size_buffer
degree = popcnt( xor( spindet, buffer(i) ) )
if ( degree == 4 ) then
doubles(n_doubles) = idx(i)
n_doubles = n_doubles+1
else if ( degree == 2 ) then
singles(n_singles) = idx(i)
n_singles = n_singles+1
endif
n_doubles = n_doubles+add_double(degree)
n_singles = n_singles+add_single(degree)
enddo
n_singles = n_singles-1
n_doubles = n_doubles-1
@ -1113,15 +1111,14 @@ subroutine get_all_spin_singles_1(buffer, idx, spindet, size_buffer, singles, n_
integer :: i
integer(bit_kind) :: v
integer :: degree
integer :: add_single(0:64) = (/ 0, 0, 1, 0, 0, (0, i=1,60) /)
include 'utils/constants.include.F'
n_singles = 1
do i=1,size_buffer
degree = popcnt(xor( spindet, buffer(i) ))
if (degree == 2) then
singles(n_singles) = idx(i)
n_singles = n_singles+1
endif
n_singles = n_singles+add_single(degree)
enddo
n_singles = n_singles-1
@ -1145,14 +1142,13 @@ subroutine get_all_spin_doubles_1(buffer, idx, spindet, size_buffer, doubles, n_
integer :: i
include 'utils/constants.include.F'
integer :: degree
integer :: add_double(0:64) = (/ 0, 0, 0, 0, 1, (0, i=1,60) /)
n_doubles = 1
do i=1,size_buffer
degree = popcnt(xor( spindet, buffer(i) ))
if ( degree == 4 ) then
doubles(n_doubles) = idx(i)
n_doubles = n_doubles+1
endif
n_doubles = n_doubles+add_double(degree)
enddo
n_doubles = n_doubles-1