35 use const_gbl,
only: stdout
37 use integer_packing,
only: pack8ints, unpack8ints
38 use mpi_gbl,
only: mpi_reduceall_max
39 use precisn,
only: longint, wp
69 integer :: total_num_csf
70 integer :: num_l2_functions
71 integer :: l2_mat_offset
73 integer :: non_zero_prototype = 0
133 this % rmat_ci => rmat_ci
137 this % start_L2 = this % options % last_continuum + 1
139 this % total_num_csf = this % options % num_csfs
141 this % L2_mat_offset = this % options % contracted_mat_size - this % total_num_csf
142 this % num_L2_functions = this % options % num_L2_CSF
156 class(
basematrix),
intent(inout) :: matrix_elements
157 integer :: num_target_sym, target_sym, num_targets_per_sym, i1, i2, n1, n2, l1, loop_skip, loop_ido, my_idx, ido
158 integer :: num_csfs, m, n, num_continuum, total_l1_cont_elems, matrix_block_size, estimated_mat_size
161 matrix_block_size = this % options % contracted_mat_size - this % total_num_csf + this % options % last_continuum
163 write (stdout,
"('continuum block_size =',i8)") matrix_block_size
166 call matrix_elements % initialize_matrix_structure(this % options % contracted_mat_size,
mat_sparse, matrix_block_size)
169 num_target_sym = this % options % num_target_sym
175 this % orbitals % MFLG = 0
181 do i1 = 1, num_target_sym
182 call this % evaluate_class_1(i1, this % options % num_target_state_sym(i1), matrix_elements)
185 write (stdout,
"('Class 1 complete')")
219 this % orbitals % MFLG = 1
223 do i1 = 1, num_target_sym
224 call this % evaluate_class_3(i1, this % options % num_target_state_sym(i1), matrix_elements)
230 write (stdout,
"('Class 3 complete')")
238 loop_skip = max(1, grid % gprocs)
239 my_idx = max(grid % grank, 0)
242 do i1 = 1, num_target_sym
243 total_l1_cont_elems = this % options % num_target_state_sym(i1) * this % options % num_continuum_orbitals_target(i1)
244 do loop_ido = this % start_L2, this % total_num_csf, loop_skip
245 l1 = my_idx + loop_ido
247 if (l1 > this % total_num_csf)
then
249 do ido = 1, total_l1_cont_elems
250 call matrix_elements % update_pure_L2(.false.)
254 call this % evaluate_class_4(i1, this % options % num_target_state_sym(i1), l1, matrix_elements)
260 write (stdout,
"('Class 4 complete')")
270 do i1 = 1, num_target_sym - 1
271 do i2 = i1 + 1, num_target_sym
276 if (this % options % lambda_continuum_orbitals_target(i1) == &
277 this % options % lambda_continuum_orbitals_target(i2))
then
278 if (this % options % gerade_sym_continuum_orbital_target(i1) == &
279 this % options % gerade_sym_continuum_orbital_target(i2))
then
282 call this % evaluate_class_5(i1, this % options % num_target_state_sym(i1), i2, &
283 this % options % num_target_state_sym(i2), matrix_elements)
286 call this % evaluate_class_6 (i1, this % options % num_target_state_sym(i1), i2, &
287 this % options % num_target_state_sym(i2), matrix_elements)
296 call this % evaluate_class_7(i1, this % options % num_target_state_sym(i1), i2, &
297 this % options % num_target_state_sym(i2), matrix_elements)
305 write (stdout,
"('Class 567 complete')")
313 call this % evaluate_class_2_and_8(matrix_elements)
317 write (stdout,
"('Class 2+8 complete')")
324 call matrix_elements % update_pure_L2(.true.)
327 call matrix_elements % finalize_matrix
330 n = (this % options % num_csfs * (this % options % num_csfs + 1)) / 2
331 m = (this % options % contracted_mat_size * (this % options % contracted_mat_size + 1)) / 2
333 write (stdout, 6000) m, matrix_elements % get_size()
334 6000
format(//,
' TOTAL H Matrix ELEMENTS =',i15,/,
' NON-ZERO ELEMENTS evaluated =',i15)
335 write (stdout, 6010) n, this % non_zero_prototype
336 6010
format(
' Total prototype ELEMENTS =',i15,/,
' Non-zero prototype ELEMENTS =',i15)
338 6020
format(/,
' Number (prototype) integrals =',i15,/,
' Compressed (prototype) integrals =',i15)
339 write (stdout, 6030) this % number_of_integrals
340 6030
format(
' Number integrals evaluated =',i15)
358 class(
basematrix),
intent(inout) :: matrix_elements
359 integer,
intent(in) :: i1
360 integer,
intent(in) :: num_targets
367 integer,
allocatable :: matrix_index(:,:)
374 integer :: starting_index, ido, jdo, ii, jj, ij, err
376 integer :: loop_idx, loop_ido, my_idx, loop_skip
378 integer :: num_configurations
380 integer :: config_idx_a, config_idx_b
382 real(wp),
allocatable :: alpha_coeffs(:,:)
384 real(wp),
allocatable :: mat_coeffs(:,:)
386 integer :: continuum_orbital, num_continuum_orbitals
388 allocate(matrix_index(2,num_targets*(num_targets+1)/2), stat = err)
389 call master_memory % track_memory(kind(matrix_index),
size(matrix_index), err,
'CLASS1::MATRIX_INDEX')
390 allocate(alpha_coeffs(num_targets*(num_targets+1)/2,1), stat = err)
391 call master_memory % track_memory(kind(alpha_coeffs),
size(alpha_coeffs), err,
'CLASS1::alpha_coeffs')
392 allocate(mat_coeffs(num_targets*(num_targets+1)/2,1), stat = err)
393 call master_memory % track_memory(kind(mat_coeffs),
size(mat_coeffs), err,
'CLASS1::mat_coeffs')
395 num_continuum_orbitals = this % options % num_continuum_orbitals_target(i1)
398 num_ci = num_targets * (num_targets + 1) / 2
401 do n1 = 1, this % options % num_target_state_sym(i1)
402 do n2 = n1, this % options % num_target_state_sym(i1)
405 call this % compute_matrix_ij(i1, n1, 1, i1, n2, 1, matrix_index(1,ii), matrix_index(2,ii))
410 call master_prototype % construct(num_ci, 1)
413 call temp_prototype % construct
416 starting_index = this % get_starting_index(i1)
419 num_configurations = this % options % num_ci_target_sym(i1)
422 loop_skip = max(1, grid % lprocs)
423 my_idx = max(grid % lrank, 0)
427 do loop_ido = 1, num_configurations, loop_skip
428 this % orbitals % MFLG = 0
430 ido = loop_ido + my_idx
432 if (ido > num_configurations) cycle
434 config_idx_a = starting_index + (ido - 1) * this % csf_skip
436 call this % slater_rules(this % csfs(config_idx_a), this % csfs(config_idx_a), temp_prototype, 0, .false.)
437 alpha_coeffs = 0.0_wp
440 do n1 = 1, this % options % num_target_state_sym(i1)
441 do n2 = n1, this % options % num_target_state_sym(i1)
443 alpha_coeffs(ii,1) = this % get_target_coeff(i1, ido, n1) * this % get_target_coeff(i1, ido, n2)
447 call master_prototype % add_symbols(temp_prototype, alpha_coeffs)
451 call temp_prototype % clear
457 config_idx_b = starting_index + (jdo - 1) * this % csf_skip
459 call this % slater_rules(this % csfs(config_idx_b), this % csfs(config_idx_a), temp_prototype, 1, .false.)
462 if (temp_prototype % is_empty()) cycle
466 do n1 = 1, this % options % num_target_state_sym(i1)
467 do n2 = n1, this % options % num_target_state_sym(i1)
469 alpha_coeffs(ii,1) = this % get_target_coeff(i1, ido, n1) * this % get_target_coeff(i1, jdo, n2) &
470 + this % get_target_coeff(i1, jdo, n1) * this % get_target_coeff(i1, ido, n2)
477 call master_prototype % add_symbols(temp_prototype, alpha_coeffs)
480 call temp_prototype % clear
486 call master_prototype % synchronize_symbols()
504 config_idx_a = starting_index + (num_configurations - 1) * this % csf_skip
506 continuum_orbital = this % csfs(config_idx_a) % orbital_sequence_number
509 loop_skip = max(1, grid % gprocs)
510 my_idx = max(grid % grank, 0)
514 do loop_ido = 1, num_continuum_orbitals, loop_skip
515 ido = loop_ido + my_idx
516 call matrix_elements % update_pure_L2(.false., num_targets * (num_targets - 1))
518 if (ido > num_continuum_orbitals) cycle
522 call this % contr_expand_diagonal_eval(continuum_orbital, master_prototype, ido, mat_coeffs)
524 do ii = 1, num_targets
525 do jj = ii, num_targets
528 mat_coeffs(ij,1) = mat_coeffs(ij,1) + this % rmat_ci(i1) % eigenvalues(ii)
530 call matrix_elements % insert_matrix_element(matrix_index(2,ij) + ido - 1, &
531 matrix_index(1,ij) + ido - 1, mat_coeffs(ij,1), 8)
540 call temp_prototype %destroy
543 call master_prototype % destroy
545 call master_memory % free_memory(kind(matrix_index),
size(matrix_index))
546 call master_memory % free_memory(kind(alpha_coeffs),
size(alpha_coeffs))
547 call master_memory % free_memory(kind(mat_coeffs),
size(mat_coeffs))
548 deallocate(matrix_index, alpha_coeffs, mat_coeffs)
550 this % non_zero_prototype = this % non_zero_prototype + 1
567 class(
basematrix),
intent(inout) :: matrix_elements
569 real(wp) :: mat_coeff
570 integer :: l1, mat_offset, loop_ido, loop_skip, my_idx
572 this % diagonal_flag = 0
575 call symbolic_elements % construct
577 loop_skip = max(1, grid % gprocs)
578 my_idx = max(1, grid % grank)
581 do l1 = this % start_L2, this % total_num_csf
582 call matrix_elements % update_pure_L2(.false.)
584 call this % slater_rules(this % csfs(l1), this % csfs(l1), symbolic_elements, 0)
586 if (symbolic_elements % is_empty()) cycle
588 mat_coeff = this % evaluate_integrals(symbolic_elements,
normal_phase)
590 call matrix_elements % insert_matrix_element(l1 + this % L2_mat_offset, l1 + this % L2_mat_offset, mat_coeff, 2)
592 call symbolic_elements % clear
594 this % non_zero_prototype = this % non_zero_prototype + 1
598 call symbolic_elements % destroy
616 class(
basematrix),
intent(inout) :: matrix_elements
617 integer,
intent(in) :: i1, num_targets
624 integer,
allocatable :: matrix_index(:,:)
630 integer :: starting_index, ido, jdo, ii
632 integer :: loop_idx, loop_ido, my_idx, loop_skip, err
634 integer :: num_configurations
636 integer :: config_idx_a, config_idx_b
638 real(wp),
allocatable :: alpha_coeffs(:,:)
640 real(wp),
allocatable :: mat_coeffs(:,:)
642 integer :: continuum_orbital_a, continuum_orbital_b, num_continuum_orbitals, total_orbs
644 allocate(matrix_index(2,num_targets*(num_targets+1)/2), stat = err)
645 call master_memory % track_memory(kind(matrix_index),
size(matrix_index), err,
'CLASS3::MATRIX_INDEX')
647 allocate(alpha_coeffs(num_targets*(num_targets+1)/2,1), stat = err)
648 call master_memory % track_memory(kind(alpha_coeffs),
size(alpha_coeffs), err,
'CLASS3::alpha_coeffs')
650 allocate(mat_coeffs(num_targets*(num_targets+1)/2,1), stat = err)
651 call master_memory % track_memory(kind(mat_coeffs),
size(mat_coeffs), err,
'CLASS3::mat_coeffs')
654 num_continuum_orbitals = this % options % num_continuum_orbitals_target(i1)
657 num_ci = num_targets * (num_targets + 1) / 2
660 do n1 = 1, this % options % num_target_state_sym(i1)
661 do n2 = n1, this % options % num_target_state_sym(i1)
664 call this % compute_matrix_ij(i1, n1, 2, i1, n2, 1, matrix_index(1,ii), matrix_index(2,ii))
669 call master_prototype % construct(num_targets * (num_targets + 1) / 2, 1)
672 call temp_prototype % construct
675 starting_index = this % get_starting_index(i1)
678 num_configurations = this % options % num_ci_target_sym(i1)
681 loop_skip = max(1, grid % lprocs)
682 my_idx = max(grid % lrank, 0)
686 do loop_ido = 1, num_configurations, loop_skip
688 ido = loop_ido + my_idx
690 if (ido > num_configurations) cycle
692 config_idx_a = starting_index + (ido - 1) * this % csf_skip
694 config_idx_b = config_idx_a + 1
696 call this % slater_rules(this % csfs(config_idx_b), this % csfs(config_idx_a), temp_prototype, 0, .false.)
698 alpha_coeffs = 0.0_wp
701 do n1 = 1, this % options % num_target_state_sym(i1)
702 do n2 = n1, this % options % num_target_state_sym(i1)
703 alpha_coeffs(ii,1) = this % get_target_coeff(i1, ido, n1) * this % get_target_coeff(i1, ido, n2)
707 call master_prototype % add_symbols(temp_prototype, alpha_coeffs)
710 call temp_prototype % clear
713 do jdo = ido + 1, num_configurations
715 config_idx_b = config_idx_a + 1 + (jdo - ido) * this % csf_skip
717 call this % slater_rules(this % csfs(config_idx_b), this % csfs(config_idx_a), temp_prototype, 1, .false.)
720 if (temp_prototype % is_empty()) cycle
721 alpha_coeffs = 0.0_wp
725 do n1 = 1, this % options % num_target_state_sym(i1)
726 do n2 = n1, this % options % num_target_state_sym(i1)
727 alpha_coeffs(ii,1) = this % get_target_coeff(i1, ido, n1) * this % get_target_coeff(i1, jdo, n2) &
728 + this % get_target_coeff(i1, jdo, n1) * this % get_target_coeff(i1, ido, n2)
732 call master_prototype % add_symbols(temp_prototype, alpha_coeffs)
734 call temp_prototype % clear
739 call master_prototype % synchronize_symbols()
773 config_idx_a = starting_index + (num_configurations - 1) * this % csf_skip
774 config_idx_b = config_idx_a + 1
776 continuum_orbital_a = this % csfs(config_idx_a) % orbital_sequence_number
777 continuum_orbital_b = this % csfs(config_idx_b) % orbital_sequence_number
781 loop_skip = max(1, grid % gprocs)
782 my_idx = max(grid % grank, 0)
786 do loop_ido = 1, total_orbs, loop_skip
788 loop_idx = loop_ido + my_idx
789 call matrix_elements % update_pure_L2(.false., num_targets * (num_targets - 1))
791 if (loop_idx > total_orbs) cycle
795 if (ido > num_continuum_orbitals) cycle
796 if (jdo > num_continuum_orbitals) cycle
797 if (jdo < ido + 1) cycle
798 if (ido == jdo) cycle
807 call this % contr_expand_off_diagonal_eval(continuum_orbital_a, continuum_orbital_b, &
808 master_prototype, ido, jdo, mat_coeffs)
810 do n1 = 1, num_targets
811 do n2 = n1, num_targets
813 call matrix_elements % insert_matrix_element(matrix_index(2,ii) + jdo - 1, &
814 matrix_index(1,ii) + ido - 2, mat_coeffs(ii,1), 8)
820 call matrix_elements % insert_matrix_element (matrix_index(2,ii) + ido - 1, &
821 matrix_index(1,ii) + jdo - 2, mat_coeffs(ii,1), 8)
835 call master_prototype % destroy
838 call temp_prototype % destroy
840 this % non_zero_prototype = this % non_zero_prototype + 1
842 call master_memory % free_memory(kind(matrix_index),
size(matrix_index))
843 call master_memory % free_memory(kind(alpha_coeffs),
size(alpha_coeffs))
844 call master_memory % free_memory(kind(mat_coeffs),
size(mat_coeffs))
845 deallocate(matrix_index, alpha_coeffs, mat_coeffs)
865 class(
basematrix),
intent(inout) :: matrix_elements
866 integer,
intent(in) :: i1, num_states, l1
868 integer :: config_idx_a
869 integer :: num_continuum_orbitals
870 integer :: num_configurations
872 integer :: continuum_orbital
874 integer :: ido, jdo, starting_index, i, j
875 integer :: loop_skip, loop_idx, my_idx, err
876 integer,
allocatable :: matrix_index(:)
880 real(wp),
allocatable :: alpha_coeffs(:,:), mat_coeffs(:)
882 allocate(matrix_index(num_states), stat = err)
883 call master_memory % track_memory(kind(matrix_index),
size(matrix_index), err,
'CLASS4::MATRIX_INDEX')
885 allocate(alpha_coeffs(num_states,1), stat = err)
886 call master_memory % track_memory(kind(alpha_coeffs),
size(alpha_coeffs), err,
'CLASS4::alpha_coeffs')
888 allocate(mat_coeffs(num_states), stat = err)
889 call master_memory % track_memory(kind(mat_coeffs),
size(mat_coeffs), err,
'CLASS4::mat_coeffs')
892 num_continuum_orbitals = this % options % num_continuum_orbitals_target(i1)
894 num_configurations = this % options % num_ci_target_sym(i1)
897 starting_index = this % get_starting_index(i1)
899 do n1 = 1, num_states
902 call this % compute_matrix_ij(i1, n1, 1, 1, 1, 1, matrix_index(n1), j)
905 call master_prototype % construct(num_states, 1)
908 call temp_prototype % construct
910 call temp_prototype % clear
917 do ido = 1, num_configurations
923 config_idx_a = starting_index + (ido - 1) * this % csf_skip
926 call this % slater_rules(this % csfs(l1), this % csfs(config_idx_a), temp_prototype, 1, .false.)
928 if (temp_prototype % is_empty()) cycle
931 do n1 = 1, num_states
932 alpha_coeffs(n1,1) = this % get_target_coeff(i1, ido, n1)
935 call master_prototype % add_symbols(temp_prototype, alpha_coeffs)
936 call temp_prototype % clear
939 call temp_prototype % clear
942 config_idx_a = starting_index + (num_configurations - 1) * this % csf_skip
944 continuum_orbital = this % csfs(config_idx_a) % orbital_sequence_number
947 j = l1 + this % L2_mat_offset
962 do ido = 1, num_continuum_orbitals
967 call this % contr_expand_continuum_L2_eval(continuum_orbital, master_prototype, ido, mat_coeffs)
969 do n1 = 1, num_states
972 call matrix_elements % insert_matrix_element(j, matrix_index(n1) + ido - 1, mat_coeffs(n1), 8, 0.0_wp)
974 call matrix_elements % update_pure_L2(.false.)
979 call master_prototype % destroy
980 call temp_prototype % destroy
982 this % non_zero_prototype = this % non_zero_prototype + 1
984 call master_memory % free_memory(kind(matrix_index),
size(matrix_index))
985 call master_memory % free_memory(kind(alpha_coeffs),
size(alpha_coeffs))
986 call master_memory % free_memory(kind(mat_coeffs),
size(mat_coeffs))
988 deallocate(matrix_index, alpha_coeffs, mat_coeffs)
1009 class(
basematrix),
intent(inout) :: matrix_elements
1010 integer,
intent(in) :: i1, i2, num_target_1, num_target_2
1017 integer,
allocatable :: matrix_index(:,:,:)
1018 real(wp),
allocatable :: alpha_coeffs(:,:)
1022 integer :: config_idx_a,config_idx_b,n1,n2
1024 integer :: num_continuum_orbitals
1026 integer :: num_configurations_a,num_configurations_b,total_configurations
1028 integer :: loop_idx,my_idx,loop_skip,loop_ido
1030 integer :: ido,jdo,starting_index_a,starting_index_b,i,j,err
1032 integer :: continuum_orbital
1037 real(wp),
allocatable :: mat_coeffs(:,:)
1039 allocate(matrix_index(2, num_target_1, num_target_2), stat = err)
1040 call master_memory % track_memory(kind(matrix_index),
size(matrix_index), err,
'CLASS5::MATRIX_INDEX')
1042 allocate(alpha_coeffs(num_target_1, num_target_2), stat = err)
1043 call master_memory % track_memory(kind(alpha_coeffs),
size(alpha_coeffs), err,
'CLASS5::alpha_coeffs')
1045 allocate(mat_coeffs(num_target_1, num_target_2), stat = err)
1046 call master_memory % track_memory(kind(mat_coeffs),
size(mat_coeffs), err,
'CLASS5::mat_coeffs')
1049 num_continuum_orbitals = min(this % options % num_continuum_orbitals_target(i1), &
1050 this % options % num_continuum_orbitals_target(i2))
1053 starting_index_a = this % get_starting_index(i1)
1056 starting_index_b = this % get_starting_index(i2)
1059 num_configurations_a = this % options % num_ci_target_sym(i1)
1062 num_configurations_b = this % options % num_ci_target_sym(i2)
1065 do n1 = 1, num_target_1
1066 do n2 = 1, num_target_2
1067 call this % compute_matrix_ij(i1, n1, 1, i2, n2, 1, matrix_index(1,n1,n2), matrix_index(2,n1,n2))
1070 call master_prototype % construct(num_target_1, num_target_2)
1073 call temp_prototype % construct
1074 call temp_prototype % clear
1079 total_configurations =
compute_total_box(num_configurations_a, num_configurations_b)
1082 loop_skip = max(1, grid % lprocs)
1083 my_idx = max(grid % lrank, 0)
1091 do loop_ido = 1, total_configurations, loop_skip
1092 alpha_coeffs = 0.0_wp
1095 loop_idx = loop_ido + my_idx
1097 if (loop_idx > total_configurations) cycle
1101 alpha_coeffs = 0.0_wp
1104 config_idx_a = starting_index_a + (ido - 1) * this % csf_skip
1105 config_idx_b = starting_index_b + (jdo - 1) * this % csf_skip
1108 call this % slater_rules(this % csfs(config_idx_b), this % csfs(config_idx_a), temp_prototype, 1, .false.)
1110 if (temp_prototype % is_empty()) cycle
1119 do n1 = 1, num_target_1
1120 do n2 = 1, num_target_2
1121 alpha_coeffs(n1,n2) = this % get_target_coeff(i1,ido,n1) * this % get_target_coeff(i2,jdo,n2)
1125 call master_prototype % add_symbols(temp_prototype, alpha_coeffs)
1128 call temp_prototype % clear
1132 call temp_prototype % destroy
1137 config_idx_a = starting_index_a + (num_configurations_a - 1) * this % csf_skip
1138 continuum_orbital = this % csfs(config_idx_a) % orbital_sequence_number
1152 call master_prototype % synchronize_symbols
1157 loop_skip = max(1, grid % gprocs)
1158 my_idx = max(grid % grank, 0)
1161 do loop_ido = 1, num_continuum_orbitals, loop_skip
1163 ido = loop_ido + my_idx
1164 call matrix_elements % update_pure_L2(.false., num_target_1 * num_target_2)
1166 if (ido > num_continuum_orbitals) cycle
1168 call this % contr_expand_diagonal_eval(continuum_orbital, master_prototype, ido, mat_coeffs)
1170 do n1 = 1, num_target_1
1171 do n2 = 1, num_target_2
1174 call matrix_elements % insert_matrix_element(matrix_index(2,n1,n2) + ido - 1, &
1175 matrix_index(1,n1,n2) + ido - 1, mat_coeffs(n1,n2), 8)
1183 call master_prototype % destroy
1185 this % non_zero_prototype = this % non_zero_prototype + 1
1187 call master_memory % free_memory(kind(matrix_index),
size(matrix_index))
1188 call master_memory % free_memory(kind(alpha_coeffs),
size(alpha_coeffs))
1189 call master_memory % free_memory(kind(mat_coeffs),
size(mat_coeffs))
1191 deallocate(matrix_index, alpha_coeffs, mat_coeffs)
1212 integer,
intent(in) :: i1, i2, num_target_1, num_target_2
1213 class(
basematrix),
intent(inout) :: matrix_elements
1221 integer,
allocatable :: matrix_index(:,:,:)
1222 real(wp),
allocatable :: alpha_coeffs(:,:)
1228 integer :: config_idx_a, config_idx_b, n1, n2
1231 integer :: num_continuum_orbitals_a, num_continuum_orbitals_b
1234 integer :: num_configurations_a, num_configurations_b, total_configurations
1237 integer :: loop_idx, my_idx, loop_skip, loop_ido
1240 integer :: ido, jdo, starting_index_a, starting_index_b, i, j, err
1243 integer :: continuum_orbital_a, continuum_orbital_b, total_orbs
1247 real(wp),
allocatable :: mat_coeffs(:,:)
1249 allocate(matrix_index(2, num_target_1, num_target_2), stat = err)
1250 call master_memory % track_memory(kind(matrix_index),
size(matrix_index), err,
'CLASS6::MATRIX_INDEX')
1252 allocate(alpha_coeffs(num_target_1, num_target_2), stat = err)
1253 call master_memory % track_memory(kind(alpha_coeffs),
size(alpha_coeffs), err,
'CLASS6::alpha_coeffs')
1255 allocate(mat_coeffs(num_target_1, num_target_2), stat = err)
1256 call master_memory % track_memory(kind(mat_coeffs),
size(mat_coeffs), err,
'CLASS6::mat_coeffs')
1259 num_continuum_orbitals_a = this % options % num_continuum_orbitals_target(i1)
1262 num_continuum_orbitals_b = this % options % num_continuum_orbitals_target(i2)
1265 starting_index_a = this % get_starting_index(i1)
1268 starting_index_b = this % get_starting_index(i2)
1271 num_configurations_a = this % options % num_ci_target_sym(i1)
1274 num_configurations_b = this % options % num_ci_target_sym(i2)
1277 do n1 = 1, num_target_1
1278 do n2 = 1, num_target_2
1279 call this % compute_matrix_ij(i1, n1, 1, i2, n2, 1, matrix_index(1,n1,n2), matrix_index(2,n1,n2))
1282 call master_prototype % construct(num_target_1, num_target_2)
1285 call temp_prototype % construct
1286 call temp_prototype % clear
1290 total_configurations =
compute_total_box(num_configurations_a, num_configurations_b)
1293 loop_skip = max(1, grid % lprocs)
1294 my_idx = max(grid % lrank, 0)
1302 do loop_ido = 1, total_configurations, loop_skip
1303 alpha_coeffs = 0.0_wp
1306 loop_idx = loop_ido + my_idx
1308 if (loop_idx > total_configurations) cycle
1313 config_idx_a = starting_index_a + (ido - 1) * this % csf_skip
1314 config_idx_b = starting_index_b + 1 + (jdo - 1) * this % csf_skip
1317 call this % slater_rules(this % csfs(config_idx_b), this % csfs(config_idx_a), temp_prototype, 1, .false.)
1319 if (temp_prototype % is_empty()) cycle
1328 do n1 = 1, num_target_1
1329 do n2 = 1, num_target_2
1330 alpha_coeffs(n1,n2) = this % get_target_coeff(i1,ido,n1) * this % get_target_coeff(i2,jdo,n2)
1334 call master_prototype % add_symbols(temp_prototype, alpha_coeffs)
1337 call temp_prototype % clear
1341 call temp_prototype % clear
1344 continuum_orbital_a = this % csfs(config_idx_a) % orbital_sequence_number
1345 continuum_orbital_b = this % csfs(config_idx_b) % orbital_sequence_number
1350 call master_prototype % synchronize_symbols
1353 total_orbs =
compute_total_box(num_continuum_orbitals_a, num_continuum_orbitals_b)
1356 loop_skip = max(1, grid % gprocs)
1357 my_idx = max(grid % grank, 0)
1360 do loop_ido = 1, total_orbs, loop_skip
1363 loop_idx = loop_ido + my_idx
1364 call matrix_elements%update_pure_L2(.false.,num_target_1*num_target_2)
1367 if(loop_idx > total_orbs) cycle
1371 if (ido == jdo) cycle
1375 call this % contr_expand_off_diagonal_eval (continuum_orbital_a, continuum_orbital_b, &
1376 master_prototype, ido, jdo, mat_coeffs)
1377 do n1 = 1, num_target_1
1379 do n2 = 1, num_target_2
1381 call matrix_elements % insert_matrix_element (matrix_index(2,n1,n2) + jdo - 1, &
1382 matrix_index(1,n1,n2) + ido - 1, &
1383 mat_coeffs(n1,n2), 8)
1391 call master_prototype % destroy
1392 call temp_prototype % destroy
1394 this % non_zero_prototype = this % non_zero_prototype + 1
1396 call master_memory % free_memory(kind(matrix_index),
size(matrix_index))
1397 call master_memory % free_memory(kind(alpha_coeffs),
size(alpha_coeffs))
1398 call master_memory % free_memory(kind(mat_coeffs),
size(mat_coeffs))
1400 deallocate(matrix_index, alpha_coeffs, mat_coeffs)
1420 integer,
intent(in) :: i1, i2, num_target_1, num_target_2
1421 class(
basematrix),
intent(inout) :: matrix_elements
1429 integer,
allocatable :: matrix_index(:,:,:)
1430 real(wp),
allocatable :: alpha_coeffs(:,:)
1436 integer :: config_idx_a, config_idx_b, n1, n2
1439 integer :: num_continuum_orbitals_a, num_continuum_orbitals_b
1442 integer :: num_configurations_a, num_configurations_b, total_configurations
1445 integer :: loop_idx, my_idx, loop_skip, loop_ido
1448 integer :: ido, jdo, starting_index_a, starting_index_b, i, j, err
1451 integer :: continuum_orbital_a, continuum_orbital_b, total_orbs
1455 real(wp),
allocatable :: mat_coeffs(:,:)
1457 allocate(matrix_index(2,num_target_1,num_target_2), stat = err)
1458 call master_memory % track_memory(kind(matrix_index),
size(matrix_index), err,
'CLASS7::MATRIX_INDEX')
1460 allocate(alpha_coeffs(num_target_1,num_target_2), stat = err)
1461 call master_memory % track_memory(kind(alpha_coeffs),
size(alpha_coeffs), err,
'CLASS7::alpha_coeffs')
1463 allocate(mat_coeffs(num_target_1,num_target_2), stat = err)
1464 call master_memory % track_memory(kind(mat_coeffs),
size(mat_coeffs), err,
'CLASS7::mat_coeffs')
1470 num_continuum_orbitals_a = this % options % num_continuum_orbitals_target(i1)
1472 num_continuum_orbitals_b = this % options % num_continuum_orbitals_target(i2)
1475 starting_index_a = this % get_starting_index(i1)
1477 starting_index_b = this % get_starting_index(i2)
1480 num_configurations_a = this % options % num_ci_target_sym(i1)
1482 num_configurations_b = this % options % num_ci_target_sym(i2)
1485 do n1 = 1, num_target_1
1486 do n2= 1, num_target_2
1487 call this % compute_matrix_ij(i1, n1, 1, i2, n2, 1, matrix_index(1,n1,n2), matrix_index(2,n1,n2))
1491 call master_prototype % construct(num_target_1, num_target_2)
1494 call temp_prototype % construct
1495 call temp_prototype % clear
1499 total_configurations =
compute_total_box(num_configurations_a, num_configurations_b)
1502 loop_skip = max(1, grid % lprocs)
1503 my_idx = max(grid % lrank, 0)
1511 do loop_ido = 1, total_configurations, loop_skip
1512 alpha_coeffs = 0.0_wp
1515 loop_idx = loop_ido + my_idx
1517 if (loop_idx > total_configurations) cycle
1522 config_idx_a = starting_index_a + (ido - 1) * this % csf_skip
1523 config_idx_b = starting_index_b + (jdo - 1) * this % csf_skip
1526 call this % slater_rules(this % csfs(config_idx_b), this % csfs(config_idx_a), temp_prototype, 1, .false.)
1529 if (temp_prototype % is_empty()) cycle
1539 do n1 = 1, num_target_1
1540 do n2 = 1, num_target_2
1541 alpha_coeffs(n1,n2) = this % get_target_coeff(i1, ido, n1) * this % get_target_coeff(i2, jdo, n2)
1545 call master_prototype % add_symbols(temp_prototype, alpha_coeffs)
1548 call temp_prototype % clear
1552 call temp_prototype % clear
1557 n1 = config_idx_a;
call mpi_reduceall_max(n1, config_idx_a, grid % lcomm)
1558 n2 = config_idx_b;
call mpi_reduceall_max(n2, config_idx_b, grid % lcomm)
1561 continuum_orbital_a = this % csfs(config_idx_a) % orbital_sequence_number
1562 continuum_orbital_b = this % csfs(config_idx_b) % orbital_sequence_number
1565 call master_prototype % synchronize_symbols
1568 total_orbs =
compute_total_box(num_continuum_orbitals_a, num_continuum_orbitals_b)
1571 loop_skip = max(1, grid % gprocs)
1572 my_idx = max(grid % grank, 0)
1577 do loop_ido = 1, total_orbs, loop_skip
1580 loop_idx = loop_ido + my_idx
1581 call matrix_elements % update_pure_L2(.false., num_target_1 * num_target_2)
1583 if (loop_idx > total_orbs) cycle
1588 call this % expand_off_diagonal_gen_eval(continuum_orbital_a, continuum_orbital_b, master_prototype, &
1589 ido, jdo, mat_coeffs)
1591 do n1 = 1, num_target_1
1593 do n2 = 1, num_target_2
1595 call matrix_elements % insert_matrix_element(matrix_index(2,n1,n2) + jdo - 1, &
1596 matrix_index(1,n1,n2) + ido - 1, &
1597 mat_coeffs(n1,n2), 8)
1606 call temp_prototype % destroy
1607 call master_prototype % destroy
1609 this % non_zero_prototype = this % non_zero_prototype + 1
1611 call master_memory % free_memory(kind(matrix_index),
size(matrix_index))
1612 call master_memory % free_memory(kind(alpha_coeffs),
size(alpha_coeffs))
1613 call master_memory % free_memory(kind(mat_coeffs),
size(mat_coeffs))
1615 deallocate(matrix_index, alpha_coeffs, mat_coeffs)
1631 class(
basematrix),
intent(inout) :: matrix_elements
1635 real(wp) :: mat_coeff
1636 integer :: loop_ido, my_idx, loop_skip
1639 call symbolic_elements % construct
1641 my_idx = max(1, grid % grank)
1642 loop_skip = max(1, grid % gprocs)
1645 do loop_ido = this % start_L2, this % total_num_csf - 1, loop_skip
1646 l1 = loop_ido + my_idx
1647 call matrix_elements % update_pure_L2(.false.)
1650 do l2 = this % start_L2, l1 - 1
1653 if (l1 > this % total_num_csf - 1)
exit
1656 call this % slater_rules(this % csfs(l1), this % csfs(l2), symbolic_elements, 1, .false.)
1658 if (symbolic_elements % is_empty()) cycle
1660 mat_coeff = this % evaluate_integrals(symbolic_elements,
normal_phase)
1662 call matrix_elements % insert_matrix_element(l2 + this % L2_mat_offset, l1 + this % L2_mat_offset, mat_coeff, 8)
1664 call symbolic_elements % clear
1666 this % non_zero_prototype = this % non_zero_prototype + 1
1671 call symbolic_elements % destroy
1689 class(
basematrix),
intent(inout) :: matrix_elements
1693 real(wp) :: mat_coeff
1694 integer :: loop_idx, ido
1695 integer :: total_vals
1696 integer :: loop_skip, my_idx
1700 call symbolic_elements % construct
1701 trig_n = this % num_L2_functions
1704 this % diagonal_flag = 0
1707 loop_skip = max(1, grid % gprocs)
1708 my_idx= max(grid % grank, 0)
1710 write (stdout,
"('start,total: ',2i12)") this % start_L2, total_vals
1715 do ido = 1, total_vals, loop_skip
1718 call matrix_elements % update_pure_L2(.false.)
1719 call symbolic_elements % clear
1722 loop_idx = ido + my_idx
1724 if (loop_idx > total_vals) cycle
1729 l1 = l1 + this % start_L2 - 1
1730 l2 = l2 + this % start_L2 - 1
1733 if ((l2 + this % L2_mat_offset) < (l1 + this % L2_mat_offset)) cycle
1736 if (l1 > this % total_num_csf .or. l2 > this % total_num_csf) cycle
1737 if (l1 < this % start_L2 .or. l2 < this % start_L2 ) cycle
1743 if (l1 == l2) diag = 0
1746 call this % slater_rules(this % csfs(l1), this % csfs(l2), symbolic_elements, diag, .false.)
1748 if (symbolic_elements % is_empty()) cycle
1750 mat_coeff = this % evaluate_integrals(symbolic_elements,
normal_phase)
1756 call matrix_elements % insert_matrix_element(l2 + this % L2_mat_offset, l1 + this % L2_mat_offset, mat_coeff, 8)
1759 this % non_zero_prototype = this % non_zero_prototype + 1
1764 call symbolic_elements % destroy
1785 integer,
intent(in) :: i1, n1, j1, i2, n2, j2
1786 integer,
intent(out) :: i, j
1792 i = i + this % options % num_target_state_sym(ido - 1) &
1793 * this % options % num_continuum_orbitals_target(ido - 1)
1797 i = i + this % options % num_continuum_orbitals_target(i1)
1804 j = j + this % options % num_target_state_sym(ido - 1) &
1805 * this % options % num_continuum_orbitals_target(ido - 1)
1809 j = j + this % options % num_continuum_orbitals_target(i2)
1819 subroutine expand_diagonal (this, continuum_orbital, master_prototype, j1, expanded_prototype)
1822 integer,
intent(in) :: continuum_orbital, j1
1824 integer(longint) :: integral(2)
1825 real(wp) :: integral_coeff
1826 integer :: lwd(8), lw1, lw2, ido, i, num_integrals
1828 num_integrals = master_prototype % get_size()
1830 do ido = 1, num_integrals
1833 call master_prototype % get_coeff_and_integral(ido, integral_coeff, integral)
1834 call unpack8ints(integral, lwd)
1840 if (lwd(i) == continuum_orbital)
then
1850 call expanded_prototype % insert_symbol(integral, integral_coeff, .false.)
1852 else if (lw2 == 0)
then
1853 lwd(lw1) = continuum_orbital + j1 - 1
1855 lwd(lw1) = continuum_orbital + j1 - 1
1856 lwd(lw2) = continuum_orbital + j1 - 1
1859 call expanded_prototype % insert_ijklm_symbol(lwd(1), lwd(2), lwd(3), lwd(4), lwd(5), integral_coeff, .false.)
1866 subroutine expand_off_diagonal (this, continuum_orbital_a, continuum_orbital_b, master_prototype, ja, jb, expanded_prototype)
1869 integer,
intent(in) :: continuum_orbital_a, continuum_orbital_b, ja, jb
1871 integer(longint) :: integral(2)
1872 real(wp) :: integral_coeff
1873 integer :: lwd(8), lwa, lwb, ido, i, num_integrals
1875 num_integrals = master_prototype % get_size()
1877 do ido = 1, num_integrals
1880 call master_prototype % get_coeff_and_integral(ido, integral_coeff, integral)
1881 call unpack8ints(integral, lwd)
1887 if (lwd(i) == continuum_orbital_a) lwa = i
1888 if (lwd(i) == continuum_orbital_b) lwb = i
1892 if (max(lwa, lwb) == 0)
then
1893 call expanded_prototype % insert_symbol(integral, integral_coeff, .false.)
1895 else if (lwb == 0)
then
1896 lwd(lwa) = continuum_orbital_a + ja - 1
1897 else if (lwa == 0)
then
1898 lwd(lwb) = continuum_orbital_b + jb - 2
1900 lwd(lwa) = continuum_orbital_a + ja - 1
1901 lwd(lwb) = continuum_orbital_b + jb - 2
1906 call expanded_prototype % insert_ijklm_symbol(lwd(1), lwd(2), lwd(3), lwd(4), lwd(5), integral_coeff, .false.)
1917 integer,
intent(in) :: continuum_orbital, j1
1919 integer(longint) :: integral(2)
1920 real(wp) :: integral_coeff
1921 integer :: lwd(8), lw, ido, i, num_integrals
1923 num_integrals = master_prototype % get_size()
1925 do ido = 1, num_integrals
1928 call master_prototype % get_coeff_and_integral(ido, integral_coeff, integral)
1929 call unpack8ints(integral, lwd)
1934 if (lwd(i) == continuum_orbital) lw=i
1938 call expanded_prototype % insert_symbol(integral, integral_coeff, .false.)
1941 lwd(lw) = continuum_orbital + j1 - 1
1944 call expanded_prototype % insert_ijklm_symbol(lwd(1), lwd(2), lwd(3), lwd(4), lwd(5), integral_coeff, .false.)
1953 ja, jb, expanded_prototype)
1956 integer,
intent(in) :: continuum_orbital_a, continuum_orbital_b, ja, jb
1958 integer(longint) :: integral(2)
1959 real(wp) :: integral_coeff
1960 integer :: lwd(8), lwa, lwb, ido, i, num_integrals
1962 num_integrals = master_prototype % get_size()
1964 do ido = 1, num_integrals
1967 call master_prototype % get_coeff_and_integral(ido, integral_coeff, integral)
1968 call unpack8ints(integral, lwd)
1974 if (lwd(i) == continuum_orbital_a) lwa = i
1975 if (lwd(i) == continuum_orbital_b) lwb = i
1979 if (max(lwa, lwb) == 0)
then
1980 call expanded_prototype % insert_symbol(integral, integral_coeff, .false.)
1982 else if(lwb == 0)
then
1983 lwd(lwa) = continuum_orbital_a + ja - 1
1984 else if (lwa == 0)
then
1985 lwd(lwb) = continuum_orbital_b + jb - 1
1987 lwd(lwa) = continuum_orbital_a + ja - 1
1988 lwd(lwb) = continuum_orbital_b + jb - 1
1992 call expanded_prototype % insert_ijklm_symbol(lwd(1), lwd(2), lwd(3), lwd(4), lwd(5), integral_coeff, .false.)
2013 integer,
intent(in) :: continuum_orbital, j1
2015 real(wp),
intent(out) :: mat_coeffs(:)
2017 integer(longint) :: integral(2)
2018 real(wp) :: integral_coeff
2019 integer :: lwd(8), lw1, lw2, ido, i, prototypes, num_prototypes, num_integrals
2021 num_prototypes =
size(master_prototype)
2022 num_integrals = master_prototype(1) % get_size()
2025 if (num_integrals == 0)
return
2027 do ido = 1, num_integrals
2030 call master_prototype(1) % get_coeff_and_integral(ido, integral_coeff, integral)
2031 call unpack8ints(integral, lwd)
2033 integral_coeff = 1.0_wp
2039 if (lwd(i) == continuum_orbital)
then
2049 integral_coeff = this % evaluate_integrals_singular(integral, 1.0_wp,
normal_phase)
2050 do prototypes = 1, num_prototypes
2051 mat_coeffs(prototypes) = mat_coeffs(prototypes) &
2052 + master_prototype(prototypes) % get_coefficient(ido) * integral_coeff
2055 else if (lw2 == 0)
then
2056 lwd(lw1) = continuum_orbital + j1 - 1
2058 lwd(lw1) = continuum_orbital + j1 - 1
2059 lwd(lw2) = continuum_orbital + j1 - 1
2062 call pack8ints(lwd(1), lwd(2), lwd(3), lwd(4), lwd(5), 0, 0, 0, integral)
2063 integral_coeff = this % evaluate_integrals_singular(integral, 1.0_wp,
normal_phase)
2065 do prototypes = 1, num_prototypes
2066 mat_coeffs(prototypes) = mat_coeffs(prototypes) + master_prototype(prototypes)%get_coefficient(ido) * integral_coeff
2087 integer,
intent(in) :: continuum_orbital, j1
2088 real(wp),
intent(out) :: mat_coeffs(:,:)
2090 integer(longint) :: integral(2)
2091 real(wp) :: integral_coeff
2093 integer :: lwd(8), lw1, lw2, ido, i, prototypes, num_prototypes, num_integrals, num_targets_1, num_targets_2, n1, n2
2095 num_integrals = master_prototype % get_size()
2096 num_targets_1 = master_prototype % get_num_targets_sym1()
2097 num_targets_2 = master_prototype % get_num_targets_sym2()
2100 if (num_integrals == 0)
return
2102 do ido = 1, num_integrals
2105 integral = master_prototype % get_integral_label(ido)
2106 call unpack8ints(integral, lwd)
2108 integral_coeff = 1.0_wp
2113 if (lwd(i) == continuum_orbital)
then
2123 integral_coeff = this % evaluate_integrals_singular(integral, 1.0_wp,
normal_phase)
2124 do n1 = 1,num_targets_1
2125 do n2 = 1,num_targets_2
2126 mat_coeffs(n1,n2) = mat_coeffs(n1,n2) + master_prototype % get_coefficient(ido, n1, n2) * integral_coeff
2130 else if (lw2 == 0)
then
2131 lwd(lw1) = continuum_orbital + j1 - 1
2133 lwd(lw1) = continuum_orbital + j1 - 1
2134 lwd(lw2) = continuum_orbital + j1 - 1
2137 call pack8ints(lwd(1), lwd(2), lwd(3), lwd(4), lwd(5), 0, 0, 0, integral)
2138 integral_coeff = this % evaluate_integrals_singular(integral, 1.0_wp,
normal_phase)
2140 do n1 = 1,num_targets_1
2141 do n2 = 1,num_targets_2
2142 mat_coeffs(n1,n2) = mat_coeffs(n1,n2) + master_prototype % get_coefficient(ido, n1, n2) * integral_coeff
2164 integer,
intent(in) :: continuum_orbital, j1
2165 real(wp),
intent(out) :: mat_coeffs(:)
2167 integer(longint) :: integral(2)
2168 real(wp) :: integral_coeff
2169 integer :: lwd(8), lw, ido, i, prototypes, num_prototypes, num_integrals
2171 num_prototypes =
size(master_prototype)
2172 num_integrals = master_prototype(1) % get_size()
2176 if (num_integrals == 0)
return
2178 do ido = 1, num_integrals
2181 call master_prototype(1) % get_coeff_and_integral(ido, integral_coeff, integral)
2182 call unpack8ints(integral, lwd)
2184 integral_coeff = 1.0_wp
2188 if (lwd(i) == continuum_orbital) lw = i
2192 integral_coeff = this % evaluate_integrals_singular(integral, 1.0_wp,
normal_phase)
2193 do prototypes = 1, num_prototypes
2194 mat_coeffs(prototypes) = mat_coeffs(prototypes) &
2195 + master_prototype(prototypes) % get_coefficient(ido) * integral_coeff
2198 lwd(lw) = continuum_orbital + j1 - 1
2201 call pack8ints(lwd(1), lwd(2), lwd(3), lwd(4), lwd(5), 0, 0, 0, integral)
2203 integral_coeff = this % evaluate_integrals_singular(integral, 1.0_wp,
normal_phase)
2205 do prototypes = 1, num_prototypes
2206 mat_coeffs(prototypes) = mat_coeffs(prototypes) + master_prototype(prototypes)%get_coefficient(ido) * integral_coeff
2227 integer,
intent(in) :: continuum_orbital, j1
2228 real(wp),
intent(out) :: mat_coeffs(:)
2230 integer(longint) :: integral(2)
2231 real(wp) :: integral_coeff
2232 integer :: lwd(8), lw, ido, i, num_targets_1, num_targets_2, n1, n2, num_integrals
2234 num_targets_1 = master_prototype % get_num_targets_sym1()
2235 num_integrals = master_prototype % get_size()
2238 if (num_integrals == 0)
return
2240 do ido = 1, num_integrals
2243 integral = master_prototype % get_integral_label(ido)
2244 call unpack8ints(integral, lwd)
2246 integral_coeff = 1.0_wp
2251 if (lwd(i) == continuum_orbital) lw = i
2255 integral_coeff = this % evaluate_integrals_singular(integral, 1.0_wp,
normal_phase)
2256 do n1 = 1, num_targets_1
2257 mat_coeffs(n1) = mat_coeffs(n1) + master_prototype % get_coefficient(ido, n1, 1) * integral_coeff
2261 lwd(lw) = continuum_orbital + j1 - 1
2264 call pack8ints(lwd(1), lwd(2), lwd(3), lwd(4), lwd(5), 0, 0, 0, integral)
2266 integral_coeff = this % evaluate_integrals_singular(integral, 1.0_wp,
normal_phase)
2268 do n1 = 1, num_targets_1
2269 mat_coeffs(n1) = mat_coeffs(n1) + master_prototype % get_coefficient(ido, n1, 1) * integral_coeff
2292 integer,
intent(in) :: continuum_orbital_a, continuum_orbital_b, ja, jb
2293 real(wp),
intent(out) :: mat_coeffs(:)
2295 integer(longint) :: integral(2)
2296 real(wp) :: integral_coeff
2297 integer :: lwd(8), lwa, lwb, ido, i, prototypes, num_prototypes, num_integrals
2299 num_prototypes =
size(master_prototype)
2300 num_integrals = master_prototype(1) % get_size()
2303 if (num_integrals == 0)
return
2305 do ido = 1, num_integrals
2308 call master_prototype(1) % get_coeff_and_integral(ido, integral_coeff, integral)
2309 call unpack8ints(integral, lwd)
2311 integral_coeff = 1.0_wp
2317 if (lwd(i) == continuum_orbital_a) lwa = i
2318 if (lwd(i) == continuum_orbital_b) lwb = i
2322 if (max(lwa, lwb) == 0)
then
2323 integral_coeff = this % evaluate_integrals_singular(integral, 1.0_wp,
normal_phase)
2325 do prototypes = 1,num_prototypes
2326 mat_coeffs(prototypes) = mat_coeffs(prototypes) &
2327 + master_prototype(prototypes) % get_coefficient(ido) * integral_coeff
2331 else if (lwb == 0)
then
2332 lwd(lwa) = continuum_orbital_a + ja - 1
2333 else if (lwa == 0)
then
2334 lwd(lwb) = continuum_orbital_b + jb - 2
2336 lwd(lwa) = continuum_orbital_a + ja - 1
2337 lwd(lwb) = continuum_orbital_b + jb - 2
2340 call pack8ints(lwd(1), lwd(2), lwd(3), lwd(4), lwd(5), 0, 0, 0, integral)
2342 integral_coeff = this % evaluate_integrals_singular(integral, 1.0_wp,
normal_phase)
2344 do prototypes = 1,num_prototypes
2345 mat_coeffs(prototypes) = mat_coeffs(prototypes) + master_prototype(prototypes)%get_coefficient(ido) * integral_coeff
2368 integer,
intent(in) :: continuum_orbital_a, continuum_orbital_b, ja, jb
2369 real(wp),
intent(out) :: mat_coeffs(:,:)
2371 integer(longint) :: integral(2)
2372 real(wp) :: integral_coeff
2374 integer :: lwd(8), lwa, lwb, ido, i, prototypes, num_prototypes, num_integrals, num_targets_1, num_targets_2, n1, n2
2377 num_integrals = master_prototype % get_size()
2378 num_targets_1 = master_prototype % get_num_targets_sym1()
2379 num_targets_2 = master_prototype % get_num_targets_sym2()
2382 if (num_integrals == 0)
return
2384 do ido = 1, num_integrals
2387 integral = master_prototype % get_integral_label(ido)
2388 call unpack8ints(integral, lwd)
2390 integral_coeff = 1.0_wp
2396 if (lwd(i) == continuum_orbital_a) lwa = i
2397 if (lwd(i) == continuum_orbital_b) lwb = i
2401 if (max(lwa, lwb) == 0)
then
2402 integral_coeff = this % evaluate_integrals_singular(integral, 1.0_wp,
normal_phase)
2404 do n1 = 1, num_targets_1
2405 do n2 = 1, num_targets_2
2406 mat_coeffs(n1,n2) = mat_coeffs(n1,n2) + master_prototype % get_coefficient(ido, n1, n2) * integral_coeff
2411 else if (lwb == 0)
then
2412 lwd(lwa) = continuum_orbital_a + ja - 1
2413 else if (lwa == 0)
then
2414 lwd(lwb) = continuum_orbital_b + jb - 2
2416 lwd(lwa) = continuum_orbital_a + ja - 1
2417 lwd(lwb) = continuum_orbital_b + jb - 2
2420 call pack8ints(lwd(1), lwd(2), lwd(3), lwd(4), lwd(5), 0, 0, 0, integral)
2422 integral_coeff = this % evaluate_integrals_singular(integral, 1.0_wp,
normal_phase)
2424 do n1 = 1, num_targets_1
2425 do n2 = 1, num_targets_2
2426 mat_coeffs(n1,n2) = mat_coeffs(n1,n2) + master_prototype % get_coefficient(ido, n1, n2) * integral_coeff
2450 integer,
intent(in) :: continuum_orbital_a, continuum_orbital_b, ja, jb
2451 real(wp),
intent(out) :: mat_coeffs(:,:)
2453 integer(longint) :: integral(2)
2454 real(wp) :: integral_coeff
2455 integer :: lwd(8), lwa, lwb, ido, i, n1, n2, num_targets_1, num_targets_2, ii, num_integrals
2457 num_targets_1 = master_prototype % get_num_targets_sym1()
2458 num_targets_2 = master_prototype % get_num_targets_sym2()
2459 num_integrals = master_prototype % get_size()
2462 if (num_integrals == 0)
return
2464 do ido = 1, num_integrals
2467 integral = master_prototype % get_integral_label(ido)
2468 call unpack8ints(integral, lwd)
2470 integral_coeff = 1.0_wp
2476 if (lwd(i) == continuum_orbital_a) lwa = i
2477 if (lwd(i) == continuum_orbital_b) lwb = i
2481 if (max(lwa, lwb) == 0)
then
2482 integral_coeff = this % evaluate_integrals_singular(integral, 1.0_wp,
normal_phase)
2483 do n1 = 1,num_targets_1
2484 do n2 = 1,num_targets_2
2485 mat_coeffs(n1,n2) = mat_coeffs(n1,n2) + master_prototype % get_coefficient(ido, n1, n2) * integral_coeff
2489 else if(lwb == 0)
then
2490 lwd(lwa) = continuum_orbital_a + ja - 1
2491 else if (lwa == 0)
then
2492 lwd(lwb) = continuum_orbital_b + jb - 1
2494 lwd(lwa) = continuum_orbital_a + ja - 1
2495 lwd(lwb) = continuum_orbital_b + jb - 1
2498 call pack8ints(lwd(1), lwd(2), lwd(3), lwd(4), lwd(5), 0, 0, 0, integral)
2500 integral_coeff = this % evaluate_integrals_singular(integral, 1.0_wp,
normal_phase)
2502 do n1 = 1, num_targets_1
2503 do n2 = 1, num_targets_2
2504 mat_coeffs(n1,n2) = mat_coeffs(n1,n2) + master_prototype % get_coefficient(ido, n1, n2) * integral_coeff
2526 integer :: num_prototypes, ido
2528 num_prototypes =
size(prototypes)
2530 if (num_prototypes <= 1)
return
2532 do ido = 2, num_prototypes
2533 call prototypes(1) % add_symbols(prototypes(ido))
2550 integer,
intent(in) :: symmetry
2555 do ido = 2, symmetry
2585 integer,
intent(in) :: i1, ido, num_targets
2586 class(symbolicelementvector),
intent(in) :: temp_prototype, master_prototypes(num_targets * (num_targets + 1) / 2)
2588 integer(longint),
dimension(2) :: label
2590 integer :: found_idx, ii, n1, n2, num_symbols, jdo
2591 real(wp) :: alpha(num_targets * (num_targets + 1) / 2), coeff
2596 do n1 = 1, num_targets
2597 do n2 = n1, num_targets
2599 alpha(ii) = this % get_target_coeff(i1, ido, n1) * this % get_target_coeff(i1, ido, n2)
2605 num_symbols = temp_prototype % get_size()
2607 do jdo = 1, num_symbols
2608 call temp_prototype % get_coeff_and_integral(jdo, coeff, label)
2610 if (master_prototypes(1) % check_same_integral(label, found_idx))
then
2613 do n1 = 1, num_targets
2614 do n2 = n1, num_targets
2615 call master_prototypes(ii) % modify_coeff(found_idx, alpha(ii) * coeff)
2622 do n1 = 1, num_targets
2623 do n2 = n1, num_targets
2625 call master_prototypes(ii) % insert_symbol(label, alpha(ii) * coeff, .false.)
2637 integer,
intent(in) :: i1, s1, s2, num_targets
2638 class(symbolicelementvector),
intent(in) :: temp_prototype, master_prototypes(num_targets * (num_targets + 1) / 2)
2640 integer(longint),
dimension(2) :: label
2642 integer :: found_idx, ii, n1, n2, num_symbols, jdo
2643 real(wp) :: alpha(num_targets * (num_targets + 1) / 2), coeff
2648 do n1 = 1, num_targets
2649 do n2 = n1, num_targets
2651 alpha(ii) = this % get_target_coeff(i1, s1, n1) * this % get_target_coeff(i1, s2, n2) &
2652 + this % get_target_coeff(i1, s2, n1) * this % get_target_coeff(i1, s1, n2)
2658 num_symbols = temp_prototype % get_size()
2660 do jdo = 1, num_symbols
2661 call temp_prototype % get_coeff_and_integral(jdo, coeff, label)
2663 if (master_prototypes(1) % check_same_integral(label, found_idx))
then
2666 do n1 = 1, num_targets
2667 do n2 = n1, num_targets
2668 call master_prototypes(ii) % modify_coeff(found_idx, alpha(ii) * coeff)
2675 do n1 = 1, num_targets
2676 do n2 = n1, num_targets
2678 call master_prototypes(ii) % insert_symbol(label, alpha(ii) * coeff, .false.)
2690 integer,
intent(in) :: i1, i2, s1, s2, num_targets1, num_targets2
2691 class(symbolicelementvector),
intent(in) :: temp_prototype, master_prototypes(num_targets1, num_targets2)
2693 integer(longint),
dimension(2) :: label
2695 integer :: found_idx, ii, n1, n2, num_symbols, jdo
2696 real(wp) :: alpha(num_targets1, num_targets2), coeff
2700 do n1 = 1, num_targets1
2701 do n2 = 1, num_targets2
2703 alpha(n1,n2) = this % get_target_coeff(i1, s1, n1) * this % get_target_coeff(i2, s2, n2)
2708 num_symbols = temp_prototype % get_size()
2710 do jdo = 1, num_symbols
2711 call temp_prototype % get_coeff_and_integral(jdo, coeff, label)
2713 if (master_prototypes(1,1) % check_same_integral(label, found_idx))
then
2715 do n1 = 1, num_targets1
2716 do n2 = 1, num_targets2
2717 call master_prototypes(n1,n2) % modify_coeff(found_idx, alpha(n1,n2) * coeff)
2722 do n1 = 1, num_targets1
2723 do n2 = 1, num_targets2
2725 call master_prototypes(n1,n2) % insert_symbol(label, alpha(n1,n2) * coeff, .false.)