subroutine init_exact_diag() use bit_rep_data, only: NIfTot use gndts_mod, only: gndts_all_sym_this_proc use SystemData, only: nbasis, nel use util_mod, only: choose_i64 integer :: expected_ndets_tot integer(n_int), allocatable :: ilut_list(:, :) character(len=*), parameter :: t_r = 'init_exact_diag' integer :: ierr write(stdout, '(/,1x,a57,/)') "Beginning exact diagonalisation in all symmetry sectors." call neci_flush(stdout) write(stdout, '(1x,a56)', advance='no') "Enumerating and storing all determinants in the space..." call neci_flush(stdout) ! Generate and count all the determinants on this processor, but don't store them. call gndts_all_sym_this_proc(ilut_list, .true., ndets_ed) allocate(ilut_list(0:NIfTot, ndets_ed)) ! Now generate them again and store them this time. call gndts_all_sym_this_proc(ilut_list, .false., ndets_ed) write(stdout, '(1x,a9)') "Complete." call neci_flush(stdout) expected_ndets_tot = int(choose_i64(nbasis, nel)) if (ndets_ed /= expected_ndets_tot) then write(stdout, *) "ndets counted:", ndets_ed, "ndets expected:", expected_ndets_tot call stop_all('t_r', 'The number of determinants generated is not & &consistent with the expected number.') end if allocate(eigv_ed(ndets_ed), stat=ierr) if (ierr /= 0) then write(stdout, '(1x,a11,1x,i5)') "Error code:", ierr call stop_all(t_r, "Error allocating eigenvalue array.") end if eigv_ed = 0.0_dp write(stdout, '(1x,a48)') "Allocating and calculating Hamiltonian matrix..." call neci_flush(stdout) allocate(hamiltonian(ndets_ed, ndets_ed), stat=ierr) if (ierr /= 0) then write(stdout, '(1x,a11,1x,i5)') "Error code:", ierr call stop_all(t_r, "Error allocating Hamiltonian array.") end if write(stdout, '(1x,a46)') "Hamiltonian allocation completed successfully." call neci_flush(stdout) call calculate_full_hamiltonian(ilut_list, hamiltonian) write(stdout, '(1x,a33)') "Hamiltonian calculation complete." call neci_flush(stdout) end subroutine init_exact_diag