mirror of
https://github.com/LCPQ/quantum_package
synced 2024-08-26 06:21:45 +02:00
Merge branch 'alpha_factory' of https://github.com/garniron/quantum_package into garniron-alpha_factory
Conflicts: plugins/dress_zmq/alpha_factory.irp.f plugins/dress_zmq/dress_stoch_routines.irp.f plugins/mrcepa0/mrcc_stoch_routines.irp.f
This commit is contained in:
commit
9fd2a7ef39
@ -1,4 +1,4 @@
|
|||||||
subroutine dress_with_alpha_buffer(Nstates,Ndet,Nint,delta_ij_loc, minilist, det_minilist, n_minilist, alpha, iproc)
|
subroutine dress_with_alpha_buffer(Nstates,Ndet,Nint,delta_ij_loc, i_gen, minilist, det_minilist, n_minilist, alpha, iproc)
|
||||||
use bitmasks
|
use bitmasks
|
||||||
implicit none
|
implicit none
|
||||||
BEGIN_DOC
|
BEGIN_DOC
|
||||||
@ -8,7 +8,7 @@ subroutine dress_with_alpha_buffer(Nstates,Ndet,Nint,delta_ij_loc, minilist, det
|
|||||||
!n_minilist : size of minilist
|
!n_minilist : size of minilist
|
||||||
!alpha : alpha determinant
|
!alpha : alpha determinant
|
||||||
END_DOC
|
END_DOC
|
||||||
integer, intent(in) :: Nint, Ndet, Nstates, n_minilist, iproc
|
integer, intent(in) :: Nint, Ndet, Nstates, n_minilist, iproc, i_gen
|
||||||
integer(bit_kind), intent(in) :: alpha(Nint,2), det_minilist(Nint, 2, n_minilist)
|
integer(bit_kind), intent(in) :: alpha(Nint,2), det_minilist(Nint, 2, n_minilist)
|
||||||
integer,intent(in) :: minilist(n_minilist)
|
integer,intent(in) :: minilist(n_minilist)
|
||||||
double precision, intent(inout) :: delta_ij_loc(Nstates,Ndet,2)
|
double precision, intent(inout) :: delta_ij_loc(Nstates,Ndet,2)
|
||||||
|
@ -773,6 +773,7 @@ subroutine get_d2(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs)
|
|||||||
|
|
||||||
if(tip == 3) then
|
if(tip == 3) then
|
||||||
puti = p(1, mi)
|
puti = p(1, mi)
|
||||||
|
if(bannedOrb(puti, mi)) return
|
||||||
do i = 1, 3
|
do i = 1, 3
|
||||||
putj = p(i, ma)
|
putj = p(i, ma)
|
||||||
if(banned(putj,puti,bant)) cycle
|
if(banned(putj,puti,bant)) cycle
|
||||||
@ -795,11 +796,12 @@ subroutine get_d2(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs)
|
|||||||
h2 = h(1,2)
|
h2 = h(1,2)
|
||||||
do j = 1,2
|
do j = 1,2
|
||||||
putj = p(j, 2)
|
putj = p(j, 2)
|
||||||
|
if(bannedOrb(putj, 2)) cycle
|
||||||
p2 = p(turn2(j), 2)
|
p2 = p(turn2(j), 2)
|
||||||
do i = 1,2
|
do i = 1,2
|
||||||
puti = p(i, 1)
|
puti = p(i, 1)
|
||||||
|
|
||||||
if(banned(puti,putj,bant)) cycle
|
if(banned(puti,putj,bant) .or. bannedOrb(puti,1)) cycle
|
||||||
p1 = p(turn2(i), 1)
|
p1 = p(turn2(i), 1)
|
||||||
|
|
||||||
hij = mo_bielec_integral(p1, p2, h1, h2) * get_phase_bi(phasemask, 1, 2, h1, p1, h2, p2)
|
hij = mo_bielec_integral(p1, p2, h1, h2) * get_phase_bi(phasemask, 1, 2, h1, p1, h2, p2)
|
||||||
@ -814,8 +816,10 @@ subroutine get_d2(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs)
|
|||||||
h2 = h(2, ma)
|
h2 = h(2, ma)
|
||||||
do i=1,3
|
do i=1,3
|
||||||
puti = p(i, ma)
|
puti = p(i, ma)
|
||||||
|
if(bannedOrb(puti,ma)) cycle
|
||||||
do j=i+1,4
|
do j=i+1,4
|
||||||
putj = p(j, ma)
|
putj = p(j, ma)
|
||||||
|
if(bannedOrb(putj,ma)) cycle
|
||||||
if(banned(puti,putj,1)) cycle
|
if(banned(puti,putj,1)) cycle
|
||||||
|
|
||||||
i1 = turn2d(1, i, j)
|
i1 = turn2d(1, i, j)
|
||||||
@ -832,7 +836,9 @@ subroutine get_d2(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs)
|
|||||||
p1 = p(1, mi)
|
p1 = p(1, mi)
|
||||||
do i=1,3
|
do i=1,3
|
||||||
puti = p(turn3(1,i), ma)
|
puti = p(turn3(1,i), ma)
|
||||||
|
if(bannedOrb(puti,ma)) cycle
|
||||||
putj = p(turn3(2,i), ma)
|
putj = p(turn3(2,i), ma)
|
||||||
|
if(bannedOrb(putj,ma)) cycle
|
||||||
if(banned(puti,putj,1)) cycle
|
if(banned(puti,putj,1)) cycle
|
||||||
p2 = p(i, ma)
|
p2 = p(i, ma)
|
||||||
|
|
||||||
|
@ -364,18 +364,8 @@ subroutine generate_singles_and_doubles(delta_ij_loc, i_generator, bitmask_index
|
|||||||
|
|
||||||
|
|
||||||
if(siz > size(abuf)) stop "buffer too small in alpha_factory"
|
if(siz > size(abuf)) stop "buffer too small in alpha_factory"
|
||||||
!abuf = 0
|
|
||||||
call splash_pq(mask, sp, minilist, i_generator, interesting(0), bannedOrb, banned, indexes_end, abuf, interesting)
|
call splash_pq(mask, sp, minilist, i_generator, interesting(0), bannedOrb, banned, indexes_end, abuf, interesting)
|
||||||
!indexes_end(:,:) -= 1
|
call alpha_callback_mask(delta_ij_loc, i_generator, sp, mask, bannedOrb, banned, indexes, indexes_end, abuf, siz, iproc)
|
||||||
!do i=1,siz
|
|
||||||
! if(abuf(i) < 1 .or. abuf(i) > N_det) stop "foireous abuf"
|
|
||||||
!end do
|
|
||||||
!print *, "IND1", indexes(1,:)
|
|
||||||
!print *, "IND2", indexes_end(1,:)
|
|
||||||
!stop
|
|
||||||
call alpha_callback_mask(delta_ij_loc, sp, mask, bannedOrb, banned, indexes, indexes_end, abuf, siz, iproc)
|
|
||||||
|
|
||||||
!call dress_with_alpha_buffer(delta_ij_loc, minilist, interesting(0), abuf, n)
|
|
||||||
|
|
||||||
end if
|
end if
|
||||||
enddo
|
enddo
|
||||||
@ -386,12 +376,12 @@ subroutine generate_singles_and_doubles(delta_ij_loc, i_generator, bitmask_index
|
|||||||
end subroutine
|
end subroutine
|
||||||
|
|
||||||
|
|
||||||
subroutine alpha_callback_mask(delta_ij_loc, sp, mask, bannedOrb, banned, indexes, indexes_end, rabuf, siz, iproc)
|
subroutine alpha_callback_mask(delta_ij_loc, i_gen, sp, mask, bannedOrb, banned, indexes, indexes_end, rabuf, siz, iproc)
|
||||||
use bitmasks
|
use bitmasks
|
||||||
implicit none
|
implicit none
|
||||||
|
|
||||||
double precision,intent(inout) :: delta_ij_loc(N_states,N_det,2)
|
double precision,intent(inout) :: delta_ij_loc(N_states,N_det,2)
|
||||||
integer, intent(in) :: sp, indexes(0:mo_tot_num, 0:mo_tot_num), siz, iproc
|
integer, intent(in) :: sp, indexes(0:mo_tot_num, 0:mo_tot_num), siz, iproc, i_gen
|
||||||
integer, intent(in) :: indexes_end(0:mo_tot_num, 0:mo_tot_num), rabuf(*)
|
integer, intent(in) :: indexes_end(0:mo_tot_num, 0:mo_tot_num), rabuf(*)
|
||||||
logical, intent(in) :: bannedOrb(mo_tot_num,2), banned(mo_tot_num, mo_tot_num)
|
logical, intent(in) :: bannedOrb(mo_tot_num,2), banned(mo_tot_num, mo_tot_num)
|
||||||
integer(bit_kind), intent(in) :: mask(N_int, 2)
|
integer(bit_kind), intent(in) :: mask(N_int, 2)
|
||||||
@ -487,7 +477,7 @@ subroutine alpha_callback_mask(delta_ij_loc, sp, mask, bannedOrb, banned, indexe
|
|||||||
!APPLY PART
|
!APPLY PART
|
||||||
if(st4 > 1) then
|
if(st4 > 1) then
|
||||||
call apply_particles(mask, s1, i, s2, j, alpha, ok, N_int)
|
call apply_particles(mask, s1, i, s2, j, alpha, ok, N_int)
|
||||||
call dress_with_alpha_buffer(N_states, N_det, N_int, delta_ij_loc, labuf, det_minilist, st4-1, alpha, iproc)
|
call dress_with_alpha_buffer(N_states, N_det, N_int, delta_ij_loc, i_gen, labuf, det_minilist, st4-1, alpha, iproc)
|
||||||
end if
|
end if
|
||||||
end do
|
end do
|
||||||
|
|
||||||
|
@ -250,21 +250,22 @@ subroutine dress_collector(zmq_socket_pull, E, relative_error, delta, delta_s2,
|
|||||||
|
|
||||||
time = omp_get_wtime()
|
time = omp_get_wtime()
|
||||||
|
|
||||||
|
if((time - timeLast > 2d0) .or. (.not. loop)) then
|
||||||
if(time - timeLast > 1d0 .or. (.not. loop)) then
|
|
||||||
timeLast = time
|
timeLast = time
|
||||||
cur_cp = N_cp
|
cur_cp = N_cp
|
||||||
if(.not. actually_computed(dress_jobs(1))) cycle pullLoop
|
|
||||||
|
|
||||||
do i=2,N_det_generators
|
do i=1,N_det_generators
|
||||||
if(.not. actually_computed(dress_jobs(i))) then
|
if(.not. actually_computed(dress_jobs(i))) then
|
||||||
|
if(i /= 1) then
|
||||||
cur_cp = done_cp_at(i-1)
|
cur_cp = done_cp_at(i-1)
|
||||||
|
else
|
||||||
|
cur_cp = 0
|
||||||
|
end if
|
||||||
exit
|
exit
|
||||||
end if
|
end if
|
||||||
end do
|
end do
|
||||||
if(cur_cp == 0) cycle pullLoop
|
if(cur_cp == 0) cycle pullLoop
|
||||||
|
|
||||||
|
|
||||||
double precision :: su, su2, eqt, avg, E0, val
|
double precision :: su, su2, eqt, avg, E0, val
|
||||||
integer, external :: zmq_abort
|
integer, external :: zmq_abort
|
||||||
|
|
||||||
@ -282,6 +283,8 @@ subroutine dress_collector(zmq_socket_pull, E, relative_error, delta, delta_s2,
|
|||||||
if(cp_first_tooth(cur_cp) <= comb_teeth) then
|
if(cp_first_tooth(cur_cp) <= comb_teeth) then
|
||||||
E0 = E0 + dress_detail(istate, first_det_of_teeth(cp_first_tooth(cur_cp))) * (1d0-fractage(cp_first_tooth(cur_cp)))
|
E0 = E0 + dress_detail(istate, first_det_of_teeth(cp_first_tooth(cur_cp))) * (1d0-fractage(cp_first_tooth(cur_cp)))
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
|
||||||
call wall_time(time)
|
call wall_time(time)
|
||||||
if ((dabs(eqt) < relative_error .and. cps_N(cur_cp) >= 5) .or. total_computed == N_det_generators) then
|
if ((dabs(eqt) < relative_error .and. cps_N(cur_cp) >= 5) .or. total_computed == N_det_generators) then
|
||||||
! Termination
|
! Termination
|
||||||
|
@ -22,7 +22,7 @@ END_PROVIDER
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
subroutine dress_with_alpha_buffer(delta_ij_loc, minilist, det_minilist, n_minilist, alpha, iproc)
|
subroutine dress_with_alpha_buffer(delta_ij_loc, i_gen, minilist, det_minilist, n_minilist, alpha, iproc)
|
||||||
use bitmasks
|
use bitmasks
|
||||||
implicit none
|
implicit none
|
||||||
BEGIN_DOC
|
BEGIN_DOC
|
||||||
@ -33,7 +33,7 @@ subroutine dress_with_alpha_buffer(delta_ij_loc, minilist, det_minilist, n_minil
|
|||||||
!alpha : alpha determinant
|
!alpha : alpha determinant
|
||||||
END_DOC
|
END_DOC
|
||||||
integer(bit_kind), intent(in) :: alpha(N_int,2), det_minilist(N_int, 2, n_minilist)
|
integer(bit_kind), intent(in) :: alpha(N_int,2), det_minilist(N_int, 2, n_minilist)
|
||||||
integer,intent(in) :: minilist(n_minilist), n_minilist, iproc
|
integer,intent(in) :: minilist(n_minilist), n_minilist, iproc, i_gen
|
||||||
double precision, intent(inout) :: delta_ij_loc(N_states,N_det,2)
|
double precision, intent(inout) :: delta_ij_loc(N_states,N_det,2)
|
||||||
|
|
||||||
|
|
||||||
@ -62,6 +62,7 @@ subroutine dress_with_alpha_buffer(delta_ij_loc, minilist, det_minilist, n_minil
|
|||||||
if (perturbative_triples) then
|
if (perturbative_triples) then
|
||||||
PROVIDE one_anhil fock_virt_total fock_core_inactive_total one_creat
|
PROVIDE one_anhil fock_virt_total fock_core_inactive_total one_creat
|
||||||
endif
|
endif
|
||||||
|
|
||||||
canbediamond = 0
|
canbediamond = 0
|
||||||
do l_sd=1,n_minilist
|
do l_sd=1,n_minilist
|
||||||
call get_excitation(det_minilist(1,1,l_sd),alpha,exc,degree1,phase,N_int)
|
call get_excitation(det_minilist(1,1,l_sd),alpha,exc,degree1,phase,N_int)
|
||||||
@ -190,9 +191,9 @@ subroutine dress_with_alpha_buffer(delta_ij_loc, minilist, det_minilist, n_minil
|
|||||||
do i_state=1,N_states
|
do i_state=1,N_states
|
||||||
hdress = dIa(i_state) * hla * psi_ref_coef(i_I,i_state)
|
hdress = dIa(i_state) * hla * psi_ref_coef(i_I,i_state)
|
||||||
sdress = dIa(i_state) * sla * psi_ref_coef(i_I,i_state)
|
sdress = dIa(i_state) * sla * psi_ref_coef(i_I,i_state)
|
||||||
!$OMP ATOMIC
|
!!!$OMP ATOMIC
|
||||||
delta_ij_loc(i_state,k_sd,1) += hdress
|
delta_ij_loc(i_state,k_sd,1) += hdress
|
||||||
!$OMP ATOMIC
|
!!!$OMP ATOMIC
|
||||||
delta_ij_loc(i_state,k_sd,2) += sdress
|
delta_ij_loc(i_state,k_sd,2) += sdress
|
||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
|
@ -332,7 +332,10 @@ subroutine mrcc_collector(zmq_socket_pull, E, relative_error, delta, delta_s2, m
|
|||||||
E0 = E0 + mrcc_detail(1, first_det_of_teeth(cp_first_tooth(cur_cp))) * (1d0-fractage(cp_first_tooth(cur_cp)))
|
E0 = E0 + mrcc_detail(1, first_det_of_teeth(cp_first_tooth(cur_cp))) * (1d0-fractage(cp_first_tooth(cur_cp)))
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
if(cur_cp /= old_cur_cp) then
|
||||||
|
old_cur_cp = cur_cp
|
||||||
print '(I5,F15.7,E12.4,F10.2)', cur_cp, E(mrcc_stoch_istate)+E0+avg, eqt, time-timeInit
|
print '(I5,F15.7,E12.4,F10.2)', cur_cp, E(mrcc_stoch_istate)+E0+avg, eqt, time-timeInit
|
||||||
|
end if
|
||||||
|
|
||||||
if ((dabs(eqt) < relative_error .and. cps_N(cur_cp) >= 30) .or. total_computed == N_det_generators) then
|
if ((dabs(eqt) < relative_error .and. cps_N(cur_cp) >= 30) .or. total_computed == N_det_generators) then
|
||||||
if (zmq_abort(zmq_to_qp_run_socket) == -1) then
|
if (zmq_abort(zmq_to_qp_run_socket) == -1) then
|
||||||
|
1
plugins/shiftedbk/NEEDED_CHILDREN_MODULES
Normal file
1
plugins/shiftedbk/NEEDED_CHILDREN_MODULES
Normal file
@ -0,0 +1 @@
|
|||||||
|
dress_zmq
|
12
plugins/shiftedbk/README.rst
Normal file
12
plugins/shiftedbk/README.rst
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
=========
|
||||||
|
shiftedbk
|
||||||
|
=========
|
||||||
|
|
||||||
|
Needed Modules
|
||||||
|
==============
|
||||||
|
.. Do not edit this section It was auto-generated
|
||||||
|
.. by the `update_README.py` script.
|
||||||
|
Documentation
|
||||||
|
=============
|
||||||
|
.. Do not edit this section It was auto-generated
|
||||||
|
.. by the `update_README.py` script.
|
90
plugins/shiftedbk/shifted_bk.irp.f
Normal file
90
plugins/shiftedbk/shifted_bk.irp.f
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
|
||||||
|
program mrcc_sto
|
||||||
|
implicit none
|
||||||
|
BEGIN_DOC
|
||||||
|
! TODO
|
||||||
|
END_DOC
|
||||||
|
call dress_zmq()
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_PROVIDER [ double precision, fock_diag_tmp_, (2,mo_tot_num+1,Nproc) ]
|
||||||
|
&BEGIN_PROVIDER [ integer, current_generator_, (Nproc) ]
|
||||||
|
implicit none
|
||||||
|
current_generator_(:) = 0
|
||||||
|
END_PROVIDER
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
subroutine dress_with_alpha_buffer(delta_ij_loc, i_gen, minilist, det_minilist, n_minilist, alpha, iproc)
|
||||||
|
use bitmasks
|
||||||
|
implicit none
|
||||||
|
BEGIN_DOC
|
||||||
|
!delta_ij_loc(:,:,1) : dressing column for H
|
||||||
|
!delta_ij_loc(:,:,2) : dressing column for S2
|
||||||
|
!i_gen : generator index in psi_det_generators
|
||||||
|
!minilist : indices of determinants connected to alpha ( in psi_det_sorted )
|
||||||
|
!n_minilist : size of minilist
|
||||||
|
!alpha : alpha determinant
|
||||||
|
END_DOC
|
||||||
|
integer(bit_kind), intent(in) :: alpha(N_int,2), det_minilist(N_int, 2, n_minilist)
|
||||||
|
integer,intent(in) :: minilist(n_minilist), n_minilist, iproc, i_gen
|
||||||
|
double precision, intent(inout) :: delta_ij_loc(N_states,N_det,2)
|
||||||
|
double precision :: hii, hij, sij, delta_e
|
||||||
|
double precision, external :: diag_H_mat_elem_fock
|
||||||
|
integer :: i,j,k,l,m, l_sd
|
||||||
|
double precision, save :: tot = 0d0
|
||||||
|
double precision :: de(N_states), val, tmp
|
||||||
|
|
||||||
|
stop "shiftedbk currently does not work"
|
||||||
|
|
||||||
|
if(current_generator_(iproc) /= i_gen) then
|
||||||
|
current_generator_(iproc) = i_gen
|
||||||
|
call build_fock_tmp(fock_diag_tmp_(1,1,iproc),psi_det_generators(1,1,i_gen),N_int)
|
||||||
|
end if
|
||||||
|
|
||||||
|
hii = diag_H_mat_elem_fock(psi_det_generators(1,1,i_gen),alpha,fock_diag_tmp_(1,1,iproc),N_int)
|
||||||
|
do i=1,N_states
|
||||||
|
de(i) = (E0_denominator(i) - hii)
|
||||||
|
end do
|
||||||
|
|
||||||
|
do i=1,N_states
|
||||||
|
val = 0D0
|
||||||
|
do l_sd=1,n_minilist
|
||||||
|
call i_h_j_s2(alpha,det_minilist(1,1,l_sd),N_int,hij, sij)
|
||||||
|
val += hij
|
||||||
|
end do
|
||||||
|
val = 2d0 * val
|
||||||
|
tmp = dsqrt(de(i)**2 + val**2)
|
||||||
|
if(de(i) < 0d0) tmp = -tmp
|
||||||
|
delta_ij_loc(i, minilist(l_sd), 1) += 0.5d0 * (tmp - de(i)) ! * psi_coef(minilist(l_sd), i)
|
||||||
|
end do
|
||||||
|
end subroutine
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BEGIN_PROVIDER [ logical, initialize_E0_denominator ]
|
||||||
|
implicit none
|
||||||
|
BEGIN_DOC
|
||||||
|
! If true, initialize pt2_E0_denominator
|
||||||
|
END_DOC
|
||||||
|
initialize_E0_denominator = .True.
|
||||||
|
END_PROVIDER
|
||||||
|
|
||||||
|
BEGIN_PROVIDER [ double precision, E0_denominator, (N_states) ]
|
||||||
|
implicit none
|
||||||
|
BEGIN_DOC
|
||||||
|
! E0 in the denominator of the PT2
|
||||||
|
END_DOC
|
||||||
|
if (initialize_E0_denominator) then
|
||||||
|
E0_denominator(1:N_states) = psi_energy(1:N_states)
|
||||||
|
! call ezfio_get_full_ci_zmq_energy(pt2_E0_denominator(1))
|
||||||
|
! pt2_E0_denominator(1) -= nuclear_repulsion
|
||||||
|
! pt2_E0_denominator(1:N_states) = HF_energy - nuclear_repulsion
|
||||||
|
! pt2_E0_denominator(1:N_states) = barycentric_electronic_energy(1:N_states)
|
||||||
|
else
|
||||||
|
E0_denominator = -huge(1.d0)
|
||||||
|
endif
|
||||||
|
END_PROVIDER
|
Loading…
Reference in New Issue
Block a user