30 use const_gbl,
only: stdout
58 class(
basematrix),
intent(inout) :: matrix_elements
60 integer :: starting_index, num_csfs, ido, jdo, num_continuum, csf_a_idx, csf_b_idx
61 integer :: num_elements, loop_skip, my_idx, loop_ido, total_vals, m_flag, diag
62 real(wp) :: mat_coeff, element_one
65 num_continuum = this % options % last_continuum
66 num_csfs = this % options % num_csfs
68 this % orbitals % MFLG = 0
70 call matrix_elements % initialize_matrix_structure(num_csfs,
mat_dense, num_csfs)
72 call ref_symbolic_elements % construct
73 call this % slater_rules(this % csfs(1), this % csfs(1), ref_symbolic_elements, diag, .false.)
75 element_one = this % evaluate_integrals(ref_symbolic_elements, 0)
77 call symbolic_elements % construct
78 call symbolic_elements % clear
80 loop_skip = max(1, grid % gprocs)
81 my_idx = max(grid % grank, 0)
84 do loop_ido = 1, total_vals, loop_skip
86 call matrix_elements % update_pure_L2(.false.)
87 ido = loop_ido + my_idx
88 if (ido > total_vals) cycle
92 if (csf_a_idx == csf_b_idx)
then
97 if (csf_a_idx < csf_b_idx) cycle
99 call this % slater_rules(this % csfs(csf_a_idx), this % csfs(csf_b_idx), symbolic_elements, m_flag, .false.)
101 if (m_flag == 0 .and. this % diagonal_flag == 0)
then
102 call symbolic_elements % add_symbols(ref_symbolic_elements, -1.0_wp)
105 mat_coeff = this % evaluate_integrals(symbolic_elements, this % options % phase_correction_flag)
106 if (this % diagonal_flag == 0 .and. this % orbitals % MFLG == 0) mat_coeff = mat_coeff + element_one
107 call matrix_elements % insert_matrix_element(csf_a_idx, csf_b_idx, mat_coeff)
108 num_elements = num_elements + 1
110 call symbolic_elements % clear
115 call matrix_elements % update_pure_L2(.true.)
118 call symbolic_elements % destroy
119 call matrix_elements % finalize_matrix
121 write (stdout,
"('Num of elements = ',i0)") num_elements