mirror of
https://github.com/LCPQ/quantum_package
synced 2025-01-03 18:16:12 +01:00
hard-coded fragmentation of first generators
This commit is contained in:
parent
6881056eaf
commit
fb1fa1af38
@ -87,7 +87,7 @@ program fci_zmq
|
|||||||
threshold_selectors = 1.d0
|
threshold_selectors = 1.d0
|
||||||
threshold_generators = 1d0 ! 0.9999d0
|
threshold_generators = 1d0 ! 0.9999d0
|
||||||
E_CI_before(1:N_states) = CI_energy(1:N_states)
|
E_CI_before(1:N_states) = CI_energy(1:N_states)
|
||||||
!call ZMQ_selection(0, pt2) pour non-stochastic
|
!call ZMQ_selection(0, pt2)! pour non-stochastic
|
||||||
call ZMQ_pt2(pt2)
|
call ZMQ_pt2(pt2)
|
||||||
print *, 'Final step'
|
print *, 'Final step'
|
||||||
print *, 'N_det = ', N_det
|
print *, 'N_det = ', N_det
|
||||||
@ -121,7 +121,7 @@ subroutine ZMQ_pt2(pt2)
|
|||||||
double precision, allocatable :: pt2_detail(:,:), comb(:)
|
double precision, allocatable :: pt2_detail(:,:), comb(:)
|
||||||
logical, allocatable :: computed(:)
|
logical, allocatable :: computed(:)
|
||||||
integer, allocatable :: tbc(:)
|
integer, allocatable :: tbc(:)
|
||||||
integer :: i, Ncomb, generator_per_task, i_generator_end
|
integer :: i, j, Ncomb, generator_per_task, i_generator_end
|
||||||
integer, external :: pt2_find
|
integer, external :: pt2_find
|
||||||
|
|
||||||
double precision :: sumabove(comb_teeth), sum2above(comb_teeth), Nabove(comb_teeth)
|
double precision :: sumabove(comb_teeth), sum2above(comb_teeth), Nabove(comb_teeth)
|
||||||
@ -131,7 +131,7 @@ subroutine ZMQ_pt2(pt2)
|
|||||||
allocate(pt2_detail(N_states, N_det_generators), comb(100000), computed(N_det_generators), tbc(0:N_det_generators))
|
allocate(pt2_detail(N_states, N_det_generators), comb(100000), computed(N_det_generators), tbc(0:N_det_generators))
|
||||||
provide nproc
|
provide nproc
|
||||||
|
|
||||||
call random_seed()
|
!call random_seed()
|
||||||
|
|
||||||
computed = .false.
|
computed = .false.
|
||||||
tbc(0) = first_det_of_comb - 1
|
tbc(0) = first_det_of_comb - 1
|
||||||
@ -163,9 +163,19 @@ subroutine ZMQ_pt2(pt2)
|
|||||||
do i=tbc(0),1,-1 ! generator_per_task
|
do i=tbc(0),1,-1 ! generator_per_task
|
||||||
i_generator_end = min(i+generator_per_task-1, tbc(0))
|
i_generator_end = min(i+generator_per_task-1, tbc(0))
|
||||||
!print *, "TASK", (i_generator_end-i+1), tbc(i:i_generator_end)
|
!print *, "TASK", (i_generator_end-i+1), tbc(i:i_generator_end)
|
||||||
write(task,*) (i_generator_end-i+1), tbc(i:i_generator_end)
|
if(i > 10) then
|
||||||
call add_task_to_taskserver(zmq_to_qp_run_socket,task)
|
integer :: zero
|
||||||
|
zero = 0
|
||||||
|
write(task,*) (i_generator_end-i+1), zero, tbc(i:i_generator_end)
|
||||||
|
call add_task_to_taskserver(zmq_to_qp_run_socket,task)
|
||||||
|
else
|
||||||
|
do j=1,8
|
||||||
|
write(task,*) (i_generator_end-i+1), j, tbc(i:i_generator_end)
|
||||||
|
call add_task_to_taskserver(zmq_to_qp_run_socket,task)
|
||||||
|
end do
|
||||||
|
end if
|
||||||
end do
|
end do
|
||||||
|
|
||||||
print *, "tasked"
|
print *, "tasked"
|
||||||
!$OMP PARALLEL DEFAULT(shared) SHARED(b, pt2) PRIVATE(i) NUM_THREADS(nproc+1)
|
!$OMP PARALLEL DEFAULT(shared) SHARED(b, pt2) PRIVATE(i) NUM_THREADS(nproc+1)
|
||||||
i = omp_get_thread_num()
|
i = omp_get_thread_num()
|
||||||
@ -180,7 +190,6 @@ subroutine ZMQ_pt2(pt2)
|
|||||||
call do_carlo(tbc, Ncomb, comb, pt2_detail, sumabove, sum2above, Nabove)
|
call do_carlo(tbc, Ncomb, comb, pt2_detail, sumabove, sum2above, Nabove)
|
||||||
!END LOOP?
|
!END LOOP?
|
||||||
integer :: tooth
|
integer :: tooth
|
||||||
!-8.091550677158776E-003
|
|
||||||
call get_first_tooth(computed, tooth)
|
call get_first_tooth(computed, tooth)
|
||||||
!print *, "TOOTH ", tooth
|
!print *, "TOOTH ", tooth
|
||||||
|
|
||||||
@ -199,9 +208,7 @@ subroutine ZMQ_pt2(pt2)
|
|||||||
if(Nabove(tooth) >= 30) then
|
if(Nabove(tooth) >= 30) then
|
||||||
E0 = sum(pt2_detail(1,:first_det_of_teeth(tooth)-1))
|
E0 = sum(pt2_detail(1,:first_det_of_teeth(tooth)-1))
|
||||||
prop = ((1d0 - dfloat(comb_teeth - tooth + 1) * comb_step) - cweight(first_det_of_teeth(tooth)-1))
|
prop = ((1d0 - dfloat(comb_teeth - tooth + 1) * comb_step) - cweight(first_det_of_teeth(tooth)-1))
|
||||||
!print *, "preprop ", prop, weight(first_det_of_teeth(tooth))
|
|
||||||
prop = prop / weight(first_det_of_teeth(tooth))
|
prop = prop / weight(first_det_of_teeth(tooth))
|
||||||
!print *, "prop", prop
|
|
||||||
E0 += pt2_detail(1,first_det_of_teeth(tooth)) * prop
|
E0 += pt2_detail(1,first_det_of_teeth(tooth)) * prop
|
||||||
avg = E0 + (sumabove(tooth) / Nabove(tooth))
|
avg = E0 + (sumabove(tooth) / Nabove(tooth))
|
||||||
eqt = sqrt(1d0 / (Nabove(tooth)-1) * abs(sum2above(tooth) / Nabove(tooth) - (sumabove(tooth)/Nabove(tooth))**2))
|
eqt = sqrt(1d0 / (Nabove(tooth)-1) * abs(sum2above(tooth) / Nabove(tooth) - (sumabove(tooth)/Nabove(tooth))**2))
|
||||||
@ -230,7 +237,6 @@ subroutine do_carlo(tbc, Ncomb, comb, pt2_detail, sumabove, sum2above, Nabove)
|
|||||||
myVal = 0d0
|
myVal = 0d0
|
||||||
myVal2 = 0d0
|
myVal2 = 0d0
|
||||||
do j=comb_teeth,1,-1
|
do j=comb_teeth,1,-1
|
||||||
!if(pt2_detail(1, dets(j)) == -1d0) print *, "uncalculatedidified", dets(j), pt2_detail(1, dets(j)-1:dets(j)+1)
|
|
||||||
myVal += pt2_detail(1, dets(j)) / weight(dets(j)) * comb_step
|
myVal += pt2_detail(1, dets(j)) / weight(dets(j)) * comb_step
|
||||||
sumabove(j) += myVal
|
sumabove(j) += myVal
|
||||||
sum2above(j) += myVal**2
|
sum2above(j) += myVal**2
|
||||||
@ -487,7 +493,7 @@ subroutine get_carlo_workbatch(maxWorkload, computed, comb, Ncomb, tbc)
|
|||||||
comb(i) = comb(i) * comb_step
|
comb(i) = comb(i) * comb_step
|
||||||
call add_comb(comb(i), computed, tbc, myWorkload)
|
call add_comb(comb(i), computed, tbc, myWorkload)
|
||||||
Ncomb = i
|
Ncomb = i
|
||||||
if(myWorkload > maxWorkload .and. i >= 30) exit
|
if(myWorkload > maxWorkload .and. i >= 50) exit
|
||||||
end do
|
end do
|
||||||
call reorder_tbc(tbc)
|
call reorder_tbc(tbc)
|
||||||
end subroutine
|
end subroutine
|
||||||
|
@ -53,7 +53,7 @@ subroutine run_selection_slave(thread,iproc,energy)
|
|||||||
!print *, "psi_selectors_coef ", psi_selectors_coef(N_det_selectors-5:N_det_selectors, 1)
|
!print *, "psi_selectors_coef ", psi_selectors_coef(N_det_selectors-5:N_det_selectors, 1)
|
||||||
!call debug_det(psi_selectors(1,1,N_det_selectors), N_int)
|
!call debug_det(psi_selectors(1,1,N_det_selectors), N_int)
|
||||||
do i_generator=i_generator_start,i_generator_max,step
|
do i_generator=i_generator_start,i_generator_max,step
|
||||||
call select_connected(i_generator,energy,pt2,buf)
|
call select_connected(i_generator,energy,pt2,buf,0)
|
||||||
enddo
|
enddo
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -55,11 +55,11 @@ subroutine get_mask_phase(det, phasemask)
|
|||||||
end subroutine
|
end subroutine
|
||||||
|
|
||||||
|
|
||||||
subroutine select_connected(i_generator,E0,pt2,b)
|
subroutine select_connected(i_generator,E0,pt2,b,subset)
|
||||||
use bitmasks
|
use bitmasks
|
||||||
use selection_types
|
use selection_types
|
||||||
implicit none
|
implicit none
|
||||||
integer, intent(in) :: i_generator
|
integer, intent(in) :: i_generator, subset
|
||||||
type(selection_buffer), intent(inout) :: b
|
type(selection_buffer), intent(inout) :: b
|
||||||
double precision, intent(inout) :: pt2(N_states)
|
double precision, intent(inout) :: pt2(N_states)
|
||||||
integer :: k,l
|
integer :: k,l
|
||||||
@ -78,7 +78,7 @@ subroutine select_connected(i_generator,E0,pt2,b)
|
|||||||
particle_mask(k,2) = iand(generators_bitmask(k,2,s_part,l), not(psi_det_generators(k,2,i_generator)) )
|
particle_mask(k,2) = iand(generators_bitmask(k,2,s_part,l), not(psi_det_generators(k,2,i_generator)) )
|
||||||
|
|
||||||
enddo
|
enddo
|
||||||
call select_doubles(i_generator,hole_mask,particle_mask,fock_diag_tmp,E0,pt2,b)
|
call select_doubles(i_generator,hole_mask,particle_mask,fock_diag_tmp,E0,pt2,b,subset)
|
||||||
enddo
|
enddo
|
||||||
end subroutine
|
end subroutine
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
|
|
||||||
subroutine select_doubles(i_generator,hole_mask,particle_mask,fock_diag_tmp,E0,pt2,buf)
|
subroutine select_doubles(i_generator,hole_mask,particle_mask,fock_diag_tmp,E0,pt2,buf,subset)
|
||||||
use bitmasks
|
use bitmasks
|
||||||
use selection_types
|
use selection_types
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
integer, intent(in) :: i_generator
|
integer, intent(in) :: i_generator, subset
|
||||||
integer(bit_kind), intent(in) :: hole_mask(N_int,2), particle_mask(N_int,2)
|
integer(bit_kind), intent(in) :: hole_mask(N_int,2), particle_mask(N_int,2)
|
||||||
double precision, intent(in) :: fock_diag_tmp(mo_tot_num)
|
double precision, intent(in) :: fock_diag_tmp(mo_tot_num)
|
||||||
double precision, intent(in) :: E0(N_states)
|
double precision, intent(in) :: E0(N_states)
|
||||||
@ -21,7 +21,9 @@ subroutine select_doubles(i_generator,hole_mask,particle_mask,fock_diag_tmp,E0,p
|
|||||||
integer(bit_kind), allocatable :: minilist(:, :, :), fullminilist(:, :, :)
|
integer(bit_kind), allocatable :: minilist(:, :, :), fullminilist(:, :, :)
|
||||||
|
|
||||||
logical :: monoAdo, monoBdo;
|
logical :: monoAdo, monoBdo;
|
||||||
|
integer :: maskInd
|
||||||
|
maskInd = -1
|
||||||
|
|
||||||
monoAdo = .true.
|
monoAdo = .true.
|
||||||
monoBdo = .true.
|
monoBdo = .true.
|
||||||
|
|
||||||
@ -73,6 +75,19 @@ subroutine select_doubles(i_generator,hole_mask,particle_mask,fock_diag_tmp,E0,p
|
|||||||
|
|
||||||
do s1=1,2
|
do s1=1,2
|
||||||
do i1=N_holes(s1),1,-1 ! Generate low excitations first
|
do i1=N_holes(s1),1,-1 ! Generate low excitations first
|
||||||
|
!if(subset /= 0 .and. mod(maskInd, 10) /= (subset-1)) then
|
||||||
|
! maskInd += 1
|
||||||
|
! cycle
|
||||||
|
!end if
|
||||||
|
maskInd += 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(subset == 0 .or. mod(maskInd, 8) == (subset-1)) then
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
h1 = hole_list(i1,s1)
|
h1 = hole_list(i1,s1)
|
||||||
call apply_hole(psi_det_generators(1,1,i_generator), s1,h1, pmask, ok, N_int)
|
call apply_hole(psi_det_generators(1,1,i_generator), s1,h1, pmask, ok, N_int)
|
||||||
|
|
||||||
@ -121,8 +136,14 @@ subroutine select_doubles(i_generator,hole_mask,particle_mask,fock_diag_tmp,E0,p
|
|||||||
end if
|
end if
|
||||||
end do
|
end do
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
end if
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
do s2=s1,2
|
do s2=s1,2
|
||||||
sp = s1
|
sp = s1
|
||||||
|
|
||||||
@ -132,41 +153,39 @@ subroutine select_doubles(i_generator,hole_mask,particle_mask,fock_diag_tmp,E0,p
|
|||||||
if(s1 == s2) ib = i1+1
|
if(s1 == s2) ib = i1+1
|
||||||
monoAdo = .true.
|
monoAdo = .true.
|
||||||
do i2=N_holes(s2),ib,-1 ! Generate low excitations first
|
do i2=N_holes(s2),ib,-1 ! Generate low excitations first
|
||||||
|
|
||||||
h2 = hole_list(i2,s2)
|
|
||||||
call apply_hole(pmask, s2,h2, mask, ok, N_int)
|
|
||||||
|
|
||||||
logical :: banned(mo_tot_num, mo_tot_num,2)
|
logical :: banned(mo_tot_num, mo_tot_num,2)
|
||||||
logical :: bannedOrb(mo_tot_num, 2)
|
logical :: bannedOrb(mo_tot_num, 2)
|
||||||
|
|
||||||
banned = .false.
|
if(subset == 0 .or. mod(maskInd, 8) == (subset-1)) then
|
||||||
|
h2 = hole_list(i2,s2)
|
||||||
call spot_isinwf(mask, fullminilist, i_generator, fullinteresting(0), banned, fullMatch, fullinteresting)
|
call apply_hole(pmask, s2,h2, mask, ok, N_int)
|
||||||
|
banned = .false.
|
||||||
if(fullMatch) cycle
|
bannedOrb(1:mo_tot_num, 1:2) = .true.
|
||||||
|
do s3=1,2
|
||||||
bannedOrb(1:mo_tot_num, 1:2) = .true.
|
do i=1,N_particles(s3)
|
||||||
do s3=1,2
|
bannedOrb(particle_list(i,s3), s3) = .false.
|
||||||
do i=1,N_particles(s3)
|
enddo
|
||||||
bannedOrb(particle_list(i,s3), s3) = .false.
|
|
||||||
enddo
|
enddo
|
||||||
enddo
|
|
||||||
|
|
||||||
if(s1 /= s2) then
|
if(s1 /= s2) then
|
||||||
if(monoBdo) then
|
if(monoBdo) then
|
||||||
bannedOrb(h1,s1) = .false.
|
bannedOrb(h1,s1) = .false.
|
||||||
end if
|
end if
|
||||||
if(monoAdo) then
|
if(monoAdo) then
|
||||||
bannedOrb(h2,s2) = .false.
|
bannedOrb(h2,s2) = .false.
|
||||||
monoAdo = .false.
|
monoAdo = .false.
|
||||||
|
end if
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
|
||||||
|
call spot_isinwf(mask, fullminilist, i_generator, fullinteresting(0), banned, fullMatch, fullinteresting)
|
||||||
|
if(fullMatch) cycle
|
||||||
|
|
||||||
|
mat = 0d0
|
||||||
|
call splash_pq(mask, sp, minilist, i_generator, interesting(0), bannedOrb, banned, mat, interesting)
|
||||||
|
|
||||||
|
call fill_buffer_double(i_generator, sp, h1, h2, bannedOrb, banned, fock_diag_tmp, E0, pt2, mat, buf)
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
|
||||||
mat = 0d0
|
|
||||||
call splash_pq(mask, sp, minilist, i_generator, interesting(0), bannedOrb, banned, mat, interesting)
|
|
||||||
call fill_buffer_double(i_generator, sp, h1, h2, bannedOrb, banned, fock_diag_tmp, E0, pt2, mat, buf)
|
|
||||||
|
|
||||||
enddo
|
enddo
|
||||||
if(s1 /= s2) monoBdo = .false.
|
if(s1 /= s2) monoBdo = .false.
|
||||||
enddo
|
enddo
|
||||||
|
Loading…
Reference in New Issue
Block a user