10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-09-27 03:51:01 +02:00

Removed threshold_selectors

This commit is contained in:
Anthony Scemama 2018-12-19 16:03:21 +01:00
parent d60d65b08b
commit a4344fc41f
14 changed files with 46 additions and 83 deletions

View File

@ -96,11 +96,11 @@ end = struct
let n_states =
States_number.to_int n
in
(*
let old_nstates, read_wf =
Ezfio.get_determinants_n_states (),
Ezfio.get_determinants_read_wf ()
in
(*
if read_wf && old_nstates <> n_states then
Printf.eprintf "Warning : n_states could not be changed because read_wf is true\n%!"
else

View File

@ -40,12 +40,6 @@ doc: Thresholds on generators (fraction of the square of the norm)
interface: ezfio,provider,ocaml
default: 0.99
[threshold_selectors]
type: Threshold
doc: Thresholds on selectors (fraction of the square of the norm)
interface: ezfio,provider,ocaml
default: 0.999
[n_int]
interface: ezfio
doc: Number of integers required to represent bitstrings (set in module :ref:`bitmask`)

View File

@ -5,10 +5,9 @@ subroutine dress_slave
END_DOC
read_wf = .False.
distributed_davidson = .False.
SOFT_TOUCH read_wf distributed_davidson
threshold_selectors = 1.d0
threshold_generators = 1d0
SOFT_TOUCH read_wf distributed_davidson threshold_generators
call provide_everything
call switch_qp_run_to_master

View File

@ -290,16 +290,13 @@ subroutine ZMQ_dress(E, dress, delta_out, delta_s2_out, relative_error)
if (zmq_put_int(zmq_to_qp_run_socket,1,'dress_stoch_istate',dress_stoch_istate) == -1) then
stop 'Unable to put dress_stoch_istate on ZMQ server'
endif
if (zmq_put_dvector(zmq_to_qp_run_socket,1,'threshold_selectors',threshold_selectors,1) == -1) then
stop 'Unable to put threshold_selectors on ZMQ server'
endif
if (zmq_put_dvector(zmq_to_qp_run_socket,1,'threshold_generators',threshold_generators,1) == -1) then
stop 'Unable to put threshold_generators on ZMQ server'
endif
if (zmq_put_dvector(zmq_to_qp_run_socket,1,'threshold_generators',threshold_generators,1) == -1) then
stop 'Unable to put threshold_generators on ZMQ server'
endif
if (zmq_put_int(zmq_to_qp_run_socket, 1, 'ending', (-1)) == -1) then
stop 'Unable to put initial ending'
endif
if (zmq_put_int(zmq_to_qp_run_socket, 1, 'ending', (-1)) == -1) then
stop 'Unable to put initial ending'
endif

View File

@ -2,11 +2,10 @@ subroutine dress_zmq()
implicit none
double precision, allocatable :: energy(:)
allocate (energy(N_states))
threshold_selectors = 1.d0
threshold_generators = 1d0
read_wf = .True.
SOFT_TOUCH read_wf threshold_generators threshold_selectors
SOFT_TOUCH read_wf threshold_generators
if (.True.) then
integer :: i,j

View File

@ -52,8 +52,7 @@ program fci
n_det_before = 0
double precision :: correlation_energy_ratio
double precision :: threshold_selectors_save, threshold_generators_save
threshold_selectors_save = threshold_selectors
double precision :: threshold_generators_save
threshold_generators_save = threshold_generators
double precision :: error(N_states)
@ -71,13 +70,11 @@ program fci
pt2 = 0.d0
variance = 0.d0
norm = 0.d0
threshold_selectors = 1.d0
threshold_generators = 1.d0
SOFT_TOUCH threshold_selectors threshold_generators
SOFT_TOUCH threshold_generators
call ZMQ_pt2(psi_energy_with_nucl_rep,pt2,relative_error,error, variance, norm) ! Stochastic PT2
threshold_selectors = threshold_selectors_save
threshold_generators = threshold_generators_save
SOFT_TOUCH threshold_selectors threshold_generators
SOFT_TOUCH threshold_generators
endif
@ -123,13 +120,11 @@ program fci
pt2 = 0.d0
variance = 0.d0
norm = 0.d0
threshold_selectors = 1.d0
threshold_generators = 1d0
SOFT_TOUCH threshold_selectors threshold_generators
SOFT_TOUCH threshold_generators
call ZMQ_pt2(psi_energy_with_nucl_rep, pt2,relative_error,error,variance,norm) ! Stochastic PT2
threshold_selectors = threshold_selectors_save
threshold_generators = threshold_generators_save
SOFT_TOUCH threshold_selectors threshold_generators
SOFT_TOUCH threshold_generators
call ezfio_set_fci_energy(psi_energy_with_nucl_rep(1:N_states))
call ezfio_set_fci_energy_pt2(psi_energy_with_nucl_rep(1:N_states)+pt2)
endif

View File

@ -5,7 +5,8 @@ program pt2
! EZFIO directory.
END_DOC
read_wf = .True.
SOFT_TOUCH read_wf
threshold_generators = 1.d0
SOFT_TOUCH read_wf threshold_generators
PROVIDE mo_bielec_integrals_in_map
PROVIDE psi_energy
call run
@ -26,8 +27,6 @@ subroutine run
pt2(:) = 0.d0
E_CI_before(:) = psi_energy(:) + nuclear_repulsion
threshold_selectors = 1.d0
threshold_generators = 1.d0
relative_error=PT2_relative_error
call ZMQ_pt2(psi_energy_with_nucl_rep,pt2,relative_error,error, variance, norm) ! Stochastic PT2

View File

@ -154,9 +154,6 @@ subroutine ZMQ_pt2(E, pt2,relative_error, error, variance, norm)
if (zmq_put_ivector(zmq_to_qp_run_socket,1,'pt2_stoch_istate',pt2_stoch_istate,1) == -1) then
stop 'Unable to put pt2_stoch_istate on ZMQ server'
endif
if (zmq_put_dvector(zmq_to_qp_run_socket,1,'threshold_selectors',threshold_selectors,1) == -1) then
stop 'Unable to put threshold_selectors on ZMQ server'
endif
if (zmq_put_dvector(zmq_to_qp_run_socket,1,'threshold_generators',threshold_generators,1) == -1) then
stop 'Unable to put threshold_generators on ZMQ server'
endif

View File

@ -1212,28 +1212,19 @@ subroutine get_d0(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs)
if(bannedOrb(p2,2)) cycle
call get_mo_bielec_integrals(p2,h1,h2,mo_tot_num,hij_cache1,mo_integrals_map)
do p1=1, mo_tot_num
if(bannedOrb(p1, 1)) cycle
if(banned(p1, p2, bant)) cycle ! rentable?
if(p1 == h1 .or. p2 == h2) then
call apply_particles(mask, 1,p1,2,p2, det, ok, N_int)
call i_h_j(gen, det, N_int, hij)
else
if(bannedOrb(p1, 1) .or. banned(p1, p2, bant)) cycle
if(p1 /= h1 .and. p2 /= h2) then
if (hij_cache1(p1) == 0.d0) cycle
phase = get_phase_bi(phasemask, 1, 2, h1, p1, h2, p2, N_int)
hij = hij_cache1(p1) * phase
else
call apply_particles(mask, 1,p1,2,p2, det, ok, N_int)
call i_h_j(gen, det, N_int, hij)
if (hij == 0.d0) cycle
end if
! if( (bannedOrb(p1, 1)).or.(banned(p1, p2, bant)) ) then
! hij = 0.d0
! else if(p1 /= h1 .and. p2 /= h2) then
! hij = hij_cache1(p1) * get_phase_bi(phasemask, 1, 2, h1, p1, h2, p2, N_int)
! else
! call apply_particles(mask, 1,p1,2,p2, det, ok, N_int)
! call i_h_j(gen, det, N_int, hij)
! end if
if (hij /= 0.d0) then
do k=1,N_states
mat(k, p1, p2) = mat(k, p1, p2) + coefs(k) * hij ! HOTSPOT
enddo
endif
do k=1,N_states
mat(k, p1, p2) = mat(k, p1, p2) + coefs(k) * hij ! HOTSPOT
enddo
end do
end do
@ -1245,20 +1236,19 @@ subroutine get_d0(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs)
call get_mo_bielec_integrals(puti,p2,p1,mo_tot_num,hij_cache1,mo_integrals_map)
call get_mo_bielec_integrals(puti,p1,p2,mo_tot_num,hij_cache2,mo_integrals_map)
do putj=puti+1, mo_tot_num
if(bannedOrb(putj, sp)) cycle
if(banned(puti, putj, bant)) cycle ! rentable?
if(puti == p1 .or. putj == p2 .or. puti == p2 .or. putj == p1) then
call apply_particles(mask, sp,puti,sp,putj, det, ok, N_int)
call i_h_j(gen, det, N_int, hij)
if(bannedOrb(putj, sp) .or. banned(putj, sp, bant)) cycle
if(puti /= p1 .and. putj /= p2 .and. puti /= p2 .and. putj /= p1) then
hij = hij_cache1(putj) - hij_cache2(putj)
if (hij /= 0.d0) then
hij = hij * get_phase_bi(phasemask, sp, sp, puti, p1 , putj, p2, N_int)
do k=1,N_states
mat(k, puti, putj) = mat(k, puti, putj) + coefs(k) * hij
enddo
endif
else
hij = hij_cache1(putj) - hij_cache2(putj)
call apply_particles(mask, sp,puti,sp,putj, det, ok, N_int)
call i_h_j(gen, det, N_int, hij)
if (hij /= 0.d0) then
hij = hij * get_phase_bi(phasemask, sp, sp, puti, p1 , putj, p2, N_int)
do k=1,N_states
mat(k, puti, putj) = mat(k, puti, putj) + coefs(k) * hij
enddo

View File

@ -42,9 +42,6 @@ subroutine ZMQ_selection(N_in, pt2, variance, norm)
if (zmq_put_dvector(zmq_to_qp_run_socket,1,'energy',pt2_e0_denominator,size(pt2_e0_denominator)) == -1) then
stop 'Unable to put energy on ZMQ server'
endif
if (zmq_put_dvector(zmq_to_qp_run_socket,1,'threshold_selectors',threshold_selectors,1) == -1) then
stop 'Unable to put threshold_selectors on ZMQ server'
endif
if (zmq_put_dvector(zmq_to_qp_run_socket,1,'state_average_weight',state_average_weight,N_states) == -1) then
stop 'Unable to put state_average_weight on ZMQ server'
endif

View File

@ -169,7 +169,6 @@ subroutine pt2_epstein_nesbet_2x2 ($arguments)
endif
H_pert_diag(i) = h*c_pert(i)*c_pert(i)
! print*, 'N_det,N_det_selectors = ',N_det,N_det_selectors
! print*, 'threshold_selectors',threshold_selectors
! print*, delta_e,i_H_psi_array(1)
! double precision :: hij,accu
! accu = 0.d0

View File

@ -1,5 +1,13 @@
use bitmasks
BEGIN_PROVIDER [ double precision, threshold_selectors ]
implicit none
BEGIN_DOC
! Thresholds on selectors (fraction of the square of the norm)
END_DOC
threshold_selectors = dsqrt(threshold_generators)
END_PROVIDER
BEGIN_PROVIDER [ integer, N_det_selectors]
implicit none
BEGIN_DOC
@ -10,9 +18,6 @@ BEGIN_PROVIDER [ integer, N_det_selectors]
double precision :: norm, norm_max
call write_time(6)
N_det_selectors = N_det
! if (threshold_selectors == 1.d0) then
! return
! endif
norm = 1.d0
do i=1,N_det
norm = norm - psi_average_norm_contrib_sorted(i)

View File

@ -16,7 +16,7 @@ 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 N_states_diag
PROVIDE pt2_e0_denominator mo_tot_num N_int ci_energy mpi_master zmq_state zmq_context
PROVIDE psi_det psi_coef threshold_generators threshold_selectors state_average_weight
PROVIDE psi_det psi_coef threshold_generators state_average_weight
PROVIDE N_det_selectors pt2_stoch_istate N_det
end
@ -51,7 +51,7 @@ subroutine run_wf
zmq_to_qp_run_socket = new_zmq_to_qp_run_socket()
PROVIDE psi_det psi_coef threshold_generators threshold_selectors state_average_weight mpi_master
PROVIDE psi_det psi_coef threshold_generators state_average_weight mpi_master
PROVIDE zmq_state N_det_selectors pt2_stoch_istate N_det pt2_e0_denominator
PROVIDE N_det_generators N_states N_states_diag psi_energy
@ -101,10 +101,6 @@ subroutine run_wf
call mpi_print('zmq_get_dvector threshold_generators')
IRP_ENDIF
if (zmq_get_dvector(zmq_to_qp_run_socket,1,'threshold_generators',threshold_generators,1) == -1) cycle
IRP_IF MPI_DEBUG
call mpi_print('zmq_get_dvector threshold_selectors')
IRP_ENDIF
if (zmq_get_dvector(zmq_to_qp_run_socket,1,'threshold_selectors',threshold_selectors,1) == -1) cycle
IRP_IF MPI_DEBUG
call mpi_print('zmq_get_dvector energy')
IRP_ENDIF
@ -122,7 +118,7 @@ subroutine run_wf
IRP_ENDIF
if (zmq_get_dvector(zmq_to_qp_run_socket,1,'state_average_weight',state_average_weight,N_states) == -1) cycle
psi_energy(1:N_states) = energy(1:N_states)
TOUCH psi_energy state_average_weight threshold_selectors threshold_generators
TOUCH psi_energy state_average_weight threshold_generators
if (mpi_master) then
print *, 'N_det', N_det
@ -213,10 +209,6 @@ subroutine run_wf
call mpi_print('zmq_get_dvector threshold_generators')
IRP_ENDIF
if (zmq_get_dvector(zmq_to_qp_run_socket,1,'threshold_generators',threshold_generators,1) == -1) cycle
IRP_IF MPI_DEBUG
call mpi_print('zmq_get_dvector threshold_selectors')
IRP_ENDIF
if (zmq_get_dvector(zmq_to_qp_run_socket,1,'threshold_selectors',threshold_selectors,1) == -1) cycle
IRP_IF MPI_DEBUG
call mpi_print('zmq_get_dvector energy')
IRP_ENDIF
@ -230,7 +222,7 @@ subroutine run_wf
IRP_ENDIF
if (zmq_get_dvector(zmq_to_qp_run_socket,1,'state_average_weight',state_average_weight,N_states) == -1) cycle
psi_energy(1:N_states) = energy(1:N_states)
TOUCH psi_energy state_average_weight pt2_stoch_istate threshold_selectors threshold_generators
TOUCH psi_energy state_average_weight pt2_stoch_istate threshold_generators
if (mpi_master) then
print *, 'N_det', N_det
print *, 'N_det_generators', N_det_generators

View File

@ -28,7 +28,7 @@ function run_FCI() {
}
@test "FCI H2O cc-pVDZ" {
run_FCI h2o.ezfio 2000 -76.1250464119599 -76.1258876912360
run_FCI h2o.ezfio 2000 -76.1249493055975 -76.1258779921351
}