Fixed multi-state selection

This commit is contained in:
Anthony Scemama 2019-01-15 11:44:29 +01:00
parent 3529637c32
commit b1f17b91f8
8 changed files with 59 additions and 39 deletions

View File

@ -88,11 +88,20 @@ IRPF90
The code can be automatically indented with :command:`irp_indent`.
Mathematical formulas in the `BEGIN_DOC...END_DOC` sections sould be written
in LaTeX format, between `$` symbols.
Lines sould not be longer than 80 characters.
Mathematical formulas in the `BEGIN_DOC...END_DOC` sections sould be written in
LaTeX format, between `$` symbols.
All the providers, subroutines and functions should have a
`BEGIN_DOC...END_DOC` block.
Providers should never be present in the same file as a main program.
String must not use double quotes (`"`) but single quotes (`'`).
After a `read` statement there should be no comma.
Only standard Fortran is allowed : Intel or GNU extensions are forbidden.

View File

@ -116,6 +116,11 @@ subroutine ZMQ_pt2(E, pt2,relative_error, error, variance, norm, N_in)
integer(ZMQ_PTR), external :: new_zmq_to_qp_run_socket
type(selection_buffer) :: b
PROVIDE psi_bilinear_matrix_columns_loc psi_det_alpha_unique psi_det_beta_unique
PROVIDE psi_bilinear_matrix_rows psi_det_sorted_order psi_bilinear_matrix_order
PROVIDE psi_bilinear_matrix_transp_rows_loc psi_bilinear_matrix_transp_columns
PROVIDE psi_bilinear_matrix_transp_order psi_selectors_coef_transp psi_det_sorted
if (N_det < max(10,N_states)) then
pt2=0.d0

View File

@ -26,6 +26,8 @@ subroutine run_selection_slave(thread,iproc,energy)
PROVIDE psi_bilinear_matrix_rows psi_det_sorted_order psi_bilinear_matrix_order
PROVIDE psi_bilinear_matrix_transp_rows_loc psi_bilinear_matrix_transp_columns
PROVIDE psi_bilinear_matrix_transp_order N_int pt2_F
PROVIDE psi_selectors_coef_transp psi_det_sorted
zmq_to_qp_run_socket = new_zmq_to_qp_run_socket()

View File

@ -3,23 +3,9 @@ use bitmasks
BEGIN_PROVIDER [ double precision, selection_weight, (N_states) ]
implicit none
BEGIN_DOC
! Weights in the state-average calculation of the density matrix
! Weights used in the selection criterion
END_DOC
logical :: exists
selection_weight(:) = 1.d0
if (used_weight == 0) then
selection_weight(:) = c0_weight(:)
else if (used_weight == 1) then
selection_weight(:) = 1./N_states
else
call ezfio_has_determinants_state_average_weight(exists)
if (exists) then
call ezfio_get_determinants_state_average_weight(selection_weight)
endif
endif
selection_weight(:) = selection_weight(:)+1.d-31
selection_weight(:) = selection_weight(:)/(sum(selection_weight(:)))
selection_weight(1:N_states) = c0_weight(1:N_states)
END_PROVIDER
@ -171,9 +157,25 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d
double precision :: rss
double precision, external :: memory_of_double, memory_of_int
rss = memory_of_int( (8*N_int+5)*N_det + N_det_alpha_unique + 4*N_int*N_det_selectors)
rss += memory_of_double(mo_num*mo_num*(N_states+1))
PROVIDE psi_bilinear_matrix_columns_loc psi_det_alpha_unique psi_det_beta_unique
PROVIDE psi_bilinear_matrix_rows psi_det_sorted_order psi_bilinear_matrix_order
PROVIDE psi_bilinear_matrix_transp_rows_loc psi_bilinear_matrix_transp_columns
PROVIDE psi_bilinear_matrix_transp_order psi_selectors_coef_transp
rss = memory_of_double( &
N_int*2*N_det & ! preinteresting_det
+ N_int*2*N_det & ! fullminilist
+ N_int*2*N_det_selectors & ! minilist
+ N_states*mo_num*mo_num & ! mat
) + memory_of_int( &
+ (N_det+1)*2 & ! preinteresting, prefullinteresting,
+ (N_det+1)*2 & ! interesting, fullinteresting
+ mo_num*mo_num/2 & ! banned
+ mo_num/2 & ! bannedOrb
)
call check_mem(rss,irp_here)
allocate (preinteresting_det(N_int,2,N_det))
monoAdo = .true.
@ -200,11 +202,6 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d
allocate (indices(N_det), &
exc_degree(max(N_det_alpha_unique,N_det_beta_unique)))
PROVIDE psi_bilinear_matrix_columns_loc psi_det_alpha_unique psi_det_beta_unique
PROVIDE psi_bilinear_matrix_rows psi_det_sorted_order psi_bilinear_matrix_order
PROVIDE psi_bilinear_matrix_transp_rows_loc psi_bilinear_matrix_transp_columns
PROVIDE psi_bilinear_matrix_transp_order
k=1
do i=1,N_det_alpha_unique
call get_excitation_degree_spin(psi_det_alpha_unique(1,i), &
@ -561,11 +558,11 @@ subroutine fill_buffer_double(i_generator, sp, h1, h2, bannedOrb, banned, fock_d
variance(istate) = variance(istate) + alpha_h_psi * alpha_h_psi
norm(istate) = norm(istate) + coef * coef
if (h0_type == "Variance") then
sum_e_pert = sum_e_pert - alpha_h_psi * alpha_h_psi * selection_weight(istate)
else
! if (h0_type == "Variance") then
! sum_e_pert = sum_e_pert - alpha_h_psi * alpha_h_psi * selection_weight(istate)
! else
sum_e_pert = sum_e_pert + e_pert * selection_weight(istate)
endif
! endif
end do
if(sum_e_pert <= buf%mini) then
@ -590,7 +587,7 @@ subroutine splash_pq(mask, sp, det, i_gen, N_sel, bannedOrb, banned, mat, intere
integer(bit_kind) :: perMask(N_int, 2), mobMask(N_int, 2), negMask(N_int, 2)
integer(bit_kind) :: phasemask(N_int,2)
PROVIDE psi_selectors_coef_transp
PROVIDE psi_selectors_coef_transp psi_det_sorted
mat = 0d0
do i=1,N_int

View File

@ -9,7 +9,7 @@ subroutine run_stochastic_cipsi
double precision :: rss
double precision, external :: memory_of_double
threshold_generators = 1.d0
threshold_generators = 2.d0
SOFT_TOUCH threshold_generators
rss = memory_of_double(N_states)*4.d0

View File

@ -36,9 +36,9 @@ default: True
[used_weight]
type: integer
doc: 0: 1./(c_0^2), 1: 1/N_states, 2: input state-average weight, 3: 1/(Norm_L3(Psi))
doc: Weight used in the calculation of the one-electron density matrix. 0: 1./(c_0^2), 1: 1/N_states, 2: input state-average weight, 3: 1/(Norm_L3(Psi))
interface: ezfio,provider,ocaml
default: 0
default: 1
[threshold_generators]
type: Threshold

View File

@ -24,9 +24,4 @@ doc: The selection process stops at a fixed correlation ratio (useful for gettin
interface: ezfio,provider,ocaml
default: 1.00
[h0_type]
type: Perturbation
doc: Type of zeroth-order Hamiltonian [ EN | Barycentric | Variance | SOP ]
interface: ezfio,provider,ocaml
default: EN

View File

@ -0,0 +1,12 @@
BEGIN_PROVIDER [ character*32,h0_type ]
implicit none
BEGIN_DOC
! Type of zeroth-order Hamiltonian
END_DOC
if (s2_eig) then
h0_type = 'SOP'
else
h0_type = 'EN'
endif
END_PROVIDER