diff --git a/plugins/All_singles/NEEDED_CHILDREN_MODULES b/plugins/All_singles/NEEDED_CHILDREN_MODULES index 6f46f9e1..ee0ff040 100644 --- a/plugins/All_singles/NEEDED_CHILDREN_MODULES +++ b/plugins/All_singles/NEEDED_CHILDREN_MODULES @@ -1 +1 @@ -Generators_restart Perturbation Properties Selectors_no_sorted Utils DavidsonUndressed +Generators_restart Perturbation Properties Selectors_no_sorted Utils Davidson diff --git a/plugins/CAS_SD_ZMQ/NEEDED_CHILDREN_MODULES b/plugins/CAS_SD_ZMQ/NEEDED_CHILDREN_MODULES index 91dd3eff..6ff49e64 100644 --- a/plugins/CAS_SD_ZMQ/NEEDED_CHILDREN_MODULES +++ b/plugins/CAS_SD_ZMQ/NEEDED_CHILDREN_MODULES @@ -1,2 +1,2 @@ -Generators_CAS Perturbation Selectors_CASSD ZMQ DavidsonUndressed +Generators_CAS Perturbation Selectors_CASSD ZMQ Davidson diff --git a/plugins/CID/NEEDED_CHILDREN_MODULES b/plugins/CID/NEEDED_CHILDREN_MODULES index 3272abe5..1632a44d 100644 --- a/plugins/CID/NEEDED_CHILDREN_MODULES +++ b/plugins/CID/NEEDED_CHILDREN_MODULES @@ -1 +1 @@ -Selectors_full SingleRefMethod DavidsonUndressed +Selectors_full SingleRefMethod Davidson diff --git a/plugins/CID_selected/NEEDED_CHILDREN_MODULES b/plugins/CID_selected/NEEDED_CHILDREN_MODULES index ea9febd6..6b12c0ee 100644 --- a/plugins/CID_selected/NEEDED_CHILDREN_MODULES +++ b/plugins/CID_selected/NEEDED_CHILDREN_MODULES @@ -1 +1 @@ -Perturbation CID DavidsonUndressed +Perturbation CID Davidson diff --git a/plugins/CIS/NEEDED_CHILDREN_MODULES b/plugins/CIS/NEEDED_CHILDREN_MODULES index 3272abe5..1632a44d 100644 --- a/plugins/CIS/NEEDED_CHILDREN_MODULES +++ b/plugins/CIS/NEEDED_CHILDREN_MODULES @@ -1 +1 @@ -Selectors_full SingleRefMethod DavidsonUndressed +Selectors_full SingleRefMethod Davidson diff --git a/plugins/CISD/NEEDED_CHILDREN_MODULES b/plugins/CISD/NEEDED_CHILDREN_MODULES index 3272abe5..1632a44d 100644 --- a/plugins/CISD/NEEDED_CHILDREN_MODULES +++ b/plugins/CISD/NEEDED_CHILDREN_MODULES @@ -1 +1 @@ -Selectors_full SingleRefMethod DavidsonUndressed +Selectors_full SingleRefMethod Davidson diff --git a/plugins/Casino/NEEDED_CHILDREN_MODULES b/plugins/Casino/NEEDED_CHILDREN_MODULES index 2a87d1c1..34de8ddb 100644 --- a/plugins/Casino/NEEDED_CHILDREN_MODULES +++ b/plugins/Casino/NEEDED_CHILDREN_MODULES @@ -1 +1 @@ -Determinants DavidsonUndressed +Determinants Davidson diff --git a/plugins/Full_CI_ZMQ/NEEDED_CHILDREN_MODULES b/plugins/Full_CI_ZMQ/NEEDED_CHILDREN_MODULES index cc81a88f..1d6553e8 100644 --- a/plugins/Full_CI_ZMQ/NEEDED_CHILDREN_MODULES +++ b/plugins/Full_CI_ZMQ/NEEDED_CHILDREN_MODULES @@ -1 +1 @@ -Perturbation Selectors_full Generators_full ZMQ FourIdx MPI DavidsonUndressed +Perturbation Selectors_full Generators_full ZMQ FourIdx MPI Davidson diff --git a/plugins/UndressedMethod/null_dressing_vector.irp.f b/plugins/UndressedMethod/null_dressing_vector.irp.f deleted file mode 100644 index faffe964..00000000 --- a/plugins/UndressedMethod/null_dressing_vector.irp.f +++ /dev/null @@ -1,10 +0,0 @@ - BEGIN_PROVIDER [ double precision, dressing_column_h, (N_det,N_states) ] -&BEGIN_PROVIDER [ double precision, dressing_column_s, (N_det,N_states) ] - implicit none - BEGIN_DOC - ! Null dressing vectors - END_DOC - dressing_column_h(:,:) = 0.d0 - dressing_column_s(:,:) = 0.d0 -END_PROVIDER - diff --git a/plugins/mrcepa0/NEEDED_CHILDREN_MODULES b/plugins/mrcepa0/NEEDED_CHILDREN_MODULES index fe8255d1..11d8e8a8 100644 --- a/plugins/mrcepa0/NEEDED_CHILDREN_MODULES +++ b/plugins/mrcepa0/NEEDED_CHILDREN_MODULES @@ -1 +1 @@ -Perturbation Selectors_full Generators_full Psiref_CAS MRCC_Utils ZMQ +Perturbation Selectors_full Generators_full Psiref_CAS MRCC_Utils ZMQ DavidsonDressed diff --git a/src/Davidson/NEEDED_CHILDREN_MODULES b/src/Davidson/NEEDED_CHILDREN_MODULES index 9361eccd..22a71c5e 100644 --- a/src/Davidson/NEEDED_CHILDREN_MODULES +++ b/src/Davidson/NEEDED_CHILDREN_MODULES @@ -1 +1 @@ -Determinants DavidsonDressed +Davidson_Utils diff --git a/src/Davidson/README.rst b/src/Davidson/README.rst index 62a7495b..e11d0703 100644 --- a/src/Davidson/README.rst +++ b/src/Davidson/README.rst @@ -1,322 +1,14 @@ +================= +DavidsonUndressed +================= + +Module for main files with undressed Davidson + Needed Modules ============== .. Do not edit this section It was auto-generated .. by the `update_README.py` script. - - -.. image:: tree_dependency.png - -* `Determinants `_ - Documentation ============= .. Do not edit this section It was auto-generated .. by the `update_README.py` script. - - -`ci_eigenvectors `_ - Eigenvectors/values of the CI matrix - - -`ci_eigenvectors_s2 `_ - Eigenvectors/values of the CI matrix - - -`ci_electronic_energy `_ - Eigenvectors/values of the CI matrix - - -`ci_energy `_ - N_states lowest eigenvalues of the CI matrix - - -`davidson_collector `_ - Undocumented - - -`davidson_converged `_ - True if the Davidson algorithm is converged - - -`davidson_criterion `_ - Can be : [ energy | residual | both | wall_time | cpu_time | iterations ] - - -`davidson_diag `_ - Davidson diagonalization. - .br - dets_in : bitmasks corresponding to determinants - .br - u_in : guess coefficients on the various states. Overwritten - on exit - .br - dim_in : leftmost dimension of u_in - .br - sze : Number of determinants - .br - N_st : Number of eigenstates - .br - iunit : Unit number for the I/O - .br - Initial guess vectors are not necessarily orthonormal - - -`davidson_diag_hjj `_ - Davidson diagonalization with specific diagonal elements of the H matrix - .br - H_jj : specific diagonal H matrix elements to diagonalize de Davidson - .br - dets_in : bitmasks corresponding to determinants - .br - u_in : guess coefficients on the various states. Overwritten - on exit - .br - dim_in : leftmost dimension of u_in - .br - sze : Number of determinants - .br - N_st : Number of eigenstates - .br - N_st_diag : Number of states in which H is diagonalized - .br - iunit : Unit for the I/O - .br - Initial guess vectors are not necessarily orthonormal - - -`davidson_diag_hjj_sjj `_ - Davidson diagonalization with specific diagonal elements of the H matrix - .br - H_jj : specific diagonal H matrix elements to diagonalize de Davidson - .br - S2_out : Output : s^2 - .br - dets_in : bitmasks corresponding to determinants - .br - u_in : guess coefficients on the various states. Overwritten - on exit - .br - dim_in : leftmost dimension of u_in - .br - sze : Number of determinants - .br - N_st : Number of eigenstates - .br - N_st_diag : Number of states in which H is diagonalized. Assumed > sze - .br - iunit : Unit for the I/O - .br - Initial guess vectors are not necessarily orthonormal - - -`davidson_diag_hs2 `_ - Davidson diagonalization. - .br - dets_in : bitmasks corresponding to determinants - .br - u_in : guess coefficients on the various states. Overwritten - on exit - .br - dim_in : leftmost dimension of u_in - .br - sze : Number of determinants - .br - N_st : Number of eigenstates - .br - iunit : Unit number for the I/O - .br - Initial guess vectors are not necessarily orthonormal - - -`davidson_pull_results `_ - Undocumented - - -`davidson_push_results `_ - Undocumented - - -`davidson_run_slave `_ - Undocumented - - -`davidson_slave `_ - Undocumented - - -`davidson_slave_inproc `_ - Undocumented - - -`davidson_slave_tcp `_ - Undocumented - - -`davidson_slave_work `_ - Undocumented - - -`davidson_sze_max `_ - Number of micro-iterations before re-contracting - - -`det_inf `_ - Ordering function for determinants - - -`diag_and_save `_ - Undocumented - - -`diagonalize_ci `_ - Replace the coefficients of the CI states by the coefficients of the - eigenstates of the CI matrix - - -`disk_based_davidson `_ - If true, disk space is used to store the vectors - - -`distributed_davidson `_ - If true, use the distributed algorithm - - -`find_reference `_ - Undocumented - - -`first_guess `_ - Select all the determinants with the lowest energy as a starting point. - - -`h_s2_u_0_nstates `_ - Computes v_0 = H|u_0> and s_0 = S^2 |u_0> - .br - n : number of determinants - .br - H_jj : array of - .br - S2_jj : array of - - -`h_s2_u_0_nstates_openmp `_ - Computes v_0 = H|u_0> and s_0 = S^2 |u_0> - .br - Assumes that the determinants are in psi_det - .br - istart, iend, ishift, istep are used in ZMQ parallelization. - - -`h_s2_u_0_nstates_openmp_work `_ - Computes v_t = H|u_t> and s_t = S^2 |u_t> - .br - Default should be 1,N_det,0,1 - - -`h_s2_u_0_nstates_openmp_work_1 `_ - Computes v_t = H|u_t> and s_t = S^2 |u_t> - .br - Default should be 1,N_det,0,1 - - -`h_s2_u_0_nstates_openmp_work_2 `_ - Computes v_t = H|u_t> and s_t = S^2 |u_t> - .br - Default should be 1,N_det,0,1 - - -`h_s2_u_0_nstates_openmp_work_3 `_ - Computes v_t = H|u_t> and s_t = S^2 |u_t> - .br - Default should be 1,N_det,0,1 - - -`h_s2_u_0_nstates_openmp_work_4 `_ - Computes v_t = H|u_t> and s_t = S^2 |u_t> - .br - Default should be 1,N_det,0,1 - - -`h_s2_u_0_nstates_openmp_work_n_int `_ - Computes v_t = H|u_t> and s_t = S^2 |u_t> - .br - Default should be 1,N_det,0,1 - - -`h_s2_u_0_nstates_test `_ - Undocumented - - -`h_s2_u_0_nstates_zmq `_ - Computes v_0 = H|u_0> and s_0 = S^2 |u_0> - .br - n : number of determinants - .br - H_jj : array of - .br - S2_jj : array of - - -`h_u_0_nstates `_ - Computes v_0 = H|u_0> - .br - n : number of determinants - .br - H_jj : array of - .br - - -`n_states_diag `_ - Number of states to consider during the Davdison diagonalization - - -`nthreads_davidson `_ - Number of threads for Davdison - - -`print_h_matrix_restart `_ - Undocumented - - -`provide_everything `_ - Undocumented - - -`psi_energy `_ - Energy of the current wave function - - -`routine `_ - Undocumented - - -`sort_dets_ab `_ - Uncodumented : TODO - - -`sort_dets_ab_v `_ - Uncodumented : TODO - - -`sort_dets_ba_v `_ - Uncodumented : TODO - - -`state_following `_ - If true, the states are re-ordered to match the input states - - -`tamiser `_ - Uncodumented : TODO - - -`threshold_davidson `_ - Thresholds of Davidson's algorithm - - -`u_0_h_u_0 `_ - Computes e_0 = / - .br - n : number of determinants - .br - diff --git a/src/Davidson/tree_dependency.png b/src/Davidson/tree_dependency.png deleted file mode 100644 index e69de29b..00000000 diff --git a/src/DavidsonDressed/NEEDED_CHILDREN_MODULES b/src/DavidsonDressed/NEEDED_CHILDREN_MODULES index 8b137891..22a71c5e 100644 --- a/src/DavidsonDressed/NEEDED_CHILDREN_MODULES +++ b/src/DavidsonDressed/NEEDED_CHILDREN_MODULES @@ -1 +1 @@ - +Davidson_Utils diff --git a/src/DavidsonDressed/diagonalization_hs2_dressed.irp.f b/src/DavidsonDressed/diagonalization_hs2_dressed.irp.f index 8a477b5a..297db3c5 100644 --- a/src/DavidsonDressed/diagonalization_hs2_dressed.irp.f +++ b/src/DavidsonDressed/diagonalization_hs2_dressed.irp.f @@ -478,43 +478,3 @@ end -subroutine u_0_H_u_0(e_0,u_0,n,keys_tmp,Nint,N_st,sze) - use bitmasks - implicit none - BEGIN_DOC - ! Computes e_0 = / - ! - ! n : number of determinants - ! - END_DOC - integer, intent(in) :: n,Nint, N_st, sze - double precision, intent(out) :: e_0(N_st) - double precision, intent(inout) :: u_0(sze,N_st) - integer(bit_kind),intent(in) :: keys_tmp(Nint,2,n) - - double precision, allocatable :: v_0(:,:), s_0(:,:), u_1(:,:) - double precision :: u_dot_u,u_dot_v,diag_H_mat_elem - integer :: i,j - - if ((sze > 100000).and.distributed_davidson) then - allocate (v_0(sze,N_states_diag),s_0(sze,N_states_diag), u_1(sze,N_states_diag)) - u_1(1:sze,1:N_states) = u_0(1:sze,1:N_states) - u_1(1:sze,N_states+1:N_states_diag) = 0.d0 - call H_S2_u_0_nstates_zmq(v_0,s_0,u_1,N_states_diag,sze) - deallocate(u_1) - else - allocate (v_0(sze,N_st),s_0(sze,N_st)) - call H_S2_u_0_nstates_openmp(v_0,s_0,u_0,N_st,sze) - endif - double precision :: norm - do i=1,N_st - norm = u_dot_u(u_0(1,i),n) - if (norm /= 0.d0) then - e_0(i) = u_dot_v(v_0(1,i),u_0(1,i),n) - else - e_0(i) = 0.d0 - endif - enddo - deallocate (s_0, v_0) -end - diff --git a/src/DavidsonUndressed/NEEDED_CHILDREN_MODULES b/src/DavidsonUndressed/NEEDED_CHILDREN_MODULES deleted file mode 100644 index 25180044..00000000 --- a/src/DavidsonUndressed/NEEDED_CHILDREN_MODULES +++ /dev/null @@ -1 +0,0 @@ -Davidson UndressedMethod diff --git a/src/DavidsonUndressed/README.rst b/src/DavidsonUndressed/README.rst deleted file mode 100644 index e11d0703..00000000 --- a/src/DavidsonUndressed/README.rst +++ /dev/null @@ -1,14 +0,0 @@ -================= -DavidsonUndressed -================= - -Module for main files with undressed Davidson - -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/src/DavidsonUndressed/davidson_slave.irp.f b/src/DavidsonUndressed/davidson_slave.irp.f deleted file mode 100644 index d8143958..00000000 --- a/src/DavidsonUndressed/davidson_slave.irp.f +++ /dev/null @@ -1,32 +0,0 @@ -program davidson_slave - 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) :: state - - call provide_everything - call switch_qp_run_to_master - call omp_set_nested(.True.) - - zmq_context = f77_zmq_ctx_new () - zmq_state = 'davidson' - state = 'Waiting' - - zmq_to_qp_run_socket = new_zmq_to_qp_run_socket() - do - call wait_for_state(zmq_state,state) - if(trim(state) /= "davidson") exit - integer :: rc, i - print *, 'Davidson slave running' - call davidson_slave_tcp(i) - end do -end - -subroutine provide_everything - PROVIDE mo_bielec_integrals_in_map psi_det_sorted_bit N_states_diag zmq_context ref_bitmask_energy -end subroutine - diff --git a/src/DavidsonUndressed/diag_restart_save_all_states.irp.f b/src/DavidsonUndressed/diag_restart_save_all_states.irp.f deleted file mode 100644 index 3bdc37c5..00000000 --- a/src/DavidsonUndressed/diag_restart_save_all_states.irp.f +++ /dev/null @@ -1,16 +0,0 @@ -program diag_and_save - implicit none - read_wf = .True. - touch read_wf - call routine -end - -subroutine routine - implicit none - call diagonalize_CI - print*,'N_det = ',N_det - call save_wavefunction_general(N_det,N_states_diag,psi_det_sorted,size(psi_coef_sorted,1),psi_coef_sorted) - - - -end diff --git a/src/DavidsonUndressed/diag_restart_save_lowest_state.irp.f b/src/DavidsonUndressed/diag_restart_save_lowest_state.irp.f deleted file mode 100644 index 0e379aae..00000000 --- a/src/DavidsonUndressed/diag_restart_save_lowest_state.irp.f +++ /dev/null @@ -1,29 +0,0 @@ -program diag_and_save - implicit none - read_wf = .True. - touch read_wf - call routine -end - -subroutine routine - implicit none - print*,'N_det = ',N_det - PROVIDE H_apply_buffer_allocated - if (s2_eig) then - call make_s2_eigenfunction - endif - call diagonalize_CI - integer :: igood_state - igood_state=1 - double precision, allocatable :: psi_coef_tmp(:) - allocate(psi_coef_tmp(n_det)) - integer :: i - do i = 1, N_det - psi_coef_tmp(i) = psi_coef(i,igood_state) - enddo - call save_wavefunction_general(N_det,1,psi_det,n_det,psi_coef_tmp) - deallocate(psi_coef_tmp) - - - -end diff --git a/src/DavidsonUndressed/diag_restart_save_one_state.irp.f b/src/DavidsonUndressed/diag_restart_save_one_state.irp.f deleted file mode 100644 index c5f4e59d..00000000 --- a/src/DavidsonUndressed/diag_restart_save_one_state.irp.f +++ /dev/null @@ -1,26 +0,0 @@ -program diag_and_save - implicit none - read_wf = .True. - touch read_wf - call routine -end - -subroutine routine - implicit none - print*,'N_det = ',N_det - call diagonalize_CI - write(*,*)'Which state would you like to save ?' - integer :: igood_state - read(5,*)igood_state - double precision, allocatable :: psi_coef_tmp(:) - allocate(psi_coef_tmp(n_det)) - integer :: i - do i = 1, N_det - psi_coef_tmp(i) = psi_coef(i,igood_state) - enddo - call save_wavefunction_general(N_det,1,psi_det,n_det,psi_coef_tmp) - deallocate(psi_coef_tmp) - - - -end diff --git a/src/DavidsonUndressed/guess_lowest_state.irp.f b/src/DavidsonUndressed/guess_lowest_state.irp.f deleted file mode 100644 index f6d0a004..00000000 --- a/src/DavidsonUndressed/guess_lowest_state.irp.f +++ /dev/null @@ -1,162 +0,0 @@ -program first_guess - use bitmasks - implicit none - BEGIN_DOC - ! Select all the determinants with the lowest energy as a starting point. - END_DOC - integer :: i,j - double precision, allocatable :: orb_energy(:) - double precision :: E - integer, allocatable :: kept(:) - integer :: nelec_kept(2) - character :: occ_char, keep_char - - PROVIDE H_apply_buffer_allocated psi_det - allocate (orb_energy(mo_tot_num), kept(0:mo_tot_num)) - nelec_kept(1:2) = 0 - kept(0) = 0 - - print *, 'Orbital energies' - print *, '================' - print *, '' - do i=1,mo_tot_num - keep_char = ' ' - occ_char = '-' - orb_energy(i) = mo_mono_elec_integral(i,i) - do j=1,elec_beta_num - if (i==j) cycle - orb_energy(i) += mo_bielec_integral_jj_anti(i,j) - enddo - do j=1,elec_alpha_num - orb_energy(i) += mo_bielec_integral_jj(i,j) - enddo - if ( (orb_energy(i) > -.5d0).and.(orb_energy(i) < .1d0) ) then - kept(0) += 1 - keep_char = 'X' - kept( kept(0) ) = i - if (i <= elec_beta_num) then - nelec_kept(2) += 1 - endif - if (i <= elec_alpha_num) then - nelec_kept(1) += 1 - endif - endif - if (i <= elec_alpha_num) then - if (i <= elec_beta_num) then - occ_char = '#' - else - occ_char = '+' - endif - endif - print '(I4, 3X, A, 3X, F10.6, 3X, A)', i, occ_char, orb_energy(i), keep_char - enddo - - - integer, allocatable :: list (:,:) - integer(bit_kind), allocatable :: string(:,:) - allocate ( list(N_int*bit_kind_size,2), string(N_int,2) ) - - string = ref_bitmask - call bitstring_to_list( string(1,1), list(1,1), elec_alpha_num, N_int) - call bitstring_to_list( string(1,2), list(1,2), elec_beta_num , N_int) - - psi_det_alpha_unique(:,1) = string(:,1) - psi_det_beta_unique (:,1) = string(:,2) - N_det_alpha_unique = 1 - N_det_beta_unique = 1 - - integer :: i1,i2,i3,i4,i5,i6,i7,i8,i9 - - psi_det_size = kept(0)**(nelec_kept(1)+nelec_kept(2)) - print *, kept(0), nelec_kept(:) - call write_int(6,psi_det_size,'psi_det_size') - TOUCH psi_det_size - -BEGIN_SHELL [ /usr/bin/python ] - -template_alpha_ext = """ -do %(i2)s = %(i1)s-1,1,-1 - list(elec_alpha_num-%(i)d,1) = kept(%(i2)s) - call list_to_bitstring( string(1,1), list(1,1), elec_alpha_num, N_int) -""" - -template_alpha = """ -do %(i2)s = %(i1)s-1,1,-1 - list(elec_alpha_num-%(i)d,1) = kept(%(i2)s) - call list_to_bitstring( string(1,1), list(1,1), elec_alpha_num, N_int) - N_det_alpha_unique += 1 - psi_det_alpha_unique(:,N_det_alpha_unique) = string(:,1) -""" - -template_beta_ext = """ -do %(i2)s = %(i1)s-1,1,-1 - list(elec_beta_num-%(i)d,2) = kept(%(i2)s) - call list_to_bitstring( string(1,2), list(1,2), elec_beta_num, N_int) -""" -template_beta = """ -do %(i2)s = %(i1)s-1,1,-1 - list(elec_beta_num-%(i)d,2) = kept(%(i2)s) - call list_to_bitstring( string(1,2), list(1,2), elec_beta_num, N_int) - N_det_beta_unique += 1 - psi_det_beta_unique(:,N_det_beta_unique) = string(:,2) -""" - -def write(template_ext,template,imax): - print "case(%d)"%(imax) - def aux(i2,i1,i,j): - if (i==imax-1): - print template%locals() - else: - print template_ext%locals() - i += 1 - j -= 1 - if (i != imax): - i1 = "i%d"%(i) - i2 = "i%d"%(i+1) - aux(i2,i1,i,j) - print "enddo" - - i2 = "i1" - i1 = "kept(0)+1" - i = 0 - aux(i2,i1,i,imax) - -def main(): - print """ - select case (nelec_kept(1)) - case(0) - continue - """ - for imax in range(1,10): - write(template_alpha_ext,template_alpha,imax) - - print """ - end select - - select case (nelec_kept(2)) - case(0) - continue - """ - for imax in range(1,10): - write(template_beta_ext,template_beta,imax) - print "end select" - -main() - -END_SHELL - - TOUCH N_det_alpha_unique N_det_beta_unique psi_det_alpha_unique psi_det_beta_unique - call create_wf_of_psi_bilinear_matrix(.False.) - call diagonalize_ci - j= N_det - do i=1,N_det - if (psi_average_norm_contrib_sorted(i) < 1.d-6) then - j = i-1 - exit - endif -! call debug_det(psi_det_sorted(1,1,i),N_int) - enddo - call save_wavefunction_general(j,N_states,psi_det_sorted,size(psi_coef_sorted,1),psi_coef_sorted) - - deallocate(orb_energy, kept, list, string) -end diff --git a/src/DavidsonUndressed/print_H_matrix_restart.irp.f b/src/DavidsonUndressed/print_H_matrix_restart.irp.f deleted file mode 100644 index 57fc3633..00000000 --- a/src/DavidsonUndressed/print_H_matrix_restart.irp.f +++ /dev/null @@ -1,176 +0,0 @@ -program print_H_matrix_restart - implicit none - read_wf = .True. - touch read_wf - call routine - -end - -subroutine routine - use bitmasks - implicit none - integer :: i,j - integer, allocatable :: H_matrix_degree(:,:) - double precision, allocatable :: H_matrix_phase(:,:) - integer :: degree - integer(bit_kind), allocatable :: keys_tmp(:,:,:) - allocate(keys_tmp(N_int,2,N_det)) - do i = 1, N_det - print*,'' - call debug_det(psi_det(1,1,i),N_int) - do j = 1, N_int - keys_tmp(j,1,i) = psi_det(j,1,i) - keys_tmp(j,2,i) = psi_det(j,2,i) - enddo - enddo - if(N_det.ge.10000)then - print*,'Warning !!!' - print*,'Number of determinants is ',N_det - print*,'It means that the H matrix will be enormous !' - print*,'stoppping ..' - stop - endif - print*,'' - print*,'Determinants ' - do i = 1, N_det - enddo - allocate(H_matrix_degree(N_det,N_det),H_matrix_phase(N_det,N_det)) - integer :: exc(0:2,2,2) - double precision :: phase - do i = 1, N_det - do j = i, N_det - call get_excitation_degree(psi_det(1,1,i),psi_det(1,1,j),degree,N_int) - H_matrix_degree(i,j) = degree - H_matrix_degree(j,i) = degree - phase = 0.d0 - if(degree==1.or.degree==2)then - call get_excitation(psi_det(1,1,i),psi_det(1,1,j),exc,degree,phase,N_int) - endif - H_matrix_phase(i,j) = phase - H_matrix_phase(j,i) = phase - enddo - enddo - print*,'H matrix ' - double precision :: ref_h_matrix,s2 - ref_h_matrix = H_matrix_all_dets(1,1) - print*,'HF like determinant energy = ',ref_bitmask_energy+nuclear_repulsion - print*,'Ref element of H_matrix = ',ref_h_matrix+nuclear_repulsion - print*,'Printing the H matrix ...' - print*,'' - print*,'' -!do i = 1, N_det -! H_matrix_all_dets(i,i) -= ref_h_matrix -!enddo - - do i = 1, N_det - H_matrix_all_dets(i,i) += nuclear_repulsion - enddo - -!do i = 5,N_det -! H_matrix_all_dets(i,3) = 0.d0 -! H_matrix_all_dets(3,i) = 0.d0 -! H_matrix_all_dets(i,4) = 0.d0 -! H_matrix_all_dets(4,i) = 0.d0 -!enddo - - - - - - do i = 1, N_det - write(*,'(I3,X,A3,1000(F16.7))')i,' | ',H_matrix_all_dets(i,:) - enddo - - print*,'' - print*,'' - print*,'' - print*,'Printing the degree of excitations within the H matrix' - print*,'' - print*,'' - do i = 1, N_det - write(*,'(I3,X,A3,X,1000(I1,X))')i,' | ',H_matrix_degree(i,:) - enddo - - - print*,'' - print*,'' - print*,'Printing the phase of the Hamiltonian matrix elements ' - print*,'' - print*,'' - do i = 1, N_det - write(*,'(I3,X,A3,X,1000(F3.0,X))')i,' | ',H_matrix_phase(i,:) - enddo - print*,'' - - - double precision, allocatable :: eigenvectors(:,:), eigenvalues(:) - double precision, allocatable :: s2_eigvalues(:) - allocate (eigenvectors(size(H_matrix_all_dets,1),N_det)) - allocate (eigenvalues(N_det),s2_eigvalues(N_det)) - call lapack_diag(eigenvalues,eigenvectors, & - H_matrix_all_dets,size(H_matrix_all_dets,1),N_det) - print*,'Two first eigenvectors ' - call u_0_S2_u_0(s2_eigvalues,eigenvectors,n_det,keys_tmp,N_int,N_det,size(eigenvectors,1)) - do j =1, N_states - print*,'s2 = ',s2_eigvalues(j) - print*,'e = ',eigenvalues(j) - print*,'coefs : ' - do i = 1, N_det - print*,'i = ',i,eigenvectors(i,j) - enddo - if(j>1)then - print*,'Delta E(H) = ',eigenvalues(1) - eigenvalues(j) - print*,'Delta E(eV) = ',(eigenvalues(1) - eigenvalues(j))*27.2114d0 - endif - enddo - double precision :: get_mo_bielec_integral,k_a_iv,k_b_iv - integer :: h1,p1,h2,p2 - h1 = 10 - p1 = 16 - h2 = 14 - p2 = 14 -!h1 = 1 -!p1 = 4 -!h2 = 2 -!p2 = 2 - k_a_iv = get_mo_bielec_integral(h1,h2,p2,p1,mo_integrals_map) - h2 = 15 - p2 = 15 - k_b_iv = get_mo_bielec_integral(h1,h2,p2,p1,mo_integrals_map) - print*,'k_a_iv = ',k_a_iv - print*,'k_b_iv = ',k_b_iv - double precision :: k_av,k_bv,k_ai,k_bi - h1 = 16 - p1 = 14 - h2 = 14 - p2 = 16 - k_av = get_mo_bielec_integral(h1,h2,p1,p2,mo_integrals_map) - h1 = 16 - p1 = 15 - h2 = 15 - p2 = 16 - k_bv = get_mo_bielec_integral(h1,h2,p1,p2,mo_integrals_map) - - h1 = 10 - p1 = 14 - h2 = 14 - p2 = 10 - k_ai = get_mo_bielec_integral(h1,h2,p1,p2,mo_integrals_map) - - h1 = 10 - p1 = 15 - h2 = 15 - p2 = 10 - k_bi = get_mo_bielec_integral(h1,h2,p1,p2,mo_integrals_map) - - print*,'k_av, k_bv = ',k_av,k_bv - print*,'k_ai, k_bi = ',k_ai,k_bi - double precision :: k_iv - - h1 = 10 - p1 = 16 - h2 = 16 - p2 = 10 - k_iv = get_mo_bielec_integral(h1,h2,p1,p2,mo_integrals_map) - print*,'k_iv = ',k_iv -end diff --git a/src/DavidsonUndressed/print_energy.irp.f b/src/DavidsonUndressed/print_energy.irp.f deleted file mode 100644 index ae6f1da2..00000000 --- a/src/DavidsonUndressed/print_energy.irp.f +++ /dev/null @@ -1,22 +0,0 @@ -program print_energy - implicit none - read_wf = .true. - touch read_wf - call routine -end - -subroutine routine - implicit none - integer :: i,j - double precision :: accu,hij - - print*, 'psi_energy = ',psi_energy + nuclear_repulsion - accu = 0.d0 -! do i = 1,N_det -! do j = 1,N_det -! call i_H_j(psi_det(1,1,j),psi_det(1,1,i),N_int,hij) -! accu += psi_coef(i,1) * psi_coef(j,1) * hij -! enddo -! enddo -! print*, 'accu = ',accu + nuclear_repulsion -end diff --git a/src/Davidson/EZFIO.cfg b/src/Davidson_Utils/EZFIO.cfg similarity index 100% rename from src/Davidson/EZFIO.cfg rename to src/Davidson_Utils/EZFIO.cfg diff --git a/src/Davidson_Utils/NEEDED_CHILDREN_MODULES b/src/Davidson_Utils/NEEDED_CHILDREN_MODULES new file mode 100644 index 00000000..aae89501 --- /dev/null +++ b/src/Davidson_Utils/NEEDED_CHILDREN_MODULES @@ -0,0 +1 @@ +Determinants diff --git a/src/Davidson_Utils/README.rst b/src/Davidson_Utils/README.rst new file mode 100644 index 00000000..5116f1bc --- /dev/null +++ b/src/Davidson_Utils/README.rst @@ -0,0 +1,324 @@ +Abstract module for Davidson diagonalization. + +Needed Modules +============== +.. Do not edit this section It was auto-generated +.. by the `update_README.py` script. + + +.. image:: tree_dependency.png + +* `Determinants `_ + +Documentation +============= +.. Do not edit this section It was auto-generated +.. by the `update_README.py` script. + + +`ci_eigenvectors `_ + Eigenvectors/values of the CI matrix + + +`ci_eigenvectors_s2 `_ + Eigenvectors/values of the CI matrix + + +`ci_electronic_energy `_ + Eigenvectors/values of the CI matrix + + +`ci_energy `_ + N_states lowest eigenvalues of the CI matrix + + +`davidson_collector `_ + Undocumented + + +`davidson_converged `_ + True if the Davidson algorithm is converged + + +`davidson_criterion `_ + Can be : [ energy | residual | both | wall_time | cpu_time | iterations ] + + +`davidson_diag `_ + Davidson diagonalization. + .br + dets_in : bitmasks corresponding to determinants + .br + u_in : guess coefficients on the various states. Overwritten + on exit + .br + dim_in : leftmost dimension of u_in + .br + sze : Number of determinants + .br + N_st : Number of eigenstates + .br + iunit : Unit number for the I/O + .br + Initial guess vectors are not necessarily orthonormal + + +`davidson_diag_hjj `_ + Davidson diagonalization with specific diagonal elements of the H matrix + .br + H_jj : specific diagonal H matrix elements to diagonalize de Davidson + .br + dets_in : bitmasks corresponding to determinants + .br + u_in : guess coefficients on the various states. Overwritten + on exit + .br + dim_in : leftmost dimension of u_in + .br + sze : Number of determinants + .br + N_st : Number of eigenstates + .br + N_st_diag : Number of states in which H is diagonalized + .br + iunit : Unit for the I/O + .br + Initial guess vectors are not necessarily orthonormal + + +`davidson_diag_hjj_sjj `_ + Davidson diagonalization with specific diagonal elements of the H matrix + .br + H_jj : specific diagonal H matrix elements to diagonalize de Davidson + .br + S2_out : Output : s^2 + .br + dets_in : bitmasks corresponding to determinants + .br + u_in : guess coefficients on the various states. Overwritten + on exit + .br + dim_in : leftmost dimension of u_in + .br + sze : Number of determinants + .br + N_st : Number of eigenstates + .br + N_st_diag : Number of states in which H is diagonalized. Assumed > sze + .br + iunit : Unit for the I/O + .br + Initial guess vectors are not necessarily orthonormal + + +`davidson_diag_hs2 `_ + Davidson diagonalization. + .br + dets_in : bitmasks corresponding to determinants + .br + u_in : guess coefficients on the various states. Overwritten + on exit + .br + dim_in : leftmost dimension of u_in + .br + sze : Number of determinants + .br + N_st : Number of eigenstates + .br + iunit : Unit number for the I/O + .br + Initial guess vectors are not necessarily orthonormal + + +`davidson_pull_results `_ + Undocumented + + +`davidson_push_results `_ + Undocumented + + +`davidson_run_slave `_ + Undocumented + + +`davidson_slave `_ + Undocumented + + +`davidson_slave_inproc `_ + Undocumented + + +`davidson_slave_tcp `_ + Undocumented + + +`davidson_slave_work `_ + Undocumented + + +`davidson_sze_max `_ + Number of micro-iterations before re-contracting + + +`det_inf `_ + Ordering function for determinants + + +`diag_and_save `_ + Undocumented + + +`diagonalize_ci `_ + Replace the coefficients of the CI states by the coefficients of the + eigenstates of the CI matrix + + +`disk_based_davidson `_ + If true, disk space is used to store the vectors + + +`distributed_davidson `_ + If true, use the distributed algorithm + + +`find_reference `_ + Undocumented + + +`first_guess `_ + Select all the determinants with the lowest energy as a starting point. + + +`h_s2_u_0_nstates `_ + Computes v_0 = H|u_0> and s_0 = S^2 |u_0> + .br + n : number of determinants + .br + H_jj : array of + .br + S2_jj : array of + + +`h_s2_u_0_nstates_openmp `_ + Computes v_0 = H|u_0> and s_0 = S^2 |u_0> + .br + Assumes that the determinants are in psi_det + .br + istart, iend, ishift, istep are used in ZMQ parallelization. + + +`h_s2_u_0_nstates_openmp_work `_ + Computes v_t = H|u_t> and s_t = S^2 |u_t> + .br + Default should be 1,N_det,0,1 + + +`h_s2_u_0_nstates_openmp_work_1 `_ + Computes v_t = H|u_t> and s_t = S^2 |u_t> + .br + Default should be 1,N_det,0,1 + + +`h_s2_u_0_nstates_openmp_work_2 `_ + Computes v_t = H|u_t> and s_t = S^2 |u_t> + .br + Default should be 1,N_det,0,1 + + +`h_s2_u_0_nstates_openmp_work_3 `_ + Computes v_t = H|u_t> and s_t = S^2 |u_t> + .br + Default should be 1,N_det,0,1 + + +`h_s2_u_0_nstates_openmp_work_4 `_ + Computes v_t = H|u_t> and s_t = S^2 |u_t> + .br + Default should be 1,N_det,0,1 + + +`h_s2_u_0_nstates_openmp_work_n_int `_ + Computes v_t = H|u_t> and s_t = S^2 |u_t> + .br + Default should be 1,N_det,0,1 + + +`h_s2_u_0_nstates_test `_ + Undocumented + + +`h_s2_u_0_nstates_zmq `_ + Computes v_0 = H|u_0> and s_0 = S^2 |u_0> + .br + n : number of determinants + .br + H_jj : array of + .br + S2_jj : array of + + +`h_u_0_nstates `_ + Computes v_0 = H|u_0> + .br + n : number of determinants + .br + H_jj : array of + .br + + +`n_states_diag `_ + Number of states to consider during the Davdison diagonalization + + +`nthreads_davidson `_ + Number of threads for Davdison + + +`print_h_matrix_restart `_ + Undocumented + + +`provide_everything `_ + Undocumented + + +`psi_energy `_ + Energy of the current wave function + + +`routine `_ + Undocumented + + +`sort_dets_ab `_ + Uncodumented : TODO + + +`sort_dets_ab_v `_ + Uncodumented : TODO + + +`sort_dets_ba_v `_ + Uncodumented : TODO + + +`state_following `_ + If true, the states are re-ordered to match the input states + + +`tamiser `_ + Uncodumented : TODO + + +`threshold_davidson `_ + Thresholds of Davidson's algorithm + + +`u_0_h_u_0 `_ + Computes e_0 = / + .br + n : number of determinants + .br + diff --git a/src/Davidson/davidson_parallel.irp.f b/src/Davidson_Utils/davidson_parallel.irp.f similarity index 100% rename from src/Davidson/davidson_parallel.irp.f rename to src/Davidson_Utils/davidson_parallel.irp.f diff --git a/src/Davidson/diagonalization.irp.f b/src/Davidson_Utils/diagonalization.irp.f similarity index 100% rename from src/Davidson/diagonalization.irp.f rename to src/Davidson_Utils/diagonalization.irp.f diff --git a/src/Davidson/diagonalize_CI.irp.f b/src/Davidson_Utils/diagonalize_CI.irp.f similarity index 100% rename from src/Davidson/diagonalize_CI.irp.f rename to src/Davidson_Utils/diagonalize_CI.irp.f diff --git a/src/Davidson/find_reference.irp.f b/src/Davidson_Utils/find_reference.irp.f similarity index 100% rename from src/Davidson/find_reference.irp.f rename to src/Davidson_Utils/find_reference.irp.f diff --git a/src/Davidson/parameters.irp.f b/src/Davidson_Utils/parameters.irp.f similarity index 100% rename from src/Davidson/parameters.irp.f rename to src/Davidson_Utils/parameters.irp.f diff --git a/src/Davidson/u0Hu0.irp.f b/src/Davidson_Utils/u0Hu0.irp.f similarity index 92% rename from src/Davidson/u0Hu0.irp.f rename to src/Davidson_Utils/u0Hu0.irp.f index e4b1de50..dc020fc9 100644 --- a/src/Davidson/u0Hu0.irp.f +++ b/src/Davidson_Utils/u0Hu0.irp.f @@ -458,3 +458,43 @@ N_int;; END_TEMPLATE +subroutine u_0_H_u_0(e_0,u_0,n,keys_tmp,Nint,N_st,sze) + use bitmasks + implicit none + BEGIN_DOC + ! Computes e_0 = / + ! + ! n : number of determinants + ! + END_DOC + integer, intent(in) :: n,Nint, N_st, sze + double precision, intent(out) :: e_0(N_st) + double precision, intent(inout) :: u_0(sze,N_st) + integer(bit_kind),intent(in) :: keys_tmp(Nint,2,n) + + double precision, allocatable :: v_0(:,:), s_0(:,:), u_1(:,:) + double precision :: u_dot_u,u_dot_v,diag_H_mat_elem + integer :: i,j + + if ((sze > 100000).and.distributed_davidson) then + allocate (v_0(sze,N_states_diag),s_0(sze,N_states_diag), u_1(sze,N_states_diag)) + u_1(1:sze,1:N_states) = u_0(1:sze,1:N_states) + u_1(1:sze,N_states+1:N_states_diag) = 0.d0 + call H_S2_u_0_nstates_zmq(v_0,s_0,u_1,N_states_diag,sze) + deallocate(u_1) + else + allocate (v_0(sze,N_st),s_0(sze,N_st)) + call H_S2_u_0_nstates_openmp(v_0,s_0,u_0,N_st,sze) + endif + double precision :: norm + do i=1,N_st + norm = u_dot_u(u_0(1,i),n) + if (norm /= 0.d0) then + e_0(i) = u_dot_v(v_0(1,i),u_0(1,i),n) + else + e_0(i) = 0.d0 + endif + enddo + deallocate (s_0, v_0) +end +