10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-26 06:14:43 +01:00

Fixed MRCC

This commit is contained in:
Anthony Scemama 2018-06-27 15:20:33 +02:00
parent df5fee1647
commit 6c73330855
23 changed files with 137 additions and 950 deletions

View File

@ -1,2 +1,2 @@
Bitmask dress_zmq DavidsonDressed Bitmask dress_zmq DavidsonDressed Generators_full Selectors_full

View File

@ -341,12 +341,12 @@ subroutine pt2_collector(zmq_socket_pull, E, b, tbc, comb, Ncomb, computed, pt2_
prop = prop * pt2_weight_inv(first_det_of_teeth(tooth)) prop = prop * pt2_weight_inv(first_det_of_teeth(tooth))
E0 += pt2_detail(pt2_stoch_istate,first_det_of_teeth(tooth)) * prop E0 += pt2_detail(pt2_stoch_istate,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.d0) * abs(sum2above(tooth) / Nabove(tooth) - (sumabove(tooth)/Nabove(tooth))**2))
else else
eqt = 0.d0 eqt = 0.d0
endif endif
call wall_time(time) call wall_time(time)
if ( ((dabs(eqt/avg) < relative_error) .or. (dabs(eqt) < absolute_error)) .and. Nabove(tooth) >= 10) then if ( ((dabs(eqt/avg) < relative_error) .or. (dabs(eqt) < absolute_error)) .and. Nabove(tooth) >= 10.d0) then
! Termination ! Termination
pt2(pt2_stoch_istate) = avg pt2(pt2_stoch_istate) = avg
error(pt2_stoch_istate) = eqt error(pt2_stoch_istate) = eqt
@ -358,7 +358,7 @@ subroutine pt2_collector(zmq_socket_pull, E, b, tbc, comb, Ncomb, computed, pt2_
endif endif
endif endif
else else
if (Nabove(tooth) > Nabove_old) then if ( (Nabove(tooth) > 2.d0) .and. (Nabove(tooth) > Nabove_old) ) then
print '(G10.3, 2X, F16.10, 2X, G16.3, 2X, F16.4, A20)', Nabove(tooth), avg+E, eqt, time-time0, '' print '(G10.3, 2X, F16.10, 2X, G16.3, 2X, F16.4, A20)', Nabove(tooth), avg+E, eqt, time-time0, ''
Nabove_old = Nabove(tooth) Nabove_old = Nabove(tooth)
endif endif
@ -379,15 +379,6 @@ subroutine pt2_collector(zmq_socket_pull, E, b, tbc, comb, Ncomb, computed, pt2_
error(pt2_stoch_istate) = sqrt(1d0 / (Nabove(tooth)-1) * abs(sum2above(tooth) / Nabove(tooth) - (sumabove(tooth)/Nabove(tooth))**2)) error(pt2_stoch_istate) = sqrt(1d0 / (Nabove(tooth)-1) * abs(sum2above(tooth) / Nabove(tooth) - (sumabove(tooth)/Nabove(tooth))**2))
end if end if
!=======
!
! E0 = sum(pt2_detail(pt2_stoch_istate,:first_det_of_teeth(tooth)-1))
! prop = ((1d0 - dfloat(comb_teeth - tooth + 1) * comb_step) - pt2_cweight(first_det_of_teeth(tooth)-1))
! prop = prop * pt2_weight_inv(first_det_of_teeth(tooth))
! E0 += pt2_detail(pt2_stoch_istate,first_det_of_teeth(tooth)) * prop
! pt2(pt2_stoch_istate) = E0 + (sumabove(tooth) / Nabove(tooth))
!
!>>>>>>> master
call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket)
call sort_selection_buffer(b) call sort_selection_buffer(b)
end subroutine end subroutine

View File

@ -1 +0,0 @@
Full_CI_ZMQ GPI2

View File

@ -1,15 +0,0 @@
================
Full_CI_ZMQ_GPI2
================
GPI2 Slave for Full_CI with ZMQ. There should be one instance of the slave
per compute node.
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.

View File

@ -1,105 +0,0 @@
program selection_slave
implicit none
BEGIN_DOC
! Helper program to compute the PT2 in distributed mode.
END_DOC
read_wf = .False.
distributed_davidson = .False.
SOFT_TOUCH read_wf distributed_davidson
call provide_everything
call switch_qp_run_to_master
call run_wf
end
subroutine provide_everything
PROVIDE H_apply_buffer_allocated mo_bielec_integrals_in_map psi_det_generators psi_coef_generators psi_det_sorted_bit psi_selectors n_det_generators n_states generators_bitmask zmq_context
PROVIDE pt2_e0_denominator mo_tot_num N_int fragment_count GASPI_is_Initialized
end
subroutine run_wf
use f77_zmq
implicit none
integer(ZMQ_PTR), external :: new_zmq_to_qp_run_socket
integer(ZMQ_PTR) :: zmq_to_qp_run_socket
double precision :: energy(N_states)
character*(64) :: states(4)
integer :: rc, i, ierr
call provide_everything
zmq_context = f77_zmq_ctx_new ()
states(1) = 'selection'
states(2) = 'davidson'
states(3) = 'pt2'
zmq_to_qp_run_socket = new_zmq_to_qp_run_socket()
do
call wait_for_states(states,zmq_state,3)
if(trim(zmq_state) == 'Stopped') then
exit
else if (trim(zmq_state) == 'selection') then
! Selection
! ---------
print *, 'Selection'
if (is_gaspi_master) then
call zmq_get_psi(zmq_to_qp_run_socket,1,energy,N_states)
endif
call broadcast_wf(energy)
!$OMP PARALLEL PRIVATE(i)
i = omp_get_thread_num()
call run_selection_slave(0,i,energy)
!$OMP END PARALLEL
print *, 'Selection done'
else if (trim(zmq_state) == 'davidson') then
! Davidson
! --------
print *, 'Davidson'
if (is_gaspi_master) then
call zmq_get_psi(zmq_to_qp_run_socket,1,energy,N_states)
endif
call broadcast_wf(energy)
call omp_set_nested(.True.)
call davidson_slave_tcp(0)
call omp_set_nested(.False.)
print *, 'Davidson done'
else if (trim(zmq_state) == 'pt2') then
! PT2
! ---
print *, 'PT2'
if (is_gaspi_master) then
call zmq_get_psi(zmq_to_qp_run_socket,1,energy,N_states)
endif
call broadcast_wf(energy)
logical :: lstop
lstop = .False.
!$OMP PARALLEL PRIVATE(i)
i = omp_get_thread_num()
call run_pt2_slave(0,i,energy,lstop)
!$OMP END PARALLEL
print *, 'PT2 done'
endif
end do
end

View File

@ -1,254 +0,0 @@
subroutine broadcast_wf(energy)
implicit none
BEGIN_DOC
! Segment corresponding to the wave function. This is segment 0.
END_DOC
use bitmasks
use GASPI
use ISO_C_BINDING
double precision, intent(inout) :: energy(N_states)
integer(gaspi_return_t) :: res
if (is_gaspi_master) then
call broadcast_wf_put(energy)
else
call broadcast_wf_get(energy)
endif
res = gaspi_barrier(GASPI_GROUP_ALL, GASPI_BLOCK)
if(res .ne. GASPI_SUCCESS) then
write(*,*) "gaspi_barrier failed"
stop -1
end if
integer(gaspi_segment_id_t) :: seg_id
do seg_id=0,3
res = gaspi_segment_delete(seg_id)
if(res .ne. GASPI_SUCCESS) then
write(*,*) "gaspi_segment_delete failed", seg_id
stop -1
end if
end do
end
subroutine broadcast_wf_put(energy)
implicit none
BEGIN_DOC
! Initiates the broadcast of the wave function
END_DOC
use bitmasks
use GASPI
use ISO_C_BINDING
double precision, intent(in) :: energy(N_states)
integer(gaspi_segment_id_t) :: seg_id
integer(gaspi_alloc_t) :: seg_alloc_policy
integer(gaspi_size_t) :: seg_size(0:3)
type(c_ptr) :: seg_ptr(0:3)
integer, pointer :: params_int(:) ! Segment 0
double precision, pointer :: psi_coef_tmp(:,:) ! Segment 1
integer(bit_kind), pointer :: psi_det_tmp(:,:,:) ! Segment 2
double precision, pointer :: params_double(:) ! Segment 3
integer(gaspi_return_t) :: res
seg_alloc_policy = GASPI_MEM_UNINITIALIZED
seg_size(0) = 4 * 5
seg_id=0
res = gaspi_segment_create(seg_id, seg_size(seg_id), GASPI_GROUP_ALL, &
GASPI_BLOCK, seg_alloc_policy)
if(res .ne. GASPI_SUCCESS) then
write(*,*) "gaspi_create_segment failed", gaspi_rank, seg_id
stop -1
end if
res = gaspi_segment_ptr(seg_id, seg_ptr(seg_id))
if(res .ne. GASPI_SUCCESS) then
write(*,*) "gaspi_segment_ptr failed", gaspi_rank
stop -1
end if
call c_f_pointer(seg_ptr(0), params_int, shape=(/ 5 /))
params_int(1) = N_states
params_int(2) = N_det
params_int(3) = psi_det_size
res = gaspi_barrier(GASPI_GROUP_ALL, GASPI_BLOCK)
if(res .ne. GASPI_SUCCESS) then
write(*,*) "gaspi_barrier failed", gaspi_rank
stop -1
end if
seg_size(1) = 8 * psi_det_size * N_states
seg_size(2) = bit_kind * psi_det_size * 2 * N_int
seg_size(3) = 8 * N_states
do seg_id=1, 3
res = gaspi_segment_create(seg_id, seg_size(seg_id), GASPI_GROUP_ALL, &
GASPI_BLOCK, seg_alloc_policy)
if(res .ne. GASPI_SUCCESS) then
write(*,*) "gaspi_create_segment failed", gaspi_rank, seg_id
stop -1
end if
res = gaspi_segment_ptr(seg_id, seg_ptr(seg_id))
if(res .ne. GASPI_SUCCESS) then
write(*,*) "gaspi_segment_ptr failed", gaspi_rank
stop -1
end if
end do
call c_f_pointer(seg_ptr(1), psi_coef_tmp, shape=shape(psi_coef))
call c_f_pointer(seg_ptr(2), psi_det_tmp, shape=shape(psi_det))
call c_f_pointer(seg_ptr(3), params_double, shape=(/ N_states /))
psi_coef_tmp = psi_coef
psi_det_tmp = psi_det
params_double = energy
res = gaspi_barrier(GASPI_GROUP_ALL, GASPI_BLOCK)
if(res .ne. GASPI_SUCCESS) then
write(*,*) "gaspi_barrier failed", gaspi_rank
stop -1
end if
end
subroutine broadcast_wf_get(energy)
implicit none
BEGIN_DOC
! Gets the broadcasted wave function
END_DOC
use bitmasks
use GASPI
use ISO_C_BINDING
double precision, intent(out) :: energy(N_states)
integer(gaspi_segment_id_t) :: seg_id
integer(gaspi_alloc_t) :: seg_alloc_policy
integer(gaspi_size_t) :: seg_size(0:3)
type(c_ptr) :: seg_ptr(0:3)
integer, pointer :: params_int(:) ! Segment 0
double precision, pointer :: psi_coef_tmp(:,:) ! Segment 1
integer(bit_kind), pointer :: psi_det_tmp(:,:,:) ! Segment 2
double precision, pointer :: params_double(:) ! Segment 3
integer(gaspi_return_t) :: res
seg_alloc_policy = GASPI_MEM_UNINITIALIZED
seg_size(0) = 4 * 5
seg_id=0
res = gaspi_segment_create(seg_id, seg_size(seg_id), GASPI_GROUP_ALL,&
GASPI_BLOCK, seg_alloc_policy)
if(res .ne. GASPI_SUCCESS) then
write(*,*) "gaspi_create_segment failed"
stop -1
end if
res = gaspi_segment_ptr(seg_id, seg_ptr(seg_id))
if(res .ne. GASPI_SUCCESS) then
write(*,*) "gaspi_segment_ptr failed"
stop -1
end if
res = gaspi_barrier(GASPI_GROUP_ALL, GASPI_BLOCK)
if(res .ne. GASPI_SUCCESS) then
write(*,*) "gaspi_barrier failed"
stop -1
end if
integer(gaspi_offset_t) :: localOff, remoteOff
integer(gaspi_rank_t) :: remoteRank
integer(gaspi_queue_id_t) :: queue
localOff = 0
remoteRank = 0
queue = 0
res = gaspi_read(seg_id, localOff, remoteRank, &
seg_id, remoteOff, seg_size(seg_id), queue, GASPI_BLOCK)
if(res .ne. GASPI_SUCCESS) then
write(*,*) "gaspi_read failed"
stop -1
end if
res = gaspi_wait(queue, GASPI_BLOCK)
if(res .ne. GASPI_SUCCESS) then
write(*,*) "gaspi_wait failed"
stop -1
end if
call c_f_pointer(seg_ptr(0), params_int, shape=shape( (/ 5 /) ))
N_states = params_int(1)
N_det = params_int(2)
psi_det_size = params_int(3)
TOUCH N_states N_det psi_det_size
seg_size(1) = 8 * psi_det_size * N_states
seg_size(2) = bit_kind * psi_det_size * 2 * N_int
seg_size(3) = 8 * N_states
do seg_id=1, 3
res = gaspi_segment_create(seg_id, seg_size(seg_id), GASPI_GROUP_ALL, &
GASPI_BLOCK, seg_alloc_policy)
if(res .ne. GASPI_SUCCESS) then
write(*,*) "gaspi_create_segment failed"
stop -1
end if
res = gaspi_segment_ptr(seg_id, seg_ptr(seg_id))
if(res .ne. GASPI_SUCCESS) then
write(*,*) "gaspi_segment_ptr failed"
stop -1
end if
end do
res = gaspi_barrier(GASPI_GROUP_ALL, GASPI_BLOCK)
if(res .ne. GASPI_SUCCESS) then
write(*,*) "gaspi_barrier failed"
stop -1
end if
do seg_id=1, 3
res = gaspi_read(seg_id, localOff, remoteRank, &
seg_id, remoteOff, seg_size(seg_id), queue, GASPI_BLOCK)
if(res .ne. GASPI_SUCCESS) then
write(*,*) "gaspi_read failed"
stop -1
end if
res = gaspi_wait(queue, GASPI_BLOCK)
if(res .ne. GASPI_SUCCESS) then
write(*,*) "gaspi_wait failed"
stop -1
end if
end do
call c_f_pointer(seg_ptr(1), psi_coef_tmp, shape=shape(psi_coef))
call c_f_pointer(seg_ptr(2), psi_det_tmp, shape=shape(psi_det))
call c_f_pointer(seg_ptr(3), params_double, shape=shape(energy))
psi_coef = psi_coef_tmp
psi_det = psi_det_tmp
energy = params_double
end

View File

@ -16,23 +16,23 @@
integer :: i,j,m integer :: i,j,m
integer :: i_state integer :: i_state
double precision :: accu(N_states) double precision :: accu(N_states)
double precision, allocatable :: delta_ij_tmp(:,:,:) double precision, allocatable :: delta_ij_local(:,:,:)
delta_ij_mrpt = 0.d0 delta_ij_mrpt = 0.d0
allocate (delta_ij_tmp(N_det,N_det,N_states)) allocate (delta_ij_local(N_det,N_det,N_states))
! 1h ! 1h
delta_ij_tmp = 0.d0 delta_ij_local = 0.d0
call H_apply_mrpt_1h(delta_ij_tmp,N_det) call H_apply_mrpt_1h(delta_ij_local,N_det)
accu = 0.d0 accu = 0.d0
do i_state = 1, N_states do i_state = 1, N_states
do i = 1, N_det do i = 1, N_det
do j = 1, N_det do j = 1, N_det
accu(i_state) += delta_ij_tmp(j,i,i_state) * psi_coef(i,i_state) * psi_coef(j,i_state) accu(i_state) += delta_ij_local(j,i,i_state) * psi_coef(i,i_state) * psi_coef(j,i_state)
delta_ij_mrpt(j,i,i_state) += delta_ij_tmp(j,i,i_state) delta_ij_mrpt(j,i,i_state) += delta_ij_local(j,i,i_state)
enddo enddo
enddo enddo
second_order_pt_new_1h(i_state) = accu(i_state) second_order_pt_new_1h(i_state) = accu(i_state)
@ -40,14 +40,14 @@
print*, '1h = ',accu print*, '1h = ',accu
! 1p ! 1p
delta_ij_tmp = 0.d0 delta_ij_local = 0.d0
call H_apply_mrpt_1p(delta_ij_tmp,N_det) call H_apply_mrpt_1p(delta_ij_local,N_det)
accu = 0.d0 accu = 0.d0
do i_state = 1, N_states do i_state = 1, N_states
do i = 1, N_det do i = 1, N_det
do j = 1, N_det do j = 1, N_det
accu(i_state) += delta_ij_tmp(j,i,i_state) * psi_coef(i,i_state) * psi_coef(j,i_state) accu(i_state) += delta_ij_local(j,i,i_state) * psi_coef(i,i_state) * psi_coef(j,i_state)
delta_ij_mrpt(j,i,i_state) += delta_ij_tmp(j,i,i_state) delta_ij_mrpt(j,i,i_state) += delta_ij_local(j,i,i_state)
enddo enddo
enddo enddo
second_order_pt_new_1p(i_state) = accu(i_state) second_order_pt_new_1p(i_state) = accu(i_state)
@ -55,15 +55,15 @@
print*, '1p = ',accu print*, '1p = ',accu
! 1h1p ! 1h1p
delta_ij_tmp = 0.d0 delta_ij_local = 0.d0
call H_apply_mrpt_1h1p(delta_ij_tmp,N_det) call H_apply_mrpt_1h1p(delta_ij_local,N_det)
double precision :: e_corr_from_1h1p_singles(N_states) double precision :: e_corr_from_1h1p_singles(N_states)
accu = 0.d0 accu = 0.d0
do i_state = 1, N_states do i_state = 1, N_states
do i = 1, N_det do i = 1, N_det
do j = 1, N_det do j = 1, N_det
accu(i_state) += delta_ij_tmp(j,i,i_state) * psi_coef(i,i_state) * psi_coef(j,i_state) accu(i_state) += delta_ij_local(j,i,i_state) * psi_coef(i,i_state) * psi_coef(j,i_state)
delta_ij_mrpt(j,i,i_state) += delta_ij_tmp(j,i,i_state) delta_ij_mrpt(j,i,i_state) += delta_ij_local(j,i,i_state)
enddo enddo
enddo enddo
second_order_pt_new_1h1p(i_state) = accu(i_state) second_order_pt_new_1h1p(i_state) = accu(i_state)
@ -72,14 +72,14 @@
! 1h1p third order ! 1h1p third order
if(do_third_order_1h1p)then if(do_third_order_1h1p)then
delta_ij_tmp = 0.d0 delta_ij_local = 0.d0
call give_1h1p_sec_order_singles_contrib(delta_ij_tmp) call give_1h1p_sec_order_singles_contrib(delta_ij_local)
accu = 0.d0 accu = 0.d0
do i_state = 1, N_states do i_state = 1, N_states
do i = 1, N_det do i = 1, N_det
do j = 1, N_det do j = 1, N_det
accu(i_state) += delta_ij_tmp(j,i,i_state) * psi_coef(i,i_state) * psi_coef(j,i_state) accu(i_state) += delta_ij_local(j,i,i_state) * psi_coef(i,i_state) * psi_coef(j,i_state)
delta_ij_mrpt(j,i,i_state) += delta_ij_tmp(j,i,i_state) delta_ij_mrpt(j,i,i_state) += delta_ij_local(j,i,i_state)
enddo enddo
enddo enddo
second_order_pt_new_1h1p(i_state) = accu(i_state) second_order_pt_new_1h1p(i_state) = accu(i_state)
@ -88,14 +88,14 @@
endif endif
! 2h ! 2h
delta_ij_tmp = 0.d0 delta_ij_local = 0.d0
call H_apply_mrpt_2h(delta_ij_tmp,N_det) call H_apply_mrpt_2h(delta_ij_local,N_det)
accu = 0.d0 accu = 0.d0
do i_state = 1, N_states do i_state = 1, N_states
do i = 1, N_det do i = 1, N_det
do j = 1, N_det do j = 1, N_det
accu(i_state) += delta_ij_tmp(j,i,i_state) * psi_coef(i,i_state) * psi_coef(j,i_state) accu(i_state) += delta_ij_local(j,i,i_state) * psi_coef(i,i_state) * psi_coef(j,i_state)
delta_ij_mrpt(j,i,i_state) += delta_ij_tmp(j,i,i_state) delta_ij_mrpt(j,i,i_state) += delta_ij_local(j,i,i_state)
enddo enddo
enddo enddo
second_order_pt_new_2h(i_state) = accu(i_state) second_order_pt_new_2h(i_state) = accu(i_state)
@ -103,14 +103,14 @@
print*, '2h = ',accu print*, '2h = ',accu
! 2p ! 2p
delta_ij_tmp = 0.d0 delta_ij_local = 0.d0
call H_apply_mrpt_2p(delta_ij_tmp,N_det) call H_apply_mrpt_2p(delta_ij_local,N_det)
accu = 0.d0 accu = 0.d0
do i_state = 1, N_states do i_state = 1, N_states
do i = 1, N_det do i = 1, N_det
do j = 1, N_det do j = 1, N_det
accu(i_state) += delta_ij_tmp(j,i,i_state) * psi_coef(i,i_state) * psi_coef(j,i_state) accu(i_state) += delta_ij_local(j,i,i_state) * psi_coef(i,i_state) * psi_coef(j,i_state)
delta_ij_mrpt(j,i,i_state) += delta_ij_tmp(j,i,i_state) delta_ij_mrpt(j,i,i_state) += delta_ij_local(j,i,i_state)
enddo enddo
enddo enddo
second_order_pt_new_2p(i_state) = accu(i_state) second_order_pt_new_2p(i_state) = accu(i_state)
@ -118,15 +118,15 @@
print*, '2p = ',accu print*, '2p = ',accu
! 1h2p ! 1h2p
delta_ij_tmp = 0.d0 delta_ij_local = 0.d0
call give_1h2p_contrib(delta_ij_tmp) call give_1h2p_contrib(delta_ij_local)
call H_apply_mrpt_1h2p(delta_ij_tmp,N_det) call H_apply_mrpt_1h2p(delta_ij_local,N_det)
accu = 0.d0 accu = 0.d0
do i_state = 1, N_states do i_state = 1, N_states
do i = 1, N_det do i = 1, N_det
do j = 1, N_det do j = 1, N_det
accu(i_state) += delta_ij_tmp(j,i,i_state) * psi_coef(i,i_state) * psi_coef(j,i_state) accu(i_state) += delta_ij_local(j,i,i_state) * psi_coef(i,i_state) * psi_coef(j,i_state)
delta_ij_mrpt(j,i,i_state) += delta_ij_tmp(j,i,i_state) delta_ij_mrpt(j,i,i_state) += delta_ij_local(j,i,i_state)
enddo enddo
enddo enddo
second_order_pt_new_1h2p(i_state) = accu(i_state) second_order_pt_new_1h2p(i_state) = accu(i_state)
@ -134,15 +134,15 @@
print*, '1h2p = ',accu print*, '1h2p = ',accu
! 2h1p ! 2h1p
delta_ij_tmp = 0.d0 delta_ij_local = 0.d0
call give_2h1p_contrib(delta_ij_tmp) call give_2h1p_contrib(delta_ij_local)
call H_apply_mrpt_2h1p(delta_ij_tmp,N_det) call H_apply_mrpt_2h1p(delta_ij_local,N_det)
accu = 0.d0 accu = 0.d0
do i_state = 1, N_states do i_state = 1, N_states
do i = 1, N_det do i = 1, N_det
do j = 1, N_det do j = 1, N_det
accu(i_state) += delta_ij_tmp(j,i,i_state) * psi_coef(i,i_state) * psi_coef(j,i_state) accu(i_state) += delta_ij_local(j,i,i_state) * psi_coef(i,i_state) * psi_coef(j,i_state)
delta_ij_mrpt(j,i,i_state) += delta_ij_tmp(j,i,i_state) delta_ij_mrpt(j,i,i_state) += delta_ij_local(j,i,i_state)
enddo enddo
enddo enddo
second_order_pt_new_2h1p(i_state) = accu(i_state) second_order_pt_new_2h1p(i_state) = accu(i_state)
@ -150,14 +150,14 @@
print*, '2h1p = ',accu print*, '2h1p = ',accu
! 2h2p ! 2h2p
!delta_ij_tmp = 0.d0 !delta_ij_local = 0.d0
!call H_apply_mrpt_2h2p(delta_ij_tmp,N_det) !call H_apply_mrpt_2h2p(delta_ij_local,N_det)
!accu = 0.d0 !accu = 0.d0
!do i_state = 1, N_states !do i_state = 1, N_states
!do i = 1, N_det !do i = 1, N_det
! do j = 1, N_det ! do j = 1, N_det
! accu(i_state) += delta_ij_tmp(j,i,i_state) * psi_coef(i,i_state) * psi_coef(j,i_state) ! accu(i_state) += delta_ij_local(j,i,i_state) * psi_coef(i,i_state) * psi_coef(j,i_state)
! delta_ij_mrpt(j,i,i_state) += delta_ij_tmp(j,i,i_state) ! delta_ij_mrpt(j,i,i_state) += delta_ij_local(j,i,i_state)
! enddo ! enddo
!enddo !enddo
!second_order_pt_new_2h2p(i_state) = accu(i_state) !second_order_pt_new_2h2p(i_state) = accu(i_state)

View File

@ -1,17 +0,0 @@
[energy]
type: double precision
doc: Calculated energy
interface: ezfio
[thresh_dressed_ci]
type: Threshold
doc: Threshold on the convergence of the dressed CI energy
interface: ezfio,provider,ocaml
default: 1.e-5
[n_it_max_dressed_ci]
type: Strictly_positive_int
doc: Maximum number of dressed CI iterations
interface: ezfio,provider,ocaml
default: 10

View File

@ -18,7 +18,6 @@
do j = 1, n_det do j = 1, n_det
dressing_column_h(j,k) = delta_ij(k,j,1) dressing_column_h(j,k) = delta_ij(k,j,1)
dressing_column_s(j,k) = delta_ij(k,j,2) dressing_column_s(j,k) = delta_ij(k,j,2)
! print *, j, delta_ij(k,j,:)
enddo enddo
enddo enddo
END_PROVIDER END_PROVIDER

View File

@ -1 +0,0 @@
dress_zmq DavidsonDressed Psiref_CAS MRPT_Utils Perturbation MRCC_Utils

View File

@ -1,12 +0,0 @@
========
mrcc_sto
========
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.

View File

@ -1,240 +0,0 @@
program mrcc_sto
implicit none
BEGIN_DOC
! TODO
END_DOC
call dress_zmq()
call ezfio_set_mrcc_sto_energy(ci_energy_dressed(1))
end
BEGIN_PROVIDER [ double precision, hij_cache_, (N_det,Nproc) ]
&BEGIN_PROVIDER [ double precision, sij_cache_, (N_det,Nproc) ]
&BEGIN_PROVIDER [ double precision, dIa_hla_, (N_states,N_det,Nproc) ]
&BEGIN_PROVIDER [ double precision, dIa_sla_, (N_states,N_det,Nproc) ]
&BEGIN_PROVIDER [ integer, excs_ , (0:2,2,2,N_det,Nproc) ]
&BEGIN_PROVIDER [ double precision, phases_, (N_det, Nproc) ]
BEGIN_DOC
! temporay arrays for dress_with_alpha_buffer. Avoids reallocation.
END_DOC
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
!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)
integer :: i,j,k,l,m
integer :: degree1, degree2, degree
double precision :: hIk, hla, hIl, sla, dIk(N_states), dka(N_states), dIa(N_states), hka
double precision :: phase, phase2
integer :: exc(0:2,2,2)
integer :: h1,h2,p1,p2,s1,s2
integer(bit_kind) :: tmp_det(N_int,2), ctrl
integer :: i_state, k_sd, l_sd, m_sd, ll_sd, i_I
double precision :: Delta_E_inv(N_states)
double precision :: sdress, hdress
logical :: ok, ok2
integer :: canbediamond
PROVIDE mo_class
if(n_minilist == 1) return
do i=1,n_minilist
if(idx_non_ref_rev(minilist(i)) == 0) return
end do
if (perturbative_triples) then
PROVIDE one_anhil fock_virt_total fock_core_inactive_total one_creat
endif
canbediamond = 0
do l_sd=1,n_minilist
call get_excitation(det_minilist(1,1,l_sd),alpha,exc,degree1,phase,N_int)
call decode_exc(exc,degree1,h1,p1,h2,p2,s1,s2)
ok = (mo_class(h1)(1:1) == 'A' .or. mo_class(h1)(1:1) == 'I') .and. &
(mo_class(p1)(1:1) == 'A' .or. mo_class(p1)(1:1) == 'V')
if(ok .and. degree1 == 2) then
ok = (mo_class(h2)(1:1) == 'A' .or. mo_class(h2)(1:1) == 'I') .and. &
(mo_class(p2)(1:1) == 'A' .or. mo_class(p2)(1:1) == 'V')
end if
if(ok) then
canbediamond += 1
excs_(:,:,:,l_sd,iproc) = exc(:,:,:)
phases_(l_sd, iproc) = phase
else
phases_(l_sd, iproc) = 0d0
end if
!call i_h_j(alpha,det_minilist(1,1,l_sd),N_int,hij_cache_(l_sd,iproc))
!call get_s2(alpha,det_minilist(1,1,l_sd),N_int,sij_cache_(l_sd,iproc))
call i_h_j_s2(alpha,det_minilist(1,1,l_sd),N_int,hij_cache_(l_sd,iproc), sij_cache_(l_sd,iproc))
enddo
if(canbediamond <= 1) return
do i_I=1,N_det_ref
call get_excitation_degree(alpha,psi_ref(1,1,i_I),degree1,N_int)
if (degree1 > 4) then
cycle
endif
do i_state=1,N_states
dIa(i_state) = 0.d0
enddo
do k_sd=1,n_minilist
if(phases_(k_sd,iproc) == 0d0) cycle
call get_excitation_degree(psi_ref(1,1,i_I),det_minilist(1,1,k_sd),degree,N_int)
if (degree > 2) then
cycle
endif
!call get_excitation(det_minilist(1,1,k_sd),alpha,exc,degree2,phase,N_int)
phase = phases_(k_sd, iproc)
exc(:,:,:) = excs_(:,:,:,k_sd,iproc)
degree2 = exc(0,1,1) + exc(0,1,2)
call apply_excitation(psi_ref(1,1,i_I), exc, tmp_det, ok, N_int)
if((.not. ok) .and. (.not. perturbative_triples)) cycle
do i_state=1,N_states
dka(i_state) = 0.d0
enddo
ok2 = .false.
!do i_state=1,N_states
! !if(dka(i_state) == 0) cycle
! dIk(i_state) = dij(i_I, idx_non_ref_rev(minilist(k_sd)), i_state)
! if(dIk(i_state) /= 0d0) then
! ok2 = .true.
! endif
!enddo
!if(.not. ok2) cycle
if (ok) then
phase2 = 0d0
do l_sd=k_sd+1,n_minilist
if(phases_(l_sd, iproc) == 0d0) cycle
call get_excitation_degree(tmp_det,det_minilist(1,1,l_sd),degree,N_int)
if (degree == 0) then
do i_state=1,N_states
dIk(i_state) = dij(i_I, idx_non_ref_rev(minilist(k_sd)), i_state)
if(dIk(i_state) /= 0d0) then
if(phase2 == 0d0) call get_excitation(psi_ref(1,1,i_I),det_minilist(1,1,l_sd),exc,degree,phase2,N_int)
dka(i_state) = dij(i_I, idx_non_ref_rev(minilist(l_sd)), i_state) * phase * phase2
end if
end do
!call get_excitation(psi_ref(1,1,i_I),det_minilist(1,1,l_sd),exc,degree,phase2,N_int)
!do i_state=1,N_states
! if(dIk(i_state) /= 0d0) dka(i_state) = dij(i_I, idx_non_ref_rev(minilist(l_sd)), i_state) * phase * phase2
!enddo
exit
endif
enddo
else if (perturbative_triples) then
hka = hij_cache_(k_sd,iproc)
if (dabs(hka) > 1.d-12) then
call get_delta_e_dyall_general_mp(psi_ref(1,1,i_I),alpha,Delta_E_inv)
do i_state=1,N_states
ASSERT (Delta_E_inv(i_state) < 0.d0)
dka(i_state) = hka / Delta_E_inv(i_state)
enddo
endif
endif
if (perturbative_triples.and. (degree2 == 1) ) then
call i_h_j(psi_ref(1,1,i_I),tmp_det,N_int,hka)
hka = hij_cache_(k_sd,iproc) - hka
if (dabs(hka) > 1.d-12) then
call get_delta_e_dyall_general_mp(psi_ref(1,1,i_I),alpha,Delta_E_inv)
do i_state=1,N_states
ASSERT (Delta_E_inv(i_state) < 0.d0)
dka(i_state) = hka / Delta_E_inv(i_state)
enddo
endif
endif
do i_state=1,N_states
dIa(i_state) = dIa(i_state) + dIk(i_state) * dka(i_state)
enddo
enddo
ok2 = .false.
do i_state=1,N_states
if(dIa(i_state) /= 0d0) ok2 = .true.
enddo
if(.not. ok2) cycle
do l_sd=1,n_minilist
k_sd = minilist(l_sd)
hla = hij_cache_(l_sd,iproc)
sla = sij_cache_(l_sd,iproc)
do i_state=1,N_states
hdress = dIa(i_state) * hla * psi_ref_coef(i_I,i_state)
sdress = dIa(i_state) * sla * psi_ref_coef(i_I,i_state)
!!!$OMP ATOMIC
delta_ij_loc(i_state,k_sd,1) += hdress
!!!$OMP ATOMIC
delta_ij_loc(i_state,k_sd,2) += sdress
enddo
enddo
enddo
end subroutine
!! TESTS MINILIST
subroutine test_minilist(minilist, n_minilist, alpha)
use bitmasks
implicit none
integer, intent(in) :: n_minilist
integer(bit_kind),intent(in) :: alpha(N_int, 2)
integer, intent(in) :: minilist(n_minilist)
integer :: a, i, deg
integer :: refc(N_det), testc(N_det)
refc = 0
testc = 0
do i=1,N_det
call get_excitation_degree(psi_det(1,1,i), alpha, deg, N_int)
if(deg <= 2) refc(i) = refc(i) + 1
end do
do i=1,n_minilist
call get_excitation_degree(psi_det(1,1,minilist(i)), alpha, deg, N_int)
if(deg <= 2) then
testc(minilist(i)) += 1
else
stop "NON LINKED IN MINILIST"
end if
end do
do i=1,N_det
if(refc(i) /= testc(i)) then
print *, "MINILIST FAIL ", sum(refc), sum(testc), n_minilist
exit
end if
end do
end subroutine

View File

@ -74,118 +74,6 @@ BEGIN_PROVIDER [ double precision, mrcc_norm_acc, (0:N_det_non_ref, N_states) ]
END_PROVIDER END_PROVIDER
! BEGIN_PROVIDER [ double precision, delta_ij_mrcc_sto,(N_states,N_det_non_ref) ]
!&BEGIN_PROVIDER [ double precision, delta_ij_s2_mrcc_sto, (N_states,N_det_non_ref) ]
! use bitmasks
! implicit none
! integer :: gen, h, p, n, t, i, j, h1, h2, p1, p2, s1, s2, iproc
! integer(bit_kind) :: mask(N_int, 2), omask(N_int, 2)
! integer(bit_kind),allocatable :: buf(:,:,:)
! logical :: ok
! logical, external :: detEq
! integer, external :: omp_get_thread_num
! double precision :: coefs(N_det_non_ref), myCoef
! integer :: n_in_teeth
! double precision :: contrib(N_states), curn, in_teeth_step, curlim, curnorm
!
! contrib = 0d0
! read(*,*) n_in_teeth
! !n_in_teeth = 2
! in_teeth_step = 1d0 / dfloat(n_in_teeth)
! !double precision :: delta_ij_mrcc_tmp,(N_states,N_det_non_ref)
! !double precision :: delta_ij_s2_mrcc_tmp(N_states,N_det_non_ref)
!
! coefs = 0d0
! coefs(:mrcc_teeth(1,1)-1) = 1d0
!
! do i=1,N_mrcc_teeth
! print *, "TEETH SIZE", i, mrcc_teeth(i+1,1)-mrcc_teeth(i,1)
! if(mrcc_teeth(i+1,1) - mrcc_teeth(i,1) <= n_in_teeth) then
! coefs(mrcc_teeth(i,1):mrcc_teeth(i+1,1)-1) = 1d0
! else if(.false.) then
! curnorm = 0d0
! curn = 0.5d0
! curlim = curn / dfloat(n_in_teeth)
! do j=mrcc_teeth(i,1), mrcc_teeth(i+1,1)-1
! if(mrcc_norm_acc(j,1) >= curlim) then
! coefs(j) = 1d0
! curnorm += mrcc_norm(j,1)
! do while(mrcc_norm_acc(j,1) > curlim)
! curn += 1d0
! curlim = curn / dfloat(n_in_teeth)
! end do
! end if
! end do
! do j=mrcc_teeth(i,1), mrcc_teeth(i+1,1)-1
! coefs(j) = coefs(j) / curnorm ! 1d0 / norm computed in teeth
! end do
! else if(.true.) then
! coefs(mrcc_teeth(i,1):mrcc_teeth(i,1)+n_in_teeth-1) = 1d0 / mrcc_norm_acc(mrcc_teeth(i,1)+n_in_teeth-1, 1)
! else
! curnorm = 0d0
! n = mrcc_teeth(i+1,1) - mrcc_teeth(i,1)
! do j=1,n_in_teeth
! t = int((dfloat(j)-0.5d0) * dfloat(n) / dfloat(n_in_teeth)) + 1 + mrcc_teeth(i,1) - 1
! curnorm += mrcc_norm(t,1)
! coefs(t) = 1d0
! end do
! do j=mrcc_teeth(i,1), mrcc_teeth(i+1,1)-1
! coefs(j) = coefs(j) / curnorm ! 1d0 / norm computed in teeth
! end do
! end if
! !coefs(mrcc_teeth(i,1)) =
! end do
!
! !coefs = coefs * dfloat(N_det_generators)
!
!
! delta_ij_mrcc_sto = 0d0
! delta_ij_s2_mrcc_sto = 0d0
! PROVIDE dij
! provide hh_shortcut psi_det_size! lambda_mrcc
! !$OMP PARALLEL DO default(none) schedule(dynamic) &
! !$OMP shared(psi_ref, psi_non_ref, hh_exists, pp_exists, N_int, hh_shortcut) &
! !$OMP shared(N_det_generators, coefs,N_det_non_ref, delta_ij_mrcc_sto) &
! !$OMP shared(contrib,psi_det_generators, delta_ij_s2_mrcc_sto) &
! !$OMP private(i,j,curnorm,myCoef, h, n, mask, omask, buf, ok, iproc)
! do gen= 1,N_det_generators
! if(coefs(gen) == 0d0) cycle
! myCoef = coefs(gen)
! allocate(buf(N_int, 2, N_det_non_ref))
! iproc = omp_get_thread_num() + 1
! if(mod(gen, 1000) == 0) print *, "mrcc_sto ", gen, "/", N_det_generators
!
! do h=1, hh_shortcut(0)
! call apply_hole_local(psi_det_generators(1,1,gen), hh_exists(1, h), mask, ok, N_int)
! if(.not. ok) cycle
! omask = 0_bit_kind
! if(hh_exists(1, h) /= 0) omask = mask
! n = 1
! do p=hh_shortcut(h), hh_shortcut(h+1)-1
! call apply_particle_local(mask, pp_exists(1, p), buf(1,1,n), ok, N_int)
! if(ok) n = n + 1
! if(n > N_det_non_ref) stop "Buffer too small in MRCC..."
! end do
! n = n - 1
! if(n /= 0) then
! call mrcc_part_dress(delta_ij_mrcc_sto, delta_ij_s2_mrcc_sto, &
! gen,n,buf,N_int,omask,myCoef,contrib)
! endif
! end do
! deallocate(buf)
! end do
! !$OMP END PARALLEL DO
!
!
!
! curnorm = 0d0
! do j=1,N_det_non_ref
! curnorm += delta_ij_mrcc_sto(1,j)*delta_ij_mrcc_sto(1,j)
! end do
! print *, "NORM DELTA ", dsqrt(curnorm)
!
!END_PROVIDER
BEGIN_PROVIDER [ double precision, delta_ij_cancel, (N_states,N_det_non_ref) ] BEGIN_PROVIDER [ double precision, delta_ij_cancel, (N_states,N_det_non_ref) ]
@ -251,7 +139,7 @@ END_PROVIDER
&BEGIN_PROVIDER [ double precision, delta_ij_s2_mrcc, (N_states,N_det_non_ref) ] &BEGIN_PROVIDER [ double precision, delta_ij_s2_mrcc, (N_states,N_det_non_ref) ]
use bitmasks use bitmasks
implicit none implicit none
integer :: gen, h, p, n, t, i, h1, h2, p1, p2, s1, s2, iproc integer :: gen, h, p, n, t, i, h1, h2, p1, p2, s1, s2
integer(bit_kind) :: mask(N_int, 2), omask(N_int, 2) integer(bit_kind) :: mask(N_int, 2), omask(N_int, 2)
integer(bit_kind),allocatable :: buf(:,:,:) integer(bit_kind),allocatable :: buf(:,:,:)
logical :: ok logical :: ok
@ -266,13 +154,15 @@ END_PROVIDER
delta_ij_s2_mrcc = 0d0 delta_ij_s2_mrcc = 0d0
!$OMP PARALLEL DO default(none) schedule(dynamic) & !$OMP PARALLEL default(none) &
!$OMP shared(contrib,psi_det_generators, N_det_generators, hh_exists, pp_exists, N_int, hh_shortcut) & !$OMP shared(contrib,psi_det_generators, N_det_generators, hh_exists, pp_exists, N_int, hh_shortcut) &
!$OMP shared(N_det_non_ref, N_det_ref, delta_ij_mrcc, delta_ij_s2_mrcc) & !$OMP shared(N_det_non_ref, N_det_ref, delta_ij_mrcc, delta_ij_s2_mrcc) &
!$OMP private(h, n, mask, omask, buf, ok, iproc) !$OMP private(h, n, mask, omask, buf, ok,gen)
allocate(buf(N_int, 2, N_det_non_ref))
!$OMP DO schedule(dynamic)
do gen= 1, N_det_generators do gen= 1, N_det_generators
allocate(buf(N_int, 2, N_det_non_ref))
iproc = omp_get_thread_num() + 1
if(mod(gen, 1000) == 0) print *, "mrcc ", gen, "/", N_det_generators if(mod(gen, 1000) == 0) print *, "mrcc ", gen, "/", N_det_generators
do h=1, hh_shortcut(0) do h=1, hh_shortcut(0)
call apply_hole_local(psi_det_generators(1,1,gen), hh_exists(1, h), mask, ok, N_int) call apply_hole_local(psi_det_generators(1,1,gen), hh_exists(1, h), mask, ok, N_int)
@ -292,9 +182,12 @@ END_PROVIDER
endif endif
end do end do
deallocate(buf)
end do end do
!$OMP END PARALLEL DO !$OMP END DO
deallocate(buf)
!$OMP END PARALLEL
END_PROVIDER END_PROVIDER
@ -542,13 +435,13 @@ subroutine mrcc_part_dress(delta_ij_, delta_ij_s2_, i_generator,n_selected,det_b
enddo enddo
enddo enddo
do i_state=1,N_states do i_state=1,N_states
do l_sd=1,idx_alpha(0) do l_sd=1,idx_alpha(0)
k_sd = idx_alpha(l_sd) k_sd = idx_alpha(l_sd)
hdress = dIa_hla(i_state,k_sd) * psi_ref_coef(i_I,i_state) hdress = dIa_hla(i_state,k_sd) * psi_ref_coef(i_I,i_state)
sdress = dIa_sla(i_state,k_sd) * psi_ref_coef(i_I,i_state) sdress = dIa_sla(i_state,k_sd) * psi_ref_coef(i_I,i_state)
!!$OMP ATOMIC
!$OMP ATOMIC !$OMP ATOMIC
contrib(i_state) += hdress * psi_coef(dressed_column_idx(i_state), i_state) * psi_non_ref_coef(k_sd, i_state) contrib(i_state) += hdress * psi_non_ref_coef(k_sd, i_state)
!$OMP ATOMIC !$OMP ATOMIC
delta_ij_(i_state,k_sd) += hdress delta_ij_(i_state,k_sd) += hdress
!$OMP ATOMIC !$OMP ATOMIC
@ -596,7 +489,7 @@ END_PROVIDER
if(target_error /= 0d0) then if(target_error /= 0d0) then
target_error = target_error * 0.5d0 ! (-mrcc_E0_denominator(1) + mrcc_previous_E(1)) / 1d1 target_error = target_error * 0.5d0 ! (-mrcc_E0_denominator(1) + mrcc_previous_E(1)) / 1d1
else else
target_error = 1d-4 target_error = -1d-4
end if end if
call ZMQ_mrcc(E_CI_before, mrcc, delta_ij_mrcc_zmq, delta_ij_s2_mrcc_zmq, abs(target_error)) call ZMQ_mrcc(E_CI_before, mrcc, delta_ij_mrcc_zmq, delta_ij_s2_mrcc_zmq, abs(target_error))
@ -609,21 +502,7 @@ END_PROVIDER
use bitmasks use bitmasks
implicit none implicit none
integer :: i, j, i_state integer :: i, j, i_state
!mrmode : 1=mrcepa0, 2=mrsc2 add, 3=mrcc, 4=stoch !mrmode : 1=mrcepa0, 2=mrsc2 add, 3=mrcc 5=mrcc_stoch
! if(mrmode == 4) then
! do j = 1, N_det_non_ref
! do i_state = 1, N_states
! delta_ij(i_state,j) = delta_ij_mrcc_sto(i_state,j)
! delta_ij_s2(i_state,j) = delta_ij_s2_mrcc_sto(i_state,j)
! enddo
! end do
! else if(mrmode == 10) then
! do j = 1, N_det_non_ref
! do i_state = 1, N_states
! delta_ij(i_state,j) = delta_ij_mrsc2(i_state,j)
! delta_ij_s2(i_state,j) = delta_ij_s2_mrsc2(i_state,j)
! enddo
! end do
if(mrmode == 5) then if(mrmode == 5) then
do j = 1, N_det_non_ref do j = 1, N_det_non_ref
do i_state = 1, N_states do i_state = 1, N_states
@ -656,13 +535,6 @@ END_PROVIDER
stop "invalid mrmode" stop "invalid mrmode"
end if end if
!if(mrmode == 2 .or. mrmode == 3) then
! do j = 1, N_det_non_ref
! do i_state = 1, N_states
! delta_ij(i_state,j) += delta_ij_cancel(i_state,j)
! enddo
! end do
!end if
END_PROVIDER END_PROVIDER

View File

@ -450,15 +450,15 @@ subroutine mrsc2_dressing_collector(zmq_socket_pull,delta_ij_,delta_ij_s2_)
do l=1, n(1) do l=1, n(1)
do i_state=1,N_states do i_state=1,N_states
delta_ij_(i_state,idx(l,1)) += delta(i_state,l,1) * psi_ref_coef(i_I,i_state) * c0(i_state) delta_ij_(i_state,idx(l,1)) += delta(i_state,l,1) * psi_ref_coef(i_I,i_state)
delta_ij_s2_(i_state,idx(l,1)) += delta_s2(i_state,l,1) * psi_ref_coef(i_I,i_state) * c0(i_state) delta_ij_s2_(i_state,idx(l,1)) += delta_s2(i_state,l,1) * psi_ref_coef(i_I,i_state)
end do end do
end do end do
do l=1, n(2) do l=1, n(2)
do i_state=1,N_states do i_state=1,N_states
delta_ij_(i_state,idx(l,2)) += delta(i_state,l,2) * psi_ref_coef(J,i_state) * c0(i_state) delta_ij_(i_state,idx(l,2)) += delta(i_state,l,2) * psi_ref_coef(J,i_state)
delta_ij_s2_(i_state,idx(l,2)) += delta_s2(i_state,l,2) * psi_ref_coef(J,i_state) * c0(i_state) delta_ij_s2_(i_state,idx(l,2)) += delta_s2(i_state,l,2) * psi_ref_coef(J,i_state)
end do end do
end do end do

View File

@ -15,17 +15,11 @@
do k=1,N_states do k=1,N_states
l = dressed_column_idx(k) l = dressed_column_idx(k)
f = 1.d0/psi_coef(l,k)
do jj = 1, n_det_non_ref do jj = 1, n_det_non_ref
j = idx_non_ref(jj) j = idx_non_ref(jj)
dressing_column_h(j,k) = delta_ij (k,jj) * f dressing_column_h(j,k) = delta_ij (k,jj)
dressing_column_s(j,k) = delta_ij_s2(k,jj) * f dressing_column_s(j,k) = delta_ij_s2(k,jj)
enddo enddo
tmp = u_dot_v(dressing_column_h(1,k), psi_coef(1,k), N_det)
dressing_column_h(l,k) -= tmp * f
tmp = u_dot_v(dressing_column_s(1,k), psi_coef(1,k), N_det)
dressing_column_s(l,k) -= tmp * f
enddo enddo
! stop
END_PROVIDER END_PROVIDER

View File

@ -1,27 +0,0 @@
program mrsc2sub
implicit none
double precision, allocatable :: energy(:)
allocate (energy(N_states))
!!mrmode : 1=mrcepa0, 2=mrsc2 add, 3=mrcc
mrmode = 4
read_wf = .True.
SOFT_TOUCH read_wf
call set_generators_bitmasks_as_holes_and_particles
if (.True.) then
integer :: i,j
do j=1,N_states
do i=1,N_det
psi_coef(i,j) = CI_eigenvectors(i,j)
enddo
enddo
SOFT_TOUCH psi_coef
endif
call run(N_states,energy)
if(do_pt2)then
call run_pt2(N_states,energy)
endif
deallocate(energy)
end

View File

@ -43,6 +43,7 @@ subroutine ZMQ_mrcc(E, mrcc, delta, delta_s2, relative_error)
call write_double(6,relative_error,"Target relative error")
print *, '========== ================= ================= =================' print *, '========== ================= ================= ================='
print *, ' Samples Energy Stat. Error Seconds ' print *, ' Samples Energy Stat. Error Seconds '
print *, '========== ================= ================= =================' print *, '========== ================= ================= ================='
@ -335,7 +336,7 @@ subroutine mrcc_collector(zmq_socket_pull, E, relative_error, delta, delta_s2, m
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 end if
if (((dabs(eqt)/(E(mrcc_stoch_istate)+E0+avg) < relative_error) .and. cps_N(cur_cp) >= 10) .or. total_computed == N_det_generators) then if (( (dabs(eqt/(E(mrcc_stoch_istate)+E0+avg)) < relative_error) .and. (cps_N(cur_cp) >= 10) ) .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
call sleep(1) call sleep(1)
if (zmq_abort(zmq_to_qp_run_socket) == -1) then if (zmq_abort(zmq_to_qp_run_socket) == -1) then
@ -400,7 +401,7 @@ end function
&BEGIN_PROVIDER [ integer, N_cps_max ] &BEGIN_PROVIDER [ integer, N_cps_max ]
implicit none implicit none
comb_teeth = 16 comb_teeth = 16
N_cps_max = 64 N_cps_max = 128
!comb_per_cp = 64 !comb_per_cp = 64
gen_per_cp = (N_det_generators / N_cps_max) + 1 gen_per_cp = (N_det_generators / N_cps_max) + 1
N_cps_max += 1 N_cps_max += 1

View File

@ -6,6 +6,10 @@ program mrsc2sub
!mrmode : 1=mrcepa0, 2=mrsc2 add, 3=mrcc !mrmode : 1=mrcepa0, 2=mrsc2 add, 3=mrcc
mrmode = 5 mrmode = 5
threshold_generators = 1.d0
threshold_selectors = 1.d0
TOUCH threshold_generators threshold_selectors
read_wf = .True. read_wf = .True.
SOFT_TOUCH read_wf SOFT_TOUCH read_wf
call set_generators_bitmasks_as_holes_and_particles call set_generators_bitmasks_as_holes_and_particles

View File

@ -1,17 +0,0 @@
#!/bin/bash
ezfio=$1
# Create the integral
echo 'Create Integral'
echo 'Create EZFIO'
read nel nmo natom <<< $(cat param)
read e_nucl <<< $(cat e_nuc)
./create_ezfio.py $ezfio $nel $natom $nmo $e_nucl
#Handle the orbital consitensy check
qp_edit -c $ezfio &> /dev/null
cp $ezfio/{ao,mo}_basis/ao_md5
#Read the integral
echo 'Read Integral'
qp_run read_integrals_mo $ezfio

View File

@ -1,44 +1,23 @@
[energy]
type: double precision
doc: Calculated energy
interface: ezfio
[thresh_dressed_ci]
type: Threshold
doc: Threshold on the convergence of the dressed CI energy
interface: ezfio,provider,ocaml
default: 1.e-5
[n_it_max_dressed_ci]
type: Strictly_positive_int
doc: Maximum number of dressed CI iterations
interface: ezfio,provider,ocaml
default: 10
[h0_type] [h0_type]
type: Perturbation type: Perturbation
doc: Type of zeroth-order Hamiltonian [ EN | Barycentric ] doc: Type of zeroth-order Hamiltonian [ EN | Barycentric ]
interface: ezfio,provider,ocaml interface: ezfio,provider,ocaml
default: EN default: EN
[energy]
type: double precision
doc: Calculated Selected FCI energy
interface: ezfio
[energy_pt2]
type: double precision
doc: Calculated FCI energy + PT2
interface: ezfio
[iterative_save]
type: integer
doc: Save data at each iteration : 1(Append) | 2(Overwrite) | 3(NoSave)
interface: ezfio,ocaml
default: 2
[n_iter]
interface: ezfio
doc: number of iterations
type:integer
[n_det_iter]
interface: ezfio
doc: number of determinants at iteration
type: integer
size: (full_ci_zmq.n_iter)
[energy_iter]
interface: ezfio
doc: The energy without a pt2 correction for n_det
type: double precision
size: (determinants.n_states,full_ci_zmq.n_iter)
[pt2_iter]
interface: ezfio
doc: The pt2 correction for n_det
type: double precision
size: (determinants.n_states,full_ci_zmq.n_iter)

View File

@ -18,7 +18,25 @@ source $QP_ROOT/tests/bats/common.bats.sh
ezfio set_file TMP ezfio set_file TMP
energy="$(ezfio get mrcepa0 energy_pt2)" energy="$(ezfio get mrcepa0 energy_pt2)"
rm -rf TMP rm -rf TMP
eq $energy -76.2382119593927 1.e-4 eq $energy -76.2379929298452 1.e-4
}
@test "MRCC-stoch H2O cc-pVDZ" {
INPUT=h2o.ezfio
EXE=mrcc_zmq
test_exe $EXE || skip
qp_edit -c $INPUT
ezfio set_file $INPUT
ezfio set determinants threshold_generators 1.
ezfio set determinants threshold_selectors 1.
ezfio set determinants read_wf True
ezfio set mrcepa0 lambda_type 1
ezfio set mrcepa0 n_it_max_dressed_ci 3
cp -r $INPUT TMP ; qp_run $EXE TMP
ezfio set_file TMP
energy="$(ezfio get mrcepa0 energy_pt2)"
rm -rf TMP
eq $energy -76.2379929298452 1.e-4
} }
@test "MRCC H2O cc-pVDZ" { @test "MRCC H2O cc-pVDZ" {
@ -36,7 +54,25 @@ source $QP_ROOT/tests/bats/common.bats.sh
ezfio set_file TMP ezfio set_file TMP
energy="$(ezfio get mrcepa0 energy_pt2)" energy="$(ezfio get mrcepa0 energy_pt2)"
rm -rf TMP rm -rf TMP
eq $energy -76.2381753982902 1.e-4 eq $energy -76.2379517543157 1.e-4
}
@test "MRCC-stoch H2O cc-pVDZ" {
INPUT=h2o.ezfio
EXE=mrcc_zmq
test_exe $EXE || skip
qp_edit -c $INPUT
ezfio set_file $INPUT
ezfio set determinants threshold_generators 1.
ezfio set determinants threshold_selectors 1.
ezfio set determinants read_wf True
ezfio set mrcepa0 lambda_type 0
ezfio set mrcepa0 n_it_max_dressed_ci 3
cp -r $INPUT TMP ; qp_run $EXE TMP
ezfio set_file TMP
energy="$(ezfio get mrcepa0 energy_pt2)"
rm -rf TMP
eq $energy -76.2379517543157 1.e-4
} }
@test "MRSC2 H2O cc-pVDZ" { @test "MRSC2 H2O cc-pVDZ" {
@ -72,6 +108,6 @@ source $QP_ROOT/tests/bats/common.bats.sh
ezfio set_file TMP ezfio set_file TMP
energy="$(ezfio get mrcepa0 energy_pt2)" energy="$(ezfio get mrcepa0 energy_pt2)"
rm -rf TMP rm -rf TMP
eq $energy -76.2411825032868 2.e-4 eq $energy -76.2407388142333 2.e-4
} }

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python2
import sys import sys