From ca3b0e98251e0df27396c7744495da8850e25296 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 7 Mar 2018 19:45:52 +0100 Subject: [PATCH 01/96] Trying to fix jbuilder bug in OCaml installation --- install/scripts/install_ocaml.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/scripts/install_ocaml.sh b/install/scripts/install_ocaml.sh index 9e8a2b25..91099fa2 100755 --- a/install/scripts/install_ocaml.sh +++ b/install/scripts/install_ocaml.sh @@ -5,7 +5,7 @@ QP_ROOT=$PWD cd - # Normal installation -PACKAGES="core.v0.10.0 cryptokit ocamlfind sexplib.v0.10.0 ZMQ ppx_sexp_conv ppx_deriving" +PACKAGES="core.v0.10.0 cryptokit ocamlfind sexplib.v0.10.0 ZMQ ppx_sexp_conv ppx_deriving jbuilder.1.0+beta17" # Needed for ZeroMQ export C_INCLUDE_PATH="${QP_ROOT}"/include:"${C_INCLUDE_PATH}" From 4e55e362609641aa7db8abe914734494da53986d Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 7 May 2018 15:21:28 +0200 Subject: [PATCH 02/96] Barycentric --- plugins/DavidsonDressed/diagonalize_CI.irp.f | 4 +-- plugins/dress_zmq/dress_general.irp.f | 11 ++++---- plugins/dress_zmq/dressing.irp.f | 2 +- plugins/dress_zmq/dressing_vector.irp.f | 6 ---- plugins/dress_zmq/energy.irp.f | 19 ++++++++++--- plugins/shiftedbk/shifted_bk_routines.irp.f | 22 ++------------- .../diagonalization_hs2_dressed.irp.f | 28 +++++++++---------- src/Determinants/slater_rules.irp.f | 17 +++++------ 8 files changed, 48 insertions(+), 61 deletions(-) diff --git a/plugins/DavidsonDressed/diagonalize_CI.irp.f b/plugins/DavidsonDressed/diagonalize_CI.irp.f index 2ee540e2..ddea2950 100644 --- a/plugins/DavidsonDressed/diagonalize_CI.irp.f +++ b/plugins/DavidsonDressed/diagonalize_CI.irp.f @@ -63,8 +63,8 @@ END_PROVIDER call davidson_diag_HS2(psi_det,CI_eigenvectors_dressed, CI_eigenvectors_s2_dressed,& size(CI_eigenvectors_dressed,1), CI_electronic_energy_dressed,& N_det,min(N_det,N_states),min(N_det,N_states_diag),N_int,1) - call u_0_S2_u_0(CI_eigenvectors_s2_dressed,CI_eigenvectors_dressed,N_det,psi_det,N_int,& - N_states_diag,size(CI_eigenvectors_dressed,1)) +! call u_0_S2_u_0(CI_eigenvectors_s2_dressed,CI_eigenvectors_dressed,N_det,psi_det,N_int,& +! N_states_diag,size(CI_eigenvectors_dressed,1)) else if (diag_algorithm == "Lapack") then diff --git a/plugins/dress_zmq/dress_general.irp.f b/plugins/dress_zmq/dress_general.irp.f index 068d811e..731011e3 100644 --- a/plugins/dress_zmq/dress_general.irp.f +++ b/plugins/dress_zmq/dress_general.irp.f @@ -29,27 +29,26 @@ subroutine run_dressing(N_st,energy) E_new = 0.d0 delta_E = 1.d0 iteration = 0 - do while (delta_E > thresh_dress) - iteration += 1 + do iteration=1,n_it_dress_max print *, '===============================================' print *, 'Iteration', iteration, '/', n_it_dress_max print *, '===============================================' print *, '' - E_old = dress_e0_denominator(1) !sum(ci_energy_dressed(1:N_states)) + E_old = sum(psi_energy(:)) do i=1,N_st call write_double(6,ci_energy_dressed(i),"Energy") enddo call diagonalize_ci_dressed - E_new = dress_e0_denominator(1) !sum(ci_energy_dressed(1:N_states)) + E_new = sum(psi_energy(:)) delta_E = (E_new - E_old)/dble(N_states) print *, '' call write_double(6,thresh_dress,"thresh_dress") - call write_double(6,delta_E,"delta_E") + call write_double(6,delta_E,"delta_E (undressed)") delta_E = dabs(delta_E) call save_wavefunction ! call ezfio_set_dress_zmq_energy(ci_energy_dressed(1)) - if (iteration >= n_it_dress_max) then + if (delta_E < thresh_dress) then exit endif enddo diff --git a/plugins/dress_zmq/dressing.irp.f b/plugins/dress_zmq/dressing.irp.f index 0c15ee0b..928c72c5 100644 --- a/plugins/dress_zmq/dressing.irp.f +++ b/plugins/dress_zmq/dressing.irp.f @@ -78,7 +78,7 @@ BEGIN_PROVIDER [ double precision, delta_ij, (N_states,N_det,2) ] delta_ij = 0d0 - E_CI_before(:) = dress_E0_denominator(:) + nuclear_repulsion + E_CI_before(:) = psi_energy(:) + nuclear_repulsion threshold_selectors = 1.d0 threshold_generators = 1d0 ! if(errr /= 0d0) then diff --git a/plugins/dress_zmq/dressing_vector.irp.f b/plugins/dress_zmq/dressing_vector.irp.f index 5a8fee3b..e098cf78 100644 --- a/plugins/dress_zmq/dressing_vector.irp.f +++ b/plugins/dress_zmq/dressing_vector.irp.f @@ -18,12 +18,6 @@ dressing_column_h(j,k) = delta_ij(k,j,1) dressing_column_s(j,k) = delta_ij(k,j,2) enddo -! tmp = u_dot_v(dressing_column_h(1,k), psi_coef(1,k), N_det) & -! - dressing_column_h(l,k) * psi_coef(l,k) -! 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) * psi_coef(l,k) -! dressing_column_s(l,k) -= tmp * f enddo END_PROVIDER diff --git a/plugins/dress_zmq/energy.irp.f b/plugins/dress_zmq/energy.irp.f index b8948219..7e223a2e 100644 --- a/plugins/dress_zmq/energy.irp.f +++ b/plugins/dress_zmq/energy.irp.f @@ -13,13 +13,24 @@ BEGIN_PROVIDER [ double precision, dress_E0_denominator, (N_states) ] END_DOC integer :: i if (initialize_dress_E0_denominator) then - call u_0_H_u_0(dress_E0_denominator,psi_coef,N_det,psi_det,N_int,N_states,size(psi_coef,1)) - do i=N_det+1,N_states - dress_E0_denominator(i) = 0.d0 - enddo + if (h0_type == "EN") then + dress_E0_denominator(1:N_states) = psi_energy(1:N_states) + else if (h0_type == "Barycentric") then +! dress_E0_denominator(1:N_states) = barycentric_electronic_energy(1:N_states) + dress_E0_denominator(1:N_states) = minval(diagonal_H_matrix_on_psi_det(1:N_det)) + else + print *, h0_type, ' not implemented' + stop + endif +! call u_0_H_u_0(dress_E0_denominator,psi_coef,N_det,psi_det,N_int,N_states,size(psi_coef,1)) +! do i=N_det+1,N_states +! dress_E0_denominator(i) = 0.d0 +! enddo call write_double(6,dress_E0_denominator(1)+nuclear_repulsion, 'dress Energy denominator') else dress_E0_denominator = -huge(1.d0) endif END_PROVIDER + + diff --git a/plugins/shiftedbk/shifted_bk_routines.irp.f b/plugins/shiftedbk/shifted_bk_routines.irp.f index e88d153c..80383e39 100644 --- a/plugins/shiftedbk/shifted_bk_routines.irp.f +++ b/plugins/shiftedbk/shifted_bk_routines.irp.f @@ -4,6 +4,7 @@ &BEGIN_PROVIDER [ double precision, a_s2_i, (N_det, Nproc) ] implicit none current_generator_(:) = 0 + fock_diag_tmp_(:,:,:) = 0.d0 a_h_i = 0d0 a_s2_i = 0d0 END_PROVIDER @@ -52,7 +53,7 @@ subroutine dress_with_alpha_buffer(Nstates,Ndet,Nint,delta_ij_loc, i_gen, minili do i=1,Nstates - de = E0_denominator(i) - haa + de = dress_E0_denominator(i) - haa if(DABS(de) < 1D-5) cycle c_alpha = a_h_psi(i) / de @@ -76,23 +77,4 @@ BEGIN_PROVIDER [ logical, initialize_E0_denominator ] 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 - if (h0_type == "EN") then - E0_denominator(1:N_states) = psi_energy(1:N_states) - else if (h0_type == "Barycentric") then - E0_denominator(1:N_states) = barycentric_electronic_energy(1:N_states) - else - print *, h0_type, ' not implemented' - stop - endif - else - E0_denominator = -huge(1.d0) - endif -END_PROVIDER - diff --git a/src/Davidson/diagonalization_hs2_dressed.irp.f b/src/Davidson/diagonalization_hs2_dressed.irp.f index 59e9c9fe..c57312a9 100644 --- a/src/Davidson/diagonalization_hs2_dressed.irp.f +++ b/src/Davidson/diagonalization_hs2_dressed.irp.f @@ -35,7 +35,7 @@ subroutine davidson_diag_hs2(dets_in,u_in,s2_out,dim_in,energies,sze,N_st,N_st_d double precision, intent(inout) :: u_in(dim_in,N_st_diag) double precision, intent(out) :: energies(N_st_diag), s2_out(N_st_diag) integer, intent(in) :: dressing_state - double precision, allocatable :: H_jj(:), S2_jj(:) + double precision, allocatable :: H_jj(:) double precision, external :: diag_H_mat_elem, diag_S_mat_elem integer :: i,k @@ -44,7 +44,7 @@ subroutine davidson_diag_hs2(dets_in,u_in,s2_out,dim_in,energies,sze,N_st,N_st_d ASSERT (Nint > 0) ASSERT (Nint == N_int) PROVIDE mo_bielec_integrals_in_map - allocate(H_jj(sze),S2_jj(sze)) + allocate(H_jj(sze)) H_jj(1) = diag_h_mat_elem(dets_in(1,1,1),Nint) !$OMP PARALLEL DEFAULT(NONE) & @@ -60,13 +60,13 @@ subroutine davidson_diag_hs2(dets_in,u_in,s2_out,dim_in,energies,sze,N_st,N_st_d if (dressing_state > 0) then do k=1,N_st do i=1,sze - H_jj(i) += u_in(i,k) * dressing_column_h(i,k) + H_jj(i) += u_in(i,k) * dressing_column_h(i,k) enddo enddo endif call davidson_diag_hjj_sjj(dets_in,u_in,H_jj,S2_out,energies,dim_in,sze,N_st,N_st_diag,Nint,dressing_state) - deallocate (H_jj,S2_jj) + deallocate (H_jj) end @@ -254,9 +254,9 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_ dressing_column_h, size(dressing_column_h,1), s_tmp, size(s_tmp,1), & 1.d0, W(1,shift+1), size(W,1)) - call dgemm('N','N', sze, N_st_diag, N_st, 0.5d0, & - dressing_column_s, size(dressing_column_s,1), s_tmp, size(s_tmp,1), & - 1.d0, S(1,shift+1), size(S,1)) +! call dgemm('N','N', sze, N_st_diag, N_st, 0.5d0, & +! dressing_column_s, size(dressing_column_s,1), s_tmp, size(s_tmp,1), & +! 1.d0, S(1,shift+1), size(S,1)) call dgemm('T','N', N_st, N_st_diag, sze, 1.d0, & @@ -267,13 +267,13 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_ psi_coef, size(psi_coef,1), s_tmp, size(s_tmp,1), & 1.d0, W(1,shift+1), size(W,1)) - call dgemm('T','N', N_st, N_st_diag, sze, 1.d0, & - dressing_column_s, size(dressing_column_s,1), & - U(1,shift+1), size(U,1), 0.d0, s_tmp, size(s_tmp,1)) - - call dgemm('N','N', sze, N_st_diag, N_st, 0.5d0, & - psi_coef, size(psi_coef,1), s_tmp, size(s_tmp,1), & - 1.d0, S(1,shift+1), size(S,1)) +! call dgemm('T','N', N_st, N_st_diag, sze, 1.d0, & +! dressing_column_s, size(dressing_column_s,1), & +! U(1,shift+1), size(U,1), 0.d0, s_tmp, size(s_tmp,1)) +! +! call dgemm('N','N', sze, N_st_diag, N_st, 0.5d0, & +! psi_coef, size(psi_coef,1), s_tmp, size(s_tmp,1), & +! 1.d0, S(1,shift+1), size(S,1)) endif diff --git a/src/Determinants/slater_rules.irp.f b/src/Determinants/slater_rules.irp.f index ee597720..a3120be9 100644 --- a/src/Determinants/slater_rules.irp.f +++ b/src/Determinants/slater_rules.irp.f @@ -509,11 +509,12 @@ subroutine i_H_j_s2(key_i,key_j,Nint,hij,s2) select case (degree) case (2) call get_double_excitation(key_i,key_j,exc,phase,Nint) - + ! Mono alpha, mono beta if (exc(0,1,1) == 1) then - ! Mono alpha, mono beta + if ( (exc(1,1,1) == exc(1,2,2)).and.(exc(1,1,2) == exc(1,2,1)) ) then + s2 = -phase + endif if(exc(1,1,1) == exc(1,2,2) )then - if(exc(1,1,2) == exc(1,2,1)) s2 = -phase !!!!! hij = phase * big_array_exchange_integrals(exc(1,1,1),exc(1,1,2),exc(1,2,1)) else if (exc(1,2,1) ==exc(1,1,2))then hij = phase * big_array_exchange_integrals(exc(1,2,1),exc(1,1,1),exc(1,2,2)) @@ -524,8 +525,8 @@ subroutine i_H_j_s2(key_i,key_j,Nint,hij,s2) exc(1,2,1), & exc(1,2,2) ,mo_integrals_map) endif + ! Double alpha else if (exc(0,1,1) == 2) then - ! Double alpha hij = phase*(get_mo_bielec_integral( & exc(1,1,1), & exc(2,1,1), & @@ -536,8 +537,8 @@ subroutine i_H_j_s2(key_i,key_j,Nint,hij,s2) exc(2,1,1), & exc(2,2,1), & exc(1,2,1) ,mo_integrals_map) ) + ! Double beta else if (exc(0,1,2) == 2) then - ! Double beta hij = phase*(get_mo_bielec_integral( & exc(1,1,2), & exc(2,1,2), & @@ -553,13 +554,13 @@ subroutine i_H_j_s2(key_i,key_j,Nint,hij,s2) call get_mono_excitation(key_i,key_j,exc,phase,Nint) !DIR$ FORCEINLINE call bitstring_to_list_ab(key_i, occ, n_occ_ab, Nint) + ! Mono alpha if (exc(0,1,1) == 1) then - ! Mono alpha m = exc(1,1,1) p = exc(1,2,1) spin = 1 + ! Mono beta else - ! Mono beta m = exc(1,1,2) p = exc(1,2,2) spin = 2 @@ -567,7 +568,7 @@ subroutine i_H_j_s2(key_i,key_j,Nint,hij,s2) call get_mono_excitation_from_fock(key_i,key_j,p,m,spin,phase,hij) case (0) - print *," ZERO" + print *,irp_here,": ZERO" double precision, external :: diag_S_mat_elem s2 = diag_S_mat_elem(key_i,Nint) hij = diag_H_mat_elem(key_i,Nint) From 8ee9f7ed9b6a348ae9835309aca8ea8d784fcfe0 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 7 May 2018 15:51:02 +0200 Subject: [PATCH 03/96] truncate_wf_spin --- plugins/Bk/dressing.irp.f | 2 + plugins/QMC/truncate_wf_spin.irp.f | 83 ++++++++++---------- plugins/dress_zmq/dress_stoch_routines.irp.f | 2 +- 3 files changed, 44 insertions(+), 43 deletions(-) diff --git a/plugins/Bk/dressing.irp.f b/plugins/Bk/dressing.irp.f index 0fbefda5..d0e7c2d3 100644 --- a/plugins/Bk/dressing.irp.f +++ b/plugins/Bk/dressing.irp.f @@ -53,7 +53,9 @@ subroutine dress_with_alpha_buffer(Nstates,Ndet,Nint,delta_ij_loc, i_gen, minili do i_state=1,N_states hdress = c_alpha(i_state) * i_h_alpha sdress = c_alpha(i_state) * i_s_alpha + !$OMP ATOMIC delta_ij_loc(i_state,j,1) = delta_ij_loc(i_state,j,1) + hdress + !$OMP ATOMIC delta_ij_loc(i_state,j,2) = delta_ij_loc(i_state,j,2) + sdress enddo enddo diff --git a/plugins/QMC/truncate_wf_spin.irp.f b/plugins/QMC/truncate_wf_spin.irp.f index 68e903c1..585171d0 100644 --- a/plugins/QMC/truncate_wf_spin.irp.f +++ b/plugins/QMC/truncate_wf_spin.irp.f @@ -65,53 +65,52 @@ subroutine run enddo !$OMP END PARALLEL DO endif - if (ci_threshold > norm_sort(j)) then - cycle + if (ci_threshold <= norm_sort(j)) then + exit endif - - u_0(1:N_det,1:N_states) = psi_bilinear_matrix_values(1:N_det,1:N_states) - v_0(1:N_det,1:N_states) = 0.d0 - u_t(1:N_states,1:N_det) = 0.d0 - v_t(1:N_states,1:N_det) = 0.d0 - s_t(1:N_states,1:N_det) = 0.d0 - call dtranspose( & - u_0, & - size(u_0, 1), & - u_t, & - size(u_t, 1), & - N_det, N_states) - print *, 'Computing H|Psi> ...' - call H_S2_u_0_nstates_openmp_work(v_t,s_t,u_t,N_states,N_det,1,N_det,0,1) - print *, 'Done' - call dtranspose( & - v_t, & - size(v_t, 1), & - v_0, & - size(v_0, 1), & - N_states, N_det) - - double precision, external :: u_dot_u, u_dot_v - do i=1,N_states - e_0(i) = u_dot_v(u_0(1,i),v_0(1,i),N_det)/u_dot_u(u_0(1,i),N_det) - print *, 'E = ', e_0(i) + nuclear_repulsion - enddo - - m = 0 - do k=1,n_det - if (sum(psi_bilinear_matrix_values(k,1:N_states)) /= 0.d0) then - m = m+1 - endif - enddo - - do k=1,N_states - E = E_0(k) + nuclear_repulsion - enddo - print *, 'Number of determinants:', m - exit enddo + + m = 0 + do k=1,n_det + if (sum(psi_bilinear_matrix_values(k,1:N_states)) /= 0.d0) then + m = m+1 + endif + enddo + + do k=1,N_states + E = E_0(k) + nuclear_repulsion + enddo + print *, 'Number of determinants:', m call wf_of_psi_bilinear_matrix(.True.) call save_wavefunction + u_0(1:N_det,1:N_states) = psi_bilinear_matrix_values(1:N_det,1:N_states) + v_0(1:N_det,1:N_states) = 0.d0 + u_t(1:N_states,1:N_det) = 0.d0 + v_t(1:N_states,1:N_det) = 0.d0 + s_t(1:N_states,1:N_det) = 0.d0 + call dtranspose( & + u_0, & + size(u_0, 1), & + u_t, & + size(u_t, 1), & + N_det, N_states) + print *, 'Computing H|Psi> ...' + call H_S2_u_0_nstates_openmp_work(v_t,s_t,u_t,N_states,N_det,1,N_det,0,1) + print *, 'Done' + call dtranspose( & + v_t, & + size(v_t, 1), & + v_0, & + size(v_0, 1), & + N_states, N_det) + + double precision, external :: u_dot_u, u_dot_v + do i=1,N_states + e_0(i) = u_dot_v(u_0(1,i),v_0(1,i),N_det)/u_dot_u(u_0(1,i),N_det) + print *, 'E(',i,') = ', e_0(i) + nuclear_repulsion + enddo + deallocate (iorder, norm_sort) end diff --git a/plugins/dress_zmq/dress_stoch_routines.irp.f b/plugins/dress_zmq/dress_stoch_routines.irp.f index f1406b7b..6bee7256 100644 --- a/plugins/dress_zmq/dress_stoch_routines.irp.f +++ b/plugins/dress_zmq/dress_stoch_routines.irp.f @@ -369,7 +369,7 @@ end function ! gen_per_cp : number of generators per checkpoint END_DOC comb_teeth = 64 - N_cps_max = 64 + N_cps_max = 256 gen_per_cp = (N_det_generators / N_cps_max) + 1 END_PROVIDER From c9865c6fde691fed742ec99d898f57ade50cfe5d Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 7 May 2018 15:52:14 +0200 Subject: [PATCH 04/96] Cleaning in mmap --- src/Utils/map_functions.irp.f | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Utils/map_functions.irp.f b/src/Utils/map_functions.irp.f index c7ea6938..6cad763b 100644 --- a/src/Utils/map_functions.irp.f +++ b/src/Utils/map_functions.irp.f @@ -9,6 +9,9 @@ subroutine map_save_to_disk(filename,map) integer*8 :: i,k integer :: j + integer*8 :: n_elements + n_elements = int(map % n_elements,8) + if (map % consolidated) then stop 'map already consolidated' @@ -17,11 +20,11 @@ subroutine map_save_to_disk(filename,map) call mmap(trim(filename)//'_consolidated_idx', (/ map % map_size + 2_8 /), 8, fd(1), .False., c_pointer(1)) call c_f_pointer(c_pointer(1),map % consolidated_idx, (/ map % map_size +2_8/)) - call mmap(trim(filename)//'_consolidated_key', (/ map % n_elements /), cache_key_kind, fd(2), .False., c_pointer(2)) - call c_f_pointer(c_pointer(2),map % consolidated_key, (/ map % n_elements /)) + call mmap(trim(filename)//'_consolidated_key', (/ n_elements /), cache_key_kind, fd(2), .False., c_pointer(2)) + call c_f_pointer(c_pointer(2),map % consolidated_key, (/ n_elements /)) - call mmap(trim(filename)//'_consolidated_value', (/ map % n_elements /), integral_kind, fd(3), .False., c_pointer(3)) - call c_f_pointer(c_pointer(3),map % consolidated_value, (/ map % n_elements /)) + call mmap(trim(filename)//'_consolidated_value', (/ n_elements /), integral_kind, fd(3), .False., c_pointer(3)) + call c_f_pointer(c_pointer(3),map % consolidated_value, (/ n_elements /)) if (.not.associated(map%consolidated_key)) then stop 'cannot consolidate map : consolidated_key not associated' @@ -52,9 +55,6 @@ subroutine map_save_to_disk(filename,map) map % consolidated_idx (map % map_size + 2_8) = k map % consolidated = .True. - integer*8 :: n_elements - n_elements = int(map % n_elements,8) - print *, 'Writing data to disk...' call msync ( (/ map % map_size + 2_8 /), 8, fd(1), c_pointer(1)) call msync ( (/ n_elements /), cache_key_kind, fd(2), c_pointer(2)) From 8461e74ed006f446b1275411c3ec24b9a807cbe0 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 7 May 2018 23:26:33 +0200 Subject: [PATCH 05/96] Fixed reading MOs --- plugins/Bk/EZFIO.cfg | 6 ++++++ src/Utils/fortran_mmap.c | 2 +- src/Utils/map_functions.irp.f | 22 ++++++++++++++-------- src/ZMQ/utils.irp.f | 14 +++++++------- 4 files changed, 28 insertions(+), 16 deletions(-) diff --git a/plugins/Bk/EZFIO.cfg b/plugins/Bk/EZFIO.cfg index 52d41568..c594bcf8 100644 --- a/plugins/Bk/EZFIO.cfg +++ b/plugins/Bk/EZFIO.cfg @@ -15,3 +15,9 @@ doc: Maximum number of dressed CI iterations interface: ezfio,provider,ocaml default: 10 +[h0_type] +type: Perturbation +doc: Type of zeroth-order Hamiltonian [ EN | Barycentric ] +interface: ezfio,provider,ocaml +default: EN + diff --git a/src/Utils/fortran_mmap.c b/src/Utils/fortran_mmap.c index 41ad93ec..4ecffe56 100644 --- a/src/Utils/fortran_mmap.c +++ b/src/Utils/fortran_mmap.c @@ -33,7 +33,7 @@ void* mmap_fortran(char* filename, size_t bytes, int* file_descr, int read_only) exit(EXIT_FAILURE); } - result = lseek(fd, bytes, SEEK_SET); + result = lseek(fd, bytes+1, SEEK_SET); if (result == -1) { close(fd); printf("%s:\n", filename); diff --git a/src/Utils/map_functions.irp.f b/src/Utils/map_functions.irp.f index 6cad763b..88807fac 100644 --- a/src/Utils/map_functions.irp.f +++ b/src/Utils/map_functions.irp.f @@ -74,6 +74,8 @@ subroutine map_load_from_disk(filename,map) integer :: fd(3) integer*8 :: i,k,l integer*4 :: j,n_elements + integer(cache_key_kind), pointer :: key_p(:) + real(integral_kind), pointer :: value_p(:) if (map % consolidated) then stop 'map already consolidated' @@ -96,21 +98,25 @@ subroutine map_load_from_disk(filename,map) do i=0_8, map % map_size deallocate(map % map(i) % value) deallocate(map % map(i) % key) - map % map(i) % value => map % consolidated_value ( map % consolidated_idx (i+1_8) :) - map % map(i) % key => map % consolidated_key ( map % consolidated_idx (i+1_8) :) - map % map(i) % sorted = .True. - n_elements = int( map % consolidated_idx (i+2_8) - k, 4) k = map % consolidated_idx (i+2_8) + l = map % consolidated_idx (i+1_8) + n_elements = int(k - l, 4) + key_p => map % consolidated_key (l:l+n_elements) + value_p => map % consolidated_value ( l:l+n_elements ) + print *, i, n_elements + map % map(i) % key => key_p + map % map(i) % value => value_p + map % map(i) % sorted = .True. map % map(i) % map_size = n_elements map % map(i) % n_elements = n_elements ! Load memory from disk do j=1,n_elements - x = x + map % map(i) % value(j) - l = iand(l,int(map % map(i) % key(j),8)) - if (map % map(i) % value(j) > 1.e30) then + x = x + value_p(j) + l = iand(l,int(key_p(j),8)) + if (value_p(j) > 1.e30) then stop 'Error in integrals file' endif - if (map % map(i) % key(j) < 0) then + if (key_p(j) < 0) then stop 'Error in integrals file' endif enddo diff --git a/src/ZMQ/utils.irp.f b/src/ZMQ/utils.irp.f index fac7470c..86c4a3ee 100644 --- a/src/ZMQ/utils.irp.f +++ b/src/ZMQ/utils.irp.f @@ -148,12 +148,12 @@ function new_zmq_to_qp_run_socket() stop 'Unable to create zmq req socket' endif - rc = f77_zmq_setsockopt(new_zmq_to_qp_run_socket, ZMQ_SNDTIMEO, 30000, 4) + rc = f77_zmq_setsockopt(new_zmq_to_qp_run_socket, ZMQ_SNDTIMEO, 60000, 4) if (rc /= 0) then stop 'Unable to set send timeout in new_zmq_to_qp_run_socket' endif - rc = f77_zmq_setsockopt(new_zmq_to_qp_run_socket, ZMQ_RCVTIMEO, 30000, 4) + rc = f77_zmq_setsockopt(new_zmq_to_qp_run_socket, ZMQ_RCVTIMEO, 60000, 4) if (rc /= 0) then stop 'Unable to set recv timeout in new_zmq_to_qp_run_socket' endif @@ -250,7 +250,7 @@ IRP_ENDIF stop 'Unable to create zmq pull socket' endif - rc = f77_zmq_setsockopt(new_zmq_pull_socket,ZMQ_LINGER,30000,4) + rc = f77_zmq_setsockopt(new_zmq_pull_socket,ZMQ_LINGER,60000,4) if (rc /= 0) then stop 'Unable to set ZMQ_LINGER on pull socket' endif @@ -332,7 +332,7 @@ IRP_ENDIF stop 'Unable to create zmq push socket' endif - rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_LINGER,30000,4) + rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_LINGER,60000,4) if (rc /= 0) then stop 'Unable to set ZMQ_LINGER on push socket' endif @@ -352,7 +352,7 @@ IRP_ENDIF stop 'Unable to set ZMQ_IMMEDIATE on push socket' endif - rc = f77_zmq_setsockopt(new_zmq_push_socket, ZMQ_SNDTIMEO, 30000, 4) + rc = f77_zmq_setsockopt(new_zmq_push_socket, ZMQ_SNDTIMEO, 60000, 4) if (rc /= 0) then stop 'Unable to set send timout in new_zmq_push_socket' endif @@ -488,7 +488,7 @@ subroutine end_zmq_push_socket(zmq_socket_push,thread) integer :: rc character*(8), external :: zmq_port - rc = f77_zmq_setsockopt(zmq_socket_push,ZMQ_LINGER,30000,4) + rc = f77_zmq_setsockopt(zmq_socket_push,ZMQ_LINGER,60000,4) if (rc /= 0) then stop 'Unable to set ZMQ_LINGER on push socket' endif @@ -1019,7 +1019,7 @@ subroutine end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) character*(8), external :: zmq_port integer :: rc - rc = f77_zmq_setsockopt(zmq_to_qp_run_socket,ZMQ_LINGER,30000,4) + rc = f77_zmq_setsockopt(zmq_to_qp_run_socket,ZMQ_LINGER,60000,4) if (rc /= 0) then stop 'Unable to set ZMQ_LINGER on zmq_to_qp_run_socket' endif From 548aa4f2fb7b19c03da4e65c765c201b867fa02c Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Mon, 7 May 2018 16:37:07 -0500 Subject: [PATCH 06/96] Update README.md --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 52f949c3..39e05a4a 100644 --- a/README.md +++ b/README.md @@ -163,3 +163,6 @@ It's caused when we call the DGEMM routine of LAPACK. Set `ulimit -s unlimited`, before runing `qp_run`. It seems to fix the problem. +#### Error: f77zmq not symbol found + +In the Makefile of the f77zmq, you should NOT use ar but `libtool -static` From b6c3eccf7ed3a0fef0e7d7b87c696baaaa0c2431 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 7 May 2018 23:43:35 +0200 Subject: [PATCH 07/96] python2 --- plugins/pyscf/PyscfToQp.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/pyscf/PyscfToQp.py b/plugins/pyscf/PyscfToQp.py index 74ef951c..3fd650ac 100644 --- a/plugins/pyscf/PyscfToQp.py +++ b/plugins/pyscf/PyscfToQp.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python2 import numpy,re,sys From de60a016c898718e1cd5b8ad04b2443e2d212ca5 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 7 May 2018 23:44:58 +0200 Subject: [PATCH 08/96] Delete tree_dependency.png --- src/Davidson/tree_dependency.png | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/Davidson/tree_dependency.png diff --git a/src/Davidson/tree_dependency.png b/src/Davidson/tree_dependency.png deleted file mode 100644 index e69de29b..00000000 From 596cb71894038a6e9a886ed48cdf0a3f09a707ef Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 7 May 2018 23:26:33 +0200 Subject: [PATCH 09/96] Fixed reading MOs --- src/Utils/fortran_mmap.c | 2 +- src/Utils/map_functions.irp.f | 22 ++++++++++++++-------- src/ZMQ/utils.irp.f | 14 +++++++------- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/Utils/fortran_mmap.c b/src/Utils/fortran_mmap.c index 41ad93ec..4ecffe56 100644 --- a/src/Utils/fortran_mmap.c +++ b/src/Utils/fortran_mmap.c @@ -33,7 +33,7 @@ void* mmap_fortran(char* filename, size_t bytes, int* file_descr, int read_only) exit(EXIT_FAILURE); } - result = lseek(fd, bytes, SEEK_SET); + result = lseek(fd, bytes+1, SEEK_SET); if (result == -1) { close(fd); printf("%s:\n", filename); diff --git a/src/Utils/map_functions.irp.f b/src/Utils/map_functions.irp.f index c7ea6938..8c63f525 100644 --- a/src/Utils/map_functions.irp.f +++ b/src/Utils/map_functions.irp.f @@ -74,6 +74,8 @@ subroutine map_load_from_disk(filename,map) integer :: fd(3) integer*8 :: i,k,l integer*4 :: j,n_elements + integer(cache_key_kind), pointer :: key_p(:) + real(integral_kind), pointer :: value_p(:) if (map % consolidated) then stop 'map already consolidated' @@ -96,21 +98,25 @@ subroutine map_load_from_disk(filename,map) do i=0_8, map % map_size deallocate(map % map(i) % value) deallocate(map % map(i) % key) - map % map(i) % value => map % consolidated_value ( map % consolidated_idx (i+1_8) :) - map % map(i) % key => map % consolidated_key ( map % consolidated_idx (i+1_8) :) - map % map(i) % sorted = .True. - n_elements = int( map % consolidated_idx (i+2_8) - k, 4) k = map % consolidated_idx (i+2_8) + l = map % consolidated_idx (i+1_8) + n_elements = int(k - l, 4) + key_p => map % consolidated_key (l:l+n_elements) + value_p => map % consolidated_value ( l:l+n_elements ) + print *, i, n_elements + map % map(i) % key => key_p + map % map(i) % value => value_p + map % map(i) % sorted = .True. map % map(i) % map_size = n_elements map % map(i) % n_elements = n_elements ! Load memory from disk do j=1,n_elements - x = x + map % map(i) % value(j) - l = iand(l,int(map % map(i) % key(j),8)) - if (map % map(i) % value(j) > 1.e30) then + x = x + value_p(j) + l = iand(l,int(key_p(j),8)) + if (value_p(j) > 1.e30) then stop 'Error in integrals file' endif - if (map % map(i) % key(j) < 0) then + if (key_p(j) < 0) then stop 'Error in integrals file' endif enddo diff --git a/src/ZMQ/utils.irp.f b/src/ZMQ/utils.irp.f index 570cf30f..78b8abff 100644 --- a/src/ZMQ/utils.irp.f +++ b/src/ZMQ/utils.irp.f @@ -148,12 +148,12 @@ function new_zmq_to_qp_run_socket() stop 'Unable to create zmq req socket' endif - rc = f77_zmq_setsockopt(new_zmq_to_qp_run_socket, ZMQ_SNDTIMEO, 30000, 4) + rc = f77_zmq_setsockopt(new_zmq_to_qp_run_socket, ZMQ_SNDTIMEO, 60000, 4) if (rc /= 0) then stop 'Unable to set send timeout in new_zmq_to_qp_run_socket' endif - rc = f77_zmq_setsockopt(new_zmq_to_qp_run_socket, ZMQ_RCVTIMEO, 30000, 4) + rc = f77_zmq_setsockopt(new_zmq_to_qp_run_socket, ZMQ_RCVTIMEO, 60000, 4) if (rc /= 0) then stop 'Unable to set recv timeout in new_zmq_to_qp_run_socket' endif @@ -250,7 +250,7 @@ IRP_ENDIF stop 'Unable to create zmq pull socket' endif - rc = f77_zmq_setsockopt(new_zmq_pull_socket,ZMQ_LINGER,30000,4) + rc = f77_zmq_setsockopt(new_zmq_pull_socket,ZMQ_LINGER,60000,4) if (rc /= 0) then stop 'Unable to set ZMQ_LINGER on pull socket' endif @@ -332,7 +332,7 @@ IRP_ENDIF stop 'Unable to create zmq push socket' endif - rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_LINGER,30000,4) + rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_LINGER,60000,4) if (rc /= 0) then stop 'Unable to set ZMQ_LINGER on push socket' endif @@ -352,7 +352,7 @@ IRP_ENDIF stop 'Unable to set ZMQ_IMMEDIATE on push socket' endif - rc = f77_zmq_setsockopt(new_zmq_push_socket, ZMQ_SNDTIMEO, 30000, 4) + rc = f77_zmq_setsockopt(new_zmq_push_socket, ZMQ_SNDTIMEO, 60000, 4) if (rc /= 0) then stop 'Unable to set send timout in new_zmq_push_socket' endif @@ -488,7 +488,7 @@ subroutine end_zmq_push_socket(zmq_socket_push,thread) integer :: rc character*(8), external :: zmq_port - rc = f77_zmq_setsockopt(zmq_socket_push,ZMQ_LINGER,30000,4) + rc = f77_zmq_setsockopt(zmq_socket_push,ZMQ_LINGER,60000,4) if (rc /= 0) then stop 'Unable to set ZMQ_LINGER on push socket' endif @@ -1014,7 +1014,7 @@ subroutine end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) character*(8), external :: zmq_port integer :: rc - rc = f77_zmq_setsockopt(zmq_to_qp_run_socket,ZMQ_LINGER,30000,4) + rc = f77_zmq_setsockopt(zmq_to_qp_run_socket,ZMQ_LINGER,60000,4) if (rc /= 0) then stop 'Unable to set ZMQ_LINGER on zmq_to_qp_run_socket' endif From cfaebcfe995eab0c282097d2f2c3e1ef93c34f0e Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 9 May 2018 09:44:38 +0200 Subject: [PATCH 10/96] Removed print --- src/Utils/map_functions.irp.f | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Utils/map_functions.irp.f b/src/Utils/map_functions.irp.f index 88807fac..cf894893 100644 --- a/src/Utils/map_functions.irp.f +++ b/src/Utils/map_functions.irp.f @@ -103,7 +103,6 @@ subroutine map_load_from_disk(filename,map) n_elements = int(k - l, 4) key_p => map % consolidated_key (l:l+n_elements) value_p => map % consolidated_value ( l:l+n_elements ) - print *, i, n_elements map % map(i) % key => key_p map % map(i) % value => value_p map % map(i) % sorted = .True. From 1311fd72bd9519947354a190d556041c81fc02e4 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 9 May 2018 11:31:32 +0200 Subject: [PATCH 11/96] Changes for OCaml zmq-5.0 --- install/scripts/install_ocaml.sh | 2 +- ocaml/TaskServer.ml | 106 +++++++++--------- ocaml/_tags | 2 +- ocaml/qp_run.ml | 12 +- scripts/ezfio_interface/ei_handler.py | 2 +- .../qp_convert_output_to_ezfio.py | 2 +- 6 files changed, 63 insertions(+), 63 deletions(-) diff --git a/install/scripts/install_ocaml.sh b/install/scripts/install_ocaml.sh index 91099fa2..cf5ad505 100755 --- a/install/scripts/install_ocaml.sh +++ b/install/scripts/install_ocaml.sh @@ -5,7 +5,7 @@ QP_ROOT=$PWD cd - # Normal installation -PACKAGES="core.v0.10.0 cryptokit ocamlfind sexplib.v0.10.0 ZMQ ppx_sexp_conv ppx_deriving jbuilder.1.0+beta17" +PACKAGES="core.v0.10.0 cryptokit ocamlfind sexplib.v0.10.0 zmq ppx_sexp_conv ppx_deriving jbuilder.1.0+beta17" # Needed for ZeroMQ export C_INCLUDE_PATH="${QP_ROOT}"/include:"${C_INCLUDE_PATH}" diff --git a/ocaml/TaskServer.ml b/ocaml/TaskServer.ml index 170e011a..c7f969f1 100644 --- a/ocaml/TaskServer.ml +++ b/ocaml/TaskServer.ml @@ -47,10 +47,10 @@ let debug str = let zmq_context = - ZMQ.Context.create () + Zmq.Context.create () let () = - ZMQ.Context.set_io_threads zmq_context 8 + Zmq.Context.set_io_threads zmq_context 8 let bind_socket ~socket_type ~socket ~port = @@ -61,7 +61,7 @@ let bind_socket ~socket_type ~socket ~port = | -1 -> () | i -> try - ZMQ.Socket.bind socket @@ Printf.sprintf "tcp://*:%d" port; + Zmq.Socket.bind socket @@ Printf.sprintf "tcp://*:%d" port; loop (-1) with | Unix.Unix_error _ -> (Time.pause @@ Time.Span.of_sec 1. ; loop (i-1) ) @@ -105,31 +105,31 @@ let ip_address = lazy ( let reply_ok rep_socket = Message.Ok_msg.create |> Message.Ok_msg.to_string - |> ZMQ.Socket.send rep_socket + |> Zmq.Socket.send rep_socket let reply_wrong_state rep_socket = Message.Error_msg.create "Wrong state" |> Message.Error_msg.to_string - |> ZMQ.Socket.send rep_socket + |> Zmq.Socket.send rep_socket let stop ~port = debug "STOP"; let req_socket = - ZMQ.Socket.create zmq_context ZMQ.Socket.req + Zmq.Socket.create zmq_context Zmq.Socket.req and address = Printf.sprintf "tcp://localhost:%d" port in - ZMQ.Socket.set_linger_period req_socket 1_000_000; - ZMQ.Socket.connect req_socket address; + Zmq.Socket.set_linger_period req_socket 1_000_000; + Zmq.Socket.connect req_socket address; Message.Terminate (Message.Terminate_msg.create) |> Message.to_string - |> ZMQ.Socket.send req_socket ; + |> Zmq.Socket.send req_socket ; let msg = - ZMQ.Socket.recv req_socket + Zmq.Socket.recv req_socket |> Message.of_string in let () = @@ -137,8 +137,8 @@ let stop ~port = | Message.Ok _ -> () | _ -> failwith "Problem in termination" in - ZMQ.Socket.set_linger_period req_socket 1_000; - ZMQ.Socket.close req_socket + Zmq.Socket.set_linger_period req_socket 1_000; + Zmq.Socket.close req_socket let new_job msg program_state rep_socket pair_socket = @@ -166,7 +166,7 @@ let new_job msg program_state rep_socket pair_socket = in reply_ok rep_socket; string_of_pub_state Waiting - |> ZMQ.Socket.send pair_socket ; + |> Zmq.Socket.send pair_socket ; result let change_pub_state msg program_state rep_socket pair_socket = @@ -186,7 +186,7 @@ let change_pub_state msg program_state rep_socket pair_socket = in reply_ok rep_socket; string_of_pub_state msg - |> ZMQ.Socket.send pair_socket ; + |> Zmq.Socket.send pair_socket ; program_state @@ -216,7 +216,7 @@ let end_job msg program_state rep_socket pair_socket = Printf.sprintf "waiting for %d slaves..." n |> Message.Error_msg.create |> Message.Error_msg.to_string - |> ZMQ.Socket.send rep_socket ; + |> Zmq.Socket.send rep_socket ; program_state in @@ -227,13 +227,13 @@ let end_job msg program_state rep_socket pair_socket = if (msg.Message.Endjob_msg.state = force_state) then begin string_of_pub_state Waiting - |> ZMQ.Socket.send pair_socket ; + |> Zmq.Socket.send pair_socket ; success () end else if (msg.Message.Endjob_msg.state = state) then begin string_of_pub_state Waiting - |> ZMQ.Socket.send pair_socket ; + |> Zmq.Socket.send pair_socket ; if (Queuing_system.number_of_clients program_state.queue = 0) then success () else @@ -280,7 +280,7 @@ let connect msg program_state rep_socket = Message.ConnectReply (Message.ConnectReply_msg.create ~state:state ~client_id ~push_address) |> Message.to_string - |> ZMQ.Socket.send rep_socket ; + |> Zmq.Socket.send rep_socket ; { program_state with queue = new_queue } @@ -306,7 +306,7 @@ let disconnect msg program_state rep_socket = in Message.DisconnectReply (Message.DisconnectReply_msg.create ~state) |> Message.to_string - |> ZMQ.Socket.send rep_socket ; + |> Zmq.Socket.send rep_socket ; new_program_state in @@ -352,7 +352,7 @@ let del_task msg program_state rep_socket = in Message.DelTaskReply (Message.DelTaskReply_msg.create ~task_ids ~more) |> Message.to_string - |> ZMQ.Socket.send ~block:true rep_socket ; (** /!\ Has to be blocking *) + |> Zmq.Socket.send ~block:true rep_socket ; (** /!\ Has to be blocking *) new_program_state in @@ -426,10 +426,10 @@ let get_task msg program_state rep_socket pair_socket = if no_task then string_of_pub_state Waiting - |> ZMQ.Socket.send pair_socket + |> Zmq.Socket.send pair_socket else string_of_pub_state (Running (Message.State.to_string state)) - |> ZMQ.Socket.send pair_socket; + |> Zmq.Socket.send pair_socket; let new_program_state = { program_state with @@ -440,7 +440,7 @@ let get_task msg program_state rep_socket pair_socket = Message.GetTaskReply (Message.GetTaskReply_msg.create ~task ~task_id) |> Message.to_string - |> ZMQ.Socket.send rep_socket ; + |> Zmq.Socket.send rep_socket ; new_program_state in @@ -498,10 +498,10 @@ let get_tasks msg program_state rep_socket pair_socket = if no_task then string_of_pub_state Waiting - |> ZMQ.Socket.send pair_socket + |> Zmq.Socket.send pair_socket else string_of_pub_state (Running (Message.State.to_string state)) - |> ZMQ.Socket.send pair_socket; + |> Zmq.Socket.send pair_socket; let new_program_state = { program_state with @@ -512,7 +512,7 @@ let get_tasks msg program_state rep_socket pair_socket = Message.GetTasksReply (Message.GetTasksReply_msg.create result) |> Message.to_string_list - |> ZMQ.Socket.send_all rep_socket ; + |> Zmq.Socket.send_all rep_socket ; new_program_state in @@ -596,7 +596,7 @@ let put_data msg rest_of_msg program_state rep_socket = StringHashtbl.set program_state.data ~key ~data:value ; Message.PutDataReply (Message.PutDataReply_msg.create ()) |> Message.to_string - |> ZMQ.Socket.send rep_socket; + |> Zmq.Socket.send rep_socket; program_state and failure () = @@ -629,7 +629,7 @@ let get_data msg program_state rep_socket = in Message.GetDataReply (Message.GetDataReply_msg.create ~value) |> Message.to_string_list - |> ZMQ.Socket.send_all rep_socket; + |> Zmq.Socket.send_all rep_socket; program_state and failure () = @@ -699,7 +699,7 @@ let abort program_state rep_socket = let error msg program_state rep_socket = Message.Error (Message.Error_msg.create msg) |> Message.to_string - |> ZMQ.Socket.send rep_socket ; + |> Zmq.Socket.send rep_socket ; program_state let start_pub_thread ~port = @@ -709,54 +709,54 @@ let start_pub_thread ~port = in let pair_socket = - ZMQ.Socket.create zmq_context ZMQ.Socket.pair + Zmq.Socket.create zmq_context Zmq.Socket.pair and address = "inproc://pair" in - ZMQ.Socket.connect pair_socket address; + Zmq.Socket.connect pair_socket address; let pub_socket = - ZMQ.Socket.create zmq_context ZMQ.Socket.pub + Zmq.Socket.create zmq_context Zmq.Socket.pub in bind_socket ~socket_type:"PUB" ~socket:pub_socket ~port; let pollitem = - ZMQ.Poll.mask_of - [| (pair_socket, ZMQ.Poll.In) |] + Zmq.Poll.mask_of + [| (pair_socket, Zmq.Poll.In) |] in let rec run state = let new_state = let polling = - ZMQ.Poll.poll ~timeout pollitem + Zmq.Poll.poll ~timeout pollitem in - if (polling.(0) = Some ZMQ.Poll.In) then - ZMQ.Socket.recv ~block:false pair_socket + if (polling.(0) = Some Zmq.Poll.In) then + Zmq.Socket.recv ~block:false pair_socket |> pub_state_of_string else state in - ZMQ.Socket.send pub_socket @@ string_of_pub_state new_state; + Zmq.Socket.send pub_socket @@ string_of_pub_state new_state; match state with | Stopped -> () | _ -> run new_state in run Waiting; - ZMQ.Socket.set_linger_period pair_socket 1000 ; - ZMQ.Socket.close pair_socket; - ZMQ.Socket.set_linger_period pub_socket 1000 ; - ZMQ.Socket.close pub_socket; + Zmq.Socket.set_linger_period pair_socket 1000 ; + Zmq.Socket.close pair_socket; + Zmq.Socket.set_linger_period pub_socket 1000 ; + Zmq.Socket.close pub_socket; ) let run ~port = (** Bind inproc socket for changing state of pub *) let pair_socket = - ZMQ.Socket.create zmq_context ZMQ.Socket.pair + Zmq.Socket.create zmq_context Zmq.Socket.pair and address = "inproc://pair" in - ZMQ.Socket.bind pair_socket address; + Zmq.Socket.bind pair_socket address; let pub_thread = start_pub_thread ~port:(port+1) () @@ -764,9 +764,9 @@ let run ~port = (** Bind REP socket *) let rep_socket = - ZMQ.Socket.create zmq_context ZMQ.Socket.rep + Zmq.Socket.create zmq_context Zmq.Socket.rep in - ZMQ.Socket.set_linger_period rep_socket 1_000_000; + Zmq.Socket.set_linger_period rep_socket 1_000_000; bind_socket "REP" rep_socket port; let initial_program_state = @@ -783,8 +783,8 @@ let run ~port = (** ZMR polling item *) let pollitem = - ZMQ.Poll.mask_of - [| (rep_socket, ZMQ.Poll.In) |] + Zmq.Poll.mask_of + [| (rep_socket, Zmq.Poll.In) |] in let address = @@ -798,9 +798,9 @@ let run ~port = | false -> () | true -> let polling = - ZMQ.Poll.poll ~timeout:1000 pollitem + Zmq.Poll.poll ~timeout:1000 pollitem in - if (polling.(0) <> Some ZMQ.Poll.In) then + if (polling.(0) <> Some Zmq.Poll.In) then main_loop program_state true else begin @@ -818,7 +818,7 @@ let run ~port = (** Extract message *) let raw_message, rest = - match ZMQ.Socket.recv_all rep_socket with + match Zmq.Socket.recv_all rep_socket with | x :: rest -> x, rest | [] -> failwith "Badly formed message" in @@ -873,9 +873,9 @@ let run ~port = end in main_loop initial_program_state true; - ZMQ.Socket.send pair_socket @@ string_of_pub_state Stopped; + Zmq.Socket.send pair_socket @@ string_of_pub_state Stopped; Thread.join pub_thread; - ZMQ.Socket.close rep_socket + Zmq.Socket.close rep_socket diff --git a/ocaml/_tags b/ocaml/_tags index aa36989b..bf267415 100644 --- a/ocaml/_tags +++ b/ocaml/_tags @@ -1,3 +1,3 @@ -true: package(core,cryptokit,ZMQ,str,ppx_sexp_conv,ppx_deriving) +true: package(core,cryptokit,zmq,str,ppx_sexp_conv,ppx_deriving) true: thread false: profile diff --git a/ocaml/qp_run.ml b/ocaml/qp_run.ml index f3f0b14e..49fa13d4 100644 --- a/ocaml/qp_run.ml +++ b/ocaml/qp_run.ml @@ -20,10 +20,10 @@ let run slave exe ezfio_file = (** Check availability of the ports *) let port_number = let zmq_context = - ZMQ.Context.create () + Zmq.Context.create () in let dummy_socket = - ZMQ.Socket.create zmq_context ZMQ.Socket.rep + Zmq.Socket.create zmq_context Zmq.Socket.rep in let rec try_new_port port_number = try @@ -31,8 +31,8 @@ let run slave exe ezfio_file = let address = Printf.sprintf "tcp://%s:%d" (Lazy.force TaskServer.ip_address) (port_number+i) in - ZMQ.Socket.bind dummy_socket address; - ZMQ.Socket.unbind dummy_socket address; + Zmq.Socket.bind dummy_socket address; + Zmq.Socket.unbind dummy_socket address; ); port_number with @@ -41,8 +41,8 @@ let run slave exe ezfio_file = let result = try_new_port 41279 in - ZMQ.Socket.close dummy_socket; - ZMQ.Context.terminate zmq_context; + Zmq.Socket.close dummy_socket; + Zmq.Context.terminate zmq_context; result in diff --git a/scripts/ezfio_interface/ei_handler.py b/scripts/ezfio_interface/ei_handler.py index 8d154fc2..4137bb0e 100755 --- a/scripts/ezfio_interface/ei_handler.py +++ b/scripts/ezfio_interface/ei_handler.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Welcome to the ei_handler. diff --git a/scripts/ezfio_interface/qp_convert_output_to_ezfio.py b/scripts/ezfio_interface/qp_convert_output_to_ezfio.py index 7f4f30be..6b415dd7 100755 --- a/scripts/ezfio_interface/qp_convert_output_to_ezfio.py +++ b/scripts/ezfio_interface/qp_convert_output_to_ezfio.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 """ convert output of gamess/GAU$$IAN to ezfio From 91eb59157246159b2b296176dab6fd8352ac397a Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 9 May 2018 12:22:54 +0200 Subject: [PATCH 12/96] Changes for OCaml zmq-5.0 --- ocaml/TaskServer.mli | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/ocaml/TaskServer.mli b/ocaml/TaskServer.mli index c492756d..e3801423 100644 --- a/ocaml/TaskServer.mli +++ b/ocaml/TaskServer.mli @@ -19,14 +19,14 @@ val debug_env : bool (** Print a debug message *) val debug : string -> unit -(** {1} ZMQ *) +(** {1} Zmq *) (** ZeroMQ context *) -val zmq_context : ZMQ.Context.t +val zmq_context : Zmq.Context.t -(** Bind a ZMQ socket to a TCP port and to an IPC file /tmp/qp_run. *) +(** Bind a Zmq socket to a TCP port and to an IPC file /tmp/qp_run. *) val bind_socket : - socket_type:string -> socket:'a ZMQ.Socket.t -> port:int -> unit + socket_type:string -> socket:'a Zmq.Socket.t -> port:int -> unit (** Name of the host on which the server runs *) val hostname : string lazy_t @@ -35,8 +35,8 @@ val hostname : string lazy_t val ip_address : string lazy_t (** Standard messages *) -val reply_ok : [> `Req ] ZMQ.Socket.t -> unit -val reply_wrong_state : [> `Req ] ZMQ.Socket.t -> unit +val reply_ok : [> `Req ] Zmq.Socket.t -> unit +val reply_wrong_state : [> `Req ] Zmq.Socket.t -> unit (** Stop server *) val stop : port:int -> unit @@ -44,34 +44,34 @@ val stop : port:int -> unit (** {1} Server functions *) (** Create a new job *) -val new_job : Message.Newjob_msg.t -> t -> [> `Req ] ZMQ.Socket.t -> [> `Pair] ZMQ.Socket.t -> t +val new_job : Message.Newjob_msg.t -> t -> [> `Req ] Zmq.Socket.t -> [> `Pair] Zmq.Socket.t -> t (** Finish a running job *) -val end_job : Message.Endjob_msg.t -> t -> [> `Req ] ZMQ.Socket.t -> [> `Pair] ZMQ.Socket.t -> t +val end_job : Message.Endjob_msg.t -> t -> [> `Req ] Zmq.Socket.t -> [> `Pair] Zmq.Socket.t -> t (** Connect a client *) -val connect: Message.Connect_msg.t -> t -> [> `Req ] ZMQ.Socket.t -> t +val connect: Message.Connect_msg.t -> t -> [> `Req ] Zmq.Socket.t -> t (** Disconnect a client *) -val disconnect: Message.Disconnect_msg.t -> t -> [> `Req ] ZMQ.Socket.t -> t +val disconnect: Message.Disconnect_msg.t -> t -> [> `Req ] Zmq.Socket.t -> t (** Add a task to the pool *) -val add_task: Message.AddTask_msg.t -> t -> [> `Req ] ZMQ.Socket.t -> t +val add_task: Message.AddTask_msg.t -> t -> [> `Req ] Zmq.Socket.t -> t (** Mark the task as done by the client *) -val task_done: Message.TaskDone_msg.t -> t -> [> `Req ] ZMQ.Socket.t -> t +val task_done: Message.TaskDone_msg.t -> t -> [> `Req ] Zmq.Socket.t -> t (** Delete a task when it has been pulled by the collector *) -val del_task: Message.DelTask_msg.t -> t -> [> `Req ] ZMQ.Socket.t -> t +val del_task: Message.DelTask_msg.t -> t -> [> `Req ] Zmq.Socket.t -> t (** The client get a new task to execute *) -val get_task: Message.GetTask_msg.t -> t -> [> `Req ] ZMQ.Socket.t -> [> `Pair] ZMQ.Socket.t -> t +val get_task: Message.GetTask_msg.t -> t -> [> `Req ] Zmq.Socket.t -> [> `Pair] Zmq.Socket.t -> t (** Terminate server *) -val terminate : t -> [> `Req ] ZMQ.Socket.t -> t +val terminate : t -> [> `Req ] Zmq.Socket.t -> t (** Reply an Error message *) -val error : string -> t -> [> `Req ] ZMQ.Socket.t -> t +val error : string -> t -> [> `Req ] Zmq.Socket.t -> t (** Run server *) val run : port:int -> unit From 850c438956a0320a46b9002400ffb3544b5f6606 Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Wed, 9 May 2018 17:17:12 -0500 Subject: [PATCH 13/96] Change the url for GMP. The officiel website is down sometime --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 9f677e92..98970655 100755 --- a/configure +++ b/configure @@ -138,7 +138,7 @@ zeromq = Info( default_path=join(QP_ROOT_LIB, "libzmq.a")) gmp= Info( - url='https://gmplib.org/download/gmp/gmp-6.1.2.tar.bz2', + url='ftp://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.bz2', description=' The GNU Multiple Precision Arithmetic Library', default_path=join(QP_ROOT_LIB, "libgmp.a")) From 7e0c5b609f9f43fe6e1226d65b4d92860e826fbe Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 15 May 2018 11:06:16 +0200 Subject: [PATCH 14/96] Python2 --- scripts/compilation/qp_create_ninja.py | 2 +- scripts/ezfio_interface/qp_convert_output_to_ezfio.py | 3 ++- scripts/module/qp_module.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/compilation/qp_create_ninja.py b/scripts/compilation/qp_create_ninja.py index b3e40a14..f1164627 100755 --- a/scripts/compilation/qp_create_ninja.py +++ b/scripts/compilation/qp_create_ninja.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Usage: qp_create_ninja.py create (--development | --production) diff --git a/scripts/ezfio_interface/qp_convert_output_to_ezfio.py b/scripts/ezfio_interface/qp_convert_output_to_ezfio.py index 6b415dd7..a380d561 100755 --- a/scripts/ezfio_interface/qp_convert_output_to_ezfio.py +++ b/scripts/ezfio_interface/qp_convert_output_to_ezfio.py @@ -271,7 +271,7 @@ def write_ezfio(res, filename): # # INPUT - # {% for lanel,zcore, l_block in l_atom $} + # {% for label,zcore, l_block in l_atom $} # #local l_block l=0} # {label} GEN {zcore} {len(l_block)-1 #lmax_block} # {% for l_param in l_block%} @@ -336,6 +336,7 @@ def write_ezfio(res, filename): l_max_block = max(len(i) for i in matrix_unlocal_unpad) k_max = max([len(item) for row in matrix_unlocal_unpad for item in row]) + matrix_unlocal_semipaded = [[pad(item, k_max, [0., 2, 0.]) for item in row] for row in matrix_unlocal_unpad] empty_row = [[0., 2, 0.] for k in range(l_max_block)] diff --git a/scripts/module/qp_module.py b/scripts/module/qp_module.py index adeb3a46..e6baeee4 100755 --- a/scripts/module/qp_module.py +++ b/scripts/module/qp_module.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Usage: From ab0d5640db045d7e25a38f23040c2c035f6a931c Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 17 May 2018 17:21:42 +0200 Subject: [PATCH 15/96] Fixed segfault --- src/Utils/map_functions.irp.f | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Utils/map_functions.irp.f b/src/Utils/map_functions.irp.f index cf894893..c08182c6 100644 --- a/src/Utils/map_functions.irp.f +++ b/src/Utils/map_functions.irp.f @@ -41,7 +41,7 @@ subroutine map_save_to_disk(filename,map) call map_sort(map) k = 1_8 do i=0_8, map % map_size - map % consolidated_idx (i+1) = k + map % consolidated_idx (i+1_8) = k do j=1, map % map(i) % n_elements map % consolidated_value(k) = map % map(i) % value(j) map % consolidated_key (k) = map % map(i) % key(j) @@ -49,8 +49,8 @@ subroutine map_save_to_disk(filename,map) enddo deallocate(map % map(i) % value) deallocate(map % map(i) % key) - map % map(i) % value => map % consolidated_value ( map % consolidated_idx (i+1_8) :) - map % map(i) % key => map % consolidated_key ( map % consolidated_idx (i+1_8) :) + map % map(i) % value => map % consolidated_value ( map % consolidated_idx (i+1_8) : k-1) + map % map(i) % key => map % consolidated_key ( map % consolidated_idx (i+1_8) : k-1) enddo map % consolidated_idx (map % map_size + 2_8) = k map % consolidated = .True. From 156c797ec99cec12f8874edbfae0fc22dabd0c2d Mon Sep 17 00:00:00 2001 From: Kevin Gasperich Date: Thu, 17 May 2018 11:25:34 -0500 Subject: [PATCH 16/96] fixed incorrect indices in checking of reverse bielec indexing function (#233) --- src/Integrals_Bielec/map_integrals.irp.f | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Integrals_Bielec/map_integrals.irp.f b/src/Integrals_Bielec/map_integrals.irp.f index 7d1714b0..85a2f954 100644 --- a/src/Integrals_Bielec/map_integrals.irp.f +++ b/src/Integrals_Bielec/map_integrals.irp.f @@ -100,7 +100,7 @@ subroutine bielec_integrals_index_reverse(i,j,k,l,i1) call bielec_integrals_index(i(ii),j(ii),k(ii),l(ii),i2) if (i1 /= i2) then print *, i1, i2 - print *, i(ii), j(jj), k(jj), l(jj) + print *, i(ii), j(ii), k(ii), l(ii) stop 'bielec_integrals_index_reverse failed' endif endif From 3d8a1460c9dfe38dca32a8826f54f25a9462a322 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 18 May 2018 20:36:12 +0200 Subject: [PATCH 17/96] L3 selection for excited states --- plugins/Full_CI_ZMQ/selection.irp.f | 32 ++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/plugins/Full_CI_ZMQ/selection.irp.f b/plugins/Full_CI_ZMQ/selection.irp.f index 2463b762..095f7104 100644 --- a/plugins/Full_CI_ZMQ/selection.irp.f +++ b/plugins/Full_CI_ZMQ/selection.irp.f @@ -1,4 +1,26 @@ use bitmasks +BEGIN_PROVIDER [ double precision, selection_weight, (N_states) ] + implicit none + BEGIN_DOC + ! Weight of the states in the selection : 1/(sum_i c_i^4) + END_DOC + integer :: i,k + double precision :: c + print *, 'Selection weights' + print *, '-----------------' + do i=1,N_states + selection_weight(i) = 0.d0 + do k=1,N_det + c = psi_coef(k,i)*psi_coef(k,i) + selection_weight(i) = selection_weight(i) + c*abs(psi_coef(k,i)) + enddo + selection_weight(i) = 1.d0/selection_weight(i) + print *, i, selection_weight(i) + enddo + print *, '-----------------' + +END_PROVIDER + BEGIN_PROVIDER [ integer, fragment_count ] implicit none @@ -594,7 +616,7 @@ subroutine fill_buffer_double(i_generator, sp, h1, h2, bannedOrb, banned, fock_d logical :: ok integer :: s1, s2, p1, p2, ib, j, istate integer(bit_kind) :: mask(N_int, 2), det(N_int, 2) - double precision :: e_pert, delta_E, val, Hii, min_e_pert,tmp + double precision :: e_pert, delta_E, val, Hii, sum_e_pert, tmp double precision, external :: diag_H_mat_elem_fock logical, external :: detEq @@ -621,7 +643,7 @@ subroutine fill_buffer_double(i_generator, sp, h1, h2, bannedOrb, banned, fock_d call apply_particles(mask, s1, p1, s2, p2, det, ok, N_int) Hii = diag_H_mat_elem_fock(psi_det_generators(1,1,i_generator),det,fock_diag_tmp,N_int) - min_e_pert = 0d0 + sum_e_pert = 0d0 do istate=1,N_states delta_E = E0(istate) - Hii @@ -632,11 +654,11 @@ subroutine fill_buffer_double(i_generator, sp, h1, h2, bannedOrb, banned, fock_d endif e_pert = 0.5d0 * (tmp - delta_E) pt2(istate) = pt2(istate) + e_pert - min_e_pert = min(e_pert,min_e_pert) + sum_e_pert = sum_e_pert + e_pert * selection_weight(istate) end do - if(min_e_pert <= buf%mini) then - call add_to_selection_buffer(buf, det, min_e_pert) + if(sum_e_pert <= buf%mini) then + call add_to_selection_buffer(buf, det, sum_e_pert) end if end do end do From 470ad73484de6d0dc33189f6ee696ae1bd6eb2a5 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 18 May 2018 23:12:19 +0200 Subject: [PATCH 18/96] Fixed bug in MPI multistate --- plugins/Full_CI_ZMQ/selection_slave.irp.f | 57 +++++++++++++++++------ src/Determinants/zmq.irp.f | 4 +- 2 files changed, 44 insertions(+), 17 deletions(-) diff --git a/plugins/Full_CI_ZMQ/selection_slave.irp.f b/plugins/Full_CI_ZMQ/selection_slave.irp.f index aa749151..c1712b2d 100644 --- a/plugins/Full_CI_ZMQ/selection_slave.irp.f +++ b/plugins/Full_CI_ZMQ/selection_slave.irp.f @@ -13,49 +13,60 @@ program selection_slave 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 + 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 fragment_count ci_energy mpi_master zmq_state zmq_context + PROVIDE psi_det psi_coef end subroutine run_wf use f77_zmq - + implicit none + IRP_IF MPI + include 'mpif.h' + IRP_ENDIF 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) + character*(64) :: states(2) integer :: rc, i, ierr - - integer, external :: zmq_get_dvector - integer, external :: zmq_get_psi + double precision :: t0, t1 + integer, external :: zmq_get_dvector, zmq_get_N_det_generators + integer, external :: zmq_get_psi, zmq_get_N_det_selectors + integer, external :: zmq_get_N_states_diag + call provide_everything zmq_context = f77_zmq_ctx_new () states(1) = 'selection' - states(2) = 'davidson' - states(3) = 'pt2' + states(2) = 'pt2' zmq_to_qp_run_socket = new_zmq_to_qp_run_socket() do - call wait_for_states(states,zmq_state,3) + call wait_for_states(states,zmq_state,size(states)) + print *, trim(zmq_state) - if(trim(zmq_state) == 'Stopped') then + if(zmq_state(1:7) == 'Stopped') then exit - else if (trim(zmq_state) == 'selection') then + else if (zmq_state(1:9) == 'selection') then ! Selection ! --------- - print *, 'Selection' + call wall_time(t0) if (zmq_get_psi(zmq_to_qp_run_socket,1) == -1) cycle + if (zmq_get_N_det_generators (zmq_to_qp_run_socket, 1) == -1) cycle + if (zmq_get_N_det_selectors(zmq_to_qp_run_socket, 1) == -1) cycle if (zmq_get_dvector(zmq_to_qp_run_socket,1,'energy',energy,N_states) == -1) cycle + + call wall_time(t1) + call write_double(6,(t1-t0),'Broadcast time') !$OMP PARALLEL PRIVATE(i) i = omp_get_thread_num() @@ -63,15 +74,21 @@ subroutine run_wf !$OMP END PARALLEL print *, 'Selection done' - else if (trim(zmq_state) == 'pt2') then + else if (zmq_state(1:3) == 'pt2') then ! PT2 ! --- print *, 'PT2' + call wall_time(t0) if (zmq_get_psi(zmq_to_qp_run_socket,1) == -1) cycle if (zmq_get_dvector(zmq_to_qp_run_socket,1,'energy',energy,N_states) == -1) cycle - + if (zmq_get_N_det_generators (zmq_to_qp_run_socket, 1) == -1) cycle + if (zmq_get_N_det_selectors(zmq_to_qp_run_socket, 1) == -1) cycle + + call wall_time(t1) + call write_double(6,(t1-t0),'Broadcast time') + logical :: lstop lstop = .False. !$OMP PARALLEL PRIVATE(i) @@ -82,7 +99,17 @@ subroutine run_wf endif + IRP_IF MPI + call MPI_BARRIER(MPI_COMM_WORLD, ierr) + if (ierr /= MPI_SUCCESS) then + print *, irp_here, 'error in barrier' + endif + IRP_ENDIF + end do + IRP_IF MPI + call MPI_finalize(i) + IRP_ENDIF end diff --git a/src/Determinants/zmq.irp.f b/src/Determinants/zmq.irp.f index 5e42cff5..e8edc1a8 100644 --- a/src/Determinants/zmq.irp.f +++ b/src/Determinants/zmq.irp.f @@ -304,7 +304,7 @@ integer function zmq_get_psi_det(zmq_to_qp_run_socket, worker_id) if (ierr /= MPI_SUCCESS) then stop 'Unable to broadcast zmq_get_psi_det' endif - call broadcast_chunks_bit_kind(psi_det,N_det*N_int*2) + call broadcast_chunks_bit_kind(psi_det,size(psi_det)) IRP_ENDIF end @@ -353,7 +353,7 @@ integer function zmq_get_psi_coef(zmq_to_qp_run_socket, worker_id) if (ierr /= MPI_SUCCESS) then stop 'Unable to broadcast zmq_get_psi_coef' endif - call broadcast_chunks_double(psi_coef,N_states*N_det) + call broadcast_chunks_double(psi_coef,size(psi_coef)) IRP_ENDIF end From 054421533fdbab373ad6db0f959c0723c69483f4 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 22 May 2018 14:56:43 +0200 Subject: [PATCH 19/96] merge master (#71) * Change the url for GMP. The officiel website is down sometime * fixed incorrect indices in checking of reverse bielec indexing function (#233) --- configure | 2 +- src/Integrals_Bielec/map_integrals.irp.f | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 9bc8f24b..2a7d62e2 100755 --- a/configure +++ b/configure @@ -138,7 +138,7 @@ zeromq = Info( default_path=join(QP_ROOT_LIB, "libzmq.a")) gmp= Info( - url='https://gmplib.org/download/gmp/gmp-6.1.2.tar.bz2', + url='ftp://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.bz2', description=' The GNU Multiple Precision Arithmetic Library', default_path=join(QP_ROOT_LIB, "libgmp.a")) diff --git a/src/Integrals_Bielec/map_integrals.irp.f b/src/Integrals_Bielec/map_integrals.irp.f index 7d1714b0..85a2f954 100644 --- a/src/Integrals_Bielec/map_integrals.irp.f +++ b/src/Integrals_Bielec/map_integrals.irp.f @@ -100,7 +100,7 @@ subroutine bielec_integrals_index_reverse(i,j,k,l,i1) call bielec_integrals_index(i(ii),j(ii),k(ii),l(ii),i2) if (i1 /= i2) then print *, i1, i2 - print *, i(ii), j(jj), k(jj), l(jj) + print *, i(ii), j(ii), k(ii), l(ii) stop 'bielec_integrals_index_reverse failed' endif endif From 2437bbfe97df18ac6a2f099a56f602720cee3fcb Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 22 May 2018 17:09:12 +0200 Subject: [PATCH 20/96] MPI bug fixed --- plugins/Full_CI_ZMQ/pt2_slave.irp.f | 2 ++ plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/plugins/Full_CI_ZMQ/pt2_slave.irp.f b/plugins/Full_CI_ZMQ/pt2_slave.irp.f index 718884d1..2764b169 100644 --- a/plugins/Full_CI_ZMQ/pt2_slave.irp.f +++ b/plugins/Full_CI_ZMQ/pt2_slave.irp.f @@ -57,6 +57,8 @@ subroutine run_wf 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_energy(1:N_states) = energy(1:N_states) + TOUCH psi_energy !$OMP PARALLEL PRIVATE(i) i = omp_get_thread_num() diff --git a/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f b/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f index 49943ad1..2b6df181 100644 --- a/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f +++ b/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f @@ -65,6 +65,8 @@ subroutine run_wf if (zmq_get_N_det_generators (zmq_to_qp_run_socket, 1) == -1) cycle if (zmq_get_N_det_selectors(zmq_to_qp_run_socket, 1) == -1) cycle if (zmq_get_dvector(zmq_to_qp_run_socket,1,'energy',energy,N_states) == -1) cycle + psi_energy(1:N_states) = energy(1:N_states) + TOUCH psi_energy call wall_time(t1) call write_double(6,(t1-t0),'Broadcast time') @@ -105,6 +107,8 @@ subroutine run_wf if (zmq_get_dvector(zmq_to_qp_run_socket,1,'energy',energy,N_states) == -1) cycle if (zmq_get_N_det_generators (zmq_to_qp_run_socket, 1) == -1) cycle if (zmq_get_N_det_selectors(zmq_to_qp_run_socket, 1) == -1) cycle + psi_energy(1:N_states) = energy(1:N_states) + TOUCH psi_energy call wall_time(t1) call write_double(6,(t1-t0),'Broadcast time') From 9245c090e29888dbb8cb65a91b19e97d26614883 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 22 May 2018 19:11:10 +0200 Subject: [PATCH 21/96] debugging --- plugins/dress_zmq/dress_general.irp.f | 4 +-- plugins/dress_zmq/dress_slave.irp.f | 6 ++--- plugins/dress_zmq/dress_stoch_routines.irp.f | 27 +++++++++++++------- plugins/dress_zmq/dressing.irp.f | 6 +++-- plugins/dress_zmq/run_dress_slave.irp.f | 2 +- plugins/mrcepa0/dressing.irp.f | 5 ++-- plugins/mrcepa0/mrcc_stoch_routines.irp.f | 1 - plugins/shiftedbk/shifted_bk_routines.irp.f | 20 +++++++++------ src/Determinants/H_apply.irp.f | 5 ++-- src/Utils/map_functions.irp.f | 4 +-- 10 files changed, 46 insertions(+), 34 deletions(-) diff --git a/plugins/dress_zmq/dress_general.irp.f b/plugins/dress_zmq/dress_general.irp.f index 3fe0c676..048605b8 100644 --- a/plugins/dress_zmq/dress_general.irp.f +++ b/plugins/dress_zmq/dress_general.irp.f @@ -63,11 +63,11 @@ subroutine run_dressing(N_st,energy) enddo print *, 'Variational energy ' do i=1,N_st - print *, i, psi_energy(i) + print *, i, psi_energy(i)+nuclear_repulsion enddo print *, 'Dressed energy ' do i=1,N_st - print *, i, ci_energy_dressed(i) + print *, i, ci_energy_dressed(i)+nuclear_repulsion enddo endif diff --git a/plugins/dress_zmq/dress_slave.irp.f b/plugins/dress_zmq/dress_slave.irp.f index acae326f..8983c2bc 100644 --- a/plugins/dress_zmq/dress_slave.irp.f +++ b/plugins/dress_zmq/dress_slave.irp.f @@ -59,10 +59,8 @@ integer, external :: zmq_get_dvector, zmq_get_N_det_generators if (zmq_get_dvector(zmq_to_qp_run_socket,1,'energy',energy,N_states) == -1) cycle if (zmq_get_dvector(zmq_to_qp_run_socket,1,'dress_stoch_istate',tmp,1) == -1) cycle dress_stoch_istate = int(tmp) - - - TOUCH dress_stoch_istate - TOUCH state_average_weight + psi_energy(1:N_states) = energy(1:N_states) + TOUCH psi_energy dress_stoch_istate state_average_weight 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 diff --git a/plugins/dress_zmq/dress_stoch_routines.irp.f b/plugins/dress_zmq/dress_stoch_routines.irp.f index cb43baad..b6a50024 100644 --- a/plugins/dress_zmq/dress_stoch_routines.irp.f +++ b/plugins/dress_zmq/dress_stoch_routines.irp.f @@ -133,16 +133,18 @@ subroutine ZMQ_dress(E, dress, delta_out, delta_s2_out, relative_error, lndet) print *, irp_here, ': Failed in zmq_set_running' endif - !!$OMP PARALLEL DEFAULT(shared) NUM_THREADS(nproc) & - ! !$OMP PRIVATE(i) - !i = omp_get_thread_num() - !if (i==0) then + call omp_set_nested(.true.) + !$OMP PARALLEL DEFAULT(shared) NUM_THREADS(2) & + !$OMP PRIVATE(i) + i = omp_get_thread_num() + if (i==0) then call dress_collector(zmq_socket_pull,E, relative_error, delta, delta_s2, dress,& dress_stoch_istate) - !else - ! call dress_slave_inproc(i) - !endif - !!$OMP END PARALLEL + else + call dress_slave_inproc(i) + endif + !$OMP END PARALLEL + call omp_set_nested(.false.) delta_out(dress_stoch_istate,1:N_det) = delta(dress_stoch_istate,1:N_det) delta_s2_out(dress_stoch_istate,1:N_det) = delta_s2(dress_stoch_istate,1:N_det) call end_parallel_job(zmq_to_qp_run_socket, zmq_socket_pull, 'dress') @@ -237,6 +239,7 @@ subroutine dress_collector(zmq_socket_pull, E, relative_error, delta, delta_s2, call wall_time(time) end if + print *, cur_cp, ind if(cur_cp == -1) then call dress_pulled(ind, int_buf, double_buf, det_buf, N_buf) @@ -348,7 +351,7 @@ end function ! ! gen_per_cp : number of generators per checkpoint END_DOC - comb_teeth = 64 + comb_teeth = min(1+N_det/10,64) N_cps_max = 16 gen_per_cp = (N_det_generators / N_cps_max) + 1 END_PROVIDER @@ -505,6 +508,12 @@ END_PROVIDER done_cp_at_det(dress_jobs(i)) = cur_cp needed_by_cp(cur_cp) += 1 end do + + +print *, 'needed_by_cp' +do i=1,cur_cp + print *, i, needed_by_cp(i) +enddo under_det = 0 diff --git a/plugins/dress_zmq/dressing.irp.f b/plugins/dress_zmq/dressing.irp.f index b2d3bddd..12fef07a 100644 --- a/plugins/dress_zmq/dressing.irp.f +++ b/plugins/dress_zmq/dressing.irp.f @@ -65,12 +65,14 @@ END_PROVIDER BEGIN_PROVIDER [ integer , N_det_delta_ij ] implicit none - !N_det_delta_ij = 0!N_det + N_det_delta_ij = 1 END_PROVIDER BEGIN_PROVIDER [ double precision, delta_ij, (N_states, N_det, 2) ] implicit none - if(.true.) delta_ij(:,:N_det_delta_ij, :) = delta_ij_tmp(:,:,:) + if(.true.) then + delta_ij(:,:N_det_delta_ij, :) = delta_ij_tmp(:,:,:) + endif delta_ij(:,N_det_delta_ij+1:,:) = 0d0 END_PROVIDER diff --git a/plugins/dress_zmq/run_dress_slave.irp.f b/plugins/dress_zmq/run_dress_slave.irp.f index 6b392666..8801cb3f 100644 --- a/plugins/dress_zmq/run_dress_slave.irp.f +++ b/plugins/dress_zmq/run_dress_slave.irp.f @@ -48,7 +48,7 @@ subroutine run_dress_slave(thread,iproce,energy) double precision :: fac - if(iproce /= 0) stop "RUN DRESS SLAVE is OMP" +! if(iproce /= 0) stop "RUN DRESS SLAVE is OMP" allocate(delta_det(N_states, N_det, 0:comb_teeth+1, 2)) allocate(cp(N_states, N_det, N_cp, 2)) diff --git a/plugins/mrcepa0/dressing.irp.f b/plugins/mrcepa0/dressing.irp.f index a376585c..ad557d1a 100644 --- a/plugins/mrcepa0/dressing.irp.f +++ b/plugins/mrcepa0/dressing.irp.f @@ -581,7 +581,7 @@ END_PROVIDER double precision, allocatable :: mrcc(:) double precision :: E_CI_before!, relative_error - double precision, save :: target_error = 0d0 + double precision, save :: target_error = 2d-2 allocate(mrcc(N_states)) @@ -594,11 +594,10 @@ END_PROVIDER threshold_selectors = 1.d0 threshold_generators = 1d0 if(target_error /= 0d0) then - target_error = target_error / 2d0 ! (-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 target_error = 1d-4 end if - target_error = 0d0 call ZMQ_mrcc(E_CI_before, mrcc, delta_ij_mrcc_zmq, delta_ij_s2_mrcc_zmq, abs(target_error)) mrcc_previous_E(:) = mrcc_E0_denominator(:) diff --git a/plugins/mrcepa0/mrcc_stoch_routines.irp.f b/plugins/mrcepa0/mrcc_stoch_routines.irp.f index 1b605e6d..4aa6307e 100644 --- a/plugins/mrcepa0/mrcc_stoch_routines.irp.f +++ b/plugins/mrcepa0/mrcc_stoch_routines.irp.f @@ -310,7 +310,6 @@ subroutine mrcc_collector(zmq_socket_pull, E, relative_error, delta, delta_s2, m end if end do if(cur_cp == 0) then - print *, "no checkpoint reached so far..." cycle pullLoop end if !!!!!!!!!!!! diff --git a/plugins/shiftedbk/shifted_bk_routines.irp.f b/plugins/shiftedbk/shifted_bk_routines.irp.f index 8940a77f..9340ae97 100644 --- a/plugins/shiftedbk/shifted_bk_routines.irp.f +++ b/plugins/shiftedbk/shifted_bk_routines.irp.f @@ -51,6 +51,7 @@ subroutine generator_done(i_gen, int_buf, double_buf, det_buf, N_buf, iproc) double precision, intent(out) :: double_buf(N_dress_double_buffer) integer(bit_kind), intent(out) :: det_buf(N_int, 2, N_dress_det_buffer) integer :: i + int_buf(:) = 0 call sort_selection_buffer(sb(iproc)) det_buf(:,:,:sb(iproc)%cur) = sb(iproc)%det(:,:,:sb(iproc)%cur) @@ -115,15 +116,18 @@ subroutine delta_ij_done() old_det_gen = N_det_generators - call sort_selection_buffer(global_sb) - call fill_H_apply_buffer_no_selection(global_sb%cur,global_sb%det,N_int,0) - call copy_H_apply_buffer_to_wf() - - if (s2_eig.or.(N_states > 1) ) then - call make_s2_eigenfunction + if (dress_stoch_istate == N_states) then + ! Add buffer only when the last state is computed + call sort_selection_buffer(global_sb) + call fill_H_apply_buffer_no_selection(global_sb%cur,global_sb%det,N_int,0) + call copy_H_apply_buffer_to_wf() + if (s2_eig.or.(N_states > 1) ) then + call make_s2_eigenfunction + endif + call undress_with_alpha(old_generators, old_det_gen, psi_det(1,1,N_det_delta_ij+1), N_det-N_det_delta_ij) + call save_wavefunction endif - call undress_with_alpha(old_generators, old_det_gen, psi_det(1,1,N_det_delta_ij+1), N_det-N_det_delta_ij) - call save_wavefunction + end subroutine diff --git a/src/Determinants/H_apply.irp.f b/src/Determinants/H_apply.irp.f index e5197a21..cd1baa8f 100644 --- a/src/Determinants/H_apply.irp.f +++ b/src/Determinants/H_apply.irp.f @@ -192,8 +192,9 @@ subroutine copy_H_apply_buffer_to_wf call normalize(psi_coef,N_det) SOFT_TOUCH N_det psi_det psi_coef -! logical :: found_duplicates -! call remove_duplicates_in_psi_det(found_duplicates) + logical :: found_duplicates + call remove_duplicates_in_psi_det(found_duplicates) + end subroutine remove_duplicates_in_psi_det(found_duplicates) diff --git a/src/Utils/map_functions.irp.f b/src/Utils/map_functions.irp.f index c08182c6..bb82243e 100644 --- a/src/Utils/map_functions.irp.f +++ b/src/Utils/map_functions.irp.f @@ -101,8 +101,8 @@ subroutine map_load_from_disk(filename,map) k = map % consolidated_idx (i+2_8) l = map % consolidated_idx (i+1_8) n_elements = int(k - l, 4) - key_p => map % consolidated_key (l:l+n_elements) - value_p => map % consolidated_value ( l:l+n_elements ) + key_p => map % consolidated_key (l:l+n_elements-1) + value_p => map % consolidated_value ( l:l+n_elements-1 ) map % map(i) % key => key_p map % map(i) % value => value_p map % map(i) % sorted = .True. From bfb0c8732c03812fd77582cce81454ba006c8267 Mon Sep 17 00:00:00 2001 From: Kevin Gasperich Date: Tue, 22 May 2018 13:51:43 -0500 Subject: [PATCH 22/96] corrected conditional related to data types (#234) difference between out_val and tmp_val is integral_kind (instead of key_kind) --- src/Integrals_Bielec/map_integrals.irp.f | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Integrals_Bielec/map_integrals.irp.f b/src/Integrals_Bielec/map_integrals.irp.f index 85a2f954..03f0f073 100644 --- a/src/Integrals_Bielec/map_integrals.irp.f +++ b/src/Integrals_Bielec/map_integrals.irp.f @@ -447,7 +447,7 @@ subroutine get_mo_bielec_integrals(j,k,l,sze,out_val,map) call bielec_integrals_index(i,j,k,l,hash(i)) enddo - if (key_kind == 8) then + if (integral_kind == 8) then call map_get_many(map, hash, out_val, sze) else call map_get_many(map, hash, tmp_val, sze) @@ -534,7 +534,7 @@ subroutine get_mo_bielec_integrals_coulomb_ii(k,l,sze,out_val,map) call bielec_integrals_index(k,i,l,i,hash(i)) enddo - if (key_kind == 8) then + if (integral_kind == 8) then call map_get_many(map, hash, out_val, sze) else call map_get_many(map, hash, tmp_val, sze) @@ -567,7 +567,7 @@ subroutine get_mo_bielec_integrals_exch_ii(k,l,sze,out_val,map) call bielec_integrals_index(k,i,i,l,hash(i)) enddo - if (key_kind == 8) then + if (integral_kind == 8) then call map_get_many(map, hash, out_val, sze) else call map_get_many(map, hash, tmp_val, sze) From 1eb1e49b609d34ac1a8ee5e95ac3408e71fa0fec Mon Sep 17 00:00:00 2001 From: Kevin Gasperich Date: Tue, 22 May 2018 15:37:59 -0500 Subject: [PATCH 23/96] change 1->2 for beta electron part of cas bitmask --- src/Bitmask/bitmasks.irp.f | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bitmask/bitmasks.irp.f b/src/Bitmask/bitmasks.irp.f index 4eac3e0a..efb39119 100644 --- a/src/Bitmask/bitmasks.irp.f +++ b/src/Bitmask/bitmasks.irp.f @@ -559,7 +559,7 @@ END_PROVIDER n_core_inact_act_orb = 0 do i = 1, N_int reunion_of_core_inact_act_bitmask(i,1) = ior(reunion_of_core_inact_bitmask(i,1),cas_bitmask(i,1,1)) - reunion_of_core_inact_act_bitmask(i,2) = ior(reunion_of_core_inact_bitmask(i,2),cas_bitmask(i,1,1)) + reunion_of_core_inact_act_bitmask(i,2) = ior(reunion_of_core_inact_bitmask(i,2),cas_bitmask(i,2,1)) n_core_inact_act_orb +=popcnt(reunion_of_core_inact_act_bitmask(i,1)) enddo END_PROVIDER From e4dfaa20bdd1fe55d97c610249b128f4b9645c4c Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 23 May 2018 10:26:02 +0200 Subject: [PATCH 24/96] Minor fix --- plugins/Full_CI_ZMQ/pt2_stoch.irp.f | 12 ++++++------ src/Utils/map_functions.irp.f | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/Full_CI_ZMQ/pt2_stoch.irp.f b/plugins/Full_CI_ZMQ/pt2_stoch.irp.f index 7cf27d0e..204498af 100644 --- a/plugins/Full_CI_ZMQ/pt2_stoch.irp.f +++ b/plugins/Full_CI_ZMQ/pt2_stoch.irp.f @@ -19,14 +19,14 @@ subroutine run double precision :: E_CI_before, relative_error, absolute_error, eqt allocate (pt2(N_states)) - call diagonalize_CI() - pt2 = 0.d0 +! call diagonalize_CI() + pt2(:) = 0.d0 - E_CI_before = pt2_E0_denominator(1) + nuclear_repulsion + E_CI_before = psi_energy(1) + nuclear_repulsion threshold_selectors = 1.d0 - threshold_generators = 1d0 - relative_error = 1.d-9 - absolute_error = 1.d-9 + threshold_generators = 1.d0 + relative_error = 1.d-3 + absolute_error = 1.d-5 call ZMQ_pt2(E_CI_before, pt2, relative_error, absolute_error, eqt) print *, 'Final step' print *, 'N_det = ', N_det diff --git a/src/Utils/map_functions.irp.f b/src/Utils/map_functions.irp.f index c08182c6..bb82243e 100644 --- a/src/Utils/map_functions.irp.f +++ b/src/Utils/map_functions.irp.f @@ -101,8 +101,8 @@ subroutine map_load_from_disk(filename,map) k = map % consolidated_idx (i+2_8) l = map % consolidated_idx (i+1_8) n_elements = int(k - l, 4) - key_p => map % consolidated_key (l:l+n_elements) - value_p => map % consolidated_value ( l:l+n_elements ) + key_p => map % consolidated_key (l:l+n_elements-1) + value_p => map % consolidated_value ( l:l+n_elements-1 ) map % map(i) % key => key_p map % map(i) % value => value_p map % map(i) % sorted = .True. From bac9f32df14ddfb66a455b8fb0338e681cfd0dc5 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 23 May 2018 13:48:42 +0200 Subject: [PATCH 25/96] 10 combs --- plugins/dress_zmq/dress_stoch_routines.irp.f | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/dress_zmq/dress_stoch_routines.irp.f b/plugins/dress_zmq/dress_stoch_routines.irp.f index 633f782c..17fe0c95 100644 --- a/plugins/dress_zmq/dress_stoch_routines.irp.f +++ b/plugins/dress_zmq/dress_stoch_routines.irp.f @@ -352,7 +352,7 @@ end function ! ! gen_per_cp : number of generators per checkpoint END_DOC - comb_teeth = min(1+N_det/10,64) + comb_teeth = min(1+N_det/10,10) N_cps_max = 16 gen_per_cp = (N_det_generators / N_cps_max) + 1 END_PROVIDER From 95893b861d78d579324df3f8c38c6039149c9cae Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 23 May 2018 13:49:37 +0200 Subject: [PATCH 26/96] fragmented selection --- plugins/Full_CI_ZMQ/run_selection_slave.irp.f | 6 +-- plugins/Full_CI_ZMQ/zmq_selection.irp.f | 46 +++++++++++++------ 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/plugins/Full_CI_ZMQ/run_selection_slave.irp.f b/plugins/Full_CI_ZMQ/run_selection_slave.irp.f index 464f0a9f..3f0e6865 100644 --- a/plugins/Full_CI_ZMQ/run_selection_slave.irp.f +++ b/plugins/Full_CI_ZMQ/run_selection_slave.irp.f @@ -50,8 +50,8 @@ subroutine run_selection_slave(thread,iproc,energy) if (done) then ctask = ctask - 1 else - integer :: i_generator, N - read(task,*) i_generator, N + integer :: i_generator, N, subset + read(task,*) subset, i_generator, N if(buf%N == 0) then ! Only first time call create_selection_buffer(N, N*2, buf) @@ -60,7 +60,7 @@ subroutine run_selection_slave(thread,iproc,energy) else ASSERT (N == buf%N) end if - call select_connected(i_generator,energy,pt2,buf,0) + call select_connected(i_generator,energy,pt2,buf,subset) endif integer, external :: task_done_to_taskserver diff --git a/plugins/Full_CI_ZMQ/zmq_selection.irp.f b/plugins/Full_CI_ZMQ/zmq_selection.irp.f index fec28ba7..77a1457f 100644 --- a/plugins/Full_CI_ZMQ/zmq_selection.irp.f +++ b/plugins/Full_CI_ZMQ/zmq_selection.irp.f @@ -10,7 +10,6 @@ subroutine ZMQ_selection(N_in, pt2) integer :: i, N integer, external :: omp_get_thread_num double precision, intent(out) :: pt2(N_states) - integer, parameter :: maxtasks=10000 PROVIDE fragment_count @@ -21,7 +20,7 @@ subroutine ZMQ_selection(N_in, pt2) 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 + PROVIDE psi_bilinear_matrix_transp_order fragment_count call new_parallel_job(zmq_to_qp_run_socket,zmq_socket_pull,'selection') @@ -46,26 +45,40 @@ subroutine ZMQ_selection(N_in, pt2) endif integer, external :: add_task_to_taskserver - character*(20*maxtasks) :: task + character(len=64000) :: task + integer :: j,k,ipos + ipos=1 task = ' ' - integer :: k - k=0 do i= 1, N_det_generators - k = k+1 - write(task(20*(k-1)+1:20*k),'(I9,1X,I9,''|'')') i, N - if (k>=maxtasks) then - k=0 - if (add_task_to_taskserver(zmq_to_qp_run_socket,task) == -1) then - stop 'Unable to add task to task server' - endif + if (i>ishft(N_det_generators,-7)) then + write(task(ipos:ipos+30),'(I9,1X,I9,1X,I9,''|'')') 0, i, N + ipos += 30 + if (ipos > 63970) then + if (add_task_to_taskserver(zmq_to_qp_run_socket,trim(task(1:ipos))) == -1) then + stop 'Unable to add task to task server' + endif + ipos=1 + endif + else + do j=1,fragment_count + write(task(ipos:ipos+30),'(I9,1X,I9,1X,I9,''|'')') j, i, N + ipos += 30 + if (ipos > 63970) then + if (add_task_to_taskserver(zmq_to_qp_run_socket,trim(task(1:ipos))) == -1) then + stop 'Unable to add task to task server' + endif + ipos=1 + endif + end do endif - end do - if (k > 0) then - if (add_task_to_taskserver(zmq_to_qp_run_socket,task) == -1) then + enddo + if (ipos > 1) then + if (add_task_to_taskserver(zmq_to_qp_run_socket,trim(task(1:ipos))) == -1) then stop 'Unable to add task to task server' endif endif + ASSERT (associated(b%det)) ASSERT (associated(b%val)) @@ -130,6 +143,9 @@ subroutine selection_collector(zmq_socket_pull, b, N, pt2) integer(bit_kind), pointer :: det(:,:,:) integer, allocatable :: task_id(:) type(selection_buffer) :: b2 + + + zmq_to_qp_run_socket = new_zmq_to_qp_run_socket() call create_selection_buffer(N, N*2, b2) From 4b1a77c5c0fbd34825fd3617d6e69ce608731e9f Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 23 May 2018 18:16:33 +0200 Subject: [PATCH 27/96] Iterative sbk, broken --- plugins/Psiref_Utils/psi_ref_utils.irp.f | 4 +- plugins/dress_zmq/dress_general.irp.f | 4 +- plugins/dress_zmq/dress_stoch_routines.irp.f | 12 +- plugins/dress_zmq/dressing.irp.f | 3 +- plugins/shiftedbk/EZFIO.cfg | 39 +++++ plugins/shiftedbk/selection_buffer.irp.f | 86 ++++++++++ plugins/shiftedbk/shifted_bk_iter.irp.f | 159 +++++++++++++++++++ plugins/shiftedbk/shifted_bk_routines.irp.f | 21 ++- src/Determinants/H_apply.irp.f | 4 +- src/Determinants/determinants.irp.f | 15 +- src/Determinants/psi_cas.irp.f | 4 +- 11 files changed, 314 insertions(+), 37 deletions(-) create mode 100644 plugins/shiftedbk/shifted_bk_iter.irp.f diff --git a/plugins/Psiref_Utils/psi_ref_utils.irp.f b/plugins/Psiref_Utils/psi_ref_utils.irp.f index c59bbd9f..a63b0ded 100644 --- a/plugins/Psiref_Utils/psi_ref_utils.irp.f +++ b/plugins/Psiref_Utils/psi_ref_utils.irp.f @@ -9,7 +9,7 @@ use bitmasks ! function. END_DOC call sort_dets_by_det_search_key(N_det_ref, psi_ref, psi_ref_coef, & - psi_ref_sorted_bit, psi_ref_coef_sorted_bit) + psi_ref_sorted_bit, psi_ref_coef_sorted_bit, N_states) END_PROVIDER @@ -152,7 +152,7 @@ END_PROVIDER ! function. END_DOC call sort_dets_by_det_search_key(N_det_ref, psi_non_ref, psi_non_ref_coef, & - psi_non_ref_sorted_bit, psi_non_ref_coef_sorted_bit) + psi_non_ref_sorted_bit, psi_non_ref_coef_sorted_bit, N_states) END_PROVIDER diff --git a/plugins/dress_zmq/dress_general.irp.f b/plugins/dress_zmq/dress_general.irp.f index 048605b8..b99eb1d7 100644 --- a/plugins/dress_zmq/dress_general.irp.f +++ b/plugins/dress_zmq/dress_general.irp.f @@ -38,10 +38,10 @@ subroutine run_dressing(N_st,energy) E_old = sum(psi_energy(:)) print *, 'Variational energy ' do i=1,N_st - print *, i, psi_energy(i) + print *, i, psi_energy(i)+nuclear_repulsion enddo !print *, "DELTA IJ", delta_ij(1,1,1) - if(.true.) dummy = delta_ij_tmp(1,1,1) + PROVIDE delta_ij_tmp if(.true.) call delta_ij_done() print *, 'Dressed energy ' do i=1,N_st diff --git a/plugins/dress_zmq/dress_stoch_routines.irp.f b/plugins/dress_zmq/dress_stoch_routines.irp.f index 17fe0c95..6b7bf396 100644 --- a/plugins/dress_zmq/dress_stoch_routines.irp.f +++ b/plugins/dress_zmq/dress_stoch_routines.irp.f @@ -229,10 +229,8 @@ subroutine dress_collector(zmq_socket_pull, E, relative_error, delta, delta_s2, pullLoop : do while (loop) call pull_dress_results(zmq_socket_pull, ind, cur_cp, delta_loc, int_buf, double_buf, det_buf, N_buf, task_id, dress_mwen) - !print *, cur_cp, ind if(floop) then call wall_time(time) - print *, "first_pull", time-time0 time0 = time floop = .false. end if @@ -240,8 +238,6 @@ subroutine dress_collector(zmq_socket_pull, E, relative_error, delta, delta_s2, call wall_time(time) end if - print *, cur_cp, ind - if(cur_cp == -1) then call dress_pulled(ind, int_buf, double_buf, det_buf, N_buf) if (zmq_delete_tasks(zmq_to_qp_run_socket,zmq_socket_pull,task_id,1,more) == -1) then @@ -295,7 +291,7 @@ subroutine dress_collector(zmq_socket_pull, E, relative_error, delta, delta_s2, !print '(I2X, F16.7, 2X, G16.3, 2X, F16.4, A20)', avg+E(istate)+E0, eqt, time-time0, '' print '(G10.3, 2X, F16.10, 2X, G16.3, 2X, F16.4, A20)', cps_N(cur_cp), avg+E0+E(istate), eqt, time-time0, '' - if ((dabs(eqt) < relative_error .and. cps_N(cur_cp) >= 30)) then + if ((dabs(eqt/(avg+E0+E(istate))) < relative_error .and. cps_N(cur_cp) >= 10)) then ! Termination print *, "TERMINATE" if (zmq_abort(zmq_to_qp_run_socket) == -1) then @@ -511,12 +507,6 @@ END_PROVIDER end do -print *, 'needed_by_cp' -do i=1,cur_cp - print *, i, needed_by_cp(i) -enddo - - under_det = 0 cp_first_tooth = 0 do i=1,N_dress_jobs diff --git a/plugins/dress_zmq/dressing.irp.f b/plugins/dress_zmq/dressing.irp.f index 12fef07a..bf2ab207 100644 --- a/plugins/dress_zmq/dressing.irp.f +++ b/plugins/dress_zmq/dressing.irp.f @@ -96,12 +96,13 @@ BEGIN_PROVIDER [ double precision, delta_ij_tmp, (N_states,N_det_delta_ij,2) ] E_CI_before(:) = psi_energy(:) + nuclear_repulsion threshold_selectors = 1.d0 threshold_generators = 1.d0 + SOFT_TOUCH threshold_selectors threshold_generators ! if(errr /= 0d0) then ! errr = errr / 2d0 ! else ! errr = 1d-4 ! end if - relative_error = 5.d-5 + relative_error = 1.d-2 call write_double(6,relative_error,"Convergence of the stochastic algorithm") diff --git a/plugins/shiftedbk/EZFIO.cfg b/plugins/shiftedbk/EZFIO.cfg index 001535b9..be4998dd 100644 --- a/plugins/shiftedbk/EZFIO.cfg +++ b/plugins/shiftedbk/EZFIO.cfg @@ -3,3 +3,42 @@ type: Perturbation doc: Type of zeroth-order Hamiltonian [ EN | Barycentric ] interface: ezfio,provider,ocaml 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) + diff --git a/plugins/shiftedbk/selection_buffer.irp.f b/plugins/shiftedbk/selection_buffer.irp.f index 8c3bee91..8b140666 100644 --- a/plugins/shiftedbk/selection_buffer.irp.f +++ b/plugins/shiftedbk/selection_buffer.irp.f @@ -156,3 +156,89 @@ end subroutine +subroutine unique_selection_buffer(b) + use selection_types + implicit none + BEGIN_DOC +! Removes duplicate determinants in the selection buffer + END_DOC + type(selection_buffer), intent(inout) :: b + integer, allocatable :: iorder(:) + integer(bit_kind), pointer :: detmp(:,:,:) + double precision, pointer :: val(:) + integer :: i,j,k + integer(bit_kind), allocatable :: bit_tmp(:) + logical,allocatable :: duplicate(:) + + logical :: found_duplicates + integer*8, external :: det_search_key + + if (b%N == 0 .or. b%cur == 0) return + allocate (duplicate(b%cur), val(size(b%val)), detmp(N_int, 2, size(b%val)), bit_tmp(b%cur)) + call sort_dets_by_det_search_key(b%cur, b%det, b%val, detmp, val, 1) + + deallocate(b%det, b%val) + do i=b%cur+1,b%N + val(i) = 0.d0 + detmp(1:N_int,1:2,i) = 0_bit_kind + enddo + b%det => detmp + b%val => val + + do i=1,b%cur + bit_tmp(i) = det_search_key(b%det(1,1,i),N_int) + duplicate(i) = .False. + enddo + + do i=1,b%cur-1 + if (duplicate(i)) then + cycle + endif + j = i+1 + do while (bit_tmp(j)==bit_tmp(i)) + if (duplicate(j)) then + j += 1 + if (j > b%cur) then + exit + else + cycle + endif + endif + duplicate(j) = .True. + do k=1,N_int + if ( (b%det(k,1,i) /= b%det(k,1,j) ) & + .or. (b%det(k,2,i) /= b%det(k,2,j) ) ) then + duplicate(j) = .False. + exit + endif + enddo + j += 1 + if (j > b%cur) then + exit + endif + enddo + enddo + + found_duplicates = .False. + do i=1,b%cur + if (duplicate(i)) then + found_duplicates = .True. + exit + endif + enddo + + if (found_duplicates) then + k=0 + do i=1,N_det + if (.not.duplicate(i)) then + k += 1 + b%det(:,:,k) = b%det(:,:,i) + b%val(k) = b%val(i) + endif + enddo + b%cur = k + endif + deallocate (duplicate,bit_tmp) +end + + diff --git a/plugins/shiftedbk/shifted_bk_iter.irp.f b/plugins/shiftedbk/shifted_bk_iter.irp.f new file mode 100644 index 00000000..429efa4b --- /dev/null +++ b/plugins/shiftedbk/shifted_bk_iter.irp.f @@ -0,0 +1,159 @@ +program shifted_bk + implicit none + integer :: i,j,k + double precision, allocatable :: pt2(:) + integer :: degree + integer :: n_det_before + double precision :: threshold_davidson_in + + allocate (pt2(N_states)) + + double precision :: hf_energy_ref + logical :: has + double precision :: relative_error, absolute_error + integer :: N_states_p + character*(512) :: fmt + + 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 + + + pt2 = -huge(1.e0) + threshold_davidson_in = threshold_davidson + threshold_davidson = threshold_davidson_in * 100.d0 + SOFT_TOUCH threshold_davidson + + call diagonalize_CI_dressed + call save_wavefunction + + call ezfio_has_hartree_fock_energy(has) + if (has) then + call ezfio_get_hartree_fock_energy(hf_energy_ref) + else + hf_energy_ref = ref_bitmask_energy + endif + + if (N_det > N_det_max) then + psi_det = psi_det_sorted + psi_coef = psi_coef_sorted + N_det = N_det_max + soft_touch N_det psi_det psi_coef + call diagonalize_CI_dressed + call save_wavefunction + N_states_p = min(N_det,N_states) + endif + + n_det_before = 0 + + character*(8) :: pt2_string + double precision :: threshold_selectors_save, threshold_generators_save + threshold_selectors_save = threshold_selectors + threshold_generators_save = threshold_generators + double precision :: error(N_states), energy(N_states) + error = 0.d0 + + threshold_selectors = 1.d0 + threshold_generators = 1d0 + + if (.True.) then + pt2_string = '(sh-Bk) ' + do while ( (N_det < N_det_max) ) + write(*,'(A)') '--------------------------------------------------------------------------------' + + N_det_delta_ij = N_det + + do i=1,N_states + energy(i) = psi_energy(i)+nuclear_repulsion + enddo + + PROVIDE delta_ij_tmp + call delta_ij_done() + + call diagonalize_ci_dressed + do i=1,N_states + pt2(i) = ci_energy_dressed(i) - energy(i) + enddo + + N_states_p = min(N_det,N_states) + + print *, '' + print '(A,I12)', 'Summary at N_det = ', N_det + print '(A)', '-----------------------------------' + print *, '' + print *, '' + + write(fmt,*) '(''# ============'',', N_states_p, '(1X,''=============================''))' + write(*,fmt) + write(fmt,*) '(12X,', N_states_p, '(6X,A7,1X,I6,10X))' + write(*,fmt) ('State',k, k=1,N_states_p) + write(fmt,*) '(''# ============'',', N_states_p, '(1X,''=============================''))' + write(*,fmt) + write(fmt,*) '(A12,', N_states_p, '(1X,F14.8,15X))' + write(*,fmt) '# E ', energy(1:N_states_p) + if (N_states_p > 1) then + write(*,fmt) '# Excit. (au)', energy(1:N_states_p)-energy(1) + write(*,fmt) '# Excit. (eV)', (energy(1:N_states_p)-energy(1))*27.211396641308d0 + endif + write(fmt,*) '(A12,', 2*N_states_p, '(1X,F14.8))' + write(*,fmt) '# PT2'//pt2_string, (pt2(k), error(k), k=1,N_states_p) + write(*,'(A)') '#' + write(*,fmt) '# E+PT2 ', (energy(k)+pt2(k),error(k), k=1,N_states_p) + if (N_states_p > 1) then + write(*,fmt) '# Excit. (au)', ( (energy(k)+pt2(k)-energy(1)-pt2(1)), & + dsqrt(error(k)*error(k)+error(1)*error(1)), k=1,N_states_p) + write(*,fmt) '# Excit. (eV)', ( (energy(k)+pt2(k)-energy(1)-pt2(1))*27.211396641308d0, & + dsqrt(error(k)*error(k)+error(1)*error(1))*27.211396641308d0, k=1,N_states_p) + endif + write(fmt,*) '(''# ============'',', N_states_p, '(1X,''=============================''))' + write(*,fmt) + print *, '' + + print *, 'N_det = ', N_det + print *, 'N_states = ', N_states + + do k=1, N_states_p + print*,'State ',k + print *, 'PT2 = ', pt2(k) + print *, 'E = ', energy(k) + print *, 'E+PT2'//pt2_string//' = ', energy(k)+pt2(k) + enddo + + print *, '-----' + if(N_states.gt.1)then + print *, 'Variational Energy difference (au | eV)' + do i=2, N_states_p + print*,'Delta E = ', (energy(i) - energy(1)), & + (energy(i) - energy(1)) * 27.211396641308d0 + enddo + print *, '-----' + print*, 'Variational + perturbative Energy difference (au | eV)' + do i=2, N_states_p + print*,'Delta E = ', (energy(i)+ pt2(i) - (energy(1) + pt2(1))), & + (energy(i)+ pt2(i) - (energy(1) + pt2(1))) * 27.211396641308d0 + enddo + endif + call ezfio_set_shiftedbk_energy_pt2(energy(1)+pt2(1)) +! call dump_fci_iterations_value(N_det,energy,pt2) + + n_det_before = N_det + + PROVIDE psi_coef + PROVIDE psi_det + PROVIDE psi_det_sorted + + if (N_det >= N_det_max) then + threshold_davidson = threshold_davidson_in + end if + call save_wavefunction + call ezfio_set_shiftedbk_energy(energy(1)) + call ezfio_set_shiftedbk_energy_pt2(ci_energy_dressed(1)) + enddo + endif + + + + +end + diff --git a/plugins/shiftedbk/shifted_bk_routines.irp.f b/plugins/shiftedbk/shifted_bk_routines.irp.f index 3d4540bd..0663f75e 100644 --- a/plugins/shiftedbk/shifted_bk_routines.irp.f +++ b/plugins/shiftedbk/shifted_bk_routines.irp.f @@ -20,7 +20,7 @@ END_PROVIDER fock_diag_tmp_(:,:,:) = 0.d0 integer :: i - N_det_increase_factor = 1d0 + N_det_increase_factor = dble(N_states) n_det_add = max(1, int(float(N_det) * N_det_increase_factor)) @@ -120,17 +120,16 @@ subroutine delta_ij_done() old_det_gen = N_det_generators - if (dress_stoch_istate == N_states) then - ! Add buffer only when the last state is computed - call sort_selection_buffer(global_sb) - call fill_H_apply_buffer_no_selection(global_sb%cur,global_sb%det,N_int,0) - call copy_H_apply_buffer_to_wf() - if (s2_eig.or.(N_states > 1) ) then - call make_s2_eigenfunction - endif - call undress_with_alpha(old_generators, old_det_gen, psi_det(1,1,N_det_delta_ij+1), N_det-N_det_delta_ij) - call save_wavefunction + ! Add buffer only when the last state is computed + call unique_selection_buffer(global_sb) + call sort_selection_buffer(global_sb) + call fill_H_apply_buffer_no_selection(global_sb%cur,global_sb%det,N_int,0) + call copy_H_apply_buffer_to_wf() + if (s2_eig.or.(N_states > 1) ) then + call make_s2_eigenfunction endif + call undress_with_alpha(old_generators, old_det_gen, psi_det(1,1,N_det_delta_ij+1), N_det-N_det_delta_ij) + call save_wavefunction end subroutine diff --git a/src/Determinants/H_apply.irp.f b/src/Determinants/H_apply.irp.f index cd1baa8f..3ba674f1 100644 --- a/src/Determinants/H_apply.irp.f +++ b/src/Determinants/H_apply.irp.f @@ -192,8 +192,8 @@ subroutine copy_H_apply_buffer_to_wf call normalize(psi_coef,N_det) SOFT_TOUCH N_det psi_det psi_coef - logical :: found_duplicates - call remove_duplicates_in_psi_det(found_duplicates) +! logical :: found_duplicates +! call remove_duplicates_in_psi_det(found_duplicates) end diff --git a/src/Determinants/determinants.irp.f b/src/Determinants/determinants.irp.f index 8530fa64..d01c80ff 100644 --- a/src/Determinants/determinants.irp.f +++ b/src/Determinants/determinants.irp.f @@ -321,21 +321,24 @@ end subroutine END_DOC call sort_dets_by_det_search_key(N_det, psi_det, psi_coef, & - psi_det_sorted_bit, psi_coef_sorted_bit) + psi_det_sorted_bit, psi_coef_sorted_bit, N_states) END_PROVIDER -subroutine sort_dets_by_det_search_key(Ndet, det_in, coef_in, det_out, coef_out) +subroutine sort_dets_by_det_search_key(Ndet, det_in, coef_in, det_out, coef_out, N_st) use bitmasks implicit none - integer, intent(in) :: Ndet + integer, intent(in) :: Ndet, N_st integer(bit_kind), intent(in) :: det_in (N_int,2,psi_det_size) - double precision , intent(in) :: coef_in(psi_det_size,N_states) + double precision , intent(in) :: coef_in(psi_det_size,N_st) integer(bit_kind), intent(out) :: det_out (N_int,2,psi_det_size) - double precision , intent(out) :: coef_out(psi_det_size,N_states) + double precision , intent(out) :: coef_out(psi_det_size,N_st) BEGIN_DOC ! Determinants are sorted are sorted according to their det_search_key. ! Useful to accelerate the search of a random determinant in the wave ! function. + ! + ! /!\ The first dimension of coef_out and coef_in need to be psi_det_size + ! END_DOC integer :: i,j,k integer, allocatable :: iorder(:) @@ -356,7 +359,7 @@ subroutine sort_dets_by_det_search_key(Ndet, det_in, coef_in, det_out, coef_out) det_out(j,1,i) = det_in(j,1,iorder(i)) det_out(j,2,i) = det_in(j,2,iorder(i)) enddo - do k=1,N_states + do k=1,N_st coef_out(i,k) = coef_in(iorder(i),k) enddo enddo diff --git a/src/Determinants/psi_cas.irp.f b/src/Determinants/psi_cas.irp.f index 591843f7..58a71fbc 100644 --- a/src/Determinants/psi_cas.irp.f +++ b/src/Determinants/psi_cas.irp.f @@ -54,7 +54,7 @@ END_PROVIDER ! function. END_DOC call sort_dets_by_det_search_key(N_det_cas, psi_cas, psi_cas_coef, & - psi_cas_sorted_bit, psi_cas_coef_sorted_bit) + psi_cas_sorted_bit, psi_cas_coef_sorted_bit, N_states) END_PROVIDER @@ -107,7 +107,7 @@ END_PROVIDER ! function. END_DOC call sort_dets_by_det_search_key(N_det_cas, psi_non_cas, psi_non_cas_coef, & - psi_non_cas_sorted_bit, psi_non_cas_coef_sorted_bit) + psi_non_cas_sorted_bit, psi_non_cas_coef_sorted_bit, N_states) END_PROVIDER From 5fc2bd19c8282a8dd5199fc3fc62afad647a5aa9 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 24 May 2018 14:12:25 +0200 Subject: [PATCH 28/96] Fixed Generators_CAS --- plugins/Generators_CAS/generators.irp.f | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Generators_CAS/generators.irp.f b/plugins/Generators_CAS/generators.irp.f index 67d3cc31..426306dc 100644 --- a/plugins/Generators_CAS/generators.irp.f +++ b/plugins/Generators_CAS/generators.irp.f @@ -39,7 +39,7 @@ END_PROVIDER psi_det_generators(k,1,m) = psi_det_sorted(k,1,i) psi_det_generators(k,2,m) = psi_det_sorted(k,2,i) enddo - psi_coef_generators(m,:) = psi_coef_sorted(m,:) + psi_coef_generators(m,:) = psi_coef_sorted(i,:) endif enddo From db6ab659a1c425066569250ec3703220629c6931 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 24 May 2018 16:19:27 +0200 Subject: [PATCH 29/96] S2 --- plugins/mrcepa0/dressing.irp.f | 2 +- plugins/mrcepa0/mrcc_stoch_routines.irp.f | 4 +--- .../diagonalization_hs2_dressed.irp.f | 20 +++++++++---------- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/plugins/mrcepa0/dressing.irp.f b/plugins/mrcepa0/dressing.irp.f index a376585c..fc4592ea 100644 --- a/plugins/mrcepa0/dressing.irp.f +++ b/plugins/mrcepa0/dressing.irp.f @@ -581,7 +581,7 @@ END_PROVIDER double precision, allocatable :: mrcc(:) double precision :: E_CI_before!, relative_error - double precision, save :: target_error = 0d0 + double precision, save :: target_error = 1d-4 allocate(mrcc(N_states)) diff --git a/plugins/mrcepa0/mrcc_stoch_routines.irp.f b/plugins/mrcepa0/mrcc_stoch_routines.irp.f index 1b605e6d..efa7a1ae 100644 --- a/plugins/mrcepa0/mrcc_stoch_routines.irp.f +++ b/plugins/mrcepa0/mrcc_stoch_routines.irp.f @@ -177,7 +177,6 @@ subroutine mrcc_collector(zmq_socket_pull, E, relative_error, delta, delta_s2, m usf = 0d0 num = 0d0 - print *, "TARGET ERROR :", relative_error delta = 0d0 delta_s2 = 0d0 allocate(delta_det(N_states, N_det_non_ref, 0:comb_teeth+1, 2)) @@ -310,7 +309,6 @@ subroutine mrcc_collector(zmq_socket_pull, E, relative_error, delta, delta_s2, m end if end do if(cur_cp == 0) then - print *, "no checkpoint reached so far..." cycle pullLoop end if !!!!!!!!!!!! @@ -337,7 +335,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 end if - if ((dabs(eqt) < relative_error .and. cps_N(cur_cp) >= 30) .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 call sleep(1) if (zmq_abort(zmq_to_qp_run_socket) == -1) then diff --git a/src/Davidson/diagonalization_hs2_dressed.irp.f b/src/Davidson/diagonalization_hs2_dressed.irp.f index c57312a9..c6ccf99d 100644 --- a/src/Davidson/diagonalization_hs2_dressed.irp.f +++ b/src/Davidson/diagonalization_hs2_dressed.irp.f @@ -254,9 +254,9 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_ dressing_column_h, size(dressing_column_h,1), s_tmp, size(s_tmp,1), & 1.d0, W(1,shift+1), size(W,1)) -! call dgemm('N','N', sze, N_st_diag, N_st, 0.5d0, & -! dressing_column_s, size(dressing_column_s,1), s_tmp, size(s_tmp,1), & -! 1.d0, S(1,shift+1), size(S,1)) + call dgemm('N','N', sze, N_st_diag, N_st, 0.5d0, & + dressing_column_s, size(dressing_column_s,1), s_tmp, size(s_tmp,1), & + 1.d0, S(1,shift+1), size(S,1)) call dgemm('T','N', N_st, N_st_diag, sze, 1.d0, & @@ -267,13 +267,13 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_ psi_coef, size(psi_coef,1), s_tmp, size(s_tmp,1), & 1.d0, W(1,shift+1), size(W,1)) -! call dgemm('T','N', N_st, N_st_diag, sze, 1.d0, & -! dressing_column_s, size(dressing_column_s,1), & -! U(1,shift+1), size(U,1), 0.d0, s_tmp, size(s_tmp,1)) -! -! call dgemm('N','N', sze, N_st_diag, N_st, 0.5d0, & -! psi_coef, size(psi_coef,1), s_tmp, size(s_tmp,1), & -! 1.d0, S(1,shift+1), size(S,1)) + call dgemm('T','N', N_st, N_st_diag, sze, 1.d0, & + dressing_column_s, size(dressing_column_s,1), & + U(1,shift+1), size(U,1), 0.d0, s_tmp, size(s_tmp,1)) + + call dgemm('N','N', sze, N_st_diag, N_st, 0.5d0, & + psi_coef, size(psi_coef,1), s_tmp, size(s_tmp,1), & + 1.d0, S(1,shift+1), size(S,1)) endif From 142a2d25fa15ba3624c82739ec16a54da477937d Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 24 May 2018 22:53:59 +0200 Subject: [PATCH 30/96] Allow lowercase in symmetries --- ocaml/Symmetry.ml | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/ocaml/Symmetry.ml b/ocaml/Symmetry.ml index 7b088b73..4cf84f2d 100644 --- a/ocaml/Symmetry.ml +++ b/ocaml/Symmetry.ml @@ -16,30 +16,30 @@ let to_string = function | L -> "L" let of_string = function - | "S" -> S - | "P" -> P - | "D" -> D - | "F" -> F - | "G" -> G - | "H" -> H - | "I" -> I - | "J" -> J - | "K" -> K - | "L" -> L + | "S" | "s" -> S + | "P" | "p" -> P + | "D" | "d" -> D + | "F" | "f" -> F + | "G" | "g" -> G + | "H" | "h" -> H + | "I" | "i" -> I + | "J" | "j" -> J + | "K" | "k" -> K + | "L" | "l" -> L | x -> raise (Failure ("Symmetry should be S|P|D|F|G|H|I|J|K|L, not "^x^".")) let of_char = function - | 'S' -> S - | 'P' -> P - | 'D' -> D - | 'F' -> F - | 'G' -> G - | 'H' -> H - | 'I' -> I - | 'J' -> J - | 'K' -> K - | 'L' -> L + | 'S' | 's' -> S + | 'P' | 'p' -> P + | 'D' | 'd' -> D + | 'F' | 'f' -> F + | 'G' | 'g' -> G + | 'H' | 'h' -> H + | 'I' | 'i' -> I + | 'J' | 'j' -> J + | 'K' | 'k' -> K + | 'L' | 'l' -> L | x -> raise (Failure ("Symmetry should be S|P|D|F|G|H|I|J|K|L")) let to_l = function From 25f7e47ef1ec2cb5a0cafbf71cc569aa9d3d5609 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 24 May 2018 23:50:56 +0200 Subject: [PATCH 31/96] qp_find_pi_space -apply --- ocaml/qp_find_pi_space.ml | 51 ++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/ocaml/qp_find_pi_space.ml b/ocaml/qp_find_pi_space.ml index dcd671ce..e23b4382 100644 --- a/ocaml/qp_find_pi_space.ml +++ b/ocaml/qp_find_pi_space.ml @@ -2,7 +2,7 @@ open Core open Qputils open Qptypes -let run ?(sym="None") ezfio_filename = +let run ?(sym="None") apply ezfio_filename = Ezfio.set_file ezfio_filename ; let aos = @@ -72,28 +72,51 @@ let run ?(sym="None") ezfio_filename = | _ -> ([],[]) in - match sym with - | "x" | "X" | "y" | "Y" | "z" | "Z" -> - begin - Printf.printf "Pi: ["; - List.iter ~f:(fun mo_i -> Printf.printf "%d," mo_i) pi; - Printf.printf "\b]\n\nSigma: ["; - List.iter ~f:(fun mo_i -> Printf.printf "%d," mo_i) sigma; - Printf.printf "\b]\n" - end - | _ -> List.iter ~f:(fun (mo_i,x,y,z) -> Printf.printf "%d: (%f,%f,%f)\n" mo_i x y z) result - + begin + match sym with + | "x" | "X" | "y" | "Y" | "z" | "Z" -> + if apply then + begin + let ne = Ezfio.get_electrons_elec_alpha_num () in + let command = + (Printf.sprintf "qp_set_mo_class -act \"[") ^ + (String.concat ~sep:"," @@ List.map ~f:string_of_int pi) ^ + "]\" -core \"[" ^ + (String.concat ~sep:"," @@ List.map ~f:string_of_int @@ List.filter ~f:(fun mo_i -> mo_i <= ne) sigma) ^ + "]\" -del \"[" ^ + (String.concat ~sep:"," @@ List.map ~f:string_of_int @@ List.filter ~f:(fun mo_i -> mo_i > ne) sigma) ^ + "]\" " ^ ezfio_filename + in + print_endline command; + if Sys.command command <> 0 then + failwith "Command failed" + end + else + begin + Printf.printf "Pi: ["; + List.iter ~f:(fun mo_i -> Printf.printf "%d," mo_i) pi; + Printf.printf "\b]\n\nSigma: ["; + List.iter ~f:(fun mo_i -> Printf.printf "%d," mo_i) sigma; + Printf.printf "\b]\n" + end + | _ -> List.iter ~f:(fun (mo_i,x,y,z) -> Printf.printf "%d: (%f,%f,%f)\n" mo_i x y z) result + end + let spec = let open Command.Spec in empty - +> flag "sym" (optional string) ~doc:"{x,y,z} Axis perpendicular to the plane" + +> flag "sym" (optional string) + ~doc:"{x,y,z} Axis perpendicular to the plane" + +> flag "apply" no_arg + ~doc:"Set the pi space as the active space, all other MOs frozen" +> anon ("ezfio_filename" %: string) + let command = Command.basic_spec ~summary: "Quantum Package command" @@ -101,7 +124,7 @@ let command = "Find all the pi molecular orbitals to create a pi space. ") spec - (fun sym ezfio_filename () -> run ?sym ezfio_filename ) + (fun sym apply ezfio_filename () -> run ?sym apply ezfio_filename) let () = From dbe2e997f9c775f7eda49d7207c63cf09e05bee4 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 25 May 2018 14:18:53 +0200 Subject: [PATCH 32/96] qp_set_frozen_core is deactivated with pseudos --- scripts/qp_set_frozen_core.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/qp_set_frozen_core.py b/scripts/qp_set_frozen_core.py index 51915170..49aaae29 100755 --- a/scripts/qp_set_frozen_core.py +++ b/scripts/qp_set_frozen_core.py @@ -7,6 +7,9 @@ sys.path = [ os.environ["QP_ROOT"]+"/install/EZFIO/Python" ] + sys.path from ezfio import ezfio ezfio.set_filename(sys.argv[1]) +if ezfio.get_pseudo_do_pseudo: + print "I will not set frozen core with pseudopotentials." + sys.exit(0) nb = 0 for charge in ezfio.nuclei_nucl_charge: From de1791f9d67f092706b4a27fae3e2fa9c1512a56 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 25 May 2018 14:47:05 +0200 Subject: [PATCH 33/96] Find_pi_space updated --- ocaml/qp_find_pi_space.ml | 40 +++++++++++++++++++++++++++++------ scripts/qp_set_frozen_core.py | 14 +++++++++--- 2 files changed, 45 insertions(+), 9 deletions(-) diff --git a/ocaml/qp_find_pi_space.ml b/ocaml/qp_find_pi_space.ml index e23b4382..b3702d42 100644 --- a/ocaml/qp_find_pi_space.ml +++ b/ocaml/qp_find_pi_space.ml @@ -2,7 +2,7 @@ open Core open Qputils open Qptypes -let run ?(sym="None") apply ezfio_filename = +let run ?(sym="None") ?(apply="no") fc ezfio_filename = Ezfio.set_file ezfio_filename ; let aos = @@ -75,11 +75,11 @@ let run ?(sym="None") apply ezfio_filename = begin match sym with | "x" | "X" | "y" | "Y" | "z" | "Z" -> - if apply then + if apply = "cas" then begin let ne = Ezfio.get_electrons_elec_alpha_num () in let command = - (Printf.sprintf "qp_set_mo_class -act \"[") ^ + "qp_set_mo_class -act \"[" ^ (String.concat ~sep:"," @@ List.map ~f:string_of_int pi) ^ "]\" -core \"[" ^ (String.concat ~sep:"," @@ List.map ~f:string_of_int @@ List.filter ~f:(fun mo_i -> mo_i <= ne) sigma) ^ @@ -91,6 +91,32 @@ let run ?(sym="None") apply ezfio_filename = if Sys.command command <> 0 then failwith "Command failed" end + else if apply = "cassd" then + begin + let ne = Ezfio.get_electrons_elec_alpha_num () in + let nfc = + if fc then + let ic = + Unix.open_process_in ("qp_set_frozen_core.py -q "^ezfio_filename) + in + let result = int_of_string @@ input_line ic in + close_in ic; result + else 0 + in + let command = + "qp_set_mo_class" ^ + ( if nfc > 0 then + Printf.sprintf " -core \"[1-%d]\"" nfc else "") ^ + " -inact \"[" ^ + (String.concat ~sep:"," @@ List.map ~f:string_of_int @@ List.filter ~f:(fun mo_i -> mo_i > nfc && mo_i <= ne) sigma) ^ "]\"" ^ + " -act \"[" ^ (String.concat ~sep:"," @@ List.map ~f:string_of_int pi) ^ "]\"" ^ + " -virt \"[" ^ + (String.concat ~sep:"," @@ List.map ~f:string_of_int @@ List.filter ~f:(fun mo_i -> mo_i > ne) sigma) ^ "]\" " ^ ezfio_filename + in + print_endline command; + if Sys.command command <> 0 then + failwith "Command failed" + end else begin Printf.printf "Pi: ["; @@ -111,8 +137,10 @@ let spec = empty +> flag "sym" (optional string) ~doc:"{x,y,z} Axis perpendicular to the plane" - +> flag "apply" no_arg - ~doc:"Set the pi space as the active space, all other MOs frozen" + +> flag "apply" (optional string) + ~doc:"[cas|cassd] Set the pi space as the active space, all other MOs frozen. If [cassd] is chosen, set inactive and virtual mos." + +> flag "fc" no_arg + ~doc:"freeze core MOs with -apply cassd" +> anon ("ezfio_filename" %: string) @@ -124,7 +152,7 @@ let command = "Find all the pi molecular orbitals to create a pi space. ") spec - (fun sym apply ezfio_filename () -> run ?sym apply ezfio_filename) + (fun sym apply fc ezfio_filename () -> run ?sym ?apply fc ezfio_filename) let () = diff --git a/scripts/qp_set_frozen_core.py b/scripts/qp_set_frozen_core.py index 49aaae29..aee32574 100755 --- a/scripts/qp_set_frozen_core.py +++ b/scripts/qp_set_frozen_core.py @@ -6,8 +6,16 @@ import sys sys.path = [ os.environ["QP_ROOT"]+"/install/EZFIO/Python" ] + sys.path from ezfio import ezfio -ezfio.set_filename(sys.argv[1]) -if ezfio.get_pseudo_do_pseudo: + +filename = sys.argv[1] +if filename == '-q': filename = sys.argv[2] + +ezfio.set_filename(filename) + +if ezfio.pseudo_do_pseudo: + if '-q' in sys.argv: + print 0 + sys.exit(0) print "I will not set frozen core with pseudopotentials." sys.exit(0) @@ -23,7 +31,7 @@ for charge in ezfio.nuclei_nucl_charge: mo_tot_num = ezfio.mo_basis_mo_tot_num if len(sys.argv)>2: - if sys.argv[2] == '-q': + if '-q' in sys.argv: print nb sys.exit(0) From 50b12bcacbaef29de0f3dc9b6d3a128cf803fc3a Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 25 May 2018 15:03:12 +0200 Subject: [PATCH 34/96] L3 weight --- plugins/Full_CI_ZMQ/selection.irp.f | 24 +--------------- src/Determinants/EZFIO.cfg | 7 +++++ src/Determinants/density_matrix.irp.f | 38 +++++++++++++++++++++---- src/Determinants/spindeterminants.irp.f | 6 ++-- 4 files changed, 43 insertions(+), 32 deletions(-) diff --git a/plugins/Full_CI_ZMQ/selection.irp.f b/plugins/Full_CI_ZMQ/selection.irp.f index 095f7104..516c4567 100644 --- a/plugins/Full_CI_ZMQ/selection.irp.f +++ b/plugins/Full_CI_ZMQ/selection.irp.f @@ -1,26 +1,4 @@ use bitmasks -BEGIN_PROVIDER [ double precision, selection_weight, (N_states) ] - implicit none - BEGIN_DOC - ! Weight of the states in the selection : 1/(sum_i c_i^4) - END_DOC - integer :: i,k - double precision :: c - print *, 'Selection weights' - print *, '-----------------' - do i=1,N_states - selection_weight(i) = 0.d0 - do k=1,N_det - c = psi_coef(k,i)*psi_coef(k,i) - selection_weight(i) = selection_weight(i) + c*abs(psi_coef(k,i)) - enddo - selection_weight(i) = 1.d0/selection_weight(i) - print *, i, selection_weight(i) - enddo - print *, '-----------------' - -END_PROVIDER - BEGIN_PROVIDER [ integer, fragment_count ] implicit none @@ -654,7 +632,7 @@ subroutine fill_buffer_double(i_generator, sp, h1, h2, bannedOrb, banned, fock_d endif e_pert = 0.5d0 * (tmp - delta_E) pt2(istate) = pt2(istate) + e_pert - sum_e_pert = sum_e_pert + e_pert * selection_weight(istate) + sum_e_pert = sum_e_pert + e_pert * state_average_weight(istate) end do if(sum_e_pert <= buf%mini) then diff --git a/src/Determinants/EZFIO.cfg b/src/Determinants/EZFIO.cfg index c86f831d..d55dd612 100644 --- a/src/Determinants/EZFIO.cfg +++ b/src/Determinants/EZFIO.cfg @@ -40,6 +40,13 @@ doc: Force the wave function to be an eigenfunction of S^2 interface: ezfio,provider,ocaml default: True +[use_l3_weight] +type: logical +doc: If true, set the state-averaged weight to 1/(Norm_L3(Psi)) +interface: ezfio,provider,ocaml +default: False + + [threshold_generators] type: Threshold doc: Thresholds on generators (fraction of the norm) diff --git a/src/Determinants/density_matrix.irp.f b/src/Determinants/density_matrix.irp.f index bd5f0741..44d26346 100644 --- a/src/Determinants/density_matrix.irp.f +++ b/src/Determinants/density_matrix.irp.f @@ -361,6 +361,28 @@ subroutine save_natural_mos end +BEGIN_PROVIDER [ double precision, l3_weight, (N_states) ] + implicit none + BEGIN_DOC + ! Weight of the states in the selection : 1/(sum_i c_i^4) + END_DOC + integer :: i,k + double precision :: c + do i=1,N_states + l3_weight(i) = 1.d-31 + do k=1,N_det + c = psi_coef(k,i)*psi_coef(k,i) + l3_weight(i) = l3_weight(i) + c*abs(psi_coef(k,i)) + enddo + l3_weight(i) = min(1.d0/l3_weight(i), 100.d0) + enddo + print *, 'L3 weights' + print *, '----------' + print *, l3_weight(1:N_states) + +END_PROVIDER + + BEGIN_PROVIDER [ double precision, state_average_weight, (N_states) ] implicit none BEGIN_DOC @@ -368,13 +390,17 @@ BEGIN_PROVIDER [ double precision, state_average_weight, (N_states) ] END_DOC logical :: exists - state_average_weight(:) = 1.d0 - call ezfio_has_determinants_state_average_weight(exists) - if (exists) then - call ezfio_get_determinants_state_average_weight(state_average_weight) + if (use_l3_weight) then + state_average_weight(:) = l3_weight(:) + else + state_average_weight(:) = 1.d0 + call ezfio_has_determinants_state_average_weight(exists) + if (exists) then + call ezfio_get_determinants_state_average_weight(state_average_weight) + endif + state_average_weight(:) = state_average_weight(:)+1.d-31 + state_average_weight(:) = state_average_weight(:)/(sum(state_average_weight(:))) endif - state_average_weight(:) = state_average_weight(:)+1.d-31 - state_average_weight(:) = state_average_weight(:)/(sum(state_average_weight(:))) END_PROVIDER diff --git a/src/Determinants/spindeterminants.irp.f b/src/Determinants/spindeterminants.irp.f index 136872b4..1f076057 100644 --- a/src/Determinants/spindeterminants.irp.f +++ b/src/Determinants/spindeterminants.irp.f @@ -367,13 +367,13 @@ end j = psi_bilinear_matrix_columns(k) f = 0.d0 do l=1,N_states - f += psi_bilinear_matrix_values(k,l)*psi_bilinear_matrix_values(k,l) + f += psi_bilinear_matrix_values(k,l)*psi_bilinear_matrix_values(k,l) * state_average_weight(l) enddo det_alpha_norm(i) += f det_beta_norm(j) += f enddo - det_alpha_norm = det_alpha_norm / dble(N_states) - det_beta_norm = det_beta_norm / dble(N_states) + det_alpha_norm = det_alpha_norm + det_beta_norm = det_beta_norm END_PROVIDER From 3a53ba3ea19d9832f3c0d81d51b7d68ed5c5da6b Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 25 May 2018 15:56:18 +0200 Subject: [PATCH 35/96] prepend in quantum_package.rc --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 2a7d62e2..b8ac30f2 100755 --- a/configure +++ b/configure @@ -489,7 +489,7 @@ def create_ninja_and_rc(l_installed): 'function qp_prepend_export () {', ' #Prepend path $2:${!1}. Add the semicolon only if ${!1} is defined', ' eval "value_1=\"\${$1}\""', - ' echo ${value_1:+${value_1}:}${2}', + ' echo ${value_1:+${2}:${value_1}}', '}', 'export PYTHONPATH=$(qp_prepend_export "PYTHONPATH" "${QP_EZFIO}/Python":"${QP_PYTHON}")', 'export PATH=$(qp_prepend_export "PATH" "${QP_PYTHON}":"${QP_ROOT}"/bin:"${QP_ROOT}"/ocaml)', From ba1f94d13dff9915eedda8b8bcb51fd6e899fad9 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 25 May 2018 16:42:53 +0200 Subject: [PATCH 36/96] Fixed state-averaged weights --- src/Determinants/density_matrix.irp.f | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Determinants/density_matrix.irp.f b/src/Determinants/density_matrix.irp.f index 44d26346..a4e5f5f0 100644 --- a/src/Determinants/density_matrix.irp.f +++ b/src/Determinants/density_matrix.irp.f @@ -390,17 +390,17 @@ BEGIN_PROVIDER [ double precision, state_average_weight, (N_states) ] END_DOC logical :: exists + state_average_weight(:) = 1.d0 if (use_l3_weight) then state_average_weight(:) = l3_weight(:) else - state_average_weight(:) = 1.d0 call ezfio_has_determinants_state_average_weight(exists) if (exists) then call ezfio_get_determinants_state_average_weight(state_average_weight) endif - state_average_weight(:) = state_average_weight(:)+1.d-31 - state_average_weight(:) = state_average_weight(:)/(sum(state_average_weight(:))) endif + state_average_weight(:) = state_average_weight(:)+1.d-31 + state_average_weight(:) = state_average_weight(:)/(sum(state_average_weight(:))) END_PROVIDER From 7be923f801dcdb0964f76b9fbee30784abea5620 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 30 May 2018 13:46:48 +0200 Subject: [PATCH 37/96] Davidson N_states_diag incrementing --- configure | 9 ++++-- .../qp_convert_output_to_ezfio.py | 3 +- scripts/qp_set_frozen_core.py | 22 +++++--------- .../diagonalization_hs2_dressed.irp.f | 30 +++++++++++++++---- src/MO_Basis/ao_ortho_canonical.irp.f | 12 +++++--- src/MO_Basis/utils.irp.f | 11 +++++-- 6 files changed, 57 insertions(+), 30 deletions(-) diff --git a/configure b/configure index b8ac30f2..8cc19b56 100755 --- a/configure +++ b/configure @@ -487,9 +487,12 @@ def create_ninja_and_rc(l_installed): 'export IRPF90={0}'.format(path_irpf90.replace(QP_ROOT,"${QP_ROOT}")), 'export NINJA={0}'.format(path_ninja.replace(QP_ROOT,"${QP_ROOT}")), 'function qp_prepend_export () {', - ' #Prepend path $2:${!1}. Add the semicolon only if ${!1} is defined', - ' eval "value_1=\"\${$1}\""', - ' echo ${value_1:+${2}:${value_1}}', + 'eval "value_1="\${$1}""', + 'if [[ -z $value_1 ]] ; then', + ' echo "${1}=${2}:"', + 'else', + ' echo "${1}=${2}:${value_1}"', + 'fi', '}', 'export PYTHONPATH=$(qp_prepend_export "PYTHONPATH" "${QP_EZFIO}/Python":"${QP_PYTHON}")', 'export PATH=$(qp_prepend_export "PATH" "${QP_PYTHON}":"${QP_ROOT}"/bin:"${QP_ROOT}"/ocaml)', diff --git a/scripts/ezfio_interface/qp_convert_output_to_ezfio.py b/scripts/ezfio_interface/qp_convert_output_to_ezfio.py index 6b415dd7..ab9d7c65 100755 --- a/scripts/ezfio_interface/qp_convert_output_to_ezfio.py +++ b/scripts/ezfio_interface/qp_convert_output_to_ezfio.py @@ -28,7 +28,8 @@ except: sys.exit(1) else: sys.path = [ QP_ROOT + "/install/EZFIO/Python", - QP_ROOT + "/resultsFile", + QP_ROOT + "/install/resultsFile", + QP_ROOT + "/install", QP_ROOT + "/scripts"] + sys.path # ~#~#~#~#~#~ # diff --git a/scripts/qp_set_frozen_core.py b/scripts/qp_set_frozen_core.py index aee32574..e5046055 100755 --- a/scripts/qp_set_frozen_core.py +++ b/scripts/qp_set_frozen_core.py @@ -12,21 +12,15 @@ if filename == '-q': filename = sys.argv[2] ezfio.set_filename(filename) -if ezfio.pseudo_do_pseudo: - if '-q' in sys.argv: - print 0 - sys.exit(0) - print "I will not set frozen core with pseudopotentials." - sys.exit(0) - nb = 0 -for charge in ezfio.nuclei_nucl_charge: - if charge < 5: - pass - elif charge < 13: - nb += 1 - else: - nb += 5 +if not ezfio.pseudo_do_pseudo: + for charge in ezfio.nuclei_nucl_charge: + if charge < 5: + pass + elif charge < 13: + nb += 1 + else: + nb += 5 mo_tot_num = ezfio.mo_basis_mo_tot_num diff --git a/src/Davidson/diagonalization_hs2_dressed.irp.f b/src/Davidson/diagonalization_hs2_dressed.irp.f index c6ccf99d..968578eb 100644 --- a/src/Davidson/diagonalization_hs2_dressed.irp.f +++ b/src/Davidson/diagonalization_hs2_dressed.irp.f @@ -65,12 +65,27 @@ subroutine davidson_diag_hs2(dets_in,u_in,s2_out,dim_in,energies,sze,N_st,N_st_d enddo endif - call davidson_diag_hjj_sjj(dets_in,u_in,H_jj,S2_out,energies,dim_in,sze,N_st,N_st_diag,Nint,dressing_state) + integer :: N_st_diag_local + double precision, allocatable :: energies_local(:), s2_out_local(:), u_in_local(:,:) + logical :: converged + converged = .False. + call davidson_diag_hjj_sjj(dets_in,u_in,H_jj,S2_out,energies,dim_in,sze,N_st,N_st_diag,Nint,dressing_state,converged) + N_st_diag_local = N_st_diag + do while (.not.converged) + N_st_diag_local += N_states + allocate (energies_local(N_st_diag_local), s2_out_local(N_st_diag_local), u_in_local(sze,N_st_diag_local)) + u_in_local(1:sze,1:N_st_diag) = u_in(1:sze,1:N_st_diag) + call davidson_diag_hjj_sjj(dets_in,u_in_local,H_jj,s2_out_local,energies_local,dim_in,sze,N_st,N_st_diag_local,Nint,dressing_state,converged) + energies(1:N_st_diag) = energies_local(1:N_st_diag) + s2_out(1:N_st_diag) = s2_out_local(1:N_st_diag) + u_in(1:sze,1:N_st_diag) = u_in_local(1:sze,1:N_st_diag) + deallocate (energies_local, s2_out_local, u_in_local) + enddo deallocate (H_jj) end -subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_st,N_st_diag,Nint,dressing_state) +subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_st,N_st_diag,Nint,dressing_state,converged) use bitmasks implicit none BEGIN_DOC @@ -105,13 +120,13 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_ integer :: iter integer :: i,j,k,l,m - logical :: converged + logical, intent(inout) :: converged double precision, external :: u_dot_v, u_dot_u integer :: k_pairs, kl - integer :: iter2 + integer :: iter2, itertot double precision, allocatable :: W(:,:), U(:,:), S(:,:), overlap(:,:) double precision, allocatable :: y(:,:), h(:,:), lambda(:), s2(:) double precision, allocatable :: c(:), s_(:,:), s_tmp(:,:) @@ -133,6 +148,7 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_ endif itermax = max(3,min(davidson_sze_max, sze/N_st_diag)) + itertot = 0 PROVIDE nuclear_repulsion expected_s2 psi_bilinear_matrix_order psi_bilinear_matrix_order_reverse @@ -220,7 +236,11 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_ do while (.not.converged) - + itertot = itertot+1 + if (itertot == 5) then + exit + endif + do k=1,N_st_diag do i=1,sze U(i,k) = u_in(i,k) diff --git a/src/MO_Basis/ao_ortho_canonical.irp.f b/src/MO_Basis/ao_ortho_canonical.irp.f index 5d01efb9..ab93f94e 100644 --- a/src/MO_Basis/ao_ortho_canonical.irp.f +++ b/src/MO_Basis/ao_ortho_canonical.irp.f @@ -2,9 +2,7 @@ &BEGIN_PROVIDER [ integer, ao_cart_to_sphe_num ] implicit none BEGIN_DOC -! matrix of the coefficients of the mos generated by the -! orthonormalization by the S^{-1/2} canonical transformation of the aos -! ao_cart_to_sphe_coef(i,j) = coefficient of the ith ao on the jth ao_ortho_canonical orbital +! ao_cart_to_sphe coefficients of the current basis set END_DOC integer :: i integer, external :: ao_power_index @@ -117,7 +115,6 @@ END_PROVIDER ao_num,ao_ortho_canonical_coef,size(ao_ortho_canonical_coef,1), & ao_ortho_canonical_num) - else double precision, allocatable :: S(:,:) @@ -137,6 +134,13 @@ END_PROVIDER S, size(S,1), & 0.d0, ao_ortho_canonical_coef, size(ao_ortho_canonical_coef,1)) +!integer :: j +!do i=1,ao_num +! do j=1,ao_num +! print *, i,j, ao_ortho_canonical_coef(i,j) +! enddo +!enddo +!stop deallocate(S) endif END_PROVIDER diff --git a/src/MO_Basis/utils.irp.f b/src/MO_Basis/utils.irp.f index 212d2b6f..b8eed315 100644 --- a/src/MO_Basis/utils.irp.f +++ b/src/MO_Basis/utils.irp.f @@ -112,6 +112,7 @@ subroutine mo_as_svd_vectors_of_mo_matrix(matrix,lda,m,n,label) double precision, intent(in) :: matrix(lda,n) integer :: i,j + double precision :: accu double precision, allocatable :: mo_coef_new(:,:), U(:,:),D(:), A(:,:), Vt(:,:), work(:) !DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: mo_coef_new, U, Vt, A @@ -137,12 +138,16 @@ subroutine mo_as_svd_vectors_of_mo_matrix(matrix,lda,m,n,label) write (6,'(A)') 'Eigenvalues' write (6,'(A)') '-----------' write (6,'(A)') '' - write (6,'(A)') '======== ================' + write (6,'(A)') '======== ================ ================' + write (6,'(A)') ' MO Eigenvalue Cumulative ' + write (6,'(A)') '======== ================ ================' + accu = 0.d0 do i=1,m - write (6,'(I8,1X,F16.10)') i,D(i) + accu = accu + D(i) + write (6,'(I8,1X,F16.10,1X,F16.10)') i,D(i), accu enddo - write (6,'(A)') '======== ================' + write (6,'(A)') '======== ================ ================' write (6,'(A)') '' call dgemm('N','N',ao_num,m,m,1.d0,mo_coef_new,size(mo_coef_new,1),U,size(U,1),0.d0,mo_coef,size(mo_coef,1)) From ace711ae143900cc173d66162c373891ae2c58b1 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 5 Jun 2018 17:51:10 +0200 Subject: [PATCH 38/96] Parallel bugs fixed --- ocaml/TaskServer.ml | 2 +- plugins/Full_CI_ZMQ/pt2_slave.irp.f | 82 -------------- plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f | 18 ++- plugins/Full_CI_ZMQ/run_pt2_slave.irp.f | 8 +- plugins/Full_CI_ZMQ/run_selection_slave.irp.f | 107 +++++++++++++++++- plugins/Full_CI_ZMQ/selection.irp.f | 28 ++--- .../selection_davidson_slave.irp.f | 21 +++- plugins/Full_CI_ZMQ/zmq_selection.irp.f | 6 + src/Determinants/s2.irp.f | 9 +- src/Integrals_Bielec/map_integrals.irp.f | 2 +- src/ZMQ/put_get.irp.f | 105 ++++++++++++++++- src/ZMQ/utils.irp.f | 14 +-- 12 files changed, 283 insertions(+), 119 deletions(-) delete mode 100644 plugins/Full_CI_ZMQ/pt2_slave.irp.f diff --git a/ocaml/TaskServer.ml b/ocaml/TaskServer.ml index 42524d2d..44a46f52 100644 --- a/ocaml/TaskServer.ml +++ b/ocaml/TaskServer.ml @@ -625,7 +625,7 @@ let get_data msg program_state rep_socket = let value = match StringHashtbl.find program_state.data key with | Some value -> value - | None -> "" + | None -> "\0" in Message.GetDataReply (Message.GetDataReply_msg.create ~value) |> Message.to_string_list diff --git a/plugins/Full_CI_ZMQ/pt2_slave.irp.f b/plugins/Full_CI_ZMQ/pt2_slave.irp.f deleted file mode 100644 index 2764b169..00000000 --- a/plugins/Full_CI_ZMQ/pt2_slave.irp.f +++ /dev/null @@ -1,82 +0,0 @@ -program pt2_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 -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_diag) - character*(64) :: states(1) - integer :: rc, i - - integer, external :: zmq_get_dvector - integer, external :: zmq_get_psi - - call provide_everything - - zmq_context = f77_zmq_ctx_new () - states(1) = 'pt2' - - zmq_to_qp_run_socket = new_zmq_to_qp_run_socket() - - do - - call wait_for_states(states,zmq_state,1) - - if(trim(zmq_state) == 'Stopped') then - - exit - - else if (trim(zmq_state) == 'pt2') then - - ! Selection - ! --------- - - print *, 'PT2' - if (zmq_get_psi(zmq_to_qp_run_socket,1) == -1) cycle - if (zmq_get_dvector(zmq_to_qp_run_socket,1,'energy',energy,N_states) == -1) cycle - - 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_energy(1:N_states) = energy(1:N_states) - TOUCH psi_energy - - !$OMP PARALLEL PRIVATE(i) - i = omp_get_thread_num() - call pt2_slave_tcp(i, energy) - !$OMP END PARALLEL - print *, 'PT2 done' - - endif - - end do -end - -subroutine pt2_slave_tcp(i,energy) - implicit none - double precision, intent(in) :: energy(N_states_diag) - integer, intent(in) :: i - logical :: lstop - lstop = .False. - call run_pt2_slave(0,i,energy,lstop) -end - diff --git a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f index 96c4db69..c20c409d 100644 --- a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f +++ b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f @@ -37,10 +37,9 @@ subroutine ZMQ_pt2(E, pt2,relative_error, absolute_error, error) state_average_weight_save(:) = state_average_weight(:) do pt2_stoch_istate=1,N_states - SOFT_TOUCH pt2_stoch_istate state_average_weight(:) = 0.d0 state_average_weight(pt2_stoch_istate) = 1.d0 - TOUCH state_average_weight + TOUCH state_average_weight pt2_stoch_istate allocate(pt2_detail(N_states,N_det_generators+1), comb(N_det_generators), computed(N_det_generators), tbc(0:size_tbc)) sumabove = 0d0 @@ -71,6 +70,7 @@ subroutine ZMQ_pt2(E, pt2,relative_error, absolute_error, error) integer, external :: zmq_put_N_det_generators integer, external :: zmq_put_N_det_selectors integer, external :: zmq_put_dvector + integer, external :: zmq_put_ivector if (zmq_put_psi(zmq_to_qp_run_socket,1) == -1) then stop 'Unable to put psi on ZMQ server' endif @@ -83,6 +83,20 @@ subroutine ZMQ_pt2(E, pt2,relative_error, absolute_error, error) 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,'state_average_weight',pt2_e0_denominator,size(state_average_weight)) == -1) then + stop 'Unable to put state_average_weight on ZMQ server' + endif + 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 + + call create_selection_buffer(1, 1*2, b) integer :: ipos diff --git a/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f b/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f index 88c8aacb..dbd9dd48 100644 --- a/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f +++ b/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f @@ -25,6 +25,12 @@ subroutine run_pt2_slave(thread,iproc,energy) integer :: n_tasks, k, n_tasks_max integer, allocatable :: i_generator(:), subset(:) +!if (mpi_master) then +! do i=1,N_det_generators +! print '(I6,X,100(I10,X))' ,i, psi_det_generators(:,:,i) +! enddo +!endif + n_tasks_max = N_det_generators/100+1 allocate(task_id(n_tasks_max), task(n_tasks_max)) allocate(pt2(N_states,n_tasks_max), i_generator(n_tasks_max), subset(n_tasks_max)) @@ -77,8 +83,8 @@ subroutine run_pt2_slave(thread,iproc,energy) continue endif - call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) call end_zmq_push_socket(zmq_socket_push,thread) + call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) call delete_selection_buffer(buf) end subroutine diff --git a/plugins/Full_CI_ZMQ/run_selection_slave.irp.f b/plugins/Full_CI_ZMQ/run_selection_slave.irp.f index 3f0e6865..4aa3594c 100644 --- a/plugins/Full_CI_ZMQ/run_selection_slave.irp.f +++ b/plugins/Full_CI_ZMQ/run_selection_slave.irp.f @@ -1,5 +1,110 @@ - subroutine run_selection_slave(thread,iproc,energy) + call run_selection_slave_new(thread,iproc,energy) +end + +subroutine run_selection_slave_new(thread,iproc,energy) + use f77_zmq + use selection_types + implicit none + + double precision, intent(in) :: energy(N_states_diag) + integer, intent(in) :: thread, iproc + integer :: rc, i, N + logical :: buffer_ready + + integer :: worker_id, ltask + character*(512), allocatable :: task(:) + integer, allocatable :: task_id(:) + + integer(ZMQ_PTR),external :: new_zmq_to_qp_run_socket + integer(ZMQ_PTR) :: zmq_to_qp_run_socket + + integer(ZMQ_PTR), external :: new_zmq_push_socket + integer(ZMQ_PTR) :: zmq_socket_push + + type(selection_buffer) :: buf, buf2 + logical :: done + + double precision,allocatable :: pt2(:,:) + integer :: n_tasks, k, n_tasks_max + integer, allocatable :: i_generator(:), subset(:) + + 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 + + buffer_ready = .False. + n_tasks_max = N_det_generators/100+1 + allocate(task_id(n_tasks_max), task(n_tasks_max)) + allocate(pt2(N_states,n_tasks_max), i_generator(n_tasks_max), subset(n_tasks_max)) + + zmq_to_qp_run_socket = new_zmq_to_qp_run_socket() + + integer, external :: connect_to_taskserver + if (connect_to_taskserver(zmq_to_qp_run_socket,worker_id,thread) == -1) then + call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) + return + endif + + zmq_socket_push = new_zmq_push_socket(thread) + + buf%N = 0 + n_tasks = 0 + call create_selection_buffer(0, 0, buf) + done = .False. + do while (.not.done) + + n_tasks = min(n_tasks+1,n_tasks_max) + + integer, external :: get_tasks_from_taskserver + if (get_tasks_from_taskserver(zmq_to_qp_run_socket,worker_id, task_id, task, n_tasks) == -1) then + exit + endif + done = task_id(n_tasks) == 0 + if (done) n_tasks = n_tasks-1 + if (n_tasks == 0) exit + + do k=1,n_tasks + read (task(k),*) subset(k), i_generator(k), N + enddo + + if(buf%N == 0) then + ! Only first time + call create_selection_buffer(N, N*2, buf) + call create_selection_buffer(N, N*2, buf2) + buffer_ready = .True. + endif + + do k=1,n_tasks + pt2(:,k) = 0.d0 + buf%cur = 0 + call select_connected(i_generator(k),energy,pt2(1,k),buf,subset(k)) + enddo + integer, external :: tasks_done_to_taskserver + if (tasks_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id,n_tasks) == -1) then + done = .true. + endif + call sort_selection_buffer(buf) + call merge_selection_buffers(buf,buf2) + call push_selection_results(zmq_socket_push, pt2, buf, task_id, n_tasks) + buf%mini = buf2%mini + pt2(:,:) = 0d0 + buf%cur = 0 + end do + + integer, external :: disconnect_from_taskserver + if (disconnect_from_taskserver(zmq_to_qp_run_socket,worker_id) == -1) then + continue + endif + + call end_zmq_push_socket(zmq_socket_push,thread) + call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) + call delete_selection_buffer(buf) + +end + +subroutine run_selection_slave_old(thread,iproc,energy) use f77_zmq use selection_types implicit none diff --git a/plugins/Full_CI_ZMQ/selection.irp.f b/plugins/Full_CI_ZMQ/selection.irp.f index 516c4567..82276406 100644 --- a/plugins/Full_CI_ZMQ/selection.irp.f +++ b/plugins/Full_CI_ZMQ/selection.irp.f @@ -137,7 +137,7 @@ subroutine get_m2(gen, phasemask, bannedOrb, vect, mask, h, p, sp, coefs) puti = p(j, sp) if(bannedOrb(puti)) cycle pmob = p(turn2(j), sp) - hij = mo_bielec_integral(pfix, pmob, hfix, hmob) + hij = mo_bielec_integral(pmob, pfix, hmob, hfix) hij *= get_phase_bi(phasemask, sp, sfix, hmob, pmob, hfix, pfix) vect(:, puti) += hij * coefs end do @@ -193,13 +193,13 @@ subroutine get_m1(gen, phasemask, bannedOrb, vect, mask, h, p, sp, coefs) do i=1,hole-1 if(lbanned(i)) cycle - hij = (mo_bielec_integral(p1, p2, i, hole) - mo_bielec_integral(p2, p1, i, hole)) + hij = (mo_bielec_integral(i, hole, p1, p2) - mo_bielec_integral(i, hole, p2, p1)) hij *= get_phase_bi(phasemask, sp, sp, i, p1, hole, p2) vect(1:N_states,i) += hij * coefs(1:N_states) end do do i=hole+1,mo_tot_num if(lbanned(i)) cycle - hij = (mo_bielec_integral(p1, p2, hole, i) - mo_bielec_integral(p2, p1, hole, i)) + hij = (mo_bielec_integral(hole, i, p1, p2) - mo_bielec_integral(hole, i, p2, p1)) hij *= get_phase_bi(phasemask, sp, sp, hole, p1, i, p2) vect(1:N_states,i) += hij * coefs(1:N_states) end do @@ -211,7 +211,7 @@ subroutine get_m1(gen, phasemask, bannedOrb, vect, mask, h, p, sp, coefs) p2 = p(1, sh) do i=1,mo_tot_num if(lbanned(i)) cycle - hij = mo_bielec_integral(p1, p2, i, hole) + hij = mo_bielec_integral(i, hole, p1, p2) hij *= get_phase_bi(phasemask, sp, sh, i, p1, hole, p2) vect(1:N_states,i) += hij * coefs(1:N_states) end do @@ -910,12 +910,12 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) tmp_row = 0d0 do putj=1, hfix-1 if(lbanned(putj, ma) .or. banned(putj, puti,bant)) cycle - hij = (mo_bielec_integral(p1, p2, putj, hfix)-mo_bielec_integral(p2,p1,putj,hfix)) * get_phase_bi(phasemask, ma, ma, putj, p1, hfix, p2) + hij = (mo_bielec_integral(putj, hfix, p1, p2)-mo_bielec_integral(putj,hfix,p2,p1)) * get_phase_bi(phasemask, ma, ma, putj, p1, hfix, p2) tmp_row(1:N_states,putj) += hij * coefs(1:N_states) end do do putj=hfix+1, mo_tot_num if(lbanned(putj, ma) .or. banned(putj, puti,bant)) cycle - hij = (mo_bielec_integral(p1, p2, hfix, putj)-mo_bielec_integral(p2,p1,hfix,putj)) * get_phase_bi(phasemask, ma, ma, hfix, p1, putj, p2) + hij = (mo_bielec_integral(hfix,putj,p1, p2)-mo_bielec_integral(hfix,putj,p2,p1)) * get_phase_bi(phasemask, ma, ma, hfix, p1, putj, p2) tmp_row(1:N_states,putj) += hij * coefs(1:N_states) end do @@ -935,13 +935,13 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) !p1 fixed putj = p1 if(.not. banned(putj,puti,bant)) then - hij = mo_bielec_integral(p2,pfix,hfix,puti) * get_phase_bi(phasemask, ma, mi, hfix, p2, puti, pfix) + hij = mo_bielec_integral(puti,hfix,pfix,p2) * get_phase_bi(phasemask, ma, mi, hfix, p2, puti, pfix) tmp_row(:,puti) += hij * coefs(:) end if putj = p2 if(.not. banned(putj,puti,bant)) then - hij = mo_bielec_integral(p1,pfix,hfix,puti) * get_phase_bi(phasemask, ma, mi, hfix, p1, puti, pfix) + hij = mo_bielec_integral(puti,hfix,pfix,p1) * get_phase_bi(phasemask, ma, mi, hfix, p1, puti, pfix) tmp_row2(:,puti) += hij * coefs(:) end if end do @@ -963,12 +963,12 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) tmp_row = 0d0 do putj=1,hfix-1 if(lbanned(putj,ma) .or. banned(puti,putj,1)) cycle - hij = (mo_bielec_integral(p1, p2, putj, hfix)-mo_bielec_integral(p2,p1,putj,hfix)) * get_phase_bi(phasemask, ma, ma, putj, p1, hfix, p2) + hij = (mo_bielec_integral(putj, hfix, p1, p2)-mo_bielec_integral(putj,hfix,p2,p1)) * get_phase_bi(phasemask, ma, ma, putj, p1, hfix, p2) tmp_row(:,putj) += hij * coefs(:) end do do putj=hfix+1,mo_tot_num if(lbanned(putj,ma) .or. banned(puti,putj,1)) cycle - hij = (mo_bielec_integral(p1, p2, hfix, putj)-mo_bielec_integral(p2,p1,hfix,putj)) * get_phase_bi(phasemask, ma, ma, hfix, p1, putj, p2) + hij = (mo_bielec_integral(putj, hfix, p2, p1)-mo_bielec_integral(putj,hfix,p1,p2)) * get_phase_bi(phasemask, ma, ma, hfix, p1, putj, p2) tmp_row(:,putj) += hij * coefs(:) end do @@ -986,13 +986,13 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) if(lbanned(puti,ma)) cycle putj = p2 if(.not. banned(puti,putj,1)) then - hij = mo_bielec_integral(pfix, p1, hfix, puti) * get_phase_bi(phasemask, mi, ma, hfix, pfix, puti, p1) + hij = mo_bielec_integral(puti,hfix, p1,pfix) * get_phase_bi(phasemask, mi, ma, hfix, pfix, puti, p1) tmp_row(:,puti) += hij * coefs(:) end if putj = p1 if(.not. banned(puti,putj,1)) then - hij = mo_bielec_integral(pfix, p2, hfix, puti) * get_phase_bi(phasemask, mi, ma, hfix, pfix, puti, p2) + hij = mo_bielec_integral(puti, hfix, p2, pfix) * get_phase_bi(phasemask, mi, ma, hfix, pfix, puti, p2) tmp_row2(:,puti) += hij * coefs(:) end if end do @@ -1064,7 +1064,7 @@ subroutine get_d0(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) call i_h_j(gen, det, N_int, hij) else phase = get_phase_bi(phasemask, 1, 2, h1, p1, h2, p2) - hij = mo_bielec_integral(p1, p2, h1, h2) * phase + hij = mo_bielec_integral(p2, p1, h2, h1) * phase end if mat(:, p1, p2) += coefs(:) * hij end do @@ -1081,7 +1081,7 @@ subroutine get_d0(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) call apply_particles(mask, sp,puti,sp,putj, det, ok, N_int) call i_h_j(gen, det, N_int, hij) else - hij = (mo_bielec_integral(p1, p2, puti, putj) - mo_bielec_integral(p2, p1, puti, putj))* get_phase_bi(phasemask, sp, sp, puti, p1 , putj, p2) + hij = (mo_bielec_integral(putj, puti, p2, p1) - mo_bielec_integral(putj, puti, p1, p2))* get_phase_bi(phasemask, sp, sp, puti, p1 , putj, p2) end if mat(:, puti, putj) += coefs(:) * hij end do diff --git a/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f b/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f index 2b6df181..67acc567 100644 --- a/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f +++ b/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f @@ -34,6 +34,7 @@ subroutine run_wf double precision :: t0, t1 integer, external :: zmq_get_dvector, zmq_get_N_det_generators + integer, external :: zmq_get_ivector integer, external :: zmq_get_psi, zmq_get_N_det_selectors integer, external :: zmq_get_N_states_diag @@ -65,8 +66,10 @@ subroutine run_wf if (zmq_get_N_det_generators (zmq_to_qp_run_socket, 1) == -1) cycle if (zmq_get_N_det_selectors(zmq_to_qp_run_socket, 1) == -1) cycle if (zmq_get_dvector(zmq_to_qp_run_socket,1,'energy',energy,N_states) == -1) cycle + if (zmq_get_dvector(zmq_to_qp_run_socket,1,'threshold_generators',threshold_generators,1) == -1) cycle + if (zmq_get_dvector(zmq_to_qp_run_socket,1,'threshold_selectors',threshold_selectors,1) == -1) cycle psi_energy(1:N_states) = energy(1:N_states) - TOUCH psi_energy + TOUCH psi_energy threshold_selectors threshold_generators call wall_time(t1) call write_double(6,(t1-t0),'Broadcast time') @@ -105,10 +108,20 @@ subroutine run_wf call wall_time(t0) if (zmq_get_psi(zmq_to_qp_run_socket,1) == -1) cycle if (zmq_get_dvector(zmq_to_qp_run_socket,1,'energy',energy,N_states) == -1) cycle + if (zmq_get_dvector(zmq_to_qp_run_socket,1,'state_average_weight',state_average_weight,N_states) == -1) cycle + if (zmq_get_ivector(zmq_to_qp_run_socket,1,'pt2_stoch_istate',pt2_stoch_istate,1) == -1) cycle if (zmq_get_N_det_generators (zmq_to_qp_run_socket, 1) == -1) cycle if (zmq_get_N_det_selectors(zmq_to_qp_run_socket, 1) == -1) cycle + if (zmq_get_dvector(zmq_to_qp_run_socket,1,'threshold_generators',threshold_generators,1) == -1) cycle + if (zmq_get_dvector(zmq_to_qp_run_socket,1,'threshold_selectors',threshold_selectors,1) == -1) cycle psi_energy(1:N_states) = energy(1:N_states) - TOUCH psi_energy + TOUCH psi_energy state_average_weight pt2_stoch_istate threshold_selectors threshold_generators + print *, 'N_det', N_det + print *, 'N_det_generators', N_det_generators + print *, 'N_det_selectors', N_det_selectors + print *, 'psi_energy', psi_energy + print *, 'pt2_stoch_istate', pt2_stoch_istate + print *, 'state_average_weight', state_average_weight call wall_time(t1) call write_double(6,(t1-t0),'Broadcast time') @@ -117,9 +130,11 @@ subroutine run_wf lstop = .False. !$OMP PARALLEL PRIVATE(i) i = omp_get_thread_num() - call run_pt2_slave(0,i,energy,lstop) + call run_pt2_slave(0,i,pt2_e0_denominator) !$OMP END PARALLEL print *, 'PT2 done' +exit + FREE state_average_weight endif diff --git a/plugins/Full_CI_ZMQ/zmq_selection.irp.f b/plugins/Full_CI_ZMQ/zmq_selection.irp.f index 77a1457f..03d9cb04 100644 --- a/plugins/Full_CI_ZMQ/zmq_selection.irp.f +++ b/plugins/Full_CI_ZMQ/zmq_selection.irp.f @@ -41,6 +41,12 @@ subroutine ZMQ_selection(N_in, pt2) 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,'threshold_generators',threshold_generators,1) == -1) then + stop 'Unable to put threshold_generators on ZMQ server' + endif call create_selection_buffer(N, N*2, b) endif diff --git a/src/Determinants/s2.irp.f b/src/Determinants/s2.irp.f index 1df4721e..273b8352 100644 --- a/src/Determinants/s2.irp.f +++ b/src/Determinants/s2.irp.f @@ -189,8 +189,8 @@ subroutine S2_u_0_nstates(v_0,u_0,n,keys_tmp,Nint,N_st,sze_8) allocate(vt(sze_8,N_st)) vt = 0.d0 - !$OMP DO SCHEDULE(dynamic) do sh=1,shortcut(0,1) + !$OMP DO do sh2=sh,shortcut(0,1) exa = 0 do ni=1,Nint @@ -227,11 +227,11 @@ subroutine S2_u_0_nstates(v_0,u_0,n,keys_tmp,Nint,N_st,sze_8) enddo enddo enddo + !$OMP END DO NOWAIT enddo - !$OMP END DO NOWAIT - !$OMP DO SCHEDULE(dynamic) do sh=1,shortcut(0,2) + !$OMP DO do i=shortcut(sh,2),shortcut(sh+1,2)-1 org_i = sort_idx(i,2) do j=shortcut(sh,2),i-1 @@ -249,8 +249,9 @@ subroutine S2_u_0_nstates(v_0,u_0,n,keys_tmp,Nint,N_st,sze_8) end if end do end do + !$OMP END DO NOWAIT enddo - !$OMP END DO NOWAIT + !$OMP BARRIER do istate=1,N_st do i=n,1,-1 diff --git a/src/Integrals_Bielec/map_integrals.irp.f b/src/Integrals_Bielec/map_integrals.irp.f index 85a2f954..47743efe 100644 --- a/src/Integrals_Bielec/map_integrals.irp.f +++ b/src/Integrals_Bielec/map_integrals.irp.f @@ -421,8 +421,8 @@ double precision function mo_bielec_integral(i,j,k,l) integer, intent(in) :: i,j,k,l double precision :: get_mo_bielec_integral PROVIDE mo_bielec_integrals_in_map mo_integrals_cache - !DIR$ FORCEINLINE PROVIDE mo_bielec_integrals_in_map + !DIR$ FORCEINLINE mo_bielec_integral = get_mo_bielec_integral(i,j,k,l,mo_integrals_map) return end diff --git a/src/ZMQ/put_get.irp.f b/src/ZMQ/put_get.irp.f index 40d2e881..ff58fad2 100644 --- a/src/ZMQ/put_get.irp.f +++ b/src/ZMQ/put_get.irp.f @@ -2,7 +2,7 @@ integer function zmq_put_dvector(zmq_to_qp_run_socket, worker_id, name, x, size_ use f77_zmq implicit none BEGIN_DOC -! Put the X vector on the qp_run scheduler +! Put a float vector on the qp_run scheduler END_DOC integer(ZMQ_PTR), intent(in) :: zmq_to_qp_run_socket integer, intent(in) :: worker_id @@ -40,7 +40,7 @@ integer function zmq_get_dvector(zmq_to_qp_run_socket, worker_id, name, x, size_ use f77_zmq implicit none BEGIN_DOC -! Get psi_coef from the qp_run scheduler +! Get a float vector from the qp_run scheduler END_DOC integer(ZMQ_PTR), intent(in) :: zmq_to_qp_run_socket integer, intent(in) :: worker_id @@ -86,7 +86,7 @@ integer function zmq_get_dvector(zmq_to_qp_run_socket, worker_id, name, x, size_ print *, irp_here//': Unable to broadcast zmq_get_dvector' stop -1 endif - call MPI_BCAST (x, size_x, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) + call MPI_BCAST (x, size_x, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr) if (ierr /= MPI_SUCCESS) then print *, irp_here//': Unable to broadcast dvector' stop -1 @@ -97,3 +97,102 @@ end +integer function zmq_put_ivector(zmq_to_qp_run_socket, worker_id, name, x, size_x) + use f77_zmq + implicit none + BEGIN_DOC +! Put a vector of integers on the qp_run scheduler + END_DOC + integer(ZMQ_PTR), intent(in) :: zmq_to_qp_run_socket + integer, intent(in) :: worker_id + character*(*) :: name + integer, intent(in) :: size_x + integer, intent(out) :: x(size_x) + integer :: rc + character*(256) :: msg + + zmq_put_ivector = 0 + + write(msg,'(A,1X,I8,1X,A200)') 'put_data '//trim(zmq_state), worker_id, name + rc = f77_zmq_send(zmq_to_qp_run_socket,trim(msg),len(trim(msg)),ZMQ_SNDMORE) + if (rc /= len(trim(msg))) then + zmq_put_ivector = -1 + return + endif + + rc = f77_zmq_send(zmq_to_qp_run_socket,x,size_x*4,0) + if (rc /= size_x*4) then + zmq_put_ivector = -1 + return + endif + + rc = f77_zmq_recv(zmq_to_qp_run_socket,msg,len(msg),0) + if (msg(1:rc) /= 'put_data_reply ok') then + zmq_put_ivector = -1 + return + endif + +end + + +integer function zmq_get_ivector(zmq_to_qp_run_socket, worker_id, name, x, size_x) + use f77_zmq + implicit none + BEGIN_DOC +! Get a vector of integers from the qp_run scheduler + END_DOC + integer(ZMQ_PTR), intent(in) :: zmq_to_qp_run_socket + integer, intent(in) :: worker_id + integer, intent(in) :: size_x + character*(*), intent(in) :: name + integer, intent(out) :: x(size_x) + integer :: rc + integer*8 :: rc8 + character*(256) :: msg + + PROVIDE zmq_state + ! Success + zmq_get_ivector = 0 + + if (mpi_master) then + write(msg,'(A,1X,I8,1X,A200)') 'get_data '//trim(zmq_state), worker_id, name + rc = f77_zmq_send(zmq_to_qp_run_socket,trim(msg),len(trim(msg)),0) + if (rc /= len(trim(msg))) then + zmq_get_ivector = -1 + go to 10 + endif + + rc = f77_zmq_recv(zmq_to_qp_run_socket,msg,len(msg),0) + if (msg(1:14) /= 'get_data_reply') then + zmq_get_ivector = -1 + go to 10 + endif + + rc = f77_zmq_recv(zmq_to_qp_run_socket,x,size_x*4,0) + if (rc /= size_x*4) then + zmq_get_ivector = -1 + go to 10 + endif + endif + + 10 continue + + IRP_IF MPI + integer :: ierr + include 'mpif.h' + call MPI_BCAST (zmq_get_ivector, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr) + if (ierr /= MPI_SUCCESS) then + print *, irp_here//': Unable to broadcast zmq_get_ivector' + stop -1 + endif + call MPI_BCAST (x, size_x, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr) + if (ierr /= MPI_SUCCESS) then + print *, irp_here//': Unable to broadcast ivector' + stop -1 + endif + IRP_ENDIF + +end + + + diff --git a/src/ZMQ/utils.irp.f b/src/ZMQ/utils.irp.f index 86c4a3ee..f8f7c71b 100644 --- a/src/ZMQ/utils.irp.f +++ b/src/ZMQ/utils.irp.f @@ -148,12 +148,12 @@ function new_zmq_to_qp_run_socket() stop 'Unable to create zmq req socket' endif - rc = f77_zmq_setsockopt(new_zmq_to_qp_run_socket, ZMQ_SNDTIMEO, 60000, 4) + rc = f77_zmq_setsockopt(new_zmq_to_qp_run_socket, ZMQ_SNDTIMEO, 300000, 4) if (rc /= 0) then stop 'Unable to set send timeout in new_zmq_to_qp_run_socket' endif - rc = f77_zmq_setsockopt(new_zmq_to_qp_run_socket, ZMQ_RCVTIMEO, 60000, 4) + rc = f77_zmq_setsockopt(new_zmq_to_qp_run_socket, ZMQ_RCVTIMEO, 300000, 4) if (rc /= 0) then stop 'Unable to set recv timeout in new_zmq_to_qp_run_socket' endif @@ -250,7 +250,7 @@ IRP_ENDIF stop 'Unable to create zmq pull socket' endif - rc = f77_zmq_setsockopt(new_zmq_pull_socket,ZMQ_LINGER,60000,4) + rc = f77_zmq_setsockopt(new_zmq_pull_socket,ZMQ_LINGER,300000,4) if (rc /= 0) then stop 'Unable to set ZMQ_LINGER on pull socket' endif @@ -332,7 +332,7 @@ IRP_ENDIF stop 'Unable to create zmq push socket' endif - rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_LINGER,60000,4) + rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_LINGER,300000,4) if (rc /= 0) then stop 'Unable to set ZMQ_LINGER on push socket' endif @@ -352,7 +352,7 @@ IRP_ENDIF stop 'Unable to set ZMQ_IMMEDIATE on push socket' endif - rc = f77_zmq_setsockopt(new_zmq_push_socket, ZMQ_SNDTIMEO, 60000, 4) + rc = f77_zmq_setsockopt(new_zmq_push_socket, ZMQ_SNDTIMEO, 300000, 4) if (rc /= 0) then stop 'Unable to set send timout in new_zmq_push_socket' endif @@ -488,7 +488,7 @@ subroutine end_zmq_push_socket(zmq_socket_push,thread) integer :: rc character*(8), external :: zmq_port - rc = f77_zmq_setsockopt(zmq_socket_push,ZMQ_LINGER,60000,4) + rc = f77_zmq_setsockopt(zmq_socket_push,ZMQ_LINGER,300000,4) if (rc /= 0) then stop 'Unable to set ZMQ_LINGER on push socket' endif @@ -1019,7 +1019,7 @@ subroutine end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) character*(8), external :: zmq_port integer :: rc - rc = f77_zmq_setsockopt(zmq_to_qp_run_socket,ZMQ_LINGER,60000,4) + rc = f77_zmq_setsockopt(zmq_to_qp_run_socket,ZMQ_LINGER,300000,4) if (rc /= 0) then stop 'Unable to set ZMQ_LINGER on zmq_to_qp_run_socket' endif From a4fded893f0f5ab2b93384d0bb0209a0e05bbae6 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 5 Jun 2018 21:51:24 +0200 Subject: [PATCH 39/96] Fixed selection --- plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f | 5 +++-- plugins/Full_CI_ZMQ/zmq_selection.irp.f | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f b/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f index 67acc567..aecb3987 100644 --- a/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f +++ b/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f @@ -63,13 +63,14 @@ subroutine run_wf call wall_time(t0) if (zmq_get_psi(zmq_to_qp_run_socket,1) == -1) cycle + if (zmq_get_dvector(zmq_to_qp_run_socket,1,'energy',energy,N_states) == -1) cycle + if (zmq_get_dvector(zmq_to_qp_run_socket,1,'state_average_weight',state_average_weight,N_states) == -1) cycle if (zmq_get_N_det_generators (zmq_to_qp_run_socket, 1) == -1) cycle if (zmq_get_N_det_selectors(zmq_to_qp_run_socket, 1) == -1) cycle - if (zmq_get_dvector(zmq_to_qp_run_socket,1,'energy',energy,N_states) == -1) cycle if (zmq_get_dvector(zmq_to_qp_run_socket,1,'threshold_generators',threshold_generators,1) == -1) cycle if (zmq_get_dvector(zmq_to_qp_run_socket,1,'threshold_selectors',threshold_selectors,1) == -1) cycle psi_energy(1:N_states) = energy(1:N_states) - TOUCH psi_energy threshold_selectors threshold_generators + TOUCH psi_energy state_average_weight threshold_selectors threshold_generators call wall_time(t1) call write_double(6,(t1-t0),'Broadcast time') diff --git a/plugins/Full_CI_ZMQ/zmq_selection.irp.f b/plugins/Full_CI_ZMQ/zmq_selection.irp.f index 03d9cb04..8db4615a 100644 --- a/plugins/Full_CI_ZMQ/zmq_selection.irp.f +++ b/plugins/Full_CI_ZMQ/zmq_selection.irp.f @@ -44,6 +44,9 @@ subroutine ZMQ_selection(N_in, pt2) 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',pt2_e0_denominator,size(state_average_weight)) == -1) then + stop 'Unable to put state_average_weight 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 From 9f127c40a7f728849997531f6b0e90953384a942 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 5 Jun 2018 22:32:06 +0200 Subject: [PATCH 40/96] Fixed parallel runs --- plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f | 2 +- .../selection_davidson_slave.irp.f | 21 ++++++++++++------- plugins/Full_CI_ZMQ/zmq_selection.irp.f | 2 +- src/ZMQ/put_get.irp.f | 2 +- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f index c20c409d..8d36fd55 100644 --- a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f +++ b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f @@ -83,7 +83,7 @@ subroutine ZMQ_pt2(E, pt2,relative_error, absolute_error, error) 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,'state_average_weight',pt2_e0_denominator,size(state_average_weight)) == -1) then + 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 if (zmq_put_ivector(zmq_to_qp_run_socket,1,'pt2_stoch_istate',pt2_stoch_istate,1) == -1) then diff --git a/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f b/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f index aecb3987..abc66089 100644 --- a/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f +++ b/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f @@ -63,15 +63,21 @@ subroutine run_wf call wall_time(t0) if (zmq_get_psi(zmq_to_qp_run_socket,1) == -1) cycle - if (zmq_get_dvector(zmq_to_qp_run_socket,1,'energy',energy,N_states) == -1) cycle - if (zmq_get_dvector(zmq_to_qp_run_socket,1,'state_average_weight',state_average_weight,N_states) == -1) cycle - if (zmq_get_N_det_generators (zmq_to_qp_run_socket, 1) == -1) cycle - if (zmq_get_N_det_selectors(zmq_to_qp_run_socket, 1) == -1) cycle if (zmq_get_dvector(zmq_to_qp_run_socket,1,'threshold_generators',threshold_generators,1) == -1) cycle if (zmq_get_dvector(zmq_to_qp_run_socket,1,'threshold_selectors',threshold_selectors,1) == -1) cycle + if (zmq_get_dvector(zmq_to_qp_run_socket,1,'energy',energy,N_states) == -1) cycle + if (zmq_get_N_det_generators (zmq_to_qp_run_socket, 1) == -1) cycle + if (zmq_get_N_det_selectors(zmq_to_qp_run_socket, 1) == -1) cycle + 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 + print *, 'N_det', N_det + print *, 'N_det_generators', N_det_generators + print *, 'N_det_selectors', N_det_selectors + print *, 'psi_energy', psi_energy + print *, 'pt2_stoch_istate', pt2_stoch_istate + print *, 'state_average_weight', state_average_weight call wall_time(t1) call write_double(6,(t1-t0),'Broadcast time') @@ -108,13 +114,13 @@ subroutine run_wf print *, 'PT2' call wall_time(t0) if (zmq_get_psi(zmq_to_qp_run_socket,1) == -1) cycle - if (zmq_get_dvector(zmq_to_qp_run_socket,1,'energy',energy,N_states) == -1) cycle - if (zmq_get_dvector(zmq_to_qp_run_socket,1,'state_average_weight',state_average_weight,N_states) == -1) cycle - if (zmq_get_ivector(zmq_to_qp_run_socket,1,'pt2_stoch_istate',pt2_stoch_istate,1) == -1) cycle if (zmq_get_N_det_generators (zmq_to_qp_run_socket, 1) == -1) cycle if (zmq_get_N_det_selectors(zmq_to_qp_run_socket, 1) == -1) cycle if (zmq_get_dvector(zmq_to_qp_run_socket,1,'threshold_generators',threshold_generators,1) == -1) cycle if (zmq_get_dvector(zmq_to_qp_run_socket,1,'threshold_selectors',threshold_selectors,1) == -1) cycle + if (zmq_get_dvector(zmq_to_qp_run_socket,1,'energy',energy,N_states) == -1) cycle + if (zmq_get_ivector(zmq_to_qp_run_socket,1,'pt2_stoch_istate',pt2_stoch_istate,1) == -1) cycle + 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 print *, 'N_det', N_det @@ -134,7 +140,6 @@ subroutine run_wf call run_pt2_slave(0,i,pt2_e0_denominator) !$OMP END PARALLEL print *, 'PT2 done' -exit FREE state_average_weight endif diff --git a/plugins/Full_CI_ZMQ/zmq_selection.irp.f b/plugins/Full_CI_ZMQ/zmq_selection.irp.f index 8db4615a..60d0dbe1 100644 --- a/plugins/Full_CI_ZMQ/zmq_selection.irp.f +++ b/plugins/Full_CI_ZMQ/zmq_selection.irp.f @@ -44,7 +44,7 @@ subroutine ZMQ_selection(N_in, pt2) 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',pt2_e0_denominator,size(state_average_weight)) == -1) then + 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 if (zmq_put_dvector(zmq_to_qp_run_socket,1,'threshold_generators',threshold_generators,1) == -1) then diff --git a/src/ZMQ/put_get.irp.f b/src/ZMQ/put_get.irp.f index ff58fad2..5269bd5e 100644 --- a/src/ZMQ/put_get.irp.f +++ b/src/ZMQ/put_get.irp.f @@ -86,7 +86,7 @@ integer function zmq_get_dvector(zmq_to_qp_run_socket, worker_id, name, x, size_ print *, irp_here//': Unable to broadcast zmq_get_dvector' stop -1 endif - call MPI_BCAST (x, size_x, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr) + call MPI_BCAST (x, size_x, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, ierr) if (ierr /= MPI_SUCCESS) then print *, irp_here//': Unable to broadcast dvector' stop -1 From c8ee6036678e98984bf6ad886867775f58ff03df Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 6 Jun 2018 10:47:51 +0200 Subject: [PATCH 41/96] Increased number of fragments --- plugins/Full_CI_ZMQ/selection.irp.f | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Full_CI_ZMQ/selection.irp.f b/plugins/Full_CI_ZMQ/selection.irp.f index 82276406..3da1bca4 100644 --- a/plugins/Full_CI_ZMQ/selection.irp.f +++ b/plugins/Full_CI_ZMQ/selection.irp.f @@ -5,7 +5,7 @@ BEGIN_PROVIDER [ integer, fragment_count ] BEGIN_DOC ! Number of fragments for the deterministic part END_DOC - fragment_count = (elec_alpha_num-n_core_orb)**2 + fragment_count = (elec_alpha_num-n_core_orb)*mo_tot_num END_PROVIDER From 535a3402d87dfca9696f413d89ac8fe33bd244ee Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 6 Jun 2018 13:09:30 +0200 Subject: [PATCH 42/96] Adjust ntasks with time --- plugins/Full_CI_ZMQ/run_pt2_slave.irp.f | 12 ++++++++++-- plugins/Full_CI_ZMQ/run_selection_slave.irp.f | 12 ++++++++++-- src/Davidson/diagonalization_hs2_dressed.irp.f | 4 ++-- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f b/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f index dbd9dd48..613f00e5 100644 --- a/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f +++ b/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f @@ -46,13 +46,14 @@ subroutine run_pt2_slave(thread,iproc,energy) zmq_socket_push = new_zmq_push_socket(thread) buf%N = 0 - n_tasks = 0 + n_tasks = 1 call create_selection_buffer(0, 0, buf) done = .False. do while (.not.done) - n_tasks = min(n_tasks+1,n_tasks_max) + n_tasks = max(1,n_tasks) + n_tasks = min(n_tasks,n_tasks_max) integer, external :: get_tasks_from_taskserver if (get_tasks_from_taskserver(zmq_to_qp_run_socket,worker_id, task_id, task, n_tasks) == -1) then @@ -66,16 +67,23 @@ subroutine run_pt2_slave(thread,iproc,energy) read (task(k),*) subset(k), i_generator(k) enddo + double precision :: time0, time1 + call wall_time(time0) do k=1,n_tasks pt2(:,k) = 0.d0 buf%cur = 0 call select_connected(i_generator(k),energy,pt2(1,k),buf,subset(k)) enddo + call wall_time(time1) + integer, external :: tasks_done_to_taskserver if (tasks_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id,n_tasks) == -1) then done = .true. endif call push_pt2_results(zmq_socket_push, i_generator, pt2, task_id, n_tasks) + + ! Try to adjust n_tasks around 10 seconds per job + n_tasks = int(10.d0 * dble(n_tasks) / (time1 - time0 + 1.d-9))+1 end do integer, external :: disconnect_from_taskserver diff --git a/plugins/Full_CI_ZMQ/run_selection_slave.irp.f b/plugins/Full_CI_ZMQ/run_selection_slave.irp.f index 4aa3594c..43cd340a 100644 --- a/plugins/Full_CI_ZMQ/run_selection_slave.irp.f +++ b/plugins/Full_CI_ZMQ/run_selection_slave.irp.f @@ -50,12 +50,13 @@ subroutine run_selection_slave_new(thread,iproc,energy) zmq_socket_push = new_zmq_push_socket(thread) buf%N = 0 - n_tasks = 0 + n_tasks = 1 call create_selection_buffer(0, 0, buf) done = .False. do while (.not.done) - n_tasks = min(n_tasks+1,n_tasks_max) + n_tasks = max(1,n_tasks) + n_tasks = min(n_tasks,n_tasks_max) integer, external :: get_tasks_from_taskserver if (get_tasks_from_taskserver(zmq_to_qp_run_socket,worker_id, task_id, task, n_tasks) == -1) then @@ -76,11 +77,15 @@ subroutine run_selection_slave_new(thread,iproc,energy) buffer_ready = .True. endif + double precision :: time0, time1 + call wall_time(time0) do k=1,n_tasks pt2(:,k) = 0.d0 buf%cur = 0 call select_connected(i_generator(k),energy,pt2(1,k),buf,subset(k)) enddo + call wall_time(time1) + integer, external :: tasks_done_to_taskserver if (tasks_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id,n_tasks) == -1) then done = .true. @@ -91,6 +96,9 @@ subroutine run_selection_slave_new(thread,iproc,energy) buf%mini = buf2%mini pt2(:,:) = 0d0 buf%cur = 0 + + ! Try to adjust n_tasks around 10 seconds per job + n_tasks = int(10.d0 * dble(n_tasks) / (time1 - time0 + 1.d-9))+1 end do integer, external :: disconnect_from_taskserver diff --git a/src/Davidson/diagonalization_hs2_dressed.irp.f b/src/Davidson/diagonalization_hs2_dressed.irp.f index 968578eb..ad75f583 100644 --- a/src/Davidson/diagonalization_hs2_dressed.irp.f +++ b/src/Davidson/diagonalization_hs2_dressed.irp.f @@ -72,7 +72,7 @@ subroutine davidson_diag_hs2(dets_in,u_in,s2_out,dim_in,energies,sze,N_st,N_st_d call davidson_diag_hjj_sjj(dets_in,u_in,H_jj,S2_out,energies,dim_in,sze,N_st,N_st_diag,Nint,dressing_state,converged) N_st_diag_local = N_st_diag do while (.not.converged) - N_st_diag_local += N_states + N_st_diag_local = 2 * N_st_diag_local allocate (energies_local(N_st_diag_local), s2_out_local(N_st_diag_local), u_in_local(sze,N_st_diag_local)) u_in_local(1:sze,1:N_st_diag) = u_in(1:sze,1:N_st_diag) call davidson_diag_hjj_sjj(dets_in,u_in_local,H_jj,s2_out_local,energies_local,dim_in,sze,N_st,N_st_diag_local,Nint,dressing_state,converged) @@ -237,7 +237,7 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_ do while (.not.converged) itertot = itertot+1 - if (itertot == 5) then + if (itertot == 8) then exit endif From c46635c5ed11b0469585ff042d634703f6fa6375 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 6 Jun 2018 21:21:42 +0200 Subject: [PATCH 43/96] Tuning --- ocaml/Makefile | 3 +- plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f | 8 +- plugins/Full_CI_ZMQ/run_pt2_slave.irp.f | 4 +- plugins/Full_CI_ZMQ/run_selection_slave.irp.f | 4 +- plugins/Full_CI_ZMQ/selection.irp.f | 85 +++++++++++++------ plugins/Full_CI_ZMQ/zmq_selection.irp.f | 2 +- src/Integrals_Bielec/qp_ao_ints.irp.f | 26 +++++- src/ZMQ/utils.irp.f | 2 +- 8 files changed, 95 insertions(+), 39 deletions(-) diff --git a/ocaml/Makefile b/ocaml/Makefile index b666187f..a49304e6 100644 --- a/ocaml/Makefile +++ b/ocaml/Makefile @@ -12,7 +12,8 @@ endif LIBS= PKGS= OCAMLCFLAGS="-g" -OCAMLBUILD=ocamlbuild -j 0 -cflags $(OCAMLCFLAGS) -lflags $(OCAMLCFLAGS) +OCAMLOPTFLAGS="opt -O3 -nodynlink -remove-unused-arguments -rounds 16 -inline 100 -inline-max-unroll 100" +OCAMLBUILD=ocamlbuild -j 0 -cflags $(OCAMLCFLAGS) -lflags $(OCAMLCFLAGS) -ocamlopt $(OCAMLOPTFLAGS) MLLFILES=$(wildcard *.mll) MLFILES=$(wildcard *.ml) ezfio.ml Qptypes.ml Input_auto_generated.ml qp_edit.ml MLIFILES=$(wildcard *.mli) git diff --git a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f index 8d36fd55..04718218 100644 --- a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f +++ b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f @@ -396,7 +396,11 @@ end function BEGIN_PROVIDER [ integer, comb_teeth ] implicit none - comb_teeth = 100 + BEGIN_DOC +! Number of teeth in the comb + END_DOC + comb_teeth = min(1+N_det/10,100) + END_PROVIDER @@ -555,7 +559,7 @@ END_PROVIDER comb_step = 1d0/dfloat(comb_teeth) first_det_of_comb = 1 do i=1,N_det_generators - if(pt2_weight(i)/norm_left < .5d0*comb_step) then + if(pt2_weight(i)/norm_left < .25d0*comb_step) then first_det_of_comb = i exit end if diff --git a/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f b/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f index 613f00e5..4d5bb344 100644 --- a/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f +++ b/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f @@ -82,8 +82,8 @@ subroutine run_pt2_slave(thread,iproc,energy) endif call push_pt2_results(zmq_socket_push, i_generator, pt2, task_id, n_tasks) - ! Try to adjust n_tasks around 10 seconds per job - n_tasks = int(10.d0 * dble(n_tasks) / (time1 - time0 + 1.d-9))+1 + ! Try to adjust n_tasks around 1 second per job + n_tasks = min(n_tasks,int( dble(n_tasks) / (time1 - time0 + 1.d-9)))+1 end do integer, external :: disconnect_from_taskserver diff --git a/plugins/Full_CI_ZMQ/run_selection_slave.irp.f b/plugins/Full_CI_ZMQ/run_selection_slave.irp.f index 43cd340a..6de5b19d 100644 --- a/plugins/Full_CI_ZMQ/run_selection_slave.irp.f +++ b/plugins/Full_CI_ZMQ/run_selection_slave.irp.f @@ -97,8 +97,8 @@ subroutine run_selection_slave_new(thread,iproc,energy) pt2(:,:) = 0d0 buf%cur = 0 - ! Try to adjust n_tasks around 10 seconds per job - n_tasks = int(10.d0 * dble(n_tasks) / (time1 - time0 + 1.d-9))+1 + ! Try to adjust n_tasks around 1 second per job + n_tasks = min(n_tasks,int( dble(n_tasks) / (time1 - time0 + 1.d-9)))+1 end do integer, external :: disconnect_from_taskserver diff --git a/plugins/Full_CI_ZMQ/selection.irp.f b/plugins/Full_CI_ZMQ/selection.irp.f index 3da1bca4..ba02dbf9 100644 --- a/plugins/Full_CI_ZMQ/selection.irp.f +++ b/plugins/Full_CI_ZMQ/selection.irp.f @@ -5,7 +5,7 @@ BEGIN_PROVIDER [ integer, fragment_count ] BEGIN_DOC ! Number of fragments for the deterministic part END_DOC - fragment_count = (elec_alpha_num-n_core_orb)*mo_tot_num + fragment_count = (elec_alpha_num-n_core_orb)**2 END_PROVIDER @@ -690,8 +690,8 @@ subroutine splash_pq(mask, sp, det, i_gen, N_sel, bannedOrb, banned, mat, intere if (interesting(i) == i_gen) then if(sp == 3) then - do j=1,mo_tot_num - do k=1,mo_tot_num + do k=1,mo_tot_num + do j=1,mo_tot_num banned(j,k,2) = banned(k,j,1) enddo enddo @@ -909,14 +909,22 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) if(.not. bannedOrb(puti, mi)) then tmp_row = 0d0 do putj=1, hfix-1 - if(lbanned(putj, ma) .or. banned(putj, puti,bant)) cycle - hij = (mo_bielec_integral(putj, hfix, p1, p2)-mo_bielec_integral(putj,hfix,p2,p1)) * get_phase_bi(phasemask, ma, ma, putj, p1, hfix, p2) - tmp_row(1:N_states,putj) += hij * coefs(1:N_states) + if(lbanned(putj, ma)) cycle + if(banned(putj, puti,bant)) cycle + hij = mo_bielec_integral(putj, hfix, p1, p2)-mo_bielec_integral(putj,hfix,p2,p1) + if (hij /= 0.d0) then + hij = hij * get_phase_bi(phasemask, ma, ma, putj, p1, hfix, p2) + tmp_row(1:N_states,putj) += hij * coefs(1:N_states) + endif end do do putj=hfix+1, mo_tot_num - if(lbanned(putj, ma) .or. banned(putj, puti,bant)) cycle - hij = (mo_bielec_integral(hfix,putj,p1, p2)-mo_bielec_integral(hfix,putj,p2,p1)) * get_phase_bi(phasemask, ma, ma, hfix, p1, putj, p2) - tmp_row(1:N_states,putj) += hij * coefs(1:N_states) + if(lbanned(putj, ma)) cycle + if(banned(putj, puti,bant)) cycle + hij = mo_bielec_integral(putj,hfix,p2, p1)-mo_bielec_integral(putj,hfix,p1,p2) + if (hij /= 0.d0) then + hij = hij * get_phase_bi(phasemask, ma, ma, hfix, p1, putj, p2) + tmp_row(1:N_states,putj) += hij * coefs(1:N_states) + endif end do if(ma == 1) then @@ -935,14 +943,20 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) !p1 fixed putj = p1 if(.not. banned(putj,puti,bant)) then - hij = mo_bielec_integral(puti,hfix,pfix,p2) * get_phase_bi(phasemask, ma, mi, hfix, p2, puti, pfix) - tmp_row(:,puti) += hij * coefs(:) + hij = mo_bielec_integral(puti,hfix,pfix,p2) + if (hij /= 0.d0) then + hij = hij * get_phase_bi(phasemask, ma, mi, hfix, p2, puti, pfix) + tmp_row(:,puti) += hij * coefs(:) + endif end if putj = p2 if(.not. banned(putj,puti,bant)) then - hij = mo_bielec_integral(puti,hfix,pfix,p1) * get_phase_bi(phasemask, ma, mi, hfix, p1, puti, pfix) - tmp_row2(:,puti) += hij * coefs(:) + hij = mo_bielec_integral(puti,hfix,pfix,p1) + if (hij /= 0.d0) then + hij = hij * get_phase_bi(phasemask, ma, mi, hfix, p1, puti, pfix) + tmp_row2(:,puti) += hij * coefs(:) + endif end if end do @@ -953,7 +967,9 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) mat(:,p1,:) += tmp_row(:,:) mat(:,p2,:) += tmp_row2(:,:) end if - else + + else ! sp /= 3 + if(p(0,ma) == 3) then do i=1,3 hfix = h(1,ma) @@ -962,14 +978,24 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) p2 = p(turn3(2,i), ma) tmp_row = 0d0 do putj=1,hfix-1 - if(lbanned(putj,ma) .or. banned(puti,putj,1)) cycle - hij = (mo_bielec_integral(putj, hfix, p1, p2)-mo_bielec_integral(putj,hfix,p2,p1)) * get_phase_bi(phasemask, ma, ma, putj, p1, hfix, p2) - tmp_row(:,putj) += hij * coefs(:) + if(lbanned(putj,ma)) cycle +! if(banned(puti,putj,1)) cycle + if(banned(putj,puti,1)) cycle + hij = mo_bielec_integral(putj, hfix, p1, p2)-mo_bielec_integral(putj,hfix,p2,p1) + if (hij /= 0.d0) then + hij = hij * get_phase_bi(phasemask, ma, ma, putj, p1, hfix, p2) + tmp_row(:,putj) += hij * coefs(:) + endif end do do putj=hfix+1,mo_tot_num - if(lbanned(putj,ma) .or. banned(puti,putj,1)) cycle - hij = (mo_bielec_integral(putj, hfix, p2, p1)-mo_bielec_integral(putj,hfix,p1,p2)) * get_phase_bi(phasemask, ma, ma, hfix, p1, putj, p2) - tmp_row(:,putj) += hij * coefs(:) + if(lbanned(putj,ma)) cycle +! if(banned(puti,putj,1)) cycle + if(banned(putj,puti,1)) cycle + hij = mo_bielec_integral(putj, hfix, p2, p1)-mo_bielec_integral(putj,hfix,p1,p2) + if (hij /= 0.d0) then + hij = hij * get_phase_bi(phasemask, ma, ma, hfix, p1, putj, p2) + tmp_row(:,putj) += hij * coefs(:) + endif end do mat(:, :puti-1, puti) += tmp_row(:,:puti-1) @@ -986,14 +1012,20 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) if(lbanned(puti,ma)) cycle putj = p2 if(.not. banned(puti,putj,1)) then - hij = mo_bielec_integral(puti,hfix, p1,pfix) * get_phase_bi(phasemask, mi, ma, hfix, pfix, puti, p1) - tmp_row(:,puti) += hij * coefs(:) + hij = mo_bielec_integral(puti,hfix, p1,pfix) + if (hij /= 0.d0) then + hij = hij * get_phase_bi(phasemask, mi, ma, hfix, pfix, puti, p1) + tmp_row(:,puti) += hij * coefs(:) + endif end if putj = p1 if(.not. banned(puti,putj,1)) then - hij = mo_bielec_integral(puti, hfix, p2, pfix) * get_phase_bi(phasemask, mi, ma, hfix, pfix, puti, p2) - tmp_row2(:,puti) += hij * coefs(:) + hij = mo_bielec_integral(puti, hfix, p2, pfix) + if (hij /= 0.d0) then + hij = hij * get_phase_bi(phasemask, mi, ma, hfix, pfix, puti, p2) + tmp_row2(:,puti) += hij * coefs(:) + endif end if end do mat(:,:p2-1,p2) += tmp_row(:,:p2-1) @@ -1016,10 +1048,11 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) do i1=1,p(0,s1) ib = 1 if(s1 == s2) ib = i1+1 + p1 = p(i1,s1) + if(bannedOrb(p1, s1)) cycle do i2=ib,p(0,s2) - p1 = p(i1,s1) p2 = p(i2,s2) - if(bannedOrb(p1, s1) .or. bannedOrb(p2, s2) .or. banned(p1, p2, 1)) cycle + if(bannedOrb(p2, s2) .or. banned(p1, p2, 1)) cycle call apply_particles(mask, s1, p1, s2, p2, det, ok, N_int) call i_h_j(gen, det, N_int, hij) mat(:, p1, p2) += coefs(:) * hij diff --git a/plugins/Full_CI_ZMQ/zmq_selection.irp.f b/plugins/Full_CI_ZMQ/zmq_selection.irp.f index 60d0dbe1..55cdb718 100644 --- a/plugins/Full_CI_ZMQ/zmq_selection.irp.f +++ b/plugins/Full_CI_ZMQ/zmq_selection.irp.f @@ -60,7 +60,7 @@ subroutine ZMQ_selection(N_in, pt2) task = ' ' do i= 1, N_det_generators - if (i>ishft(N_det_generators,-7)) then + if (i>ishft(N_det_generators,-2)) then write(task(ipos:ipos+30),'(I9,1X,I9,1X,I9,''|'')') 0, i, N ipos += 30 if (ipos > 63970) then diff --git a/src/Integrals_Bielec/qp_ao_ints.irp.f b/src/Integrals_Bielec/qp_ao_ints.irp.f index 93f62a7d..f499c848 100644 --- a/src/Integrals_Bielec/qp_ao_ints.irp.f +++ b/src/Integrals_Bielec/qp_ao_ints.irp.f @@ -1,10 +1,16 @@ program qp_ao_ints use omp_lib implicit none + IRP_IF MPI + include 'mpif.h' + IRP_ENDIF + integer :: ierr + BEGIN_DOC ! Increments a running calculation to compute AO integrals END_DOC integer :: i + PROVIDE zmq_context mpi_master zmq_state zmq_context call switch_qp_run_to_master @@ -17,15 +23,27 @@ program qp_ao_ints double precision :: integral, ao_bielec_integral integral = ao_bielec_integral(1,1,1,1) - character*(64) :: state - call wait_for_state(zmq_state,state) - do while (state /= 'Stopped') + do + call wait_for_state('ao_integrals',zmq_state) + if (zmq_state(1:7) == 'Stopped') then + exit + endif + !$OMP PARALLEL DEFAULT(PRIVATE) PRIVATE(i) i = omp_get_thread_num() call ao_bielec_integrals_in_map_slave_tcp(i) !$OMP END PARALLEL - call wait_for_state(zmq_state,state) + IRP_IF MPI + call MPI_BARRIER(MPI_COMM_WORLD, ierr) + if (ierr /= MPI_SUCCESS) then + print *, irp_here, 'error in barrier' + endif + IRP_ENDIF + enddo + IRP_IF MPI + call MPI_finalize(i) + IRP_ENDIF print *, 'Done' end diff --git a/src/ZMQ/utils.irp.f b/src/ZMQ/utils.irp.f index f8f7c71b..c263c884 100644 --- a/src/ZMQ/utils.irp.f +++ b/src/ZMQ/utils.irp.f @@ -337,7 +337,7 @@ IRP_ENDIF stop 'Unable to set ZMQ_LINGER on push socket' endif - rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_SNDHWM,5,4) + rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_SNDHWM,1,4) if (rc /= 0) then stop 'Unable to set ZMQ_SNDHWM on push socket' endif From be077680266c0be8fcaa350d52968acf2f32b178 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 7 Jun 2018 10:02:25 +0200 Subject: [PATCH 44/96] EZFIO and resultsFile moved to GitLab --- configure | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 98970655..c2877eae 100755 --- a/configure +++ b/configure @@ -76,6 +76,11 @@ from collections import namedtuple Info = namedtuple("Info", ["url", "description", "default_path"]) path_github = {"head": "http://github.com", "tail": "archive/master.tar.gz"} +def path_gitlab(user,project,branch): + """For example, + https://gitlab.com/scemama/resultsFile/-/archive/master/resultsFile-master.tar.gz + """ + return "http://gitlab.com/%(user)s/%(project)s/-/archive/%(branch)s/%(project)s-%(branch)s.tar.gz"%locals() ocaml = Info( url='http://raw.github.com/ocaml/opam/master/shell/opam_installer.sh', @@ -113,7 +118,7 @@ docopt = Info( default_path=join(QP_ROOT_INSTALL, "docopt")) resultsFile = Info( - url='{head}/LCPQ/resultsFile/{tail}'.format(**path_github), + url=path_gitlab("scemama","resultsFile","master"), description=' resultsFile', default_path=join(QP_ROOT_INSTALL, "resultsFile")) @@ -128,7 +133,7 @@ emsl = Info( default_path=join(QP_ROOT_INSTALL, "emsl")) ezfio = Info( - url='{head}/LCPQ/EZFIO/{tail}'.format(**path_github), + url=path_gitlab("scemama","EZFIO","master"), description=' EZFIO', default_path=join(QP_ROOT_INSTALL, "EZFIO")) From 261a8f6dfdbc52609756538e9970f425acde32d9 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 7 Jun 2018 16:15:26 +0200 Subject: [PATCH 45/96] Accelerated integrals --- plugins/Full_CI_ZMQ/fci_zmq.irp.f | 8 +- plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f | 2 + plugins/Full_CI_ZMQ/run_pt2_slave.irp.f | 4 +- plugins/Full_CI_ZMQ/run_selection_slave.irp.f | 4 +- plugins/Full_CI_ZMQ/selection.irp.f | 101 ++++++++++++------ .../selection_davidson_slave.irp.f | 8 ++ src/Integrals_Bielec/map_integrals.irp.f | 52 ++++++--- 7 files changed, 123 insertions(+), 56 deletions(-) diff --git a/plugins/Full_CI_ZMQ/fci_zmq.irp.f b/plugins/Full_CI_ZMQ/fci_zmq.irp.f index 7cb54841..e3e8c52d 100644 --- a/plugins/Full_CI_ZMQ/fci_zmq.irp.f +++ b/plugins/Full_CI_ZMQ/fci_zmq.irp.f @@ -52,6 +52,11 @@ program fci_zmq double precision :: error(N_states) correlation_energy_ratio = 0.d0 + if (do_pt2) then + pt2_string = ' ' + else + pt2_string = '(approx)' + endif if (.True.) then ! Avoid pre-calculation of CI_energy do while ( & @@ -63,7 +68,6 @@ program fci_zmq if (do_pt2) then - pt2_string = ' ' pt2 = 0.d0 threshold_selectors = 1.d0 threshold_generators = 1d0 @@ -72,8 +76,6 @@ program fci_zmq threshold_selectors = threshold_selectors_save threshold_generators = threshold_generators_save SOFT_TOUCH threshold_selectors threshold_generators - else - pt2_string = '(approx)' endif diff --git a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f index 04718218..52f212bf 100644 --- a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f +++ b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f @@ -139,6 +139,7 @@ subroutine ZMQ_pt2(E, pt2,relative_error, absolute_error, error) endif + call omp_set_nested(.true.) !$OMP PARALLEL DEFAULT(shared) NUM_THREADS(nproc+1) & !$OMP PRIVATE(i) i = omp_get_thread_num() @@ -149,6 +150,7 @@ subroutine ZMQ_pt2(E, pt2,relative_error, absolute_error, error) call pt2_slave_inproc(i) endif !$OMP END PARALLEL + call omp_set_nested(.false.) call end_parallel_job(zmq_to_qp_run_socket, zmq_socket_pull, 'pt2') call delete_selection_buffer(b) diff --git a/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f b/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f index 4d5bb344..b07aa1b8 100644 --- a/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f +++ b/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f @@ -82,8 +82,8 @@ subroutine run_pt2_slave(thread,iproc,energy) endif call push_pt2_results(zmq_socket_push, i_generator, pt2, task_id, n_tasks) - ! Try to adjust n_tasks around 1 second per job - n_tasks = min(n_tasks,int( dble(n_tasks) / (time1 - time0 + 1.d-9)))+1 + ! Try to adjust n_tasks around 5 second per job + n_tasks = min(n_tasks,int( 5.d0*dble(n_tasks) / (time1 - time0 + 1.d-9)))+1 end do integer, external :: disconnect_from_taskserver diff --git a/plugins/Full_CI_ZMQ/run_selection_slave.irp.f b/plugins/Full_CI_ZMQ/run_selection_slave.irp.f index 6de5b19d..52b75a3a 100644 --- a/plugins/Full_CI_ZMQ/run_selection_slave.irp.f +++ b/plugins/Full_CI_ZMQ/run_selection_slave.irp.f @@ -97,8 +97,8 @@ subroutine run_selection_slave_new(thread,iproc,energy) pt2(:,:) = 0d0 buf%cur = 0 - ! Try to adjust n_tasks around 1 second per job - n_tasks = min(n_tasks,int( dble(n_tasks) / (time1 - time0 + 1.d-9)))+1 + ! Try to adjust n_tasks around 5 second per job + n_tasks = min(n_tasks,int( 5.d0 * dble(n_tasks) / (time1 - time0 + 1.d-9)))+1 end do integer, external :: disconnect_from_taskserver diff --git a/plugins/Full_CI_ZMQ/selection.irp.f b/plugins/Full_CI_ZMQ/selection.irp.f index ba02dbf9..277e6be5 100644 --- a/plugins/Full_CI_ZMQ/selection.irp.f +++ b/plugins/Full_CI_ZMQ/selection.irp.f @@ -191,17 +191,26 @@ subroutine get_m1(gen, phasemask, bannedOrb, vect, mask, h, p, sp, coefs) p2 = p(2, sp) lbanned(p2) = .true. + + double precision :: hij_cache(mo_tot_num,2) + call get_mo_bielec_integrals(hole,p1,p2,mo_tot_num,hij_cache(1,1),mo_integrals_map) + call get_mo_bielec_integrals(hole,p2,p1,mo_tot_num,hij_cache(1,2),mo_integrals_map) + do i=1,hole-1 if(lbanned(i)) cycle - hij = (mo_bielec_integral(i, hole, p1, p2) - mo_bielec_integral(i, hole, p2, p1)) - hij *= get_phase_bi(phasemask, sp, sp, i, p1, hole, p2) - vect(1:N_states,i) += hij * coefs(1:N_states) + hij = hij_cache(i,1)-hij_cache(i,2) + if (hij /= 0.d0) then + hij *= get_phase_bi(phasemask, sp, sp, i, p1, hole, p2) + vect(1:N_states,i) += hij * coefs(1:N_states) + endif end do do i=hole+1,mo_tot_num if(lbanned(i)) cycle - hij = (mo_bielec_integral(hole, i, p1, p2) - mo_bielec_integral(hole, i, p2, p1)) - hij *= get_phase_bi(phasemask, sp, sp, hole, p1, i, p2) - vect(1:N_states,i) += hij * coefs(1:N_states) + hij = hij_cache(i,2)-hij_cache(i,1) + if (hij /= 0.d0) then + hij *= get_phase_bi(phasemask, sp, sp, hole, p1, i, p2) + vect(1:N_states,i) += hij * coefs(1:N_states) + endif end do call apply_particle(mask, sp, p2, det, ok, N_int) @@ -209,11 +218,14 @@ subroutine get_m1(gen, phasemask, bannedOrb, vect, mask, h, p, sp, coefs) vect(1:N_states, p2) += hij * coefs(1:N_states) else p2 = p(1, sh) + call get_mo_bielec_integrals(hole,p1,p2,mo_tot_num,hij_cache(1,1),mo_integrals_map) do i=1,mo_tot_num if(lbanned(i)) cycle - hij = mo_bielec_integral(i, hole, p1, p2) - hij *= get_phase_bi(phasemask, sp, sh, i, p1, hole, p2) - vect(1:N_states,i) += hij * coefs(1:N_states) + hij = hij_cache(i,1) + if (hij /= 0.d0) then + hij *= get_phase_bi(phasemask, sp, sh, i, p1, hole, p2) + vect(1:N_states,i) += hij * coefs(1:N_states) + endif end do end if deallocate(lbanned) @@ -707,17 +719,17 @@ subroutine splash_pq(mask, sp, det, i_gen, N_sel, bannedOrb, banned, mat, intere call bitstring_to_list_in_selection(mobMask(1,1), p(1,1), p(0,1), N_int) call bitstring_to_list_in_selection(mobMask(1,2), p(1,2), p(0,2), N_int) - perMask(1,1) = iand(mask(1,1), not(det(1,1,i))) - perMask(1,2) = iand(mask(1,2), not(det(1,2,i))) - do j=2,N_int - perMask(j,1) = iand(mask(j,1), not(det(j,1,i))) - perMask(j,2) = iand(mask(j,2), not(det(j,2,i))) - end do - - call bitstring_to_list_in_selection(perMask(1,1), h(1,1), h(0,1), N_int) - call bitstring_to_list_in_selection(perMask(1,2), h(1,2), h(0,2), N_int) - if (interesting(i) >= i_gen) then + perMask(1,1) = iand(mask(1,1), not(det(1,1,i))) + perMask(1,2) = iand(mask(1,2), not(det(1,2,i))) + do j=2,N_int + perMask(j,1) = iand(mask(j,1), not(det(j,1,i))) + perMask(j,2) = iand(mask(j,2), not(det(j,2,i))) + end do + + call bitstring_to_list_in_selection(perMask(1,1), h(1,1), h(0,1), N_int) + call bitstring_to_list_in_selection(perMask(1,2), h(1,2), h(0,2), N_int) + call get_mask_phase(psi_det_sorted(1,1,interesting(i)), phasemask) if(nt == 4) then call get_d2(det(1,1,i), phasemask, bannedOrb, banned, mat, mask, h, p, sp, psi_selectors_coef_transp(1, interesting(i))) @@ -731,6 +743,7 @@ subroutine splash_pq(mask, sp, det, i_gen, N_sel, bannedOrb, banned, mat, intere if(nt == 3) call past_d1(bannedOrb, p) end if end do + end @@ -881,9 +894,11 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) integer, parameter :: turn3(2,3) = reshape((/2,3, 1,3, 1,2/), (/2,3/)) integer :: bant - + double precision, allocatable :: hij_cache(:,:) + PROVIDE mo_integrals_map allocate (lbanned(mo_tot_num, 2)) + allocate (hij_cache(mo_tot_num,2)) lbanned = bannedOrb do i=1, p(0,1) @@ -907,11 +922,13 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) p1 = p(1,ma) p2 = p(2,ma) if(.not. bannedOrb(puti, mi)) then + call get_mo_bielec_integrals(hfix,p1,p2,mo_tot_num,hij_cache(1,1),mo_integrals_map) + call get_mo_bielec_integrals(hfix,p2,p1,mo_tot_num,hij_cache(1,2),mo_integrals_map) tmp_row = 0d0 do putj=1, hfix-1 if(lbanned(putj, ma)) cycle if(banned(putj, puti,bant)) cycle - hij = mo_bielec_integral(putj, hfix, p1, p2)-mo_bielec_integral(putj,hfix,p2,p1) + hij = hij_cache(putj,1) - hij_cache(putj,2) if (hij /= 0.d0) then hij = hij * get_phase_bi(phasemask, ma, ma, putj, p1, hfix, p2) tmp_row(1:N_states,putj) += hij * coefs(1:N_states) @@ -920,7 +937,7 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) do putj=hfix+1, mo_tot_num if(lbanned(putj, ma)) cycle if(banned(putj, puti,bant)) cycle - hij = mo_bielec_integral(putj,hfix,p2, p1)-mo_bielec_integral(putj,hfix,p1,p2) + hij = hij_cache(putj,2) - hij_cache(putj,1) if (hij /= 0.d0) then hij = hij * get_phase_bi(phasemask, ma, ma, hfix, p1, putj, p2) tmp_row(1:N_states,putj) += hij * coefs(1:N_states) @@ -938,12 +955,14 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) pfix = p(1,mi) tmp_row = 0d0 tmp_row2 = 0d0 + call get_mo_bielec_integrals(hfix,pfix,p1,mo_tot_num,hij_cache(1,1),mo_integrals_map) + call get_mo_bielec_integrals(hfix,pfix,p2,mo_tot_num,hij_cache(1,2),mo_integrals_map) do puti=1,mo_tot_num if(lbanned(puti,mi)) cycle !p1 fixed putj = p1 if(.not. banned(putj,puti,bant)) then - hij = mo_bielec_integral(puti,hfix,pfix,p2) + hij = hij_cache(puti,2) if (hij /= 0.d0) then hij = hij * get_phase_bi(phasemask, ma, mi, hfix, p2, puti, pfix) tmp_row(:,puti) += hij * coefs(:) @@ -952,7 +971,7 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) putj = p2 if(.not. banned(putj,puti,bant)) then - hij = mo_bielec_integral(puti,hfix,pfix,p1) + hij = hij_cache(puti,1) if (hij /= 0.d0) then hij = hij * get_phase_bi(phasemask, ma, mi, hfix, p1, puti, pfix) tmp_row2(:,puti) += hij * coefs(:) @@ -976,12 +995,13 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) puti = p(i, ma) p1 = p(turn3(1,i), ma) p2 = p(turn3(2,i), ma) + call get_mo_bielec_integrals(hfix,p1,p2,mo_tot_num,hij_cache(1,1),mo_integrals_map) + call get_mo_bielec_integrals(hfix,p2,p1,mo_tot_num,hij_cache(1,2),mo_integrals_map) tmp_row = 0d0 do putj=1,hfix-1 if(lbanned(putj,ma)) cycle -! if(banned(puti,putj,1)) cycle if(banned(putj,puti,1)) cycle - hij = mo_bielec_integral(putj, hfix, p1, p2)-mo_bielec_integral(putj,hfix,p2,p1) + hij = hij_cache(putj,1) - hij_cache(putj,2) if (hij /= 0.d0) then hij = hij * get_phase_bi(phasemask, ma, ma, putj, p1, hfix, p2) tmp_row(:,putj) += hij * coefs(:) @@ -989,9 +1009,8 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) end do do putj=hfix+1,mo_tot_num if(lbanned(putj,ma)) cycle -! if(banned(puti,putj,1)) cycle if(banned(putj,puti,1)) cycle - hij = mo_bielec_integral(putj, hfix, p2, p1)-mo_bielec_integral(putj,hfix,p1,p2) + hij = hij_cache(putj,2) - hij_cache(putj,1) if (hij /= 0.d0) then hij = hij * get_phase_bi(phasemask, ma, ma, hfix, p1, putj, p2) tmp_row(:,putj) += hij * coefs(:) @@ -1008,11 +1027,13 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) p2 = p(2,ma) tmp_row = 0d0 tmp_row2 = 0d0 + call get_mo_bielec_integrals(hfix,p1,pfix,mo_tot_num,hij_cache(1,1),mo_integrals_map) + call get_mo_bielec_integrals(hfix,p2,pfix,mo_tot_num,hij_cache(1,2),mo_integrals_map) do puti=1,mo_tot_num if(lbanned(puti,ma)) cycle putj = p2 if(.not. banned(puti,putj,1)) then - hij = mo_bielec_integral(puti,hfix, p1,pfix) + hij = hij_cache(puti,1) if (hij /= 0.d0) then hij = hij * get_phase_bi(phasemask, mi, ma, hfix, pfix, puti, p1) tmp_row(:,puti) += hij * coefs(:) @@ -1021,7 +1042,7 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) putj = p1 if(.not. banned(puti,putj,1)) then - hij = mo_bielec_integral(puti, hfix, p2, pfix) + hij = hij_cache(puti,2) if (hij /= 0.d0) then hij = hij * get_phase_bi(phasemask, mi, ma, hfix, pfix, puti, p2) tmp_row2(:,puti) += hij * coefs(:) @@ -1034,7 +1055,7 @@ subroutine get_d1(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) mat(:,p1,p1:) += tmp_row2(:,p1:) end if end if - deallocate(lbanned) + deallocate(lbanned,hij_cache) !! MONO if(sp == 3) then @@ -1081,6 +1102,8 @@ subroutine get_d0(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) logical :: ok integer :: bant + double precision, allocatable :: hij_cache(:,:) + allocate (hij_cache(mo_tot_num,2)) bant = 1 @@ -1089,6 +1112,7 @@ subroutine get_d0(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) h2 = p(1,2) do p1=1, mo_tot_num if(bannedOrb(p1, 1)) cycle + call get_mo_bielec_integrals(p1,h2,h1,mo_tot_num,hij_cache(1,1),mo_integrals_map) do p2=1, mo_tot_num if(bannedOrb(p2,2)) cycle if(banned(p1, p2, bant)) cycle ! rentable? @@ -1097,7 +1121,7 @@ subroutine get_d0(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) call i_h_j(gen, det, N_int, hij) else phase = get_phase_bi(phasemask, 1, 2, h1, p1, h2, p2) - hij = mo_bielec_integral(p2, p1, h2, h1) * phase + hij = hij_cache(p2,1) * phase end if mat(:, p1, p2) += coefs(:) * hij end do @@ -1107,19 +1131,28 @@ subroutine get_d0(gen, phasemask, bannedOrb, banned, mat, mask, h, p, sp, coefs) p2 = p(2,sp) do puti=1, mo_tot_num if(bannedOrb(puti, sp)) cycle + call get_mo_bielec_integrals(puti,p2,p1,mo_tot_num,hij_cache(1,1),mo_integrals_map) + call get_mo_bielec_integrals(puti,p1,p2,mo_tot_num,hij_cache(1,2),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 (hij /= 0.d0) then + mat(:, puti, putj) += coefs(:) * hij + endif else - hij = (mo_bielec_integral(putj, puti, p2, p1) - mo_bielec_integral(putj, puti, p1, p2))* get_phase_bi(phasemask, sp, sp, puti, p1 , putj, p2) + hij = hij_cache(putj,1) - hij_cache(putj,2) + if (hij /= 0.d0) then + hij *= get_phase_bi(phasemask, sp, sp, puti, p1 , putj, p2) + mat(:, puti, putj) += coefs(:) * hij + endif end if - mat(:, puti, putj) += coefs(:) * hij end do end do end if + deallocate(hij_cache) end diff --git a/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f b/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f index abc66089..b4a4d578 100644 --- a/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f +++ b/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f @@ -30,6 +30,7 @@ subroutine run_wf integer(ZMQ_PTR) :: zmq_to_qp_run_socket double precision :: energy(N_states) character*(64) :: states(3) + character*(64) :: old_state integer :: rc, i, ierr double precision :: t0, t1 @@ -44,14 +45,21 @@ subroutine run_wf states(1) = 'selection' states(2) = 'davidson' states(3) = 'pt2' + old_state = 'Waiting' zmq_to_qp_run_socket = new_zmq_to_qp_run_socket() do call wait_for_states(states,zmq_state,size(states)) + if (zmq_state == old_state) then + cycle + else + old_state = zmq_state + endif print *, trim(zmq_state) + if(zmq_state(1:7) == 'Stopped') then exit diff --git a/src/Integrals_Bielec/map_integrals.irp.f b/src/Integrals_Bielec/map_integrals.irp.f index 47743efe..05979d9f 100644 --- a/src/Integrals_Bielec/map_integrals.irp.f +++ b/src/Integrals_Bielec/map_integrals.irp.f @@ -438,24 +438,46 @@ subroutine get_mo_bielec_integrals(j,k,l,sze,out_val,map) double precision, intent(out) :: out_val(sze) type(map_type), intent(inout) :: map integer :: i - integer(key_kind) :: hash(sze) - real(integral_kind) :: tmp_val(sze) - PROVIDE mo_bielec_integrals_in_map + double precision, external :: get_mo_bielec_integral + PROVIDE mo_bielec_integrals_in_map mo_integrals_cache + integer :: ii, ii0 + integer*8 :: ii_8, ii0_8 + real(integral_kind) :: tmp + integer(key_kind) :: i1, idx + integer(key_kind) :: p,q,r,s,i2 + PROVIDE mo_bielec_integrals_in_map mo_integrals_cache + + ii0 = l-mo_integrals_cache_min + ii0 = ior(ii0, k-mo_integrals_cache_min) + ii0 = ior(ii0, j-mo_integrals_cache_min) + + ii0_8 = int(l,8)-mo_integrals_cache_min_8 + ii0_8 = ior( ishft(ii0_8,7), int(k,8)-mo_integrals_cache_min_8) + ii0_8 = ior( ishft(ii0_8,7), int(j,8)-mo_integrals_cache_min_8) + + q = min(j,l) + s = max(j,l) + q = q+ishft(s*s-s,-1) + do i=1,sze - !DIR$ FORCEINLINE - call bielec_integrals_index(i,j,k,l,hash(i)) + ii = ior(ii0, i-mo_integrals_cache_min) + if (iand(ii, -128) == 0) then + ii_8 = ior( ishft(ii0_8,7), int(i,8)-mo_integrals_cache_min_8) + out_val(i) = mo_integrals_cache(ii_8) + else + p = min(i,k) + r = max(i,k) + p = p+ishft(r*r-r,-1) + i1 = min(p,q) + i2 = max(p,q) + idx = i1+ishft(i2*i2-i2,-1) + !DIR$ FORCEINLINE + call map_get(map,idx,tmp) + out_val(i) = dble(tmp) + endif enddo - - if (key_kind == 8) then - call map_get_many(map, hash, out_val, sze) - else - call map_get_many(map, hash, tmp_val, sze) - ! Conversion to double precision - do i=1,sze - out_val(i) = dble(tmp_val(i)) - enddo - endif + end subroutine get_mo_bielec_integrals_ij(k,l,sze,out_array,map) From fe53949f63592148d2c96d59b9379e4467e1ef5e Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 7 Jun 2018 19:26:57 +0200 Subject: [PATCH 46/96] Optimized MPI --- plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f | 16 +- .../selection_davidson_slave.irp.f | 65 +++++---- src/ZMQ/utils.irp.f | 138 +++++++++++++----- 3 files changed, 147 insertions(+), 72 deletions(-) diff --git a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f index 52f212bf..aea967eb 100644 --- a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f +++ b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f @@ -279,7 +279,13 @@ subroutine pt2_collector(zmq_socket_pull, E, b, tbc, comb, Ncomb, computed, pt2_ loop = .True. pullLoop : do while (loop) + integer, external :: zmq_delete_tasks_async_send, zmq_delete_tasks_async_recv + integer, external :: zmq_delete_tasks + call pull_pt2_results(zmq_socket_pull, index, pt2_mwen, task_id, n_tasks) + if (zmq_delete_tasks(zmq_to_qp_run_socket,zmq_socket_pull,task_id,n_tasks,more) == -1) then + stop 'Unable to send delete tasks' + endif do i=1,n_tasks pt2_detail(1:N_states, index(i)) += pt2_mwen(1:N_states,i) parts_to_get(index(i)) -= 1 @@ -292,17 +298,13 @@ subroutine pt2_collector(zmq_socket_pull, E, b, tbc, comb, Ncomb, computed, pt2_ if(parts_to_get(index(i)) == 0) actually_computed(index(i)) = .true. enddo - integer, external :: zmq_delete_tasks - if (zmq_delete_tasks(zmq_to_qp_run_socket,zmq_socket_pull,task_id,n_tasks,more) == -1) then - stop 'Unable to delete tasks' - endif + call wall_time(time) + if (more == 0) then loop = .False. endif - time = omp_get_wtime() - - if(time - timeLast > 10d0 .or. (.not.loop)) then + if(time - timeLast > 4d0 .or. (.not.loop)) then timeLast = time do i=1, first_det_of_teeth(1)-1 if(.not.(actually_computed(i))) then diff --git a/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f b/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f index b4a4d578..3ecf2fb4 100644 --- a/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f +++ b/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f @@ -51,20 +51,34 @@ subroutine run_wf do - call wait_for_states(states,zmq_state,size(states)) + if (mpi_master) then + print *, trim(zmq_state) + call wait_for_states(states,zmq_state,size(states)) + endif + + IRP_IF MPI + call MPI_BARRIER(MPI_COMM_WORLD, ierr) + if (ierr /= MPI_SUCCESS) then + print *, irp_here, 'error in barrier' + endif + call MPI_BCAST (zmq_state, 128, MPI_CHARACTER, 0, MPI_COMM_WORLD, ierr) + if (ierr /= MPI_SUCCESS) then + print *, irp_here, 'error in broadcast of zmq_state' + endif + IRP_ENDIF + if (zmq_state == old_state) then cycle else old_state = zmq_state endif - print *, trim(zmq_state) - if(zmq_state(1:7) == 'Stopped') then - exit + endif - else if (zmq_state(1:9) == 'selection') then + + if (zmq_state(1:9) == 'selection') then ! Selection ! --------- @@ -80,12 +94,14 @@ subroutine run_wf psi_energy(1:N_states) = energy(1:N_states) TOUCH psi_energy state_average_weight threshold_selectors threshold_generators - print *, 'N_det', N_det - print *, 'N_det_generators', N_det_generators - print *, 'N_det_selectors', N_det_selectors - print *, 'psi_energy', psi_energy - print *, 'pt2_stoch_istate', pt2_stoch_istate - print *, 'state_average_weight', state_average_weight + if (mpi_master) then + print *, 'N_det', N_det + print *, 'N_det_generators', N_det_generators + print *, 'N_det_selectors', N_det_selectors + print *, 'psi_energy', psi_energy + print *, 'pt2_stoch_istate', pt2_stoch_istate + print *, 'state_average_weight', state_average_weight + endif call wall_time(t1) call write_double(6,(t1-t0),'Broadcast time') @@ -100,14 +116,15 @@ subroutine run_wf ! Davidson ! -------- - print *, 'Davidson' call wall_time(t0) if (zmq_get_psi(zmq_to_qp_run_socket,1) == -1) cycle if (zmq_get_N_states_diag(zmq_to_qp_run_socket,1) == -1) cycle if (zmq_get_dvector(zmq_to_qp_run_socket,1,'energy',energy,N_states_diag) == -1) cycle call wall_time(t1) - call write_double(6,(t1-t0),'Broadcast time') + if (mpi_master) then + call write_double(6,(t1-t0),'Broadcast time') + endif call omp_set_nested(.True.) call davidson_slave_tcp(0) @@ -119,7 +136,6 @@ subroutine run_wf ! PT2 ! --- - print *, 'PT2' call wall_time(t0) if (zmq_get_psi(zmq_to_qp_run_socket,1) == -1) cycle if (zmq_get_N_det_generators (zmq_to_qp_run_socket, 1) == -1) cycle @@ -131,12 +147,14 @@ subroutine run_wf 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 - print *, 'N_det', N_det - print *, 'N_det_generators', N_det_generators - print *, 'N_det_selectors', N_det_selectors - print *, 'psi_energy', psi_energy - print *, 'pt2_stoch_istate', pt2_stoch_istate - print *, 'state_average_weight', state_average_weight + if (mpi_master) then + print *, 'N_det', N_det + print *, 'N_det_generators', N_det_generators + print *, 'N_det_selectors', N_det_selectors + print *, 'psi_energy', psi_energy + print *, 'pt2_stoch_istate', pt2_stoch_istate + print *, 'state_average_weight', state_average_weight + endif call wall_time(t1) call write_double(6,(t1-t0),'Broadcast time') @@ -152,13 +170,6 @@ subroutine run_wf endif - IRP_IF MPI - call MPI_BARRIER(MPI_COMM_WORLD, ierr) - if (ierr /= MPI_SUCCESS) then - print *, irp_here, 'error in barrier' - endif - IRP_ENDIF - end do IRP_IF MPI call MPI_finalize(i) diff --git a/src/ZMQ/utils.irp.f b/src/ZMQ/utils.irp.f index c263c884..14ab4302 100644 --- a/src/ZMQ/utils.irp.f +++ b/src/ZMQ/utils.irp.f @@ -148,15 +148,15 @@ function new_zmq_to_qp_run_socket() stop 'Unable to create zmq req socket' endif - rc = f77_zmq_setsockopt(new_zmq_to_qp_run_socket, ZMQ_SNDTIMEO, 300000, 4) - if (rc /= 0) then - stop 'Unable to set send timeout in new_zmq_to_qp_run_socket' - endif - - rc = f77_zmq_setsockopt(new_zmq_to_qp_run_socket, ZMQ_RCVTIMEO, 300000, 4) - if (rc /= 0) then - stop 'Unable to set recv timeout in new_zmq_to_qp_run_socket' - endif +! rc = f77_zmq_setsockopt(new_zmq_to_qp_run_socket, ZMQ_SNDTIMEO, 300000, 4) +! if (rc /= 0) then +! stop 'Unable to set send timeout in new_zmq_to_qp_run_socket' +! endif +! +! rc = f77_zmq_setsockopt(new_zmq_to_qp_run_socket, ZMQ_RCVTIMEO, 300000, 4) +! if (rc /= 0) then +! stop 'Unable to set recv timeout in new_zmq_to_qp_run_socket' +! endif rc = f77_zmq_connect(new_zmq_to_qp_run_socket, trim(qp_run_address)//':'//trim(zmq_port(0))) if (rc /= 0) then @@ -250,20 +250,20 @@ IRP_ENDIF stop 'Unable to create zmq pull socket' endif - rc = f77_zmq_setsockopt(new_zmq_pull_socket,ZMQ_LINGER,300000,4) - if (rc /= 0) then - stop 'Unable to set ZMQ_LINGER on pull socket' - endif +! rc = f77_zmq_setsockopt(new_zmq_pull_socket,ZMQ_LINGER,300000,4) +! if (rc /= 0) then +! stop 'Unable to set ZMQ_LINGER on pull socket' +! endif ! rc = f77_zmq_setsockopt(new_zmq_pull_socket,ZMQ_RCVBUF,100000000,4) ! if (rc /= 0) then ! stop 'Unable to set ZMQ_RCVBUF on pull socket' ! endif - rc = f77_zmq_setsockopt(new_zmq_pull_socket,ZMQ_RCVHWM,5,4) - if (rc /= 0) then - stop 'Unable to set ZMQ_RCVHWM on pull socket' - endif +! rc = f77_zmq_setsockopt(new_zmq_pull_socket,ZMQ_RCVHWM,5,4) +! if (rc /= 0) then +! stop 'Unable to set ZMQ_RCVHWM on pull socket' +! endif integer :: icount @@ -332,15 +332,15 @@ IRP_ENDIF stop 'Unable to create zmq push socket' endif - rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_LINGER,300000,4) - if (rc /= 0) then - stop 'Unable to set ZMQ_LINGER on push socket' - endif - - rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_SNDHWM,1,4) - if (rc /= 0) then - stop 'Unable to set ZMQ_SNDHWM on push socket' - endif +! rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_LINGER,300000,4) +! if (rc /= 0) then +! stop 'Unable to set ZMQ_LINGER on push socket' +! endif +! +! rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_SNDHWM,1,4) +! if (rc /= 0) then +! stop 'Unable to set ZMQ_SNDHWM on push socket' +! endif ! rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_SNDBUF,100000000,4) ! if (rc /= 0) then @@ -352,10 +352,10 @@ IRP_ENDIF stop 'Unable to set ZMQ_IMMEDIATE on push socket' endif - rc = f77_zmq_setsockopt(new_zmq_push_socket, ZMQ_SNDTIMEO, 300000, 4) - if (rc /= 0) then - stop 'Unable to set send timout in new_zmq_push_socket' - endif +! rc = f77_zmq_setsockopt(new_zmq_push_socket, ZMQ_SNDTIMEO, 300000, 4) +! if (rc /= 0) then +! stop 'Unable to set send timout in new_zmq_push_socket' +! endif if (thread == 1) then rc = f77_zmq_connect(new_zmq_push_socket, zmq_socket_push_inproc_address) @@ -488,10 +488,10 @@ subroutine end_zmq_push_socket(zmq_socket_push,thread) integer :: rc character*(8), external :: zmq_port - rc = f77_zmq_setsockopt(zmq_socket_push,ZMQ_LINGER,300000,4) - if (rc /= 0) then - stop 'Unable to set ZMQ_LINGER on push socket' - endif +! rc = f77_zmq_setsockopt(zmq_socket_push,ZMQ_LINGER,300000,4) +! if (rc /= 0) then +! stop 'Unable to set ZMQ_LINGER on push socket' +! endif call omp_set_lock(zmq_lock) rc = f77_zmq_close(zmq_socket_push) @@ -1019,10 +1019,10 @@ subroutine end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) character*(8), external :: zmq_port integer :: rc - rc = f77_zmq_setsockopt(zmq_to_qp_run_socket,ZMQ_LINGER,300000,4) - if (rc /= 0) then - stop 'Unable to set ZMQ_LINGER on zmq_to_qp_run_socket' - endif +! rc = f77_zmq_setsockopt(zmq_to_qp_run_socket,ZMQ_LINGER,300000,4) +! if (rc /= 0) then +! stop 'Unable to set ZMQ_LINGER on zmq_to_qp_run_socket' +! endif rc = f77_zmq_close(zmq_to_qp_run_socket) if (rc /= 0) then @@ -1112,6 +1112,68 @@ integer function zmq_delete_tasks(zmq_to_qp_run_socket,zmq_socket_pull,task_id,n endif end +integer function zmq_delete_tasks_async_send(zmq_to_qp_run_socket,zmq_socket_pull,task_id,n_tasks,more) + use f77_zmq + implicit none + BEGIN_DOC +! When a task is done, it has to be removed from the list of tasks on the qp_run +! queue. This guarantees that the results have been received in the pull. + END_DOC + integer(ZMQ_PTR), intent(in) :: zmq_to_qp_run_socket + integer(ZMQ_PTR) :: zmq_socket_pull + integer, intent(in) :: n_tasks, task_id(n_tasks) + integer, intent(in) :: more + integer :: rc, k + character*(64) :: fmt, reply + character(LEN=:), allocatable :: message + + zmq_delete_tasks_async_send = 0 + + allocate(character(LEN=64+n_tasks*12) :: message) + + write(fmt,*) '(A,1X,A,1X,', n_tasks, '(I11,1X))' + write(message,*) 'del_task '//trim(zmq_state), (task_id(k), k=1,n_tasks) + + + rc = f77_zmq_send(zmq_to_qp_run_socket,trim(message),len(trim(message)),0) + if (rc /= len(trim(message))) then + zmq_delete_tasks_async_send = -1 + deallocate(message) + return + endif + deallocate(message) + +end + + +integer function zmq_delete_tasks_async_recv(zmq_to_qp_run_socket,zmq_socket_pull,task_id,n_tasks,more) + use f77_zmq + implicit none + BEGIN_DOC +! When a task is done, it has to be removed from the list of tasks on the qp_run +! queue. This guarantees that the results have been received in the pull. + END_DOC + integer(ZMQ_PTR), intent(in) :: zmq_to_qp_run_socket + integer(ZMQ_PTR) :: zmq_socket_pull + integer, intent(in) :: n_tasks, task_id(n_tasks) + integer, intent(out) :: more + integer :: rc + character*(64) :: reply + + zmq_delete_tasks_async_recv = 0 + + reply = '' + rc = f77_zmq_recv(zmq_to_qp_run_socket,reply,64,0) + + if (reply(16:19) == 'more') then + more = 1 + else if (reply(16:19) == 'done') then + more = 0 + else + zmq_delete_tasks_async_recv = -1 + endif +end + subroutine wait_for_next_state(state) use f77_zmq From c48623a5c9f0b8de60a43e05f8311160d5086002 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 8 Jun 2018 01:11:30 +0200 Subject: [PATCH 47/96] Fixed parallelization bugs --- ocaml/TaskServer.ml | 2 +- plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f | 31 ++--- .../selection_davidson_slave.irp.f | 42 ++++-- src/Determinants/density_matrix.irp.f | 11 +- src/ZMQ/utils.irp.f | 131 +++++++++--------- 5 files changed, 122 insertions(+), 95 deletions(-) diff --git a/ocaml/TaskServer.ml b/ocaml/TaskServer.ml index 44a46f52..9fa27d14 100644 --- a/ocaml/TaskServer.ml +++ b/ocaml/TaskServer.ml @@ -208,7 +208,7 @@ let end_job msg program_state rep_socket pair_socket = address_tcp = None; address_inproc = None; running = true; - accepting_clients = false; + accepting_clients = false; data = StringHashtbl.create (); } diff --git a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f index aea967eb..e6758e8f 100644 --- a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f +++ b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f @@ -89,12 +89,12 @@ subroutine ZMQ_pt2(E, pt2,relative_error, absolute_error, error) 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 + 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 call create_selection_buffer(1, 1*2, b) @@ -139,7 +139,6 @@ subroutine ZMQ_pt2(E, pt2,relative_error, absolute_error, error) endif - call omp_set_nested(.true.) !$OMP PARALLEL DEFAULT(shared) NUM_THREADS(nproc+1) & !$OMP PRIVATE(i) i = omp_get_thread_num() @@ -150,7 +149,6 @@ subroutine ZMQ_pt2(E, pt2,relative_error, absolute_error, error) call pt2_slave_inproc(i) endif !$OMP END PARALLEL - call omp_set_nested(.false.) call end_parallel_job(zmq_to_qp_run_socket, zmq_socket_pull, 'pt2') call delete_selection_buffer(b) @@ -279,13 +277,7 @@ subroutine pt2_collector(zmq_socket_pull, E, b, tbc, comb, Ncomb, computed, pt2_ loop = .True. pullLoop : do while (loop) - integer, external :: zmq_delete_tasks_async_send, zmq_delete_tasks_async_recv - integer, external :: zmq_delete_tasks - call pull_pt2_results(zmq_socket_pull, index, pt2_mwen, task_id, n_tasks) - if (zmq_delete_tasks(zmq_to_qp_run_socket,zmq_socket_pull,task_id,n_tasks,more) == -1) then - stop 'Unable to send delete tasks' - endif do i=1,n_tasks pt2_detail(1:N_states, index(i)) += pt2_mwen(1:N_states,i) parts_to_get(index(i)) -= 1 @@ -298,13 +290,18 @@ subroutine pt2_collector(zmq_socket_pull, E, b, tbc, comb, Ncomb, computed, pt2_ if(parts_to_get(index(i)) == 0) actually_computed(index(i)) = .true. enddo - call wall_time(time) - + integer, external :: zmq_delete_tasks + if (zmq_delete_tasks(zmq_to_qp_run_socket,zmq_socket_pull,task_id,n_tasks,more) == -1) then + cycle + endif if (more == 0) then loop = .False. endif - if(time - timeLast > 4d0 .or. (.not.loop)) then + call wall_time(time) + + + if(time - timeLast > 5d0 .or. (.not.loop)) then timeLast = time do i=1, first_det_of_teeth(1)-1 if(.not.(actually_computed(i))) then diff --git a/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f b/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f index 3ecf2fb4..88b30172 100644 --- a/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f +++ b/plugins/Full_CI_ZMQ/selection_davidson_slave.irp.f @@ -52,27 +52,23 @@ subroutine run_wf do if (mpi_master) then - print *, trim(zmq_state) call wait_for_states(states,zmq_state,size(states)) + if (zmq_state(1:64) == old_state(1:64)) then + call sleep(1) + cycle + else + old_state(1:64) = zmq_state(1:64) + endif + print *, trim(zmq_state) endif IRP_IF MPI - call MPI_BARRIER(MPI_COMM_WORLD, ierr) - if (ierr /= MPI_SUCCESS) then - print *, irp_here, 'error in barrier' - endif call MPI_BCAST (zmq_state, 128, MPI_CHARACTER, 0, MPI_COMM_WORLD, ierr) if (ierr /= MPI_SUCCESS) then print *, irp_here, 'error in broadcast of zmq_state' endif IRP_ENDIF - if (zmq_state == old_state) then - cycle - else - old_state = zmq_state - endif - if(zmq_state(1:7) == 'Stopped') then exit endif @@ -110,6 +106,13 @@ subroutine run_wf call run_selection_slave(0,i,energy) !$OMP END PARALLEL print *, 'Selection done' + IRP_IF MPI + call MPI_BARRIER(MPI_COMM_WORLD, ierr) + if (ierr /= MPI_SUCCESS) then + print *, irp_here, 'error in barrier' + endif + IRP_ENDIF + print *, 'All selection done' else if (zmq_state(1:8) == 'davidson') then @@ -130,6 +133,13 @@ subroutine run_wf call davidson_slave_tcp(0) call omp_set_nested(.False.) print *, 'Davidson done' + IRP_IF MPI + call MPI_BARRIER(MPI_COMM_WORLD, ierr) + if (ierr /= MPI_SUCCESS) then + print *, irp_here, 'error in barrier' + endif + IRP_ENDIF + print *, 'All Davidson done' else if (zmq_state(1:3) == 'pt2') then @@ -168,11 +178,19 @@ subroutine run_wf print *, 'PT2 done' FREE state_average_weight + IRP_IF MPI + call MPI_BARRIER(MPI_COMM_WORLD, ierr) + if (ierr /= MPI_SUCCESS) then + print *, irp_here, 'error in barrier' + endif + IRP_ENDIF + print *, 'All PT2 done' + endif end do IRP_IF MPI - call MPI_finalize(i) + call MPI_finalize(ierr) IRP_ENDIF end diff --git a/src/Determinants/density_matrix.irp.f b/src/Determinants/density_matrix.irp.f index a4e5f5f0..0bd0a187 100644 --- a/src/Determinants/density_matrix.irp.f +++ b/src/Determinants/density_matrix.irp.f @@ -376,9 +376,14 @@ BEGIN_PROVIDER [ double precision, l3_weight, (N_states) ] enddo l3_weight(i) = min(1.d0/l3_weight(i), 100.d0) enddo - print *, 'L3 weights' - print *, '----------' - print *, l3_weight(1:N_states) + if (mpi_master) then + print *, '' + print *, 'L3 weights' + print *, '----------' + print *, '' + print *, l3_weight(1:N_states) + print *, '' + endif END_PROVIDER diff --git a/src/ZMQ/utils.irp.f b/src/ZMQ/utils.irp.f index 14ab4302..d0c73f17 100644 --- a/src/ZMQ/utils.irp.f +++ b/src/ZMQ/utils.irp.f @@ -148,15 +148,15 @@ function new_zmq_to_qp_run_socket() stop 'Unable to create zmq req socket' endif -! rc = f77_zmq_setsockopt(new_zmq_to_qp_run_socket, ZMQ_SNDTIMEO, 300000, 4) -! if (rc /= 0) then -! stop 'Unable to set send timeout in new_zmq_to_qp_run_socket' -! endif -! -! rc = f77_zmq_setsockopt(new_zmq_to_qp_run_socket, ZMQ_RCVTIMEO, 300000, 4) -! if (rc /= 0) then -! stop 'Unable to set recv timeout in new_zmq_to_qp_run_socket' -! endif + rc = f77_zmq_setsockopt(new_zmq_to_qp_run_socket, ZMQ_SNDTIMEO, 300000, 4) + if (rc /= 0) then + stop 'Unable to set send timeout in new_zmq_to_qp_run_socket' + endif + + rc = f77_zmq_setsockopt(new_zmq_to_qp_run_socket, ZMQ_RCVTIMEO, 300000, 4) + if (rc /= 0) then + stop 'Unable to set recv timeout in new_zmq_to_qp_run_socket' + endif rc = f77_zmq_connect(new_zmq_to_qp_run_socket, trim(qp_run_address)//':'//trim(zmq_port(0))) if (rc /= 0) then @@ -188,25 +188,11 @@ function new_zmq_pair_socket(bind) endif -! rc = f77_zmq_setsockopt(new_zmq_pair_socket, ZMQ_SNDHWM, 2, 4) -! if (rc /= 0) then -! stop 'f77_zmq_setsockopt(new_zmq_pair_socket, ZMQ_SNDHWM, 2, 4)' -! endif -! -! rc = f77_zmq_setsockopt(new_zmq_pair_socket, ZMQ_RCVHWM, 2, 4) -! if (rc /= 0) then -! stop 'f77_zmq_setsockopt(new_zmq_pair_socket, ZMQ_RCVHWM, 2, 4)' -! endif -! rc = f77_zmq_setsockopt(new_zmq_pair_socket, ZMQ_IMMEDIATE, 1, 4) if (rc /= 0) then stop 'f77_zmq_setsockopt(new_zmq_pair_socket, ZMQ_IMMEDIATE, 1, 4)' endif -! -! rc = f77_zmq_setsockopt(new_zmq_pair_socket, ZMQ_LINGER, 600000, 4) -! if (rc /= 0) then -! stop 'f77_zmq_setsockopt(new_zmq_pair_socket, ZMQ_LINGER, 600000, 4)' -! endif + if (bind) then rc = f77_zmq_bind(new_zmq_pair_socket,zmq_socket_pair_inproc_address) @@ -250,20 +236,20 @@ IRP_ENDIF stop 'Unable to create zmq pull socket' endif -! rc = f77_zmq_setsockopt(new_zmq_pull_socket,ZMQ_LINGER,300000,4) -! if (rc /= 0) then -! stop 'Unable to set ZMQ_LINGER on pull socket' -! endif + rc = f77_zmq_setsockopt(new_zmq_pull_socket,ZMQ_LINGER,300000,4) + if (rc /= 0) then + stop 'Unable to set ZMQ_LINGER on pull socket' + endif ! rc = f77_zmq_setsockopt(new_zmq_pull_socket,ZMQ_RCVBUF,100000000,4) ! if (rc /= 0) then ! stop 'Unable to set ZMQ_RCVBUF on pull socket' ! endif -! rc = f77_zmq_setsockopt(new_zmq_pull_socket,ZMQ_RCVHWM,5,4) -! if (rc /= 0) then -! stop 'Unable to set ZMQ_RCVHWM on pull socket' -! endif + rc = f77_zmq_setsockopt(new_zmq_pull_socket,ZMQ_RCVHWM,1,4) + if (rc /= 0) then + stop 'Unable to set ZMQ_RCVHWM on pull socket' + endif integer :: icount @@ -332,15 +318,15 @@ IRP_ENDIF stop 'Unable to create zmq push socket' endif -! rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_LINGER,300000,4) -! if (rc /= 0) then -! stop 'Unable to set ZMQ_LINGER on push socket' -! endif -! -! rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_SNDHWM,1,4) -! if (rc /= 0) then -! stop 'Unable to set ZMQ_SNDHWM on push socket' -! endif + rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_LINGER,300000,4) + if (rc /= 0) then + stop 'Unable to set ZMQ_LINGER on push socket' + endif + + rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_SNDHWM,1,4) + if (rc /= 0) then + stop 'Unable to set ZMQ_SNDHWM on push socket' + endif ! rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_SNDBUF,100000000,4) ! if (rc /= 0) then @@ -352,10 +338,10 @@ IRP_ENDIF stop 'Unable to set ZMQ_IMMEDIATE on push socket' endif -! rc = f77_zmq_setsockopt(new_zmq_push_socket, ZMQ_SNDTIMEO, 300000, 4) -! if (rc /= 0) then -! stop 'Unable to set send timout in new_zmq_push_socket' -! endif + rc = f77_zmq_setsockopt(new_zmq_push_socket, ZMQ_SNDTIMEO, 300000, 4) + if (rc /= 0) then + stop 'Unable to set send timout in new_zmq_push_socket' + endif if (thread == 1) then rc = f77_zmq_connect(new_zmq_push_socket, zmq_socket_push_inproc_address) @@ -488,10 +474,10 @@ subroutine end_zmq_push_socket(zmq_socket_push,thread) integer :: rc character*(8), external :: zmq_port -! rc = f77_zmq_setsockopt(zmq_socket_push,ZMQ_LINGER,300000,4) -! if (rc /= 0) then -! stop 'Unable to set ZMQ_LINGER on push socket' -! endif + rc = f77_zmq_setsockopt(zmq_socket_push,ZMQ_LINGER,300000,4) + if (rc /= 0) then + print *, 'warning: Unable to set ZMQ_LINGER on push socket' + endif call omp_set_lock(zmq_lock) rc = f77_zmq_close(zmq_socket_push) @@ -615,7 +601,7 @@ subroutine end_parallel_job(zmq_to_qp_run_socket,zmq_socket_pull,name_in) stop 'Wrong end of job' endif - do i=10,1,-1 + do i=300,1,-1 rc = f77_zmq_send(zmq_to_qp_run_socket, 'end_job '//trim(zmq_state),8+len(trim(zmq_state)),0) rc = f77_zmq_recv(zmq_to_qp_run_socket, message, 512, 0) if (trim(message(1:13)) == 'error waiting') then @@ -685,6 +671,14 @@ integer function connect_to_taskserver(zmq_to_qp_run_socket,worker_id,thread) connect_to_taskserver = -1 return endif + if (trim(state) /= zmq_state) then + integer, external :: disconnect_from_taskserver_state + if (disconnect_from_taskserver_state(zmq_to_qp_run_socket, worker_id, state) == -1) then + continue + endif + connect_to_taskserver = -1 + return + endif return 10 continue @@ -699,19 +693,32 @@ integer function disconnect_from_taskserver(zmq_to_qp_run_socket, worker_id) END_DOC integer(ZMQ_PTR), intent(in) :: zmq_to_qp_run_socket integer, intent(in) :: worker_id + integer, external :: disconnect_from_taskserver_state + disconnect_from_taskserver = disconnect_from_taskserver_state(zmq_to_qp_run_socket, worker_id, zmq_state(1:128)) +end + +integer function disconnect_from_taskserver_state(zmq_to_qp_run_socket, worker_id, state) + use f77_zmq + implicit none + BEGIN_DOC + ! Disconnect from the task server + END_DOC + integer(ZMQ_PTR), intent(in) :: zmq_to_qp_run_socket + integer, intent(in) :: worker_id integer :: rc, sze - character*(512) :: message, reply, state + character*(512) :: message, reply + character*(128) :: state - disconnect_from_taskserver = 0 + disconnect_from_taskserver_state = 0 - write(message,*) 'disconnect '//trim(zmq_state), worker_id + write(message,*) 'disconnect '//trim(state), worker_id sze = len(trim(message)) rc = f77_zmq_send(zmq_to_qp_run_socket, trim(message), sze, 0) if (rc /= sze) then - disconnect_from_taskserver = -1 + disconnect_from_taskserver_state = -1 return endif @@ -720,20 +727,20 @@ integer function disconnect_from_taskserver(zmq_to_qp_run_socket, worker_id) read(message,*, end=10, err=10) reply, state if ((trim(reply) == 'disconnect_reply').and.(trim(state) == trim(zmq_state))) then - disconnect_from_taskserver = -1 + disconnect_from_taskserver_state = -1 return endif if (trim(message) == 'error Wrong state') then - disconnect_from_taskserver = -1 + disconnect_from_taskserver_state = -1 return else if (trim(message) == 'error No job is running') then - disconnect_from_taskserver = -1 + disconnect_from_taskserver_state = -1 return endif return 10 continue - disconnect_from_taskserver = -1 + disconnect_from_taskserver_state = -1 end integer function add_task_to_taskserver(zmq_to_qp_run_socket,task) @@ -1019,10 +1026,10 @@ subroutine end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) character*(8), external :: zmq_port integer :: rc -! rc = f77_zmq_setsockopt(zmq_to_qp_run_socket,ZMQ_LINGER,300000,4) -! if (rc /= 0) then -! stop 'Unable to set ZMQ_LINGER on zmq_to_qp_run_socket' -! endif + rc = f77_zmq_setsockopt(zmq_to_qp_run_socket,ZMQ_LINGER,300000,4) + if (rc /= 0) then + print *, 'warning: Unable to set ZMQ_LINGER on zmq_to_qp_run_socket' + endif rc = f77_zmq_close(zmq_to_qp_run_socket) if (rc /= 0) then From ef92609192bad5f591a0da300d6cba40685e3da1 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 8 Jun 2018 02:09:42 +0200 Subject: [PATCH 48/96] timeouts --- plugins/Full_CI_ZMQ/fci_zmq.irp.f | 2 +- plugins/Full_CI_ZMQ/run_pt2_slave.irp.f | 8 +++++--- plugins/Generators_full/generators.irp.f | 2 +- src/ZMQ/utils.irp.f | 6 +++--- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/plugins/Full_CI_ZMQ/fci_zmq.irp.f b/plugins/Full_CI_ZMQ/fci_zmq.irp.f index e3e8c52d..2d3c1f29 100644 --- a/plugins/Full_CI_ZMQ/fci_zmq.irp.f +++ b/plugins/Full_CI_ZMQ/fci_zmq.irp.f @@ -70,7 +70,7 @@ program fci_zmq if (do_pt2) then pt2 = 0.d0 threshold_selectors = 1.d0 - threshold_generators = 1d0 + threshold_generators = 1.d0 SOFT_TOUCH threshold_selectors threshold_generators call ZMQ_pt2(CI_energy, pt2,relative_error,absolute_error,error) ! Stochastic PT2 threshold_selectors = threshold_selectors_save diff --git a/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f b/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f index b07aa1b8..bc88c23c 100644 --- a/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f +++ b/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f @@ -87,9 +87,11 @@ subroutine run_pt2_slave(thread,iproc,energy) end do integer, external :: disconnect_from_taskserver - if (disconnect_from_taskserver(zmq_to_qp_run_socket,worker_id) == -1) then - continue - endif + do i=1,300 + if (disconnect_from_taskserver(zmq_to_qp_run_socket,worker_id) /= -2) exit + call sleep(1) + print *, 'Retry disconnect...' + end do call end_zmq_push_socket(zmq_socket_push,thread) call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) diff --git a/plugins/Generators_full/generators.irp.f b/plugins/Generators_full/generators.irp.f index 4f2c715e..835897bd 100644 --- a/plugins/Generators_full/generators.irp.f +++ b/plugins/Generators_full/generators.irp.f @@ -13,7 +13,7 @@ BEGIN_PROVIDER [ integer, N_det_generators ] N_det_generators = N_det do i=1,N_det norm = norm + psi_average_norm_contrib_sorted(i) - if (norm >= threshold_generators) then + if (norm > threshold_generators) then N_det_generators = i exit endif diff --git a/src/ZMQ/utils.irp.f b/src/ZMQ/utils.irp.f index d0c73f17..a77f974a 100644 --- a/src/ZMQ/utils.irp.f +++ b/src/ZMQ/utils.irp.f @@ -601,7 +601,7 @@ subroutine end_parallel_job(zmq_to_qp_run_socket,zmq_socket_pull,name_in) stop 'Wrong end of job' endif - do i=300,1,-1 + do i=3600,1,-1 rc = f77_zmq_send(zmq_to_qp_run_socket, 'end_job '//trim(zmq_state),8+len(trim(zmq_state)),0) rc = f77_zmq_recv(zmq_to_qp_run_socket, message, 512, 0) if (trim(message(1:13)) == 'error waiting') then @@ -612,6 +612,7 @@ subroutine end_parallel_job(zmq_to_qp_run_socket,zmq_socket_pull,name_in) endif end do if (i==0) then + print *, '.. Forcing kill ..' rc = f77_zmq_send(zmq_to_qp_run_socket, 'end_job force',13,0) rc = f77_zmq_recv(zmq_to_qp_run_socket, message, 512, 0) endif @@ -718,7 +719,7 @@ integer function disconnect_from_taskserver_state(zmq_to_qp_run_socket, worker_i rc = f77_zmq_send(zmq_to_qp_run_socket, trim(message), sze, 0) if (rc /= sze) then - disconnect_from_taskserver_state = -1 + disconnect_from_taskserver_state = -2 return endif @@ -727,7 +728,6 @@ integer function disconnect_from_taskserver_state(zmq_to_qp_run_socket, worker_i read(message,*, end=10, err=10) reply, state if ((trim(reply) == 'disconnect_reply').and.(trim(state) == trim(zmq_state))) then - disconnect_from_taskserver_state = -1 return endif if (trim(message) == 'error Wrong state') then From 6d05caffd5644e472aa809ef0c09a067afdbe79c Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 8 Jun 2018 21:37:08 +0200 Subject: [PATCH 49/96] Memory model --- plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f | 12 ++- plugins/Full_CI_ZMQ/selection_slave.irp.f | 101 ++++++++++++------ plugins/Full_CI_ZMQ/zmq_selection.irp.f | 12 ++- src/Davidson/davidson_parallel.irp.f | 2 +- .../diagonalization_hs2_dressed.irp.f | 18 +++- src/Utils/util.irp.f | 17 +++ src/ZMQ/utils.irp.f | 4 +- 7 files changed, 130 insertions(+), 36 deletions(-) diff --git a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f index e6758e8f..36ad63b2 100644 --- a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f +++ b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f @@ -139,7 +139,17 @@ subroutine ZMQ_pt2(E, pt2,relative_error, absolute_error, error) endif - !$OMP PARALLEL DEFAULT(shared) NUM_THREADS(nproc+1) & + integer :: nproc_target + nproc_target = nproc + double precision :: mem + mem = 8.d0 * N_det * (N_int * 2.d0 * 3.d0 + 3.d0 + 5.d0) / (1024.d0**3) + call write_double(6,mem,'Estimated memory/thread (Gb)') + if (qp_max_mem > 0) then + nproc_target = max(1,int(dble(qp_max_mem)/mem)) + nproc_target = min(nproc_target,nproc) + endif + + !$OMP PARALLEL DEFAULT(shared) NUM_THREADS(nproc_target+1) & !$OMP PRIVATE(i) i = omp_get_thread_num() if (i==0) then diff --git a/plugins/Full_CI_ZMQ/selection_slave.irp.f b/plugins/Full_CI_ZMQ/selection_slave.irp.f index c1712b2d..8036985a 100644 --- a/plugins/Full_CI_ZMQ/selection_slave.irp.f +++ b/plugins/Full_CI_ZMQ/selection_slave.irp.f @@ -29,11 +29,13 @@ subroutine run_wf 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(2) + character*(64) :: states(3) + character*(64) :: old_state integer :: rc, i, ierr double precision :: t0, t1 integer, external :: zmq_get_dvector, zmq_get_N_det_generators + integer, external :: zmq_get_ivector integer, external :: zmq_get_psi, zmq_get_N_det_selectors integer, external :: zmq_get_N_states_diag @@ -41,30 +43,61 @@ subroutine run_wf zmq_context = f77_zmq_ctx_new () states(1) = 'selection' - states(2) = 'pt2' + states(2) = 'davidson' + states(3) = 'pt2' + old_state = 'Waiting' zmq_to_qp_run_socket = new_zmq_to_qp_run_socket() do - call wait_for_states(states,zmq_state,size(states)) - print *, trim(zmq_state) + if (mpi_master) then + call wait_for_states(states,zmq_state,size(states)) + if (zmq_state(1:64) == old_state(1:64)) then + call sleep(1) + cycle + else + old_state(1:64) = zmq_state(1:64) + endif + print *, trim(zmq_state) + endif + + IRP_IF MPI + call MPI_BCAST (zmq_state, 128, MPI_CHARACTER, 0, MPI_COMM_WORLD, ierr) + if (ierr /= MPI_SUCCESS) then + print *, irp_here, 'error in broadcast of zmq_state' + endif + IRP_ENDIF if(zmq_state(1:7) == 'Stopped') then - exit + endif - else if (zmq_state(1:9) == 'selection') then + + if (zmq_state(1:9) == 'selection') then ! Selection ! --------- call wall_time(t0) if (zmq_get_psi(zmq_to_qp_run_socket,1) == -1) cycle + if (zmq_get_dvector(zmq_to_qp_run_socket,1,'threshold_generators',threshold_generators,1) == -1) cycle + if (zmq_get_dvector(zmq_to_qp_run_socket,1,'threshold_selectors',threshold_selectors,1) == -1) cycle + if (zmq_get_dvector(zmq_to_qp_run_socket,1,'energy',energy,N_states) == -1) cycle if (zmq_get_N_det_generators (zmq_to_qp_run_socket, 1) == -1) cycle if (zmq_get_N_det_selectors(zmq_to_qp_run_socket, 1) == -1) cycle - if (zmq_get_dvector(zmq_to_qp_run_socket,1,'energy',energy,N_states) == -1) cycle + 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 + if (mpi_master) then + print *, 'N_det', N_det + print *, 'N_det_generators', N_det_generators + print *, 'N_det_selectors', N_det_selectors + print *, 'psi_energy', psi_energy + print *, 'pt2_stoch_istate', pt2_stoch_istate + print *, 'state_average_weight', state_average_weight + endif call wall_time(t1) call write_double(6,(t1-t0),'Broadcast time') @@ -73,42 +106,50 @@ subroutine run_wf call run_selection_slave(0,i,energy) !$OMP END PARALLEL print *, 'Selection done' + IRP_IF MPI + call MPI_BARRIER(MPI_COMM_WORLD, ierr) + if (ierr /= MPI_SUCCESS) then + print *, irp_here, 'error in barrier' + endif + IRP_ENDIF + print *, 'All selection done' + if (N_det < 100000) then + exit + endif - else if (zmq_state(1:3) == 'pt2') then + else if (zmq_state(1:8) == 'davidson') then - ! PT2 - ! --- + ! Davidson + ! -------- - print *, 'PT2' call wall_time(t0) if (zmq_get_psi(zmq_to_qp_run_socket,1) == -1) cycle - if (zmq_get_dvector(zmq_to_qp_run_socket,1,'energy',energy,N_states) == -1) cycle - if (zmq_get_N_det_generators (zmq_to_qp_run_socket, 1) == -1) cycle - if (zmq_get_N_det_selectors(zmq_to_qp_run_socket, 1) == -1) cycle + if (zmq_get_N_states_diag(zmq_to_qp_run_socket,1) == -1) cycle + if (zmq_get_dvector(zmq_to_qp_run_socket,1,'energy',energy,N_states_diag) == -1) cycle call wall_time(t1) - call write_double(6,(t1-t0),'Broadcast time') + if (mpi_master) then + call write_double(6,(t1-t0),'Broadcast time') + endif - 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' + call omp_set_nested(.True.) + call davidson_slave_tcp(0) + call omp_set_nested(.False.) + print *, 'Davidson done' + IRP_IF MPI + call MPI_BARRIER(MPI_COMM_WORLD, ierr) + if (ierr /= MPI_SUCCESS) then + print *, irp_here, 'error in barrier' + endif + IRP_ENDIF + print *, 'All Davidson done' + exit endif - IRP_IF MPI - call MPI_BARRIER(MPI_COMM_WORLD, ierr) - if (ierr /= MPI_SUCCESS) then - print *, irp_here, 'error in barrier' - endif - IRP_ENDIF - end do IRP_IF MPI - call MPI_finalize(i) + call MPI_finalize(ierr) IRP_ENDIF end diff --git a/plugins/Full_CI_ZMQ/zmq_selection.irp.f b/plugins/Full_CI_ZMQ/zmq_selection.irp.f index 55cdb718..6bcc548a 100644 --- a/plugins/Full_CI_ZMQ/zmq_selection.irp.f +++ b/plugins/Full_CI_ZMQ/zmq_selection.irp.f @@ -97,7 +97,17 @@ subroutine ZMQ_selection(N_in, pt2) print *, irp_here, ': Failed in zmq_set_running' endif - !$OMP PARALLEL DEFAULT(shared) SHARED(b, pt2) PRIVATE(i) NUM_THREADS(nproc+1) + integer :: nproc_target + nproc_target = nproc + double precision :: mem + mem = 8.d0 * N_det * (N_int * 2.d0 * 3.d0 + 3.d0 + 5.d0) / (1024.d0**3) + call write_double(6,mem,'Estimated memory/thread (Gb)') + if (qp_max_mem > 0) then + nproc_target = max(1,int(dble(qp_max_mem)/mem)) + nproc_target = min(nproc_target,nproc) + endif + + !$OMP PARALLEL DEFAULT(shared) SHARED(b, pt2) PRIVATE(i) NUM_THREADS(nproc_target+1) i = omp_get_thread_num() if (i==0) then call selection_collector(zmq_socket_pull, b, N, pt2) diff --git a/src/Davidson/davidson_parallel.irp.f b/src/Davidson/davidson_parallel.irp.f index ce6d670a..15eede23 100644 --- a/src/Davidson/davidson_parallel.irp.f +++ b/src/Davidson/davidson_parallel.irp.f @@ -403,8 +403,8 @@ BEGIN_PROVIDER [ integer, nthreads_davidson ] call getenv('NTHREADS_DAVIDSON',env) if (trim(env) /= '') then read(env,*) nthreads_davidson + call write_int(6,nthreads_davidson,'Number of threads for ') endif - call write_int(6,nthreads_davidson,'Number of threads for Diagonalization') END_PROVIDER diff --git a/src/Davidson/diagonalization_hs2_dressed.irp.f b/src/Davidson/diagonalization_hs2_dressed.irp.f index ad75f583..491ddea7 100644 --- a/src/Davidson/diagonalization_hs2_dressed.irp.f +++ b/src/Davidson/diagonalization_hs2_dressed.irp.f @@ -138,6 +138,7 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_ integer :: shift, shift2, itermax, istate double precision :: r1, r2 logical :: state_ok(N_st_diag*davidson_sze_max) + integer :: nproc_target include 'constants.include.F' !DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: U, W, S, y, h, lambda @@ -162,8 +163,22 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_ call write_int(6,N_st,'Number of states') call write_int(6,N_st_diag,'Number of states in diagonalization') call write_int(6,sze,'Number of determinants') + nproc_target = nproc r1 = 8.d0*(3.d0*dble(sze*N_st_diag*itermax+5.d0*(N_st_diag*itermax)**2 & - + 4.d0*(N_st_diag*itermax)+nproc*(4.d0*N_det_alpha_unique+2.d0*N_st_diag*sze)))/(1024.d0**3) + + 3.d0*(N_st_diag*itermax)+nproc*(4.d0*N_det_alpha_unique+2.d0*N_st_diag*sze)))/(1024.d0**3) + if (qp_max_mem > 0) then + do while (r1 > qp_max_mem) + nproc_target = nproc_target - 1 + r1 = 8.d0*(3.d0*dble(sze*N_st_diag*itermax+5.d0*(N_st_diag*itermax)**2 & + + 3.d0*(N_st_diag*itermax)+nproc_target*(4.d0*N_det_alpha_unique+2.d0*N_st_diag*sze)))/(1024.d0**3) + if (nproc_target == 0) then + nproc_target = 1 + exit + endif + enddo + call omp_set_num_threads(nproc_target) + call write_int(6,nproc_target,'Number of threads for diagonalization') + endif call write_double(6, r1, 'Memory(Gb)') write(6,'(A)') '' write_buffer = '=====' @@ -512,6 +527,7 @@ subroutine davidson_diag_hjj_sjj(dets_in,u_in,H_jj,s2_out,energies,dim_in,sze,N_ y, s_, s_tmp, & lambda & ) + call omp_set_num_threads(nproc) end diff --git a/src/Utils/util.irp.f b/src/Utils/util.irp.f index e4b21f2e..9f4f2168 100644 --- a/src/Utils/util.irp.f +++ b/src/Utils/util.irp.f @@ -286,6 +286,23 @@ BEGIN_PROVIDER [ integer, nproc ] !$OMP END PARALLEL END_PROVIDER +BEGIN_PROVIDER [ integer, qp_max_mem ] + implicit none + BEGIN_DOC + ! Maximum memory in Gb + END_DOC + character*(128) :: env + + qp_max_mem = -1 + call getenv('QP_MAXMEM',env) + if (trim(env) /= '') then + read(env,*) qp_max_mem + call write_int(6,qp_max_mem,'Target maximum memory') + endif + + +END_PROVIDER + double precision function u_dot_v(u,v,sze) implicit none diff --git a/src/ZMQ/utils.irp.f b/src/ZMQ/utils.irp.f index a77f974a..97fded04 100644 --- a/src/ZMQ/utils.irp.f +++ b/src/ZMQ/utils.irp.f @@ -246,7 +246,7 @@ IRP_ENDIF ! stop 'Unable to set ZMQ_RCVBUF on pull socket' ! endif - rc = f77_zmq_setsockopt(new_zmq_pull_socket,ZMQ_RCVHWM,1,4) + rc = f77_zmq_setsockopt(new_zmq_pull_socket,ZMQ_RCVHWM,nproc,4) if (rc /= 0) then stop 'Unable to set ZMQ_RCVHWM on pull socket' endif @@ -323,7 +323,7 @@ IRP_ENDIF stop 'Unable to set ZMQ_LINGER on push socket' endif - rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_SNDHWM,1,4) + rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_SNDHWM,3,4) if (rc /= 0) then stop 'Unable to set ZMQ_SNDHWM on push socket' endif From b27b2701cf5e2c1b366e91dee06064ae6b652ea5 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Sat, 9 Jun 2018 12:18:12 +0200 Subject: [PATCH 50/96] Warning in OCaml --- ocaml/TaskServer.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ocaml/TaskServer.ml b/ocaml/TaskServer.ml index 9fa27d14..8f682eef 100644 --- a/ocaml/TaskServer.ml +++ b/ocaml/TaskServer.ml @@ -625,7 +625,7 @@ let get_data msg program_state rep_socket = let value = match StringHashtbl.find program_state.data key with | Some value -> value - | None -> "\0" + | None -> String.make 1 (Char.of_int_exn 0) in Message.GetDataReply (Message.GetDataReply_msg.create ~value) |> Message.to_string_list From 52eb8e996a73cfa9fa67c4ecfe509ebbe178b76f Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Sat, 9 Jun 2018 14:35:33 +0200 Subject: [PATCH 51/96] minor change --- plugins/Full_CI_ZMQ/pt2_stoch.irp.f | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/Full_CI_ZMQ/pt2_stoch.irp.f b/plugins/Full_CI_ZMQ/pt2_stoch.irp.f index 204498af..c5f29511 100644 --- a/plugins/Full_CI_ZMQ/pt2_stoch.irp.f +++ b/plugins/Full_CI_ZMQ/pt2_stoch.irp.f @@ -25,8 +25,9 @@ subroutine run E_CI_before = psi_energy(1) + nuclear_repulsion threshold_selectors = 1.d0 threshold_generators = 1.d0 - relative_error = 1.d-3 - absolute_error = 1.d-5 + relative_error=PT2_relative_error + absolute_error=PT2_absolute_error + call ZMQ_pt2(E_CI_before, pt2, relative_error, absolute_error, eqt) print *, 'Final step' print *, 'N_det = ', N_det From ebcd9251143891e6881a87193715f117007c08a7 Mon Sep 17 00:00:00 2001 From: Kevin Gasperich Date: Mon, 11 Jun 2018 17:55:20 -0500 Subject: [PATCH 52/96] change dimension of diagonal_Fock_matrix_mo --- plugins/Hartree_Fock/diagonalize_fock.irp.f | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Hartree_Fock/diagonalize_fock.irp.f b/plugins/Hartree_Fock/diagonalize_fock.irp.f index b3003985..bc874514 100644 --- a/plugins/Hartree_Fock/diagonalize_fock.irp.f +++ b/plugins/Hartree_Fock/diagonalize_fock.irp.f @@ -1,4 +1,4 @@ - BEGIN_PROVIDER [ double precision, diagonal_Fock_matrix_mo, (ao_num) ] + BEGIN_PROVIDER [ double precision, diagonal_Fock_matrix_mo, (mo_tot_num) ] &BEGIN_PROVIDER [ double precision, eigenvectors_Fock_matrix_mo, (ao_num,mo_tot_num) ] implicit none BEGIN_DOC From f3f304656367eac87cb544b066aca4bbd839e6fd Mon Sep 17 00:00:00 2001 From: "M. Chandler Bennett" Date: Tue, 12 Jun 2018 09:30:37 -0400 Subject: [PATCH 53/96] Correcting spin-multiplicity --- plugins/QMC/qp_convert_qmcpack_to_ezfio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/QMC/qp_convert_qmcpack_to_ezfio.py b/plugins/QMC/qp_convert_qmcpack_to_ezfio.py index 94f0c347..40619bb5 100755 --- a/plugins/QMC/qp_convert_qmcpack_to_ezfio.py +++ b/plugins/QMC/qp_convert_qmcpack_to_ezfio.py @@ -60,7 +60,7 @@ beta = ezfio.get_electrons_elec_beta_num() print "elec_alpha_num", alpha print "elec_beta_num", beta print "elec_tot_num", alpha + beta -print "spin_multiplicity", 2 * (alpha - beta) + 1 +print "spin_multiplicity", (alpha - beta) + 1 l_label = ezfio.get_nuclei_nucl_label() l_charge = ezfio.get_nuclei_nucl_charge() From eb8176ee189a0067125ea464190db696cb184b22 Mon Sep 17 00:00:00 2001 From: Kevin Gasperich Date: Tue, 12 Jun 2018 13:11:57 -0500 Subject: [PATCH 54/96] alpha -> beta --- plugins/Hartree_Fock/localize_mos.irp.f | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Hartree_Fock/localize_mos.irp.f b/plugins/Hartree_Fock/localize_mos.irp.f index 8a665c64..27c97ddb 100644 --- a/plugins/Hartree_Fock/localize_mos.irp.f +++ b/plugins/Hartree_Fock/localize_mos.irp.f @@ -21,7 +21,7 @@ program localize_mos mo_coef(1,1),size(mo_coef,1),1.d-6,rank) print *, rank - if (elec_alpha_num>elec_alpha_num) then + if (elec_alpha_num>elec_beta_num) then W = 0.d0 do k=elec_beta_num+1,elec_alpha_num do j=1,ao_num From 8a562b6b06235cb74aacfc8bd4a729062cfa7e74 Mon Sep 17 00:00:00 2001 From: Thomas Applencourt Date: Thu, 14 Jun 2018 15:29:52 -0500 Subject: [PATCH 55/96] Update qp_convert_qmcpack_to_ezfio.py Fix too long gms converter --- plugins/QMC/qp_convert_qmcpack_to_ezfio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/QMC/qp_convert_qmcpack_to_ezfio.py b/plugins/QMC/qp_convert_qmcpack_to_ezfio.py index 40619bb5..d8e37139 100755 --- a/plugins/QMC/qp_convert_qmcpack_to_ezfio.py +++ b/plugins/QMC/qp_convert_qmcpack_to_ezfio.py @@ -133,7 +133,7 @@ d_gms_order ={ 0:["s"], 1:[ "x", "y", "z" ], 2:[ "xx", "yy", "zz", "xy", "xz", "yz" ], 3:[ "xxx", "yyy", "zzz", "xxy", "xxz", "yyx", "yyz", "zzx", "zzy", "xyz"], - 4: ["xxxx", "yyyy", "zzzz", "xxxy", "xxxz", "yyyx", "yyyz", "zzzx", "zzzy", "xxyy", "xxzz", "yyzz", "xxyz", "yyxz", "zzxy", "xxxx", "yyyy", "zzzz", "xxxy", "xxxz", "yyyx", "yyyz", "zzzx", "zzzy", "xxyy", "xxzz", "yyzz", "xxyz", "yyxz","zzxy"] } + 4:[ "xxxx", "yyyy", "zzzz", "xxxy", "xxxz", "yyyx", "yyyz", "zzzx", "zzzy", "xxyy", "xxzz", "yyzz", "xxyz", "yyxz", "zzxy"] } def compare_gamess_style(item1, item2): n1,n2 = map(len,(item1,item2)) From f1be78d1a879087048a4b52fe2a04284d2851e79 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 18 Jun 2018 09:36:41 +0200 Subject: [PATCH 56/96] Trying to optimize pt2: --- plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f index 36ad63b2..7cb3aab1 100644 --- a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f +++ b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f @@ -570,7 +570,7 @@ END_PROVIDER comb_step = 1d0/dfloat(comb_teeth) first_det_of_comb = 1 do i=1,N_det_generators - if(pt2_weight(i)/norm_left < .25d0*comb_step) then + if(pt2_weight(i)/norm_left < .5d0*comb_step) then first_det_of_comb = i exit end if From 0cc458a23f07bdd94ac9faefa23dc0ac2cd3a98f Mon Sep 17 00:00:00 2001 From: Pierre-Francois Loos Date: Tue, 19 Jun 2018 11:14:44 +0200 Subject: [PATCH 57/96] Occupation numbers in EZFIO --- lib64 | 1 - ocaml/qptypes_generator.ml | 4 +- src/Determinants/density_matrix.irp.f | 3 +- src/MO_Basis/utils.irp.f | 59 +++++++++++++++++++++++++++ 4 files changed, 63 insertions(+), 4 deletions(-) delete mode 120000 lib64 diff --git a/lib64 b/lib64 deleted file mode 120000 index 7951405f..00000000 --- a/lib64 +++ /dev/null @@ -1 +0,0 @@ -lib \ No newline at end of file diff --git a/ocaml/qptypes_generator.ml b/ocaml/qptypes_generator.ml index d76120b8..3d5950a5 100644 --- a/ocaml/qptypes_generator.ml +++ b/ocaml/qptypes_generator.ml @@ -84,8 +84,8 @@ let input_data = " * MO_coef : float * MO_occ : float - if (x < 0.) || (x > 2.) then - raise (Invalid_argument (Printf.sprintf \"MO_occ : (0. <= x <= 2.) : x=%f\" x)); + if x < 0. then 0. else + if x > 2. then 2. else * AO_coef : float diff --git a/src/Determinants/density_matrix.irp.f b/src/Determinants/density_matrix.irp.f index 0bd0a187..ea32ece4 100644 --- a/src/Determinants/density_matrix.irp.f +++ b/src/Determinants/density_matrix.irp.f @@ -347,7 +347,8 @@ subroutine set_natural_mos double precision, allocatable :: tmp(:,:) label = "Natural" - call mo_as_svd_vectors_of_mo_matrix(one_body_dm_mo,size(one_body_dm_mo,1),mo_tot_num,mo_tot_num,label) + call mo_as_svd_vectors_of_mo_matrix_eig(one_body_dm_mo,size(one_body_dm_mo,1),mo_tot_num,mo_tot_num,mo_occ,label) + soft_touch mo_occ end subroutine save_natural_mos diff --git a/src/MO_Basis/utils.irp.f b/src/MO_Basis/utils.irp.f index b8eed315..3882aae4 100644 --- a/src/MO_Basis/utils.irp.f +++ b/src/MO_Basis/utils.irp.f @@ -157,6 +157,65 @@ subroutine mo_as_svd_vectors_of_mo_matrix(matrix,lda,m,n,label) mo_label = label end +subroutine mo_as_svd_vectors_of_mo_matrix_eig(matrix,lda,m,n,eig,label) + implicit none + integer,intent(in) :: lda,m,n + character*(64), intent(in) :: label + double precision, intent(in) :: matrix(lda,n) + double precision, intent(out) :: eig(m) + + integer :: i,j + double precision :: accu + double precision, allocatable :: mo_coef_new(:,:), U(:,:),D(:), A(:,:), Vt(:,:), work(:) + !DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: mo_coef_new, U, Vt, A + + call write_time(6) + if (m /= mo_tot_num) then + print *, irp_here, ': Error : m/= mo_tot_num' + stop 1 + endif + + allocate(A(lda,n),U(lda,n),mo_coef_new(ao_num,m),D(m),Vt(lda,n)) + + do j=1,n + do i=1,m + A(i,j) = matrix(i,j) + enddo + enddo + mo_coef_new = mo_coef + + call svd(A,lda,U,lda,D,Vt,lda,m,n) + + write (6,'(A)') 'MOs are now **'//trim(label)//'**' + write (6,'(A)') '' + write (6,'(A)') 'Eigenvalues' + write (6,'(A)') '-----------' + write (6,'(A)') '' + write (6,'(A)') '======== ================ ================' + write (6,'(A)') ' MO Eigenvalue Cumulative ' + write (6,'(A)') '======== ================ ================' + + accu = 0.d0 + do i=1,m + accu = accu + D(i) + write (6,'(I8,1X,F16.10,1X,F16.10)') i,D(i), accu + enddo + write (6,'(A)') '======== ================ ================' + write (6,'(A)') '' + + call dgemm('N','N',ao_num,m,m,1.d0,mo_coef_new,size(mo_coef_new,1),U,size(U,1),0.d0,mo_coef,size(mo_coef,1)) + + do i=1,m + eig(i) = D(i) + enddo + + deallocate(A,mo_coef_new,U,Vt,D) + call write_time(6) + + mo_label = label + +end + subroutine mo_as_eigvectors_of_mo_matrix_sort_by_observable(matrix,observable,n,m,label) implicit none integer,intent(in) :: n,m From f9e473d703adf35bb17000a3e4e5cdc1688b9915 Mon Sep 17 00:00:00 2001 From: Kevin Gasperich Date: Mon, 25 Jun 2018 02:34:06 -0500 Subject: [PATCH 58/96] square determinant coefficients (#242) --- src/Determinants/spindeterminants.irp.f | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Determinants/spindeterminants.irp.f b/src/Determinants/spindeterminants.irp.f index 136872b4..796e4fac 100644 --- a/src/Determinants/spindeterminants.irp.f +++ b/src/Determinants/spindeterminants.irp.f @@ -649,7 +649,7 @@ subroutine create_wf_of_psi_bilinear_matrix(truncate) do k=1,N_states psi_coef_sorted_bit(idx,k) = psi_bilinear_matrix(i,j,k) !$OMP ATOMIC - norm(k) += psi_bilinear_matrix(i,j,k) + norm(k) += psi_bilinear_matrix(i,j,k)*psi_bilinear_matrix(i,j,k) enddo endif enddo From ca263297bfc727afa568b6c8f1990023a8d851b9 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 25 Jun 2018 14:18:46 +0200 Subject: [PATCH 59/96] Fixed selection --- config/ifort.cfg | 2 +- configure | 4 +-- ocaml/TaskServer.ml | 4 +-- plugins/Full_CI_ZMQ/pt2_stoch.irp.f | 1 - plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f | 7 ++--- plugins/Full_CI_ZMQ/run_pt2_slave.irp.f | 19 +++++-------- plugins/Full_CI_ZMQ/run_selection_slave.irp.f | 5 ++-- plugins/Full_CI_ZMQ/zmq_selection.irp.f | 27 ++++++++++--------- plugins/Generators_full/generators.irp.f | 6 ++--- plugins/dress_zmq/dress_slave.irp.f | 2 +- src/Determinants/H_apply.irp.f | 1 - src/Determinants/s2.irp.f | 2 +- src/MO_Basis/ao_ortho_canonical.irp.f | 8 +----- src/ZMQ/utils.irp.f | 2 +- 14 files changed, 37 insertions(+), 53 deletions(-) diff --git a/config/ifort.cfg b/config/ifort.cfg index b94d0cd4..0c630114 100644 --- a/config/ifort.cfg +++ b/config/ifort.cfg @@ -32,7 +32,7 @@ OPENMP : 1 ; Append OpenMP flags # [OPT] FC : -traceback -FCFLAGS : -xSSE4.2 -O2 -ip -ftz -g +FCFLAGS : -xAVX -O2 -ip -ftz -g # Profiling flags ################# diff --git a/configure b/configure index 171bb377..346d9804 100755 --- a/configure +++ b/configure @@ -494,9 +494,9 @@ def create_ninja_and_rc(l_installed): 'function qp_prepend_export () {', 'eval "value_1="\${$1}""', 'if [[ -z $value_1 ]] ; then', - ' echo "${1}=${2}:"', + ' echo "${2}:"', 'else', - ' echo "${1}=${2}:${value_1}"', + ' echo "${2}:${value_1}"', 'fi', '}', 'export PYTHONPATH=$(qp_prepend_export "PYTHONPATH" "${QP_EZFIO}/Python":"${QP_PYTHON}")', diff --git a/ocaml/TaskServer.ml b/ocaml/TaskServer.ml index 9fa27d14..506b1639 100644 --- a/ocaml/TaskServer.ml +++ b/ocaml/TaskServer.ml @@ -208,7 +208,7 @@ let end_job msg program_state rep_socket pair_socket = address_tcp = None; address_inproc = None; running = true; - accepting_clients = false; + accepting_clients = false; data = StringHashtbl.create (); } @@ -625,7 +625,7 @@ let get_data msg program_state rep_socket = let value = match StringHashtbl.find program_state.data key with | Some value -> value - | None -> "\0" + | None -> "\000" in Message.GetDataReply (Message.GetDataReply_msg.create ~value) |> Message.to_string_list diff --git a/plugins/Full_CI_ZMQ/pt2_stoch.irp.f b/plugins/Full_CI_ZMQ/pt2_stoch.irp.f index 96951342..204498af 100644 --- a/plugins/Full_CI_ZMQ/pt2_stoch.irp.f +++ b/plugins/Full_CI_ZMQ/pt2_stoch.irp.f @@ -27,7 +27,6 @@ subroutine run threshold_generators = 1.d0 relative_error = 1.d-3 absolute_error = 1.d-5 - call ZMQ_pt2(E_CI_before, pt2, relative_error, absolute_error, eqt) print *, 'Final step' print *, 'N_det = ', N_det diff --git a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f index 723f1d02..8ebbdff7 100644 --- a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f +++ b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f @@ -335,8 +335,6 @@ subroutine pt2_collector(zmq_socket_pull, E, b, tbc, comb, Ncomb, computed, pt2_ exit pullLoop endif - !if(Nabove(1) < 5d0) cycle - E0 = sum(pt2_detail(pt2_stoch_istate,:first_det_of_teeth(tooth)-1)) if (tooth <= comb_teeth) then prop = ((1d0 - dfloat(comb_teeth - tooth + 1) * comb_step) - pt2_cweight(first_det_of_teeth(tooth)-1)) @@ -348,7 +346,7 @@ subroutine pt2_collector(zmq_socket_pull, E, b, tbc, comb, Ncomb, computed, pt2_ eqt = 0.d0 endif call wall_time(time) - if ( ((dabs(eqt/avg) < relative_error) .or. (dabs(eqt) < absolute_error)) .and. Nabove(tooth) >= 30) then + if ( ((dabs(eqt/avg) < relative_error) .or. (dabs(eqt) < absolute_error)) .and. Nabove(tooth) >= 10) then ! Termination pt2(pt2_stoch_istate) = avg error(pt2_stoch_istate) = eqt @@ -361,14 +359,13 @@ subroutine pt2_collector(zmq_socket_pull, E, b, tbc, comb, Ncomb, computed, pt2_ endif else if (Nabove(tooth) > Nabove_old) then - print *, loop print '(G10.3, 2X, F16.10, 2X, G16.3, 2X, F16.4, A20)', Nabove(tooth), avg+E, eqt, time-time0, '' Nabove_old = Nabove(tooth) endif endif end if end do pullLoop -!<<<<<<< HEAD + if(tooth == comb_teeth+1) then pt2(pt2_stoch_istate) = sum(pt2_detail(pt2_stoch_istate,:)) diff --git a/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f b/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f index bc88c23c..8ffe502c 100644 --- a/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f +++ b/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f @@ -25,12 +25,6 @@ subroutine run_pt2_slave(thread,iproc,energy) integer :: n_tasks, k, n_tasks_max integer, allocatable :: i_generator(:), subset(:) -!if (mpi_master) then -! do i=1,N_det_generators -! print '(I6,X,100(I10,X))' ,i, psi_det_generators(:,:,i) -! enddo -!endif - n_tasks_max = N_det_generators/100+1 allocate(task_id(n_tasks_max), task(n_tasks_max)) allocate(pt2(N_states,n_tasks_max), i_generator(n_tasks_max), subset(n_tasks_max)) @@ -67,23 +61,24 @@ subroutine run_pt2_slave(thread,iproc,energy) read (task(k),*) subset(k), i_generator(k) enddo - double precision :: time0, time1 - call wall_time(time0) +! double precision :: time0, time1 +! call wall_time(time0) do k=1,n_tasks pt2(:,k) = 0.d0 buf%cur = 0 call select_connected(i_generator(k),energy,pt2(1,k),buf,subset(k)) enddo - call wall_time(time1) - +! call wall_time(time1) +! integer, external :: tasks_done_to_taskserver if (tasks_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id,n_tasks) == -1) then done = .true. endif call push_pt2_results(zmq_socket_push, i_generator, pt2, task_id, n_tasks) - ! Try to adjust n_tasks around 5 second per job - n_tasks = min(n_tasks,int( 5.d0*dble(n_tasks) / (time1 - time0 + 1.d-9)))+1 +! ! Try to adjust n_tasks around 5 second per job +! n_tasks = min(n_tasks,int( 5.d0*dble(n_tasks) / (time1 - time0 + 1.d-9)))+1 + n_tasks = n_tasks+1 end do integer, external :: disconnect_from_taskserver diff --git a/plugins/Full_CI_ZMQ/run_selection_slave.irp.f b/plugins/Full_CI_ZMQ/run_selection_slave.irp.f index 52b75a3a..09f7974c 100644 --- a/plugins/Full_CI_ZMQ/run_selection_slave.irp.f +++ b/plugins/Full_CI_ZMQ/run_selection_slave.irp.f @@ -97,8 +97,9 @@ subroutine run_selection_slave_new(thread,iproc,energy) pt2(:,:) = 0d0 buf%cur = 0 - ! Try to adjust n_tasks around 5 second per job - n_tasks = min(n_tasks,int( 5.d0 * dble(n_tasks) / (time1 - time0 + 1.d-9)))+1 +! ! Try to adjust n_tasks around 5 second per job +! n_tasks = min(n_tasks,int( 5.d0 * dble(n_tasks) / (time1 - time0 + 1.d-9)))+1 + n_tasks = n_tasks+1 end do integer, external :: disconnect_from_taskserver diff --git a/plugins/Full_CI_ZMQ/zmq_selection.irp.f b/plugins/Full_CI_ZMQ/zmq_selection.irp.f index 6bcc548a..b3a87e95 100644 --- a/plugins/Full_CI_ZMQ/zmq_selection.irp.f +++ b/plugins/Full_CI_ZMQ/zmq_selection.irp.f @@ -60,7 +60,8 @@ subroutine ZMQ_selection(N_in, pt2) task = ' ' do i= 1, N_det_generators - if (i>ishft(N_det_generators,-2)) then +! /!\ Fragments don't work +! if (i>-ishft(N_det_generators,-2)) then write(task(ipos:ipos+30),'(I9,1X,I9,1X,I9,''|'')') 0, i, N ipos += 30 if (ipos > 63970) then @@ -69,18 +70,18 @@ subroutine ZMQ_selection(N_in, pt2) endif ipos=1 endif - else - do j=1,fragment_count - write(task(ipos:ipos+30),'(I9,1X,I9,1X,I9,''|'')') j, i, N - ipos += 30 - if (ipos > 63970) then - if (add_task_to_taskserver(zmq_to_qp_run_socket,trim(task(1:ipos))) == -1) then - stop 'Unable to add task to task server' - endif - ipos=1 - endif - end do - endif +! else +! do j=1,fragment_count +! write(task(ipos:ipos+30),'(I9,1X,I9,1X,I9,''|'')') j, i, N +! ipos += 30 +! if (ipos > 63970) then +! if (add_task_to_taskserver(zmq_to_qp_run_socket,trim(task(1:ipos))) == -1) then +! stop 'Unable to add task to task server' +! endif +! ipos=1 +! endif +! end do +! endif enddo if (ipos > 1) then if (add_task_to_taskserver(zmq_to_qp_run_socket,trim(task(1:ipos))) == -1) then diff --git a/plugins/Generators_full/generators.irp.f b/plugins/Generators_full/generators.irp.f index d706863c..c40ba2d4 100644 --- a/plugins/Generators_full/generators.irp.f +++ b/plugins/Generators_full/generators.irp.f @@ -13,7 +13,7 @@ BEGIN_PROVIDER [ integer, N_det_generators ] N_det_generators = N_det do i=1,N_det norm = norm + psi_average_norm_contrib_sorted(i) - if (norm > threshold_generators+1d-15) then + if (norm >= threshold_generators) then N_det_generators = i exit endif @@ -47,9 +47,7 @@ END_PROVIDER integer :: i, k psi_det_sorted_gen = psi_det_sorted psi_coef_sorted_gen = psi_coef_sorted - !do i=1,N_det_generators - psi_det_sorted_gen_order = psi_det_sorted_order - !end do + psi_det_sorted_gen_order = psi_det_sorted_order END_PROVIDER diff --git a/plugins/dress_zmq/dress_slave.irp.f b/plugins/dress_zmq/dress_slave.irp.f index 0c5b7193..6de3e2da 100644 --- a/plugins/dress_zmq/dress_slave.irp.f +++ b/plugins/dress_zmq/dress_slave.irp.f @@ -28,7 +28,7 @@ subroutine run_wf double precision :: energy(N_states_diag) character*(64) :: states(1) integer :: rc, i -integer, external :: zmq_get_dvector, zmq_get_N_det_generators + integer, external :: zmq_get_dvector, zmq_get_N_det_generators integer, external :: zmq_get_psi, zmq_get_N_det_selectors integer, external :: zmq_get_N_states_diag double precision :: tmp diff --git a/src/Determinants/H_apply.irp.f b/src/Determinants/H_apply.irp.f index 3ba674f1..e5197a21 100644 --- a/src/Determinants/H_apply.irp.f +++ b/src/Determinants/H_apply.irp.f @@ -194,7 +194,6 @@ subroutine copy_H_apply_buffer_to_wf ! logical :: found_duplicates ! call remove_duplicates_in_psi_det(found_duplicates) - end subroutine remove_duplicates_in_psi_det(found_duplicates) diff --git a/src/Determinants/s2.irp.f b/src/Determinants/s2.irp.f index 273b8352..95339664 100644 --- a/src/Determinants/s2.irp.f +++ b/src/Determinants/s2.irp.f @@ -190,7 +190,7 @@ subroutine S2_u_0_nstates(v_0,u_0,n,keys_tmp,Nint,N_st,sze_8) vt = 0.d0 do sh=1,shortcut(0,1) - !$OMP DO + !$OMP DO SCHEDULE(static,1) do sh2=sh,shortcut(0,1) exa = 0 do ni=1,Nint diff --git a/src/MO_Basis/ao_ortho_canonical.irp.f b/src/MO_Basis/ao_ortho_canonical.irp.f index ab93f94e..1cc3444e 100644 --- a/src/MO_Basis/ao_ortho_canonical.irp.f +++ b/src/MO_Basis/ao_ortho_canonical.irp.f @@ -115,6 +115,7 @@ END_PROVIDER ao_num,ao_ortho_canonical_coef,size(ao_ortho_canonical_coef,1), & ao_ortho_canonical_num) + else double precision, allocatable :: S(:,:) @@ -134,13 +135,6 @@ END_PROVIDER S, size(S,1), & 0.d0, ao_ortho_canonical_coef, size(ao_ortho_canonical_coef,1)) -!integer :: j -!do i=1,ao_num -! do j=1,ao_num -! print *, i,j, ao_ortho_canonical_coef(i,j) -! enddo -!enddo -!stop deallocate(S) endif END_PROVIDER diff --git a/src/ZMQ/utils.irp.f b/src/ZMQ/utils.irp.f index 97fded04..1f775413 100644 --- a/src/ZMQ/utils.irp.f +++ b/src/ZMQ/utils.irp.f @@ -323,7 +323,7 @@ IRP_ENDIF stop 'Unable to set ZMQ_LINGER on push socket' endif - rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_SNDHWM,3,4) + rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_SNDHWM,5,4) if (rc /= 0) then stop 'Unable to set ZMQ_SNDHWM on push socket' endif From 256048d24f41c7f6a1ecc12395e11fc4fa203050 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 27 Jun 2018 15:20:33 +0200 Subject: [PATCH 60/96] Fixed MRCC --- plugins/Bk/NEEDED_CHILDREN_MODULES | 2 +- plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f | 17 +- .../Full_CI_ZMQ_GPI2/NEEDED_CHILDREN_MODULES | 1 - plugins/Full_CI_ZMQ_GPI2/README.rst | 15 -- .../selection_davidson_slave_gpi2.irp.f | 105 -------- plugins/GPI2/broadcast.irp.f | 254 ------------------ plugins/MRPT_Utils/mrpt_utils.irp.f | 80 +++--- plugins/dress_zmq/EZFIO.cfg | 17 -- plugins/dress_zmq/dressing_vector.irp.f | 1 - plugins/mrcc_sto/NEEDED_CHILDREN_MODULES | 1 - plugins/mrcc_sto/README.rst | 12 - plugins/mrcc_sto/mrcc_sto.irp.f | 240 ----------------- plugins/mrcepa0/dressing.irp.f | 170 ++---------- plugins/mrcepa0/dressing_slave.irp.f | 8 +- plugins/mrcepa0/dressing_vector.irp.f | 10 +- plugins/mrcepa0/mrcc.irp.f | 2 +- plugins/mrcepa0/mrcc_omp.irp.f | 27 -- plugins/mrcepa0/mrcc_stoch_routines.irp.f | 5 +- plugins/mrcepa0/mrcc_zmq.irp.f | 4 + .../read_integral/Gen_Ezfio_from_integral.sh | 17 -- plugins/shiftedbk/EZFIO.cfg | 55 ++-- tests/bats/mrcepa0.bats | 40 ++- tests/bats_to_sh.py | 2 +- 23 files changed, 136 insertions(+), 949 deletions(-) delete mode 100644 plugins/Full_CI_ZMQ_GPI2/NEEDED_CHILDREN_MODULES delete mode 100644 plugins/Full_CI_ZMQ_GPI2/README.rst delete mode 100644 plugins/Full_CI_ZMQ_GPI2/selection_davidson_slave_gpi2.irp.f delete mode 100644 plugins/GPI2/broadcast.irp.f delete mode 100644 plugins/dress_zmq/EZFIO.cfg delete mode 100644 plugins/mrcc_sto/NEEDED_CHILDREN_MODULES delete mode 100644 plugins/mrcc_sto/README.rst delete mode 100644 plugins/mrcc_sto/mrcc_sto.irp.f delete mode 100644 plugins/mrcepa0/mrcc_omp.irp.f delete mode 100755 plugins/read_integral/Gen_Ezfio_from_integral.sh diff --git a/plugins/Bk/NEEDED_CHILDREN_MODULES b/plugins/Bk/NEEDED_CHILDREN_MODULES index 6bcca9aa..709c29ec 100644 --- a/plugins/Bk/NEEDED_CHILDREN_MODULES +++ b/plugins/Bk/NEEDED_CHILDREN_MODULES @@ -1,2 +1,2 @@ -Bitmask dress_zmq DavidsonDressed +Bitmask dress_zmq DavidsonDressed Generators_full Selectors_full diff --git a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f index 8ebbdff7..95759730 100644 --- a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f +++ b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f @@ -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)) E0 += pt2_detail(pt2_stoch_istate,first_det_of_teeth(tooth)) * prop 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 eqt = 0.d0 endif 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 pt2(pt2_stoch_istate) = avg error(pt2_stoch_istate) = eqt @@ -358,7 +358,7 @@ subroutine pt2_collector(zmq_socket_pull, E, b, tbc, comb, Ncomb, computed, pt2_ endif endif 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, '' Nabove_old = Nabove(tooth) endif @@ -378,16 +378,7 @@ subroutine pt2_collector(zmq_socket_pull, E, b, tbc, comb, Ncomb, computed, pt2_ pt2(pt2_stoch_istate) = E0 + (sumabove(tooth) / Nabove(tooth)) error(pt2_stoch_istate) = sqrt(1d0 / (Nabove(tooth)-1) * abs(sum2above(tooth) / Nabove(tooth) - (sumabove(tooth)/Nabove(tooth))**2)) 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 sort_selection_buffer(b) end subroutine diff --git a/plugins/Full_CI_ZMQ_GPI2/NEEDED_CHILDREN_MODULES b/plugins/Full_CI_ZMQ_GPI2/NEEDED_CHILDREN_MODULES deleted file mode 100644 index dd79ddf2..00000000 --- a/plugins/Full_CI_ZMQ_GPI2/NEEDED_CHILDREN_MODULES +++ /dev/null @@ -1 +0,0 @@ -Full_CI_ZMQ GPI2 diff --git a/plugins/Full_CI_ZMQ_GPI2/README.rst b/plugins/Full_CI_ZMQ_GPI2/README.rst deleted file mode 100644 index b3e89d9e..00000000 --- a/plugins/Full_CI_ZMQ_GPI2/README.rst +++ /dev/null @@ -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. diff --git a/plugins/Full_CI_ZMQ_GPI2/selection_davidson_slave_gpi2.irp.f b/plugins/Full_CI_ZMQ_GPI2/selection_davidson_slave_gpi2.irp.f deleted file mode 100644 index 52822e41..00000000 --- a/plugins/Full_CI_ZMQ_GPI2/selection_davidson_slave_gpi2.irp.f +++ /dev/null @@ -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 - - - diff --git a/plugins/GPI2/broadcast.irp.f b/plugins/GPI2/broadcast.irp.f deleted file mode 100644 index e9f421d8..00000000 --- a/plugins/GPI2/broadcast.irp.f +++ /dev/null @@ -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 - - - - diff --git a/plugins/MRPT_Utils/mrpt_utils.irp.f b/plugins/MRPT_Utils/mrpt_utils.irp.f index e186116d..dfb8f2c8 100644 --- a/plugins/MRPT_Utils/mrpt_utils.irp.f +++ b/plugins/MRPT_Utils/mrpt_utils.irp.f @@ -16,23 +16,23 @@ integer :: i,j,m integer :: i_state double precision :: accu(N_states) - double precision, allocatable :: delta_ij_tmp(:,:,:) + double precision, allocatable :: delta_ij_local(:,:,:) 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 - delta_ij_tmp = 0.d0 - call H_apply_mrpt_1h(delta_ij_tmp,N_det) + delta_ij_local = 0.d0 + call H_apply_mrpt_1h(delta_ij_local,N_det) accu = 0.d0 do i_state = 1, N_states do i = 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) - delta_ij_mrpt(j,i,i_state) += delta_ij_tmp(j,i,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_local(j,i,i_state) enddo enddo second_order_pt_new_1h(i_state) = accu(i_state) @@ -40,14 +40,14 @@ print*, '1h = ',accu ! 1p - delta_ij_tmp = 0.d0 - call H_apply_mrpt_1p(delta_ij_tmp,N_det) + delta_ij_local = 0.d0 + call H_apply_mrpt_1p(delta_ij_local,N_det) accu = 0.d0 do i_state = 1, N_states do i = 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) - delta_ij_mrpt(j,i,i_state) += delta_ij_tmp(j,i,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_local(j,i,i_state) enddo enddo second_order_pt_new_1p(i_state) = accu(i_state) @@ -55,15 +55,15 @@ print*, '1p = ',accu ! 1h1p - delta_ij_tmp = 0.d0 - call H_apply_mrpt_1h1p(delta_ij_tmp,N_det) + delta_ij_local = 0.d0 + call H_apply_mrpt_1h1p(delta_ij_local,N_det) double precision :: e_corr_from_1h1p_singles(N_states) accu = 0.d0 do i_state = 1, N_states do i = 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) - delta_ij_mrpt(j,i,i_state) += delta_ij_tmp(j,i,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_local(j,i,i_state) enddo enddo second_order_pt_new_1h1p(i_state) = accu(i_state) @@ -72,14 +72,14 @@ ! 1h1p third order if(do_third_order_1h1p)then - delta_ij_tmp = 0.d0 - call give_1h1p_sec_order_singles_contrib(delta_ij_tmp) + delta_ij_local = 0.d0 + call give_1h1p_sec_order_singles_contrib(delta_ij_local) accu = 0.d0 do i_state = 1, N_states do i = 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) - delta_ij_mrpt(j,i,i_state) += delta_ij_tmp(j,i,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_local(j,i,i_state) enddo enddo second_order_pt_new_1h1p(i_state) = accu(i_state) @@ -88,14 +88,14 @@ endif ! 2h - delta_ij_tmp = 0.d0 - call H_apply_mrpt_2h(delta_ij_tmp,N_det) + delta_ij_local = 0.d0 + call H_apply_mrpt_2h(delta_ij_local,N_det) accu = 0.d0 do i_state = 1, N_states do i = 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) - delta_ij_mrpt(j,i,i_state) += delta_ij_tmp(j,i,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_local(j,i,i_state) enddo enddo second_order_pt_new_2h(i_state) = accu(i_state) @@ -103,14 +103,14 @@ print*, '2h = ',accu ! 2p - delta_ij_tmp = 0.d0 - call H_apply_mrpt_2p(delta_ij_tmp,N_det) + delta_ij_local = 0.d0 + call H_apply_mrpt_2p(delta_ij_local,N_det) accu = 0.d0 do i_state = 1, N_states do i = 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) - delta_ij_mrpt(j,i,i_state) += delta_ij_tmp(j,i,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_local(j,i,i_state) enddo enddo second_order_pt_new_2p(i_state) = accu(i_state) @@ -118,15 +118,15 @@ print*, '2p = ',accu ! 1h2p - delta_ij_tmp = 0.d0 - call give_1h2p_contrib(delta_ij_tmp) - call H_apply_mrpt_1h2p(delta_ij_tmp,N_det) + delta_ij_local = 0.d0 + call give_1h2p_contrib(delta_ij_local) + call H_apply_mrpt_1h2p(delta_ij_local,N_det) accu = 0.d0 do i_state = 1, N_states do i = 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) - delta_ij_mrpt(j,i,i_state) += delta_ij_tmp(j,i,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_local(j,i,i_state) enddo enddo second_order_pt_new_1h2p(i_state) = accu(i_state) @@ -134,15 +134,15 @@ print*, '1h2p = ',accu ! 2h1p - delta_ij_tmp = 0.d0 - call give_2h1p_contrib(delta_ij_tmp) - call H_apply_mrpt_2h1p(delta_ij_tmp,N_det) + delta_ij_local = 0.d0 + call give_2h1p_contrib(delta_ij_local) + call H_apply_mrpt_2h1p(delta_ij_local,N_det) accu = 0.d0 do i_state = 1, N_states do i = 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) - delta_ij_mrpt(j,i,i_state) += delta_ij_tmp(j,i,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_local(j,i,i_state) enddo enddo second_order_pt_new_2h1p(i_state) = accu(i_state) @@ -150,14 +150,14 @@ print*, '2h1p = ',accu ! 2h2p -!delta_ij_tmp = 0.d0 -!call H_apply_mrpt_2h2p(delta_ij_tmp,N_det) +!delta_ij_local = 0.d0 +!call H_apply_mrpt_2h2p(delta_ij_local,N_det) !accu = 0.d0 !do i_state = 1, N_states !do i = 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) -! delta_ij_mrpt(j,i,i_state) += delta_ij_tmp(j,i,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_local(j,i,i_state) ! enddo !enddo !second_order_pt_new_2h2p(i_state) = accu(i_state) diff --git a/plugins/dress_zmq/EZFIO.cfg b/plugins/dress_zmq/EZFIO.cfg deleted file mode 100644 index 52d41568..00000000 --- a/plugins/dress_zmq/EZFIO.cfg +++ /dev/null @@ -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 - diff --git a/plugins/dress_zmq/dressing_vector.irp.f b/plugins/dress_zmq/dressing_vector.irp.f index 98c69cbf..a7251dd9 100644 --- a/plugins/dress_zmq/dressing_vector.irp.f +++ b/plugins/dress_zmq/dressing_vector.irp.f @@ -18,7 +18,6 @@ do j = 1, n_det dressing_column_h(j,k) = delta_ij(k,j,1) dressing_column_s(j,k) = delta_ij(k,j,2) -! print *, j, delta_ij(k,j,:) enddo enddo END_PROVIDER diff --git a/plugins/mrcc_sto/NEEDED_CHILDREN_MODULES b/plugins/mrcc_sto/NEEDED_CHILDREN_MODULES deleted file mode 100644 index 8416d0f5..00000000 --- a/plugins/mrcc_sto/NEEDED_CHILDREN_MODULES +++ /dev/null @@ -1 +0,0 @@ -dress_zmq DavidsonDressed Psiref_CAS MRPT_Utils Perturbation MRCC_Utils diff --git a/plugins/mrcc_sto/README.rst b/plugins/mrcc_sto/README.rst deleted file mode 100644 index da126dfd..00000000 --- a/plugins/mrcc_sto/README.rst +++ /dev/null @@ -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. diff --git a/plugins/mrcc_sto/mrcc_sto.irp.f b/plugins/mrcc_sto/mrcc_sto.irp.f deleted file mode 100644 index e72f1112..00000000 --- a/plugins/mrcc_sto/mrcc_sto.irp.f +++ /dev/null @@ -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 - - diff --git a/plugins/mrcepa0/dressing.irp.f b/plugins/mrcepa0/dressing.irp.f index ad557d1a..f76a1424 100644 --- a/plugins/mrcepa0/dressing.irp.f +++ b/plugins/mrcepa0/dressing.irp.f @@ -74,118 +74,6 @@ BEGIN_PROVIDER [ double precision, mrcc_norm_acc, (0:N_det_non_ref, N_states) ] 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) ] @@ -251,7 +139,7 @@ END_PROVIDER &BEGIN_PROVIDER [ double precision, delta_ij_s2_mrcc, (N_states,N_det_non_ref) ] use bitmasks 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),allocatable :: buf(:,:,:) logical :: ok @@ -266,13 +154,15 @@ END_PROVIDER 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(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 - 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 do h=1, hh_shortcut(0) 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 end do - deallocate(buf) end do - !$OMP END PARALLEL DO + !$OMP END DO + + deallocate(buf) + + !$OMP END PARALLEL END_PROVIDER @@ -502,7 +395,7 @@ subroutine mrcc_part_dress(delta_ij_, delta_ij_s2_, i_generator,n_selected,det_b hka = hij_cache(idx_alpha(k_sd)) if (dabs(hka) > 1.d-12) then call get_delta_e_dyall_general_mp(psi_ref(1,1,i_I),tq(1,1,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) @@ -510,7 +403,7 @@ subroutine mrcc_part_dress(delta_ij_, delta_ij_s2_, i_generator,n_selected,det_b endif endif - + if (perturbative_triples.and. (degree2 == 1) ) then call i_h_j(psi_ref(1,1,i_I),tmp_det,Nint,hka) hka = hij_cache(idx_alpha(k_sd)) - hka @@ -521,14 +414,14 @@ subroutine mrcc_part_dress(delta_ij_, delta_ij_s2_, i_generator,n_selected,det_b 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 - + do i_state=1,N_states ci_inv(i_state) = psi_ref_coef_inv(i_I,i_state) enddo @@ -542,13 +435,13 @@ subroutine mrcc_part_dress(delta_ij_, delta_ij_s2_, i_generator,n_selected,det_b enddo enddo do i_state=1,N_states + do l_sd=1,idx_alpha(0) k_sd = idx_alpha(l_sd) 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) - !!$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 delta_ij_(i_state,k_sd) += hdress !$OMP ATOMIC @@ -596,7 +489,7 @@ END_PROVIDER if(target_error /= 0d0) then target_error = target_error * 0.5d0 ! (-mrcc_E0_denominator(1) + mrcc_previous_E(1)) / 1d1 else - target_error = 1d-4 + target_error = -1d-4 end if 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 implicit none integer :: i, j, i_state - !mrmode : 1=mrcepa0, 2=mrsc2 add, 3=mrcc, 4=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 + !mrmode : 1=mrcepa0, 2=mrsc2 add, 3=mrcc 5=mrcc_stoch if(mrmode == 5) then do j = 1, N_det_non_ref do i_state = 1, N_states @@ -656,13 +535,6 @@ END_PROVIDER stop "invalid mrmode" 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 diff --git a/plugins/mrcepa0/dressing_slave.irp.f b/plugins/mrcepa0/dressing_slave.irp.f index b0c3a360..cd635f20 100644 --- a/plugins/mrcepa0/dressing_slave.irp.f +++ b/plugins/mrcepa0/dressing_slave.irp.f @@ -450,15 +450,15 @@ subroutine mrsc2_dressing_collector(zmq_socket_pull,delta_ij_,delta_ij_s2_) do l=1, n(1) 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_s2_(i_state,idx(l,1)) += delta_s2(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) end do end do do l=1, n(2) 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_s2_(i_state,idx(l,2)) += delta_s2(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) end do end do diff --git a/plugins/mrcepa0/dressing_vector.irp.f b/plugins/mrcepa0/dressing_vector.irp.f index 933e57b9..2a2de699 100644 --- a/plugins/mrcepa0/dressing_vector.irp.f +++ b/plugins/mrcepa0/dressing_vector.irp.f @@ -15,17 +15,11 @@ do k=1,N_states l = dressed_column_idx(k) - f = 1.d0/psi_coef(l,k) do jj = 1, n_det_non_ref j = idx_non_ref(jj) - dressing_column_h(j,k) = delta_ij (k,jj) * f - dressing_column_s(j,k) = delta_ij_s2(k,jj) * f + dressing_column_h(j,k) = delta_ij (k,jj) + dressing_column_s(j,k) = delta_ij_s2(k,jj) 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 -! stop END_PROVIDER diff --git a/plugins/mrcepa0/mrcc.irp.f b/plugins/mrcepa0/mrcc.irp.f index e0ae3e21..7be35b87 100644 --- a/plugins/mrcepa0/mrcc.irp.f +++ b/plugins/mrcepa0/mrcc.irp.f @@ -7,7 +7,7 @@ program mrsc2sub mrmode = 3 read_wf = .True. - SOFT_TOUCH read_wf + SOFT_TOUCH read_wf call set_generators_bitmasks_as_holes_and_particles if (.True.) then integer :: i,j diff --git a/plugins/mrcepa0/mrcc_omp.irp.f b/plugins/mrcepa0/mrcc_omp.irp.f deleted file mode 100644 index 5c4d318d..00000000 --- a/plugins/mrcepa0/mrcc_omp.irp.f +++ /dev/null @@ -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 - diff --git a/plugins/mrcepa0/mrcc_stoch_routines.irp.f b/plugins/mrcepa0/mrcc_stoch_routines.irp.f index efa7a1ae..abf2734d 100644 --- a/plugins/mrcepa0/mrcc_stoch_routines.irp.f +++ b/plugins/mrcepa0/mrcc_stoch_routines.irp.f @@ -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 *, ' Samples Energy Stat. Error Seconds ' 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 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 call sleep(1) if (zmq_abort(zmq_to_qp_run_socket) == -1) then @@ -400,7 +401,7 @@ end function &BEGIN_PROVIDER [ integer, N_cps_max ] implicit none comb_teeth = 16 - N_cps_max = 64 + N_cps_max = 128 !comb_per_cp = 64 gen_per_cp = (N_det_generators / N_cps_max) + 1 N_cps_max += 1 diff --git a/plugins/mrcepa0/mrcc_zmq.irp.f b/plugins/mrcepa0/mrcc_zmq.irp.f index f9c519e9..a3089a24 100644 --- a/plugins/mrcepa0/mrcc_zmq.irp.f +++ b/plugins/mrcepa0/mrcc_zmq.irp.f @@ -6,6 +6,10 @@ program mrsc2sub !mrmode : 1=mrcepa0, 2=mrsc2 add, 3=mrcc mrmode = 5 +threshold_generators = 1.d0 +threshold_selectors = 1.d0 +TOUCH threshold_generators threshold_selectors + read_wf = .True. SOFT_TOUCH read_wf call set_generators_bitmasks_as_holes_and_particles diff --git a/plugins/read_integral/Gen_Ezfio_from_integral.sh b/plugins/read_integral/Gen_Ezfio_from_integral.sh deleted file mode 100755 index d190ffae..00000000 --- a/plugins/read_integral/Gen_Ezfio_from_integral.sh +++ /dev/null @@ -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 diff --git a/plugins/shiftedbk/EZFIO.cfg b/plugins/shiftedbk/EZFIO.cfg index be4998dd..c594bcf8 100644 --- a/plugins/shiftedbk/EZFIO.cfg +++ b/plugins/shiftedbk/EZFIO.cfg @@ -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] type: Perturbation doc: Type of zeroth-order Hamiltonian [ EN | Barycentric ] interface: ezfio,provider,ocaml 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) diff --git a/tests/bats/mrcepa0.bats b/tests/bats/mrcepa0.bats index 4985f8f0..0ebf1eab 100644 --- a/tests/bats/mrcepa0.bats +++ b/tests/bats/mrcepa0.bats @@ -18,7 +18,25 @@ source $QP_ROOT/tests/bats/common.bats.sh ezfio set_file TMP energy="$(ezfio get mrcepa0 energy_pt2)" 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" { @@ -36,7 +54,25 @@ source $QP_ROOT/tests/bats/common.bats.sh ezfio set_file TMP energy="$(ezfio get mrcepa0 energy_pt2)" 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" { diff --git a/tests/bats_to_sh.py b/tests/bats_to_sh.py index 8feb9272..37e5fadb 100755 --- a/tests/bats_to_sh.py +++ b/tests/bats_to_sh.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 import sys From 6c73330855dfa4fb7bb2fc4997bbb9dd89e7e857 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 27 Jun 2018 15:20:33 +0200 Subject: [PATCH 61/96] Fixed MRCC --- plugins/Bk/NEEDED_CHILDREN_MODULES | 2 +- plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f | 17 +- .../Full_CI_ZMQ_GPI2/NEEDED_CHILDREN_MODULES | 1 - plugins/Full_CI_ZMQ_GPI2/README.rst | 15 -- .../selection_davidson_slave_gpi2.irp.f | 105 -------- plugins/GPI2/broadcast.irp.f | 254 ------------------ plugins/MRPT_Utils/mrpt_utils.irp.f | 80 +++--- plugins/dress_zmq/EZFIO.cfg | 17 -- plugins/dress_zmq/dressing_vector.irp.f | 1 - plugins/mrcc_sto/NEEDED_CHILDREN_MODULES | 1 - plugins/mrcc_sto/README.rst | 12 - plugins/mrcc_sto/mrcc_sto.irp.f | 240 ----------------- plugins/mrcepa0/dressing.irp.f | 170 ++---------- plugins/mrcepa0/dressing_slave.irp.f | 8 +- plugins/mrcepa0/dressing_vector.irp.f | 10 +- plugins/mrcepa0/mrcc.irp.f | 2 +- plugins/mrcepa0/mrcc_omp.irp.f | 27 -- plugins/mrcepa0/mrcc_stoch_routines.irp.f | 5 +- plugins/mrcepa0/mrcc_zmq.irp.f | 4 + .../read_integral/Gen_Ezfio_from_integral.sh | 17 -- plugins/shiftedbk/EZFIO.cfg | 55 ++-- tests/bats/mrcepa0.bats | 42 ++- tests/bats_to_sh.py | 2 +- 23 files changed, 137 insertions(+), 950 deletions(-) delete mode 100644 plugins/Full_CI_ZMQ_GPI2/NEEDED_CHILDREN_MODULES delete mode 100644 plugins/Full_CI_ZMQ_GPI2/README.rst delete mode 100644 plugins/Full_CI_ZMQ_GPI2/selection_davidson_slave_gpi2.irp.f delete mode 100644 plugins/GPI2/broadcast.irp.f delete mode 100644 plugins/dress_zmq/EZFIO.cfg delete mode 100644 plugins/mrcc_sto/NEEDED_CHILDREN_MODULES delete mode 100644 plugins/mrcc_sto/README.rst delete mode 100644 plugins/mrcc_sto/mrcc_sto.irp.f delete mode 100644 plugins/mrcepa0/mrcc_omp.irp.f delete mode 100755 plugins/read_integral/Gen_Ezfio_from_integral.sh diff --git a/plugins/Bk/NEEDED_CHILDREN_MODULES b/plugins/Bk/NEEDED_CHILDREN_MODULES index 6bcca9aa..709c29ec 100644 --- a/plugins/Bk/NEEDED_CHILDREN_MODULES +++ b/plugins/Bk/NEEDED_CHILDREN_MODULES @@ -1,2 +1,2 @@ -Bitmask dress_zmq DavidsonDressed +Bitmask dress_zmq DavidsonDressed Generators_full Selectors_full diff --git a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f index 8ebbdff7..95759730 100644 --- a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f +++ b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f @@ -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)) E0 += pt2_detail(pt2_stoch_istate,first_det_of_teeth(tooth)) * prop 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 eqt = 0.d0 endif 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 pt2(pt2_stoch_istate) = avg error(pt2_stoch_istate) = eqt @@ -358,7 +358,7 @@ subroutine pt2_collector(zmq_socket_pull, E, b, tbc, comb, Ncomb, computed, pt2_ endif endif 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, '' Nabove_old = Nabove(tooth) endif @@ -378,16 +378,7 @@ subroutine pt2_collector(zmq_socket_pull, E, b, tbc, comb, Ncomb, computed, pt2_ pt2(pt2_stoch_istate) = E0 + (sumabove(tooth) / Nabove(tooth)) error(pt2_stoch_istate) = sqrt(1d0 / (Nabove(tooth)-1) * abs(sum2above(tooth) / Nabove(tooth) - (sumabove(tooth)/Nabove(tooth))**2)) 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 sort_selection_buffer(b) end subroutine diff --git a/plugins/Full_CI_ZMQ_GPI2/NEEDED_CHILDREN_MODULES b/plugins/Full_CI_ZMQ_GPI2/NEEDED_CHILDREN_MODULES deleted file mode 100644 index dd79ddf2..00000000 --- a/plugins/Full_CI_ZMQ_GPI2/NEEDED_CHILDREN_MODULES +++ /dev/null @@ -1 +0,0 @@ -Full_CI_ZMQ GPI2 diff --git a/plugins/Full_CI_ZMQ_GPI2/README.rst b/plugins/Full_CI_ZMQ_GPI2/README.rst deleted file mode 100644 index b3e89d9e..00000000 --- a/plugins/Full_CI_ZMQ_GPI2/README.rst +++ /dev/null @@ -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. diff --git a/plugins/Full_CI_ZMQ_GPI2/selection_davidson_slave_gpi2.irp.f b/plugins/Full_CI_ZMQ_GPI2/selection_davidson_slave_gpi2.irp.f deleted file mode 100644 index 52822e41..00000000 --- a/plugins/Full_CI_ZMQ_GPI2/selection_davidson_slave_gpi2.irp.f +++ /dev/null @@ -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 - - - diff --git a/plugins/GPI2/broadcast.irp.f b/plugins/GPI2/broadcast.irp.f deleted file mode 100644 index e9f421d8..00000000 --- a/plugins/GPI2/broadcast.irp.f +++ /dev/null @@ -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 - - - - diff --git a/plugins/MRPT_Utils/mrpt_utils.irp.f b/plugins/MRPT_Utils/mrpt_utils.irp.f index e186116d..dfb8f2c8 100644 --- a/plugins/MRPT_Utils/mrpt_utils.irp.f +++ b/plugins/MRPT_Utils/mrpt_utils.irp.f @@ -16,23 +16,23 @@ integer :: i,j,m integer :: i_state double precision :: accu(N_states) - double precision, allocatable :: delta_ij_tmp(:,:,:) + double precision, allocatable :: delta_ij_local(:,:,:) 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 - delta_ij_tmp = 0.d0 - call H_apply_mrpt_1h(delta_ij_tmp,N_det) + delta_ij_local = 0.d0 + call H_apply_mrpt_1h(delta_ij_local,N_det) accu = 0.d0 do i_state = 1, N_states do i = 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) - delta_ij_mrpt(j,i,i_state) += delta_ij_tmp(j,i,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_local(j,i,i_state) enddo enddo second_order_pt_new_1h(i_state) = accu(i_state) @@ -40,14 +40,14 @@ print*, '1h = ',accu ! 1p - delta_ij_tmp = 0.d0 - call H_apply_mrpt_1p(delta_ij_tmp,N_det) + delta_ij_local = 0.d0 + call H_apply_mrpt_1p(delta_ij_local,N_det) accu = 0.d0 do i_state = 1, N_states do i = 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) - delta_ij_mrpt(j,i,i_state) += delta_ij_tmp(j,i,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_local(j,i,i_state) enddo enddo second_order_pt_new_1p(i_state) = accu(i_state) @@ -55,15 +55,15 @@ print*, '1p = ',accu ! 1h1p - delta_ij_tmp = 0.d0 - call H_apply_mrpt_1h1p(delta_ij_tmp,N_det) + delta_ij_local = 0.d0 + call H_apply_mrpt_1h1p(delta_ij_local,N_det) double precision :: e_corr_from_1h1p_singles(N_states) accu = 0.d0 do i_state = 1, N_states do i = 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) - delta_ij_mrpt(j,i,i_state) += delta_ij_tmp(j,i,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_local(j,i,i_state) enddo enddo second_order_pt_new_1h1p(i_state) = accu(i_state) @@ -72,14 +72,14 @@ ! 1h1p third order if(do_third_order_1h1p)then - delta_ij_tmp = 0.d0 - call give_1h1p_sec_order_singles_contrib(delta_ij_tmp) + delta_ij_local = 0.d0 + call give_1h1p_sec_order_singles_contrib(delta_ij_local) accu = 0.d0 do i_state = 1, N_states do i = 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) - delta_ij_mrpt(j,i,i_state) += delta_ij_tmp(j,i,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_local(j,i,i_state) enddo enddo second_order_pt_new_1h1p(i_state) = accu(i_state) @@ -88,14 +88,14 @@ endif ! 2h - delta_ij_tmp = 0.d0 - call H_apply_mrpt_2h(delta_ij_tmp,N_det) + delta_ij_local = 0.d0 + call H_apply_mrpt_2h(delta_ij_local,N_det) accu = 0.d0 do i_state = 1, N_states do i = 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) - delta_ij_mrpt(j,i,i_state) += delta_ij_tmp(j,i,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_local(j,i,i_state) enddo enddo second_order_pt_new_2h(i_state) = accu(i_state) @@ -103,14 +103,14 @@ print*, '2h = ',accu ! 2p - delta_ij_tmp = 0.d0 - call H_apply_mrpt_2p(delta_ij_tmp,N_det) + delta_ij_local = 0.d0 + call H_apply_mrpt_2p(delta_ij_local,N_det) accu = 0.d0 do i_state = 1, N_states do i = 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) - delta_ij_mrpt(j,i,i_state) += delta_ij_tmp(j,i,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_local(j,i,i_state) enddo enddo second_order_pt_new_2p(i_state) = accu(i_state) @@ -118,15 +118,15 @@ print*, '2p = ',accu ! 1h2p - delta_ij_tmp = 0.d0 - call give_1h2p_contrib(delta_ij_tmp) - call H_apply_mrpt_1h2p(delta_ij_tmp,N_det) + delta_ij_local = 0.d0 + call give_1h2p_contrib(delta_ij_local) + call H_apply_mrpt_1h2p(delta_ij_local,N_det) accu = 0.d0 do i_state = 1, N_states do i = 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) - delta_ij_mrpt(j,i,i_state) += delta_ij_tmp(j,i,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_local(j,i,i_state) enddo enddo second_order_pt_new_1h2p(i_state) = accu(i_state) @@ -134,15 +134,15 @@ print*, '1h2p = ',accu ! 2h1p - delta_ij_tmp = 0.d0 - call give_2h1p_contrib(delta_ij_tmp) - call H_apply_mrpt_2h1p(delta_ij_tmp,N_det) + delta_ij_local = 0.d0 + call give_2h1p_contrib(delta_ij_local) + call H_apply_mrpt_2h1p(delta_ij_local,N_det) accu = 0.d0 do i_state = 1, N_states do i = 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) - delta_ij_mrpt(j,i,i_state) += delta_ij_tmp(j,i,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_local(j,i,i_state) enddo enddo second_order_pt_new_2h1p(i_state) = accu(i_state) @@ -150,14 +150,14 @@ print*, '2h1p = ',accu ! 2h2p -!delta_ij_tmp = 0.d0 -!call H_apply_mrpt_2h2p(delta_ij_tmp,N_det) +!delta_ij_local = 0.d0 +!call H_apply_mrpt_2h2p(delta_ij_local,N_det) !accu = 0.d0 !do i_state = 1, N_states !do i = 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) -! delta_ij_mrpt(j,i,i_state) += delta_ij_tmp(j,i,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_local(j,i,i_state) ! enddo !enddo !second_order_pt_new_2h2p(i_state) = accu(i_state) diff --git a/plugins/dress_zmq/EZFIO.cfg b/plugins/dress_zmq/EZFIO.cfg deleted file mode 100644 index 52d41568..00000000 --- a/plugins/dress_zmq/EZFIO.cfg +++ /dev/null @@ -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 - diff --git a/plugins/dress_zmq/dressing_vector.irp.f b/plugins/dress_zmq/dressing_vector.irp.f index 98c69cbf..a7251dd9 100644 --- a/plugins/dress_zmq/dressing_vector.irp.f +++ b/plugins/dress_zmq/dressing_vector.irp.f @@ -18,7 +18,6 @@ do j = 1, n_det dressing_column_h(j,k) = delta_ij(k,j,1) dressing_column_s(j,k) = delta_ij(k,j,2) -! print *, j, delta_ij(k,j,:) enddo enddo END_PROVIDER diff --git a/plugins/mrcc_sto/NEEDED_CHILDREN_MODULES b/plugins/mrcc_sto/NEEDED_CHILDREN_MODULES deleted file mode 100644 index 8416d0f5..00000000 --- a/plugins/mrcc_sto/NEEDED_CHILDREN_MODULES +++ /dev/null @@ -1 +0,0 @@ -dress_zmq DavidsonDressed Psiref_CAS MRPT_Utils Perturbation MRCC_Utils diff --git a/plugins/mrcc_sto/README.rst b/plugins/mrcc_sto/README.rst deleted file mode 100644 index da126dfd..00000000 --- a/plugins/mrcc_sto/README.rst +++ /dev/null @@ -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. diff --git a/plugins/mrcc_sto/mrcc_sto.irp.f b/plugins/mrcc_sto/mrcc_sto.irp.f deleted file mode 100644 index e72f1112..00000000 --- a/plugins/mrcc_sto/mrcc_sto.irp.f +++ /dev/null @@ -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 - - diff --git a/plugins/mrcepa0/dressing.irp.f b/plugins/mrcepa0/dressing.irp.f index ad557d1a..f76a1424 100644 --- a/plugins/mrcepa0/dressing.irp.f +++ b/plugins/mrcepa0/dressing.irp.f @@ -74,118 +74,6 @@ BEGIN_PROVIDER [ double precision, mrcc_norm_acc, (0:N_det_non_ref, N_states) ] 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) ] @@ -251,7 +139,7 @@ END_PROVIDER &BEGIN_PROVIDER [ double precision, delta_ij_s2_mrcc, (N_states,N_det_non_ref) ] use bitmasks 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),allocatable :: buf(:,:,:) logical :: ok @@ -266,13 +154,15 @@ END_PROVIDER 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(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 - 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 do h=1, hh_shortcut(0) 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 end do - deallocate(buf) end do - !$OMP END PARALLEL DO + !$OMP END DO + + deallocate(buf) + + !$OMP END PARALLEL END_PROVIDER @@ -502,7 +395,7 @@ subroutine mrcc_part_dress(delta_ij_, delta_ij_s2_, i_generator,n_selected,det_b hka = hij_cache(idx_alpha(k_sd)) if (dabs(hka) > 1.d-12) then call get_delta_e_dyall_general_mp(psi_ref(1,1,i_I),tq(1,1,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) @@ -510,7 +403,7 @@ subroutine mrcc_part_dress(delta_ij_, delta_ij_s2_, i_generator,n_selected,det_b endif endif - + if (perturbative_triples.and. (degree2 == 1) ) then call i_h_j(psi_ref(1,1,i_I),tmp_det,Nint,hka) hka = hij_cache(idx_alpha(k_sd)) - hka @@ -521,14 +414,14 @@ subroutine mrcc_part_dress(delta_ij_, delta_ij_s2_, i_generator,n_selected,det_b 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 - + do i_state=1,N_states ci_inv(i_state) = psi_ref_coef_inv(i_I,i_state) enddo @@ -542,13 +435,13 @@ subroutine mrcc_part_dress(delta_ij_, delta_ij_s2_, i_generator,n_selected,det_b enddo enddo do i_state=1,N_states + do l_sd=1,idx_alpha(0) k_sd = idx_alpha(l_sd) 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) - !!$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 delta_ij_(i_state,k_sd) += hdress !$OMP ATOMIC @@ -596,7 +489,7 @@ END_PROVIDER if(target_error /= 0d0) then target_error = target_error * 0.5d0 ! (-mrcc_E0_denominator(1) + mrcc_previous_E(1)) / 1d1 else - target_error = 1d-4 + target_error = -1d-4 end if 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 implicit none integer :: i, j, i_state - !mrmode : 1=mrcepa0, 2=mrsc2 add, 3=mrcc, 4=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 + !mrmode : 1=mrcepa0, 2=mrsc2 add, 3=mrcc 5=mrcc_stoch if(mrmode == 5) then do j = 1, N_det_non_ref do i_state = 1, N_states @@ -656,13 +535,6 @@ END_PROVIDER stop "invalid mrmode" 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 diff --git a/plugins/mrcepa0/dressing_slave.irp.f b/plugins/mrcepa0/dressing_slave.irp.f index b0c3a360..cd635f20 100644 --- a/plugins/mrcepa0/dressing_slave.irp.f +++ b/plugins/mrcepa0/dressing_slave.irp.f @@ -450,15 +450,15 @@ subroutine mrsc2_dressing_collector(zmq_socket_pull,delta_ij_,delta_ij_s2_) do l=1, n(1) 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_s2_(i_state,idx(l,1)) += delta_s2(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) end do end do do l=1, n(2) 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_s2_(i_state,idx(l,2)) += delta_s2(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) end do end do diff --git a/plugins/mrcepa0/dressing_vector.irp.f b/plugins/mrcepa0/dressing_vector.irp.f index 933e57b9..2a2de699 100644 --- a/plugins/mrcepa0/dressing_vector.irp.f +++ b/plugins/mrcepa0/dressing_vector.irp.f @@ -15,17 +15,11 @@ do k=1,N_states l = dressed_column_idx(k) - f = 1.d0/psi_coef(l,k) do jj = 1, n_det_non_ref j = idx_non_ref(jj) - dressing_column_h(j,k) = delta_ij (k,jj) * f - dressing_column_s(j,k) = delta_ij_s2(k,jj) * f + dressing_column_h(j,k) = delta_ij (k,jj) + dressing_column_s(j,k) = delta_ij_s2(k,jj) 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 -! stop END_PROVIDER diff --git a/plugins/mrcepa0/mrcc.irp.f b/plugins/mrcepa0/mrcc.irp.f index e0ae3e21..7be35b87 100644 --- a/plugins/mrcepa0/mrcc.irp.f +++ b/plugins/mrcepa0/mrcc.irp.f @@ -7,7 +7,7 @@ program mrsc2sub mrmode = 3 read_wf = .True. - SOFT_TOUCH read_wf + SOFT_TOUCH read_wf call set_generators_bitmasks_as_holes_and_particles if (.True.) then integer :: i,j diff --git a/plugins/mrcepa0/mrcc_omp.irp.f b/plugins/mrcepa0/mrcc_omp.irp.f deleted file mode 100644 index 5c4d318d..00000000 --- a/plugins/mrcepa0/mrcc_omp.irp.f +++ /dev/null @@ -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 - diff --git a/plugins/mrcepa0/mrcc_stoch_routines.irp.f b/plugins/mrcepa0/mrcc_stoch_routines.irp.f index efa7a1ae..abf2734d 100644 --- a/plugins/mrcepa0/mrcc_stoch_routines.irp.f +++ b/plugins/mrcepa0/mrcc_stoch_routines.irp.f @@ -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 *, ' Samples Energy Stat. Error Seconds ' 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 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 call sleep(1) if (zmq_abort(zmq_to_qp_run_socket) == -1) then @@ -400,7 +401,7 @@ end function &BEGIN_PROVIDER [ integer, N_cps_max ] implicit none comb_teeth = 16 - N_cps_max = 64 + N_cps_max = 128 !comb_per_cp = 64 gen_per_cp = (N_det_generators / N_cps_max) + 1 N_cps_max += 1 diff --git a/plugins/mrcepa0/mrcc_zmq.irp.f b/plugins/mrcepa0/mrcc_zmq.irp.f index f9c519e9..a3089a24 100644 --- a/plugins/mrcepa0/mrcc_zmq.irp.f +++ b/plugins/mrcepa0/mrcc_zmq.irp.f @@ -6,6 +6,10 @@ program mrsc2sub !mrmode : 1=mrcepa0, 2=mrsc2 add, 3=mrcc mrmode = 5 +threshold_generators = 1.d0 +threshold_selectors = 1.d0 +TOUCH threshold_generators threshold_selectors + read_wf = .True. SOFT_TOUCH read_wf call set_generators_bitmasks_as_holes_and_particles diff --git a/plugins/read_integral/Gen_Ezfio_from_integral.sh b/plugins/read_integral/Gen_Ezfio_from_integral.sh deleted file mode 100755 index d190ffae..00000000 --- a/plugins/read_integral/Gen_Ezfio_from_integral.sh +++ /dev/null @@ -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 diff --git a/plugins/shiftedbk/EZFIO.cfg b/plugins/shiftedbk/EZFIO.cfg index be4998dd..c594bcf8 100644 --- a/plugins/shiftedbk/EZFIO.cfg +++ b/plugins/shiftedbk/EZFIO.cfg @@ -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] type: Perturbation doc: Type of zeroth-order Hamiltonian [ EN | Barycentric ] interface: ezfio,provider,ocaml 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) diff --git a/tests/bats/mrcepa0.bats b/tests/bats/mrcepa0.bats index 4985f8f0..879a85e1 100644 --- a/tests/bats/mrcepa0.bats +++ b/tests/bats/mrcepa0.bats @@ -18,7 +18,25 @@ source $QP_ROOT/tests/bats/common.bats.sh ezfio set_file TMP energy="$(ezfio get mrcepa0 energy_pt2)" 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" { @@ -36,7 +54,25 @@ source $QP_ROOT/tests/bats/common.bats.sh ezfio set_file TMP energy="$(ezfio get mrcepa0 energy_pt2)" 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" { @@ -72,6 +108,6 @@ source $QP_ROOT/tests/bats/common.bats.sh ezfio set_file TMP energy="$(ezfio get mrcepa0 energy_pt2)" rm -rf TMP - eq $energy -76.2411825032868 2.e-4 + eq $energy -76.2407388142333 2.e-4 } diff --git a/tests/bats_to_sh.py b/tests/bats_to_sh.py index 8feb9272..37e5fadb 100755 --- a/tests/bats_to_sh.py +++ b/tests/bats_to_sh.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python2 import sys From bceb6f28393431f01b747a71b68cbde8d4cc0db8 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 27 Jun 2018 15:40:50 +0200 Subject: [PATCH 62/96] Fixed Bk --- plugins/Bk/dressing.irp.f | 1 - plugins/Bk/extra_functions.irp.f | 58 +++++++++++++++++++ .../dress_zmq/extra_functions.irp.f.example | 58 +++++++++++++++++++ 3 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 plugins/Bk/extra_functions.irp.f create mode 100644 plugins/dress_zmq/extra_functions.irp.f.example diff --git a/plugins/Bk/dressing.irp.f b/plugins/Bk/dressing.irp.f index d0e7c2d3..721a7554 100644 --- a/plugins/Bk/dressing.irp.f +++ b/plugins/Bk/dressing.irp.f @@ -64,4 +64,3 @@ subroutine dress_with_alpha_buffer(Nstates,Ndet,Nint,delta_ij_loc, i_gen, minili end subroutine - diff --git a/plugins/Bk/extra_functions.irp.f b/plugins/Bk/extra_functions.irp.f new file mode 100644 index 00000000..f6d196be --- /dev/null +++ b/plugins/Bk/extra_functions.irp.f @@ -0,0 +1,58 @@ + BEGIN_PROVIDER [ integer, N_dress_int_buffer ] +&BEGIN_PROVIDER [ integer, N_dress_double_buffer ] +&BEGIN_PROVIDER [ integer, N_dress_det_buffer ] + implicit none + N_dress_int_buffer = 1 + N_dress_double_buffer = 1 + N_dress_det_buffer = 1 +END_PROVIDER + + + +subroutine delta_ij_done() + BEGIN_DOC + ! This subroutine is executed on the master when the dressing has been computed, + ! before the diagonalization. + END_DOC +end + +subroutine dress_pulled(ind, int_buf, double_buf, det_buf, N_buf) + use bitmasks + implicit none + BEGIN_DOC + ! Dress the contributions pulled from the slave. + END_DOC + + integer, intent(in) :: ind, N_buf(3) + integer, intent(in) :: int_buf(*) + double precision, intent(in) :: double_buf(*) + integer(bit_kind), intent(in) :: det_buf(N_int,2,*) +end + +subroutine generator_start(i_gen, iproc) + implicit none + BEGIN_DOC + ! This subroutine is executed on the slave before computing the contribution of a generator. + END_DOC + + integer, intent(in) :: i_gen, iproc + integer :: i +end + +subroutine generator_done(i_gen, int_buf, double_buf, det_buf, N_buf, iproc) + implicit none + BEGIN_DOC + ! This subroutine is executed on the slave after computing the contribution of a generator. + END_DOC + integer, intent(in) :: i_gen, iproc + integer, intent(out) :: int_buf(N_dress_int_buffer), N_buf(3) + double precision, intent(out) :: double_buf(N_dress_double_buffer) + integer(bit_kind), intent(out) :: det_buf(N_int, 2, N_dress_det_buffer) + N_buf(:) = 1 + int_buf(:) = 0 + double_buf(:) = 0.d0 + det_buf(:,:,:) = 0 +end + + + diff --git a/plugins/dress_zmq/extra_functions.irp.f.example b/plugins/dress_zmq/extra_functions.irp.f.example new file mode 100644 index 00000000..f6d196be --- /dev/null +++ b/plugins/dress_zmq/extra_functions.irp.f.example @@ -0,0 +1,58 @@ + BEGIN_PROVIDER [ integer, N_dress_int_buffer ] +&BEGIN_PROVIDER [ integer, N_dress_double_buffer ] +&BEGIN_PROVIDER [ integer, N_dress_det_buffer ] + implicit none + N_dress_int_buffer = 1 + N_dress_double_buffer = 1 + N_dress_det_buffer = 1 +END_PROVIDER + + + +subroutine delta_ij_done() + BEGIN_DOC + ! This subroutine is executed on the master when the dressing has been computed, + ! before the diagonalization. + END_DOC +end + +subroutine dress_pulled(ind, int_buf, double_buf, det_buf, N_buf) + use bitmasks + implicit none + BEGIN_DOC + ! Dress the contributions pulled from the slave. + END_DOC + + integer, intent(in) :: ind, N_buf(3) + integer, intent(in) :: int_buf(*) + double precision, intent(in) :: double_buf(*) + integer(bit_kind), intent(in) :: det_buf(N_int,2,*) +end + +subroutine generator_start(i_gen, iproc) + implicit none + BEGIN_DOC + ! This subroutine is executed on the slave before computing the contribution of a generator. + END_DOC + + integer, intent(in) :: i_gen, iproc + integer :: i +end + +subroutine generator_done(i_gen, int_buf, double_buf, det_buf, N_buf, iproc) + implicit none + BEGIN_DOC + ! This subroutine is executed on the slave after computing the contribution of a generator. + END_DOC + integer, intent(in) :: i_gen, iproc + integer, intent(out) :: int_buf(N_dress_int_buffer), N_buf(3) + double precision, intent(out) :: double_buf(N_dress_double_buffer) + integer(bit_kind), intent(out) :: det_buf(N_int, 2, N_dress_det_buffer) + N_buf(:) = 1 + int_buf(:) = 0 + double_buf(:) = 0.d0 + det_buf(:,:,:) = 0 +end + + + From 6ba232251c834433071304aa8dc65254661f73f7 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 27 Jun 2018 15:42:44 +0200 Subject: [PATCH 63/96] EZFIO file in Bk --- ocaml/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ocaml/Makefile b/ocaml/Makefile index a49304e6..3a3d3411 100644 --- a/ocaml/Makefile +++ b/ocaml/Makefile @@ -12,7 +12,7 @@ endif LIBS= PKGS= OCAMLCFLAGS="-g" -OCAMLOPTFLAGS="opt -O3 -nodynlink -remove-unused-arguments -rounds 16 -inline 100 -inline-max-unroll 100" +OCAMLOPTFLAGS="opt -O3 -remove-unused-arguments -rounds 16 -inline 100 -inline-max-unroll 100" OCAMLBUILD=ocamlbuild -j 0 -cflags $(OCAMLCFLAGS) -lflags $(OCAMLCFLAGS) -ocamlopt $(OCAMLOPTFLAGS) MLLFILES=$(wildcard *.mll) MLFILES=$(wildcard *.ml) ezfio.ml Qptypes.ml Input_auto_generated.ml qp_edit.ml From 7246641fcef2b8e13464f0233952d992557183f1 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 27 Jun 2018 15:54:59 +0200 Subject: [PATCH 64/96] type mismatch --- plugins/Full_CI_ZMQ/run_selection_slave.irp.f | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/Full_CI_ZMQ/run_selection_slave.irp.f b/plugins/Full_CI_ZMQ/run_selection_slave.irp.f index 09f7974c..39f6c01c 100644 --- a/plugins/Full_CI_ZMQ/run_selection_slave.irp.f +++ b/plugins/Full_CI_ZMQ/run_selection_slave.irp.f @@ -1,4 +1,7 @@ subroutine run_selection_slave(thread,iproc,energy) + implicit none + integer, intent(in) :: thread, iproc + double precision, intent(in) :: energy(N_states_diag) call run_selection_slave_new(thread,iproc,energy) end @@ -7,8 +10,8 @@ subroutine run_selection_slave_new(thread,iproc,energy) use selection_types implicit none - double precision, intent(in) :: energy(N_states_diag) integer, intent(in) :: thread, iproc + double precision, intent(in) :: energy(N_states_diag) integer :: rc, i, N logical :: buffer_ready From 724cab95f4e2836485dfa076e4e88ec525feb780 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 27 Jun 2018 16:31:48 +0200 Subject: [PATCH 65/96] Fixed bound --- plugins/mrcepa0/mrcc_stoch_routines.irp.f | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mrcepa0/mrcc_stoch_routines.irp.f b/plugins/mrcepa0/mrcc_stoch_routines.irp.f index abf2734d..edf73e1e 100644 --- a/plugins/mrcepa0/mrcc_stoch_routines.irp.f +++ b/plugins/mrcepa0/mrcc_stoch_routines.irp.f @@ -561,7 +561,7 @@ subroutine add_comb(com, computed, cp, N, tbc) implicit none double precision, intent(in) :: com integer, intent(inout) :: N - double precision, intent(inout) :: cp(N_det_non_ref) + double precision, intent(inout) :: cp(N_det_generators) logical, intent(inout) :: computed(N_det_generators) integer, intent(inout) :: tbc(N_det_generators) integer :: i, k, l, dets(comb_teeth) From 39913c03fdd61f0d871897ded05b98902414b6be Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 27 Jun 2018 16:32:41 +0200 Subject: [PATCH 66/96] EZFIO --- plugins/shiftedbk/EZFIO.cfg | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/shiftedbk/EZFIO.cfg b/plugins/shiftedbk/EZFIO.cfg index c594bcf8..576bf1e4 100644 --- a/plugins/shiftedbk/EZFIO.cfg +++ b/plugins/shiftedbk/EZFIO.cfg @@ -3,6 +3,11 @@ type: double precision doc: Calculated energy interface: ezfio +[energy_pt2] +type: double precision +doc: Calculated energy with pt2 contribution +interface: ezfio + [thresh_dressed_ci] type: Threshold doc: Threshold on the convergence of the dressed CI energy From 5627445e6f1ad0792ee936a4013d106566e2b53d Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 28 Jun 2018 10:38:57 +0200 Subject: [PATCH 67/96] Removed rmcc_zmq from tests --- plugins/Full_CI_ZMQ/run_pt2_slave.irp.f | 18 +++--- plugins/mrcepa0/mrcc_stoch_routines.irp.f | 17 ++++-- src/ZMQ/utils.irp.f | 4 +- tests/bats/mrcepa0.bats | 68 +++++++++++------------ 4 files changed, 57 insertions(+), 50 deletions(-) diff --git a/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f b/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f index 8ffe502c..cd780ad9 100644 --- a/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f +++ b/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f @@ -46,8 +46,8 @@ subroutine run_pt2_slave(thread,iproc,energy) done = .False. do while (.not.done) - n_tasks = max(1,n_tasks) - n_tasks = min(n_tasks,n_tasks_max) +! n_tasks = max(1,n_tasks) +! n_tasks = min(n_tasks,n_tasks_max) integer, external :: get_tasks_from_taskserver if (get_tasks_from_taskserver(zmq_to_qp_run_socket,worker_id, task_id, task, n_tasks) == -1) then @@ -61,24 +61,24 @@ subroutine run_pt2_slave(thread,iproc,energy) read (task(k),*) subset(k), i_generator(k) enddo -! double precision :: time0, time1 -! call wall_time(time0) + double precision :: time0, time1 + call wall_time(time0) do k=1,n_tasks pt2(:,k) = 0.d0 buf%cur = 0 call select_connected(i_generator(k),energy,pt2(1,k),buf,subset(k)) enddo -! call wall_time(time1) -! + call wall_time(time1) + integer, external :: tasks_done_to_taskserver if (tasks_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id,n_tasks) == -1) then done = .true. endif call push_pt2_results(zmq_socket_push, i_generator, pt2, task_id, n_tasks) -! ! Try to adjust n_tasks around 5 second per job -! n_tasks = min(n_tasks,int( 5.d0*dble(n_tasks) / (time1 - time0 + 1.d-9)))+1 - n_tasks = n_tasks+1 + ! Try to adjust n_tasks around 1 second per job + n_tasks = min(n_tasks,int( 1.d0*dble(n_tasks) / (time1 - time0 + 1.d-9)))+1 +! n_tasks = n_tasks+1 end do integer, external :: disconnect_from_taskserver diff --git a/plugins/mrcepa0/mrcc_stoch_routines.irp.f b/plugins/mrcepa0/mrcc_stoch_routines.irp.f index edf73e1e..24068bec 100644 --- a/plugins/mrcepa0/mrcc_stoch_routines.irp.f +++ b/plugins/mrcepa0/mrcc_stoch_routines.irp.f @@ -400,12 +400,13 @@ end function &BEGIN_PROVIDER [ integer, comb_teeth ] &BEGIN_PROVIDER [ integer, N_cps_max ] implicit none + integer :: comb_per_cp comb_teeth = 16 - N_cps_max = 128 - !comb_per_cp = 64 + N_cps_max = 64 +! comb_per_cp = 64 gen_per_cp = (N_det_generators / N_cps_max) + 1 - N_cps_max += 1 - !N_cps_max = N_det_generators / comb_per_cp + 1 +! N_cps_max += 1 + N_cps_max = N_det_generators / gen_per_cp + 1 END_PROVIDER @@ -525,6 +526,11 @@ subroutine get_comb_val(stato, detail, cur_cp, val) val = 0d0 first = cp_first_tooth(cur_cp) + !TODO : check + if (first == 0) then + return + endif + do j = comb_teeth, first, -1 !DIR$ FORCEINLINE k = mrcc_find(curs, mrcc_cweight,size(mrcc_cweight), first_det_of_teeth(j), first_det_of_teeth(j+1)) @@ -590,7 +596,7 @@ end subroutine &BEGIN_PROVIDER [ double precision, mrcc_cweight_cache, (N_det_generators) ] &BEGIN_PROVIDER [ double precision, fractage, (comb_teeth) ] &BEGIN_PROVIDER [ double precision, comb_step ] -&BEGIN_PROVIDER [ integer, first_det_of_teeth, (comb_teeth+1) ] +&BEGIN_PROVIDER [ integer, first_det_of_teeth, (0:comb_teeth+1) ] &BEGIN_PROVIDER [ integer, first_det_of_comb ] &BEGIN_PROVIDER [ integer, tooth_of_det, (N_det_generators) ] implicit none @@ -649,6 +655,7 @@ end subroutine end do first_det_of_teeth(comb_teeth+1) = N_det_generators + 1 first_det_of_teeth(1) = first_det_of_comb + first_det_of_teeth(0) = 1 if(first_det_of_teeth(1) /= first_det_of_comb) then diff --git a/src/ZMQ/utils.irp.f b/src/ZMQ/utils.irp.f index 1f775413..3fbc842b 100644 --- a/src/ZMQ/utils.irp.f +++ b/src/ZMQ/utils.irp.f @@ -246,7 +246,7 @@ IRP_ENDIF ! stop 'Unable to set ZMQ_RCVBUF on pull socket' ! endif - rc = f77_zmq_setsockopt(new_zmq_pull_socket,ZMQ_RCVHWM,nproc,4) + rc = f77_zmq_setsockopt(new_zmq_pull_socket,ZMQ_RCVHWM,2,4) if (rc /= 0) then stop 'Unable to set ZMQ_RCVHWM on pull socket' endif @@ -323,7 +323,7 @@ IRP_ENDIF stop 'Unable to set ZMQ_LINGER on push socket' endif - rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_SNDHWM,5,4) + rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_SNDHWM,2,4) if (rc /= 0) then stop 'Unable to set ZMQ_SNDHWM on push socket' endif diff --git a/tests/bats/mrcepa0.bats b/tests/bats/mrcepa0.bats index 879a85e1..e2025752 100644 --- a/tests/bats/mrcepa0.bats +++ b/tests/bats/mrcepa0.bats @@ -21,23 +21,23 @@ source $QP_ROOT/tests/bats/common.bats.sh 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-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" { INPUT=h2o.ezfio @@ -57,23 +57,23 @@ source $QP_ROOT/tests/bats/common.bats.sh 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 "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" { INPUT=h2o.ezfio From e89242ce97c603f4432ae979d6f89d69e28e2a22 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 2 Jul 2018 13:58:22 +0200 Subject: [PATCH 68/96] Set HWM to 1 --- src/ZMQ/utils.irp.f | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ZMQ/utils.irp.f b/src/ZMQ/utils.irp.f index 3fbc842b..a77f974a 100644 --- a/src/ZMQ/utils.irp.f +++ b/src/ZMQ/utils.irp.f @@ -246,7 +246,7 @@ IRP_ENDIF ! stop 'Unable to set ZMQ_RCVBUF on pull socket' ! endif - rc = f77_zmq_setsockopt(new_zmq_pull_socket,ZMQ_RCVHWM,2,4) + rc = f77_zmq_setsockopt(new_zmq_pull_socket,ZMQ_RCVHWM,1,4) if (rc /= 0) then stop 'Unable to set ZMQ_RCVHWM on pull socket' endif @@ -323,7 +323,7 @@ IRP_ENDIF stop 'Unable to set ZMQ_LINGER on push socket' endif - rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_SNDHWM,2,4) + rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_SNDHWM,1,4) if (rc /= 0) then stop 'Unable to set ZMQ_SNDHWM on push socket' endif From 348a6f9f6964eaee2c3a82162f86cfc77f726c9d Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 2 Jul 2018 14:29:35 +0200 Subject: [PATCH 69/96] Fixed travis --- plugins/Full_CI_ZMQ/run_pt2_slave.irp.f | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f b/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f index cd780ad9..6be25846 100644 --- a/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f +++ b/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f @@ -46,8 +46,8 @@ subroutine run_pt2_slave(thread,iproc,energy) done = .False. do while (.not.done) -! n_tasks = max(1,n_tasks) -! n_tasks = min(n_tasks,n_tasks_max) + n_tasks = max(1,n_tasks) + n_tasks = min(n_tasks,n_tasks_max) integer, external :: get_tasks_from_taskserver if (get_tasks_from_taskserver(zmq_to_qp_run_socket,worker_id, task_id, task, n_tasks) == -1) then From a10f439468464719e3298834c1b2a42083aebafd Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 2 Jul 2018 18:00:48 +0200 Subject: [PATCH 70/96] Fixed pseudos with GAMESS interface --- .../qp_convert_output_to_ezfio.py | 209 ++++++------------ 1 file changed, 62 insertions(+), 147 deletions(-) diff --git a/scripts/ezfio_interface/qp_convert_output_to_ezfio.py b/scripts/ezfio_interface/qp_convert_output_to_ezfio.py index 8d24ad85..77a62f0f 100755 --- a/scripts/ezfio_interface/qp_convert_output_to_ezfio.py +++ b/scripts/ezfio_interface/qp_convert_output_to_ezfio.py @@ -263,160 +263,75 @@ def write_ezfio(res, filename): ezfio.set_mo_basis_mo_occ(OccNum) ezfio.set_mo_basis_mo_coef(MoMatrix) - # ______ _ - # | ___ \ | | - # | |_/ /__ ___ _ _ __| | ___ - # | __/ __|/ _ \ | | |/ _` |/ _ \ - # | | \__ \ __/ |_| | (_| | (_) | - # \_| |___/\___|\__,_|\__,_|\___/ - # - - # INPUT - # {% for label,zcore, l_block in l_atom $} - # #local l_block l=0} - # {label} GEN {zcore} {len(l_block)-1 #lmax_block} - # {% for l_param in l_block%} - # {len(l_param) # list of parameter aka n_max_bock_max(n)} - # {% for coef,n,zeta for l_param} - # {coef,n, zeta} - - - # OUTPUT - - # Local are 1 array padded by max(n_max_block) when l == 0 (output:k_loc_max) - # v_k[n-2][atom] = value - - #Non Local are 2 array padded with max of lmax_block when l!=0 (output:lmax+1) and max(n_max_block)whem l !=0 (kmax) - # v_kl[l][n-2][atom] = value - - def pad(array, size, value=0): - new_array = array - for add in xrange(len(array), size): - new_array.append(value) - - return new_array - - def parse_str(pseudo_str): - '''Return 4d array atom,l,n, attribute (attribute is coef, n, zeta)''' - matrix = [] - array_l_max_block = [] - array_z_remove = [] - - for block in [b for b in pseudo_str.split('\n\n') if b]: - #First element is header, the rest are l_param - array_party = [i for i in re.split(r"\n\d+\n", block) if i] - - z_remove, l_max_block = map(int, array_party[0].split()[-2:]) - array_l_max_block.append(l_max_block) - array_z_remove.append(z_remove) - - x = [] - for l in array_party[1:]: - y = [] - for coef_n_zeta in l.split('\n'): - z = coef_n_zeta.split() - if z : y.append(z) - x.append(y) - matrix.append(x) - return (matrix, array_l_max_block, array_z_remove) - - def get_local_stuff(matrix): - - matrix_local_unpad = [atom[0] for atom in matrix] - k_loc_max = max(len(i) for i in matrix_local_unpad) - - matrix_local = [ pad(ll, k_loc_max, [0., 2, 0.]) for ll in matrix_local_unpad] - m_coef = [[float(i[0]) for i in atom] for atom in matrix_local] - m_n = [[int(i[1]) - 2 for i in atom] for atom in matrix_local] - m_zeta = [[float(i[2]) for i in atom] for atom in matrix_local] - return (k_loc_max, m_coef, m_n, m_zeta) - - def get_non_local_stuff(matrix): - - matrix_unlocal_unpad = [atom[1:] for atom in matrix] - l_max_block = max(len(i) for i in matrix_unlocal_unpad) - k_max = max([len(item) for row in matrix_unlocal_unpad for item in row]) - - - matrix_unlocal_semipaded = [[pad(item, k_max, [0., 2, 0.]) for item in row] for row in matrix_unlocal_unpad] - - empty_row = [[0., 2, 0.] for k in range(l_max_block)] - matrix_unlocal = [ pad(ll, l_max_block, empty_row) for ll in matrix_unlocal_semipaded ] - - m_coef_noloc = [[[float(k[0]) for k in j] for j in i] for i in matrix_unlocal] - m_n_noloc = [[[int(k[1]) - 2 for k in j] for j in i] for i in matrix_unlocal] - m_zeta_noloc = [[[float(k[2]) for k in j] for j in i] for i in matrix_unlocal] - - return (l_max_block, k_max, m_coef_noloc, m_n_noloc, m_zeta_noloc) - try: - pseudo_str = [] - label = ezfio.get_nuclei_nucl_label() + lmax = 0 + nucl_charge_remove = [] + klocmax = 0 + kmax = 0 + nucl_num = len(res.geometry) for ecp in res.pseudo: - pseudo_str += [ "%(label)s GEN %(zcore)d %(lmax)d" % { "label": label[ ecp["atom"]-1 ], - "zcore": ecp["zcore"], "lmax": ecp["lmax"] } ] - lmax = ecp["lmax"] - for l in [lmax] + list(range(0,lmax)): - pseudo_str += [ "%d"%len(ecp[str(l)]) ] - for t in ecp[str(l)]: - pseudo_str += [ "%f %d %f"%t ] - pseudo_str += [""] - pseudo_str = "\n".join(pseudo_str) - - matrix, array_l_max_block, array_z_remove = parse_str(pseudo_str) - array_z_remove = map(float,array_z_remove) + lmax_local = ecp['lmax'] + lmax = max(lmax_local,lmax) + nucl_charge_remove.append(ecp['zcore']) + klocmax = max(klocmax, len(ecp[str(lmax_local)])) + for l in range(lmax_local): + kmax = max(kmax,len(ecp[str(l)])) + lmax = lmax-1 + ezfio.set_pseudo_pseudo_lmax(lmax) + ezfio.set_pseudo_nucl_charge_remove(nucl_charge_remove) + ezfio.set_pseudo_pseudo_klocmax(klocmax) + ezfio.set_pseudo_pseudo_kmax(kmax) + pseudo_n_k = [ [ 0 for _ in range(nucl_num) ] for _ in range(klocmax) ] + pseudo_v_k = [ [ 0. for _ in range(nucl_num) ] for _ in range(klocmax) ] + pseudo_dz_k = [ [ 0. for _ in range(nucl_num) ] for _ in range(klocmax) ] + pseudo_n_kl = [ [ [ 0 for _ in range(nucl_num) ] for _ in range(kmax) ] for _ in range(lmax+1) ] + pseudo_v_kl = [ [ [ 0. for _ in range(nucl_num) ] for _ in range(kmax) ] for _ in range(lmax+1) ] + pseudo_dz_kl = [ [ [ 0. for _ in range(nucl_num) ] for _ in range(kmax) ] for _ in range(lmax+1) ] + for ecp in res.pseudo: + lmax_local = ecp['lmax'] + klocmax = len(ecp[str(lmax_local)]) + atom = ecp['atom']-1 + for kloc in range(klocmax): + try: + v, n, dz = ecp[str(lmax_local)][kloc] + pseudo_n_k[kloc][atom] = n-2 + pseudo_v_k[kloc][atom] = v + pseudo_dz_k[kloc][atom] = dz + except: + pass + for l in range(lmax_local): + for k in range(kmax): + try: + v, n, dz = ecp[str(l)][k] + pseudo_n_kl[l][k][atom] = n-2 + pseudo_v_kl[l][k][atom] = v + pseudo_dz_kl[l][k][atom] = dz + except: + pass + ezfio.set_pseudo_pseudo_n_k(pseudo_n_k) + ezfio.set_pseudo_pseudo_v_k(pseudo_v_k) + ezfio.set_pseudo_pseudo_dz_k(pseudo_dz_k) + ezfio.set_pseudo_pseudo_n_kl(pseudo_n_kl) + ezfio.set_pseudo_pseudo_v_kl(pseudo_v_kl) + ezfio.set_pseudo_pseudo_dz_kl(pseudo_dz_kl) + + n_alpha = res.num_alpha + n_beta = res.num_beta + for i in range(nucl_num): + charge[i] -= nucl_charge_remove[i] + n_alpha -= nucl_charge_remove[i]/2 + n_beta -= nucl_charge_remove[i]/2 + ezfio.set_nuclei_nucl_charge(charge) + ezfio.set_electrons_elec_alpha_num(n_alpha) + ezfio.set_electrons_elec_beta_num(n_beta) + except: + raise ezfio.set_pseudo_do_pseudo(False) else: ezfio.set_pseudo_do_pseudo(True) + - # ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ # - # Z _ e f f , a l p h a / b e t a _ e l e c # - # ~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~ # - - ezfio.set_pseudo_nucl_charge_remove(array_z_remove) - charge = ezfio.get_nuclei_nucl_charge() - charge = [ i - j for i, j in zip(charge, array_z_remove) ] - ezfio.set_nuclei_nucl_charge (charge) - - import math - num_elec_diff = sum(array_z_remove)/2 - nalpha = ezfio.get_electrons_elec_alpha_num() - num_elec_diff - nbeta = ezfio.get_electrons_elec_beta_num() - num_elec_diff - - ezfio.set_electrons_elec_alpha_num(nalpha) - ezfio.set_electrons_elec_beta_num( nbeta ) - - # Change all the array 'cause EZFIO - # v_kl (v, l) => v_kl(l,v) - # v_kl => zip(*_v_kl) - # [[7.0, 79.74474797, -49.45159098], [1.0, 5.41040609, -4.60151975]] - # [(7.0, 1.0), (79.74474797, 5.41040609), (-49.45159098, -4.60151975)] - - # ~#~#~#~#~ # - # L o c a l # - # ~#~#~#~#~ # - - klocmax, m_coef, m_n, m_zeta = get_local_stuff(matrix) - ezfio.pseudo_pseudo_klocmax = klocmax - - ezfio.pseudo_pseudo_v_k = zip(*m_coef) - ezfio.pseudo_pseudo_n_k = zip(*m_n) - ezfio.pseudo_pseudo_dz_k = zip(*m_zeta) - - # ~#~#~#~#~#~#~#~#~ # - # N o n _ L o c a l # - # ~#~#~#~#~#~#~#~#~ # - - l_max_block, k_max, m_coef_noloc, m_n_noloc, m_zeta_noloc = get_non_local_stuff( - matrix) - - ezfio.pseudo_pseudo_lmax = l_max_block - 1 - ezfio.pseudo_pseudo_kmax = k_max - - ezfio.pseudo_pseudo_v_kl = zip(*m_coef_noloc) - ezfio.pseudo_pseudo_n_kl = zip(*m_n_noloc) - ezfio.pseudo_pseudo_dz_kl = zip(*m_zeta_noloc) def get_full_path(file_path): From 1f8e09e93fdce6927f3808b1e16613225a5eac4b Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 3 Jul 2018 14:46:02 +0200 Subject: [PATCH 71/96] FIxed GAMESS interface --- scripts/ezfio_interface/qp_convert_output_to_ezfio.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/ezfio_interface/qp_convert_output_to_ezfio.py b/scripts/ezfio_interface/qp_convert_output_to_ezfio.py index 77a62f0f..549c4691 100755 --- a/scripts/ezfio_interface/qp_convert_output_to_ezfio.py +++ b/scripts/ezfio_interface/qp_convert_output_to_ezfio.py @@ -93,6 +93,7 @@ def write_ezfio(res, filename): coord_y.append(a.coord[1] / a0) coord_z.append(a.coord[2] / a0) + # ~#~#~#~#~ # # W r i t e # # ~#~#~#~#~ # @@ -126,9 +127,6 @@ def write_ezfio(res, filename): coefficient = [] exponent = [] - res.clean_contractions() - res.convert_to_cartesian() - # ~#~#~#~#~#~#~ # # P a r s i n g # # ~#~#~#~#~#~#~ # From c2ddf7d606930c93c65e87d4a6dcc1aa01ea69ce Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 3 Jul 2018 14:49:23 +0200 Subject: [PATCH 72/96] Updated PT2Stoch --- plugins/Full_CI_ZMQ/pt2_stoch.irp.f | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Full_CI_ZMQ/pt2_stoch.irp.f b/plugins/Full_CI_ZMQ/pt2_stoch.irp.f index 204498af..7cd1cea7 100644 --- a/plugins/Full_CI_ZMQ/pt2_stoch.irp.f +++ b/plugins/Full_CI_ZMQ/pt2_stoch.irp.f @@ -3,6 +3,7 @@ program pt2_stoch read_wf = .True. SOFT_TOUCH read_wf PROVIDE mo_bielec_integrals_in_map + PROVIDE psi_energy call run end @@ -19,7 +20,6 @@ subroutine run double precision :: E_CI_before, relative_error, absolute_error, eqt allocate (pt2(N_states)) -! call diagonalize_CI() pt2(:) = 0.d0 E_CI_before = psi_energy(1) + nuclear_repulsion From e68bd1f98a61c214f2a1b1913c3bdd98baa08509 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 3 Jul 2018 15:30:26 +0200 Subject: [PATCH 73/96] Added 1/c0^2 weight in selection --- plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f | 6 ++++ src/Determinants/EZFIO.cfg | 8 ++--- src/Determinants/density_matrix.irp.f | 34 ++++++++++++++++++-- 3 files changed, 41 insertions(+), 7 deletions(-) diff --git a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f index 95759730..4d92e304 100644 --- a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f +++ b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f @@ -366,6 +366,12 @@ subroutine pt2_collector(zmq_socket_pull, E, b, tbc, comb, Ncomb, computed, pt2_ end if end do pullLoop + if (zmq_abort(zmq_to_qp_run_socket) == -1) then + call sleep(1) + if (zmq_abort(zmq_to_qp_run_socket) == -1) then + print *, irp_here, ': Error in sending abort signal (2)' + endif + endif if(tooth == comb_teeth+1) then pt2(pt2_stoch_istate) = sum(pt2_detail(pt2_stoch_istate,:)) diff --git a/src/Determinants/EZFIO.cfg b/src/Determinants/EZFIO.cfg index d55dd612..ecf3dd88 100644 --- a/src/Determinants/EZFIO.cfg +++ b/src/Determinants/EZFIO.cfg @@ -40,11 +40,11 @@ doc: Force the wave function to be an eigenfunction of S^2 interface: ezfio,provider,ocaml default: True -[use_l3_weight] -type: logical -doc: If true, set the state-averaged weight to 1/(Norm_L3(Psi)) +[used_weight] +type: integer +doc: 0: 1/(c_0^2), 1: 1/N_states, 2: input state-average weight, 3: 1/(Norm_L3(Psi)) interface: ezfio,provider,ocaml -default: False +default: 0 [threshold_generators] diff --git a/src/Determinants/density_matrix.irp.f b/src/Determinants/density_matrix.irp.f index ea32ece4..c7afebc6 100644 --- a/src/Determinants/density_matrix.irp.f +++ b/src/Determinants/density_matrix.irp.f @@ -365,7 +365,7 @@ end BEGIN_PROVIDER [ double precision, l3_weight, (N_states) ] implicit none BEGIN_DOC - ! Weight of the states in the selection : 1/(sum_i c_i^4) + ! Weight of the states in the selection : 1/(sum_i |c_i|^3) END_DOC integer :: i,k double precision :: c @@ -388,6 +388,30 @@ BEGIN_PROVIDER [ double precision, l3_weight, (N_states) ] END_PROVIDER +BEGIN_PROVIDER [ double precision, c0_weight, (N_states) ] + implicit none + BEGIN_DOC + ! Weight of the states in the selection : 1/c_0^2 + END_DOC + integer :: i,k + double precision :: c + do i=1,N_states + c0_weight(i) = 1.d-31 + c = maxval(psi_coef(:,i) * psi_coef(:,i)) + c0_weight(i) = 1.d0/c + c0_weight(i) = min(c0_weight(i), 100.d0) + enddo + if (mpi_master) then + print *, '' + print *, 'c0 weights' + print *, '----------' + print *, '' + print *, c0_weight(1:N_states) + print *, '' + endif + +END_PROVIDER + BEGIN_PROVIDER [ double precision, state_average_weight, (N_states) ] implicit none @@ -397,8 +421,12 @@ BEGIN_PROVIDER [ double precision, state_average_weight, (N_states) ] logical :: exists state_average_weight(:) = 1.d0 - if (use_l3_weight) then - state_average_weight(:) = l3_weight(:) + if (used_weight == 0) then + state_average_weight(:) = c0_weight(:) + else if (used_weight == 1) then + state_average_weight(:) = 1./N_states + else if (used_weight == 3) then + state_average_weight(:) = l3_weight else call ezfio_has_determinants_state_average_weight(exists) if (exists) then From 5a9b3a3f51fdfa49cc3d385162c4902cce2866d4 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 3 Jul 2018 15:37:05 +0200 Subject: [PATCH 74/96] Fixed GAMESS interface --- scripts/ezfio_interface/qp_convert_output_to_ezfio.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/ezfio_interface/qp_convert_output_to_ezfio.py b/scripts/ezfio_interface/qp_convert_output_to_ezfio.py index 549c4691..4d215f7f 100755 --- a/scripts/ezfio_interface/qp_convert_output_to_ezfio.py +++ b/scripts/ezfio_interface/qp_convert_output_to_ezfio.py @@ -324,7 +324,6 @@ def write_ezfio(res, filename): ezfio.set_electrons_elec_beta_num(n_beta) except: - raise ezfio.set_pseudo_do_pseudo(False) else: ezfio.set_pseudo_do_pseudo(True) From 1453c4670078e53cc9c45a3cb0348b0b533bb05e Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 3 Jul 2018 15:39:08 +0200 Subject: [PATCH 75/96] Fixed PT2 in FCI_ZMQ --- plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f | 9 +-------- src/ZMQ/utils.irp.f | 4 ++-- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f index 4d92e304..2f85cc00 100644 --- a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f +++ b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f @@ -332,7 +332,7 @@ subroutine pt2_collector(zmq_socket_pull, E, b, tbc, comb, Ncomb, computed, pt2_ print *, irp_here, ': Error in sending abort signal (1)' endif endif - exit pullLoop +! exit pullLoop endif E0 = sum(pt2_detail(pt2_stoch_istate,:first_det_of_teeth(tooth)-1)) @@ -366,13 +366,6 @@ subroutine pt2_collector(zmq_socket_pull, E, b, tbc, comb, Ncomb, computed, pt2_ end if end do pullLoop - if (zmq_abort(zmq_to_qp_run_socket) == -1) then - call sleep(1) - if (zmq_abort(zmq_to_qp_run_socket) == -1) then - print *, irp_here, ': Error in sending abort signal (2)' - endif - endif - if(tooth == comb_teeth+1) then pt2(pt2_stoch_istate) = sum(pt2_detail(pt2_stoch_istate,:)) error(pt2_stoch_istate) = 0d0 diff --git a/src/ZMQ/utils.irp.f b/src/ZMQ/utils.irp.f index a77f974a..3fbc842b 100644 --- a/src/ZMQ/utils.irp.f +++ b/src/ZMQ/utils.irp.f @@ -246,7 +246,7 @@ IRP_ENDIF ! stop 'Unable to set ZMQ_RCVBUF on pull socket' ! endif - rc = f77_zmq_setsockopt(new_zmq_pull_socket,ZMQ_RCVHWM,1,4) + rc = f77_zmq_setsockopt(new_zmq_pull_socket,ZMQ_RCVHWM,2,4) if (rc /= 0) then stop 'Unable to set ZMQ_RCVHWM on pull socket' endif @@ -323,7 +323,7 @@ IRP_ENDIF stop 'Unable to set ZMQ_LINGER on push socket' endif - rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_SNDHWM,1,4) + rc = f77_zmq_setsockopt(new_zmq_push_socket,ZMQ_SNDHWM,2,4) if (rc /= 0) then stop 'Unable to set ZMQ_SNDHWM on push socket' endif From 5753d340c80aedc66a3adbcb3ba318abe7a1e3b0 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 3 Jul 2018 16:22:07 +0200 Subject: [PATCH 76/96] Restored convert_to_cartesian in resultsFile --- scripts/ezfio_interface/qp_convert_output_to_ezfio.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/ezfio_interface/qp_convert_output_to_ezfio.py b/scripts/ezfio_interface/qp_convert_output_to_ezfio.py index 4d215f7f..3c515485 100755 --- a/scripts/ezfio_interface/qp_convert_output_to_ezfio.py +++ b/scripts/ezfio_interface/qp_convert_output_to_ezfio.py @@ -127,6 +127,7 @@ def write_ezfio(res, filename): coefficient = [] exponent = [] + res.convert_to_cartesian() # ~#~#~#~#~#~#~ # # P a r s i n g # # ~#~#~#~#~#~#~ # From 9d51395d8de29cea8f3f8e0ccd288347700b661b Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 17 Jul 2018 14:05:23 +0200 Subject: [PATCH 77/96] Update ZMQ and fix sBk --- configure | 2 +- install/scripts/install_zeromq.sh | 3 ++- plugins/shiftedbk/NEEDED_CHILDREN_MODULES | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 346d9804..b034f570 100755 --- a/configure +++ b/configure @@ -138,7 +138,7 @@ ezfio = Info( default_path=join(QP_ROOT_INSTALL, "EZFIO")) zeromq = Info( - url='https://github.com/zeromq/zeromq4-1/releases/download/v4.1.5/zeromq-4.1.5.tar.gz', + url='https://github.com/zeromq/libzmq/archive/v4.2.5.tar.gz' description=' ZeroMQ', default_path=join(QP_ROOT_LIB, "libzmq.a")) diff --git a/install/scripts/install_zeromq.sh b/install/scripts/install_zeromq.sh index f6596f9c..cd834672 100755 --- a/install/scripts/install_zeromq.sh +++ b/install/scripts/install_zeromq.sh @@ -11,7 +11,8 @@ function _install() set -u ORIG=$(pwd) cd "${BUILD}" - ./configure --prefix=$QP_ROOT --without-libsodium || exit 1 + ./autogen.sh + ./configure --prefix=$QP_ROOT --without-libsodium --disable-libunwind || exit 1 make -j 8 || exit 1 make install || exit 1 cd ${ORIG} diff --git a/plugins/shiftedbk/NEEDED_CHILDREN_MODULES b/plugins/shiftedbk/NEEDED_CHILDREN_MODULES index 0a06e986..4f09bfc8 100644 --- a/plugins/shiftedbk/NEEDED_CHILDREN_MODULES +++ b/plugins/shiftedbk/NEEDED_CHILDREN_MODULES @@ -1 +1 @@ -dress_zmq DavidsonDressed Selectors_full Generators_CAS +dress_zmq DavidsonDressed Selectors_full Generators_full From 6c1040c766709d30e3ba8357f3cbab5ffd4d385c Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 17 Jul 2018 14:42:15 +0200 Subject: [PATCH 78/96] Added 6-31g+ --- data/basis/6-31+g | 635 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 635 insertions(+) create mode 100644 data/basis/6-31+g diff --git a/data/basis/6-31+g b/data/basis/6-31+g new file mode 100644 index 00000000..0b89d6e3 --- /dev/null +++ b/data/basis/6-31+g @@ -0,0 +1,635 @@ +$DATA +HYDROGEN +S 3 + 1 18.7311370 0.03349460 + 2 2.8253937 0.23472695 + 3 0.6401217 0.81375733 +S 1 + 1 0.1612778 1.0000000 + +HELIUM +S 3 + 1 38.4216340 0.0237660 + 2 5.7780300 0.1546790 + 3 1.2417740 0.4696300 +S 1 + 1 0.2979640 1.0000000 + +LITHIUM +S 6 + 1 642.4189200 0.0021426 + 2 96.7985150 0.0162089 + 3 22.0911210 0.0773156 + 4 6.2010703 0.2457860 + 5 1.9351177 0.4701890 + 6 0.6367358 0.3454708 +S 3 + 1 2.3249184 -0.0350917 + 2 0.6324306 -0.1912328 + 3 0.0790534 1.0839878 +P 3 + 1 2.3249184 0.0089415 + 2 0.6324306 0.1410095 + 3 0.0790534 0.9453637 +S 1 + 1 0.0359620 1.0000000 +P 1 + 1 0.0359620 1.0000000 +S 1 + 1 0.0074000 1.0000000 +P 1 + 1 0.0074000 1.0000000 + +BERYLLIUM +S 6 + 1 1264.5857000 0.0019448 + 2 189.9368100 0.0148351 + 3 43.1590890 0.0720906 + 4 12.0986630 0.2371542 + 5 3.8063232 0.4691987 + 6 1.2728903 0.3565202 +S 3 + 1 3.1964631 -0.1126487 + 2 0.7478133 -0.2295064 + 3 0.2199663 1.1869167 +P 3 + 1 3.1964631 0.0559802 + 2 0.7478133 0.2615506 + 3 0.2199663 0.7939723 +S 1 + 1 0.0823099 1.0000000 +P 1 + 1 0.0823099 1.0000000 +S 1 + 1 0.0207000 1.0000000 +P 1 + 1 0.0207000 1.0000000 + +BORON +S 6 + 1 2068.8823000 0.0018663 + 2 310.6495700 0.0142515 + 3 70.6830330 0.0695516 + 4 19.8610800 0.2325729 + 5 6.2993048 0.4670787 + 6 2.1270270 0.3634314 +S 3 + 1 4.7279710 -0.1303938 + 2 1.1903377 -0.1307889 + 3 0.3594117 1.1309444 +P 3 + 1 4.7279710 0.0745976 + 2 1.1903377 0.3078467 + 3 0.3594117 0.7434568 +S 1 + 1 0.1267512 1.0000000 +P 1 + 1 0.1267512 1.0000000 +S 1 + 1 0.0315000 1.0000000 +P 1 + 1 0.0315000 1.0000000 + +CARBON +S 6 + 1 3047.5249000 0.0018347 + 2 457.3695100 0.0140373 + 3 103.9486900 0.0688426 + 4 29.2101550 0.2321844 + 5 9.2866630 0.4679413 + 6 3.1639270 0.3623120 +S 3 + 1 7.8682724 -0.1193324 + 2 1.8812885 -0.1608542 + 3 0.5442493 1.1434564 +P 3 + 1 7.8682724 0.0689991 + 2 1.8812885 0.3164240 + 3 0.5442493 0.7443083 +S 1 + 1 0.1687144 1.0000000 +P 1 + 1 0.1687144 1.0000000 +S 1 + 1 0.0438000 1.0000000 +P 1 + 1 0.0438000 1.0000000 + +NITROGEN +S 6 + 1 4173.5110000 0.0018348 + 2 627.4579000 0.0139950 + 3 142.9021000 0.0685870 + 4 40.2343300 0.2322410 + 5 12.8202100 0.4690700 + 6 4.3904370 0.3604550 +S 3 + 1 11.6263580 -0.1149610 + 2 2.7162800 -0.1691180 + 3 0.7722180 1.1458520 +P 3 + 1 11.6263580 0.0675800 + 2 2.7162800 0.3239070 + 3 0.7722180 0.7408950 +S 1 + 1 0.2120313 1.0000000 +P 1 + 1 0.2120313 1.0000000 +S 1 + 1 0.0639000 1.0000000 +P 1 + 1 0.0639000 1.0000000 + +OXYGEN +S 6 + 1 5484.6717000 0.0018311 + 2 825.2349500 0.0139501 + 3 188.0469600 0.0684451 + 4 52.9645000 0.2327143 + 5 16.8975700 0.4701930 + 6 5.7996353 0.3585209 +S 3 + 1 15.5396160 -0.1107775 + 2 3.5999336 -0.1480263 + 3 1.0137618 1.1307670 +P 3 + 1 15.5396160 0.0708743 + 2 3.5999336 0.3397528 + 3 1.0137618 0.7271586 +S 1 + 1 0.2700058 1.0000000 +P 1 + 1 0.2700058 1.0000000 +S 1 + 1 0.0845000 1.0000000 +P 1 + 1 0.0845000 1.0000000 + +FLUORINE +S 6 + 1 7001.7130900 0.0018196169 + 2 1051.3660900 0.0139160796 + 3 239.2856900 0.0684053245 + 4 67.3974453 0.233185760 + 5 21.5199573 0.471267439 + 6 7.40310130 0.356618546 +S 3 + 1 20.8479528 -0.108506975 + 2 4.80830834 -0.146451658 + 3 1.34406986 1.128688580 +P 3 + 1 20.8479528 0.0716287243 + 2 4.80830834 0.3459121030 + 3 1.34406986 0.7224699570 +S 1 + 1 0.358151393 1.0000000 +P 1 + 1 0.358151393 1.0000000 +S 1 + 1 0.1076000 1.0000000 +P 1 + 1 0.1076000 1.0000000 + +NEON +S 6 + 1 8425.8515300 0.0018843481 + 2 1268.5194000 0.0143368994 + 3 289.6214140 0.0701096233 + 4 81.8590040 0.2373732660 + 5 26.2515079 0.4730071260 + 6 9.09472051 0.3484012410 +S 3 + 1 26.5321310 -0.107118287 + 2 6.10175501 -0.146163821 + 3 1.69627153 1.127773500 +P 3 + 1 26.5321310 0.0719095885 + 2 6.10175501 0.3495133720 + 3 1.69627153 0.7199405120 +S 1 + 1 0.44581870 1.0000000 +P 1 + 1 0.44581870 1.0000000 +S 1 + 1 0.1300000 1.0000000 +P 1 + 1 0.1300000 1.0000000 + +SODIUM +S 6 + 1 9993.2000000 0.0019377 + 2 1499.8900000 0.0148070 + 3 341.9510000 0.0727060 + 4 94.6797000 0.2526290 + 5 29.7345000 0.4932420 + 6 10.0063000 0.3131690 +S 6 + 1 150.9630000 -0.0035421 + 2 35.5878000 -0.0439590 + 3 11.1683000 -0.1097521 + 4 3.9020100 0.1873980 + 5 1.3817700 0.6466990 + 6 0.4663820 0.3060580 +P 6 + 1 150.9630000 0.0050017 + 2 35.5878000 0.0355110 + 3 11.1683000 0.1428250 + 4 3.9020100 0.3386200 + 5 1.3817700 0.4515790 + 6 0.4663820 0.2732710 +S 3 + 1 0.4979660 -0.2485030 + 2 0.0843530 -0.1317040 + 3 0.0666350 1.2335200 +P 3 + 1 0.4979660 -0.0230230 + 2 0.0843530 0.9503590 + 3 0.0666350 0.0598580 +S 1 + 1 0.0259544 1.0000000 +P 1 + 1 0.0259544 1.0000000 +S 1 + 1 0.0076000 1.0000000 +P 1 + 1 0.0076000 1.0000000 + +MAGNESIUM +S 6 + 1 11722.8000000 0.0019778 + 2 1759.9300000 0.0151140 + 3 400.8460000 0.0739110 + 4 112.8070000 0.2491910 + 5 35.9997000 0.4879280 + 6 12.1828000 0.3196620 +S 6 + 1 189.1800000 -0.0032372 + 2 45.2119000 -0.0410080 + 3 14.3563000 -0.1126000 +P 6 + 1 189.1800000 0.0049281 + 2 45.2119000 0.0349890 + 3 14.3563000 0.1407250 + 4 5.1388600 0.1486330 0.3336420 + 5 1.9065200 0.6164970 0.4449400 + 6 0.7058870 0.3648290 0.2692540 +S 3 + 1 0.9293400 -0.2122900 + 2 0.2690350 -0.1079850 + 3 0.1173790 1.1758400 +P 3 + 1 0.9293400 -0.0224190 + 2 0.2690350 0.1922700 + 3 0.1173790 0.8461810 +S 1 + 1 0.0421061 1.0000000 +P 1 + 1 0.0421061 1.0000000 +S 1 + 1 0.0146000 1.0000000 +P 1 + 1 0.0146000 1.0000000 + +ALUMINUM +S 6 + 1 13983.1000000 0.00194267 + 2 2098.7500000 0.0148599 + 3 477.7050000 0.0728494 + 4 134.3600000 0.2468300 + 5 42.8709000 0.4872580 + 6 14.5189000 0.3234960 +S 6 + 1 239.6680000 -0.00292619 + 2 57.4419000 -0.0374080 + 3 18.2859000 -0.1144870 + 4 6.5991400 0.1156350 + 5 2.4904900 0.6125950 + 6 0.9445400 0.3937990 +P 6 + 1 239.6680000 0.00460285 + 2 57.4419000 0.0331990 + 3 18.2859000 0.1362820 + 4 6.5991400 0.3304760 + 5 2.4904900 0.4491460 + 6 0.9445400 0.2657040 +S 3 + 1 1.2779000 -0.2276060 + 2 0.3975900 0.00144583 + 3 0.1600950 1.0927900 +P 3 + 1 1.2779000 -0.0175130 + 2 0.3975900 0.2445330 + 3 0.1600950 0.8049340 +S 1 + 1 0.0556577 1.0000000 +P 1 + 1 0.0556577 1.0000000 +S 1 + 1 0.0318000 1.0000000 +P 1 + 1 0.0318000 1.0000000 + +SILICON +S 6 + 1 16115.9000000 0.00195948 + 2 2425.5800000 0.01492880 + 3 553.8670000 0.07284780 + 4 156.3400000 0.24613000 + 5 50.0683000 0.48591400 + 6 17.0178000 0.32500200 +S 6 + 1 292.7180000 -0.00278094 + 2 69.8731000 -0.03571460 + 3 22.3363000 -0.11498500 + 4 8.1503900 0.09356340 + 5 3.1345800 0.60301700 + 6 1.2254300 0.41895900 +P 6 + 1 292.7180000 0.00443826 + 2 69.8731000 0.03266790 + 3 22.3363000 0.13472100 + 4 8.1503900 0.32867800 + 5 3.1345800 0.44964000 + 6 1.2254300 0.26137200 +S 3 + 1 1.7273800 -0.24463000 + 2 0.5729220 0.00431572 + 3 0.2221920 1.09818000 +P 3 + 1 1.7273800 -0.01779510 + 2 0.5729220 0.25353900 + 3 0.2221920 0.80066900 +S 1 + 1 0.0778369 1.00000000 +P 1 + 1 0.0778369 1.00000000 +S 1 + 1 0.0331000 1.0000000 +P 1 + 1 0.0331000 1.0000000 + +PHOSPHOROUS +S 6 + 1 19413.3000000 0.0018516 + 2 2909.4200000 0.0142062 + 3 661.3640000 0.0699995 + 4 185.7590000 0.2400790 + 5 59.1943000 0.4847620 + 6 20.0310000 0.3352000 +S 6 + 1 339.4780000 -0.00278217 + 2 81.0101000 -0.0360499 + 3 25.8780000 -0.1166310 + 4 9.4522100 0.0968328 + 5 3.6656600 0.6144180 + 6 1.4674600 0.4037980 +P 6 + 1 339.4780000 0.00456462 + 2 81.0101000 0.03369360 + 3 25.8780000 0.13975500 + 4 9.4522100 0.33936200 + 5 3.6656600 0.45092100 + 6 1.4674600 0.23858600 +S 3 + 1 2.1562300 -0.2529230 + 2 0.7489970 0.0328517 + 3 0.2831450 1.0812500 +P 3 + 1 2.1562300 -0.01776530 + 2 0.7489970 0.27405800 + 3 0.2831450 0.78542100 +S 1 + 1 0.0998317 1.0000000 +P 1 + 1 0.0998317 1.0000000 +S 1 + 1 0.0348000 1.0000000 +P 1 + 1 0.0348000 1.0000000 + +SULFUR +S 6 + 1 21917.1000000 0.0018690 + 2 3301.4900000 0.0142300 + 3 754.1460000 0.0696960 + 4 212.7110000 0.2384870 + 5 67.9896000 0.4833070 + 6 23.0515000 0.3380740 +S 6 + 1 423.7350000 -0.0023767 + 2 100.7100000 -0.0316930 + 3 32.1599000 -0.1133170 + 4 11.8079000 0.0560900 + 5 4.6311000 0.5922550 + 6 1.8702500 0.4550060 +P 6 + 1 423.7350000 0.0040610 + 2 100.7100000 0.0306810 + 3 32.1599000 0.1304520 + 4 11.8079000 0.3272050 + 5 4.6311000 0.4528510 + 6 1.8702500 0.2560420 +S 3 + 1 2.6158400 -0.2503740 + 2 0.9221670 0.0669570 + 3 0.3412870 1.0545100 +P 3 + 1 2.6158400 -0.0145110 + 2 0.9221670 0.3102630 + 3 0.3412870 0.7544830 +S 1 + 1 0.1171670 1.0000000 +P 1 + 1 0.1171670 1.0000000 +S 1 + 1 0.0405000 1.0000000 +P 1 + 1 0.0405000 1.0000000 + +CHLORINE +S 6 + 1 25180.1000000 0.0018330 + 2 3780.3500000 0.0140340 + 3 860.4740000 0.0690970 + 4 242.1450000 0.2374520 + 5 77.3349000 0.4830340 + 6 26.2470000 0.3398560 +S 6 + 1 491.7650000 -0.0022974 + 2 116.9840000 -0.0307140 + 3 37.4153000 -0.1125280 + 4 13.7834000 0.0450160 + 5 5.4521500 0.5893530 + 6 2.2258800 0.4652060 +P 6 + 1 491.7650000 0.0039894 + 2 116.9840000 0.0303180 + 3 37.4153000 0.1298800 + 4 13.7834000 0.3279510 + 5 5.4521500 0.4535270 + 6 2.2258800 0.2521540 +S 3 + 1 3.1864900 -0.2518300 + 2 1.1442700 0.0615890 + 3 0.4203770 1.0601800 +P 3 + 1 3.1864900 -0.0142990 + 2 1.1442700 0.3235720 + 3 0.4203770 0.7435070 +S 1 + 1 0.1426570 1.0000000 +P 1 + 1 0.1426570 1.0000000 +S 1 + 1 0.0483000 1.0000000 +P 1 + 1 0.0483000 1.0000000 + +ARGON +S 6 + 1 28348.3000000 0.00182526 + 2 4257.6200000 0.01396860 + 3 969.8570000 0.06870730 + 4 273.2630000 0.23620400 + 5 87.3695000 0.48221400 + 6 29.6867000 0.34204300 +S 6 + 1 575.8910000 -0.00215972 + 2 136.8160000 -0.02907750 + 3 43.8098000 -0.11082700 + 4 16.2094000 0.02769990 + 5 6.4608400 0.57761300 + 6 2.6511400 0.48868800 +P 6 + 1 575.8910000 0.00380665 + 2 136.8160000 0.02923050 + 3 43.8098000 0.12646700 + 4 16.2094000 0.32351000 + 5 6.4608400 0.45489600 + 6 2.6511400 0.25663000 +S 3 + 1 3.8602800 -0.2555920 + 2 1.4137300 0.0378066 + 3 0.5166460 1.0805600 +P 3 + 1 3.8602800 -0.01591970 + 2 1.4137300 0.32464600 + 3 0.5166460 0.74399000 +S 1 + 1 0.1738880 1.0000000 +P 1 + 1 0.1738880 1.0000000 +S 1 + 1 0.0600000 1.0000000 +P 1 + 1 0.0600000 1.0000000 + +POTASSIUM +S 6 + 1 31594.4200000 1.828010E-03 + 2 4744.3300000 1.399403E-02 + 3 1080.4190000 6.887129E-02 + 4 304.2338000 2.369760E-01 + 5 97.2458600 4.829040E-01 + 6 33.0249500 3.404795E-01 +S 6 + 1 622.7625000 -2.502976E-03 + 2 147.8839000 -3.315550E-02 + 3 47.3273500 -1.226387E-01 + 4 17.5149500 5.353643E-02 + 5 6.9227220 6.193860E-01 + 6 2.7682770 4.345878E-01 +P 6 + 1 622.7625000 4.094637E-03 + 2 147.8839000 3.145199E-02 + 3 47.3273500 1.351558E-01 + 4 17.5149500 3.390500E-01 + 5 6.9227220 4.629455E-01 + 6 2.7682770 2.242638E-01 +S 6 + 1 11.8480200 1.277689E-02 + 2 4.0792110 2.098767E-01 + 3 1.7634810 -3.095274E-03 + 4 0.7889270 -5.593884E-01 + 5 0.3503870 -5.134760E-01 + 6 0.1463440 -6.598035E-02 +P 6 + 1 11.8480200 -1.221377E-02 + 2 4.0792110 -6.900537E-03 + 3 1.7634810 2.007466E-01 + 4 0.7889270 4.281332E-01 + 5 0.3503870 3.970156E-01 + 6 0.1463440 1.104718E-01 +S 3 + 1 0.7168010 -5.237772E-02 + 2 0.2337410 -2.798503E-01 + 3 0.0386750 1.141547E+00 +P 3 + 1 0.7168010 0.0316430 + 2 0.2337410 -0.0404616 + 3 0.0386750 1.0120290 +S 1 + 1 0.0165210 1.000000E+00 +P 1 + 1 0.0165210 1.000000E+00 +S 1 + 1 0.0047000 1.0000000 +P 1 + 1 0.0047000 1.0000000 + +CALCIUM +S 6 + 1 35264.8600000 1.813501E-03 + 2 5295.5030000 1.388493E-02 + 3 1206.0200000 6.836162E-02 + 4 339.6839000 2.356188E-01 + 5 108.6264000 4.820639E-01 + 6 36.9210300 3.429819E-01 +S 6 + 1 706.3096000 2.448225E-03 + 2 167.8187000 3.241504E-02 + 3 53.8255800 1.226219E-01 + 4 20.0163800 -4.316965E-02 + 5 7.9702790 -6.126995E-01 + 6 3.2120590 -4.487540E-01 +P 6 + 1 706.3096000 4.020371E-03 + 2 167.8187000 3.100601E-02 + 3 53.8255800 1.337279E-01 + 4 20.0163800 3.367983E-01 + 5 7.9702790 4.631281E-01 + 6 3.2120590 2.257532E-01 +S 6 + 1 14.1951800 1.084500E-02 + 2 4.8808280 2.088333E-01 + 3 2.1603900 3.150338E-02 + 4 0.9878990 -5.526518E-01 + 5 0.4495170 -5.437997E-01 + 6 0.1873870 -6.669342E-02 +P 6 + 1 14.1951800 -1.289621E-02 + 2 4.8808280 -1.025198E-02 + 3 2.1603900 1.959781E-01 + 4 0.9878990 4.357933E-01 + 5 0.4495170 3.996452E-01 + 6 0.1873870 9.713636E-02 +S 3 + 1 1.0322710 -4.439720E-02 + 2 0.3811710 -3.284563E-01 + 3 0.0651310 1.163010E+00 +P 3 + 1 1.0322710 -0.4298621 + 2 0.3811710 0.006935829 + 3 0.0651310 0.9705933 +S 1 + 1 0.0260100 1.000000E+00 +P 1 + 1 0.0260100 1.000000E+00 +S 1 + 1 0.0071000 1.0000000 +P 1 + 1 0.0071000 1.0000000 +$END + + + From 76cc05f7cd0409c19ac966860f7489f10749a964 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 24 Jul 2018 17:59:14 +0200 Subject: [PATCH 79/96] Save MRCC WF --- configure | 2 +- data/basis/ncsu-vdz | 1303 ++++++++++++ data/basis/ncsu-vtz | 1960 ++++++++++++++++++ data/pseudo/ncsu | 183 ++ plugins/MRCC_Utils/mrcc_utils.irp.f | 2 +- plugins/mrcepa0/dressing.irp.f | 137 +- plugins/mrcepa0/save_mrcc_wavefunction.irp.f | 50 + src/Determinants/determinants.irp.f | 1 + src/Determinants/spindeterminants.irp.f | 5 +- 9 files changed, 3635 insertions(+), 8 deletions(-) create mode 100644 data/basis/ncsu-vdz create mode 100644 data/basis/ncsu-vtz create mode 100644 data/pseudo/ncsu create mode 100644 plugins/mrcepa0/save_mrcc_wavefunction.irp.f diff --git a/configure b/configure index b034f570..99a98261 100755 --- a/configure +++ b/configure @@ -138,7 +138,7 @@ ezfio = Info( default_path=join(QP_ROOT_INSTALL, "EZFIO")) zeromq = Info( - url='https://github.com/zeromq/libzmq/archive/v4.2.5.tar.gz' + url='https://github.com/zeromq/libzmq/archive/v4.2.5.tar.gz', description=' ZeroMQ', default_path=join(QP_ROOT_LIB, "libzmq.a")) diff --git a/data/basis/ncsu-vdz b/data/basis/ncsu-vdz new file mode 100644 index 00000000..7ae71203 --- /dev/null +++ b/data/basis/ncsu-vdz @@ -0,0 +1,1303 @@ +CARBON +S 9 1.00 +1 13.073594 0.0051583 +2 6.541187 0.0603424 +3 4.573411 -0.1978471 +4 1.637494 -0.0810340 +5 0.819297 0.2321726 +6 0.409924 0.2914643 +7 0.231300 0.4336405 +8 0.102619 0.2131940 +9 0.051344 0.0049848 +S 1 1.00 +1 0.127852 1.000000 +P 9 1.00 +1 9.934169 0.0209076 +2 3.886955 0.0572698 +3 1.871016 0.1122682 +4 0.935757 0.2130082 +5 0.468003 0.2835815 +6 0.239473 0.3011207 +7 0.117063 0.2016934 +8 0.058547 0.0453575 +9 0.029281 0.0029775 +P 1 1.00 +1 0.149161 1.000000 +D 1 1.00 +1 0.561160 1.000000 + +CHLORINE +S 10 1.000 + 1 0.122096 0.175451 + 2 0.289394 0.607210 + 3 0.657228 0.465346 + 4 1.167709 -0.079460 + 5 2.719209 -0.339622 + 6 5.564288 0.092975 + 7 11.667080 -0.010906 + 8 25.009418 -0.000807 + 9 53.798061 -0.000189 +10 99.938947 0.000063 +S 1 1.000 +1 0.116260 1.000 +P 10 1.000 + 1 0.075272 0.093475 + 2 0.177298 0.343672 + 3 0.389880 0.404212 + 4 0.775457 0.251867 + 5 1.391339 0.073840 + 6 3.017894 -0.068164 + 7 6.140684 0.014679 + 8 12.639835 0.000722 + 9 26.439040 -0.001040 + 10 52.945707 -0.000037 +P 1 1.000 +1 0.163092 1.000 +D 1 1.000 +1 0.636871 1.000 + +COBALT +S 13 1.000 +1 90.138338 0.000870 +2 46.360154 -0.012889 +3 23.733997 0.114398 +4 14.381697 -0.098019 +5 8.774183 -0.352394 +6 4.485868 -0.094570 +7 2.536663 0.500662 +8 1.239271 0.608796 +9 0.599131 0.189026 +10 0.224507 0.005508 +11 0.124709 -0.000242 +12 0.060740 -0.000070 +13 0.028274 0.000031 +S 13 1.000 +1 90.138338 -0.000171 +2 46.360154 0.002859 +3 23.733997 -0.027465 +4 14.381697 0.026028 +5 8.774183 0.087563 +6 4.485868 0.018143 +7 2.536663 -0.134608 +8 1.239271 -0.233508 +9 0.599131 -0.163697 +10 0.224507 0.120841 +11 0.124709 0.394955 +12 0.060740 0.509928 +13 0.028274 0.150457 +S 13 1.000 +1 90.138338 -0.000093 +2 46.360154 0.004385 +3 23.733997 -0.052442 +4 14.381697 0.044798 +5 8.774183 0.213744 +6 4.485868 -0.005708 +7 2.536663 -0.327530 +8 1.239271 -0.679295 +9 0.599131 0.252601 +10 0.224507 1.215183 +11 0.124709 0.250644 +12 0.060740 -0.593655 +13 0.028274 -0.588728 +S 1 1.000 +1 0.028274 1.0 +S 1 1.000 +1 0.014 1.0 +P 13 1.000 +1 139.014951 0.000085 +2 71.647198 -0.000721 +3 37.453971 0.006545 +4 20.948358 -0.009990 +5 13.091607 -0.084075 +6 6.797915 0.009770 +7 3.804866 0.282493 +8 1.960048 0.436288 +9 1.003909 0.313331 +10 0.508607 0.089041 +11 0.234227 0.007472 +12 0.083922 0.000983 +13 0.040103 0.000275 +P 13 1.000 +1 139.014951 0.000025 +2 71.647198 -0.000075 +3 37.453971 -0.000603 +4 20.948358 0.000027 +5 13.091607 0.022667 +6 6.797915 -0.011149 +7 3.804866 -0.056513 +8 1.960048 -0.127222 +9 1.003909 -0.059476 +10 0.508607 -0.037982 +11 0.234227 0.352856 +12 0.083922 0.508744 +13 0.040103 0.292061 +P 13 1.000 +1 139.014951 -0.000240 +2 71.647198 0.001541 +3 37.453971 -0.009509 +4 20.948358 0.025569 +5 13.091607 0.060650 +6 6.797915 -0.016616 +7 3.804866 -0.429847 +8 1.960048 -0.412446 +9 1.003909 0.088445 +10 0.508607 1.072784 +11 0.234227 0.014565 +12 0.083922 -0.720502 +13 0.040103 -0.024392 +P 1 1.000 +1 0.040103 1.0 +P 1 1.000 +1 0.019 1.0 +D 11 1.000 +1 160.454443 0.000034 +2 52.961426 0.006240 +3 27.614188 0.034177 +4 12.737767 0.082700 +5 6.178095 0.177253 +6 3.025327 0.264353 +7 1.472888 0.292424 +8 0.714500 0.249507 +9 0.348985 0.171514 +10 0.173869 0.082044 +11 0.086676 0.040249 +D 11 1.000 +1 160.454443 -0.000033 +2 52.961426 -0.007451 +3 27.614188 -0.039607 +4 12.737767 -0.100623 +5 6.178095 -0.216952 +6 3.025327 -0.284736 +7 1.472888 -0.128478 +8 0.714500 0.176611 +9 0.348985 0.374429 +10 0.173869 0.291413 +11 0.086676 0.196435 +D 1 1.000 +1 0.086676 1.0 +D 1 1.000 +1 0.043 1.0 +F 1 1.000 +1 0.557366 1.0 +F 1 1.000 +1 2.011165 1.0 + +CHROMIUM +S 13 1.000 +1 73.977737 0.000864 +2 37.684349 -0.011595 +3 19.278723 0.090467 +4 12.130763 -0.024837 +5 7.453002 -0.330407 +6 3.756296 -0.200598 +7 2.084137 0.449766 +8 0.993314 0.647575 +9 0.483094 0.229025 +10 0.225854 0.009217 +11 0.115338 0.001132 +12 0.052134 -0.000367 +13 0.023679 0.000092 +S 13 1.000 +1 73.977737 -0.000183 +2 37.684349 0.002704 +3 19.278723 -0.022650 +4 12.130763 0.007181 +5 7.453002 0.087705 +6 3.756296 0.047616 +7 2.084137 -0.125672 +8 0.993314 -0.244571 +9 0.483094 -0.198419 +10 0.225854 0.030889 +11 0.115338 0.423935 +12 0.052134 0.576941 +13 0.023679 0.148323 +S 13 1.000 +1 73.977737 -0.000327 +2 37.684349 0.005309 +3 19.278723 -0.046905 +4 12.130763 0.015411 +5 7.453002 0.191697 +6 3.756296 0.099759 +7 2.084137 -0.338994 +8 0.993314 -0.695806 +9 0.483094 -0.007315 +10 0.225854 1.118599 +11 0.115338 0.717257 +12 0.052134 -0.868565 +13 0.023679 -0.467186 +S 1 1.000 +1 0.023679 1.0 +S 1 1.000 +1 0.011 1.0 +P 13 1.000 +1 101.951240 0.000088 +2 52.309865 -0.000747 +3 27.142574 0.007135 +4 15.066862 -0.014702 +5 9.693669 -0.073353 +6 4.985710 0.012007 +7 2.761266 0.283117 +8 1.417673 0.440786 +9 0.728201 0.306775 +10 0.378189 0.081804 +11 0.189359 0.008839 +12 0.072301 0.001022 +13 0.037471 0.000325 +P 13 1.000 +1 101.951240 0.000028 +2 52.309865 -0.000085 +3 27.142574 -0.000751 +4 15.066862 0.000844 +5 9.693669 0.022656 +6 4.985710 -0.012781 +7 2.761266 -0.062386 +8 1.417673 -0.143581 +9 0.728201 -0.062281 +10 0.378189 -0.054471 +11 0.189359 0.377135 +12 0.072301 0.471633 +13 0.037471 0.311624 +P 13 1.000 +1 101.951240 -0.000137 +2 52.309865 0.000932 +3 27.142574 -0.006845 +4 15.066862 0.019831 +5 9.693669 0.043647 +6 4.985710 -0.019289 +7 2.761266 -0.281187 +8 1.417673 -0.370298 +9 0.728201 -0.199873 +10 0.378189 1.028552 +11 0.189359 0.423711 +12 0.072301 -0.800926 +13 0.037471 -0.141910 +P 1 1.000 +1 0.037471 1.0 +P 1 1.000 +1 0.018 1.0 +D 11 1.000 +1 120.683729 -0.000006 +2 42.646591 0.003111 +3 21.154405 0.028641 +4 9.708242 0.076222 +5 4.614990 0.170595 +6 2.243726 0.266908 +7 1.086491 0.311039 +8 0.524700 0.267312 +9 0.255752 0.163336 +10 0.121497 0.062782 +11 0.054339 0.007872 +D 11 1.000 +1 120.683729 0.000017 +2 42.646591 -0.003576 +3 21.154405 -0.031476 +4 9.708242 -0.087583 +5 4.614990 -0.195740 +6 2.243726 -0.270132 +7 1.086491 -0.170034 +8 0.524700 0.143412 +9 0.255752 0.408687 +10 0.121497 0.370257 +11 0.054339 0.123112 +D 1 1.000 +1 0.054339 1.0 +D 1 1.000 +1 0.026 1.0 +F 1 1.000 +1 0.311720 1.0 +F 1 1.000 +1 1.112997 1.0 + +FLUORINE +S 9 +1 71.1739093 -0.0000571 +2 33.3990384 0.0003627 +3 15.6728186 0.0095329 +4 7.35462020 -0.1270651 +5 3.45122590 0.0115271 +6 1.61952080 0.2905840 +7 0.75997570 0.4485667 +8 0.35662590 0.3123056 +9 0.16735010 0.0656252 +S 1 +1 0.344569 1.000000 +P 9 +1 27.8630509 0.0037577 +2 13.6624747 0.0434953 +3 6.69931000 0.0930502 +4 3.28496520 0.1772930 +5 1.61076240 0.2617590 +6 0.78982740 0.2896868 +7 0.38728700 0.2433414 +8 0.18990380 0.1254957 +9 0.09311810 0.0268434 +P 1 +1 0.364831 1.000000 +D 1 +1 1.722479 1.000000 + +IRON +S 13 1.000 +1 84.322332 0.000785 +2 44.203528 -0.012781 +3 23.288963 0.104635 +4 13.385163 -0.119385 +5 7.518052 -0.339804 +6 4.101835 -0.049994 +7 2.253571 0.476955 +8 1.134924 0.593222 +9 0.561550 0.200151 +10 0.201961 0.008591 +11 0.108698 -0.002188 +12 0.053619 0.000677 +13 0.025823 -0.000144 +S 13 1.000 +1 84.322332 -0.000162 +2 44.203528 0.002921 +3 23.288963 -0.025466 +4 13.385163 0.031182 +5 7.518052 0.086849 +6 4.101835 0.006846 +7 2.253571 -0.131856 +8 1.134924 -0.227746 +9 0.561550 -0.173079 +10 0.201961 0.136142 +11 0.108698 0.434013 +12 0.053619 0.477555 +13 0.025823 0.128804 +S 13 1.000 +1 84.322332 0.000002 +2 44.203528 0.004103 +3 23.288963 -0.046840 +4 13.385163 0.052833 +5 7.518052 0.218094 +6 4.101835 -0.044999 +7 2.253571 -0.287386 +8 1.134924 -0.713220 +9 0.561550 0.249174 +10 0.201961 1.299872 +11 0.108698 0.192119 +12 0.053619 -0.658616 +13 0.025823 -0.521047 +S 1 1.000 +1 0.025823 1.0 +S 1 1.000 +1 0.012 1.0 +P 13 1.000 +1 125.092775 0.000056 +2 65.211589 -0.000572 +3 34.437599 0.007388 +4 18.930704 -0.028481 +5 10.873415 -0.063005 +6 6.012172 0.024855 +7 3.372205 0.277474 +8 1.768641 0.425386 +9 0.914516 0.314145 +10 0.460895 0.090422 +11 0.204490 0.006977 +12 0.074741 0.001154 +13 0.035671 0.000303 +P 13 1.000 +1 125.092775 0.000025 +2 65.211589 -0.000070 +3 34.437599 -0.001042 +4 18.930704 0.005127 +5 10.873415 0.018404 +6 6.012172 -0.014692 +7 3.372205 -0.061307 +8 1.768641 -0.128638 +9 0.914516 -0.070637 +10 0.460895 -0.016314 +11 0.204490 0.380702 +12 0.074741 0.523071 +13 0.035671 0.235765 +P 13 1.000 +1 125.092775 -0.000197 +2 65.211589 0.001251 +3 34.437599 -0.009154 +4 18.930704 0.038201 +5 10.873415 0.043097 +6 6.012172 -0.029475 +7 3.372205 -0.426996 +8 1.768641 -0.394840 +9 0.914516 0.077230 +10 0.460895 1.119881 +11 0.204490 -0.066494 +12 0.074741 -0.721583 +13 0.035671 -0.005695 +P 1 1.000 +1 0.035671 1.0 +P 1 1.000 +1 0.017 1.0 +D 11 1.000 +1 152.736742 0.000029 +2 50.772485 0.005238 +3 26.253589 0.029325 +4 12.137022 0.074901 +5 5.853719 0.163411 +6 2.856224 0.251057 +7 1.386132 0.287603 +8 0.670802 0.251862 +9 0.330280 0.186736 +10 0.170907 0.093570 +11 0.086794 0.073811 +D 11 1.000 +1 152.736742 -0.000026 +2 50.772485 -0.006329 +3 26.253589 -0.034398 +4 12.137022 -0.091765 +5 5.853719 -0.201592 +6 2.856224 -0.283930 +7 1.386132 -0.161981 +8 0.670802 0.128822 +9 0.330280 0.360160 +10 0.170907 0.277592 +11 0.086794 0.261403 +D 1 1.000 +1 0.086794 1.0 +D 1 1.000 +1 0.04 1.0 +F 1 1.000 +1 0.463696 1.0 +F 1 1.000 +1 1.696126 1.0 + +MANGANESE +S 13 1.000 +1 76.015816 0.000992 +2 39.287425 -0.014765 +3 20.413997 0.120351 +4 12.220632 -0.123547 +5 7.180198 -0.319950 +6 3.850598 -0.106021 +7 2.142243 0.472317 +8 1.049440 0.620499 +9 0.508652 0.204890 +10 0.192102 0.005983 +11 0.108912 -0.000130 +12 0.053405 -0.000175 +13 0.025223 0.000059 +S 13 1.000 +1 76.015816 -0.000199 +2 39.287425 0.003344 +3 20.413997 -0.029317 +4 12.220632 0.031960 +5 7.180198 0.083084 +6 3.850598 0.021364 +7 2.142243 -0.129827 +8 1.049440 -0.238808 +9 0.508652 -0.180485 +10 0.192102 0.109481 +11 0.108912 0.404375 +12 0.053405 0.517748 +13 0.025223 0.148273 +S 13 1.000 +1 76.015816 -0.000091 +2 39.287425 0.005358 +3 20.413997 -0.058289 +4 12.220632 0.056077 +5 7.180198 0.227722 +6 3.850598 -0.008293 +7 2.142243 -0.320247 +8 1.049440 -0.812449 +9 0.508652 0.324723 +10 0.192102 1.446872 +11 0.108912 0.022988 +12 0.053405 -0.677035 +13 0.025223 -0.454415 +S 1 1.000 +1 0.025223 1.0 +S 1 1.000 +1 0.012 1.0 +P 13 1.000 +1 113.478683 0.000103 +2 58.149046 -0.000896 +3 30.029824 0.008851 +4 16.750395 -0.019576 +5 10.714033 -0.069249 +6 5.558478 0.011297 +7 3.080496 0.282218 +8 1.582818 0.438781 +9 0.810731 0.309937 +10 0.413383 0.083951 +11 0.195719 0.007553 +12 0.072184 0.001106 +13 0.035923 0.000285 +P 13 1.000 +1 113.478683 0.000021 +2 58.149046 -0.000034 +3 30.029824 -0.001184 +4 16.750395 0.002162 +5 10.714033 0.020978 +6 5.558478 -0.011826 +7 3.080496 -0.062380 +8 1.582818 -0.137615 +9 0.810731 -0.065755 +10 0.413383 -0.033911 +11 0.195719 0.382515 +12 0.072184 0.508959 +13 0.035923 0.257840 +P 13 1.000 +1 113.478683 -0.000200 +2 58.149046 0.001371 +3 30.029824 -0.010181 +4 16.750395 0.030762 +5 10.714033 0.045983 +6 5.558478 -0.017031 +7 3.080496 -0.397037 +8 1.582818 -0.418005 +9 0.810731 0.073119 +10 0.413383 1.095819 +11 0.195719 0.003833 +12 0.072184 -0.756970 +13 0.035923 -0.040676 +P 1 1.000 +1 0.035923 1.0 +P 1 1.000 +1 0.017 1.0 +D 11 1.000 +1 132.688043 0.000030 +2 45.257740 0.005308 +3 23.264934 0.029187 +4 10.604446 0.076880 +5 5.075071 0.168742 +6 2.470085 0.256971 +7 1.206045 0.289895 +8 0.590669 0.257087 +9 0.292045 0.181613 +10 0.149158 0.089726 +11 0.076548 0.034455 +D 11 1.000 +1 132.688043 -0.000021 +2 45.257740 -0.005463 +3 23.264934 -0.029079 +4 10.604446 -0.079946 +5 5.075071 -0.174638 +6 2.470085 -0.253480 +7 1.206045 -0.173991 +8 0.590669 0.045744 +9 0.292045 0.346287 +10 0.149158 0.263668 +11 0.076548 0.370832 +D 1 1.000 +1 0.076548 1.0 +D 1 1.000 +1 0.03 1.0 +F 1 1.000 +1 0.374592 1.0 +F 1 1.000 +1 1.361579 1.0 + +NICKEL +S 13 1.000 +1 97.609231 0.000688 +2 51.795589 -0.014336 +3 27.566909 0.121035 +4 15.531444 -0.144503 +5 8.990857 -0.360791 +6 4.804810 -0.003243 +7 2.574616 0.497736 +8 1.332789 0.552240 +9 0.678890 0.196852 +10 0.231285 0.010794 +11 0.120013 -0.003782 +12 0.057871 0.001393 +13 0.027793 -0.000334 +S 13 1.000 +1 97.609231 -0.000136 +2 51.795589 0.003181 +3 27.566909 -0.028405 +4 15.531444 0.036601 +5 8.990857 0.086336 +6 4.804810 -0.001113 +7 2.574616 -0.136410 +8 1.332789 -0.206882 +9 0.678890 -0.163365 +10 0.231285 0.143310 +11 0.120013 0.450561 +12 0.057871 0.458900 +13 0.027793 0.116636 +S 13 1.000 +1 97.609231 -0.000144 +2 51.795589 0.003299 +3 27.566909 -0.029379 +4 15.531444 0.038039 +5 8.990857 0.088752 +6 4.804810 -0.001605 +7 2.574616 -0.142926 +8 1.332789 -0.206444 +9 0.678890 -0.160922 +10 0.231285 0.137129 +11 0.120013 0.452051 +12 0.057871 0.453964 +13 0.027793 0.122926 +S 1 1.000 +1 0.027793 1.0 +S 1 1.000 +1 0.013 1.0 +P 13 1.000 +1 148.055334 0.000088 +2 72.086134 -0.001119 +3 34.462396 0.021186 +4 19.703322 -0.070032 +5 15.218321 -0.047471 +6 7.500730 0.023137 +7 4.198271 0.275852 +8 2.159830 0.433799 +9 1.103715 0.310152 +10 0.573058 0.089124 +11 0.296213 0.010970 +12 0.087733 0.001132 +13 0.036681 0.000101 +P 13 1.000 +1 148.055334 0.000055 +2 72.086134 -0.000191 +3 34.462396 -0.002043 +4 19.703322 0.003428 +5 15.218321 0.023890 +6 7.500730 -0.019526 +7 4.198271 -0.041199 +8 2.159830 -0.138172 +9 1.103715 -0.018608 +10 0.573058 -0.118437 +11 0.296213 0.355825 +12 0.087733 0.604126 +13 0.036681 0.252636 +P 13 1.000 +1 148.055334 -0.000165 +2 72.086134 0.001444 +3 34.462396 -0.022779 +4 19.703322 0.103668 +5 15.218321 -0.002949 +6 7.500730 -0.008709 +7 4.198271 -0.449059 +8 2.159830 -0.387352 +9 1.103715 0.075969 +10 0.573058 1.025025 +11 0.296213 0.064695 +12 0.087733 -0.729963 +13 0.036681 -0.002806 +P 1 1.000 +1 0.036681 1.0 +P 1 1.000 +1 0.018 1.0 +D 11 1.000 +1 177.801510 -0.000015 +2 61.108038 0.002224 +3 30.508234 0.026045 +4 14.144383 0.092837 +5 6.846193 0.186362 +6 3.363485 0.268726 +7 1.645977 0.295256 +8 0.795663 0.251833 +9 0.384212 0.161292 +10 0.189273 0.070970 +11 0.091549 0.022879 +D 11 1.000 +1 177.801510 0.000016 +2 61.108038 -0.002556 +3 30.508234 -0.029764 +4 14.144383 -0.108691 +5 6.846193 -0.223408 +6 3.363485 -0.283618 +7 1.645977 -0.120676 +8 0.795663 0.193509 +9 0.384212 0.377891 +10 0.189273 0.297292 +11 0.091549 0.174221 +D 1 1.000 +1 0.091549 1.0 +D 1 1.000 +1 0.04 1.0 +F 1 1.000 +1 0.665953 1.0 +F 1 1.000 +1 2.380651 1.0 + +OXYGEN +S 9 1 +1 54.775216 -0.0012444 +2 25.616801 0.0107330 +3 11.980245 0.0018889 +4 6.992317 -0.1742537 +5 2.620277 0.0017622 +6 1.225429 0.3161846 +7 0.577797 0.4512023 +8 0.268022 0.3121534 +9 0.125346 0.0511167 +S 1 1 +1 0.258551 1.0000000 +P 9 1 +1 22.217266 0.0104866 +2 10.74755 0.0366435 +3 5.315785 0.0803674 +4 2.660761 0.1627010 +5 1.331816 0.2377791 +6 0.678626 0.2811422 +7 0.333673 0.2643189 +8 0.167017 0.1466014 +9 0.083598 0.0458145 +P 1 1 +1 0.267865 1.0000000 +D 1 1 +1 1.232753 1.0000000 + +SULFUR +s 11 +1 315.24967840 0.000233 +2 141.17315500 -0.000557 +3 63.21928635 0.007846 +4 28.31046857 -0.139746 +5 12.67781838 0.011705 +6 5.67730197 0.400954 +7 2.54237414 0.562552 +8 1.13851021 0.135102 +9 0.50984058 0.004551 +10 0.22831365 0.000131 +11 0.10224200 0.000385 +s 11 +1 315.24967840 -0.000035 +2 141.17315500 -0.000046 +3 63.21928635 -0.001545 +4 28.31046857 0.046561 +5 12.67781838 -0.007204 +6 5.67730197 -0.163807 +7 2.54237414 -0.356328 +8 1.13851021 -0.102388 +9 0.50984058 0.476460 +10 0.22831365 0.568771 +11 0.10224200 0.183715 +s 1 +1 0.152826 1.000000 +p 11 +1 105.77262714 -0.000130 +2 50.58545925 0.016880 +3 24.19235256 0.158150 +4 11.56992407 0.258667 +5 5.53328341 0.356166 +6 2.64627711 0.294147 +7 1.26557453 0.091060 +8 0.60525743 0.007367 +9 0.28946265 0.000547 +10 0.13843469 0.000553 +11 0.06620600 -0.000031 +p 11 +1 105.77262714 -0.000224 +2 50.58545925 0.005129 +3 24.19235256 0.038613 +4 11.56992407 0.068551 +5 5.53328341 0.100274 +6 2.64627711 0.091605 +7 1.26557453 -0.063653 +8 0.60525743 -0.290231 +9 0.28946265 -0.414484 +10 0.13843469 -0.297929 +11 0.06620600 -0.101003 +p 1 +1 0.152826 1.000000 +d 1 +1 0.481035 1.000000 + +SCANDIUM +S 13 1.000 +1 66.885341 0.000530 +2 33.819599 -0.004820 +3 18.254490 0.001497 +4 11.808446 0.125425 +5 6.900398 -0.270066 +6 3.228933 -0.326605 +7 1.773981 0.289735 +8 0.840523 0.630457 +9 0.472620 0.269883 +10 0.314717 0.139047 +11 0.100371 0.008111 +12 0.048701 -0.002666 +13 0.022635 0.000614 +S 13 1.000 +1 66.885341 -0.000134 +2 33.819599 0.001271 +3 18.254490 -0.000752 +4 11.808446 -0.033037 +5 6.900398 0.075355 +6 3.228933 0.090312 +7 1.773981 -0.089219 +8 0.840523 -0.216505 +9 0.472620 -0.176500 +10 0.314717 -0.131181 +11 0.100371 0.341614 +12 0.048701 0.608966 +13 0.022635 0.240473 +S 13 1.000 +1 66.885341 -0.000687 +2 33.819599 0.005444 +3 18.254490 -0.015884 +4 11.808446 -0.032814 +5 6.900398 0.108358 +6 3.228933 0.235631 +7 1.773981 -0.311150 +8 0.840523 -0.234723 +9 0.472620 -1.200718 +10 0.314717 1.048196 +11 0.100371 1.607623 +12 0.048701 -0.643134 +13 0.022635 -0.837339 +S 1 1.000 +1 0.022635 1.0 +S 1 1.000 +1 0.011 1.0 +P 13 1.000 +1 77.687965 0.000088 +2 39.720143 -0.000755 +3 20.588415 0.006537 +4 11.552484 -0.005944 +5 7.633071 -0.070539 +6 3.765354 -0.014599 +7 2.056424 0.249676 +8 1.048311 0.436532 +9 0.549190 0.325322 +10 0.304981 0.103373 +11 0.166817 0.018978 +12 0.061588 0.001353 +13 0.024836 0.000122 +P 13 1.000 +1 77.687965 0.000012 +2 39.720143 0.000002 +3 20.588415 -0.000950 +4 11.552484 -0.000472 +5 7.633071 0.021251 +6 3.765354 -0.002758 +7 2.056424 -0.060262 +8 1.048311 -0.141394 +9 0.549190 -0.081787 +10 0.304981 -0.099327 +11 0.166817 0.309280 +12 0.061588 0.623105 +13 0.024836 0.261500 +P 13 1.000 +1 77.687965 -0.000053 +2 39.720143 0.000499 +3 20.588415 -0.004884 +4 11.552484 0.005449 +5 7.633071 0.055621 +6 3.765354 0.002727 +7 2.056424 -0.232938 +8 1.048311 -0.500050 +9 0.549190 -0.218611 +10 0.304981 0.886574 +11 0.166817 0.657112 +12 0.061588 -0.824086 +13 0.024836 -0.171436 +P 1 1.000 +1 0.024836 1.0 +P 1 1.000 +1 0.012 1.0 +D 11 1.000 +1 60.996922 0.000056 +2 22.088926 0.005065 +3 10.187383 0.031740 +4 4.631390 0.082146 +5 2.148130 0.159084 +6 1.015784 0.228110 +7 0.487874 0.244131 +8 0.247348 0.234199 +9 0.129854 0.196760 +10 0.062998 0.212891 +11 0.021310 0.072798 +D 11 1.000 +1 60.996922 -0.000073 +2 22.088926 -0.006086 +3 10.187383 -0.038466 +4 4.631390 -0.100226 +5 2.148130 -0.193890 +6 1.015784 -0.253318 +7 0.487874 -0.214480 +8 0.247348 0.054136 +9 0.129854 0.267168 +10 0.062998 0.517020 +11 0.021310 0.163524 +D 1 1.000 +1 0.021310 1.0 +D 1 1.000 +1 0.01 1.0 +F 1 1.000 +1 0.083504 1.0 +F 1 1.000 +1 0.279955 1.0 + +TITANIUM +S 13 1.000 +1 68.910511 0.000616 +2 33.720700 -0.007501 +3 18.159676 0.012218 +4 12.419305 0.144739 +5 7.532195 -0.328621 +6 3.504444 -0.317517 +7 1.910727 0.357422 +8 0.888840 0.671406 +9 0.447198 0.282226 +10 0.281192 0.038673 +11 0.100258 0.004559 +12 0.046525 -0.001565 +13 0.021840 0.000398 +S 13 1.000 +1 68.910511 -0.000156 +2 33.720700 0.001966 +3 18.159676 -0.003994 +4 12.419305 -0.036377 +5 7.532195 0.088593 +6 3.504444 0.085630 +7 1.910727 -0.105993 +8 0.888840 -0.237421 +9 0.447198 -0.235359 +10 0.281192 -0.012960 +11 0.100258 0.433582 +12 0.046525 0.577873 +13 0.021840 0.164360 +S 13 1.000 +1 68.910511 0.000635 +2 33.720700 -0.006468 +3 18.159676 0.023444 +4 12.419305 0.038921 +5 7.532195 -0.141180 +6 3.504444 -0.214765 +7 1.910727 0.320151 +8 0.888840 0.451062 +9 0.447198 0.855191 +10 0.281192 -1.209224 +11 0.100258 -1.319481 +12 0.046525 0.866517 +13 0.021840 0.618916 +S 1 1.000 +1 0.021840 1.0 +S 1 1.000 +1 0.01 1.0 +P 13 1.000 +1 84.914002 0.000093 +2 42.855051 -0.000836 +3 21.700131 0.008679 +4 12.214690 -0.011178 +5 8.319164 -0.077767 +6 4.091071 -0.006113 +7 2.286543 0.271828 +8 1.159810 0.459585 +9 0.591343 0.315900 +10 0.312862 0.071683 +11 0.184828 0.010541 +12 0.068590 0.000045 +13 0.026791 -0.000837 +P 13 1.000 +1 84.914002 0.000020 +2 42.855051 -0.000049 +3 21.700131 -0.000761 +4 12.214690 -0.000575 +5 8.319164 0.018284 +6 4.091071 -0.005943 +7 2.286543 -0.043212 +8 1.159810 -0.112513 +9 0.591343 -0.052073 +10 0.312862 -0.092263 +11 0.184828 0.243946 +12 0.068590 0.413101 +13 0.026791 0.543985 +P 13 1.000 +1 84.914002 0.000019 +2 42.855051 0.000138 +3 21.700131 -0.004622 +4 12.214690 0.004465 +5 8.319164 0.065760 +6 4.091071 -0.018927 +7 2.286543 -0.222524 +8 1.159810 -0.523890 +9 0.591343 -0.071277 +10 0.312862 0.812712 +11 0.184828 0.625498 +12 0.068590 -0.812189 +13 0.026791 -0.185796 +P 1 1.000 +1 0.026791 1.0 +P 1 1.000 +1 0.013 1.0 +D 11 1.000 +1 77.434559 0.000022 +2 27.708477 0.004218 +3 12.914284 0.030087 +4 6.062674 0.084821 +5 2.863898 0.171110 +6 1.386559 0.247451 +7 0.677058 0.277310 +8 0.329864 0.261077 +9 0.159474 0.190336 +10 0.076174 0.119385 +11 0.028570 0.031297 +D 11 1.000 +1 77.434559 -0.000025 +2 27.708477 -0.004311 +3 12.914284 -0.030913 +4 6.062674 -0.088049 +5 2.863898 -0.178330 +6 1.386559 -0.234335 +7 0.677058 -0.195775 +8 0.329864 0.065872 +9 0.159474 0.330536 +10 0.076174 0.461229 +11 0.028570 0.184273 +D 1 1.000 +1 0.028570 1.0 +D 1 1.000 +1 0.014 1.0 +F 1 1.000 +1 0.146931 1.0 +F 1 1.000 +1 0.499717 1.0 + +VANADIUM +S 13 1.000 +1 68.577621 0.000804 +2 34.937147 -0.011594 +3 17.939491 0.092209 +4 11.262123 -0.045477 +5 6.776264 -0.287983 +6 3.524091 -0.217648 +7 1.938421 0.407509 +8 0.927153 0.658193 +9 0.448420 0.255234 +10 0.209668 0.008620 +11 0.103660 0.002734 +12 0.050630 -0.001161 +13 0.024201 0.000294 +S 13 1.000 +1 68.577621 -0.000177 +2 34.937147 0.002791 +3 17.939491 -0.023650 +4 11.262123 0.012504 +5 6.776264 0.078761 +6 3.524091 0.054974 +7 1.938421 -0.118955 +8 0.927153 -0.245341 +9 0.448420 -0.222959 +10 0.209668 0.047809 +11 0.103660 0.415374 +12 0.050630 0.540880 +13 0.024201 0.183421 +S 13 1.000 +1 68.577621 -0.000583 +2 34.937147 0.009570 +3 17.939491 -0.085606 +4 11.262123 0.048426 +5 6.776264 0.331239 +6 3.524091 0.140352 +7 1.938421 -0.907962 +8 0.927153 -0.503878 +9 0.448420 0.398938 +10 0.209668 0.971131 +11 0.103660 0.423999 +12 0.050630 -0.628646 +13 0.024201 -0.467495 +S 1 1.000 +1 0.024201 1.0 +S 1 1.000 +1 0.012 1.0 +P 13 1.000 +1 96.215967 0.000069 +2 49.579340 -0.000672 +3 25.638009 0.008199 +4 14.025942 -0.027108 +5 8.740334 -0.053021 +6 4.634840 0.005002 +7 2.553374 0.261986 +8 1.321166 0.433544 +9 0.681285 0.324947 +10 0.349458 0.092342 +11 0.172773 0.008964 +12 0.063300 0.001185 +13 0.033969 0.000104 +P 13 1.000 +1 96.215967 0.000040 +2 49.579340 -0.000133 +3 25.638009 -0.000955 +4 14.025942 0.003719 +5 8.740334 0.018866 +6 4.634840 -0.012074 +7 2.553374 -0.057107 +8 1.321166 -0.146433 +9 0.681285 -0.067365 +10 0.349458 -0.068254 +11 0.172773 0.403103 +12 0.063300 0.502668 +13 0.033969 0.261291 +P 13 1.000 +1 96.215967 -0.000053 +2 49.579340 0.000023 +3 25.638009 0.004629 +4 14.025942 -0.007755 +5 8.740334 -0.104133 +6 4.634840 -0.017762 +7 2.553374 0.728212 +8 1.321166 0.218826 +9 0.681285 -0.493223 +10 0.349458 -0.838192 +11 0.172773 0.398401 +12 0.063300 0.664589 +13 0.033969 0.033011 +P 1 1.000 +1 0.033969 1.0 +P 1 1.000 +1 0.016 1.0 +D 11 1.000 +1 89.989649 0.000051 +2 33.132961 0.004804 +3 15.879656 0.029485 +4 7.465803 0.086249 +5 3.551993 0.179728 +6 1.728185 0.261850 +7 0.850498 0.291794 +8 0.417673 0.259356 +9 0.201523 0.174944 +10 0.100711 0.062278 +11 0.058959 0.027653 +D 11 1.000 +1 89.989649 -0.000038 +2 33.132961 -0.004590 +3 15.879656 -0.027563 +4 7.465803 -0.082775 +5 3.551993 -0.173494 +6 1.728185 -0.236188 +7 0.850498 -0.149226 +8 0.417673 0.044145 +9 0.201523 0.390500 +10 0.100711 0.203064 +11 0.058959 0.398002 +D 1 1.000 +1 0.058959 1.0 +D 1 1.000 +1 0.027 1.0 +F 1 1.000 +1 0.308388 1.0 +F 1 1.000 +1 1.138450 1.0 + +ZINC +S 13 1.000 +1 114.485022 0.000429 +2 61.996430 -0.019339 +3 40.117132 0.086254 +4 20.119649 -0.088955 +5 10.171676 -0.402671 +6 5.601641 0.067304 +7 2.864122 0.479215 +8 1.592779 0.503960 +9 0.826525 0.222088 +10 0.263975 0.012203 +11 0.145302 -0.004300 +12 0.068195 0.001243 +13 0.031465 -0.000267 +S 13 1.000 +1 114.485022 -0.000109 +2 61.996430 0.004459 +3 40.117132 -0.020067 +4 20.119649 0.022338 +5 10.171676 0.096698 +6 5.601641 -0.021966 +7 2.864122 -0.128768 +8 1.592779 -0.181706 +9 0.826525 -0.162311 +10 0.263975 0.116264 +11 0.145302 0.411314 +12 0.068195 0.494257 +13 0.031465 0.138103 +S 13 1.000 +1 114.485022 0.000666 +2 61.996430 0.006269 +3 40.117132 -0.046603 +4 20.119649 0.050399 +5 10.171676 0.363493 +6 5.601641 -0.242840 +7 2.864122 -0.382281 +8 1.592779 -0.861567 +9 0.826525 0.706077 +10 0.263975 1.495001 +11 0.145302 -0.453994 +12 0.068195 -0.597822 +13 0.031465 -0.256117 +S 1 1.000 +1 0.031465 1.0 +S 1 1.000 +1 0.015 1.0 +P 13 1.000 +1 158.770986 -0.000153 +2 75.802876 0.001893 +3 44.547824 0.010461 +4 31.445269 -0.045141 +5 13.080125 -0.084201 +6 7.788616 0.104973 +7 4.195040 0.307714 +8 2.362276 0.368563 +9 1.302584 0.286336 +10 0.660704 0.095156 +11 0.249042 0.005851 +12 0.091781 -0.000034 +13 0.048931 0.000252 +P 13 1.000 +1 158.770986 0.000053 +2 75.802876 -0.000571 +3 44.547824 -0.001073 +4 31.445269 0.007463 +5 13.080125 0.018676 +6 7.788616 -0.028090 +7 4.195040 -0.054438 +8 2.362276 -0.093744 +9 1.302584 -0.054169 +10 0.660704 -0.007972 +11 0.249042 0.356198 +12 0.091781 0.412399 +13 0.048931 0.361321 +P 13 1.000 +1 158.770986 -0.000170 +2 75.802876 0.000604 +3 44.547824 -0.019987 +4 31.445269 0.061153 +5 13.080125 0.067317 +6 7.788616 -0.139211 +7 4.195040 -0.527041 +8 2.362276 -0.176194 +9 1.302584 0.037129 +10 0.660704 1.079322 +11 0.249042 -0.050149 +12 0.091781 -0.688971 +13 0.048931 0.037331 +P 1 1.000 +1 0.048931 1.0 +P 1 1.000 +1 0.024 1.0 +D 11 1.000 +1 270.014061 -0.000016 +2 100.161579 0.000696 +3 43.530609 0.013536 +4 21.262419 0.069350 +5 10.577821 0.149559 +6 5.343620 0.239588 +7 2.704857 0.286744 +8 1.353018 0.271459 +9 0.660873 0.202426 +10 0.309149 0.103307 +11 0.133879 0.023211 +D 11 1.000 +1 270.014061 0.000013 +2 100.161579 -0.000889 +3 43.530609 -0.018640 +4 21.262419 -0.094646 +5 10.577821 -0.215659 +6 5.343620 -0.322469 +7 2.704857 -0.197529 +8 1.353018 0.164448 +9 0.660873 0.410017 +10 0.309149 0.327838 +11 0.133879 0.105749 +D 1 1.000 +1 0.133879 1.0 +D 1 1.000 +1 0.06 1.0 +F 1 1.000 +1 0.893402 1.0 +F 1 1.000 +1 3.171936 1.0 diff --git a/data/basis/ncsu-vtz b/data/basis/ncsu-vtz new file mode 100644 index 00000000..9b189e1b --- /dev/null +++ b/data/basis/ncsu-vtz @@ -0,0 +1,1960 @@ +HYDROGEN +S 6 + 1 6.359201 -0.004943 + 2 3.546637 0.049579 + 3 1.493442 0.037176 + 4 0.551948 0.287908 + 5 0.207203 0.009543 + 6 0.079234 0.770084 +S 6 + 1 6.359201 -0.016672 + 2 3.546637 -0.005774 + 3 1.493442 -0.227982 + 4 0.551948 -0.285652 + 5 0.207203 -1.071579 + 6 0.079234 1.423767 +S 6 + 1 6.359201 -0.018886 + 2 3.546637 -0.058854 + 3 1.493442 -0.556988 + 4 0.551948 -1.084022 + 5 0.207203 2.721525 + 6 0.079234 -1.458091 +S 1 + 1 0.102700 1.000000 +P 1 + 1 1.407000 1.000000 +P 1 + 1 0.388000 1.000000 +D 1 + 1 1.057000 1.000000 + +CARBON +S 9 + 1 13.073594 0.0051583 + 2 6.541187 0.0603424 + 3 4.573411 -0.1978471 + 4 1.637494 -0.0810340 + 5 0.819297 0.2321726 + 6 0.409924 0.2914643 + 7 0.231300 0.4336405 + 8 0.102619 0.2131940 + 9 0.051344 0.0049848 +S 1 + 1 0.921552 1.000000 +S 1 + 1 0.132800 1.000000 +P 9 + 1 9.934169 0.0209076 + 2 3.886955 0.0572698 + 3 1.871016 0.1122682 + 4 0.935757 0.2130082 + 5 0.468003 0.2835815 + 6 0.239473 0.3011207 + 7 0.117063 0.2016934 + 8 0.058547 0.0453575 + 9 0.029281 0.0029775 +P 1 + 1 0.376742 1.000000 +P 1 + 1 0.126772 1.000000 +D 1 + 1 1.141611 1.000000 +D 1 + 1 0.329486 1.000000 +F 1 + 1 0.773485 1.000000 + +CHLORINE +S 10 + 1 0.122096 0.175451 + 2 0.289394 0.607210 + 3 0.657228 0.465346 + 4 1.167709 -0.079460 + 5 2.719209 -0.339622 + 6 5.564288 0.092975 + 7 11.667080 -0.010906 + 8 25.009418 -0.000807 + 9 53.798061 -0.000189 +10 99.938947 0.000063 +S 1 +1 0.188703 1.000 +S 1 +1 1.003905 1.000 +P 10 + 1 0.075272 0.093475 + 2 0.177298 0.343672 + 3 0.389880 0.404212 + 4 0.775457 0.251867 + 5 1.391339 0.073840 + 6 3.017894 -0.068164 + 7 6.140684 0.014679 + 8 12.639835 0.000722 + 9 26.439040 -0.001040 + 10 52.945707 -0.000037 +P 1 +1 0.122186 1.000 +P 1 +1 0.341503 1.000 +D 1 +1 0.361259 1.000 +D 1 +1 1.165615 1.000 +F 1 +1 0.721855 1.000 + +COBALT +S 13 +1 90.138338 0.000870 +2 46.360154 -0.012889 +3 23.733997 0.114398 +4 14.381697 -0.098019 +5 8.774183 -0.352394 +6 4.485868 -0.094570 +7 2.536663 0.500662 +8 1.239271 0.608796 +9 0.599131 0.189026 +10 0.224507 0.005508 +11 0.124709 -0.000242 +12 0.060740 -0.000070 +13 0.028274 0.000031 +S 13 +1 90.138338 -0.000171 +2 46.360154 0.002859 +3 23.733997 -0.027465 +4 14.381697 0.026028 +5 8.774183 0.087563 +6 4.485868 0.018143 +7 2.536663 -0.134608 +8 1.239271 -0.233508 +9 0.599131 -0.163697 +10 0.224507 0.120841 +11 0.124709 0.394955 +12 0.060740 0.509928 +13 0.028274 0.150457 +S 13 +1 90.138338 -0.000093 +2 46.360154 0.004385 +3 23.733997 -0.052442 +4 14.381697 0.044798 +5 8.774183 0.213744 +6 4.485868 -0.005708 +7 2.536663 -0.327530 +8 1.239271 -0.679295 +9 0.599131 0.252601 +10 0.224507 1.215183 +11 0.124709 0.250644 +12 0.060740 -0.593655 +13 0.028274 -0.588728 +S 13 +1 90.138338 -0.000342 +2 46.360154 0.009084 +3 23.733997 -0.110827 +4 14.381697 0.131865 +5 8.774183 0.389649 +6 4.485868 -0.021196 +7 2.536663 -1.176422 +8 1.239271 -0.747459 +9 0.599131 2.309439 +10 0.224507 0.259142 +11 0.124709 -1.979997 +12 0.060740 0.123168 +13 0.028274 0.937568 +S 1 +1 0.028274 1.0 +S 1 +1 0.014 1.0 +P 13 +1 139.014951 0.000085 +2 71.647198 -0.000721 +3 37.453971 0.006545 +4 20.948358 -0.009990 +5 13.091607 -0.084075 +6 6.797915 0.009770 +7 3.804866 0.282493 +8 1.960048 0.436288 +9 1.003909 0.313331 +10 0.508607 0.089041 +11 0.234227 0.007472 +12 0.083922 0.000983 +13 0.040103 0.000275 +P 13 +1 139.014951 0.000025 +2 71.647198 -0.000075 +3 37.453971 -0.000603 +4 20.948358 0.000027 +5 13.091607 0.022667 +6 6.797915 -0.011149 +7 3.804866 -0.056513 +8 1.960048 -0.127222 +9 1.003909 -0.059476 +10 0.508607 -0.037982 +11 0.234227 0.352856 +12 0.083922 0.508744 +13 0.040103 0.292061 +P 13 +1 139.014951 -0.000240 +2 71.647198 0.001541 +3 37.453971 -0.009509 +4 20.948358 0.025569 +5 13.091607 0.060650 +6 6.797915 -0.016616 +7 3.804866 -0.429847 +8 1.960048 -0.412446 +9 1.003909 0.088445 +10 0.508607 1.072784 +11 0.234227 0.014565 +12 0.083922 -0.720502 +13 0.040103 -0.024392 +P 13 +1 139.014951 -0.000032 +2 71.647198 -0.000195 +3 37.453971 0.005702 +4 20.948358 -0.022947 +5 13.091607 -0.125808 +6 6.797915 0.144929 +7 3.804866 0.804637 +8 1.960048 0.233167 +9 1.003909 -1.665718 +10 0.508607 0.275574 +11 0.234227 1.339764 +12 0.083922 -0.879771 +13 0.040103 -0.132801 +P 1 +1 0.040103 1.0 +P 1 +1 0.019 1.0 +D 11 +1 160.454443 0.000034 +2 52.961426 0.006240 +3 27.614188 0.034177 +4 12.737767 0.082700 +5 6.178095 0.177253 +6 3.025327 0.264353 +7 1.472888 0.292424 +8 0.714500 0.249507 +9 0.348985 0.171514 +10 0.173869 0.082044 +11 0.086676 0.040249 +D 11 +1 160.454443 -0.000033 +2 52.961426 -0.007451 +3 27.614188 -0.039607 +4 12.737767 -0.100623 +5 6.178095 -0.216952 +6 3.025327 -0.284736 +7 1.472888 -0.128478 +8 0.714500 0.176611 +9 0.348985 0.374429 +10 0.173869 0.291413 +11 0.086676 0.196435 +D 11 +1 160.454443 0.000054 +2 52.961426 0.009948 +3 27.614188 0.052544 +4 12.737767 0.139860 +5 6.178095 0.306445 +6 3.025327 0.246555 +7 1.472888 -0.284006 +8 0.714500 -0.594724 +9 0.348985 -0.024539 +10 0.173869 0.360938 +11 0.086676 0.447303 +D 1 +1 0.086676 1.0 +D 1 +1 0.043 1.0 +F 1 +1 0.240278 1.0 +F 1 +1 0.974322 1.0 +F 1 +1 3.95085 1.0 +G 1 +1 0.828387 1.0 +G 1 +1 2.524816 1.0 + +CHROMIUM +S 13 +1 73.977737 0.000864 +2 37.684349 -0.011595 +3 19.278723 0.090467 +4 12.130763 -0.024837 +5 7.453002 -0.330407 +6 3.756296 -0.200598 +7 2.084137 0.449766 +8 0.993314 0.647575 +9 0.483094 0.229025 +10 0.225854 0.009217 +11 0.115338 0.001132 +12 0.052134 -0.000367 +13 0.023679 0.000092 +S 13 +1 73.977737 -0.000183 +2 37.684349 0.002704 +3 19.278723 -0.022650 +4 12.130763 0.007181 +5 7.453002 0.087705 +6 3.756296 0.047616 +7 2.084137 -0.125672 +8 0.993314 -0.244571 +9 0.483094 -0.198419 +10 0.225854 0.030889 +11 0.115338 0.423935 +12 0.052134 0.576941 +13 0.023679 0.148323 +S 13 +1 73.977737 -0.000327 +2 37.684349 0.005309 +3 19.278723 -0.046905 +4 12.130763 0.015411 +5 7.453002 0.191697 +6 3.756296 0.099759 +7 2.084137 -0.338994 +8 0.993314 -0.695806 +9 0.483094 -0.007315 +10 0.225854 1.118599 +11 0.115338 0.717257 +12 0.052134 -0.868565 +13 0.023679 -0.467186 +S 13 +1 73.977737 -0.000698 +2 37.684349 0.010207 +3 19.278723 -0.091261 +4 12.130763 0.052207 +5 7.453002 0.342164 +6 3.756296 0.174866 +7 2.084137 -0.994258 +8 0.993314 -1.190604 +9 0.483094 2.271834 +10 0.225854 1.003013 +11 0.115338 -2.605235 +12 0.052134 0.265158 +13 0.023679 0.902286 +S 1 +1 0.023679 1.0 +S 1 +1 0.011 1.0 +P 13 +1 101.951240 0.000088 +2 52.309865 -0.000747 +3 27.142574 0.007135 +4 15.066862 -0.014702 +5 9.693669 -0.073353 +6 4.985710 0.012007 +7 2.761266 0.283117 +8 1.417673 0.440786 +9 0.728201 0.306775 +10 0.378189 0.081804 +11 0.189359 0.008839 +12 0.072301 0.001022 +13 0.037471 0.000325 +P 13 +1 101.951240 0.000028 +2 52.309865 -0.000085 +3 27.142574 -0.000751 +4 15.066862 0.000844 +5 9.693669 0.022656 +6 4.985710 -0.012781 +7 2.761266 -0.062386 +8 1.417673 -0.143581 +9 0.728201 -0.062281 +10 0.378189 -0.054471 +11 0.189359 0.377135 +12 0.072301 0.471633 +13 0.037471 0.311624 +P 13 +1 101.951240 -0.000137 +2 52.309865 0.000932 +3 27.142574 -0.006845 +4 15.066862 0.019831 +5 9.693669 0.043647 +6 4.985710 -0.019289 +7 2.761266 -0.281187 +8 1.417673 -0.370298 +9 0.728201 -0.199873 +10 0.378189 1.028552 +11 0.189359 0.423711 +12 0.072301 -0.800926 +13 0.037471 -0.141910 +P 13 +1 101.951240 0.000027 +2 52.309865 0.000180 +3 27.142574 -0.005742 +4 15.066862 0.020419 +5 9.693669 0.100527 +6 4.985710 -0.100608 +7 2.761266 -0.607746 +8 1.417673 -0.601705 +9 0.728201 1.450905 +10 0.378189 0.672299 +11 0.189359 -1.904823 +12 0.072301 0.665814 +13 0.037471 0.348522 +P 1 +1 0.037471 1.0 +P 1 +1 0.018 1.0 +D 11 +1 120.683729 -0.000006 +2 42.646591 0.003111 +3 21.154405 0.028641 +4 9.708242 0.076222 +5 4.614990 0.170595 +6 2.243726 0.266908 +7 1.086491 0.311039 +8 0.524700 0.267312 +9 0.255752 0.163336 +10 0.121497 0.062782 +11 0.054339 0.007872 +D 11 +1 120.683729 0.000017 +2 42.646591 -0.003576 +3 21.154405 -0.031476 +4 9.708242 -0.087583 +5 4.614990 -0.195740 +6 2.243726 -0.270132 +7 1.086491 -0.170034 +8 0.524700 0.143412 +9 0.255752 0.408687 +10 0.121497 0.370257 +11 0.054339 0.123112 +D 11 +1 120.683729 0.000040 +2 42.646591 -0.005181 +3 21.154405 -0.043393 +4 9.708242 -0.127734 +5 4.614990 -0.282070 +6 2.243726 -0.288390 +7 1.086491 0.168269 +8 0.524700 0.673062 +9 0.255752 0.099196 +10 0.121497 -0.570612 +11 0.054339 -0.297197 +D 1 +1 0.054339 1.0 +D 1 +1 0.026 1.0 +F 1 +1 0.133195 1.0 +F 1 +1 0.558910 1.0 +F 1 +1 2.34529 1.0 +G 1 +1 0.436321 1.0 +G 1 +1 1.422099 1.0 + +FLUORINE +S 9 + 1 71.1739093 -0.0000571 + 2 33.3990384 0.0003627 + 3 15.6728186 0.0095329 + 4 7.35462020 -0.1270651 + 5 3.45122590 0.0115271 + 6 1.61952080 0.2905840 + 7 0.75997570 0.4485667 + 8 0.35662590 0.3123056 + 9 0.16735010 0.0656252 +S 1 + 1 2.289795 1.000000 +S 1 +1 0.327712 1.000000 +P 9 + 1 27.8630509 0.0037577 + 2 13.6624747 0.0434953 + 3 6.69931000 0.0930502 + 4 3.28496520 0.1772930 + 5 1.61076240 0.2617590 + 6 0.78982740 0.2896868 + 7 0.38728700 0.2433414 + 8 0.18990380 0.1254957 + 9 0.09311810 0.0268434 +P 1 + 1 0.804181 1.000000 +P 1 + 1 0.243660 1.000000 +D 1 + 1 3.297425 1.000000 +D 1 + 1 0.900763 1.000000 +F 1 + 1 1.859274 1.000000 + +IRON +S 13 +1 84.322332 0.000785 +2 44.203528 -0.012781 +3 23.288963 0.104635 +4 13.385163 -0.119385 +5 7.518052 -0.339804 +6 4.101835 -0.049994 +7 2.253571 0.476955 +8 1.134924 0.593222 +9 0.561550 0.200151 +10 0.201961 0.008591 +11 0.108698 -0.002188 +12 0.053619 0.000677 +13 0.025823 -0.000144 +S 13 +1 84.322332 -0.000162 +2 44.203528 0.002921 +3 23.288963 -0.025466 +4 13.385163 0.031182 +5 7.518052 0.086849 +6 4.101835 0.006846 +7 2.253571 -0.131856 +8 1.134924 -0.227746 +9 0.561550 -0.173079 +10 0.201961 0.136142 +11 0.108698 0.434013 +12 0.053619 0.477555 +13 0.025823 0.128804 +S 13 +1 84.322332 0.000002 +2 44.203528 0.004103 +3 23.288963 -0.046840 +4 13.385163 0.052833 +5 7.518052 0.218094 +6 4.101835 -0.044999 +7 2.253571 -0.287386 +8 1.134924 -0.713220 +9 0.561550 0.249174 +10 0.201961 1.299872 +11 0.108698 0.192119 +12 0.053619 -0.658616 +13 0.025823 -0.521047 +S 13 +1 84.322332 0.000012 +2 44.203528 0.007598 +3 23.288963 -0.094133 +4 13.385163 0.127655 +5 7.518052 0.435598 +6 4.101835 -0.147911 +7 2.253571 -1.084477 +8 1.134924 -0.887003 +9 0.561550 2.449946 +10 0.201961 0.167976 +11 0.108698 -2.114668 +12 0.053619 0.452579 +13 0.025823 0.801444 +S 1 +1 0.025823 1.0 +S 1 +1 0.012 1.0 +P 13 +1 125.092775 0.000056 +2 65.211589 -0.000572 +3 34.437599 0.007388 +4 18.930704 -0.028481 +5 10.873415 -0.063005 +6 6.012172 0.024855 +7 3.372205 0.277474 +8 1.768641 0.425386 +9 0.914516 0.314145 +10 0.460895 0.090422 +11 0.204490 0.006977 +12 0.074741 0.001154 +13 0.035671 0.000303 +P 13 +1 125.092775 0.000025 +2 65.211589 -0.000070 +3 34.437599 -0.001042 +4 18.930704 0.005127 +5 10.873415 0.018404 +6 6.012172 -0.014692 +7 3.372205 -0.061307 +8 1.768641 -0.128638 +9 0.914516 -0.070637 +10 0.460895 -0.016314 +11 0.204490 0.380702 +12 0.074741 0.523071 +13 0.035671 0.235765 +P 13 +1 125.092775 -0.000197 +2 65.211589 0.001251 +3 34.437599 -0.009154 +4 18.930704 0.038201 +5 10.873415 0.043097 +6 6.012172 -0.029475 +7 3.372205 -0.426996 +8 1.768641 -0.394840 +9 0.914516 0.077230 +10 0.460895 1.119881 +11 0.204490 -0.066494 +12 0.074741 -0.721583 +13 0.035671 -0.005695 +P 13 +1 125.092775 0.000264 +2 65.211589 -0.001076 +3 34.437599 -0.002591 +4 18.930704 0.035519 +5 10.873415 0.119554 +6 6.012172 -0.204714 +7 3.372205 -0.760627 +8 1.768641 -0.262740 +9 0.914516 1.779030 +10 0.460895 -0.462742 +11 0.204490 -1.241030 +12 0.074741 0.940987 +13 0.035671 0.083496 +P 1 +1 0.035671 1.0 +P 1 +1 0.017 1.0 +D 11 +1 152.736742 0.000029 +2 50.772485 0.005238 +3 26.253589 0.029325 +4 12.137022 0.074901 +5 5.853719 0.163411 +6 2.856224 0.251057 +7 1.386132 0.287603 +8 0.670802 0.251862 +9 0.330280 0.186736 +10 0.170907 0.093570 +11 0.086794 0.073811 +D 11 +1 152.736742 -0.000026 +2 50.772485 -0.006329 +3 26.253589 -0.034398 +4 12.137022 -0.091765 +5 5.853719 -0.201592 +6 2.856224 -0.283930 +7 1.386132 -0.161981 +8 0.670802 0.128822 +9 0.330280 0.360160 +10 0.170907 0.277592 +11 0.086794 0.261403 +D 11 +1 152.736742 0.000051 +2 50.772485 0.008769 +3 26.253589 0.047921 +4 12.137022 0.132475 +5 5.853719 0.297279 +6 2.856224 0.275018 +7 1.386132 -0.222842 +8 0.670802 -0.619067 +9 0.330280 -0.076290 +10 0.170907 0.256056 +11 0.086794 0.541482 +D 1 +1 0.086794 1.0 +D 1 +1 0.04 1.0 +F 1 +1 0.200905 1.0 +F 1 +1 0.824745 1.0 +F 1 +1 3.385699 1.0 +G 1 +1 0.679723 1.0 +G 1 +1 2.137024 1.0 + +MANGANESE +S 13 +1 76.015816 0.000992 +2 39.287425 -0.014765 +3 20.413997 0.120351 +4 12.220632 -0.123547 +5 7.180198 -0.319950 +6 3.850598 -0.106021 +7 2.142243 0.472317 +8 1.049440 0.620499 +9 0.508652 0.204890 +10 0.192102 0.005983 +11 0.108912 -0.000130 +12 0.053405 -0.000175 +13 0.025223 0.000059 +S 13 +1 76.015816 -0.000199 +2 39.287425 0.003344 +3 20.413997 -0.029317 +4 12.220632 0.031960 +5 7.180198 0.083084 +6 3.850598 0.021364 +7 2.142243 -0.129827 +8 1.049440 -0.238808 +9 0.508652 -0.180485 +10 0.192102 0.109481 +11 0.108912 0.404375 +12 0.053405 0.517748 +13 0.025223 0.148273 +S 13 +1 76.015816 -0.000091 +2 39.287425 0.005358 +3 20.413997 -0.058289 +4 12.220632 0.056077 +5 7.180198 0.227722 +6 3.850598 -0.008293 +7 2.142243 -0.320247 +8 1.049440 -0.812449 +9 0.508652 0.324723 +10 0.192102 1.446872 +11 0.108912 0.022988 +12 0.053405 -0.677035 +13 0.025223 -0.454415 +S 13 +1 76.015816 -0.000522 +2 39.287425 0.011330 +3 20.413997 -0.115565 +4 12.220632 0.148466 +5 7.180198 0.360618 +6 3.850598 0.024570 +7 2.142243 -1.167352 +8 1.049440 -0.874860 +9 0.508652 2.547289 +10 0.192102 0.100010 +11 0.108912 -2.213201 +12 0.053405 0.464675 +13 0.025223 0.834977 +S 1 +1 0.025223 1.0 +S 1 +1 0.012 1.0 +P 13 +1 113.478683 0.000103 +2 58.149046 -0.000896 +3 30.029824 0.008851 +4 16.750395 -0.019576 +5 10.714033 -0.069249 +6 5.558478 0.011297 +7 3.080496 0.282218 +8 1.582818 0.438781 +9 0.810731 0.309937 +10 0.413383 0.083951 +11 0.195719 0.007553 +12 0.072184 0.001106 +13 0.035923 0.000285 +P 13 +1 113.478683 0.000021 +2 58.149046 -0.000034 +3 30.029824 -0.001184 +4 16.750395 0.002162 +5 10.714033 0.020978 +6 5.558478 -0.011826 +7 3.080496 -0.062380 +8 1.582818 -0.137615 +9 0.810731 -0.065755 +10 0.413383 -0.033911 +11 0.195719 0.382515 +12 0.072184 0.508959 +13 0.035923 0.257840 +P 13 +1 113.478683 -0.000200 +2 58.149046 0.001371 +3 30.029824 -0.010181 +4 16.750395 0.030762 +5 10.714033 0.045983 +6 5.558478 -0.017031 +7 3.080496 -0.397037 +8 1.582818 -0.418005 +9 0.810731 0.073119 +10 0.413383 1.095819 +11 0.195719 0.003833 +12 0.072184 -0.756970 +13 0.035923 -0.040676 +P 13 +1 113.478683 0.000014 +2 58.149046 0.000421 +3 30.029824 -0.008582 +4 16.750395 0.038725 +5 10.714033 0.099454 +6 5.558478 -0.144661 +7 3.080496 -0.821188 +8 1.582818 -0.249872 +9 0.810731 1.789394 +10 0.413383 -0.399933 +11 0.195719 -1.289110 +12 0.072184 0.845789 +13 0.035923 0.147713 +P 1 +1 0.035923 1.0 +P 1 +1 0.017 1.0 +D 11 +1 132.688043 0.000030 +2 45.257740 0.005308 +3 23.264934 0.029187 +4 10.604446 0.076880 +5 5.075071 0.168742 +6 2.470085 0.256971 +7 1.206045 0.289895 +8 0.590669 0.257087 +9 0.292045 0.181613 +10 0.149158 0.089726 +11 0.076548 0.034455 +D 11 +1 132.688043 -0.000021 +2 45.257740 -0.005463 +3 23.264934 -0.029079 +4 10.604446 -0.079946 +5 5.075071 -0.174638 +6 2.470085 -0.253480 +7 1.206045 -0.173991 +8 0.590669 0.045744 +9 0.292045 0.346287 +10 0.149158 0.263668 +11 0.076548 0.370832 +D 11 +1 132.688043 0.000060 +2 45.257740 0.008408 +3 23.264934 0.045875 +4 10.604446 0.129436 +5 5.075071 0.284631 +6 2.470085 0.270459 +7 1.206045 -0.102755 +8 0.590669 -0.580996 +9 0.292045 -0.180748 +10 0.149158 0.022553 +11 0.076548 0.722502 +D 1 +1 0.076548 1.0 +D 1 +1 0.03 1.0 +F 1 +1 0.162649 1.0 +F 1 +1 0.678412 1.0 +F 1 +1 2.829664 1.0 +G 1 +1 0.542598 1.0 +G 1 +1 1.744831 1.0 + +NICKEL +S 13 +1 97.609231 0.000688 +2 51.795589 -0.014336 +3 27.566909 0.121035 +4 15.531444 -0.144503 +5 8.990857 -0.360791 +6 4.804810 -0.003243 +7 2.574616 0.497736 +8 1.332789 0.552240 +9 0.678890 0.196852 +10 0.231285 0.010794 +11 0.120013 -0.003782 +12 0.057871 0.001393 +13 0.027793 -0.000334 +S 13 +1 97.609231 -0.000136 +2 51.795589 0.003181 +3 27.566909 -0.028405 +4 15.531444 0.036601 +5 8.990857 0.086336 +6 4.804810 -0.001113 +7 2.574616 -0.136410 +8 1.332789 -0.206882 +9 0.678890 -0.163365 +10 0.231285 0.143310 +11 0.120013 0.450561 +12 0.057871 0.458900 +13 0.027793 0.116636 +S 13 +1 97.609231 -0.000144 +2 51.795589 0.003299 +3 27.566909 -0.029379 +4 15.531444 0.038039 +5 8.990857 0.088752 +6 4.804810 -0.001605 +7 2.574616 -0.142926 +8 1.332789 -0.206444 +9 0.678890 -0.160922 +10 0.231285 0.137129 +11 0.120013 0.452051 +12 0.057871 0.453964 +13 0.027793 0.122926 +S 13 +1 97.609231 0.000165 +2 51.795589 0.004044 +3 27.566909 -0.051760 +4 15.531444 0.062082 +5 8.990857 0.222547 +6 4.804810 -0.077776 +7 2.574616 -0.289946 +8 1.332789 -0.660866 +9 0.678890 0.279645 +10 0.231285 1.245781 +11 0.120013 0.119337 +12 0.057871 -0.566533 +13 0.027793 -0.560143 +S 1 +1 0.027793 1.0 +S 1 +1 0.013 1.0 +P 13 +1 148.055334 0.000088 +2 72.086134 -0.001119 +3 34.462396 0.021186 +4 19.703322 -0.070032 +5 15.218321 -0.047471 +6 7.500730 0.023137 +7 4.198271 0.275852 +8 2.159830 0.433799 +9 1.103715 0.310152 +10 0.573058 0.089124 +11 0.296213 0.010970 +12 0.087733 0.001132 +13 0.036681 0.000101 +P 13 +1 148.055334 0.000055 +2 72.086134 -0.000191 +3 34.462396 -0.002043 +4 19.703322 0.003428 +5 15.218321 0.023890 +6 7.500730 -0.019526 +7 4.198271 -0.041199 +8 2.159830 -0.138172 +9 1.103715 -0.018608 +10 0.573058 -0.118437 +11 0.296213 0.355825 +12 0.087733 0.604126 +13 0.036681 0.252636 +P 13 +1 148.055334 -0.000165 +2 72.086134 0.001444 +3 34.462396 -0.022779 +4 19.703322 0.103668 +5 15.218321 -0.002949 +6 7.500730 -0.008709 +7 4.198271 -0.449059 +8 2.159830 -0.387352 +9 1.103715 0.075969 +10 0.573058 1.025025 +11 0.296213 0.064695 +12 0.087733 -0.729963 +13 0.036681 -0.002806 +P 13 +1 148.055334 0.000029 +2 72.086134 -0.000760 +3 34.462396 0.024992 +4 19.703322 -0.139884 +5 15.218321 -0.010167 +6 7.500730 0.082158 +7 4.198271 0.887724 +8 2.159830 0.082508 +9 1.103715 -1.396107 +10 0.573058 -0.189149 +11 0.296213 1.539261 +12 0.087733 -0.786978 +13 0.036681 -0.131069 +P 1 +1 0.036681 1.0 +P 1 +1 0.018 1.0 +D 11 +1 177.801510 -0.000015 +2 61.108038 0.002224 +3 30.508234 0.026045 +4 14.144383 0.092837 +5 6.846193 0.186362 +6 3.363485 0.268726 +7 1.645977 0.295256 +8 0.795663 0.251833 +9 0.384212 0.161292 +10 0.189273 0.070970 +11 0.091549 0.022879 +D 11 +1 177.801510 0.000016 +2 61.108038 -0.002556 +3 30.508234 -0.029764 +4 14.144383 -0.108691 +5 6.846193 -0.223408 +6 3.363485 -0.283618 +7 1.645977 -0.120676 +8 0.795663 0.193509 +9 0.384212 0.377891 +10 0.189273 0.297292 +11 0.091549 0.174221 +D 11 +1 177.801510 -0.000004 +2 61.108038 0.003190 +3 30.508234 0.038575 +4 14.144383 0.144009 +5 6.846193 0.306792 +6 3.363485 0.241988 +7 1.645977 -0.292647 +8 0.795663 -0.584145 +9 0.384212 -0.027638 +10 0.189273 0.403706 +11 0.091549 0.421169 +D 1 +1 0.091549 1.0 +D 1 +1 0.04 1.0 +F 1 +1 0.283943 1.0 +F 1 +1 1.149919 1.0 +F 1 +1 4.656966 1.0 +G 1 +1 0.995016 1.0 +G 1 +1 2.993316 1.0 + +OXYGEN +S 9 +1 54.775216 -0.0012444 +2 25.616801 0.0107330 +3 11.980245 0.0018889 +4 6.992317 -0.1742537 +5 2.620277 0.0017622 +6 1.225429 0.3161846 +7 0.577797 0.4512023 +8 0.268022 0.3121534 +9 0.125346 0.0511167 +S 1 +1 1.686633 1.0000000 +S 1 +1 0.237997 1.0000000 +P 9 +1 22.217266 0.0104866 +2 10.74755 0.0366435 +3 5.315785 0.0803674 +4 2.660761 0.1627010 +5 1.331816 0.2377791 +6 0.678626 0.2811422 +7 0.333673 0.2643189 +8 0.167017 0.1466014 +9 0.083598 0.0458145 +P 1 +1 0.600621 1.0000000 +P 1 +1 0.184696 1.0000000 +D 1 +1 2.404278 1.0000000 +D 1 +1 0.669340 1.0000000 +F 1 +1 1.423104 1.0000000 + +SULFUR +S 11 +1 315.24967840 0.000233 +2 141.17315500 -0.000557 +3 63.21928635 0.007846 +4 28.31046857 -0.139746 +5 12.67781838 0.011705 +6 5.67730197 0.400954 +7 2.54237414 0.562552 +8 1.13851021 0.135102 +9 0.50984058 0.004551 +10 0.22831365 0.000131 +11 0.10224200 0.000385 +S 11 +1 315.24967840 -0.000035 +2 141.17315500 -0.000046 +3 63.21928635 -0.001545 +4 28.31046857 0.046561 +5 12.67781838 -0.007204 +6 5.67730197 -0.163807 +7 2.54237414 -0.356328 +8 1.13851021 -0.102388 +9 0.50984058 0.476460 +10 0.22831365 0.568771 +11 0.10224200 0.183715 +S 1 +1 0.154095 1.000000 +S 1 +1 0.998096 1.000000 +P 11 +1 105.77262714 -0.000130 +2 50.58545925 0.016880 +3 24.19235256 0.158150 +4 11.56992407 0.258667 +5 5.53328341 0.356166 +6 2.64627711 0.294147 +7 1.26557453 0.091060 +8 0.60525743 0.007367 +9 0.28946265 0.000547 +10 0.13843469 0.000553 +11 0.06620600 -0.000031 +P 11 +1 105.77262714 -0.000224 +2 50.58545925 0.005129 +3 24.19235256 0.038613 +4 11.56992407 0.068551 +5 5.53328341 0.100274 +6 2.64627711 0.091605 +7 1.26557453 -0.063653 +8 0.60525743 -0.290231 +9 0.28946265 -0.414484 +10 0.13843469 -0.297929 +11 0.06620600 -0.101003 +P 1 +1 0.118377 1.000000 +P 1 +1 0.806689 1.000000 +D 1 +1 0.803728 1.000000 +D 1 +1 0.269530 1.000000 +F 1 +1 0.559459 1.000000 + +SCANDIUM +S 13 +1 66.885341 0.000530 +2 33.819599 -0.004820 +3 18.254490 0.001497 +4 11.808446 0.125425 +5 6.900398 -0.270066 +6 3.228933 -0.326605 +7 1.773981 0.289735 +8 0.840523 0.630457 +9 0.472620 0.269883 +10 0.314717 0.139047 +11 0.100371 0.008111 +12 0.048701 -0.002666 +13 0.022635 0.000614 +S 13 +1 66.885341 -0.000134 +2 33.819599 0.001271 +3 18.254490 -0.000752 +4 11.808446 -0.033037 +5 6.900398 0.075355 +6 3.228933 0.090312 +7 1.773981 -0.089219 +8 0.840523 -0.216505 +9 0.472620 -0.176500 +10 0.314717 -0.131181 +11 0.100371 0.341614 +12 0.048701 0.608966 +13 0.022635 0.240473 +S 13 +1 66.885341 -0.000687 +2 33.819599 0.005444 +3 18.254490 -0.015884 +4 11.808446 -0.032814 +5 6.900398 0.108358 +6 3.228933 0.235631 +7 1.773981 -0.311150 +8 0.840523 -0.234723 +9 0.472620 -1.200718 +10 0.314717 1.048196 +11 0.100371 1.607623 +12 0.048701 -0.643134 +13 0.022635 -0.837339 +S 13 +1 66.885341 -0.001496 +2 33.819599 0.011574 +3 18.254490 -0.039542 +4 11.808446 -0.025971 +5 6.900398 0.153997 +6 3.228933 0.460404 +7 1.773981 -0.772294 +8 0.840523 -0.578586 +9 0.472620 -1.812898 +10 0.314717 3.681098 +11 0.100371 -0.583535 +12 0.048701 -2.233456 +13 0.022635 1.905246 +S 1 +1 0.022635 1.0 +S 1 +1 0.011 1.0 +P 13 +1 77.687965 0.000088 +2 39.720143 -0.000755 +3 20.588415 0.006537 +4 11.552484 -0.005944 +5 7.633071 -0.070539 +6 3.765354 -0.014599 +7 2.056424 0.249676 +8 1.048311 0.436532 +9 0.549190 0.325322 +10 0.304981 0.103373 +11 0.166817 0.018978 +12 0.061588 0.001353 +13 0.024836 0.000122 +P 13 +1 77.687965 0.000012 +2 39.720143 0.000002 +3 20.588415 -0.000950 +4 11.552484 -0.000472 +5 7.633071 0.021251 +6 3.765354 -0.002758 +7 2.056424 -0.060262 +8 1.048311 -0.141394 +9 0.549190 -0.081787 +10 0.304981 -0.099327 +11 0.166817 0.309280 +12 0.061588 0.623105 +13 0.024836 0.261500 +P 13 +1 77.687965 -0.000053 +2 39.720143 0.000499 +3 20.588415 -0.004884 +4 11.552484 0.005449 +5 7.633071 0.055621 +6 3.765354 0.002727 +7 2.056424 -0.232938 +8 1.048311 -0.500050 +9 0.549190 -0.218611 +10 0.304981 0.886574 +11 0.166817 0.657112 +12 0.061588 -0.824086 +13 0.024836 -0.171436 +P 13 +1 77.687965 -0.000269 +2 39.720143 0.001710 +3 20.588415 -0.010083 +4 11.552484 0.018798 +5 7.633071 0.049498 +6 3.765354 0.048059 +7 2.056424 -0.409386 +8 1.048311 -0.813409 +9 0.549190 0.676043 +10 0.304981 2.270655 +11 0.166817 -2.757013 +12 0.061588 0.557954 +13 0.024836 0.499453 +P 1 +1 0.024836 1.0 +P 1 +1 0.012 1.0 +D 11 +1 60.996922 0.000056 +2 22.088926 0.005065 +3 10.187383 0.031740 +4 4.631390 0.082146 +5 2.148130 0.159084 +6 1.015784 0.228110 +7 0.487874 0.244131 +8 0.247348 0.234199 +9 0.129854 0.196760 +10 0.062998 0.212891 +11 0.021310 0.072798 +D 11 +1 60.996922 -0.000073 +2 22.088926 -0.006086 +3 10.187383 -0.038466 +4 4.631390 -0.100226 +5 2.148130 -0.193890 +6 1.015784 -0.253318 +7 0.487874 -0.214480 +8 0.247348 0.054136 +9 0.129854 0.267168 +10 0.062998 0.517020 +11 0.021310 0.163524 +D 11 +1 60.996922 0.000057 +2 22.088926 0.008199 +3 10.187383 0.049365 +4 4.631390 0.135710 +5 2.148130 0.246153 +6 1.015784 0.258979 +7 0.487874 -0.122052 +8 0.247348 -0.447750 +9 0.129854 -0.469557 +10 0.062998 0.534917 +11 0.021310 0.466434 +D 1 +1 0.021310 1.0 +D 1 +1 0.01 1.0 +F 1 +1 0.04021 1.0 +F 1 +1 0.172508 1.0 +F 1 +1 0.740081 1.0 +G 1 +1 0.132194 1.0 +G 1 +1 0.411857 1.0 + +TITANIUM +S 13 +1 68.910511 0.000616 +2 33.720700 -0.007501 +3 18.159676 0.012218 +4 12.419305 0.144739 +5 7.532195 -0.328621 +6 3.504444 -0.317517 +7 1.910727 0.357422 +8 0.888840 0.671406 +9 0.447198 0.282226 +10 0.281192 0.038673 +11 0.100258 0.004559 +12 0.046525 -0.001565 +13 0.021840 0.000398 +S 13 +1 68.910511 -0.000156 +2 33.720700 0.001966 +3 18.159676 -0.003994 +4 12.419305 -0.036377 +5 7.532195 0.088593 +6 3.504444 0.085630 +7 1.910727 -0.105993 +8 0.888840 -0.237421 +9 0.447198 -0.235359 +10 0.281192 -0.012960 +11 0.100258 0.433582 +12 0.046525 0.577873 +13 0.021840 0.164360 +S 13 +1 68.910511 0.000635 +2 33.720700 -0.006468 +3 18.159676 0.023444 +4 12.419305 0.038921 +5 7.532195 -0.141180 +6 3.504444 -0.214765 +7 1.910727 0.320151 +8 0.888840 0.451062 +9 0.447198 0.855191 +10 0.281192 -1.209224 +11 0.100258 -1.319481 +12 0.046525 0.866517 +13 0.021840 0.618916 +S 13 +1 68.910511 -0.001178 +2 33.720700 0.011877 +3 18.159676 -0.047240 +4 12.419305 -0.050922 +5 7.532195 0.237746 +6 3.504444 0.403185 +7 1.910727 -0.790961 +8 0.888840 -1.102276 +9 0.447198 0.209446 +10 0.281192 2.527352 +11 0.100258 -1.789041 +12 0.046525 -0.867842 +13 0.021840 1.427395 +S 1 +1 0.021840 1.0 +S 1 +1 0.01 1.0 +P 13 +1 84.914002 0.000093 +2 42.855051 -0.000836 +3 21.700131 0.008679 +4 12.214690 -0.011178 +5 8.319164 -0.077767 +6 4.091071 -0.006113 +7 2.286543 0.271828 +8 1.159810 0.459585 +9 0.591343 0.315900 +10 0.312862 0.071683 +11 0.184828 0.010541 +12 0.068590 0.000045 +13 0.026791 -0.000837 +P 13 +1 84.914002 0.000020 +2 42.855051 -0.000049 +3 21.700131 -0.000761 +4 12.214690 -0.000575 +5 8.319164 0.018284 +6 4.091071 -0.005943 +7 2.286543 -0.043212 +8 1.159810 -0.112513 +9 0.591343 -0.052073 +10 0.312862 -0.092263 +11 0.184828 0.243946 +12 0.068590 0.413101 +13 0.026791 0.543985 +P 13 +1 84.914002 0.000019 +2 42.855051 0.000138 +3 21.700131 -0.004622 +4 12.214690 0.004465 +5 8.319164 0.065760 +6 4.091071 -0.018927 +7 2.286543 -0.222524 +8 1.159810 -0.523890 +9 0.591343 -0.071277 +10 0.312862 0.812712 +11 0.184828 0.625498 +12 0.068590 -0.812189 +13 0.026791 -0.185796 +P 13 +1 84.914002 -0.000257 +2 42.855051 0.001725 +3 21.700131 -0.012646 +4 12.214690 0.029062 +5 8.319164 0.058979 +6 4.091071 0.030806 +7 2.286543 -0.524373 +8 1.159810 -0.720968 +9 0.591343 1.023204 +10 0.312862 1.973874 +11 0.184828 -2.805092 +12 0.068590 0.607954 +13 0.026791 0.447653 +P 1 +1 0.026791 1.0 +P 1 +1 0.013 1.0 +D 11 +1 77.434559 0.000022 +2 27.708477 0.004218 +3 12.914284 0.030087 +4 6.062674 0.084821 +5 2.863898 0.171110 +6 1.386559 0.247451 +7 0.677058 0.277310 +8 0.329864 0.261077 +9 0.159474 0.190336 +10 0.076174 0.119385 +11 0.028570 0.031297 +D 11 +1 77.434559 -0.000025 +2 27.708477 -0.004311 +3 12.914284 -0.030913 +4 6.062674 -0.088049 +5 2.863898 -0.178330 +6 1.386559 -0.234335 +7 0.677058 -0.195775 +8 0.329864 0.065872 +9 0.159474 0.330536 +10 0.076174 0.461229 +11 0.028570 0.184273 +D 11 +1 77.434559 0.000010 +2 27.708477 0.006187 +3 12.914284 0.042630 +4 6.062674 0.127524 +5 2.863898 0.248289 +6 1.386559 0.259761 +7 0.677058 -0.070794 +8 0.329864 -0.519396 +9 0.159474 -0.373658 +10 0.076174 0.455067 +11 0.028570 0.489586 +D 1 +1 0.028570 1.0 +D 1 +1 0.014 1.0 +F 1 +1 0.066981 1.0 +F 1 +1 0.291553 1.0 +F 1 +1 1.269061 1.0 +G 1 +1 0.227422 1.0 +G 1 +1 0.707265 1.0 + +VANADIUM +S 13 +1 68.577621 0.000804 +2 34.937147 -0.011594 +3 17.939491 0.092209 +4 11.262123 -0.045477 +5 6.776264 -0.287983 +6 3.524091 -0.217648 +7 1.938421 0.407509 +8 0.927153 0.658193 +9 0.448420 0.255234 +10 0.209668 0.008620 +11 0.103660 0.002734 +12 0.050630 -0.001161 +13 0.024201 0.000294 +S 13 +1 68.577621 -0.000177 +2 34.937147 0.002791 +3 17.939491 -0.023650 +4 11.262123 0.012504 +5 6.776264 0.078761 +6 3.524091 0.054974 +7 1.938421 -0.118955 +8 0.927153 -0.245341 +9 0.448420 -0.222959 +10 0.209668 0.047809 +11 0.103660 0.415374 +12 0.050630 0.540880 +13 0.024201 0.183421 +S 13 +1 68.577621 -0.000583 +2 34.937147 0.009570 +3 17.939491 -0.085606 +4 11.262123 0.048426 +5 6.776264 0.331239 +6 3.524091 0.140352 +7 1.938421 -0.907962 +8 0.927153 -0.503878 +9 0.448420 0.398938 +10 0.209668 0.971131 +11 0.103660 0.423999 +12 0.050630 -0.628646 +13 0.024201 -0.467495 +S 13 +1 68.577621 -0.000765 +2 34.937147 0.014529 +3 17.939491 -0.139618 +4 11.262123 0.063073 +5 6.776264 0.704193 +6 3.524091 -0.011602 +7 1.938421 -2.311604 +8 0.927153 0.768269 +9 0.448420 2.168920 +10 0.209668 -1.062671 +11 0.103660 -1.218151 +12 0.050630 0.340809 +13 0.024201 0.713322 +S 1 +1 0.024201 1.0 +S 1 +1 0.012 1.0 +P 13 +1 96.215967 0.000069 +2 49.579340 -0.000672 +3 25.638009 0.008199 +4 14.025942 -0.027108 +5 8.740334 -0.053021 +6 4.634840 0.005002 +7 2.553374 0.261986 +8 1.321166 0.433544 +9 0.681285 0.324947 +10 0.349458 0.092342 +11 0.172773 0.008964 +12 0.063300 0.001185 +13 0.033969 0.000104 +P 13 +1 96.215967 0.000040 +2 49.579340 -0.000133 +3 25.638009 -0.000955 +4 14.025942 0.003719 +5 8.740334 0.018866 +6 4.634840 -0.012074 +7 2.553374 -0.057107 +8 1.321166 -0.146433 +9 0.681285 -0.067365 +10 0.349458 -0.068254 +11 0.172773 0.403103 +12 0.063300 0.502668 +13 0.033969 0.261291 +P 13 +1 96.215967 -0.000053 +2 49.579340 0.000023 +3 25.638009 0.004629 +4 14.025942 -0.007755 +5 8.740334 -0.104133 +6 4.634840 -0.017762 +7 2.553374 0.728212 +8 1.321166 0.218826 +9 0.681285 -0.493223 +10 0.349458 -0.838192 +11 0.172773 0.398401 +12 0.063300 0.664589 +13 0.033969 0.033011 +P 13 +1 96.215967 -0.001262 +2 49.579340 0.006419 +3 25.638009 -0.021229 +4 14.025942 0.115777 +5 8.740334 -0.420740 +6 4.634840 0.197742 +7 2.553374 1.575600 +8 1.321166 -1.067913 +9 0.681285 -1.310083 +10 0.349458 1.191147 +11 0.172773 0.550516 +12 0.063300 -0.718788 +13 0.033969 -0.157441 +P 1 +1 0.033969 1.0 +P 1 +1 0.016 1.0 +D 11 +1 89.989649 0.000051 +2 33.132961 0.004804 +3 15.879656 0.029485 +4 7.465803 0.086249 +5 3.551993 0.179728 +6 1.728185 0.261850 +7 0.850498 0.291794 +8 0.417673 0.259356 +9 0.201523 0.174944 +10 0.100711 0.062278 +11 0.058959 0.027653 +D 11 +1 89.989649 -0.000038 +2 33.132961 -0.004590 +3 15.879656 -0.027563 +4 7.465803 -0.082775 +5 3.551993 -0.173494 +6 1.728185 -0.236188 +7 0.850498 -0.149226 +8 0.417673 0.044145 +9 0.201523 0.390500 +10 0.100711 0.203064 +11 0.058959 0.398002 +D 11 +1 89.989649 0.000128 +2 33.132961 0.006652 +3 15.879656 0.044635 +4 7.465803 0.122559 +5 3.551993 0.311147 +6 1.728185 0.288813 +7 0.850498 -0.142246 +8 0.417673 -0.613737 +9 0.201523 -0.123916 +10 0.100711 -0.020235 +11 0.058959 0.733259 +D 1 +1 0.058959 1.0 +D 1 +1 0.027 1.0 +F 1 +1 0.131136 1.0 +F 1 +1 0.552620 1.0 +F 1 +1 2.328788 1.0 +G 1 +1 0.616440 1.0 +G 1 +1 1.977796 1.0 + +ZINC +S 13 + 1 114.485022 0.000429 + 2 61.996430 -0.019339 + 3 40.117132 0.086254 + 4 20.119649 -0.088955 + 5 10.171676 -0.402671 + 6 5.601641 0.067304 + 7 2.864122 0.479215 + 8 1.592779 0.503960 + 9 0.826525 0.222088 + 10 0.263975 0.012203 + 11 0.145302 -0.004300 + 12 0.068195 0.001243 + 13 0.031465 -0.000267 +S 13 + 1 114.485022 -0.000109 + 2 61.996430 0.004459 + 3 40.117132 -0.020067 + 4 20.119649 0.022338 + 5 10.171676 0.096698 + 6 5.601641 -0.021966 + 7 2.864122 -0.128768 + 8 1.592779 -0.181706 + 9 0.826525 -0.162311 + 10 0.263975 0.116264 + 11 0.145302 0.411314 + 12 0.068195 0.494257 + 13 0.031465 0.138103 +S 13 + 1 114.485022 0.000666 + 2 61.996430 0.006269 + 3 40.117132 -0.046603 + 4 20.119649 0.050399 + 5 10.171676 0.363493 + 6 5.601641 -0.242840 + 7 2.864122 -0.382281 + 8 1.592779 -0.861567 + 9 0.826525 0.706077 + 10 0.263975 1.495001 + 11 0.145302 -0.453994 + 12 0.068195 -0.597822 + 13 0.031465 -0.256117 +S 13 + 1 114.485022 0.000704 + 2 61.996430 0.012841 + 3 40.117132 -0.085910 + 4 20.119649 0.117982 + 5 10.171676 0.630164 + 6 5.601641 -0.600344 + 7 2.864122 -1.249060 + 8 1.592779 -0.329498 + 9 0.826525 2.592469 + 10 0.263975 -1.004481 + 11 0.145302 -1.379514 + 12 0.068195 1.046842 + 13 0.031465 0.324676 +S 1 + 1 0.031465 1.0 +S 1 + 1 0.015 1.0 +P 13 + 1 158.770986 -0.000153 + 2 75.802876 0.001893 + 3 44.547824 0.010461 + 4 31.445269 -0.045141 + 5 13.080125 -0.084201 + 6 7.788616 0.104973 + 7 4.195040 0.307714 + 8 2.362276 0.368563 + 9 1.302584 0.286336 + 10 0.660704 0.095156 + 11 0.249042 0.005851 + 12 0.091781 -0.000034 + 13 0.048931 0.000252 +P 13 + 1 158.770986 0.000053 + 2 75.802876 -0.000571 + 3 44.547824 -0.001073 + 4 31.445269 0.007463 + 5 13.080125 0.018676 + 6 7.788616 -0.028090 + 7 4.195040 -0.054438 + 8 2.362276 -0.093744 + 9 1.302584 -0.054169 + 10 0.660704 -0.007972 + 11 0.249042 0.356198 + 12 0.091781 0.412399 + 13 0.048931 0.361321 +P 13 + 1 158.770986 -0.000170 + 2 75.802876 0.000604 + 3 44.547824 -0.019987 + 4 31.445269 0.061153 + 5 13.080125 0.067317 + 6 7.788616 -0.139211 + 7 4.195040 -0.527041 + 8 2.362276 -0.176194 + 9 1.302584 0.037129 + 10 0.660704 1.079322 + 11 0.249042 -0.050149 + 12 0.091781 -0.688971 + 13 0.048931 0.037331 +P 13 + 1 158.770986 -0.000781 + 2 75.802876 0.007855 + 3 44.547824 -0.008671 + 4 31.445269 -0.040553 + 5 13.080125 -0.200062 + 6 7.788616 0.528599 + 7 4.195040 0.528552 + 8 2.362276 0.243576 + 9 1.302584 -1.807182 + 10 0.660704 0.629496 + 11 0.249042 1.137613 + 12 0.091781 -1.067150 + 13 0.048931 0.022190 +P 1 + 1 0.048931 1.0 +P 1 + 1 0.024 1.0 +D 11 + 1 270.014061 -0.000016 + 2 100.161579 0.000696 + 3 43.530609 0.013536 + 4 21.262419 0.069350 + 5 10.577821 0.149559 + 6 5.343620 0.239588 + 7 2.704857 0.286744 + 8 1.353018 0.271459 + 9 0.660873 0.202426 + 10 0.309149 0.103307 + 11 0.133879 0.023211 +D 11 + 1 270.014061 0.000013 + 2 100.161579 -0.000889 + 3 43.530609 -0.018640 + 4 21.262419 -0.094646 + 5 10.577821 -0.215659 + 6 5.343620 -0.322469 + 7 2.704857 -0.197529 + 8 1.353018 0.164448 + 9 0.660873 0.410017 + 10 0.309149 0.327838 + 11 0.133879 0.105749 +D 11 + 1 270.014061 0.000007 + 2 100.161579 0.000868 + 3 43.530609 0.021631 + 4 21.262419 0.107748 + 5 10.577821 0.278997 + 6 5.343620 0.314543 + 7 2.704857 -0.241926 + 8 1.353018 -0.602415 + 9 0.660873 -0.118013 + 10 0.309149 0.545482 + 11 0.133879 0.363829 +D 1 + 1 0.133879 1.0 +D 1 + 1 0.06 1.0 +F 1 + 1 0.385246 1.0 +F 1 + 1 1.520399 1.0 +F 1 + 1 6.000349 1.0 +G 1 + 1 1.418972 1.0 +G 1 + 1 4.099533 1.0 + +COPPER +S 13 +1 104.471138 0.000741 +2 55.955221 -0.013953 +3 30.553953 0.105266 +4 16.942394 -0.129399 +5 9.452707 -0.362738 +6 5.174537 0.013266 +7 2.779171 0.489288 +8 1.441817 0.562088 +9 0.710674 0.190047 +10 0.241540 0.005635 +11 0.129621 -0.000582 +12 0.059229 -0.000024 +13 0.027110 0.000030 +S 13 +1 104.471138 -0.000133 +2 55.955221 0.002999 +3 30.553953 -0.024310 +4 16.942394 0.031986 +5 9.452707 0.089149 +6 5.174537 -0.010750 +7 2.779171 -0.128224 +8 1.441817 -0.215720 +9 0.710674 -0.149559 +10 0.241540 0.142917 +11 0.129621 0.446307 +12 0.059229 0.484643 +13 0.027110 0.093069 +S 13 +1 104.471138 0.000210 +2 55.955221 0.003806 +3 30.553953 -0.047312 +4 16.942394 0.059957 +5 9.452707 0.250642 +6 5.174537 -0.119102 +7 2.779171 -0.314069 +8 1.441817 -0.689300 +9 0.710674 0.403050 +10 0.241540 1.270440 +11 0.129621 -0.029029 +12 0.059229 -0.622157 +13 0.027110 -0.442074 +S 13 +1 104.471138 0.000366 +2 55.955221 0.006720 +3 30.553953 -0.091493 +4 16.942394 0.142263 +5 9.452707 0.471881 +6 5.174537 -0.319708 +7 2.779171 -1.068255 +8 1.441817 -0.615049 +9 0.710674 2.261282 +10 0.241540 -0.020059 +11 0.129621 -1.815746 +12 0.059229 0.474174 +13 0.027110 0.713597 +S 1 +1 0.027110 1.0 +S 1 +1 0.013 1.0 +P 13 +1 159.152840 0.000026 +2 83.322776 -0.000402 +3 44.840311 0.007405 +4 25.020360 -0.030714 +5 13.610016 -0.074348 +6 7.761318 0.043430 +7 4.303947 0.289703 +8 2.290080 0.413467 +9 1.202173 0.303762 +10 0.607647 0.093494 +11 0.257656 0.006663 +12 0.090897 0.000567 +13 0.041925 0.000176 +P 13 +1 159.152840 0.000034 +2 83.322776 -0.000129 +3 44.840311 -0.000802 +4 25.020360 0.004747 +5 13.610016 0.018595 +6 7.761318 -0.017692 +7 4.303947 -0.052614 +8 2.290080 -0.110349 +9 1.202173 -0.054701 +10 0.607647 -0.026655 +11 0.257656 0.335880 +12 0.090897 0.509478 +13 0.041925 0.302559 +P 13 +1 159.152840 -0.000228 +2 83.322776 0.001414 +3 44.840311 -0.010290 +4 25.020360 0.043896 +5 13.610016 0.052865 +6 7.761318 -0.056565 +7 4.303947 -0.480715 +8 2.290080 -0.315984 +9 1.202173 0.075679 +10 0.607647 1.060747 +11 0.257656 -0.008061 +12 0.090897 -0.701601 +13 0.041925 0.006941 +P 13 +1 159.152840 -0.000412 +2 83.322776 0.001957 +3 44.840311 0.000640 +4 25.020360 -0.036753 +5 13.610016 -0.147193 +6 7.761318 0.297782 +7 4.303947 0.705271 +8 2.290080 0.196466 +9 1.202173 -1.659406 +10 0.607647 0.391500 +11 0.257656 1.243284 +12 0.090897 -0.957529 +13 0.041925 -0.056091 +P 1 +1 0.041925 1.0 +P 1 +1 0.02 1.0 +D 11 +1 226.693527 0.000015 +2 73.010278 0.004108 +3 38.536518 0.028223 +4 18.726700 0.069323 +5 9.155485 0.156045 +6 4.540884 0.251238 +7 2.241175 0.297463 +8 1.085869 0.274981 +9 0.510612 0.193098 +10 0.229608 0.086393 +11 0.095781 0.014645 +D 11 +1 226.693527 -0.000013 +2 73.010278 -0.005252 +3 38.536518 -0.034982 +4 18.726700 -0.088950 +5 9.155485 -0.207194 +6 4.540884 -0.302597 +7 2.241175 -0.179327 +8 1.085869 0.169069 +9 0.510612 0.405904 +10 0.229608 0.341871 +11 0.095781 0.117080 +D 11 +1 226.693527 0.000016 +2 73.010278 0.006157 +3 38.536518 0.040361 +4 18.726700 0.106038 +5 9.155485 0.263299 +6 4.540884 0.288496 +7 2.241175 -0.186745 +8 1.085869 -0.591539 +9 0.510612 -0.138681 +10 0.229608 0.547749 +11 0.095781 0.362353 +D 1 +1 0.095781 1.0 +D 1 +1 0.045 1.0 +F 1 +1 0.331485 1.0 +F 1 +1 1.316717 1.0 +F 1 +1 5.230236 1.0 +G 1 +1 1.168290 1.0 +G 1 +1 3.445758 1.0 diff --git a/data/pseudo/ncsu b/data/pseudo/ncsu new file mode 100644 index 00000000..ee17ba13 --- /dev/null +++ b/data/pseudo/ncsu @@ -0,0 +1,183 @@ +H GEN 0 1 +3 +-10.851924053 2 21.7769665504 +1.0 1 21.2435950826 +21.2435950826 3 21.2435950826 +1 +0.0 2 1.0 + +C GEN 2 1 +3 +4.0 1 14.43502 +57.74008 3 8.39889 +-25.81955 2 7.38188 +1 +52.13345 2 7.76079 + +Cl GEN 10 2 +3 +7.0 1 22.71655173 +159.01586213 3 78.57185685 +-15.6531065 2 7.47352436 +2 +6.50888648 2 17.23708573 +46.763467 2 4.31148447 +2 +2.9946477 2 11.38275704 +28.0170341 2 3.83218762 + +Co GEN 10 2 +4 +17.0 1 24.7400138129 +420.580234819 3 23.5426031368 +-194.630579018 2 24.0406241364 +-2.94301943013 2 10.237411369 +2 +270.86974114 2 23.0205711168 +54.1910212498 2 10.9219568474 +2 +200.63032558 2 25.3244045243 +38.9480947892 2 10.6533915029 + +Cr GEN 10 2 +4 +14.0 1 18.2809107439 +255.932750414 3 17.0980065531 +-132.018263171 2 16.7226727605 +-0.773887613451 2 5.02865105891 +2 +219.481462096 2 16.9007876081 +28.079331766 2 7.33662150761 +2 +139.983968717 2 17.3197451654 +19.5483578632 2 6.92409757503 + +F GEN 2 1 +3 +7.0 1 11.3954401213 +79.7680808491 3 10.49201883 +-49.4990068225 2 10.2868054098 +1 +51.3934743997 2 11.3903478843 + +Fe GEN 10 2 +4 +16.0 1 23.2209171361 +371.534674178 3 23.5471467972 +-181.226034452 2 23.4725634461 +-2.3730523614 2 9.85238815041 +2 +277.500325475 2 22.2106269743 +46.2049558527 2 9.51515800919 +2 +194.998750566 2 24.5700087185 +31.6794513291 2 8.86648776669 + +Mn GEN 10 2 +4 +15.0 1 21.9061889166 +328.592833748 3 21.3460106503 +-162.049880237 2 21.2709151562 +-1.85679609726 2 7.90771171833 +2 +244.669998154 2 18.9263045646 +33.5399867643 2 8.31114792811 +2 +162.350195446 2 20.162449313 +24.1593874179 2 7.79269955633 + +Ni GEN 10 2 +4 +18.0 1 37.839331506 +681.107967108 3 23.875701156 +-173.162219465 2 19.8803935987 +0.34274858261 2 3.56565870195 +2 +91.6513902571 2 13.545098213 +331.659352198 2 27.7907700999 +2 +7.5147228016 2 6.46792786898 +265.586894944 2 23.6921476759 + +O GEN 2 1 +3 +6.0 1 12.30997 +73.85984 3 14.76962 +-47.876 2 13.71419 +1 +85.86406 2 13.65512 + +S GEN 2 1 +3 + 14.00000000 1 17.46806994 + 244.55297916 3 16.40396851 + -128.37752591 2 16.71429998 +2 + 30.00006536 2 54.87912854 + 125.50010056 2 31.32968867 + +Sc GEN 10 2 +4 +11.0 1 16.0484863686 +176.533350054 3 14.07764439 +-83.673420518 2 11.993486653 +0.331064789149 2 3.75115298216 +2 +153.959870288 2 11.4712713921 +14.9643185607 2 5.00756742752 +2 +97.2094454291 2 11.4449481137 +10.8162163087 2 4.78509457131 + +Ti GEN 10 2 +4 +12.0 1 18.4136620219 +220.963944263 3 15.9229241432 +-94.2902582468 2 13.6500062314 +0.0979114248227 2 5.0955521057 +2 +173.946572359 2 12.7058061392 +18.8376833381 2 6.11178551988 +2 +111.45672882 2 12.6409192965 +11.1770268269 2 5.35437415684 + +V GEN 10 2 +4 +13.0 1 20.3216891426 +264.181958854 3 19.5969804012 +-115.292932083 2 17.3314734817 +-0.662887260057 2 5.12320657929 +2 +195.567138911 2 15.1250215054 +22.8864283476 2 6.2989891447 +2 +126.421195008 2 15.9385511327 +16.0359712766 2 5.74006266866 + +Zn GEN 10 2 +4 +20.0 1 35.8079761618 +716.159523235 3 34.536460837 +-204.683933235 2 28.6283017827 +0.760266144617 2 7.9623968256 +2 +95.8764043739 2 14.6349869153 +431.708043027 2 35.0214135667 +2 +74.0127004894 2 14.5742930415 +313.577705639 2 42.2297923499 + +Cu GEN 10 2 +4 +19.0 1 31.5381126304 +599.224139977 3 31.0692553147 +-244.689154841 2 30.5903586806 +-1.2934952584 2 14.0514106386 +2 +66.2756081341 2 12.7723591969 +370.71371825 2 29.355622426 +2 +49.7626505709 2 12.5247148487 +271.662810283 2 33.5169454376 + diff --git a/plugins/MRCC_Utils/mrcc_utils.irp.f b/plugins/MRCC_Utils/mrcc_utils.irp.f index ad653c8c..dc739c75 100644 --- a/plugins/MRCC_Utils/mrcc_utils.irp.f +++ b/plugins/MRCC_Utils/mrcc_utils.irp.f @@ -1,6 +1,6 @@ use bitmasks - BEGIN_PROVIDER [ integer, mrmode ] +BEGIN_PROVIDER [ integer, mrmode ] mrmode = 0 END_PROVIDER diff --git a/plugins/mrcepa0/dressing.irp.f b/plugins/mrcepa0/dressing.irp.f index f76a1424..319d0603 100644 --- a/plugins/mrcepa0/dressing.irp.f +++ b/plugins/mrcepa0/dressing.irp.f @@ -216,11 +216,9 @@ subroutine mrcc_part_dress(delta_ij_, delta_ij_s2_, i_generator,n_selected,det_b double precision :: hIk, hla, hIl, sla, dIk(N_states), dka(N_states), dIa(N_states), hka double precision, allocatable :: dIa_hla(:,:), dIa_sla(:,:) double precision :: haj, phase, phase2 - double precision :: f(N_states), ci_inv(N_states) integer :: exc(0:2,2,2) integer :: h1,h2,p1,p2,s1,s2 integer(bit_kind) :: tmp_det(Nint,2) - integer :: iint, ipos integer :: i_state, k_sd, l_sd, i_I, i_alpha integer(bit_kind),allocatable :: miniList(:,:,:) @@ -422,9 +420,6 @@ subroutine mrcc_part_dress(delta_ij_, delta_ij_s2_, i_generator,n_selected,det_b enddo enddo - do i_state=1,N_states - ci_inv(i_state) = psi_ref_coef_inv(i_I,i_state) - enddo do l_sd=1,idx_alpha(0) k_sd = idx_alpha(l_sd) hla = hij_cache(k_sd) @@ -1118,3 +1113,135 @@ end +subroutine get_cc_coef(tq,c_alpha) + use bitmasks + implicit none + + integer(bit_kind), intent(in) :: tq(N_int,2) + double precision, intent(out) :: c_alpha(N_states) + + integer :: k + integer :: degree1, degree2, degree + + double precision :: hla, hka, dIk(N_states), dka(N_states), dIa(N_states) + 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) + integer :: i_state, k_sd, l_sd, i_I + logical :: ok + + if (perturbative_triples) then + PROVIDE one_anhil fock_virt_total fock_core_inactive_total one_creat + endif + + + c_alpha(1:N_states) = 0.d0 + + do i_I=1,N_det_ref + ! Find triples and quadruple grand parents + call get_excitation_degree(tq,psi_ref(1,1,i_I),degree1,N_int) + if (degree1 < 3) then + return + endif + enddo + + ! |I> + do i_I=1,N_det_ref + ! Find triples and quadruple grand parents + call get_excitation_degree(tq,psi_ref(1,1,i_I),degree1,N_int) + if (degree1 > 4) then + cycle + endif + if ( (degree1 < 3).or.(degree1 > 4) ) stop 'bug' + + do i_state=1,N_states + dIa(i_state) = 0.d0 + enddo + + ! |alpha> + do k_sd=1,N_det_non_ref + + call get_excitation_degree(tq,psi_non_ref(1,1,k_sd),degree,N_int) + if (degree > 2) then + cycle + endif + + call get_excitation_degree(psi_ref(1,1,i_I),psi_non_ref(1,1,k_sd),degree,N_int) + if (degree > 2) then + cycle + endif + + ! + + ! |l> = Exc(k -> alpha) |I> + call get_excitation(psi_non_ref(1,1,k_sd),tq,exc,degree2,phase,N_int) + call decode_exc(exc,degree2,h1,p1,h2,p2,s1,s2) + + tmp_det(1:N_int,1:2) = psi_ref(1:N_int,1:2,i_I) + + call apply_excitation(psi_ref(1,1,i_I), exc, tmp_det, ok, N_int) + + do i_state=1,N_states + dIK(i_state) = dij(i_I, k_sd, i_state) + enddo + + ! + do i_state=1,N_states + dka(i_state) = 0.d0 + enddo + + if (ok) then + do l_sd=k_sd+1,N_det_non_ref + call get_excitation_degree(tmp_det,psi_non_ref(1,1,l_sd),degree,N_int) + if (degree == 0) then + call get_excitation(psi_ref(1,1,i_I),psi_non_ref(1,1,l_sd),exc,degree,phase2,N_int) + do i_state=1,N_states + dka(i_state) = dij(i_I, l_sd, i_state) * phase * phase2 + enddo + exit + endif + enddo + + else if (perturbative_triples) then + ! Linked + + call i_h_j(tq,psi_non_ref(1,1,k_sd),N_int,hka) + if (dabs(hka) > 1.d-12) then + double precision :: Delta_E(N_states) + call get_delta_e_dyall_general_mp(psi_ref(1,1,i_I),tq,Delta_E) + + do i_state=1,N_states + ASSERT (Delta_E(i_state) < 0.d0) + dka(i_state) = hka / Delta_E(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) + call i_h_j(tq,psi_non_ref(1,1,k_sd),N_int,hla) + hka = hla - hka + if (dabs(hka) > 1.d-12) then + call get_delta_e_dyall_general_mp(psi_ref(1,1,i_I),tq,Delta_E) + do i_state=1,N_states + ASSERT (Delta_E(i_state) < 0.d0) + dka(i_state) = hka / Delta_E(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 + + do i_state=1,N_states + c_alpha(i_state) += dIa(i_state) * psi_ref_coef(i_I,i_state) + enddo + + enddo + +end diff --git a/plugins/mrcepa0/save_mrcc_wavefunction.irp.f b/plugins/mrcepa0/save_mrcc_wavefunction.irp.f new file mode 100644 index 00000000..49a38557 --- /dev/null +++ b/plugins/mrcepa0/save_mrcc_wavefunction.irp.f @@ -0,0 +1,50 @@ +program save_mrcc_wf + implicit none + + threshold_generators = 1.d0 + threshold_selectors = 1.d0 + TOUCH threshold_generators threshold_selectors + + mrmode=5 + read_wf = .True. + SOFT_TOUCH read_wf mrmode + call generate_all_alpha_beta_det_products + + call run1 + call run2 +end + +subroutine run1 + implicit none + + integer :: k + double precision :: c_alpha(N_states) + call set_generators_bitmasks_as_holes_and_particles + + do k=1,N_det + if (maxval(abs(psi_coef(k,1:N_states))) == 0.d0) then + call get_cc_coef(psi_det(1,1,k), c_alpha) + psi_coef(k,1:N_states) = c_alpha(1:N_states) + endif + enddo + SOFT_TOUCH psi_coef +end + +subroutine run2 + implicit none + + integer :: k + double precision :: c_alpha(N_states) + + psi_det(1:N_int,1:2,1:N_det) = psi_det_sorted(1:N_int,1:2,1:N_det) + psi_coef(1:N_det,1:N_states) = psi_coef_sorted(1:N_det,1:N_states) + do k=N_det,1,-1 + if (maxval(abs(psi_coef(k,1:N_states))) > 0.d0) then + exit + endif + enddo + N_det = k + SOFT_TOUCH N_det psi_coef psi_det + call save_wavefunction +end + diff --git a/src/Determinants/determinants.irp.f b/src/Determinants/determinants.irp.f index d01c80ff..276755fa 100644 --- a/src/Determinants/determinants.irp.f +++ b/src/Determinants/determinants.irp.f @@ -721,6 +721,7 @@ subroutine apply_excitation(det, exc, res, ok, Nint) case default print *, degree print *, "apply ex" + print *, 1.d0/0.d0 ! For traceback STOP end select ! END INLINE diff --git a/src/Determinants/spindeterminants.irp.f b/src/Determinants/spindeterminants.irp.f index ffa7c269..9a39212c 100644 --- a/src/Determinants/spindeterminants.irp.f +++ b/src/Determinants/spindeterminants.irp.f @@ -671,7 +671,10 @@ subroutine create_wf_of_psi_bilinear_matrix(truncate) do i=1,N_det norm(1) += psi_average_norm_contrib_sorted(i) if (truncate) then - if (norm(1) >= 0.999999d0) then + if (norm(1) >= 1.d0) then + exit + endif + if (psi_average_norm_contrib_sorted(i) == 0.d0) then exit endif endif From 257d7004aa77aedd4bff1e75982bd98a45053df0 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 25 Jul 2018 01:13:04 +0200 Subject: [PATCH 80/96] OpenMP in save_MRCC_wf --- plugins/CAS_SD_ZMQ/cassd_zmq.irp.f | 76 +++++++++++++++++++- plugins/Full_CI_ZMQ/fci_zmq.irp.f | 4 +- plugins/Generators_CAS/generators.irp.f | 2 +- plugins/dress_zmq/alpha_factory.irp.f | 10 +-- plugins/mrcepa0/dressing.irp.f | 4 +- plugins/mrcepa0/save_mrcc_wavefunction.irp.f | 8 +++ src/Determinants/slater_rules.irp.f | 1 - 7 files changed, 94 insertions(+), 11 deletions(-) diff --git a/plugins/CAS_SD_ZMQ/cassd_zmq.irp.f b/plugins/CAS_SD_ZMQ/cassd_zmq.irp.f index 44f9afbc..0cef5d6f 100644 --- a/plugins/CAS_SD_ZMQ/cassd_zmq.irp.f +++ b/plugins/CAS_SD_ZMQ/cassd_zmq.irp.f @@ -5,16 +5,28 @@ program cassd_zmq integer :: degree integer :: n_det_before, to_select double precision :: threshold_davidson_in + double precision :: error(N_states) allocate (pt2(N_states)) double precision :: hf_energy_ref logical :: has + integer :: N_states_p + character*(512) :: fmt + character*(8) :: pt2_string + pt2 = -huge(1.d0) + error = 0.d0 threshold_davidson_in = threshold_davidson threshold_davidson = threshold_davidson_in * 100.d0 SOFT_TOUCH threshold_davidson + if (do_pt2) then + pt2_string = ' ' + else + pt2_string = '(approx)' + endif + call diagonalize_CI call save_wavefunction @@ -45,7 +57,6 @@ program cassd_zmq double precision :: E_CI_before(N_states) - print*,'Beginning the selection ...' if (.True.) then ! Avoid pre-calculation of CI_energy E_CI_before(1:N_states) = CI_energy(1:N_states) endif @@ -60,6 +71,8 @@ program cassd_zmq (maxval(abs(pt2(1:N_states))) > pt2_max) .and. & (correlation_energy_ratio <= correlation_energy_ratio_max) & ) + write(*,'(A)') '--------------------------------------------------------------------------------' + correlation_energy_ratio = (CI_energy(1) - hf_energy_ref) / & (E_CI_before(1) + pt2(1) - hf_energy_ref) @@ -98,6 +111,67 @@ program cassd_zmq to_select = min(to_select, N_det_max-n_det_before) call ZMQ_selection(to_select, pt2) + N_states_p = min(N_det,N_states) + + print *, '' + print '(A,I12)', 'Summary at N_det = ', N_det + print '(A)', '-----------------------------------' + print *, '' + call write_double(6,correlation_energy_ratio, 'Correlation ratio') + print *, '' + + write(fmt,*) '(''# ============'',', N_states_p, '(1X,''=============================''))' + write(*,fmt) + write(fmt,*) '(12X,', N_states_p, '(6X,A7,1X,I6,10X))' + write(*,fmt) ('State',k, k=1,N_states_p) + write(fmt,*) '(''# ============'',', N_states_p, '(1X,''=============================''))' + write(*,fmt) + write(fmt,*) '(A12,', N_states_p, '(1X,F14.8,15X))' + write(*,fmt) '# E ', E_CI_before(1:N_states_p) + if (N_states_p > 1) then + write(*,fmt) '# Excit. (au)', E_CI_before(1:N_states_p)-E_CI_before(1) + write(*,fmt) '# Excit. (eV)', (E_CI_before(1:N_states_p)-E_CI_before(1))*27.211396641308d0 + endif + write(fmt,*) '(A12,', 2*N_states_p, '(1X,F14.8))' + write(*,fmt) '# PT2'//pt2_string, (pt2(k), error(k), k=1,N_states_p) + write(*,'(A)') '#' + write(*,fmt) '# E+PT2 ', (E_CI_before(k)+pt2(k),error(k), k=1,N_states_p) + if (N_states_p > 1) then + write(*,fmt) '# Excit. (au)', ( (E_CI_before(k)+pt2(k)-E_CI_before(1)-pt2(1)), & + dsqrt(error(k)*error(k)+error(1)*error(1)), k=1,N_states_p) + write(*,fmt) '# Excit. (eV)', ( (E_CI_before(k)+pt2(k)-E_CI_before(1)-pt2(1))*27.211396641308d0, & + dsqrt(error(k)*error(k)+error(1)*error(1))*27.211396641308d0, k=1,N_states_p) + endif + write(fmt,*) '(''# ============'',', N_states_p, '(1X,''=============================''))' + write(*,fmt) + print *, '' + + print *, 'N_det = ', N_det + print *, 'N_states = ', N_states + print*, 'correlation_ratio = ', correlation_energy_ratio + + do k=1, N_states_p + print*,'State ',k + print *, 'PT2 = ', pt2(k) + print *, 'E = ', E_CI_before(k) + print *, 'E+PT2'//pt2_string//' = ', E_CI_before(k)+pt2(k), ' +/- ', error(k) + enddo + + print *, '-----' + if(N_states.gt.1)then + print *, 'Variational Energy difference (au | eV)' + do i=2, N_states_p + print*,'Delta E = ', (E_CI_before(i) - E_CI_before(1)), & + (E_CI_before(i) - E_CI_before(1)) * 27.211396641308d0 + enddo + print *, '-----' + print*, 'Variational + perturbative Energy difference (au | eV)' + do i=2, N_states_p + print*,'Delta E = ', (E_CI_before(i)+ pt2(i) - (E_CI_before(1) + pt2(1))), & + (E_CI_before(i)+ pt2(i) - (E_CI_before(1) + pt2(1))) * 27.211396641308d0 + enddo + endif + PROVIDE psi_coef PROVIDE psi_det PROVIDE psi_det_sorted diff --git a/plugins/Full_CI_ZMQ/fci_zmq.irp.f b/plugins/Full_CI_ZMQ/fci_zmq.irp.f index 2d3c1f29..933056d4 100644 --- a/plugins/Full_CI_ZMQ/fci_zmq.irp.f +++ b/plugins/Full_CI_ZMQ/fci_zmq.irp.f @@ -22,8 +22,8 @@ program fci_zmq threshold_davidson = threshold_davidson_in * 100.d0 SOFT_TOUCH threshold_davidson - call diagonalize_CI - call save_wavefunction +! call diagonalize_CI +! call save_wavefunction call ezfio_has_hartree_fock_energy(has) if (has) then diff --git a/plugins/Generators_CAS/generators.irp.f b/plugins/Generators_CAS/generators.irp.f index 4be8c061..4d99f3a1 100644 --- a/plugins/Generators_CAS/generators.irp.f +++ b/plugins/Generators_CAS/generators.irp.f @@ -35,10 +35,10 @@ END_PROVIDER integer, external :: number_of_holes,number_of_particles integer, allocatable :: nongen(:) integer :: inongen - inongen = 0 allocate(nongen(N_det)) + inongen = 0 m=0 do i=1,N_det good = ( number_of_holes(psi_det_sorted(1,1,i)) ==0).and.(number_of_particles(psi_det_sorted(1,1,i))==0 ) diff --git a/plugins/dress_zmq/alpha_factory.irp.f b/plugins/dress_zmq/alpha_factory.irp.f index 261966be..f590f5d1 100644 --- a/plugins/dress_zmq/alpha_factory.irp.f +++ b/plugins/dress_zmq/alpha_factory.irp.f @@ -66,7 +66,7 @@ subroutine generate_singles_and_doubles(delta_ij_loc, i_generator, bitmask_index integer(bit_kind), allocatable:: preinteresting_det(:,:,:) integer ,allocatable :: abuf(:), labuf(:) - allocate(abuf(N_det*6), labuf(N_det)) + allocate(abuf(0:N_det*6), labuf(0:N_det)) allocate(preinteresting_det(N_int,2,N_det)) PROVIDE fragment_count @@ -387,7 +387,7 @@ subroutine alpha_callback_mask(delta_ij_loc, i_gen, sp, mask, bannedOrb, banned, integer(bit_kind), allocatable :: det_minilist(:,:,:) - allocate(abuf(siz), labuf(N_det), putten(N_det), det_minilist(N_int, 2, N_det)) + allocate(abuf(0:siz), labuf(0:N_det), putten(N_det), det_minilist(N_int, 2, N_det)) do i=1,siz abuf(i) = psi_from_sorted_gen(rabuf(i)) @@ -638,7 +638,7 @@ subroutine splash_pq(mask, sp, det, i_gen, N_sel, bannedOrb, banned, indexes, ab integer(bit_kind),intent(in) :: mask(N_int, 2), det(N_int, 2, N_sel) logical, intent(inout) :: bannedOrb(mo_tot_num, 2), banned(mo_tot_num, mo_tot_num, 2) integer, intent(inout) :: indexes(0:mo_tot_num, 0:mo_tot_num) - integer, intent(inout) :: abuf(*) + integer, intent(inout) :: abuf(0:*) integer :: i, ii, j, k, l, h(0:2,2), p(0:4,2), nt, s integer(bit_kind) :: perMask(N_int, 2), mobMask(N_int, 2), negMask(N_int, 2) integer :: phasemask(2,N_int*bit_kind_size) @@ -704,7 +704,7 @@ subroutine get_d2(i_gen, gen, banned, bannedOrb, indexes, abuf, mask, h, p, sp) implicit none integer(bit_kind), intent(in) :: mask(N_int, 2), gen(N_int, 2) - integer, intent(inout) :: abuf(*) + integer, intent(inout) :: abuf(0:*) integer, intent(in) :: i_gen logical, intent(in) :: bannedOrb(mo_tot_num, 2), banned(mo_tot_num, mo_tot_num,2) integer, intent(inout) :: indexes(0:mo_tot_num, 0:mo_tot_num) @@ -832,7 +832,7 @@ subroutine get_d1(i_gen, gen, banned, bannedOrb, indexes, abuf, mask, h, p, sp) implicit none integer(bit_kind), intent(in) :: mask(N_int, 2), gen(N_int, 2) - integer, intent(inout) :: abuf(*) + integer, intent(inout) :: abuf(0:*) integer,intent(in) :: i_gen logical, intent(in) :: bannedOrb(mo_tot_num, 2), banned(mo_tot_num, mo_tot_num,2) integer(bit_kind) :: det(N_int, 2) diff --git a/plugins/mrcepa0/dressing.irp.f b/plugins/mrcepa0/dressing.irp.f index 319d0603..f7ee5ace 100644 --- a/plugins/mrcepa0/dressing.irp.f +++ b/plugins/mrcepa0/dressing.irp.f @@ -236,6 +236,7 @@ subroutine mrcc_part_dress(delta_ij_, delta_ij_s2_, i_generator,n_selected,det_b double precision, intent(inout) :: contrib(N_states) double precision :: sdress, hdress + PROVIDE n_act_orb elec_num if (perturbative_triples) then PROVIDE one_anhil fock_virt_total fock_core_inactive_total one_creat @@ -1025,7 +1026,7 @@ subroutine filter_tq(i_generator,n_selected,det_buffer,Nint,tq,N_tq,miniList,N_m if (good) then if (.not. is_in_wavefunction(det_buffer(1,1,i),Nint)) then N_tq += 1 - do k=1,N_int + do k=1,Nint tq(k,1,N_tq) = det_buffer(k,1,i) tq(k,2,N_tq) = det_buffer(k,2,i) enddo @@ -1131,6 +1132,7 @@ subroutine get_cc_coef(tq,c_alpha) integer :: i_state, k_sd, l_sd, i_I logical :: ok + PROVIDE n_act_orb elec_num if (perturbative_triples) then PROVIDE one_anhil fock_virt_total fock_core_inactive_total one_creat endif diff --git a/plugins/mrcepa0/save_mrcc_wavefunction.irp.f b/plugins/mrcepa0/save_mrcc_wavefunction.irp.f index 49a38557..9afa2b71 100644 --- a/plugins/mrcepa0/save_mrcc_wavefunction.irp.f +++ b/plugins/mrcepa0/save_mrcc_wavefunction.irp.f @@ -3,6 +3,7 @@ program save_mrcc_wf threshold_generators = 1.d0 threshold_selectors = 1.d0 + PROVIDE N_int psi_det TOUCH threshold_generators threshold_selectors mrmode=5 @@ -21,12 +22,19 @@ subroutine run1 double precision :: c_alpha(N_states) call set_generators_bitmasks_as_holes_and_particles + call get_cc_coef(psi_det(1,1,1), c_alpha) + !$OMP PARALLEL DO DEFAULT(SHARED) & + !$OMP PRIVATE(k,c_alpha) SCHEDULE(static,64) do k=1,N_det if (maxval(abs(psi_coef(k,1:N_states))) == 0.d0) then + if (iand(k,1023) == 0) then + print *, k, '/', N_det + endif call get_cc_coef(psi_det(1,1,k), c_alpha) psi_coef(k,1:N_states) = c_alpha(1:N_states) endif enddo + !$OMP END PARALLEL DO SOFT_TOUCH psi_coef end diff --git a/src/Determinants/slater_rules.irp.f b/src/Determinants/slater_rules.irp.f index a3120be9..6e972114 100644 --- a/src/Determinants/slater_rules.irp.f +++ b/src/Determinants/slater_rules.irp.f @@ -568,7 +568,6 @@ subroutine i_H_j_s2(key_i,key_j,Nint,hij,s2) call get_mono_excitation_from_fock(key_i,key_j,p,m,spin,phase,hij) case (0) - print *,irp_here,": ZERO" double precision, external :: diag_S_mat_elem s2 = diag_S_mat_elem(key_i,Nint) hij = diag_H_mat_elem(key_i,Nint) From 907d41d697f50962f30a185bcca88cfa73888cb4 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 25 Jul 2018 01:34:20 +0200 Subject: [PATCH 81/96] save_MRCC_wf acceleration --- plugins/mrcepa0/dressing.irp.f | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/plugins/mrcepa0/dressing.irp.f b/plugins/mrcepa0/dressing.irp.f index f7ee5ace..c0b76596 100644 --- a/plugins/mrcepa0/dressing.irp.f +++ b/plugins/mrcepa0/dressing.irp.f @@ -1164,6 +1164,10 @@ subroutine get_cc_coef(tq,c_alpha) ! |alpha> do k_sd=1,N_det_non_ref + if (maxval(abs(psi_non_ref_coef(k_sd,1:N_states))) < 1.d-10) then + cycle + endif + call get_excitation_degree(tq,psi_non_ref(1,1,k_sd),degree,N_int) if (degree > 2) then cycle @@ -1173,6 +1177,15 @@ subroutine get_cc_coef(tq,c_alpha) if (degree > 2) then cycle endif + + do i_state=1,N_states + dIK(i_state) = dij(i_I, k_sd, i_state) + enddo + + if (maxval(abs(dIk))) < 1.d-10) then + cycle + endif + ! @@ -1184,17 +1197,14 @@ subroutine get_cc_coef(tq,c_alpha) call apply_excitation(psi_ref(1,1,i_I), exc, tmp_det, ok, N_int) - do i_state=1,N_states - dIK(i_state) = dij(i_I, k_sd, i_state) - enddo - ! - do i_state=1,N_states - dka(i_state) = 0.d0 - enddo + dka(1:N_states) = 0.d0 if (ok) then do l_sd=k_sd+1,N_det_non_ref + if (maxval(abs(psi_non_ref_coef(l_sd,1:N_states))) < 1.d-10) then + cycle + endif call get_excitation_degree(tmp_det,psi_non_ref(1,1,l_sd),degree,N_int) if (degree == 0) then call get_excitation(psi_ref(1,1,i_I),psi_non_ref(1,1,l_sd),exc,degree,phase2,N_int) From 62257c95f4129e8fb90ee38d6b53222072482bf4 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 25 Jul 2018 11:48:12 +0200 Subject: [PATCH 82/96] Max iterations for dressing --- plugins/dress_zmq/dress_zmq_routines.irp.f | 2 +- plugins/dress_zmq/dressing.irp.f | 4 ++-- plugins/mrcepa0/EZFIO.cfg | 4 ++-- plugins/mrcepa0/dressing.irp.f | 10 +++------- plugins/mrcepa0/mrcc_zmq.irp.f | 6 +++--- plugins/shiftedbk/EZFIO.cfg | 2 +- 6 files changed, 12 insertions(+), 16 deletions(-) diff --git a/plugins/dress_zmq/dress_zmq_routines.irp.f b/plugins/dress_zmq/dress_zmq_routines.irp.f index dc47eb20..bd070214 100644 --- a/plugins/dress_zmq/dress_zmq_routines.irp.f +++ b/plugins/dress_zmq/dress_zmq_routines.irp.f @@ -6,7 +6,7 @@ subroutine dress_zmq() threshold_generators = 1d0 read_wf = .True. - SOFT_TOUCH read_wf + SOFT_TOUCH read_wf threshold_generators threshold_selectors if (.True.) then integer :: i,j diff --git a/plugins/dress_zmq/dressing.irp.f b/plugins/dress_zmq/dressing.irp.f index bf2ab207..590b27c6 100644 --- a/plugins/dress_zmq/dressing.irp.f +++ b/plugins/dress_zmq/dressing.irp.f @@ -102,9 +102,9 @@ BEGIN_PROVIDER [ double precision, delta_ij_tmp, (N_states,N_det_delta_ij,2) ] ! else ! errr = 1d-4 ! end if - relative_error = 1.d-2 + relative_error = 1.d-3 - call write_double(6,relative_error,"Convergence of the stochastic algorithm") + call write_double(6,relative_error,"Relative error for the stochastic algorithm") call ZMQ_dress(E_CI_before, dress, del, del_s2, abs(relative_error), N_det_delta_ij) delta_ij_tmp(:,:,1) = del(:,:) diff --git a/plugins/mrcepa0/EZFIO.cfg b/plugins/mrcepa0/EZFIO.cfg index 53519ec7..88f40c18 100644 --- a/plugins/mrcepa0/EZFIO.cfg +++ b/plugins/mrcepa0/EZFIO.cfg @@ -18,7 +18,7 @@ interface: ezfio type: logical doc: Compute perturbative contribution of the Triples interface: ezfio,provider,ocaml -default: false +default: true [energy] type: double precision @@ -35,5 +35,5 @@ default: 1.e-5 type: Strictly_positive_int doc: Maximum number of dressed CI iterations interface: ezfio,provider,ocaml -default: 10 +default: 30 diff --git a/plugins/mrcepa0/dressing.irp.f b/plugins/mrcepa0/dressing.irp.f index c0b76596..d9eb2365 100644 --- a/plugins/mrcepa0/dressing.irp.f +++ b/plugins/mrcepa0/dressing.irp.f @@ -470,7 +470,7 @@ END_PROVIDER double precision, allocatable :: mrcc(:) double precision :: E_CI_before!, relative_error - double precision, save :: target_error = 2d-2 + double precision :: target_error allocate(mrcc(N_states)) @@ -482,11 +482,7 @@ END_PROVIDER E_CI_before = mrcc_E0_denominator(1) + nuclear_repulsion threshold_selectors = 1.d0 threshold_generators = 1d0 - if(target_error /= 0d0) then - target_error = target_error * 0.5d0 ! (-mrcc_E0_denominator(1) + mrcc_previous_E(1)) / 1d1 - else - target_error = -1d-4 - end if + target_error = thresh_dressed_ci * 5.d-2 call ZMQ_mrcc(E_CI_before, mrcc, delta_ij_mrcc_zmq, delta_ij_s2_mrcc_zmq, abs(target_error)) mrcc_previous_E(:) = mrcc_E0_denominator(:) @@ -1182,7 +1178,7 @@ subroutine get_cc_coef(tq,c_alpha) dIK(i_state) = dij(i_I, k_sd, i_state) enddo - if (maxval(abs(dIk))) < 1.d-10) then + if (maxval(abs(dIk)) < 1.d-10) then cycle endif diff --git a/plugins/mrcepa0/mrcc_zmq.irp.f b/plugins/mrcepa0/mrcc_zmq.irp.f index a3089a24..92fc259d 100644 --- a/plugins/mrcepa0/mrcc_zmq.irp.f +++ b/plugins/mrcepa0/mrcc_zmq.irp.f @@ -6,9 +6,9 @@ program mrsc2sub !mrmode : 1=mrcepa0, 2=mrsc2 add, 3=mrcc mrmode = 5 -threshold_generators = 1.d0 -threshold_selectors = 1.d0 -TOUCH threshold_generators threshold_selectors + threshold_generators = 1.d0 + threshold_selectors = 1.d0 + TOUCH threshold_generators threshold_selectors read_wf = .True. SOFT_TOUCH read_wf diff --git a/plugins/shiftedbk/EZFIO.cfg b/plugins/shiftedbk/EZFIO.cfg index 576bf1e4..6123f458 100644 --- a/plugins/shiftedbk/EZFIO.cfg +++ b/plugins/shiftedbk/EZFIO.cfg @@ -18,7 +18,7 @@ default: 1.e-5 type: Strictly_positive_int doc: Maximum number of dressed CI iterations interface: ezfio,provider,ocaml -default: 10 +default: 30 [h0_type] type: Perturbation From eede4e24d3ef2bacf53162582d706d3d093c688b Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 26 Jul 2018 11:31:36 +0200 Subject: [PATCH 83/96] Fixed ijkl bitmask --- src/Bitmask/bitmasks.irp.f | 17 ++++++++++------- src/Determinants/Fock_diag.irp.f | 9 +++++++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/Bitmask/bitmasks.irp.f b/src/Bitmask/bitmasks.irp.f index efb39119..f0caea96 100644 --- a/src/Bitmask/bitmasks.irp.f +++ b/src/Bitmask/bitmasks.irp.f @@ -21,14 +21,17 @@ BEGIN_PROVIDER [ integer(bit_kind), full_ijkl_bitmask, (N_int) ] ! Bitmask to include all possible MOs END_DOC - integer :: i,j,n - n = mod(mo_tot_num-1,bit_kind_size)+1 + integer :: i,j,k full_ijkl_bitmask = 0_bit_kind - do i=1,N_int-1 - full_ijkl_bitmask(i) = not(0_bit_kind) - enddo - do i=1,n - full_ijkl_bitmask(N_int) = ibset(full_ijkl_bitmask(N_int),i-1) + do j=1,N_int + k=0 + do i=0,bit_kind_size-1 + k=k+1 + if (mo_class(k) /= 'Deleted') then + full_ijkl_bitmask(j) = ibset(full_ijkl_bitmask(j),i) + endif + if (k == mo_tot_num) exit + enddo enddo END_PROVIDER diff --git a/src/Determinants/Fock_diag.irp.f b/src/Determinants/Fock_diag.irp.f index 01393fe1..75c577ed 100644 --- a/src/Determinants/Fock_diag.irp.f +++ b/src/Determinants/Fock_diag.irp.f @@ -21,10 +21,19 @@ subroutine build_fock_tmp(fock_diag_tmp,det_ref,Nint) if (Ne(1) /= elec_alpha_num) then print *, 'Error in build_fock_tmp (alpha)', Ne(1), Ne(2) + call debug_det(det_ref,N_int) + print *, occ(:,1) + print *, occ(:,2) + do i=1,10000 + occ(i,1) = fock_diag_tmp(1,mo_tot_num+i) !traceback + enddo stop -1 endif if (Ne(2) /= elec_beta_num) then print *, 'Error in build_fock_tmp (beta)', Ne(1), Ne(2) + do i=1,10000 + occ(i,1) = fock_diag_tmp(1,mo_tot_num+i) !traceback + enddo stop -1 endif From 18b64d7bc47d2890a8758863e0566efdf178dba6 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 27 Jul 2018 11:04:30 +0200 Subject: [PATCH 84/96] Fixed tests --- plugins/Symmetry/find_sym.irp.f | 28 ---------------------------- tests/bats/mrcepa0.bats | 25 ++++++------------------- 2 files changed, 6 insertions(+), 47 deletions(-) diff --git a/plugins/Symmetry/find_sym.irp.f b/plugins/Symmetry/find_sym.irp.f index 817638b4..d440279e 100644 --- a/plugins/Symmetry/find_sym.irp.f +++ b/plugins/Symmetry/find_sym.irp.f @@ -6,34 +6,6 @@ BEGIN_PROVIDER [ logical, molecule_is_linear ] molecule_is_linear = (minval(inertia_tensor_eigenvalues) < 1.d-5) END_PROVIDER -BEGIN_PROVIDER [ logical, molecule_has_center_of_inversion ] - implicit none - BEGIN_DOC - ! If true, there is a center of inversion in the WF - END_DOC - molecule_has_center_of_inversion = .True. - integer :: i,j,k - double precision :: point(3) - logical :: found - double precision, external :: u_dot_u - do i=1,nucl_num - found = .False. - do j=1,nucl_num - if (nucl_charge(i) /= nucl_charge(j)) cycle - point(:) = nucl_coord_sym_transp(:,i) + nucl_coord_sym_transp(:,j) - if (u_dot_u(point,3) < 1.d-5) then - found = .True. - exit - endif - enddo - if (.not.found) then - molecule_has_center_of_inversion = .False. - exit - endif - enddo - -END_PROVIDER - BEGIN_PROVIDER [ integer, sym_rotation_axis, (3) ] implicit none diff --git a/tests/bats/mrcepa0.bats b/tests/bats/mrcepa0.bats index e2025752..03122387 100644 --- a/tests/bats/mrcepa0.bats +++ b/tests/bats/mrcepa0.bats @@ -5,7 +5,7 @@ source $QP_ROOT/tests/bats/common.bats.sh #=== H2O @test "MRCC-lambda H2O cc-pVDZ" { INPUT=h2o.ezfio - EXE=mrcc + EXE=mrcc_zmq test_exe $EXE || skip qp_edit -c $INPUT ezfio set_file $INPUT @@ -13,6 +13,7 @@ source $QP_ROOT/tests/bats/common.bats.sh ezfio set determinants threshold_selectors 1. ezfio set determinants read_wf True ezfio set mrcepa0 lambda_type 1 + ezfio set mrcepa0 perturbative_triples 0 ezfio set mrcepa0 n_it_max_dressed_ci 3 cp -r $INPUT TMP ; qp_run $EXE TMP ezfio set_file TMP @@ -21,27 +22,10 @@ source $QP_ROOT/tests/bats/common.bats.sh 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" { INPUT=h2o.ezfio - EXE=mrcc + EXE=mrcc_zmq test_exe $EXE || skip qp_edit -c $INPUT ezfio set_file $INPUT @@ -49,6 +33,7 @@ source $QP_ROOT/tests/bats/common.bats.sh ezfio set determinants threshold_selectors 1. ezfio set determinants read_wf True ezfio set mrcepa0 lambda_type 0 + ezfio set mrcepa0 perturbative_triples 0 ezfio set mrcepa0 n_it_max_dressed_ci 3 cp -r $INPUT TMP ; qp_run $EXE TMP ezfio set_file TMP @@ -86,6 +71,7 @@ source $QP_ROOT/tests/bats/common.bats.sh ezfio set determinants read_wf True ezfio set mrcepa0 lambda_type 1 ezfio set mrcepa0 n_it_max_dressed_ci 3 + ezfio set mrcepa0 perturbative_triples 0 cp -r $INPUT TMP ; qp_run $EXE TMP ezfio set_file TMP energy="$(ezfio get mrcepa0 energy_pt2)" @@ -102,6 +88,7 @@ source $QP_ROOT/tests/bats/common.bats.sh ezfio set determinants threshold_generators 1. ezfio set determinants threshold_selectors 1. ezfio set determinants read_wf True + ezfio set mrcepa0 perturbative_triples 0 ezfio set mrcepa0 lambda_type 1 ezfio set mrcepa0 n_it_max_dressed_ci 3 cp -r $INPUT TMP ; qp_run $EXE TMP From 6fa4aec346e5e20ff0643f0e478e180ac3f85f04 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 27 Jul 2018 11:09:39 +0200 Subject: [PATCH 85/96] Updated f77zmq install --- install/scripts/install_f77zmq.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/scripts/install_f77zmq.sh b/install/scripts/install_f77zmq.sh index 92388337..15d81c96 100755 --- a/install/scripts/install_f77zmq.sh +++ b/install/scripts/install_f77zmq.sh @@ -14,7 +14,7 @@ function _install() make -j 8 || exit 1 mv libf77zmq.a "${QP_ROOT}"/lib || exit 1 mv libf77zmq.so "${QP_ROOT}"/lib || exit 1 - cp f77_zmq.h "${QP_ROOT}"/src/ZMQ/ + cp f77_zmq_free.h "${QP_ROOT}"/src/ZMQ/f77_zmq.h cd - return 0 } From 93f1f74108c1d38a4288920730ccdea228a3e1c0 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 27 Jul 2018 11:38:34 +0200 Subject: [PATCH 86/96] Removed traceback --- src/Determinants/determinants.irp.f | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Determinants/determinants.irp.f b/src/Determinants/determinants.irp.f index 276755fa..38b08172 100644 --- a/src/Determinants/determinants.irp.f +++ b/src/Determinants/determinants.irp.f @@ -721,7 +721,7 @@ subroutine apply_excitation(det, exc, res, ok, Nint) case default print *, degree print *, "apply ex" - print *, 1.d0/0.d0 ! For traceback +! print *, 1.d0/0.d0 ! For traceback STOP end select ! END INLINE From 92b9515f24d7c87818d50fe78090a47ec2199026 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 27 Jul 2018 11:48:50 +0200 Subject: [PATCH 87/96] Removed traceback --- src/Determinants/Fock_diag.irp.f | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Determinants/Fock_diag.irp.f b/src/Determinants/Fock_diag.irp.f index 75c577ed..396926c9 100644 --- a/src/Determinants/Fock_diag.irp.f +++ b/src/Determinants/Fock_diag.irp.f @@ -22,18 +22,18 @@ subroutine build_fock_tmp(fock_diag_tmp,det_ref,Nint) if (Ne(1) /= elec_alpha_num) then print *, 'Error in build_fock_tmp (alpha)', Ne(1), Ne(2) call debug_det(det_ref,N_int) - print *, occ(:,1) - print *, occ(:,2) - do i=1,10000 - occ(i,1) = fock_diag_tmp(1,mo_tot_num+i) !traceback - enddo +! print *, occ(:,1) +! print *, occ(:,2) +! do i=1,10000 +! occ(i,1) = fock_diag_tmp(1,mo_tot_num+i) !traceback +! enddo stop -1 endif if (Ne(2) /= elec_beta_num) then - print *, 'Error in build_fock_tmp (beta)', Ne(1), Ne(2) - do i=1,10000 - occ(i,1) = fock_diag_tmp(1,mo_tot_num+i) !traceback - enddo +! print *, 'Error in build_fock_tmp (beta)', Ne(1), Ne(2) +! do i=1,10000 +! occ(i,1) = fock_diag_tmp(1,mo_tot_num+i) !traceback +! enddo stop -1 endif From ffb591f6d731ba758d6b5b684f3232f2f575acdb Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 27 Jul 2018 17:01:00 +0200 Subject: [PATCH 88/96] Fix out-of-bounds --- plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f index 2f85cc00..e6e2418f 100644 --- a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f +++ b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f @@ -344,6 +344,7 @@ subroutine pt2_collector(zmq_socket_pull, E, b, tbc, comb, Ncomb, computed, pt2_ eqt = sqrt(1d0 / (Nabove(tooth)-1.d0) * abs(sum2above(tooth) / Nabove(tooth) - (sumabove(tooth)/Nabove(tooth))**2)) else eqt = 0.d0 + tooth=comb_teeth endif call wall_time(time) if ( ((dabs(eqt/avg) < relative_error) .or. (dabs(eqt) < absolute_error)) .and. Nabove(tooth) >= 10.d0) then From 7298ba2b6672a4d934f78fa051635990ae033e91 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 30 Jul 2018 16:37:51 +0200 Subject: [PATCH 89/96] MRCC Almost corrected --- plugins/mrcepa0/dressing_vector.irp.f | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/plugins/mrcepa0/dressing_vector.irp.f b/plugins/mrcepa0/dressing_vector.irp.f index 2a2de699..c3d8287d 100644 --- a/plugins/mrcepa0/dressing_vector.irp.f +++ b/plugins/mrcepa0/dressing_vector.irp.f @@ -6,20 +6,25 @@ BEGIN_DOC ! Null dressing vectors END_DOC - dressing_column_h(:,:) = 0.d0 - dressing_column_s(:,:) = 0.d0 integer :: i,ii,k,j,jj, l double precision :: f, tmp double precision, external :: u_dot_v + dressing_column_h(:,:) = 0.d0 + dressing_column_s(:,:) = 0.d0 do k=1,N_states l = dressed_column_idx(k) - do jj = 1, n_det_non_ref + f = -1.d0/psi_coef(l,k) + do jj=1,N_det_non_ref j = idx_non_ref(jj) - dressing_column_h(j,k) = delta_ij (k,jj) - dressing_column_s(j,k) = delta_ij_s2(k,jj) + dressing_column_h(j,k) = 2.d0*delta_ij (k,jj) + dressing_column_s(j,k) = 2.d0*delta_ij_s2(k,jj) + dressing_column_h(l,k) += psi_coef(j,k) * delta_ij(k,jj) + dressing_column_s(l,k) += psi_coef(j,k) * delta_ij_s2(k,jj) enddo + dressing_column_h(l,k) *= f + dressing_column_s(l,k) *= f enddo END_PROVIDER From df90b9fe98bf384e2bca1bacc7e3e530be0fc2f3 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 30 Jul 2018 19:17:27 +0200 Subject: [PATCH 90/96] Fixed CISD --- plugins/CISD/H_apply.irp.f | 4 +++- plugins/CISD/cisd.irp.f | 16 +++++++++------- plugins/mrcepa0/save_mrcc_wavefunction.irp.f | 16 ++++++++-------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/plugins/CISD/H_apply.irp.f b/plugins/CISD/H_apply.irp.f index a66c997d..8e565c8f 100644 --- a/plugins/CISD/H_apply.irp.f +++ b/plugins/CISD/H_apply.irp.f @@ -3,7 +3,9 @@ BEGIN_SHELL [ /usr/bin/env python2 ] from generate_h_apply import H_apply -H = H_apply("cisd") +H = H_apply("cisd",do_double_exc=True) +print H +H = H_apply("cis",do_double_exc=False) print H END_SHELL diff --git a/plugins/CISD/cisd.irp.f b/plugins/CISD/cisd.irp.f index 0d5a8f75..e85f0940 100644 --- a/plugins/CISD/cisd.irp.f +++ b/plugins/CISD/cisd.irp.f @@ -1,20 +1,22 @@ -program cisd +program cis + implicit none + read_wf = .False. + SOFT_TOUCH read_wf + call run +end + +subroutine run implicit none integer :: i - print *, 'HF = ', HF_energy - print *, 'N_states = ', N_states - N_det = 1 - touch psi_det psi_coef N_det call H_apply_cisd print *, 'N_det = ', N_det do i = 1,N_states print *, 'energy = ',CI_energy(i) print *, 'E_corr = ',CI_electronic_energy(i) - ref_bitmask_energy enddo - - call ezfio_set_cisd_energy(CI_energy(1)) psi_coef = ci_eigenvectors SOFT_TOUCH psi_coef call save_wavefunction + end diff --git a/plugins/mrcepa0/save_mrcc_wavefunction.irp.f b/plugins/mrcepa0/save_mrcc_wavefunction.irp.f index 9afa2b71..da52b56d 100644 --- a/plugins/mrcepa0/save_mrcc_wavefunction.irp.f +++ b/plugins/mrcepa0/save_mrcc_wavefunction.irp.f @@ -26,13 +26,13 @@ subroutine run1 !$OMP PARALLEL DO DEFAULT(SHARED) & !$OMP PRIVATE(k,c_alpha) SCHEDULE(static,64) do k=1,N_det - if (maxval(abs(psi_coef(k,1:N_states))) == 0.d0) then +! if (maxval(abs(psi_coef(k,1:N_states))) == 0.d0) then if (iand(k,1023) == 0) then print *, k, '/', N_det endif call get_cc_coef(psi_det(1,1,k), c_alpha) psi_coef(k,1:N_states) = c_alpha(1:N_states) - endif +! endif enddo !$OMP END PARALLEL DO SOFT_TOUCH psi_coef @@ -46,12 +46,12 @@ subroutine run2 psi_det(1:N_int,1:2,1:N_det) = psi_det_sorted(1:N_int,1:2,1:N_det) psi_coef(1:N_det,1:N_states) = psi_coef_sorted(1:N_det,1:N_states) - do k=N_det,1,-1 - if (maxval(abs(psi_coef(k,1:N_states))) > 0.d0) then - exit - endif - enddo - N_det = k +! do k=N_det,1,-1 +! if (maxval(abs(psi_coef(k,1:N_states))) > 0.d0) then +! exit +! endif +! enddo +! N_det = k SOFT_TOUCH N_det psi_coef psi_det call save_wavefunction end From 6caf7a2353a373400dba487f3a6cff8d9bbe1790 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 30 Jul 2018 19:27:41 +0200 Subject: [PATCH 91/96] Truncate CISD coefs to 1.e-12 --- plugins/CISD/cisd.irp.f | 2 +- src/Determinants/determinants.irp.f | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/plugins/CISD/cisd.irp.f b/plugins/CISD/cisd.irp.f index e85f0940..53f111ee 100644 --- a/plugins/CISD/cisd.irp.f +++ b/plugins/CISD/cisd.irp.f @@ -17,6 +17,6 @@ subroutine run enddo psi_coef = ci_eigenvectors SOFT_TOUCH psi_coef - call save_wavefunction + call save_wavefunction_truncated(1.d-12) end diff --git a/src/Determinants/determinants.irp.f b/src/Determinants/determinants.irp.f index 38b08172..3db76eef 100644 --- a/src/Determinants/determinants.irp.f +++ b/src/Determinants/determinants.irp.f @@ -454,6 +454,26 @@ end +subroutine save_wavefunction_truncated(thr) + implicit none + double precision, intent(in) :: thr + use bitmasks + BEGIN_DOC + ! Save the wave function into the EZFIO file + END_DOC + integer :: N_det_save,i + N_det_save = N_det + do i=1,N_det + if (psi_average_norm_contrib_sorted(i) < thr) then + N_det_save = i + exit + endif + enddo + if (mpi_master) then + call save_wavefunction_general(N_det_save,min(N_states,N_det_save),psi_det_sorted,size(psi_coef_sorted,1),psi_coef_sorted) + endif +end + subroutine save_wavefunction implicit none use bitmasks From 9dd31d4190ef9b86af7302fd0696edc553ff48a5 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Mon, 30 Jul 2018 19:37:36 +0200 Subject: [PATCH 92/96] Fixed mrcepa0 tests --- tests/bats/mrcepa0.bats | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/bats/mrcepa0.bats b/tests/bats/mrcepa0.bats index 03122387..271e5a54 100644 --- a/tests/bats/mrcepa0.bats +++ b/tests/bats/mrcepa0.bats @@ -19,7 +19,7 @@ source $QP_ROOT/tests/bats/common.bats.sh ezfio set_file TMP energy="$(ezfio get mrcepa0 energy_pt2)" rm -rf TMP - eq $energy -76.2379929298452 1.e-4 + eq $energy -76.2382975461183 1.e-4 } @@ -39,7 +39,7 @@ source $QP_ROOT/tests/bats/common.bats.sh ezfio set_file TMP energy="$(ezfio get mrcepa0 energy_pt2)" rm -rf TMP - eq $energy -76.2379517543157 1.e-4 + eq $energy -76.2382468380776 1.e-4 } #@test "MRCC-stoch H2O cc-pVDZ" { @@ -76,7 +76,7 @@ source $QP_ROOT/tests/bats/common.bats.sh ezfio set_file TMP energy="$(ezfio get mrcepa0 energy_pt2)" rm -rf TMP - eq $energy -76.2359960472962 3.e-4 + eq $energy -76.2358860928235 3.e-4 } @test "MRCEPA0 H2O cc-pVDZ" { @@ -95,6 +95,6 @@ source $QP_ROOT/tests/bats/common.bats.sh ezfio set_file TMP energy="$(ezfio get mrcepa0 energy_pt2)" rm -rf TMP - eq $energy -76.2407388142333 2.e-4 + eq $energy -76.2412031502384 2.e-4 } From 74e559c85ad258b05c66267c41f55f1fe6a8ca99 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 7 Aug 2018 18:02:58 +0200 Subject: [PATCH 93/96] Fixed full_ijkl_bitmask --- src/Bitmask/bitmasks.irp.f | 4 ++-- src/Integrals_Bielec/mo_bi_integrals.irp.f | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Bitmask/bitmasks.irp.f b/src/Bitmask/bitmasks.irp.f index f0caea96..fcfe03c8 100644 --- a/src/Bitmask/bitmasks.irp.f +++ b/src/Bitmask/bitmasks.irp.f @@ -22,9 +22,9 @@ BEGIN_PROVIDER [ integer(bit_kind), full_ijkl_bitmask, (N_int) ] END_DOC integer :: i,j,k - full_ijkl_bitmask = 0_bit_kind + k=0 do j=1,N_int - k=0 + full_ijkl_bitmask(j) = 0_bit_kind do i=0,bit_kind_size-1 k=k+1 if (mo_class(k) /= 'Deleted') then diff --git a/src/Integrals_Bielec/mo_bi_integrals.irp.f b/src/Integrals_Bielec/mo_bi_integrals.irp.f index 9d884456..e7fb815a 100644 --- a/src/Integrals_Bielec/mo_bi_integrals.irp.f +++ b/src/Integrals_Bielec/mo_bi_integrals.irp.f @@ -240,7 +240,7 @@ subroutine add_integrals_to_map(mask_ijkl) call bitstring_to_list( mask_ijkl(1,3), list_ijkl(1,3), n_k, N_int ) call bitstring_to_list( mask_ijkl(1,4), list_ijkl(1,4), n_l, N_int ) character*(2048) :: output(1) - print*, 'i' + print *, 'i' call bitstring_to_str( output(1), mask_ijkl(1,1), N_int ) print *, trim(output(1)) j = 0 From 873035e01635a1a0576cc0e8bf834beb3c60fc80 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 4 Sep 2018 17:31:45 +0200 Subject: [PATCH 94/96] Squashed commit of the following: commit 4b9c435dce0f3b3078d573e66fd32b40fca26497 Merge: 74e559c8 093e3fd0 Author: Anthony Scemama Date: Tue Sep 4 16:58:51 2018 +0200 Merge branch 'thesis' of git://github.com/garniron/quantum_package into garniron-thesis commit 093e3fd021ca5ed73fe3be530fa18e79ceb0085e Author: Yann Garniron Date: Tue Sep 4 16:13:00 2018 +0200 removed ungodly hack commit 8529a0f3f66d2f1ba9d717b0de60b268a4a821a7 Author: Yann Garniron Date: Tue Sep 4 14:57:19 2018 +0200 reduced prints in pt2_stoch commit 03b8f353bd94b837c02e570a8d3fb68689003135 Author: Yann Garniron Date: Tue Sep 4 14:41:46 2018 +0200 teeth building check for pt2_stoch commit 0d91b9310a7d580e8bc97a6a0af7a62a8506f8c0 Author: Yann Garniron Date: Tue Sep 4 14:35:04 2018 +0200 timestamp of first pull commit 34d9fa01657ed5d159a1c62f8f24cdb266d48153 Author: Yann Garniron Date: Tue Sep 4 14:27:10 2018 +0200 potential numerical precision bug commit 9a0f900d8c57bcbca36a09c11616e234528e1643 Author: Yann Garniron Date: Tue Sep 4 14:09:51 2018 +0200 tests if teeth can be built commit dda0dc34df82a59fac3c3abb2b14943fdb23c0f8 Author: Yann Garniron Date: Mon Sep 3 17:48:04 2018 +0200 corrected pt2_find_sample commit a521f0cb82bd333ce9879b4dfd87ae1abcf2baaa Author: Yann Garniron Date: Mon Sep 3 16:08:02 2018 +0200 tasks get by batches of Nproc commit 997a5a1265951394753d3154a6136ca40177ba8d Author: Yann Garniron Date: Mon Sep 3 14:18:04 2018 +0200 buffered task_id send commit 99ea7948e0d58023f7ce02386014c8c3d493deb4 Author: Yann Garniron Date: Mon Sep 3 12:29:12 2018 +0200 unbalanced fragmentation commit abb3b7e08bebdcaf84208ebbe404441d3571b1f9 Author: Yann Garniron Date: Sun Sep 2 17:18:44 2018 +0200 overflow of pt2_J commit 8df49f394b588ca304ce2ee7d8f8095455573784 Author: Yann Garniron Date: Sun Sep 2 15:58:48 2018 +0200 removed useless computation of intermediate checkpoints commit 4ba5b79eb391819a4966c7cd19b2e2fdf2ed5129 Author: Yann Garniron Date: Sun Sep 2 15:50:14 2018 +0200 dressing only sent for chosen checkpoint commit a4a6a69459321b1b210c2f51ffbef4f792943919 Author: Yann Garniron Date: Sat Sep 1 17:01:56 2018 +0200 cumulative dot_F commit 6a7f04cb79ec921d5829a011aa8d8b2ea224760d Author: Yann Garniron Date: Sat Sep 1 16:58:07 2018 +0200 simpler purge commit 168ca2f2e29b902ab37afc58672b678998f0212a Author: Yann Garniron Date: Fri Aug 31 21:07:01 2018 +0200 task list optimized commit de4a0d0caf0e1d441e0244a9ba7c65ae535d58b1 Author: Yann Garniron Date: Fri Aug 31 18:57:03 2018 +0200 removed print commit fee31d4e3e70c2edf1aeda202d3f067eddc17532 Author: Yann Garniron Date: Fri Aug 31 18:56:23 2018 +0200 dress fragmentation commit 02893a419de07c922708fe8ee2b828d9ebfd2e9b Author: Yann Garniron Date: Fri Aug 31 15:52:16 2018 +0200 bug in blocked search - replaced with thesis version commit bb6e073cf10039f8a333d120b88dda109169528b Author: Yann Garniron Date: Thu Aug 30 21:24:45 2018 +0200 ungodly hack to prevent double providing commit 0609e8c627ea7bf88d617e45dffeb64c9aea37b6 Author: Yann Garniron Date: Thu Aug 30 20:52:05 2018 +0200 debugging commit a254fdd7cffd8348846c910f240965104c969a09 Author: Yann Garniron Date: Thu Aug 30 15:24:07 2018 +0200 parallel bug commit 2a6c1941d45be78083ec8c1dccb453f51a12c338 Author: Yann Garniron Date: Thu Aug 30 11:43:11 2018 +0200 corrected when relative_error=0d0 commit bac039bdf1bd00673c0795b1cb23adb593e9d426 Author: Yann Garniron Date: Thu Aug 30 10:58:17 2018 +0200 relative error 1d-5 commit aae9d203ecbf8d53accc6bc35c2ab56aeeae78a6 Author: Yann Garniron Date: Thu Aug 30 10:07:02 2018 +0200 potential fragmentation bug commit ad69f39f99d0b0dd73f556fb13d1d55337c5b066 Author: Yann Garniron Date: Wed Aug 29 20:54:58 2018 +0200 dress_zmq re-implemented commit d78f64732a5493d7f10c7c80b564005e63a133fc Author: Yann Garniron Date: Wed Aug 29 11:30:19 2018 +0200 pt2_stoch re-implemented commit 4b9b54e19ac7459589681e5ff7aa358dde9f5fd5 Author: Yann Garniron Date: Tue Aug 28 10:24:38 2018 +0200 removed test for phase_mask_bit commit 3abccca5e35948e54a659cacccea42fbfcf4c296 Author: Yann Garniron Date: Fri Aug 3 23:44:05 2018 +0200 phasemask_bit --- plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f | 707 +++++------- plugins/Full_CI_ZMQ/run_pt2_slave.irp.f | 20 +- plugins/Full_CI_ZMQ/run_selection_slave.irp.f | 2 +- plugins/Full_CI_ZMQ/selection.irp.f | 14 +- plugins/dress_zmq/alpha_factory.irp.f | 15 +- plugins/dress_zmq/dress_stoch_routines.irp.f | 1004 ++++++++--------- plugins/dress_zmq/dressing.irp.f | 37 +- plugins/dress_zmq/run_dress_slave.irp.f | 527 ++++----- plugins/shiftedbk/shifted_bk_routines.irp.f | 3 +- src/Determinants/slater_rules.irp.f | 134 ++- 10 files changed, 1115 insertions(+), 1348 deletions(-) diff --git a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f index e6e2418f..b6952364 100644 --- a/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f +++ b/plugins/Full_CI_ZMQ/pt2_stoch_routines.irp.f @@ -1,8 +1,73 @@ -BEGIN_PROVIDER [ integer, fragment_first ] - implicit none - fragment_first = first_det_of_teeth(1) +BEGIN_PROVIDER [ integer, pt2_stoch_istate ] + implicit none + BEGIN_DOC + ! State for stochatsic PT2 + END_DOC + pt2_stoch_istate = 1 END_PROVIDER + + BEGIN_PROVIDER [ integer, pt2_N_teeth ] +&BEGIN_PROVIDER [ integer, pt2_minDetInFirstTeeth ] +&BEGIN_PROVIDER [ integer, pt2_n_tasks_max ] +&BEGIN_PROVIDER [ integer, pt2_F, (N_det_generators) ] + implicit none + logical, external :: testTeethBuilding + pt2_F(:) = 1 + !pt2_F(:N_det_generators/1000*0+50) = 1 + pt2_n_tasks_max = 16 ! N_det_generators/100 + 1 + + if(N_det_generators < 1024) then + pt2_minDetInFirstTeeth = 1 + pt2_N_teeth = 1 + else + do pt2_N_teeth=32,1,-1 + pt2_minDetInFirstTeeth = min(5, N_det_generators) + if(testTeethBuilding(pt2_minDetInFirstTeeth, pt2_N_teeth)) exit + end do + end if + print *, pt2_N_teeth +END_PROVIDER + + +logical function testTeethBuilding(minF, N) + implicit none + integer, intent(in) :: minF, N + integer :: n0, i + double precision :: u0, Wt, r + + double precision, allocatable :: tilde_w(:), tilde_cW(:) + integer, external :: dress_find_sample + + allocate(tilde_w(N_det_generators), tilde_cW(0:N_det_generators)) + + tilde_cW(0) = 0d0 + do i=1,N_det_generators + tilde_w(i) = psi_coef_generators(i,pt2_stoch_istate)**2 + tilde_cW(i) = tilde_cW(i-1) + tilde_w(i) + enddo + tilde_cW(N_det_generators) = 1d0 + + n0 = 0 + do + u0 = tilde_cW(n0) + r = tilde_cW(n0 + minF) + Wt = (1d0 - u0) / dble(N) + if(Wt >= r - u0) then + testTeethBuilding = .true. + return + end if + n0 += 1 + if(N_det_generators - n0 < minF * N) then + testTeethBuilding = .false. + return + end if + end do + stop "exited testTeethBuilding" +end function + + + subroutine ZMQ_pt2(E, pt2,relative_error, absolute_error, error) use f77_zmq use selection_types @@ -11,22 +76,15 @@ subroutine ZMQ_pt2(E, pt2,relative_error, absolute_error, error) character(len=64000) :: task integer(ZMQ_PTR) :: zmq_to_qp_run_socket, zmq_socket_pull - type(selection_buffer) :: b integer, external :: omp_get_thread_num double precision, intent(in) :: relative_error, absolute_error, E(N_states) double precision, intent(out) :: pt2(N_states),error(N_states) - double precision, allocatable :: pt2_detail(:,:), comb(:) - logical, allocatable :: computed(:) - integer, allocatable :: tbc(:) - integer :: i, j, k, Ncomb, i_generator_end - integer, external :: pt2_find + integer :: i, j, k - double precision :: sumabove(comb_teeth), sum2above(comb_teeth), Nabove(comb_teeth) double precision, external :: omp_get_wtime double precision :: state_average_weight_save(N_states), w(N_states) - double precision :: time integer(ZMQ_PTR), external :: new_zmq_to_qp_run_socket if (N_det < max(10,N_states)) then @@ -40,26 +98,9 @@ subroutine ZMQ_pt2(E, pt2,relative_error, absolute_error, error) state_average_weight(:) = 0.d0 state_average_weight(pt2_stoch_istate) = 1.d0 TOUCH state_average_weight pt2_stoch_istate - - allocate(pt2_detail(N_states,N_det_generators+1), comb(N_det_generators), computed(N_det_generators), tbc(0:size_tbc)) - sumabove = 0d0 - sum2above = 0d0 - Nabove = 0d0 - - provide nproc fragment_first fragment_count mo_bielec_integrals_in_map mo_mono_elec_integral pt2_weight psi_selectors - - computed = .false. - - tbc(0) = first_det_of_comb - 1 - do i=1, tbc(0) - tbc(i) = i - computed(i) = .true. - end do - - Ncomb=size(comb) - call get_carlo_workbatch(computed, comb, Ncomb, tbc) - pt2_detail = 0d0 + provide nproc pt2_F mo_bielec_integrals_in_map mo_mono_elec_integral pt2_w psi_selectors + print *, '========== ================= ================= =================' print *, ' Samples Energy Stat. Error Seconds ' print *, '========== ================= ================= =================' @@ -97,41 +138,17 @@ subroutine ZMQ_pt2(E, pt2,relative_error, absolute_error, error) endif - call create_selection_buffer(1, 1*2, b) - - integer :: ipos - ipos=1 - integer, external :: add_task_to_taskserver - do i=1,tbc(0) - if(tbc(i) > fragment_first) then - write(task(ipos:ipos+20),'(I9,1X,I9,''|'')') 0, tbc(i) - ipos += 20 - if (ipos > 63980) then - if (add_task_to_taskserver(zmq_to_qp_run_socket,trim(task(1:ipos))) == -1) then - stop 'Unable to add task to task server' - endif - ipos=1 + + do i=1,N_det_generators + do j=1,pt2_F(i) !!!!!!!!!!!! + write(task(1:20),'(I9,1X,I9''|'')') j, pt2_J(i) + if (add_task_to_taskserver(zmq_to_qp_run_socket,trim(task(1:20))) == -1) then + stop 'Unable to add task to task server' endif - else - do j=1,fragment_count - write(task(ipos:ipos+20),'(I9,1X,I9,''|'')') j, tbc(i) - ipos += 20 - if (ipos > 63980) then - if (add_task_to_taskserver(zmq_to_qp_run_socket,trim(task(1:ipos))) == -1) then - stop 'Unable to add task to task server' - endif - ipos=1 - endif - end do - end if + end do end do - if (ipos > 1) then - if (add_task_to_taskserver(zmq_to_qp_run_socket,trim(task(1:ipos))) == -1) then - stop 'Unable to add task to task server' - endif - endif integer, external :: zmq_set_running if (zmq_set_running(zmq_to_qp_run_socket) == -1) then @@ -153,18 +170,16 @@ subroutine ZMQ_pt2(E, pt2,relative_error, absolute_error, error) !$OMP PRIVATE(i) i = omp_get_thread_num() if (i==0) then - call pt2_collector(zmq_socket_pull,E(pt2_stoch_istate), b, tbc, comb, Ncomb, computed, pt2_detail, sumabove, sum2above, Nabove, relative_error, absolute_error, w, error) + call pt2_collector(zmq_socket_pull, E(pt2_stoch_istate),relative_error, absolute_error, w, error) pt2(pt2_stoch_istate) = w(pt2_stoch_istate) else call pt2_slave_inproc(i) endif !$OMP END PARALLEL call end_parallel_job(zmq_to_qp_run_socket, zmq_socket_pull, 'pt2') - call delete_selection_buffer(b) print *, '========== ================= ================= =================' - deallocate(pt2_detail, comb, computed, tbc) enddo FREE pt2_stoch_istate state_average_weight(:) = state_average_weight_save(:) @@ -177,34 +192,6 @@ subroutine ZMQ_pt2(E, pt2,relative_error, absolute_error, error) end subroutine -subroutine do_carlo(tbc, Ncomb, comb, pt2_detail, computed, sumabove, sum2above, Nabove) - integer, intent(in) :: tbc(0:size_tbc), Ncomb - logical, intent(in) :: computed(N_det_generators) - double precision, intent(in) :: comb(Ncomb), pt2_detail(N_states,N_det_generators) - double precision, intent(inout) :: sumabove(comb_teeth), sum2above(comb_teeth), Nabove(comb_teeth) - integer :: i, dets(comb_teeth) - double precision :: myVal, myVal2 - - mainLoop : do i=1,Ncomb - call get_comb(comb(i), dets, comb_teeth) - do j=1,comb_teeth - if(.not.(computed(dets(j)))) then - exit mainLoop - end if - end do - - myVal = 0d0 - myVal2 = 0d0 - do j=comb_teeth,1,-1 - myVal += pt2_detail(pt2_stoch_istate,dets(j)) * pt2_weight_inv(dets(j)) * comb_step - sumabove(j) += myVal - sum2above(j) += myVal*myVal - Nabove(j) += 1 - end do - end do mainLoop -end subroutine - - subroutine pt2_slave_inproc(i) implicit none integer, intent(in) :: i @@ -212,411 +199,249 @@ subroutine pt2_slave_inproc(i) call run_pt2_slave(1,i,pt2_e0_denominator) end -subroutine pt2_collector(zmq_socket_pull, E, b, tbc, comb, Ncomb, computed, pt2_detail, sumabove, sum2above, Nabove, relative_error, absolute_error, pt2,error) + +subroutine pt2_collector(zmq_socket_pull, E, relative_error, absolute_error, pt2, error) use f77_zmq use selection_types use bitmasks implicit none - integer, intent(in) :: Ncomb integer(ZMQ_PTR), intent(in) :: zmq_socket_pull - double precision, intent(inout) :: pt2_detail(N_states, N_det_generators) - double precision, intent(in) :: comb(Ncomb), relative_error, absolute_error, E - logical, intent(inout) :: computed(N_det_generators) - integer, intent(in) :: tbc(0:size_tbc) - double precision, intent(inout) :: sumabove(comb_teeth), sum2above(comb_teeth), Nabove(comb_teeth) - double precision, intent(out) :: pt2(N_states),error(N_states) + double precision, intent(in) :: relative_error, absolute_error, E + double precision, intent(out) :: pt2(N_states), error(N_states) - type(selection_buffer), intent(inout) :: b - double precision, allocatable :: pt2_mwen(:,:) + double precision, allocatable :: eI(:,:), eI_task(:,:), S(:), S2(:) integer(ZMQ_PTR),external :: new_zmq_to_qp_run_socket integer(ZMQ_PTR) :: zmq_to_qp_run_socket + integer, external :: zmq_delete_tasks + integer, external :: pt2_find_sample - - integer :: msg_size, rc, more - integer :: acc, i, j, robin, N, n_tasks - double precision, allocatable :: val(:) - integer(bit_kind), allocatable :: det(:,:,:) + integer :: more, n, i, p, c, t, n_tasks, U integer, allocatable :: task_id(:) integer, allocatable :: index(:) - double precision :: time0 - double precision :: time, timeLast, Nabove_old + double precision, external :: omp_get_wtime - integer :: tooth, firstTBDcomb, orgTBDcomb, n_tasks_max - integer, allocatable :: parts_to_get(:) - logical, allocatable :: actually_computed(:) - double precision :: eqt - character*(512) :: task - Nabove_old = -1.d0 - n_tasks_max = N_det_generators/100+1 + double precision :: v, x, avg, eqt, E0 + double precision :: time, time0 - allocate(actually_computed(N_det_generators), parts_to_get(N_det_generators), & - pt2_mwen(N_states, n_tasks_max) ) - - pt2_mwen(1:N_states, 1:n_tasks_max) = 0.d0 - do i=1,N_det_generators - actually_computed(i) = computed(i) - enddo - - parts_to_get(:) = 1 - if(fragment_first > 0) then - do i=1,fragment_first - parts_to_get(i) = fragment_count - enddo - endif - - do i=1,tbc(0) - actually_computed(tbc(i)) = .false. - end do - - orgTBDcomb = int(Nabove(1)) - firstTBDcomb = 1 + integer, allocatable :: f(:) + logical, allocatable :: d(:) zmq_to_qp_run_socket = new_zmq_to_qp_run_socket() - allocate(val(b%N), det(N_int, 2, b%N), task_id(n_tasks_max), index(n_tasks_max)) + allocate(task_id(pt2_n_tasks_max), index(pt2_n_tasks_max), f(N_det_generators)) + allocate(d(N_det_generators+1)) + allocate(eI(N_states, N_det_generators), eI_task(N_states, pt2_n_tasks_max)) + allocate(S(pt2_N_teeth+1), S2(pt2_N_teeth+1)) + + S(:) = 0d0 + S2(:) = 0d0 + n = 1 + t = 0 + U = 0 + eI(:,:) = 0d0 + f(:) = pt2_F(:) + d(:) = .false. + n_tasks = 0 + E0 = E more = 1 - call wall_time(time0) - timeLast = time0 + time0 = omp_get_wtime() - call get_first_tooth(actually_computed, tooth) - Nabove_old = Nabove(tooth) - - logical :: loop - loop = .True. - pullLoop : do while (loop) - - call pull_pt2_results(zmq_socket_pull, index, pt2_mwen, task_id, n_tasks) - do i=1,n_tasks - pt2_detail(1:N_states, index(i)) += pt2_mwen(1:N_states,i) - parts_to_get(index(i)) -= 1 - if(parts_to_get(index(i)) < 0) then - print *, i, index(i), parts_to_get(index(i)) - print *, parts_to_get - stop "PARTS ??" - end if - if(parts_to_get(index(i)) == 0) actually_computed(index(i)) = .true. - enddo - - integer, external :: zmq_delete_tasks - if (zmq_delete_tasks(zmq_to_qp_run_socket,zmq_socket_pull,task_id,n_tasks,more) == -1) then - cycle - endif - if (more == 0) then - loop = .False. - endif - - call wall_time(time) - - - if(time - timeLast > 5d0 .or. (.not.loop)) then - timeLast = time - do i=1, first_det_of_teeth(1)-1 - if(.not.(actually_computed(i))) then - cycle pullLoop + do while (n <= N_det_generators) + if(f(pt2_J(n)) == 0) then + d(pt2_J(n)) = .true. + do while(d(U+1)) + U += 1 + end do + do while(t <= pt2_N_teeth) + if(U >= pt2_n_0(t+1)) then + t=t+1 + E0 = E + do i=pt2_n_0(t),1,-1 + E0 += eI(pt2_stoch_istate, i) + end do + else + exit end if end do - - integer, external :: zmq_abort - double precision :: E0, avg, prop - - call do_carlo(tbc, Ncomb+1-firstTBDcomb, comb(firstTBDcomb), pt2_detail, actually_computed, sumabove, sum2above, Nabove) - firstTBDcomb = int(Nabove(1)) - orgTBDcomb + 1 - call get_first_tooth(actually_computed, tooth) - - if (firstTBDcomb > Ncomb) then - if (zmq_abort(zmq_to_qp_run_socket) == -1) then - call sleep(1) - if (zmq_abort(zmq_to_qp_run_socket) == -1) then - print *, irp_here, ': Error in sending abort signal (1)' - endif - endif -! exit pullLoop - endif - - E0 = sum(pt2_detail(pt2_stoch_istate,:first_det_of_teeth(tooth)-1)) - if (tooth <= comb_teeth) then - 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 - avg = E0 + (sumabove(tooth) / Nabove(tooth)) - eqt = sqrt(1d0 / (Nabove(tooth)-1.d0) * abs(sum2above(tooth) / Nabove(tooth) - (sumabove(tooth)/Nabove(tooth))**2)) - else - eqt = 0.d0 - tooth=comb_teeth - endif - call wall_time(time) - if ( ((dabs(eqt/avg) < relative_error) .or. (dabs(eqt) < absolute_error)) .and. Nabove(tooth) >= 10.d0) then - ! Termination - pt2(pt2_stoch_istate) = avg + + c = pt2_R(n) + if(c /= 0) then + x = 0d0 + do p=pt2_N_teeth, 1, -1 + v = pt2_u_0 + pt2_W_T * (pt2_u(c) + dble(p-1)) + i = pt2_find_sample(v, pt2_cW) + x += eI(pt2_stoch_istate, i) * pt2_W_T / pt2_w(i) + S(p) += x + S2(p) += x**2 + end do + avg = S(t) / dble(c) + eqt = (S2(t) / c) - (S(t)/c)**2 + eqt = sqrt(eqt / dble(c-1)) + pt2(pt2_stoch_istate) = E0-E+avg error(pt2_stoch_istate) = eqt - print '(G10.3, 2X, F16.10, 2X, G16.3, 2X, F16.4, A20)', Nabove(tooth), avg+E, eqt, time-time0, '' - if (zmq_abort(zmq_to_qp_run_socket) == -1) then - call sleep(1) - if (zmq_abort(zmq_to_qp_run_socket) == -1) then - print *, irp_here, ': Error in sending abort signal (2)' - endif - endif - else - 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, '' - Nabove_old = Nabove(tooth) - endif + time = omp_get_wtime() + if(mod(c,10)==1 .or. n==N_det_generators) print '(G10.3, 2X, F16.10, 2X, G16.3, 2X, F16.4, A20)', c, avg+E0, eqt, time-time0, '' + end if + n += 1 + else if(more == 0) then + exit + else + call pull_pt2_results(zmq_socket_pull, index, eI_task, task_id, n_tasks) + if (zmq_delete_tasks(zmq_to_qp_run_socket,zmq_socket_pull,task_id,n_tasks,more) == -1) then + stop 'Unable to delete tasks' endif + do i=1,n_tasks + eI(:, index(i)) += eI_task(:, i) + f(index(i)) -= 1 + end do end if - end do pullLoop - - if(tooth == comb_teeth+1) then - pt2(pt2_stoch_istate) = sum(pt2_detail(pt2_stoch_istate,:)) - error(pt2_stoch_istate) = 0d0 - else - 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)) - error(pt2_stoch_istate) = sqrt(1d0 / (Nabove(tooth)-1) * abs(sum2above(tooth) / Nabove(tooth) - (sumabove(tooth)/Nabove(tooth))**2)) - end if - + end do call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) - call sort_selection_buffer(b) end subroutine -integer function pt2_find(v, w, sze, imin, imax) + +integer function pt2_find_sample(v, w) implicit none - integer, intent(in) :: sze, imin, imax - double precision, intent(in) :: v, w(sze) - integer :: i,l,h - integer, parameter :: block=64 + double precision, intent(in) :: v, w(0:N_det_generators) + integer :: i,l,r - l = imin - h = imax-1 + l = 0 + r = N_det_generators - do while(h-l >= block) - i = ishft(h+l,-1) - if(w(i+1) > v) then - h = i-1 + do while(r-l > 1) + i = (r+l) / 2 + if(w(i) < v) then + l = i else - l = i+1 - end if - end do - !DIR$ LOOP COUNT (64) - do pt2_find=l,h - if(w(pt2_find) >= v) then - exit + r = i end if end do + + pt2_find_sample = r end function -BEGIN_PROVIDER [ integer, comb_teeth ] + BEGIN_PROVIDER[ integer, pt2_J, (N_det_generators)] +&BEGIN_PROVIDER[ double precision, pt2_u, (N_det_generators)] +&BEGIN_PROVIDER[ integer, pt2_R, (N_det_generators)] implicit none - BEGIN_DOC -! Number of teeth in the comb - END_DOC - comb_teeth = min(1+N_det/10,100) + integer :: N_c, N_j, U, t, i + double precision :: v + logical, allocatable :: d(:) + integer, external :: pt2_find_sample + + allocate(d(N_det_generators)) + + pt2_R(:) = 0 + N_c = 0 + N_j = pt2_n_0(1) + d(:) = .false. + do i=1,N_j + d(i) = .true. + pt2_J(i) = i + end do + call random_seed(put=(/3211,64,6566,321,65,321,654,65,321,6321,654,65,321,621,654,65,321,65,654,65,321,65/)) + call RANDOM_NUMBER(pt2_u) + call RANDOM_NUMBER(pt2_u) + + + + U = 0 + + do while(N_j < N_det_generators) + !ADD_COMB + N_c += 1 + do t=0, pt2_N_teeth-1 + v = pt2_u_0 + pt2_W_T * (dble(t) + pt2_u(N_c)) + i = pt2_find_sample(v, pt2_cW) + if(.not. d(i)) then + N_j += 1 + pt2_J(N_j) = i + d(i) = .true. + end if + end do + + pt2_R(N_j) = N_c + + !FILL_TOOTH + do while(U < N_det_generators) + U += 1 + if(.not. d(U)) then + N_j += 1 + pt2_J(N_j) = U + d(U) = .true. + exit; + end if + end do + enddo + if(N_det_generators > 1) then + pt2_R(N_det_generators-1) = 0 + pt2_R(N_det_generators) = N_c + end if END_PROVIDER - -subroutine get_first_tooth(computed, first_teeth) + BEGIN_PROVIDER [ double precision, pt2_w, (N_det_generators) ] +&BEGIN_PROVIDER [ double precision, pt2_cW, (0:N_det_generators) ] +&BEGIN_PROVIDER [ double precision, pt2_W_T ] +&BEGIN_PROVIDER [ double precision, pt2_u_0 ] +&BEGIN_PROVIDER [ integer, pt2_n_0, (pt2_N_teeth+1) ] implicit none - logical, intent(in) :: computed(N_det_generators) - integer, intent(out) :: first_teeth - integer :: i, first_det + integer :: i, t + double precision, allocatable :: tilde_w(:), tilde_cW(:) + double precision :: r, tooth_width + integer, external :: pt2_find_sample - first_det = N_det_generators+1+1 - first_teeth = 1 - do i=first_det_of_comb, N_det_generators - if(.not.(computed(i))) then - first_det = i + allocate(tilde_w(N_det_generators), tilde_cW(0:N_det_generators)) + + tilde_cW(0) = 0d0 + + do i=1,N_det_generators + tilde_w(i) = psi_coef_generators(i,pt2_stoch_istate)**2 + tilde_cW(i) = tilde_cW(i-1) + tilde_w(i) + enddo + + pt2_n_0(1) = 0 + do + pt2_u_0 = tilde_cW(pt2_n_0(1)) + r = tilde_cW(pt2_n_0(1) + pt2_minDetInFirstTeeth) + pt2_W_T = (1d0 - pt2_u_0) / dble(pt2_N_teeth) + if(pt2_W_T >= r - pt2_u_0) then exit end if - end do - - do i=comb_teeth+1, 1, -1 - if(first_det_of_teeth(i) < first_det) then - first_teeth = i - exit + pt2_n_0(1) += 1 + if(N_det_generators - pt2_n_0(1) < pt2_minDetInFirstTeeth * pt2_N_teeth) then + stop "teeth building failed" end if end do - -end subroutine - - -BEGIN_PROVIDER [ integer*8, size_tbc ] - implicit none - BEGIN_DOC -! Size of the tbc array - END_DOC - size_tbc = int((comb_teeth+1),8)*int(N_det_generators,8) + fragment_count*fragment_first -END_PROVIDER - -subroutine get_carlo_workbatch(computed, comb, Ncomb, tbc) - implicit none - integer, intent(inout) :: Ncomb - double precision, intent(out) :: comb(Ncomb) - integer, intent(inout) :: tbc(0:size_tbc) - logical, intent(inout) :: computed(N_det_generators) - integer :: i, j, last_full, dets(comb_teeth) - integer :: icount, n - integer :: k, l - l=first_det_of_comb - call RANDOM_NUMBER(comb) - do i=1,size(comb) - comb(i) = comb(i) * comb_step - !DIR$ FORCEINLINE - call add_comb(comb(i), computed, tbc, size_tbc, comb_teeth) - Ncomb = i - if (tbc(0) == N_det_generators) return - do while (computed(l)) - l=l+1 - enddo - k=tbc(0)+1 - tbc(k) = l - computed(l) = .True. - tbc(0) = k - enddo - -end subroutine - - - -subroutine get_comb(stato, dets, ct) - implicit none - integer, intent(in) :: ct - double precision, intent(in) :: stato - integer, intent(out) :: dets(ct) - double precision :: curs - integer :: j - integer, external :: pt2_find - - curs = 1d0 - stato - do j = comb_teeth, 1, -1 - !DIR$ FORCEINLINE - dets(j) = pt2_find(curs, pt2_cweight,size(pt2_cweight), first_det_of_teeth(j), first_det_of_teeth(j+1)) - curs -= comb_step + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + do t=2, pt2_N_teeth + r = pt2_u_0 + pt2_W_T * dble(t-1) + pt2_n_0(t) = pt2_find_sample(r, tilde_cW) end do -end subroutine - - -subroutine add_comb(comb, computed, tbc, stbc, ct) - implicit none - integer*8, intent(in) :: stbc - integer, intent(in) :: ct - double precision, intent(in) :: comb - logical, intent(inout) :: computed(N_det_generators) - integer, intent(inout) :: tbc(0:stbc) - integer :: i, k, l, dets(ct) - - !DIR$ FORCEINLINE - call get_comb(comb, dets, ct) - - k=tbc(0)+1 - do i = 1, ct - l = dets(i) - if(.not.(computed(l))) then - tbc(k) = l - k = k+1 - computed(l) = .true. - end if + pt2_n_0(pt2_N_teeth+1) = N_det_generators + + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + pt2_w(:pt2_n_0(1)) = tilde_w(:pt2_n_0(1)) + do t=1, pt2_N_teeth + tooth_width = tilde_cW(pt2_n_0(t+1)) - tilde_cW(pt2_n_0(t)) + do i=pt2_n_0(t)+1, pt2_n_0(t+1) + pt2_w(i) = tilde_w(i) * pt2_W_T / tooth_width + end do end do - tbc(0) = k-1 -end subroutine - - -BEGIN_PROVIDER [ integer, pt2_stoch_istate ] - implicit none - BEGIN_DOC - ! State for stochatsic PT2 - END_DOC - pt2_stoch_istate = 1 -END_PROVIDER - - - BEGIN_PROVIDER [ double precision, pt2_weight, (N_det_generators) ] -&BEGIN_PROVIDER [ double precision, pt2_cweight, (N_det_generators) ] -&BEGIN_PROVIDER [ double precision, pt2_cweight_cache, (N_det_generators) ] -&BEGIN_PROVIDER [ double precision, comb_step ] -&BEGIN_PROVIDER [ integer, first_det_of_teeth, (comb_teeth+1) ] -&BEGIN_PROVIDER [ integer, first_det_of_comb ] - implicit none - integer :: i - double precision :: norm_left, stato - integer, external :: pt2_find - - pt2_weight(1) = psi_coef_generators(1,pt2_stoch_istate)**2 - pt2_cweight(1) = psi_coef_generators(1,pt2_stoch_istate)**2 + pt2_cW(0) = 0d0 do i=1,N_det_generators - pt2_weight(i) = psi_coef_generators(i,pt2_stoch_istate)**2 - enddo - - ! Important to loop backwards for numerical precision - pt2_cweight(N_det_generators) = pt2_weight(N_det_generators) - do i=N_det_generators-1,1,-1 - pt2_cweight(i) = pt2_weight(i) + pt2_cweight(i+1) + pt2_cW(i) = pt2_cW(i-1) + pt2_w(i) end do - - do i=1,N_det_generators - pt2_weight(i) = pt2_weight(i) / pt2_cweight(1) - pt2_cweight(i) = pt2_cweight(i) / pt2_cweight(1) - enddo - - do i=1,N_det_generators-1 - pt2_cweight(i) = 1.d0 - pt2_cweight(i+1) - end do - pt2_cweight(N_det_generators) = 1.d0 - - norm_left = 1d0 - - comb_step = 1d0/dfloat(comb_teeth) - first_det_of_comb = 1 - do i=1,N_det_generators - if(pt2_weight(i)/norm_left < .5d0*comb_step) then - first_det_of_comb = i - exit - end if - norm_left -= pt2_weight(i) - end do - first_det_of_comb = max(2,first_det_of_comb) - call write_int(6, first_det_of_comb-1, 'Size of deterministic set') - - comb_step = (1d0 - pt2_cweight(first_det_of_comb-1)) * comb_step - - stato = 1d0 - comb_step - iloc = N_det_generators - do i=comb_teeth, 1, -1 - integer :: iloc - iloc = pt2_find(stato, pt2_cweight, N_det_generators, 1, iloc) - first_det_of_teeth(i) = iloc - stato -= comb_step - end do - first_det_of_teeth(comb_teeth+1) = N_det_generators + 1 - first_det_of_teeth(1) = first_det_of_comb - if(first_det_of_teeth(1) /= first_det_of_comb) then - print *, 'Error in ', irp_here - stop "comb provider" - endif - -END_PROVIDER - -BEGIN_PROVIDER [ double precision, pt2_weight_inv, (N_det_generators) ] - implicit none - BEGIN_DOC -! Inverse of pt2_weight array - END_DOC - integer :: i - do i=1,N_det_generators - pt2_weight_inv(i) = 1.d0/pt2_weight(i) - enddo - + pt2_n_0(pt2_N_teeth+1) = N_det_generators END_PROVIDER - diff --git a/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f b/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f index 6be25846..6d8b6a8c 100644 --- a/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f +++ b/plugins/Full_CI_ZMQ/run_pt2_slave.irp.f @@ -22,12 +22,11 @@ subroutine run_pt2_slave(thread,iproc,energy) logical :: done double precision,allocatable :: pt2(:,:) - integer :: n_tasks, k, n_tasks_max + integer :: n_tasks, k integer, allocatable :: i_generator(:), subset(:) - n_tasks_max = N_det_generators/100+1 - allocate(task_id(n_tasks_max), task(n_tasks_max)) - allocate(pt2(N_states,n_tasks_max), i_generator(n_tasks_max), subset(n_tasks_max)) + allocate(task_id(pt2_n_tasks_max), task(pt2_n_tasks_max)) + allocate(pt2(N_states,pt2_n_tasks_max), i_generator(pt2_n_tasks_max), subset(pt2_n_tasks_max)) zmq_to_qp_run_socket = new_zmq_to_qp_run_socket() @@ -47,7 +46,7 @@ subroutine run_pt2_slave(thread,iproc,energy) do while (.not.done) n_tasks = max(1,n_tasks) - n_tasks = min(n_tasks,n_tasks_max) + n_tasks = min(n_tasks,pt2_n_tasks_max) integer, external :: get_tasks_from_taskserver if (get_tasks_from_taskserver(zmq_to_qp_run_socket,worker_id, task_id, task, n_tasks) == -1) then @@ -66,7 +65,7 @@ subroutine run_pt2_slave(thread,iproc,energy) do k=1,n_tasks pt2(:,k) = 0.d0 buf%cur = 0 - call select_connected(i_generator(k),energy,pt2(1,k),buf,subset(k)) + call select_connected(i_generator(k),energy,pt2(1,k),buf,subset(k),pt2_F(i_generator(k))) enddo call wall_time(time1) @@ -201,12 +200,5 @@ IRP_ENDIF end subroutine - -BEGIN_PROVIDER [ double precision, pt2_workload, (N_det_generators) ] - integer :: i - do i=1,N_det_generators - pt2_workload(i) = dfloat(N_det_generators - i + 1)**2 - end do - pt2_workload = pt2_workload / sum(pt2_workload) -END_PROVIDER + diff --git a/plugins/Full_CI_ZMQ/run_selection_slave.irp.f b/plugins/Full_CI_ZMQ/run_selection_slave.irp.f index 39f6c01c..af5e4de0 100644 --- a/plugins/Full_CI_ZMQ/run_selection_slave.irp.f +++ b/plugins/Full_CI_ZMQ/run_selection_slave.irp.f @@ -177,7 +177,7 @@ subroutine run_selection_slave_old(thread,iproc,energy) else ASSERT (N == buf%N) end if - call select_connected(i_generator,energy,pt2,buf,subset) + call select_connected(i_generator,energy,pt2,buf,subset,fragment_count) endif integer, external :: task_done_to_taskserver diff --git a/plugins/Full_CI_ZMQ/selection.irp.f b/plugins/Full_CI_ZMQ/selection.irp.f index 277e6be5..de6bd9f5 100644 --- a/plugins/Full_CI_ZMQ/selection.irp.f +++ b/plugins/Full_CI_ZMQ/selection.irp.f @@ -46,11 +46,11 @@ subroutine get_mask_phase(det, phasemask) end subroutine -subroutine select_connected(i_generator,E0,pt2,b,subset) +subroutine select_connected(i_generator,E0,pt2,b,subset,csubset) use bitmasks use selection_types implicit none - integer, intent(in) :: i_generator, subset + integer, intent(in) :: i_generator, subset, csubset type(selection_buffer), intent(inout) :: b double precision, intent(inout) :: pt2(N_states) integer :: k,l @@ -71,7 +71,7 @@ subroutine select_connected(i_generator,E0,pt2,b,subset) particle_mask(k,1) = iand(generators_bitmask(k,1,s_part,l), not(psi_det_generators(k,1,i_generator)) ) particle_mask(k,2) = iand(generators_bitmask(k,2,s_part,l), not(psi_det_generators(k,2,i_generator)) ) enddo - call select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_diag_tmp,E0,pt2,b,subset) + call select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_diag_tmp,E0,pt2,b,subset,csubset) enddo deallocate(fock_diag_tmp) end subroutine @@ -266,7 +266,7 @@ subroutine get_m0(gen, phasemask, bannedOrb, vect, mask, h, p, sp, coefs) end -subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_diag_tmp,E0,pt2,buf,subset) +subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_diag_tmp,E0,pt2,buf,subset,csubset) use bitmasks use selection_types implicit none @@ -274,7 +274,7 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d ! WARNING /!\ : It is assumed that the generators and selectors are psi_det_sorted END_DOC - integer, intent(in) :: i_generator, subset + integer, intent(in) :: i_generator, subset, csubset 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) :: E0(N_states) @@ -298,7 +298,7 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d integer(bit_kind), allocatable:: preinteresting_det(:,:,:) allocate (preinteresting_det(N_int,2,N_det)) - PROVIDE fragment_count + !PROVIDE fragment_count monoAdo = .true. monoBdo = .true. @@ -571,7 +571,7 @@ subroutine select_singles_and_doubles(i_generator,hole_mask,particle_mask,fock_d end if maskInd += 1 - if(subset == 0 .or. mod(maskInd, fragment_count) == (subset-1)) then + if(mod(maskInd, csubset) == (subset-1)) then call spot_isinwf(mask, fullminilist, i_generator, fullinteresting(0), banned, fullMatch, fullinteresting) if(fullMatch) cycle diff --git a/plugins/dress_zmq/alpha_factory.irp.f b/plugins/dress_zmq/alpha_factory.irp.f index f590f5d1..e5b670fb 100644 --- a/plugins/dress_zmq/alpha_factory.irp.f +++ b/plugins/dress_zmq/alpha_factory.irp.f @@ -2,10 +2,10 @@ use bitmasks -subroutine alpha_callback(delta_ij_loc, i_generator, subset,iproc) +subroutine alpha_callback(delta_ij_loc, i_generator, subset, csubset, iproc) use bitmasks implicit none - integer, intent(in) :: i_generator, subset + integer, intent(in) :: i_generator, subset, csubset double precision,intent(inout) :: delta_ij_loc(N_states,N_det,2) integer, intent(in) :: iproc @@ -15,7 +15,7 @@ subroutine alpha_callback(delta_ij_loc, i_generator, subset,iproc) do l=1,N_generators_bitmask - call generate_singles_and_doubles(delta_ij_loc, i_generator,l,subset,iproc) + call generate_singles_and_doubles(delta_ij_loc,i_generator,l,subset,csubset,iproc) enddo end subroutine @@ -34,7 +34,7 @@ BEGIN_PROVIDER [ integer, psi_from_sorted_gen, (N_det) ] END_PROVIDER -subroutine generate_singles_and_doubles(delta_ij_loc, i_generator, bitmask_index, subset, iproc) +subroutine generate_singles_and_doubles(delta_ij_loc, i_generator, bitmask_index, subset, csubset, iproc) use bitmasks implicit none BEGIN_DOC @@ -42,7 +42,7 @@ subroutine generate_singles_and_doubles(delta_ij_loc, i_generator, bitmask_index END_DOC double precision,intent(inout) :: delta_ij_loc(N_states,N_det,2) - integer, intent(in) :: i_generator, subset, bitmask_index + integer, intent(in) :: i_generator, subset, csubset, bitmask_index integer, intent(in) :: iproc @@ -69,8 +69,8 @@ subroutine generate_singles_and_doubles(delta_ij_loc, i_generator, bitmask_index allocate(abuf(0:N_det*6), labuf(0:N_det)) allocate(preinteresting_det(N_int,2,N_det)) - PROVIDE fragment_count + maskInd = -1 monoAdo = .true. monoBdo = .true. @@ -193,7 +193,6 @@ subroutine generate_singles_and_doubles(delta_ij_loc, i_generator, bitmask_index allocate(counted(mo_tot_num, mo_tot_num), countedOrb(mo_tot_num, 2)) allocate (indexes(0:mo_tot_num, 0:mo_tot_num)) allocate (indexes_end(0:mo_tot_num, 0:mo_tot_num)) - maskInd = -1 integer :: nb_count do s1=1,2 do i1=N_holes(s1),1,-1 ! Generate low excitations first @@ -345,7 +344,7 @@ subroutine generate_singles_and_doubles(delta_ij_loc, i_generator, bitmask_index end if maskInd += 1 - if(subset == 0 .or. mod(maskInd, fragment_count) == (subset-1)) then + if(mod(maskInd, csubset) == (subset-1)) then call spot_isinwf(mask, fullminilist, i_generator, fullinteresting(0), banned, fullMatch, fullinteresting) if(fullMatch) cycle diff --git a/plugins/dress_zmq/dress_stoch_routines.irp.f b/plugins/dress_zmq/dress_stoch_routines.irp.f index 6b7bf396..136ecb7f 100644 --- a/plugins/dress_zmq/dress_stoch_routines.irp.f +++ b/plugins/dress_zmq/dress_stoch_routines.irp.f @@ -1,17 +1,205 @@ -BEGIN_PROVIDER [ integer, fragment_first ] +BEGIN_PROVIDER [ integer, dress_stoch_istate ] implicit none - fragment_first = first_det_of_teeth(1) + dress_stoch_istate = 1 +END_PROVIDER + + BEGIN_PROVIDER [ integer, pt2_N_teeth ] +&BEGIN_PROVIDER [ integer, pt2_minDetInFirstTeeth ] +&BEGIN_PROVIDER [ integer, pt2_n_tasks_max ] +&BEGIN_PROVIDER [ integer, pt2_F, (N_det_generators) ] + implicit none + logical, external :: testTeethBuilding + pt2_F(:) = 1 + !pt2_F(:N_det_generators/1000*0+50) = 1 + pt2_n_tasks_max = 16 ! N_det_generators/100 + 1 + + if(N_det_generators < 1024) then + pt2_minDetInFirstTeeth = 1 + pt2_N_teeth = 1 + else + do pt2_N_teeth=32,1,-1 + pt2_minDetInFirstTeeth = min(5, N_det_generators) + if(testTeethBuilding(pt2_minDetInFirstTeeth, pt2_N_teeth)) exit + end do + end if END_PROVIDER -subroutine ZMQ_dress(E, dress, delta_out, delta_s2_out, relative_error, lndet) +logical function testTeethBuilding(minF, N) + implicit none + integer, intent(in) :: minF, N + integer :: n0, i + double precision :: u0, Wt, r + + double precision, allocatable :: tilde_w(:), tilde_cW(:) + integer, external :: dress_find_sample + + allocate(tilde_w(N_det_generators), tilde_cW(0:N_det_generators)) + + tilde_cW(0) = 0d0 + do i=1,N_det_generators + tilde_w(i) = psi_coef_generators(i,dress_stoch_istate)**2 + tilde_cW(i) = tilde_cW(i-1) + tilde_w(i) + enddo + tilde_cW(N_det_generators) = 1d0 + + n0 = 0 + do + u0 = tilde_cW(n0) + r = tilde_cW(n0 + minF) + Wt = (1d0 - u0) / dble(N) + if(Wt >= r - u0) then + testTeethBuilding = .true. + return + end if + n0 += 1 + if(N_det_generators - n0 < minF * N) then + testTeethBuilding = .false. + return + end if + end do + stop "exited testTeethBuilding" +end function + +BEGIN_PROVIDER[ integer, dress_N_cp_max ] + dress_N_cp_max = 64 +END_PROVIDER + + BEGIN_PROVIDER[integer, pt2_J, (N_det_generators)] +&BEGIN_PROVIDER [integer, dress_R1, (0:N_det_generators) ] + implicit none + integer :: m,j + integer :: l,nmov + integer, allocatable :: iorder(:) + allocate(iorder(N_det_generators)) + + pt2_J = pt2_J_ + dress_R1 = dress_R1_ + + do m=1,dress_N_cp + nmov = 0 + l=dress_R1(m-1)+1 + do j=l, dress_R1(m) + if(dress_M_mi(m, pt2_J(j)) == 0 .and. pt2_J(j) > dress_dot_n_0(m)) then + pt2_J(j) += N_det_generators + nmov += 1 + end if + end do + if(dress_R1(m)-dress_R1(m-1) > 0) then + call isort(pt2_J(l), iorder, dress_R1(m)-dress_R1(m-1)) + end if + dress_R1(m) -= nmov + do j=dress_R1(m)+1, dress_R1(m) + nmov + pt2_J(j) -= N_det_generators + end do + end do +END_PROVIDER + + BEGIN_PROVIDER[ integer, dress_M_m, (dress_N_cp_max)] +&BEGIN_PROVIDER[ integer, pt2_J_, (N_det_generators)] +&BEGIN_PROVIDER[ double precision, pt2_u, (N_det_generators)] +&BEGIN_PROVIDER[ integer, dress_R1_, (0:N_det_generators)] +&BEGIN_PROVIDER[ double precision, dress_M_mi, (dress_N_cp_max, N_det_generators+1)] +&BEGIN_PROVIDER [ integer, dress_T, (N_det_generators) ] +&BEGIN_PROVIDER [ integer, dress_N_cp ] + implicit none + integer :: N_c, N_j, U, t, i, m + double precision :: v + double precision, allocatable :: tilde_M(:) + logical, allocatable :: d(:) + integer, external :: dress_find_sample + + allocate(d(N_det_generators), tilde_M(N_det_generators)) + + dress_M_mi = 0d0 + tilde_M = 0d0 + dress_R1_(:) = 0 + N_c = 0 + N_j = pt2_n_0(1) + d(:) = .false. + + U = min(1, N_det_generators/(dress_N_cp_max**2/2)) + do i=1,dress_N_cp_max-1 + dress_M_m(i) = U * ((i**2-i)/2)! / (dress_N_cp_max+1) + end do + + + + U = N_det_generators/((dress_N_cp_max**2+dress_N_cp_max)/2)+1 + do i=1, dress_N_cp_max + dress_M_m(i) = U * (((i*i)+i)/2) + end do + + dress_M_m(1) = min(dress_M_m(1), 2) + dress_M_m(dress_N_cp_max) = N_det_generators+1 + + do i=1,N_j + d(i) = .true. + pt2_J_(i) = i + end do + call random_seed(put=(/3211,64,6566,321,65,321,654,65,321,6321,654,65,321,621,654,65,321,65,654,65,321,65/)) + call RANDOM_NUMBER(pt2_u) + call RANDOM_NUMBER(pt2_u) + + U = 0 + + m = 1 + do while(N_j < N_det_generators) + !ADD_COMB + N_c += 1 + do t=0, pt2_N_teeth-1 + v = pt2_u_0 + pt2_W_T * (dble(t) + pt2_u(N_c)) + i = dress_find_sample(v, pt2_cW) + tilde_M(i) += 1d0 + if(.not. d(i)) then + N_j += 1 + pt2_J_(N_j) = i + d(i) = .true. + end if + end do + + !FILL_TOOTH + do while(U < N_det_generators) + U += 1 + if(.not. d(U)) then + N_j += 1 + pt2_J_(N_j) = U + d(U) = .true. + exit; + end if + end do + + if(N_c == dress_M_m(m)) then + dress_R1_(m) = N_j + dress_M_mi(m, :N_det_generators) = tilde_M(:) + m += 1 + end if + enddo + + dress_N_cp = m-1 + dress_R1_(dress_N_cp) = N_j + dress_M_m(dress_N_cp) = N_c + !!!!!!!!!!!!!! + + do i=1, pt2_n_0(1) + dress_T(i) = 0 + end do + + do t=2,pt2_N_teeth+1 + do i=pt2_n_0(t-1)+1, pt2_n_0(t) + dress_T(i) = t-1 + end do + end do + !!!!!!!!!!!!! +END_PROVIDER + + +subroutine ZMQ_dress(E, dress, delta_out, delta_s2_out, relative_error) use f77_zmq implicit none - integer, intent(in) :: lndet character(len=64000) :: task - character(len=3200) :: temp integer(ZMQ_PTR) :: zmq_to_qp_run_socket, zmq_socket_pull integer, external :: omp_get_thread_num double precision, intent(in) :: E(N_states), relative_error @@ -24,12 +212,9 @@ subroutine ZMQ_dress(E, dress, delta_out, delta_s2_out, relative_error, lndet) integer :: i, j, k, Ncp - double precision, external :: omp_get_wtime - double precision :: time integer, external :: add_task_to_taskserver double precision :: state_average_weight_save(N_states) task(:) = CHAR(0) - temp(:) = CHAR(0) allocate(delta(N_states,N_det), delta_s2(N_states, N_det)) state_average_weight_save(:) = state_average_weight(:) do dress_stoch_istate=1,N_states @@ -39,7 +224,7 @@ subroutine ZMQ_dress(E, dress, delta_out, delta_s2_out, relative_error, lndet) TOUCH state_average_weight !provide psi_coef_generators - provide nproc fragment_first fragment_count mo_bielec_integrals_in_map mo_mono_elec_integral dress_weight psi_selectors + provide nproc mo_bielec_integrals_in_map mo_mono_elec_integral psi_selectors !print *, dress_e0_denominator print *, '========== ================= ================= =================' @@ -75,65 +260,23 @@ subroutine ZMQ_dress(E, dress, delta_out, delta_s2_out, relative_error, lndet) integer(ZMQ_PTR), external :: new_zmq_to_qp_run_socket - integer :: ipos, sz - integer :: block(1), block_i, cur_tooth_reduce, ntas - logical :: flushme - block = 0 - block_i = 0 - cur_tooth_reduce = 0 - ipos=1 - ntas = 0 - do i=1,N_dress_jobs+1 - flushme = (i==N_dress_jobs+1 .or. block_i == size(block) .or. block_i >=cur_tooth_reduce ) - if(.not. flushme) flushme = (tooth_reduce(dress_jobs(i)) == 0 .or. tooth_reduce(dress_jobs(i)) /= cur_tooth_reduce) - - if(flushme .and. block_i > 0) then - if(block(1) > fragment_first) then - ntas += 1 - write(temp, '(I9,1X,60(I9,1X))') 0, block(:block_i) - sz = len(trim(temp))+1 - temp(sz:sz) = '|' - !write(task(ipos:ipos+20),'(I9,1X,I9,''|'')') 0, dress_jobs(i) - write(task(ipos:ipos+sz), *) temp(:sz) - !ipos += 20 - ipos += sz+1 - if (ipos > 63000 .or. i==N_dress_jobs+1) then - if (add_task_to_taskserver(zmq_to_qp_run_socket,trim(task(1:ipos))) == -1) then - stop 'Unable to add task to task server' - endif - - ipos=1 - endif - else - if(block_i /= 1) stop "reduced fragmented dets" - do j=1,fragment_count - ntas += 1 - write(task(ipos:ipos+20),'(I9,1X,I9,''|'')') j, block(1) - ipos += 20 - if (ipos > 63000 .or. i==N_dress_jobs+1) then - ntas += 1 - if (add_task_to_taskserver(zmq_to_qp_run_socket,trim(task(1:ipos))) == -1) then - stop 'Unable to add task to task server' - endif - ipos=1 - endif - end do - end if - block_i = 0 - block = 0 - end if - - if(i /= N_dress_jobs+1) then - cur_tooth_reduce = tooth_reduce(dress_jobs(i)) - block_i += 1 - block(block_i) = dress_jobs(i) - end if + + + do i=1,N_det_generators + do j=1,pt2_F(pt2_J(i)) + write(task(1:20),'(I9,1X,I9''|'')') j, pt2_J(i) + if (add_task_to_taskserver(zmq_to_qp_run_socket,trim(task(1:20))) == -1) then + stop 'Unable to add task to task server' + endif + end do end do if (zmq_set_running(zmq_to_qp_run_socket) == -1) then print *, irp_here, ': Failed in zmq_set_running' endif call omp_set_nested(.true.) + +if (.false.) then !! TODO !$OMP PARALLEL DEFAULT(shared) NUM_THREADS(2) & !$OMP PRIVATE(i) i = omp_get_thread_num() @@ -144,9 +287,17 @@ subroutine ZMQ_dress(E, dress, delta_out, delta_s2_out, relative_error, lndet) call dress_slave_inproc(i) endif !$OMP END PARALLEL + +else + + call dress_collector(zmq_socket_pull,E, relative_error, delta, delta_s2, dress,& + dress_stoch_istate) +endif + call omp_set_nested(.false.) delta_out(dress_stoch_istate,1:N_det) = delta(dress_stoch_istate,1:N_det) delta_s2_out(dress_stoch_istate,1:N_det) = delta_s2(dress_stoch_istate,1:N_det) + call end_parallel_job(zmq_to_qp_run_socket, zmq_socket_pull, 'dress') print *, '========== ================= ================= =================' @@ -166,6 +317,73 @@ subroutine dress_slave_inproc(i) call run_dress_slave(1,i,dress_e0_denominator) end + BEGIN_PROVIDER [integer, dress_dot_F, (dress_N_cp)] +&BEGIN_PROVIDER [ integer, dress_P, (N_det_generators) ] + implicit none + integer :: m,i + + do m=1,dress_N_cp + do i=dress_R1(m-1)+1, dress_R1(m) + dress_P(pt2_J(i)) = m + end do + end do + + dress_dot_F = 0 + do m=1,dress_N_cp + do i=dress_R1(m-1)+1,dress_R1(m) + dress_dot_F(m) += pt2_F(pt2_J(i)) + end do + end do + do m=2,dress_N_cp + dress_dot_F(m) += dress_dot_F(m-1) + end do +END_PROVIDER + +BEGIN_PROVIDER [double precision, dress_e, (N_det_generators, dress_N_cp)] +&BEGIN_PROVIDER [integer, dress_dot_t, (0:dress_N_cp)] +&BEGIN_PROVIDER [integer, dress_dot_n_0, (0:dress_N_cp)] + implicit none + + logical, allocatable :: d(:) + integer :: U, m, t, i + + allocate(d(N_det_generators+1)) + + dress_e(:,:) = 0d0 + dress_dot_t(:) = 0 + dress_dot_n_0(:) = 0 + d(:) = .false. + U=0 + + do m=1,dress_N_cp + do i=dress_R1_(m-1)+1,dress_R1_(m) + !dress_dot_F(m) += pt2_F(pt2_J_(i)) + d(pt2_J_(i)) = .true. + end do + + do while(d(U+1)) + U += 1 + end do + + dress_dot_t(m) = pt2_N_teeth + 1 + dress_dot_n_0(m) = N_det_generators + + do t = 2, pt2_N_teeth+1 + if(U < pt2_n_0(t)) then + dress_dot_t(m) = t-1 + dress_dot_n_0(m) = pt2_n_0(t-1) + exit + end if + end do + do i=dress_dot_n_0(m)+1, N_det_generators !pt2_n_0(t+1) + dress_e(i,m) = pt2_W_T * dress_M_mi(m,i) / pt2_w(i) + end do + end do + + do m=dress_N_cp, 2, -1 + dress_e(:,m) -= dress_e(:,m-1) + end do +END_PROVIDER subroutine dress_collector(zmq_socket_pull, E, relative_error, delta, delta_s2, dress, istate) @@ -179,553 +397,221 @@ subroutine dress_collector(zmq_socket_pull, E, relative_error, delta, delta_s2, double precision, intent(in) :: relative_error, E(N_states) double precision, intent(out) :: dress(N_states) - double precision, allocatable :: cp(:,:,:,:) double precision, intent(out) :: delta(N_states, N_det) double precision, intent(out) :: delta_s2(N_states, N_det) - double precision, allocatable :: delta_loc(:,:,:) - double precision, allocatable :: dress_detail(:,:) - double precision :: dress_mwen(N_states) + double precision, allocatable :: breve_delta_m(:,:,:), S(:), S2(:) + double precision, allocatable :: edI(:,:), edI_task(:,:) + integer, allocatable :: edI_index(:) integer(ZMQ_PTR),external :: new_zmq_to_qp_run_socket integer(ZMQ_PTR) :: zmq_to_qp_run_socket - integer(ZMQ_PTR), external :: new_zmq_pull_socket - - integer :: more - integer :: i, j, k, i_state, N - integer :: task_id, ind - double precision, save :: time0 = -1.d0 - double precision :: time + integer(ZMQ_PTR), external :: new_zmq_pull_socket, zmq_abort + integer, allocatable :: task_id(:) + integer :: i, c, j, k, f, t, m, p, m_task + integer :: more, n_tasks + double precision :: E0, error, x, v, time, time0 + double precision :: avg, eqt double precision, external :: omp_get_wtime - integer :: cur_cp, last_cp - integer :: delta_loc_cur, is, N_buf(3) - integer, allocatable :: int_buf(:), agreg_for_cp(:) - double precision, allocatable :: double_buf(:) - integer(bit_kind), allocatable :: det_buf(:,:,:) - integer, external :: zmq_delete_tasks - last_cp = 10000000 - allocate(agreg_for_cp(N_cp)) - agreg_for_cp = 0 - allocate(int_buf(N_dress_int_buffer), double_buf(N_dress_double_buffer), det_buf(N_int,2,N_dress_det_buffer)) - delta_loc_cur = 1 + integer, allocatable :: dot_f(:) + integer, external :: zmq_delete_tasks, dress_find_sample + logical :: found + integer :: worker_id + zmq_to_qp_run_socket = new_zmq_to_qp_run_socket() + call connect_to_taskserver(zmq_to_qp_run_socket,worker_id,1) + + found = .false. delta = 0d0 delta_s2 = 0d0 - allocate(cp(N_states, N_det, N_cp, 2), dress_detail(N_states, N_det)) - allocate(delta_loc(N_states, N_det, 2)) - dress_detail = -1000d0 - cp = 0d0 - character*(512) :: task - - zmq_to_qp_run_socket = new_zmq_to_qp_run_socket() + allocate(task_id(pt2_n_tasks_max)) + allocate(edI(N_states, N_det)) + allocate(edI_task(N_states, N_det), edI_index(N_det)) + allocate(breve_delta_m(N_states, N_det, 2)) + allocate(dot_f(dress_N_cp+1)) + allocate(S(pt2_N_teeth+1), S2(pt2_N_teeth+1)) + edI = 0d0 + + dot_f(:dress_N_cp) = dress_dot_F(:) + dot_f(dress_N_cp+1) = 1 + more = 1 + m = 1 + c = 0 + S(:) = 0d0 + S2(:) = 0d0 + time = omp_get_wtime() + time0 = -1d0 ! omp_get_wtime() more = 1 - if (time0 < 0.d0) then - call wall_time(time0) - endif - logical :: loop, floop - floop = .true. - loop = .true. - - pullLoop : do while (loop) - call pull_dress_results(zmq_socket_pull, ind, cur_cp, delta_loc, int_buf, double_buf, det_buf, N_buf, task_id, dress_mwen) - if(floop) then - call wall_time(time) - time0 = time - floop = .false. - end if - if(cur_cp == -1 .and. ind == N_det_generators) then - call wall_time(time) - end if - - if(cur_cp == -1) then - call dress_pulled(ind, int_buf, double_buf, det_buf, N_buf) - if (zmq_delete_tasks(zmq_to_qp_run_socket,zmq_socket_pull,task_id,1,more) == -1) then - stop 'Unable to delete tasks' - endif - if(more == 0) loop = .false. !stop 'loop = .false.' !!!!!!!!!!!!!!!! - dress_detail(:, ind) = dress_mwen(:) - !print *, "DETAIL", ind, dress_mwen - else if(cur_cp > 0) then - if(ind == 0) cycle - !$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(i) - do i=1,N_det - cp(:,i,cur_cp,1) += delta_loc(:,i,1) + do while (.not. found) + if(dot_f(m) == 0) then + E0 = 0 + do i=dress_dot_n_0(m),1,-1 + E0 += edI(dress_stoch_istate, i) end do - - !$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(i) - do i=1,N_det - cp(:,i,cur_cp,2) += delta_loc(:,i,2) + do while(c < dress_M_m(m)) + c = c+1 + x = 0d0 + do p=pt2_N_teeth, 1, -1 + v = pt2_u_0 + pt2_W_T * (pt2_u(c) + dble(p-1)) + i = dress_find_sample(v, pt2_cW) + x += edI(dress_stoch_istate, i) * pt2_W_T / pt2_w(i) + S(p) += x + S2(p) += x**2 + end do end do - !$OMP END PARALLEL DO - agreg_for_cp(cur_cp) += ind - !print *, agreg_for_cp(cur_cp), ind, needed_by_cp(cur_cp), cur_cp - if(agreg_for_cp(cur_cp) > needed_by_cp(cur_cp)) then - stop "too much results..." + t = dress_dot_t(m) + avg = S(t) / dble(c) + eqt = (S2(t) / c) - (S(t)/c)**2 + eqt = sqrt(eqt / dble(c-1)) + error = eqt + time = omp_get_wtime() + print '(G10.3, 2X, F16.10, 2X, G16.3, 2X, F16.4, A20)', c, avg+E0+E(dress_stoch_istate), eqt, time-time0, '' + m += 1 + if(eqt <= relative_error) then + integer, external :: zmq_put_dvector + i= zmq_put_dvector(zmq_to_qp_run_socket, worker_id, "ending", dble(m-1), 1) + found = .true. end if - if(agreg_for_cp(cur_cp) /= needed_by_cp(cur_cp)) cycle - - call wall_time(time) - - last_cp = cur_cp - double precision :: su, su2, eqt, avg, E0, val - integer, external :: zmq_abort - - su = 0d0 - su2 = 0d0 - !$OMP PARALLEL DO DEFAULT(NONE) PRIVATE(i, val) SHARED(comb, dress_detail, & - !$OMP cur_cp,istate,cps_N) REDUCTION(+:su) REDUCTION(+:su2) - do i=1, int(cps_N(cur_cp)) - call get_comb_val(comb(i), dress_detail, cur_cp, val, istate) - su += val - su2 += val*val - end do - !$OMP END PARALLEL DO - - avg = su / cps_N(cur_cp) - eqt = dsqrt( ((su2 / cps_N(cur_cp)) - avg*avg) / cps_N(cur_cp) ) - E0 = sum(dress_detail(istate, :first_det_of_teeth(cp_first_tooth(cur_cp))-1)) - 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))) - end if - - !print '(I2X, F16.7, 2X, G16.3, 2X, F16.4, A20)', avg+E(istate)+E0, eqt, time-time0, '' - print '(G10.3, 2X, F16.10, 2X, G16.3, 2X, F16.4, A20)', cps_N(cur_cp), avg+E0+E(istate), eqt, time-time0, '' - if ((dabs(eqt/(avg+E0+E(istate))) < relative_error .and. cps_N(cur_cp) >= 10)) then - ! Termination - print *, "TERMINATE" - if (zmq_abort(zmq_to_qp_run_socket) == -1) then - call sleep(1) - if (zmq_abort(zmq_to_qp_run_socket) == -1) then - print *, irp_here, ': Error in sending abort signal (2)' + else + do + call pull_dress_results(zmq_socket_pull, m_task, f, edI_task, edI_index, breve_delta_m, task_id, n_tasks) + if(time0 == -1d0) then + print *, "first pull", omp_get_wtime()-time + time0 = omp_get_wtime() + end if + if(m_task == 0) then + if (zmq_delete_tasks(zmq_to_qp_run_socket,zmq_socket_pull,task_id,n_tasks,more) == -1) then + stop 'Unable to delete tasks' endif - endif - endif + else + !if(task_id(1) /= 0) stop "TASKID" + !i= zmq_delete_tasks(zmq_to_qp_run_socket,zmq_socket_pull,task_id,1,more) + exit + end if + end do + do i=1,n_tasks + edI(:, edI_index(i)) += edI_task(:, i) + end do + dot_f(m_task) -= f end if - end do pullLoop + end do + if (zmq_abort(zmq_to_qp_run_socket) == -1) then + call sleep(1) + if (zmq_abort(zmq_to_qp_run_socket) == -1) then + print *, irp_here, ': Error in sending abort signal (2)' + endif + endif - delta(:,:) = cp(:,:,last_cp,1) - delta_s2(:,:) = cp(:,:,last_cp,2) + integer :: ff + ff = dress_dot_F(m-1) + delta= 0d0 + delta_s2 = 0d0 + do while(more /= 0) + call pull_dress_results(zmq_socket_pull, m_task, f, edI_task, edI_index, breve_delta_m, task_id, n_tasks) + + !if(task_id(0) == 0) cycle + if(m_task == 0) then + i = zmq_delete_tasks(zmq_to_qp_run_socket,zmq_socket_pull,task_id,n_tasks,more) + else if(m_task < 0) then + i = zmq_delete_tasks(zmq_to_qp_run_socket,zmq_socket_pull,task_id,1,more) + end if + + + if(m_task >= 0) cycle + ff = ff - f + delta(:,:) += breve_delta_m(:,:,1) + delta_s2(:,:) += breve_delta_m(:,:,2) + end do dress(istate) = E(istate)+E0+avg + if(ff /= 0) stop "WRONG NUMBER OF FRAGMENTS COLLECTED" + call disconnect_from_taskserver(zmq_to_qp_run_socket,worker_id) call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) end subroutine -integer function dress_find(v, w, sze, imin, imax) +integer function dress_find_sample(v, w) implicit none - integer, intent(in) :: sze, imin, imax - double precision, intent(in) :: v, w(sze) - integer :: i,l,h - integer, parameter :: block=64 + double precision, intent(in) :: v, w(0:N_det_generators) + integer :: i,l,r - l = imin - h = imax-1 + l = 0 + r = N_det_generators - do while(h-l >= block) - i = ishft(h+l,-1) - if(w(i+1) > v) then - h = i-1 + do while(r-l > 1) + i = (r+l) / 2 + if(w(i) < v) then + l = i else - l = i+1 - end if - end do - !DIR$ LOOP COUNT (64) - do dress_find=l,h - if(w(dress_find) >= v) then - exit + r = i end if end do + + dress_find_sample = r end function - BEGIN_PROVIDER [ integer, gen_per_cp ] -&BEGIN_PROVIDER [ integer, comb_teeth ] -&BEGIN_PROVIDER [ integer, N_cps_max ] + + BEGIN_PROVIDER [ double precision, pt2_w, (N_det_generators) ] +&BEGIN_PROVIDER [ double precision, pt2_cW, (0:N_det_generators) ] +&BEGIN_PROVIDER [ double precision, pt2_W_T ] +&BEGIN_PROVIDER [ double precision, pt2_u_0 ] +&BEGIN_PROVIDER [ integer, pt2_n_0, (pt2_N_teeth+1) ] implicit none - BEGIN_DOC -! N_cps_max : max number of checkpoints -! -! gen_per_cp : number of generators per checkpoint - END_DOC - comb_teeth = min(1+N_det/10,10) - N_cps_max = 16 - gen_per_cp = (N_det_generators / N_cps_max) + 1 -END_PROVIDER + integer :: i, t + double precision, allocatable :: tilde_w(:), tilde_cW(:) + double precision :: r, tooth_width + integer, external :: dress_find_sample - - BEGIN_PROVIDER [ integer, N_cp ] -&BEGIN_PROVIDER [ double precision, cps_N, (N_cps_max) ] -&BEGIN_PROVIDER [ integer, cp_first_tooth, (N_cps_max) ] -&BEGIN_PROVIDER [ integer, done_cp_at, (N_det_generators) ] -&BEGIN_PROVIDER [ integer, done_cp_at_det, (N_det_generators) ] -&BEGIN_PROVIDER [ integer, needed_by_cp, (0:N_cps_max) ] -&BEGIN_PROVIDER [ double precision, cps, (N_det_generators, N_cps_max) ] -&BEGIN_PROVIDER [ integer, N_dress_jobs ] -&BEGIN_PROVIDER [ integer, dress_jobs, (N_det_generators) ] -&BEGIN_PROVIDER [ double precision, comb, (N_det_generators) ] -&BEGIN_PROVIDER [ integer, tooth_reduce, (N_det_generators) ] - implicit none - logical, allocatable :: computed(:), comp_filler(:) - integer :: i, j, last_full, dets(comb_teeth) + allocate(tilde_w(N_det_generators), tilde_cW(0:N_det_generators)) - integer :: k, l, cur_cp, under_det(comb_teeth+1) - integer :: cp_limit(N_cps_max) - integer, allocatable :: iorder(:), first_cp(:) - integer, allocatable :: filler(:) - integer :: nfiller, lfiller, cfiller - logical :: fracted - - integer :: first_suspect - provide psi_coef_generators - first_suspect = 1 - - allocate(filler(n_det_generators)) - allocate(iorder(N_det_generators), first_cp(N_cps_max+1)) - allocate(computed(N_det_generators)) - allocate(comp_filler(N_det_generators)) - first_cp = 1 - cps = 0d0 - cur_cp = 1 - done_cp_at = 0 - done_cp_at_det = 0 - needed_by_cp = 0 - comp_filler = .false. - computed = .false. - cps_N = 1d0 - tooth_reduce = 0 + tilde_cW(0) = 0d0 - integer :: fragsize - fragsize = N_det_generators / ((N_cps_max-1+1)*(N_cps_max-1+2)/2) - - do i=1,N_cps_max - cp_limit(i) = fragsize * i * (i+1) / 2 - end do - cp_limit(N_cps_max) = N_det*2 - - N_dress_jobs = first_det_of_comb - 1 - do i=1, N_dress_jobs - dress_jobs(i) = i - computed(i) = .true. - end do - - l=first_det_of_comb - call random_seed(put=(/321,654,65,321,65,321,654,65,321,6321,654,65,321,621,654,65,321,65,654,65,321,65/)) - call RANDOM_NUMBER(comb) - lfiller = 1 - nfiller = 1 do i=1,N_det_generators - !print *, i, N_dress_jobs - comb(i) = comb(i) * comb_step - !DIR$ FORCEINLINE - call add_comb(comb(i), computed, cps(1, cur_cp), N_dress_jobs, dress_jobs) - - !if(N_dress_jobs / gen_per_cp > (cur_cp-1) .or. N_dress_jobs == N_det_generators) then - if(N_dress_jobs > cp_limit(cur_cp) .or. N_dress_jobs == N_det_generators) then - first_cp(cur_cp+1) = N_dress_jobs - done_cp_at(N_dress_jobs) = cur_cp - cps_N(cur_cp) = dfloat(i) - if(N_dress_jobs /= N_det_generators) then - cps(:, cur_cp+1) = cps(:, cur_cp) - cur_cp += 1 - end if - - if (N_dress_jobs == N_det_generators) then - exit - end if - end if - - !!!!!!!!!!!!!!!!!!!!!!!! - if(.TRUE.) then - do l=first_suspect,N_det_generators - if((.not. computed(l))) then - N_dress_jobs+=1 - dress_jobs(N_dress_jobs) = l - computed(l) = .true. - first_suspect = l - exit - end if - end do - - if (N_dress_jobs == N_det_generators) exit - - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - ELSE - !!!!!!!!!!!!!!!!!!!!!!!!!!!! - do l=first_suspect,N_det_generators - if((.not. computed(l)) .and. (.not. comp_filler(l))) exit - end do - first_suspect = l - if(l > N_det_generators) cycle - - cfiller = tooth_of_det(l)-1 - if(cfiller > lfiller) then - do j=1,nfiller-1 - if(.not. computed(filler(j))) then - k=N_dress_jobs+1 - dress_jobs(k) = filler(j) - N_dress_jobs = k - end if - computed(filler(j)) = .true. - end do - nfiller = 2 - filler(1) = l - lfiller = cfiller - else - filler(nfiller) = l - nfiller += 1 - end if - comp_filler(l) = .True. - end if - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + tilde_w(i) = psi_coef_generators(i,dress_stoch_istate)**2 + tilde_cW(i) = tilde_cW(i-1) + tilde_w(i) enddo - + tilde_cW(N_det_generators) = 1d0 - do j=1,nfiller-1 - if(.not. computed(filler(j)))then - k=N_dress_jobs+1 - dress_jobs(k) = filler(j) - N_dress_jobs = k - end if - computed(filler(j)) = .true. - end do - - - N_cp = cur_cp - - if(N_dress_jobs /= N_det_generators .or. N_cp > N_cps_max) then - print *, N_dress_jobs, N_det_generators, N_cp, N_cps_max - stop "error in jobs creation" - end if - - cur_cp = 0 - do i=1,N_dress_jobs - if(done_cp_at(i) /= 0) cur_cp = done_cp_at(i) - done_cp_at(i) = cur_cp - done_cp_at_det(dress_jobs(i)) = cur_cp - needed_by_cp(cur_cp) += 1 - end do - - - under_det = 0 - cp_first_tooth = 0 - do i=1,N_dress_jobs - do j=comb_teeth+1,1,-1 - if(dress_jobs(i) <= first_det_of_teeth(j)) then - under_det(j) = under_det(j) + 1 - if(under_det(j) == first_det_of_teeth(j))then - do l=done_cp_at(i)+1, N_cp - cps(:first_det_of_teeth(j)-1, l) = 0d0 - cp_first_tooth(l) = j - end do - cps(first_det_of_teeth(j), done_cp_at(i)+1) = & - cps(first_det_of_teeth(j), done_cp_at(i)+1) * fractage(j) - end if - else - exit - end if - end do - end do - cp_first_tooth(N_cp) = comb_teeth+1 - - do i=1,N_det_generators - do j=N_cp,2,-1 - cps(i,j) -= cps(i,j-1) - end do - end do - - iorder = -1 - - cps(:, N_cp) = 0d0 - - iloop : do i=fragment_first+1,N_det_generators - k = tooth_of_det(i) - if(k == 0) cycle - if (i == first_det_of_teeth(k)) cycle - - do j=1,N_cp - if(cps(i, j) /= 0d0) cycle iloop - end do - - tooth_reduce(i) = k - end do iloop - - do i=1,N_det_generators - if(tooth_reduce(dress_jobs(i)) == 0) dress_jobs(i) = dress_jobs(i)+N_det*2 - end do - - do i=1,N_cp-1 - call isort(dress_jobs(first_cp(i)+1),iorder,first_cp(i+1)-first_cp(i)-1) - end do - - do i=1,N_det_generators - if(dress_jobs(i) > N_det) dress_jobs(i) = dress_jobs(i) - N_det*2 - end do -END_PROVIDER - - -subroutine get_comb_val(stato, detail, cur_cp, val, istate) - implicit none - integer, intent(in) :: cur_cp, istate - integer :: first - double precision, intent(in) :: stato, detail(N_states, N_det_generators) - double precision, intent(out) :: val - double precision :: curs - integer :: j, k - integer, external :: dress_find - - curs = 1d0 - stato - val = 0d0 - first = cp_first_tooth(cur_cp) - - do j = comb_teeth, first, -1 - !DIR$ FORCEINLINE - k = dress_find(curs, dress_cweight,size(dress_cweight), first_det_of_teeth(j), first_det_of_teeth(j+1)) - if(k == first_det_of_teeth(first)) then - val += detail(istate, k) * dress_weight_inv(k) * comb_step * fractage(first) - else - val += detail(istate, k) * dress_weight_inv(k) * comb_step - end if - - curs -= comb_step - end do -end subroutine - - -subroutine get_comb(stato, dets) - implicit none - double precision, intent(in) :: stato - integer, intent(out) :: dets(comb_teeth) - double precision :: curs - integer :: j - integer, external :: dress_find - - curs = 1d0 - stato - do j = comb_teeth, 1, -1 - !DIR$ FORCEINLINE - dets(j) = dress_find(curs, dress_cweight,size(dress_cweight), first_det_of_teeth(j), first_det_of_teeth(j+1)) - curs -= comb_step - end do -end subroutine - - -subroutine add_comb(com, computed, cp, N, tbc) - implicit none - double precision, intent(in) :: com - integer, intent(inout) :: N - double precision, intent(inout) :: cp(N_det) - logical, intent(inout) :: computed(N_det_generators) - integer, intent(inout) :: tbc(N_det_generators) - integer :: i, k, l, dets(comb_teeth) - - !DIR$ FORCEINLINE - call get_comb(com, dets) - k=N+1 - do i = 1, comb_teeth - l = dets(i) - cp(l) += 1d0 - if(.not.(computed(l))) then - tbc(k) = l - k = k+1 - computed(l) = .true. - end if - end do - N = k-1 -end subroutine - - -BEGIN_PROVIDER [ integer, dress_stoch_istate ] - implicit none - dress_stoch_istate = 1 -END_PROVIDER - - - BEGIN_PROVIDER [ double precision, dress_weight, (N_det_generators) ] -&BEGIN_PROVIDER [ double precision, dress_weight_inv, (N_det_generators) ] -&BEGIN_PROVIDER [ double precision, dress_cweight, (N_det_generators) ] -&BEGIN_PROVIDER [ double precision, dress_cweight_cache, (N_det_generators) ] -&BEGIN_PROVIDER [ double precision, fractage, (comb_teeth) ] -&BEGIN_PROVIDER [ double precision, comb_step ] -&BEGIN_PROVIDER [ integer, first_det_of_teeth, (comb_teeth+1) ] -&BEGIN_PROVIDER [ integer, first_det_of_comb ] -&BEGIN_PROVIDER [ integer, tooth_of_det, (N_det_generators) ] - implicit none - integer :: i - double precision :: norm_left, stato - integer, external :: dress_find - - dress_weight(1) = psi_coef_generators(1,dress_stoch_istate)**2 - dress_cweight(1) = psi_coef_generators(1,dress_stoch_istate)**2 - - do i=1,N_det_generators - dress_weight(i) = psi_coef_generators(i,dress_stoch_istate)**2 - enddo - - ! Important to loop backwards for numerical precision - dress_cweight(N_det_generators) = dress_weight(N_det_generators) - do i=N_det_generators-1,1,-1 - dress_cweight(i) = dress_weight(i) + dress_cweight(i+1) - end do - - do i=1,N_det_generators - dress_weight(i) = dress_weight(i) / dress_cweight(1) - dress_cweight(i) = dress_cweight(i) / dress_cweight(1) - enddo - - do i=1,N_det_generators-1 - dress_cweight(i) = 1.d0 - dress_cweight(i+1) - end do - dress_cweight(N_det_generators) = 1.d0 - - norm_left = 1d0 - - comb_step = 1d0/dfloat(comb_teeth) - !print *, "comb_step", comb_step - first_det_of_comb = 1 - do i=1,N_det_generators ! min(100,N_det_generators) - first_det_of_comb = i - if(dress_weight(i)/norm_left < comb_step) then + pt2_n_0(1) = 0 + do + pt2_u_0 = tilde_cW(pt2_n_0(1)) + r = tilde_cW(pt2_n_0(1) + pt2_minDetInFirstTeeth) + pt2_W_T = (1d0 - pt2_u_0) / dble(pt2_N_teeth) + if(pt2_W_T >= r - pt2_u_0) then exit end if - norm_left -= dress_weight(i) + pt2_n_0(1) += 1 + if(N_det_generators - pt2_n_0(1) < pt2_minDetInFirstTeeth * pt2_N_teeth) then + stop "teeth building failed" + end if end do - first_det_of_comb = max(2,first_det_of_comb) - call write_int(6, first_det_of_comb-1, 'Size of deterministic set') - - - comb_step = (1d0 - dress_cweight(first_det_of_comb-1)) * comb_step - - stato = 1d0 - comb_step - iloc = N_det_generators - do i=comb_teeth, 1, -1 - integer :: iloc - iloc = dress_find(stato, dress_cweight, N_det_generators, 1, iloc) - first_det_of_teeth(i) = iloc - fractage(i) = (dress_cweight(iloc) - stato) / dress_weight(iloc) - stato -= comb_step + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + do t=2, pt2_N_teeth + r = pt2_u_0 + pt2_W_T * dble(t-1) + pt2_n_0(t) = dress_find_sample(r, tilde_cW) + end do + pt2_n_0(pt2_N_teeth+1) = N_det_generators + + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + pt2_w(:pt2_n_0(1)) = tilde_w(:pt2_n_0(1)) + do t=1, pt2_N_teeth + tooth_width = tilde_cW(pt2_n_0(t+1)) - tilde_cW(pt2_n_0(t)) + do i=pt2_n_0(t)+1, pt2_n_0(t+1) + pt2_w(i) = tilde_w(i) * pt2_W_T / tooth_width + end do end do - first_det_of_teeth(comb_teeth+1) = N_det_generators + 1 - first_det_of_teeth(1) = first_det_of_comb - - - if(first_det_of_teeth(1) /= first_det_of_comb) then - print *, 'Error in ', irp_here - stop "comb provider" - endif + pt2_cW(0) = 0d0 do i=1,N_det_generators - dress_weight_inv(i) = 1.d0/dress_weight(i) - enddo - - tooth_of_det(:first_det_of_teeth(1)-1) = 0 - do i=1,comb_teeth - tooth_of_det(first_det_of_teeth(i):first_det_of_teeth(i+1)-1) = i + pt2_cW(i) = pt2_cW(i-1) + pt2_w(i) end do + pt2_n_0(pt2_N_teeth+1) = N_det_generators END_PROVIDER - - diff --git a/plugins/dress_zmq/dressing.irp.f b/plugins/dress_zmq/dressing.irp.f index 590b27c6..a3b18b26 100644 --- a/plugins/dress_zmq/dressing.irp.f +++ b/plugins/dress_zmq/dressing.irp.f @@ -85,34 +85,21 @@ BEGIN_PROVIDER [ double precision, delta_ij_tmp, (N_states,N_det_delta_ij,2) ] double precision, allocatable :: dress(:), del(:,:), del_s2(:,:) double precision :: E_CI_before(N_states), relative_error - ! prevents re-providing if delta_ij_tmp is - ! just being copied - if(N_det_delta_ij == N_det) then + allocate(dress(N_states), del(N_states, N_det_delta_ij), del_s2(N_states, N_det_delta_ij)) + + delta_ij_tmp = 0d0 + + E_CI_before(:) = dress_E0_denominator(:) + nuclear_repulsion + relative_error = 1.d-5 + + call write_double(6,relative_error,"Convergence of the stochastic algorithm") - allocate(dress(N_states), del(N_states, N_det_delta_ij), del_s2(N_states, N_det_delta_ij)) - - delta_ij_tmp = 0d0 - - E_CI_before(:) = psi_energy(:) + nuclear_repulsion - threshold_selectors = 1.d0 - threshold_generators = 1.d0 - SOFT_TOUCH threshold_selectors threshold_generators - ! if(errr /= 0d0) then - ! errr = errr / 2d0 - ! else - ! errr = 1d-4 - ! end if - relative_error = 1.d-3 - - call write_double(6,relative_error,"Relative error for the stochastic algorithm") - - call ZMQ_dress(E_CI_before, dress, del, del_s2, abs(relative_error), N_det_delta_ij) - delta_ij_tmp(:,:,1) = del(:,:) - delta_ij_tmp(:,:,2) = del_s2(:,:) + call ZMQ_dress(E_CI_before, dress, del, del_s2, abs(relative_error), N_det_delta_ij) + delta_ij_tmp(:,:,1) = del(:,:) + delta_ij_tmp(:,:,2) = del_s2(:,:) - deallocate(dress, del, del_s2) - end if + deallocate(dress, del, del_s2) END_PROVIDER diff --git a/plugins/dress_zmq/run_dress_slave.irp.f b/plugins/dress_zmq/run_dress_slave.irp.f index 8801cb3f..184ef94c 100644 --- a/plugins/dress_zmq/run_dress_slave.irp.f +++ b/plugins/dress_zmq/run_dress_slave.irp.f @@ -1,13 +1,5 @@ use bitmasks -BEGIN_PROVIDER [ integer, fragment_count ] - implicit none - BEGIN_DOC - ! Number of fragments for the deterministic part - END_DOC - fragment_count = 1 -END_PROVIDER - subroutine run_dress_slave(thread,iproce,energy) use f77_zmq @@ -18,79 +10,73 @@ subroutine run_dress_slave(thread,iproce,energy) integer, intent(in) :: thread, iproce integer :: rc, i, subset, i_generator - integer :: worker_id, task_id, ctask, ltask - character*(5120) :: task + integer :: worker_id, ctask, ltask + character*(512) :: task(Nproc) integer(ZMQ_PTR),external :: new_zmq_to_qp_run_socket integer(ZMQ_PTR) :: zmq_to_qp_run_socket integer(ZMQ_PTR), external :: new_zmq_push_socket integer(ZMQ_PTR) :: zmq_socket_push - - logical :: done - - double precision,allocatable :: dress_detail(:) - integer :: ind - double precision,allocatable :: delta_ij_loc(:,:,:) - integer :: h,p,n,i_state - logical :: ok - - integer, allocatable :: int_buf(:) - double precision, allocatable :: double_buf(:) - integer(bit_kind), allocatable :: det_buf(:,:,:) - integer :: N_buf(3) - logical :: last + double precision,allocatable :: breve_delta_m(:,:,:) + integer :: i_state,m,l,t,p,sum_f !integer, external :: omp_get_thread_num - double precision, allocatable :: delta_det(:,:,:,:), cp(:,:,:,:) - integer :: toothMwen - logical :: fracted + double precision, allocatable :: delta_det(:,:,:,:), cp(:,:,:,:), edI(:) + double precision, allocatable :: edI_task(:) + integer, allocatable :: edI_index(:), edI_taskID(:) + integer :: n_tasks + + integer :: iproc + integer, allocatable :: f(:) + integer :: cp_sent, cp_done + integer :: cp_max(Nproc) + integer :: will_send, task_id, purge_task_id, ntask_buf + integer, allocatable :: task_buf(:) + integer(kind=OMP_LOCK_KIND) :: lck_det(0:pt2_N_teeth+1) + integer(kind=OMP_LOCK_KIND) :: lck_sto(0:dress_N_cp+1), sending, getting_task double precision :: fac - + double precision :: ending(1) + integer, external :: zmq_get_dvector +! double precision, external :: omp_get_wtime +double precision :: time, time0 + integer :: ntask_tbd, task_tbd(Nproc), i_gen_tbd(Nproc), subset_tbd(Nproc) + if(iproce /= 0) stop "RUN DRESS SLAVE is OMP" + + allocate(delta_det(N_states, N_det, 0:pt2_N_teeth+1, 2)) + allocate(cp(N_states, N_det, dress_N_cp, 2)) + allocate(edI(N_det_generators), f(N_det_generators)) + allocate(edI_index(N_det_generators), edI_task(N_det_generators)) + edI = 0d0 + f = 0 + delta_det = 0d0 -! if(iproce /= 0) stop "RUN DRESS SLAVE is OMP" + task = CHAR(0) - allocate(delta_det(N_states, N_det, 0:comb_teeth+1, 2)) - allocate(cp(N_states, N_det, N_cp, 2)) - delta_det = 0d9 - cp = 0d0 - - - task(:) = CHAR(0) - - - - integer :: iproc, cur_cp, done_for(0:N_cp) - integer, allocatable :: tasks(:) - integer :: lastCp(Nproc) - integer :: lastSent, lastSendable - logical :: send - integer(kind=OMP_LOCK_KIND) :: lck_det(0:comb_teeth+1) - integer(kind=OMP_LOCK_KIND) :: lck_sto(0:N_cp+1) - - do i=0,N_cp+1 + call omp_init_lock(sending) + call omp_init_lock(getting_task) + do i=0,dress_N_cp+1 call omp_init_lock(lck_sto(i)) end do - do i=0,comb_teeth+1 + do i=0,pt2_N_teeth+1 call omp_init_lock(lck_det(i)) end do - lastCp = 0 - lastSent = 0 - send = .false. - done_for = 0 - - double precision :: hij, sij - !call i_h_j_s2(psi_det(1,1,1),psi_det(1,1,2),N_int,hij, sij) - - hij = dress_E0_denominator(1) !PROVIDE BEFORE OMP PARALLEL + cp_done = 0 + cp_sent = 0 + will_send = 0 + double precision :: hij, sij, tmp + purge_task_id = 0 + provide psi_energy + ending(1) = dble(dress_N_cp+1) + ntask_tbd = 0 !$OMP PARALLEL DEFAULT(SHARED) & - !$OMP PRIVATE(int_buf, double_buf, det_buf, delta_ij_loc, task, task_id) & - !$OMP PRIVATE(lastSendable, toothMwen, fracted, fac) & - !$OMP PRIVATE(i, cur_cp, send, i_generator, subset, iproc, N_buf) & - !$OMP PRIVATE(zmq_to_qp_run_socket, zmq_socket_push, worker_id) - + !$OMP PRIVATE(breve_delta_m, task_id) & + !$OMP PRIVATE(tmp,fac,m,l,t,sum_f,n_tasks) & + !$OMP PRIVATE(i,p,will_send, i_generator, subset, iproc) & + !$OMP PRIVATE(zmq_to_qp_run_socket, zmq_socket_push, worker_id) & + !$OMP PRIVATE(task_buf, ntask_buf,time, time0) zmq_to_qp_run_socket = new_zmq_to_qp_run_socket() zmq_socket_push = new_zmq_push_socket(thread) call connect_to_taskserver(zmq_to_qp_run_socket,worker_id,thread) @@ -99,276 +85,239 @@ subroutine run_dress_slave(thread,iproce,energy) call end_zmq_push_socket(zmq_socket_push,thread) stop "WORKER -1" end if - - iproc = omp_get_thread_num()+1 - allocate(int_buf(N_dress_int_buffer)) - allocate(double_buf(N_dress_double_buffer)) - allocate(det_buf(N_int, 2, N_dress_det_buffer)) - allocate(delta_ij_loc(N_states,N_det,2)) - do - call get_task_from_taskserver(zmq_to_qp_run_socket,worker_id, task_id, task) - task = task//" 0" - if(task_id == 0) exit - !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - if(task_id /= 0) then - read (task,*) subset, i_generator + allocate(breve_delta_m(N_states,N_det,2)) + allocate(task_buf(pt2_n_tasks_max)) + ntask_buf = 0 + + if(iproc==1) then + call push_dress_results(zmq_socket_push, 0, 0, edI_task, edI_index, breve_delta_m, task_buf, ntask_buf) + end if - !$OMP ATOMIC - done_for(done_cp_at_det(i_generator)) += 1 - ! print *, "IGEN", i_generator, done_cp_at_det(i_generator) - delta_ij_loc(:,:,:) = 0d0 - call generator_start(i_generator, iproc) - call alpha_callback(delta_ij_loc, i_generator, subset, iproc) - call generator_done(i_generator, int_buf, double_buf, det_buf, N_buf, iproc) - - do i=1,N_cp - fac = cps(i_generator, i) * dress_weight_inv(i_generator) * comb_step - if(fac == 0d0) cycle - call omp_set_lock(lck_sto(i)) - cp(:,:,i,1) += (delta_ij_loc(:,:,1) * fac) - cp(:,:,i,2) += (delta_ij_loc(:,:,2) * fac) - call omp_unset_lock(lck_sto(i)) - end do - - - toothMwen = tooth_of_det(i_generator) - fracted = (toothMwen /= 0) - if(fracted) fracted = (i_generator == first_det_of_teeth(toothMwen)) - if(fracted) then - call omp_set_lock(lck_det(toothMwen)) - call omp_set_lock(lck_det(toothMwen-1)) - delta_det(:,:,toothMwen-1, 1) += delta_ij_loc(:,:,1) * (1d0-fractage(toothMwen)) - delta_det(:,:,toothMwen-1, 2) += delta_ij_loc(:,:,2) * (1d0-fractage(toothMwen)) - delta_det(:,:,toothMwen , 1) += delta_ij_loc(:,:,1) * (fractage(toothMwen)) - delta_det(:,:,toothMwen , 2) += delta_ij_loc(:,:,2) * (fractage(toothMwen)) - call omp_unset_lock(lck_det(toothMwen)) - call omp_unset_lock(lck_det(toothMwen-1)) - else - call omp_set_lock(lck_det(toothMwen)) - delta_det(:,:,toothMwen , 1) += delta_ij_loc(:,:,1) - delta_det(:,:,toothMwen , 2) += delta_ij_loc(:,:,2) - call omp_unset_lock(lck_det(toothMwen)) - end if - call push_dress_results(zmq_socket_push, i_generator, -1, delta_ij_loc, int_buf, double_buf, det_buf, N_buf, task_id) - call task_done_to_taskserver(zmq_to_qp_run_socket,worker_id,task_id) - lastCp(iproc) = done_cp_at_det(i_generator) + do while(cp_done > cp_sent .or. m /= dress_N_cp+1) + call omp_set_lock(getting_task) + if(ntask_tbd == 0) then + ntask_tbd = size(task_tbd) + call get_tasks_from_taskserver(zmq_to_qp_run_socket,worker_id, task_tbd, task, ntask_tbd) + !task = task//" 0" end if - + + task_id = task_tbd(1) + if(task_id /= 0) then + read (task(1),*) subset, i_generator + do i=1,size(task_tbd)-1 + task_tbd(i) = task_tbd(i+1) + task(i) = task(i+1) + end do + m = dress_P(i_generator) + ntask_tbd -= 1 + else + m = dress_N_cp + 1 + i= zmq_get_dvector(zmq_to_qp_run_socket, worker_id, "ending", ending, 1) + end if + call omp_unset_lock(getting_task) + will_send = 0 + !$OMP CRITICAL - send = .false. - lastSendable = N_cp*2 - do i=1,Nproc - lastSendable = min(lastCp(i), lastSendable) - end do - lastSendable -= 1 - if(lastSendable > lastSent .or. (lastSendable == N_cp-1 .and. lastSent /= N_cp-1)) then - lastSent = lastSendable - cur_cp = lastSent - send = .true. + cp_max(iproc) = m + cp_done = minval(cp_max)-1 + if(cp_done > cp_sent) then + will_send = cp_sent + 1 + cp_sent = will_send + end if + if(purge_task_id == 0) then + purge_task_id = task_id + task_id = 0 + else if(task_id /= 0) then + ntask_buf += 1 + task_buf(ntask_buf) = task_id end if !$OMP END CRITICAL - if(send) then - N_buf = (/0,1,0/) - - delta_ij_loc = 0d0 - if(cur_cp < 1) stop "cur_cp < 1" - do i=1,cur_cp - delta_ij_loc(:,:,1) += cp(:,:,i,1) - delta_ij_loc(:,:,2) += cp(:,:,i,2) + if(will_send /= 0 .and. will_send <= int(ending(1))) then + call omp_set_lock(sending) + n_tasks = 0 + sum_f = 0 + do i=1,N_det_generators + if(dress_P(i) <= will_send) sum_f = sum_f + f(i) + if(dress_P(i) == will_send .and. f(i) /= 0) then + n_tasks += 1 + edI_task(n_tasks) = edI(i) + edI_index(n_tasks) = i + end if end do - - delta_ij_loc(:,:,:) = delta_ij_loc(:,:,:) / cps_N(cur_cp) - do i=cp_first_tooth(cur_cp)-1,0,-1 - delta_ij_loc(:,:,1) = delta_ij_loc(:,:,1) +delta_det(:,:,i,1) - delta_ij_loc(:,:,2) = delta_ij_loc(:,:,2) +delta_det(:,:,i,2) - end do - call push_dress_results(zmq_socket_push, done_for(cur_cp), cur_cp, delta_ij_loc, int_buf, double_buf, det_buf, N_buf, -1) + call push_dress_results(zmq_socket_push, will_send, sum_f, edI_task, edI_index, breve_delta_m, 0, n_tasks) + call omp_unset_lock(sending) end if + + if(m /= dress_N_cp+1) then + !UPDATE i_generator - if(task_id == 0) exit + breve_delta_m(:,:,:) = 0d0 + call generator_start(i_generator, iproc) + time0 = omp_get_wtime() + call alpha_callback(breve_delta_m, i_generator, subset, pt2_F(i_generator), iproc) + time = omp_get_wtime() + !print '(I0.11, I4, A12, F12.3)', i_generator, subset, "GREPMETIME", time-time0 + t = dress_T(i_generator) + + call omp_set_lock(lck_det(t)) + delta_det(:,:,t, 1) += breve_delta_m(:,:,1) + delta_det(:,:,t, 2) += breve_delta_m(:,:,2) + call omp_unset_lock(lck_det(t)) + + do p=1,dress_N_cp + if(dress_e(i_generator, p) /= 0d0) then + fac = dress_e(i_generator, p) + call omp_set_lock(lck_sto(p)) + cp(:,:,p,1) += breve_delta_m(:,:,1) * fac + cp(:,:,p,2) += breve_delta_m(:,:,2) * fac + call omp_unset_lock(lck_sto(p)) + end if + end do + + tmp = 0d0 + do i=N_det,1,-1 + tmp += psi_coef(i, dress_stoch_istate)*breve_delta_m(dress_stoch_istate, i, 1) + end do + !$OMP ATOMIC + edI(i_generator) += tmp + !$OMP ATOMIC + f(i_generator) += 1 + !push bidon + if(ntask_buf == size(task_buf)) then + call push_dress_results(zmq_socket_push, 0, 0, edI_task, edI_index, breve_delta_m, task_buf, ntask_buf) + ntask_buf = 0 + end if + end if end do - + !$OMP BARRIER + if(ntask_buf /= 0) then + call push_dress_results(zmq_socket_push, 0, 0, edI_task, edI_index, breve_delta_m, task_buf, ntask_buf) + ntask_buf = 0 + end if + !$OMP SINGLE + if(purge_task_id /= 0) then + do while(int(ending(1)) == dress_N_cp+1) + call sleep(1) + i= zmq_get_dvector(zmq_to_qp_run_socket, worker_id, "ending", ending, 1) + end do + + will_send = int(ending(1)) + breve_delta_m = 0d0 + + do l=will_send, 1,-1 + breve_delta_m(:,:,1) += cp(:,:,l,1) + breve_delta_m(:,:,2) += cp(:,:,l,2) + end do + + breve_delta_m(:,:,:) = breve_delta_m(:,:,:) / dress_M_m(will_send) + + do t=dress_dot_t(will_send)-1,0,-1 + breve_delta_m(:,:,1) = breve_delta_m(:,:,1) + delta_det(:,:,t,1) + breve_delta_m(:,:,2) = breve_delta_m(:,:,2) + delta_det(:,:,t,2) + end do + + sum_f = 0 + do i=1,N_det_generators + if(dress_P(i) <= will_send) sum_f = sum_f + f(i) + end do + call push_dress_results(zmq_socket_push, -will_send, sum_f, edI_task, edI_index, breve_delta_m, purge_task_id, 1) + end if + + !$OMP END SINGLE call disconnect_from_taskserver(zmq_to_qp_run_socket,worker_id) call end_zmq_to_qp_run_socket(zmq_to_qp_run_socket) call end_zmq_push_socket(zmq_socket_push,thread) !$OMP END PARALLEL - - do i=0,N_cp+1 + do i=0,dress_N_cp+1 call omp_destroy_lock(lck_sto(i)) end do - do i=0,comb_teeth+1 + do i=0,pt2_N_teeth+1 call omp_destroy_lock(lck_det(i)) end do end subroutine - -subroutine push_dress_results(zmq_socket_push, ind, cur_cp, delta_loc, int_buf, double_buf, det_buf, N_bufi, task_id) +subroutine push_dress_results(zmq_socket_push, m_task, f, edI_task, edI_index, breve_delta_m, task_id, n_tasks) use f77_zmq implicit none - - integer, parameter :: sendt = 4 integer(ZMQ_PTR), intent(in) :: zmq_socket_push - double precision, intent(inout) :: delta_loc(N_states, N_det, 2) - real(kind=4), allocatable :: delta_loc4(:,:,:) - double precision, intent(in) :: double_buf(*) - integer, intent(in) :: int_buf(*) - integer(bit_kind), intent(in) :: det_buf(N_int, 2, *) - integer, intent(in) :: N_bufi(3) - integer :: N_buf(3) - integer, intent(in) :: ind, cur_cp, task_id - integer :: rc, i, j, k, l - double precision :: contrib(N_states) - real(sendt), allocatable :: r4buf(:,:,:) - - rc = f77_zmq_send( zmq_socket_push, ind, 4, ZMQ_SNDMORE) - if(rc /= 4) stop "push" - - rc = f77_zmq_send( zmq_socket_push, cur_cp, 4, ZMQ_SNDMORE) - if(rc /= 4) stop "push" - - - if(cur_cp /= -1) then - allocate(r4buf(N_states, N_det, 2)) - do i=1,2 - do j=1,N_det - do k=1,N_states - r4buf(k,j,i) = real(delta_loc(k,j,i), sendt) - end do - end do - end do - - rc = f77_zmq_send( zmq_socket_push, r4buf(1,1,1), sendt*N_states*N_det, ZMQ_SNDMORE) - if(rc /= sendt*N_states*N_det) stop "push" - - rc = f77_zmq_send( zmq_socket_push, r4buf(1,1,2), sendt*N_states*N_det, ZMQ_SNDMORE) - if(rc /= sendt*N_states*N_det) stop "push" - else - contrib = 0d0 - do i=1,N_det - contrib(:) += delta_loc(:,i, 1) * psi_coef(i, :) - end do - - rc = f77_zmq_send( zmq_socket_push, contrib, 8*N_states, ZMQ_SNDMORE) - if(rc /= 8*N_states) stop "push" + integer, intent(in) :: m_task, f, edI_index(n_tasks) + double precision, intent(in) :: breve_delta_m(N_states, N_det, 2), edI_task(n_tasks) + integer, intent(in) :: task_id(pt2_n_tasks_max), n_tasks + integer :: rc, i, j, k + rc = f77_zmq_send( zmq_socket_push, m_task, 4, ZMQ_SNDMORE) + if(rc /= 4) stop "push3" - N_buf = N_bufi - !N_buf = (/0,1,0/) - - rc = f77_zmq_send( zmq_socket_push, N_buf, 4*3, ZMQ_SNDMORE) - if(rc /= 4*3) stop "push5" - - if(N_buf(1) > N_dress_int_buffer) stop "run_dress_slave N_buf bad size?" - if(N_buf(2) > N_dress_double_buffer) stop "run_dress_slave N_buf bad size?" - if(N_buf(3) > N_dress_det_buffer) stop "run_dress_slave N_buf bad size?" - - - if(N_buf(1) > 0) then - rc = f77_zmq_send( zmq_socket_push, int_buf, 4*N_buf(1), ZMQ_SNDMORE) - if(rc /= 4*N_buf(1)) stop "push6" - end if - - if(N_buf(2) > 0) then - rc = f77_zmq_send( zmq_socket_push, double_buf, 8*N_buf(2), ZMQ_SNDMORE) - if(rc /= 8*N_buf(2)) stop "push8" - end if - - if(N_buf(3) > 0) then - rc = f77_zmq_send( zmq_socket_push, det_buf, 2*N_int*bit_kind*N_buf(3), ZMQ_SNDMORE) - if(rc /= 2*N_int*bit_kind*N_buf(3)) stop "push10" - end if - - rc = f77_zmq_send( zmq_socket_push, task_id, 4, 0) - if(rc /= 4) stop "push11" - end if - -! Activate is zmq_socket_push is a REQ + if(m_task > 0) then + rc = f77_zmq_send( zmq_socket_push, n_tasks, 4, ZMQ_SNDMORE) + if(rc /= 4) stop "push1" + rc = f77_zmq_send( zmq_socket_push, f, 4, ZMQ_SNDMORE) + if(rc /= 4) stop "push4" + rc = f77_zmq_send( zmq_socket_push, edI_task, 8*n_tasks, ZMQ_SNDMORE) + if(rc /= 8*n_tasks) stop "push5" + rc = f77_zmq_send( zmq_socket_push, edI_index, 4*n_tasks, 0) + if(rc /= 4*n_tasks) stop "push6" + else if(m_task == 0) then + rc = f77_zmq_send( zmq_socket_push, n_tasks, 4, ZMQ_SNDMORE) + if(rc /= 4) stop "push1" + rc = f77_zmq_send( zmq_socket_push, task_id, 4*n_tasks, 0) + if(rc /= 4*n_tasks) stop "push2" + else + rc = f77_zmq_send( zmq_socket_push, f, 4, ZMQ_SNDMORE) + if(rc /= 4) stop "push4" + rc = f77_zmq_send( zmq_socket_push, breve_delta_m, 8*N_det*N_states*2, ZMQ_SNDMORE) + if(rc /= 8*N_det*N_states*2) stop "push6" + rc = f77_zmq_send( zmq_socket_push, task_id, 4, 0) + if(rc /= 4) stop "push6" + end if +! Activate is zmq_socket_pull is a REP IRP_IF ZMQ_PUSH IRP_ELSE character*(2) :: ok rc = f77_zmq_recv( zmq_socket_push, ok, 2, 0) IRP_ENDIF - end subroutine -BEGIN_PROVIDER [ real(4), real4buf, (N_states, N_det, 2) ] - -END_PROVIDER -subroutine pull_dress_results(zmq_socket_pull, ind, cur_cp, delta_loc, int_buf, double_buf, det_buf, N_buf, task_id, contrib) +subroutine pull_dress_results(zmq_socket_pull, m_task, f, edI_task, edI_index, breve_delta_m, task_id, n_tasks) use f77_zmq implicit none - integer, parameter :: sendt = 4 integer(ZMQ_PTR), intent(in) :: zmq_socket_pull - integer, intent(out) :: cur_cp - double precision, intent(inout) :: delta_loc(N_states, N_det, 2) - double precision, intent(out) :: double_buf(*), contrib(N_states) - integer, intent(out) :: int_buf(*) - integer(bit_kind), intent(out) :: det_buf(N_int, 2, *) - integer, intent(out) :: ind - integer, intent(out) :: task_id + integer, intent(out) :: m_task, f, edI_index(N_det_generators) + double precision, intent(out) :: breve_delta_m(N_states, N_det, 2), edI_task(N_det_generators) + integer, intent(out) :: task_id(pt2_n_tasks_max), n_tasks integer :: rc, i, j, k - integer, intent(out) :: N_buf(3) - - rc = f77_zmq_recv( zmq_socket_pull, ind, 4, 0) - if(rc /= 4) stop "pulla" - rc = f77_zmq_recv( zmq_socket_pull, cur_cp, 4, 0) - if(rc /= 4) stop "pulla" - - - + rc = f77_zmq_recv( zmq_socket_pull, m_task, 4, 0) + if(rc /= 4) stop "pullc" - if(cur_cp /= -1) then - - rc = f77_zmq_recv( zmq_socket_pull, real4buf(1,1,1), N_states*sendt*N_det, 0) - if(rc /= sendt*N_states*N_det) stop "pullc" - - rc = f77_zmq_recv( zmq_socket_pull, real4buf(1,1,2), N_states*sendt*N_det, 0) - if(rc /= sendt*N_states*N_det) stop "pulld" - - do i=1,2 - !$OMP PARALLEL DO DEFAULT(SHARED) PRIVATE(j,k) - do j=1,N_det - do k=1,N_states - delta_loc(k,j,i) = real(real4buf(k,j,i), 8) - end do - end do - end do - else - rc = f77_zmq_recv( zmq_socket_pull, contrib, 8*N_states, 0) - if(rc /= 8*N_states) stop "pullc" - - rc = f77_zmq_recv( zmq_socket_pull, N_buf, 4*3, 0) - if(rc /= 4*3) stop "pull" - if(N_buf(1) > N_dress_int_buffer) stop "run_dress_slave N_buf bad size?" - if(N_buf(2) > N_dress_double_buffer) stop "run_dress_slave N_buf bad size?" - if(N_buf(3) > N_dress_det_buffer) stop "run_dress_slave N_buf bad size?" - - - if(N_buf(1) > 0) then - rc = f77_zmq_recv( zmq_socket_pull, int_buf, 4*N_buf(1), 0) - if(rc /= 4*N_buf(1)) stop "pull1" + if(m_task > 0) then + rc = f77_zmq_recv( zmq_socket_pull, n_tasks, 4, 0) + if(rc /= 4) stop "pullc" + rc = f77_zmq_recv( zmq_socket_pull, f, 4, 0) + if(rc /= 4) stop "pullc" + rc = f77_zmq_recv( zmq_socket_pull, edI_task, 8*n_tasks, 0) + if(rc /= 8*n_tasks) stop "pullc" + rc = f77_zmq_recv( zmq_socket_pull, edI_index, 4*n_tasks, 0) + if(rc /= 4*n_tasks) stop "pullc" + else if(m_task==0) then + rc = f77_zmq_recv( zmq_socket_pull, n_tasks, 4, 0) + if(rc /= 4) stop "pullc" + rc = f77_zmq_recv( zmq_socket_pull, task_id, 4*n_tasks, 0) + if(rc /= 4*n_tasks) stop "pull4" + else + rc = f77_zmq_recv( zmq_socket_pull, f, 4, 0) + if(rc /= 4) stop "pullc" + rc = f77_zmq_recv( zmq_socket_pull, breve_delta_m, 8*N_det*N_states*2, 0) + if(rc /= 8*N_det*N_states*2) stop "pullc" + rc = f77_zmq_recv( zmq_socket_pull, task_id, 4, 0) + if(rc /= 4) stop "pull4" end if - - if(N_buf(2) > 0) then - rc = f77_zmq_recv( zmq_socket_pull, double_buf, 8*N_buf(2), 0) - if(rc /= 8*N_buf(2)) stop "pull2" - end if - - if(N_buf(3) > 0) then - rc = f77_zmq_recv( zmq_socket_pull, det_buf, 2*N_int*bit_kind*N_buf(3), 0) - if(rc /= 2*N_int*bit_kind*N_buf(3)) stop "pull3" - end if - - rc = f77_zmq_recv( zmq_socket_pull, task_id, 4, 0) - if(rc /= 4) stop "pull4" - end if ! Activate is zmq_socket_pull is a REP IRP_IF ZMQ_PUSH IRP_ELSE diff --git a/plugins/shiftedbk/shifted_bk_routines.irp.f b/plugins/shiftedbk/shifted_bk_routines.irp.f index bab8490d..216f9ec3 100644 --- a/plugins/shiftedbk/shifted_bk_routines.irp.f +++ b/plugins/shiftedbk/shifted_bk_routines.irp.f @@ -298,9 +298,8 @@ subroutine dress_with_alpha_buffer(Nstates,Ndet,Nint,delta_ij_loc, i_gen, minili haa = diag_H_mat_elem_fock(psi_det_generators(1,1,i_gen),alpha,fock_diag_tmp_(1,1,iproc),N_int) - + call dress_with_alpha_(Nstates, Ndet, Nint, delta_ij_loc, minilist, det_minilist, n_minilist, alpha, haa, contrib, c_alpha, iproc) - slave_sum_alpha2(:,iproc) += c_alpha(:)**2 if(contrib < sb(iproc)%mini) then call add_to_selection_buffer(sb(iproc), alpha, contrib) diff --git a/src/Determinants/slater_rules.irp.f b/src/Determinants/slater_rules.irp.f index 6e972114..2d42e849 100644 --- a/src/Determinants/slater_rules.irp.f +++ b/src/Determinants/slater_rules.irp.f @@ -167,8 +167,7 @@ subroutine decode_exc(exc,degree,h1,p1,h2,p2,s1,s2) end select end - -subroutine get_double_excitation(det1,det2,exc,phase,Nint) +subroutine get_double_excitation_ref(det1,det2,exc,phase,Nint) use bitmasks implicit none BEGIN_DOC @@ -312,6 +311,137 @@ subroutine get_double_excitation(det1,det2,exc,phase,Nint) end +subroutine get_phasemask_bit(det1, pm, Nint) + use bitmasks + implicit none + integer, intent(in) :: Nint + integer(bit_kind), intent(in) :: det1(Nint,2) + integer(bit_kind), intent(out) :: pm(Nint,2) + integer(bit_kind) :: tmp + integer :: ispin, i + do ispin=1,2 + tmp = 0_8 + do i=1,Nint + pm(i,ispin) = xor(det1(i,ispin), ishft(det1(i,ispin), 1)) + pm(i,ispin) = xor(pm(i,ispin), ishft(pm(i,ispin), 2)) + pm(i,ispin) = xor(pm(i,ispin), ishft(pm(i,ispin), 4)) + pm(i,ispin) = xor(pm(i,ispin), ishft(pm(i,ispin), 8)) + pm(i,ispin) = xor(pm(i,ispin), ishft(pm(i,ispin), 16)) + pm(i,ispin) = xor(pm(i,ispin), ishft(pm(i,ispin), 32)) + pm(i,ispin) = xor(pm(i,ispin), tmp) + if(iand(popcnt(det1(i,ispin)), 1) == 1) tmp = not(tmp) + end do + end do +end subroutine + + +subroutine get_double_excitation(det1,det2,exc,phase,Nint) + use bitmasks + implicit none + BEGIN_DOC + ! Returns the two excitation operators between two doubly excited determinants and the phase + END_DOC + integer, intent(in) :: Nint + integer(bit_kind), intent(in) :: det1(Nint,2) + integer(bit_kind), intent(in) :: det2(Nint,2) + integer, intent(out) :: exc(0:2,2,2) + double precision, intent(out) :: phase + integer :: tz + integer :: l, ispin, idx_hole, idx_particle, ishift + integer :: nperm + integer :: i,j,k,m,n + integer :: high, low + integer :: a,b,c,d + integer(bit_kind) :: hole, particle, tmp, pm(Nint,2) + double precision, parameter :: phase_dble(0:1) = (/ 1.d0, -1.d0 /) + double precision :: refaz + logical :: ok + + ASSERT (Nint > 0) + + !do ispin=1,2 + !tmp = 0_8 + !do i=1,Nint + ! pm(i,ispin) = xor(det1(i,ispin), ishft(det1(i,ispin), 1)) + ! pm(i,ispin) = xor(pm(i,ispin), ishft(pm(i,ispin), 2)) + ! pm(i,ispin) = xor(pm(i,ispin), ishft(pm(i,ispin), 4)) + ! pm(i,ispin) = xor(pm(i,ispin), ishft(pm(i,ispin), 8)) + ! pm(i,ispin) = xor(pm(i,ispin), ishft(pm(i,ispin), 16)) + ! pm(i,ispin) = xor(pm(i,ispin), ishft(pm(i,ispin), 32)) + ! pm(i,ispin) = xor(pm(i,ispin), tmp) + ! if(iand(popcnt(det1(i,ispin)), 1) == 1) tmp = not(tmp) + !end do + !end do + call get_phasemask_bit(det1, pm, Nint) + nperm = 0 + exc(0,1,1) = 0 + exc(0,2,1) = 0 + exc(0,1,2) = 0 + exc(0,2,2) = 0 + do ispin = 1,2 + idx_particle = 0 + idx_hole = 0 + ishift = 1-bit_kind_size + !par = 0 + do l=1,Nint + ishift = ishift + bit_kind_size + if (det1(l,ispin) == det2(l,ispin)) then + cycle + endif + tmp = xor( det1(l,ispin), det2(l,ispin) ) + particle = iand(tmp, det2(l,ispin)) + hole = iand(tmp, det1(l,ispin)) + do while (particle /= 0_bit_kind) + tz = trailz(particle) + nperm = nperm + iand(ishft(pm(l,ispin), -tz), 1) + idx_particle = idx_particle + 1 + exc(0,2,ispin) = exc(0,2,ispin) + 1 + exc(idx_particle,2,ispin) = tz+ishift + particle = iand(particle,particle-1_bit_kind) + enddo + if (iand(exc(0,1,ispin),exc(0,2,ispin))==2) then ! exc(0,1,ispin)==2 or exc(0,2,ispin)==2 + exit + endif + do while (hole /= 0_bit_kind) + tz = trailz(hole) + nperm = nperm + iand(ishft(pm(l,ispin), -tz), 1) + idx_hole = idx_hole + 1 + exc(0,1,ispin) = exc(0,1,ispin) + 1 + exc(idx_hole,1,ispin) = tz+ishift + hole = iand(hole,hole-1_bit_kind) + enddo + if (iand(exc(0,1,ispin),exc(0,2,ispin))==2) then ! exc(0,1,ispin)==2 or exc(0,2,ispin) + exit + endif + enddo + + select case (exc(0,1,ispin)) + case(0) + cycle + + case(1) + if(exc(1,1,ispin) < exc(1,2,ispin)) nperm = nperm+1 + + case (2) + a = exc(1,1,ispin) + b = exc(1,2,ispin) + c = exc(2,1,ispin) + d = exc(2,2,ispin) + + if(min(a,c) > max(b,d) .or. min(b,d) > max(a,c) .or. (a-b)*(c-d)<0) then + nperm = nperm + 1 + end if + exit + end select + + enddo + phase = phase_dble(iand(nperm,1)) + !call get_double_excitation_ref(det1,det2,exc,refaz,Nint) + !if(phase == refaz) then + ! print *, "phase", phase, refaz, n, exc(0,1,1) + !end if +end + subroutine get_mono_excitation(det1,det2,exc,phase,Nint) use bitmasks implicit none From 9ebb88cbf32eed90ed2c1ff985128f271bcc1c15 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 4 Sep 2018 18:05:00 +0200 Subject: [PATCH 95/96] Cleaning --- plugins/Generators_full/generators.irp.f | 4 +--- plugins/dress_zmq/alpha_factory.irp.f | 8 ++++---- plugins/dress_zmq/dress_slave.irp.f | 4 +--- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/plugins/Generators_full/generators.irp.f b/plugins/Generators_full/generators.irp.f index c40ba2d4..2ce6f854 100644 --- a/plugins/Generators_full/generators.irp.f +++ b/plugins/Generators_full/generators.irp.f @@ -13,7 +13,7 @@ BEGIN_PROVIDER [ integer, N_det_generators ] N_det_generators = N_det do i=1,N_det norm = norm + psi_average_norm_contrib_sorted(i) - if (norm >= threshold_generators) then + if (norm > threshold_generators+1d-10) then N_det_generators = i exit endif @@ -29,7 +29,6 @@ END_PROVIDER ! For Single reference wave functions, the generator is the ! Hartree-Fock determinant END_DOC - integer :: i, k psi_det_generators(1:N_int,1:2,1:N_det) = psi_det_sorted(1:N_int,1:2,1:N_det) psi_coef_generators(1:N_det,1:N_states) = psi_coef_sorted(1:N_det,1:N_states) @@ -44,7 +43,6 @@ END_PROVIDER ! For Single reference wave functions, the generator is the ! Hartree-Fock determinant END_DOC - integer :: i, k psi_det_sorted_gen = psi_det_sorted psi_coef_sorted_gen = psi_coef_sorted psi_det_sorted_gen_order = psi_det_sorted_order diff --git a/plugins/dress_zmq/alpha_factory.irp.f b/plugins/dress_zmq/alpha_factory.irp.f index e5b670fb..ed6c7065 100644 --- a/plugins/dress_zmq/alpha_factory.irp.f +++ b/plugins/dress_zmq/alpha_factory.irp.f @@ -66,7 +66,7 @@ subroutine generate_singles_and_doubles(delta_ij_loc, i_generator, bitmask_index integer(bit_kind), allocatable:: preinteresting_det(:,:,:) integer ,allocatable :: abuf(:), labuf(:) - allocate(abuf(0:N_det*6), labuf(0:N_det)) + allocate(abuf(N_det*6), labuf(N_det)) allocate(preinteresting_det(N_int,2,N_det)) @@ -386,7 +386,7 @@ subroutine alpha_callback_mask(delta_ij_loc, i_gen, sp, mask, bannedOrb, banned, integer(bit_kind), allocatable :: det_minilist(:,:,:) - allocate(abuf(0:siz), labuf(0:N_det), putten(N_det), det_minilist(N_int, 2, N_det)) + allocate(abuf(siz), labuf(N_det), putten(N_det), det_minilist(N_int, 2, N_det)) do i=1,siz abuf(i) = psi_from_sorted_gen(rabuf(i)) @@ -703,7 +703,7 @@ subroutine get_d2(i_gen, gen, banned, bannedOrb, indexes, abuf, mask, h, p, sp) implicit none integer(bit_kind), intent(in) :: mask(N_int, 2), gen(N_int, 2) - integer, intent(inout) :: abuf(0:*) + integer, intent(inout) :: abuf(*) integer, intent(in) :: i_gen logical, intent(in) :: bannedOrb(mo_tot_num, 2), banned(mo_tot_num, mo_tot_num,2) integer, intent(inout) :: indexes(0:mo_tot_num, 0:mo_tot_num) @@ -831,7 +831,7 @@ subroutine get_d1(i_gen, gen, banned, bannedOrb, indexes, abuf, mask, h, p, sp) implicit none integer(bit_kind), intent(in) :: mask(N_int, 2), gen(N_int, 2) - integer, intent(inout) :: abuf(0:*) + integer, intent(inout) :: abuf(*) integer,intent(in) :: i_gen logical, intent(in) :: bannedOrb(mo_tot_num, 2), banned(mo_tot_num, mo_tot_num,2) integer(bit_kind) :: det(N_int, 2) diff --git a/plugins/dress_zmq/dress_slave.irp.f b/plugins/dress_zmq/dress_slave.irp.f index 6de3e2da..33238df2 100644 --- a/plugins/dress_zmq/dress_slave.irp.f +++ b/plugins/dress_zmq/dress_slave.irp.f @@ -50,9 +50,7 @@ subroutine run_wf else if (zmq_state(:5) == 'dress') then ! Dress ! --------- - !call zmq_get_psi(zmq_to_qp_run_socket,1,energy,N_states) if (zmq_get_psi(zmq_to_qp_run_socket,1) == -1) cycle - !TOUCH psi_det if (zmq_get_N_det_generators (zmq_to_qp_run_socket, 1) == -1) cycle if (zmq_get_N_det_selectors(zmq_to_qp_run_socket, 1) == -1) cycle if (zmq_get_dvector(zmq_to_qp_run_socket,1,'state_average_weight',state_average_weight,N_states) == -1) cycle @@ -60,7 +58,7 @@ subroutine run_wf if (zmq_get_dvector(zmq_to_qp_run_socket,1,'dress_stoch_istate',tmp,1) == -1) cycle dress_stoch_istate = int(tmp) psi_energy(1:N_states) = energy(1:N_states) - TOUCH psi_energy dress_stoch_istate state_average_weight + TOUCH psi_energy dress_stoch_istate state_average_weight PROVIDE psi_bilinear_matrix_columns_loc psi_det_alpha_unique psi_det_beta_unique PROVIDE psi_bilinear_matrix_rows psi_det_sorted_gen_order psi_bilinear_matrix_order From 68458296dcc86c57bab25582e138ae057a66f019 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 4 Sep 2018 18:43:39 +0200 Subject: [PATCH 96/96] Almost working but still broken --- plugins/dress_zmq/alpha_factory.irp.f | 2 +- plugins/dress_zmq/dress_general.irp.f | 6 ------ plugins/dress_zmq/dress_stoch_routines.irp.f | 17 +++++++++++------ plugins/dress_zmq/dressing.irp.f | 2 +- plugins/dress_zmq/run_dress_slave.irp.f | 2 +- src/Davidson/u0Hu0.irp.f | 1 + 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/plugins/dress_zmq/alpha_factory.irp.f b/plugins/dress_zmq/alpha_factory.irp.f index ed6c7065..d59ab032 100644 --- a/plugins/dress_zmq/alpha_factory.irp.f +++ b/plugins/dress_zmq/alpha_factory.irp.f @@ -637,7 +637,7 @@ subroutine splash_pq(mask, sp, det, i_gen, N_sel, bannedOrb, banned, indexes, ab integer(bit_kind),intent(in) :: mask(N_int, 2), det(N_int, 2, N_sel) logical, intent(inout) :: bannedOrb(mo_tot_num, 2), banned(mo_tot_num, mo_tot_num, 2) integer, intent(inout) :: indexes(0:mo_tot_num, 0:mo_tot_num) - integer, intent(inout) :: abuf(0:*) + integer, intent(inout) :: abuf(*) integer :: i, ii, j, k, l, h(0:2,2), p(0:4,2), nt, s integer(bit_kind) :: perMask(N_int, 2), mobMask(N_int, 2), negMask(N_int, 2) integer :: phasemask(2,N_int*bit_kind_size) diff --git a/plugins/dress_zmq/dress_general.irp.f b/plugins/dress_zmq/dress_general.irp.f index b99eb1d7..8364a61f 100644 --- a/plugins/dress_zmq/dress_general.irp.f +++ b/plugins/dress_zmq/dress_general.irp.f @@ -29,8 +29,6 @@ subroutine run_dressing(N_st,energy) delta_E = 1.d0 iteration = 0 do iteration=1,n_it_dress_max - N_det_delta_ij = N_det - touch N_det_delta_ij print *, '===============================================' print *, 'Iteration', iteration, '/', n_it_dress_max print *, '===============================================' @@ -40,9 +38,6 @@ subroutine run_dressing(N_st,energy) do i=1,N_st print *, i, psi_energy(i)+nuclear_repulsion enddo - !print *, "DELTA IJ", delta_ij(1,1,1) - PROVIDE delta_ij_tmp - if(.true.) call delta_ij_done() print *, 'Dressed energy ' do i=1,N_st print *, i, ci_energy_dressed(i) @@ -56,7 +51,6 @@ subroutine run_dressing(N_st,energy) call write_double(6,delta_E,"delta_E (undressed)") delta_E = dabs(delta_E) call save_wavefunction -! call ezfio_set_dress_zmq_energy(ci_energy_dressed(1)) if (delta_E < thresh_dress) then exit endif diff --git a/plugins/dress_zmq/dress_stoch_routines.irp.f b/plugins/dress_zmq/dress_stoch_routines.irp.f index 136ecb7f..846d38f0 100644 --- a/plugins/dress_zmq/dress_stoch_routines.irp.f +++ b/plugins/dress_zmq/dress_stoch_routines.irp.f @@ -276,7 +276,7 @@ subroutine ZMQ_dress(E, dress, delta_out, delta_s2_out, relative_error) call omp_set_nested(.true.) -if (.false.) then !! TODO +if (.true.) then !! TODO !$OMP PARALLEL DEFAULT(shared) NUM_THREADS(2) & !$OMP PRIVATE(i) i = omp_get_thread_num() @@ -462,11 +462,16 @@ subroutine dress_collector(zmq_socket_pull, E, relative_error, delta, delta_s2, end do t = dress_dot_t(m) avg = S(t) / dble(c) - eqt = (S2(t) / c) - (S(t)/c)**2 - eqt = sqrt(eqt / dble(c-1)) - error = eqt - time = omp_get_wtime() - print '(G10.3, 2X, F16.10, 2X, G16.3, 2X, F16.4, A20)', c, avg+E0+E(dress_stoch_istate), eqt, time-time0, '' + if (c > 1) then + eqt = (S2(t) / c) - (S(t)/c)**2 + eqt = sqrt(eqt / dble(c-1)) + error = eqt + time = omp_get_wtime() + print '(G10.3, 2X, F16.10, 2X, G16.3, 2X, F16.4, A20)', c, avg+E0+E(dress_stoch_istate), eqt, time-time0, '' + else + eqt = 1.d0 + error = eqt + endif m += 1 if(eqt <= relative_error) then integer, external :: zmq_put_dvector diff --git a/plugins/dress_zmq/dressing.irp.f b/plugins/dress_zmq/dressing.irp.f index a3b18b26..40b83037 100644 --- a/plugins/dress_zmq/dressing.irp.f +++ b/plugins/dress_zmq/dressing.irp.f @@ -65,7 +65,7 @@ END_PROVIDER BEGIN_PROVIDER [ integer , N_det_delta_ij ] implicit none - N_det_delta_ij = 1 + N_det_delta_ij = N_det END_PROVIDER BEGIN_PROVIDER [ double precision, delta_ij, (N_states, N_det, 2) ] diff --git a/plugins/dress_zmq/run_dress_slave.irp.f b/plugins/dress_zmq/run_dress_slave.irp.f index 184ef94c..734c1f31 100644 --- a/plugins/dress_zmq/run_dress_slave.irp.f +++ b/plugins/dress_zmq/run_dress_slave.irp.f @@ -41,7 +41,7 @@ subroutine run_dress_slave(thread,iproce,energy) ! double precision, external :: omp_get_wtime double precision :: time, time0 integer :: ntask_tbd, task_tbd(Nproc), i_gen_tbd(Nproc), subset_tbd(Nproc) - if(iproce /= 0) stop "RUN DRESS SLAVE is OMP" +! if(iproce /= 0) stop "RUN DRESS SLAVE is OMP" allocate(delta_det(N_states, N_det, 0:pt2_N_teeth+1, 2)) allocate(cp(N_states, N_det, dress_N_cp, 2)) diff --git a/src/Davidson/u0Hu0.irp.f b/src/Davidson/u0Hu0.irp.f index 3e5610c8..38e3f293 100644 --- a/src/Davidson/u0Hu0.irp.f +++ b/src/Davidson/u0Hu0.irp.f @@ -28,6 +28,7 @@ subroutine H_S2_u_0_nstates_openmp(v_0,s_0,u_0,N_st,sze) double precision, allocatable :: u_t(:,:), v_t(:,:), s_t(:,:) !DIR$ ATTRIBUTES ALIGN : $IRP_ALIGN :: u_t allocate(u_t(N_st,N_det),v_t(N_st,N_det),s_t(N_st,N_det)) + do k=1,N_st call dset_order(u_0(1,k),psi_bilinear_matrix_order,N_det) enddo