43 dbt_create, dbt_default_distvec, dbt_destroy, dbt_distribution_destroy, &
44 dbt_distribution_new, dbt_distribution_type, dbt_mp_dims_create, dbt_pgrid_create, &
45 dbt_pgrid_destroy, dbt_pgrid_type, dbt_type
90#include "./base/base_uses.f90"
112#define CACHE_SIZE 1024
113#define BITS_MAX_VAL 6
115 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'hfx_types'
120 REAL(kind=
dp),
DIMENSION(0:10), &
121 PARAMETER,
PUBLIC ::
mul_fact = (/1.0_dp, &
140 REAL(
dp) :: omega = 0.0_dp
141 REAL(
dp) :: scale_coulomb = 0.0_dp
142 REAL(
dp) :: scale_longrange = 0.0_dp
143 REAL(
dp) :: scale_gaussian = 0.0_dp
144 REAL(
dp) :: cutoff_radius = 0.0_dp
145 CHARACTER(default_path_length) :: filename =
""
150 REAL(
dp) :: eps_schwarz = 0.0_dp
151 REAL(
dp) :: eps_schwarz_forces = 0.0_dp
152 LOGICAL :: do_p_screening_forces = .false.
153 LOGICAL :: do_initial_p_screening = .false.
158 INTEGER :: max_memory = 0
159 INTEGER(int_8) :: max_compression_counter = 0_int_8
160 INTEGER(int_8) :: final_comp_counter_energy = 0_int_8
161 LOGICAL :: do_all_on_the_fly = .false.
162 REAL(
dp) :: eps_storage_scaling = 0.0_dp
163 INTEGER :: cache_size = 0
164 INTEGER :: bits_max_val = 0
165 INTEGER :: actual_memory_usage = 0
166 INTEGER :: actual_memory_usage_disk = 0
167 INTEGER(int_8) :: max_compression_counter_disk = 0_int_8
168 LOGICAL :: do_disk_storage = .false.
169 CHARACTER(len=default_path_length) :: storage_location =
""
170 INTEGER(int_8) :: ram_counter = 0_int_8
171 INTEGER(int_8) :: ram_counter_forces = 0_int_8
172 INTEGER(int_8) :: size_p_screen = 0_int_8
173 LOGICAL :: treat_forces_in_core = .false.
174 LOGICAL :: recalc_forces = .false.
178 TYPE hfx_periodic_type
179 INTEGER :: number_of_shells = -1
180 LOGICAL :: do_periodic = .false.
181 INTEGER :: perd(3) = -1
183 REAL(
dp) :: r_max_stress = 0.0_dp
184 INTEGER :: number_of_shells_from_input = 0
190 INTEGER :: block_size = 0
191 INTEGER :: nblocks = 0
192 LOGICAL :: rtp_redistribute = .false.
193 LOGICAL :: blocks_initialized = .false.
194 LOGICAL :: do_randomize = .false.
199 REAL(
dp) :: fraction = 0.0_dp
200 LOGICAL :: treat_lsd_in_core = .false.
205 REAL(
dp) :: cell(3) = 0.0_dp
206 REAL(
dp) :: cell_r(3) = 0.0_dp
211 INTEGER(int_8) :: istart = 0_int_8
212 INTEGER(int_8) :: number_of_atom_quartets = 0_int_8
213 INTEGER(int_8) :: cost = 0_int_8
214 REAL(kind=
dp) :: time_first_scf = 0.0_dp
215 REAL(kind=
dp) :: time_other_scf = 0.0_dp
216 REAL(kind=
dp) :: time_forces = 0.0_dp
217 INTEGER(int_8) :: ram_counter = 0_int_8
222 INTEGER,
DIMENSION(2) :: pair = 0
223 INTEGER,
DIMENSION(2) :: set_bounds = 0
224 INTEGER,
DIMENSION(2) :: kind_pair = 0
225 REAL(kind=
dp) :: r1(3) = 0.0_dp, r2(3) = 0.0_dp
226 REAL(kind=
dp) :: dist2 = 0.0_dp
231 INTEGER,
DIMENSION(2) :: pair = 0
237 INTEGER :: n_element = 0
242 INTEGER(int_8),
DIMENSION(CACHE_SIZE) :: data = 0_int_8
243 INTEGER :: element_counter = 0
247 TYPE hfx_container_node
248 TYPE(hfx_container_node),
POINTER :: next => null(), prev => null()
249 INTEGER(int_8),
DIMENSION(CACHE_SIZE) :: data = 0_int_8
254 TYPE(hfx_container_node),
POINTER :: first => null(), current => null()
255 INTEGER :: element_counter = 0
256 INTEGER(int_8) :: file_counter = 0
257 CHARACTER(LEN=5) :: desc =
""
259 CHARACTER(default_path_length) :: filename =
""
264 INTEGER,
DIMENSION(:),
POINTER :: lmax => null()
265 INTEGER,
DIMENSION(:),
POINTER :: lmin => null()
266 INTEGER,
DIMENSION(:),
POINTER :: npgf => null()
268 REAL(
dp),
DIMENSION(:, :),
POINTER :: zet => null()
269 INTEGER,
DIMENSION(:),
POINTER :: nsgf => null()
270 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgf => null()
271 REAL(
dp),
DIMENSION(:, :),
POINTER :: sphi => null()
272 INTEGER :: nsgf_total = 0
273 INTEGER,
DIMENSION(:, :),
POINTER :: nl => null()
274 INTEGER,
DIMENSION(:, :),
POINTER :: nsgfl => null()
275 INTEGER,
DIMENSION(:),
POINTER :: nshell => null()
276 REAL(
dp),
DIMENSION(:, :, :, :),
POINTER &
277 :: sphi_ext => null()
278 REAL(
dp),
DIMENSION(:),
POINTER :: set_radius => null()
279 REAL(
dp),
DIMENSION(:, :),
POINTER :: pgf_radius => null()
280 REAL(
dp) :: kind_radius = 0.0_dp
285 INTEGER :: max_set = 0
286 INTEGER :: max_sgf = 0
287 INTEGER :: max_am = 0
292 REAL(
dp) :: x(2) = 0.0_dp
297 REAL(
dp),
DIMENSION(:, :, :, :),
POINTER :: p_kind => null()
302 INTEGER,
DIMENSION(:),
POINTER :: iatom_list => null()
303 INTEGER,
DIMENSION(:),
POINTER :: jatom_list => null()
308 REAL(
dp) :: ra(3) = 0.0_dp, rb(3) = 0.0_dp
309 REAL(
dp) :: rab2 = 0.0_dp
310 REAL(
dp) :: s1234 = 0.0_dp
311 REAL(
dp) :: p(3) = 0.0_dp
312 REAL(
dp) :: r = 0.0_dp
313 REAL(
dp) :: pgf_max = 0.0_dp
314 REAL(
dp),
DIMENSION(3) :: bcell = 0.0_dp
319 TYPE(hfx_pgf_image),
DIMENSION(:),
POINTER &
320 :: image_list => null()
321 INTEGER :: nimages = 0
322 REAL(
dp) :: zetapzetb = 0.0_dp
323 REAL(
dp) :: zetainv = 0.0_dp
324 REAL(
dp) :: zeta = 0.0_dp, zetb = 0.0_dp
325 INTEGER :: ipgf = 0, jpgf = 0
330 REAL(
dp) :: ra(3) = 0.0_dp, rb(3) = 0.0_dp, rc(3) = 0.0_dp, rd(3) = 0.0_dp
331 REAL(
dp) :: zetapetainv = 0.0_dp
332 REAL(
dp) :: rho = 0.0_dp, rhoinv = 0.0_dp
333 REAL(
dp) :: p(3) = 0.0_dp, q(3) = 0.0_dp, w(3) = 0.0_dp
334 REAL(
dp) :: ab(3) = 0.0_dp, cd(3) = 0.0_dp
340 INTEGER :: istart = 0, iend = 0
341 INTEGER(int_8) :: cost = 0_int_8
346 INTEGER :: thread_id = 0
347 INTEGER :: bin_id = 0
348 INTEGER(int_8) :: cost = 0_int_8
353 POINTER :: maxval_container => null()
355 POINTER :: maxval_cache => null()
357 POINTER :: integral_containers => null()
359 POINTER :: integral_caches => null()
364 DIMENSION(:) :: integral_containers_disk => null()
368 INTEGER,
DIMENSION(:, :),
ALLOCATABLE :: ind
373 REAL(kind=
dp) :: filter_eps = 0.0_dp, filter_eps_2c = 0.0_dp, filter_eps_storage = 0.0_dp, filter_eps_mo = 0.0_dp, &
374 eps_lanczos = 0.0_dp, eps_pgf_orb = 0.0_dp, eps_eigval = 0.0_dp, kp_ri_range = 0.0_dp, &
375 kp_image_range = 0.0_dp, kp_bump_rad = 0.0_dp
376 INTEGER :: t2c_sqrt_order = 0, max_iter_lanczos = 0, flavor = 0, unit_nr_dbcsr = -1, unit_nr = -1, &
377 min_bsize = 0, max_bsize_mo = 0, t2c_method = 0, nelectron_total = 0, input_flavor = 0, &
378 ncell_ri = 0, nimg = 0, kp_stack_size = 0, nimg_nze = 0
379 LOGICAL :: check_2c_inv = .false., calc_condnum = .false.
385 REAL(kind=
dp) :: eps_schwarz = 0.0_dp
386 REAL(kind=
dp) :: eps_schwarz_forces = 0.0_dp
388 LOGICAL :: same_op = .false.
391 TYPE(dbt_pgrid_type),
POINTER :: pgrid => null()
392 TYPE(dbt_pgrid_type),
POINTER :: pgrid_2d => null()
396 TYPE(dbt_distribution_type) :: dist
399 INTEGER,
DIMENSION(:),
ALLOCATABLE :: bsizes_ri, bsizes_ao, bsizes_ri_split, bsizes_ao_split, &
400 bsizes_ri_fit, bsizes_ao_fit
403 INTEGER,
DIMENSION(:),
ALLOCATABLE :: img_to_ri_cell, present_images, idx_to_img, img_to_idx, &
407 REAL(
dp),
DIMENSION(:, :, :),
ALLOCATABLE :: kp_cost
413 TYPE(dbt_type),
DIMENSION(:),
ALLOCATABLE :: kp_t_3c_int
419 TYPE(dbt_type),
DIMENSION(:, :),
ALLOCATABLE :: rho_ao_t, ks_t
422 TYPE(dbt_type),
DIMENSION(:, :),
ALLOCATABLE :: t_2c_inv
423 TYPE(dbt_type),
DIMENSION(:, :),
ALLOCATABLE :: t_2c_pot
426 TYPE(
dbcsr_type),
DIMENSION(:, :),
ALLOCATABLE :: kp_mat_2c_pot
429 TYPE(dbt_type),
DIMENSION(:, :),
ALLOCATABLE :: t_2c_int
432 TYPE(dbt_type),
DIMENSION(:, :),
ALLOCATABLE :: t_3c_int_ctr_1
434 TYPE(dbt_pgrid_type),
POINTER :: pgrid_1 => null()
437 TYPE(dbt_type),
DIMENSION(:, :),
ALLOCATABLE :: t_3c_int_ctr_2
438 TYPE(dbt_pgrid_type),
POINTER :: pgrid_2 => null()
441 TYPE(dbt_type),
DIMENSION(:, :),
ALLOCATABLE :: t_3c_int_ctr_3
444 TYPE(dbt_type),
DIMENSION(:, :, :),
ALLOCATABLE :: t_3c_int_mo
445 TYPE(dbt_type),
DIMENSION(:, :, :),
ALLOCATABLE :: t_3c_ctr_ri
446 TYPE(dbt_type),
DIMENSION(:, :, :),
ALLOCATABLE :: t_3c_ctr_ks
447 TYPE(dbt_type),
DIMENSION(:, :, :),
ALLOCATABLE :: t_3c_ctr_ks_copy
455 CHARACTER(len=default_string_length) :: orb_basis_type =
"", ri_basis_type =
""
458 INTEGER :: n_mem_input = 0, n_mem = 0, n_mem_ri = 0, n_mem_flavor_switch = 0
461 INTEGER,
DIMENSION(:),
ALLOCATABLE :: starts_array_mem_block, ends_array_mem_block
462 INTEGER,
DIMENSION(:),
ALLOCATABLE :: starts_array_mem, ends_array_mem
464 INTEGER,
DIMENSION(:),
ALLOCATABLE :: starts_array_ri_mem_block, ends_array_ri_mem_block
465 INTEGER,
DIMENSION(:),
ALLOCATABLE :: starts_array_ri_mem, ends_array_ri_mem
467 INTEGER(int_8) :: dbcsr_nflop = 0_int_8
468 REAL(
dp) :: dbcsr_time = 0.0_dp
469 INTEGER :: num_pe = 0
513 TYPE(hfx_periodic_type) :: periodic_parameter = hfx_periodic_type()
521 POINTER :: neighbor_cells => null()
523 POINTER :: distribution_energy => null()
525 POINTER :: distribution_forces => null()
526 INTEGER,
DIMENSION(:, :),
POINTER :: is_assoc_atomic_block => null()
527 INTEGER :: number_of_p_entries = 0
529 POINTER :: basis_parameter => null()
530 INTEGER :: n_rep_hf = 0
531 LOGICAL :: b_first_load_balance_energy = .false., &
532 b_first_load_balance_forces = .false.
533 REAL(
dp),
DIMENSION(:, :),
POINTER :: full_ks_alpha => null()
534 REAL(
dp),
DIMENSION(:, :),
POINTER :: full_ks_beta => null()
538 DIMENSION(:, :, :, :, :, :),
POINTER :: screen_funct_coeffs_pgf => null(), &
539 pair_dist_radii_pgf => null()
541 DIMENSION(:, :, :, :),
POINTER :: screen_funct_coeffs_set => null()
543 DIMENSION(:, :),
POINTER :: screen_funct_coeffs_kind => null()
544 LOGICAL :: screen_funct_is_initialized = .false.
545 TYPE(
hfx_p_kind),
DIMENSION(:),
POINTER :: initial_p => null()
546 TYPE(
hfx_p_kind),
DIMENSION(:),
POINTER :: initial_p_forces => null()
547 INTEGER,
DIMENSION(:),
POINTER :: map_atom_to_kind_atom => null()
548 TYPE(
hfx_2d_map),
DIMENSION(:),
POINTER :: map_atoms_to_cpus => null()
549 INTEGER,
DIMENSION(:, :),
POINTER :: atomic_block_offset => null()
550 INTEGER,
DIMENSION(:, :, :, :),
POINTER :: set_offset => null()
551 INTEGER,
DIMENSION(:),
POINTER :: block_offset => null()
553 POINTER :: blocks => null()
555 POINTER :: task_list => null()
556 REAL(
dp),
DIMENSION(:, :),
POINTER :: pmax_atom => null(), pmax_atom_forces => null()
558 REAL(
dp),
DIMENSION(:, :),
POINTER :: pmax_block => null()
559 LOGICAL,
DIMENSION(:, :),
POINTER :: atomic_pair_list => null()
560 LOGICAL,
DIMENSION(:, :),
POINTER :: atomic_pair_list_forces => null()
561 LOGICAL :: do_hfx_ri = .false.
591 SUBROUTINE hfx_create(x_data, para_env, hfx_section, atomic_kind_set, qs_kind_set, &
592 particle_set, dft_control, cell, orb_basis, ri_basis, &
593 nelectron_total, nkp_grid)
594 TYPE(
hfx_type),
DIMENSION(:, :),
POINTER :: x_data
598 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
602 CHARACTER(LEN=*),
OPTIONAL :: orb_basis, ri_basis
603 INTEGER,
OPTIONAL :: nelectron_total
604 INTEGER,
DIMENSION(3),
OPTIONAL :: nkp_grid
606 CHARACTER(LEN=*),
PARAMETER :: routinen =
'hfx_create'
608 CHARACTER(LEN=512) :: error_msg
609 CHARACTER(LEN=default_path_length) :: char_val
610 CHARACTER(LEN=default_string_length) :: orb_basis_type, ri_basis_type
611 INTEGER :: handle, i, i_thread, iatom, ikind, int_val, irep, jkind, max_set, n_rep_hf, &
612 n_threads, natom, natom_a, natom_b, nkind, nseta, nsetb, pbc_shells, storage_id
613 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: atom2kind, kind_of
614 LOGICAL :: do_ri, explicit, logic_val
616 TYPE(
hfx_type),
POINTER :: actual_x_data
620 CALL timeset(routinen, handle)
625 natom =
SIZE(particle_set)
633 IF (do_ri) n_threads = 1
635 IF (
PRESENT(orb_basis))
THEN
636 orb_basis_type = orb_basis
638 orb_basis_type =
"ORB"
640 IF (
PRESENT(ri_basis))
THEN
641 ri_basis_type = ri_basis
643 ri_basis_type =
"RI_HFX"
646 ALLOCATE (x_data(n_rep_hf, n_threads))
647 DO i_thread = 1, n_threads
648 DO irep = 1, n_rep_hf
649 actual_x_data => x_data(irep, i_thread)
654 actual_x_data%general_parameter%fraction = real_val
655 actual_x_data%n_rep_hf = n_rep_hf
657 NULLIFY (actual_x_data%map_atoms_to_cpus)
659 CALL section_vals_val_get(hfx_section,
"TREAT_LSD_IN_CORE", l_val=logic_val, i_rep_section=irep)
660 actual_x_data%general_parameter%treat_lsd_in_core = logic_val
663 CALL section_vals_val_get(hfx_ri_section,
"_SECTION_PARAMETERS_", l_val=actual_x_data%do_hfx_ri)
667 CALL parse_memory_section(actual_x_data%memory_parameter, hf_sub_section, storage_id, i_thread, &
668 n_threads, para_env, irep, skip_disk=.false., skip_in_core_forces=.false.)
673 actual_x_data%periodic_parameter%number_of_shells = int_val
674 actual_x_data%periodic_parameter%mode = int_val
675 CALL get_cell(cell=cell, periodic=actual_x_data%periodic_parameter%perd)
676 IF (sum(actual_x_data%periodic_parameter%perd) == 0)
THEN
677 actual_x_data%periodic_parameter%do_periodic = .false.
679 actual_x_data%periodic_parameter%do_periodic = .true.
685 actual_x_data%screening_parameter%eps_schwarz = real_val
686 CALL section_vals_val_get(hf_sub_section,
"EPS_SCHWARZ_FORCES", r_val=real_val, explicit=explicit)
688 actual_x_data%screening_parameter%eps_schwarz_forces = real_val
690 actual_x_data%screening_parameter%eps_schwarz_forces = &
691 100._dp*actual_x_data%screening_parameter%eps_schwarz
694 actual_x_data%screening_parameter%do_p_screening_forces = logic_val
696 actual_x_data%screening_parameter%do_initial_p_screening = logic_val
697 actual_x_data%screen_funct_is_initialized = .false.
702 actual_x_data%potential_parameter%potential_type = int_val
704 actual_x_data%potential_parameter%omega = real_val
706 actual_x_data%potential_parameter%scale_coulomb = real_val
708 actual_x_data%potential_parameter%scale_longrange = real_val
710 actual_x_data%potential_parameter%scale_gaussian = real_val
714 actual_x_data%potential_parameter%cutoff_radius = real_val
719 WRITE (error_msg,
'(A,A,A)')
"Truncated hfx calculation requested. The file containing "// &
720 "the data could not be found at ", trim(char_val),
" Please check T_C_G_DATA "// &
721 "in the INTERACTION_POTENTIAL section"
724 actual_x_data%potential_parameter%filename = char_val
728 CALL erfc_cutoff(actual_x_data%screening_parameter%eps_schwarz, &
729 actual_x_data%potential_parameter%omega, &
730 actual_x_data%potential_parameter%cutoff_radius)
732 IF (actual_x_data%potential_parameter%potential_type ==
do_potential_id)
THEN
733 actual_x_data%potential_parameter%cutoff_radius = 0.0_dp
739 actual_x_data%load_balance_parameter%nbins = max(1, int_val)
740 actual_x_data%load_balance_parameter%blocks_initialized = .false.
743 actual_x_data%load_balance_parameter%do_randomize = logic_val
745 actual_x_data%load_balance_parameter%rtp_redistribute = .false.
746 IF (
ASSOCIATED(dft_control%rtp_control)) &
747 actual_x_data%load_balance_parameter%rtp_redistribute = dft_control%rtp_control%hfx_redistribute
751 IF (int_val <= 0)
THEN
753 int_val = ceiling(0.1_dp*natom/ &
754 REAL(actual_x_data%load_balance_parameter%nbins*n_threads*para_env%num_pe, kind=
dp)**(0.25_dp))
757 actual_x_data%load_balance_parameter%block_size = min(
max_atom_block, max(1, int_val))
859 IF (actual_x_data%periodic_parameter%do_periodic)
THEN
862 actual_x_data%periodic_parameter%number_of_shells_from_input = pbc_shells
863 ALLOCATE (actual_x_data%neighbor_cells(1))
866 ALLOCATE (actual_x_data%neighbor_cells(1))
868 actual_x_data%periodic_parameter%R_max_stress = 1.0_dp
871 nkind =
SIZE(qs_kind_set, 1)
872 max_set = actual_x_data%basis_info%max_set
875 IF (i_thread == 1)
THEN
876 ALLOCATE (actual_x_data%is_assoc_atomic_block(natom, natom))
877 ALLOCATE (actual_x_data%atomic_block_offset(natom, natom))
878 ALLOCATE (actual_x_data%set_offset(max_set, max_set, nkind, nkind))
879 ALLOCATE (actual_x_data%block_offset(para_env%num_pe + 1))
882 ALLOCATE (actual_x_data%distribution_forces(1))
883 ALLOCATE (actual_x_data%distribution_energy(1))
885 actual_x_data%memory_parameter%size_p_screen = 0_int_8
886 IF (i_thread == 1)
THEN
887 ALLOCATE (actual_x_data%atomic_pair_list(natom, natom))
888 ALLOCATE (actual_x_data%atomic_pair_list_forces(natom, natom))
891 IF (actual_x_data%screening_parameter%do_initial_p_screening .OR. &
892 actual_x_data%screening_parameter%do_p_screening_forces)
THEN
894 IF (i_thread == 1)
THEN
895 ALLOCATE (actual_x_data%pmax_atom(natom, natom))
896 ALLOCATE (actual_x_data%initial_p(nkind*(nkind + 1)/2))
900 nseta = actual_x_data%basis_parameter(ikind)%nset
901 DO jkind = ikind, nkind
903 nsetb = actual_x_data%basis_parameter(jkind)%nset
904 ALLOCATE (actual_x_data%initial_p(i)%p_kind(nseta, nsetb, natom_a, natom_b))
905 actual_x_data%memory_parameter%size_p_screen = &
906 actual_x_data%memory_parameter%size_p_screen + nseta*nsetb*natom_a*natom_b
911 ALLOCATE (actual_x_data%pmax_atom_forces(natom, natom))
912 ALLOCATE (actual_x_data%initial_p_forces(nkind*(nkind + 1)/2))
916 nseta = actual_x_data%basis_parameter(ikind)%nset
917 DO jkind = ikind, nkind
919 nsetb = actual_x_data%basis_parameter(jkind)%nset
920 ALLOCATE (actual_x_data%initial_p_forces(i)%p_kind(nseta, nsetb, natom_a, natom_b))
921 actual_x_data%memory_parameter%size_p_screen = &
922 actual_x_data%memory_parameter%size_p_screen + nseta*nsetb*natom_a*natom_b
927 ALLOCATE (actual_x_data%map_atom_to_kind_atom(natom))
930 ALLOCATE (atom2kind(nkind))
933 ikind = kind_of(iatom)
934 atom2kind(ikind) = atom2kind(ikind) + 1
935 actual_x_data%map_atom_to_kind_atom(iatom) = atom2kind(ikind)
937 DEALLOCATE (kind_of, atom2kind)
950 actual_x_data%store_ints%maxval_cache_disk%element_counter = 1
951 ALLOCATE (actual_x_data%store_ints%maxval_container_disk)
952 ALLOCATE (actual_x_data%store_ints%maxval_container_disk%first)
953 actual_x_data%store_ints%maxval_container_disk%first%prev => null()
954 actual_x_data%store_ints%maxval_container_disk%first%next => null()
955 actual_x_data%store_ints%maxval_container_disk%current => actual_x_data%store_ints%maxval_container_disk%first
956 actual_x_data%store_ints%maxval_container_disk%current%data = 0
957 actual_x_data%store_ints%maxval_container_disk%element_counter = 1
958 actual_x_data%store_ints%maxval_container_disk%file_counter = 1
959 actual_x_data%store_ints%maxval_container_disk%desc =
'Max_'
960 actual_x_data%store_ints%maxval_container_disk%unit = -1
961 WRITE (actual_x_data%store_ints%maxval_container_disk%filename,
'(A,I0,A,A,A)') &
962 trim(actual_x_data%memory_parameter%storage_location), &
963 storage_id,
"_", actual_x_data%store_ints%maxval_container_disk%desc,
"6"
964 CALL compress(actual_x_data%store_ints%maxval_container_disk%filename, .true.)
965 ALLOCATE (actual_x_data%store_ints%integral_containers_disk(64))
967 actual_x_data%store_ints%integral_caches_disk(i)%element_counter = 1
968 actual_x_data%store_ints%integral_caches_disk(i)%data = 0
969 ALLOCATE (actual_x_data%store_ints%integral_containers_disk(i)%first)
970 actual_x_data%store_ints%integral_containers_disk(i)%first%prev => null()
971 actual_x_data%store_ints%integral_containers_disk(i)%first%next => null()
972 actual_x_data%store_ints%integral_containers_disk(i)%current => &
973 actual_x_data%store_ints%integral_containers_disk(i)%first
974 actual_x_data%store_ints%integral_containers_disk(i)%current%data = 0
975 actual_x_data%store_ints%integral_containers_disk(i)%element_counter = 1
976 actual_x_data%store_ints%integral_containers_disk(i)%file_counter = 1
977 actual_x_data%store_ints%integral_containers_disk(i)%desc =
'Int_'
978 actual_x_data%store_ints%integral_containers_disk(i)%unit = -1
979 WRITE (actual_x_data%store_ints%integral_containers_disk(i)%filename,
'(A,I0,A,A,I0)') &
980 trim(actual_x_data%memory_parameter%storage_location), &
981 storage_id,
"_", actual_x_data%store_ints%integral_containers_disk(i)%desc, i
982 CALL compress(actual_x_data%store_ints%integral_containers_disk(i)%filename, .true.)
985 actual_x_data%b_first_load_balance_energy = .true.
986 actual_x_data%b_first_load_balance_forces = .true.
989 IF (actual_x_data%do_hfx_ri)
THEN
990 cpassert(
PRESENT(nelectron_total))
991 ALLOCATE (actual_x_data%ri_data)
992 CALL hfx_ri_init_read_input_from_hfx(actual_x_data%ri_data, actual_x_data, hfx_section, &
993 hf_sub_section, qs_kind_set, &
994 particle_set, atomic_kind_set, dft_control, para_env, irep, &
995 nelectron_total, orb_basis_type, ri_basis_type)
1000 DO irep = 1, n_rep_hf
1001 actual_x_data => x_data(irep, 1)
1002 CALL hfx_print_info(actual_x_data, hfx_section, irep)
1005 CALL timestop(handle)
1025 SUBROUTINE hfx_ri_init_read_input_from_hfx(ri_data, x_data, hfx_section, ri_section, qs_kind_set, &
1026 particle_set, atomic_kind_set, dft_control, para_env, irep, &
1027 nelectron_total, orb_basis_type, ri_basis_type)
1029 TYPE(
hfx_type),
INTENT(INOUT) :: x_data
1031 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1036 INTEGER,
INTENT(IN) :: irep, nelectron_total
1037 CHARACTER(LEN=*) :: orb_basis_type, ri_basis_type
1039 CHARACTER(LEN=*),
PARAMETER :: routinen =
'hfx_ri_init_read_input_from_hfx'
1041 CHARACTER(LEN=512) :: error_msg
1042 CHARACTER(LEN=default_path_length) :: char_val, t_c_filename
1043 INTEGER :: handle, unit_nr, unit_nr_dbcsr
1047 CALL timeset(routinen, handle)
1049 NULLIFY (hf_sub_section)
1051 associate(hfx_pot => ri_data%hfx_pot)
1052 hfx_pot%potential_type = x_data%potential_parameter%potential_type
1053 hfx_pot%omega = x_data%potential_parameter%omega
1054 hfx_pot%cutoff_radius = x_data%potential_parameter%cutoff_radius
1056 ri_data%ri_section => ri_section
1057 ri_data%hfx_section => hfx_section
1058 ri_data%eps_schwarz = x_data%screening_parameter%eps_schwarz
1059 ri_data%eps_schwarz_forces = x_data%screening_parameter%eps_schwarz_forces
1063 extension=
".dbcsrLog")
1066 extension=
".scfLog")
1073 WRITE (error_msg,
'(A,A,A)')
"File not found. Please check T_C_G_DATA "// &
1074 "in the INTERACTION_POTENTIAL section"
1077 t_c_filename = char_val
1080 CALL hfx_ri_init_read_input(ri_data, ri_section, qs_kind_set, particle_set, atomic_kind_set, &
1081 orb_basis_type, ri_basis_type, para_env, unit_nr, unit_nr_dbcsr, &
1082 nelectron_total, t_c_filename=t_c_filename)
1084 IF (dft_control%smear .AND. ri_data%flavor ==
ri_mo)
THEN
1085 cpabort(
"RI_FLAVOR MO is not consistent with smearing. Please use RI_FLAVOR RHO.")
1088 CALL timestop(handle)
1090 END SUBROUTINE hfx_ri_init_read_input_from_hfx
1107 SUBROUTINE hfx_ri_init_read_input(ri_data, ri_section, qs_kind_set, &
1108 particle_set, atomic_kind_set, orb_basis_type, ri_basis_type, para_env, &
1109 unit_nr, unit_nr_dbcsr, nelectron_total, t_c_filename)
1111 TYPE(section_vals_type),
POINTER :: ri_section
1112 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1113 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
1114 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
1115 CHARACTER(LEN=*),
INTENT(IN) :: orb_basis_type, ri_basis_type
1116 TYPE(mp_para_env_type) :: para_env
1117 INTEGER,
INTENT(IN) :: unit_nr, unit_nr_dbcsr, nelectron_total
1118 CHARACTER(len=*),
INTENT(IN),
OPTIONAL :: t_c_filename
1120 CHARACTER(LEN=*),
PARAMETER :: routinen =
'hfx_ri_init_read_input'
1124 REAL(dp) :: eps_storage_scaling
1126 CALL timeset(routinen, handle)
1128 CALL section_vals_val_get(ri_section,
"EPS_FILTER", r_val=ri_data%filter_eps)
1129 CALL section_vals_val_get(ri_section,
"EPS_FILTER_2C", r_val=ri_data%filter_eps_2c)
1130 CALL section_vals_val_get(ri_section,
"EPS_STORAGE_SCALING", r_val=eps_storage_scaling)
1131 ri_data%filter_eps_storage = ri_data%filter_eps*eps_storage_scaling
1132 CALL section_vals_val_get(ri_section,
"EPS_FILTER_MO", r_val=ri_data%filter_eps_mo)
1134 associate(ri_metric => ri_data%ri_metric, hfx_pot => ri_data%hfx_pot)
1135 CALL section_vals_val_get(ri_section,
"RI_METRIC", i_val=ri_metric%potential_type, explicit=explicit)
1136 IF (.NOT. explicit .OR. ri_metric%potential_type == 0)
THEN
1137 ri_metric%potential_type = hfx_pot%potential_type
1140 CALL section_vals_val_get(ri_section,
"OMEGA", r_val=ri_metric%omega, explicit=explicit)
1141 IF (.NOT. explicit)
THEN
1142 ri_metric%omega = hfx_pot%omega
1145 CALL section_vals_val_get(ri_section,
"CUTOFF_RADIUS", r_val=ri_metric%cutoff_radius, explicit=explicit)
1146 IF (.NOT. explicit)
THEN
1147 ri_metric%cutoff_radius = hfx_pot%cutoff_radius
1150 IF (ri_metric%potential_type == do_potential_short) &
1151 CALL erfc_cutoff(ri_data%eps_schwarz, ri_metric%omega, ri_metric%cutoff_radius)
1152 IF (ri_metric%potential_type == do_potential_id) ri_metric%cutoff_radius = 0.0_dp
1155 CALL section_vals_val_get(ri_section,
"2C_MATRIX_FUNCTIONS", i_val=ri_data%t2c_method)
1156 CALL section_vals_val_get(ri_section,
"EPS_EIGVAL", r_val=ri_data%eps_eigval)
1157 CALL section_vals_val_get(ri_section,
"CHECK_2C_MATRIX", l_val=ri_data%check_2c_inv)
1158 CALL section_vals_val_get(ri_section,
"CALC_COND_NUM", l_val=ri_data%calc_condnum)
1159 CALL section_vals_val_get(ri_section,
"SQRT_ORDER", i_val=ri_data%t2c_sqrt_order)
1160 CALL section_vals_val_get(ri_section,
"EPS_LANCZOS", r_val=ri_data%eps_lanczos)
1161 CALL section_vals_val_get(ri_section,
"MAX_ITER_LANCZOS", i_val=ri_data%max_iter_lanczos)
1162 CALL section_vals_val_get(ri_section,
"RI_FLAVOR", i_val=ri_data%flavor)
1163 CALL section_vals_val_get(ri_section,
"EPS_PGF_ORB", r_val=ri_data%eps_pgf_orb)
1164 CALL section_vals_val_get(ri_section,
"MIN_BLOCK_SIZE", i_val=ri_data%min_bsize)
1165 CALL section_vals_val_get(ri_section,
"MAX_BLOCK_SIZE_MO", i_val=ri_data%max_bsize_MO)
1166 CALL section_vals_val_get(ri_section,
"MEMORY_CUT", i_val=ri_data%n_mem_input)
1167 CALL section_vals_val_get(ri_section,
"FLAVOR_SWITCH_MEMORY_CUT", i_val=ri_data%n_mem_flavor_switch)
1169 ri_data%orb_basis_type = orb_basis_type
1170 ri_data%ri_basis_type = ri_basis_type
1171 ri_data%nelectron_total = nelectron_total
1172 ri_data%input_flavor = ri_data%flavor
1174 IF (
PRESENT(t_c_filename))
THEN
1175 ri_data%ri_metric%filename = t_c_filename
1176 ri_data%hfx_pot%filename = t_c_filename
1179 ri_data%unit_nr_dbcsr = unit_nr_dbcsr
1180 ri_data%unit_nr = unit_nr
1181 ri_data%dbcsr_nflop = 0
1182 ri_data%dbcsr_time = 0.0_dp
1184 CALL hfx_ri_init(ri_data, qs_kind_set, particle_set, atomic_kind_set, para_env)
1186 CALL timestop(handle)
1198 SUBROUTINE hfx_ri_init(ri_data, qs_kind_set, particle_set, atomic_kind_set, para_env)
1200 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1201 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
1202 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
1203 TYPE(mp_para_env_type) :: para_env
1205 CHARACTER(LEN=*),
PARAMETER :: routinen =
'hfx_ri_init'
1207 INTEGER :: handle, i_mem, j_mem, mo_dim, natom, &
1209 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: bsizes_ao_store, bsizes_ri_store, dist1, &
1210 dist2, dist3, dist_ao_1, dist_ao_2, &
1212 INTEGER,
DIMENSION(2) :: pdims_2d
1213 INTEGER,
DIMENSION(3) :: pdims
1215 TYPE(distribution_3d_type) :: dist_3d
1216 TYPE(gto_basis_set_p_type),
ALLOCATABLE, &
1217 DIMENSION(:) :: basis_set_ao, basis_set_ri
1218 TYPE(mp_cart_type) :: mp_comm_3d
1220 CALL cite_reference(bussy2023)
1222 CALL timeset(routinen, handle)
1225 CALL cp_libint_static_init()
1227 natom =
SIZE(particle_set)
1228 nkind =
SIZE(qs_kind_set, 1)
1229 nproc = para_env%num_pe
1231 associate(ri_metric => ri_data%ri_metric, hfx_pot => ri_data%hfx_pot)
1232 IF (ri_metric%potential_type == do_potential_short)
THEN
1233 CALL erfc_cutoff(ri_data%eps_schwarz, ri_metric%omega, ri_metric%cutoff_radius)
1236 IF (hfx_pot%potential_type == do_potential_short)
THEN
1239 CALL erfc_cutoff(ri_data%filter_eps_2c, hfx_pot%omega, hfx_pot%cutoff_radius)
1242 same_op = ri_metric%potential_type == hfx_pot%potential_type
1244 IF (same_op .AND. hfx_pot%potential_type == do_potential_truncated)
THEN
1245 same_op = abs(ri_metric%cutoff_radius - hfx_pot%cutoff_radius) < 1.0e-16_dp
1248 IF (same_op .AND. hfx_pot%potential_type == do_potential_short)
THEN
1249 same_op = abs(ri_metric%omega - hfx_pot%omega) < 1.0e-16_dp
1253 ri_data%same_op = same_op
1256 CALL mp_comm_3d%create(para_env, 3, pdims)
1258 ALLOCATE (ri_data%bsizes_RI(natom))
1259 ALLOCATE (ri_data%bsizes_AO(natom))
1260 ALLOCATE (basis_set_ri(nkind), basis_set_ao(nkind))
1261 CALL basis_set_list_setup(basis_set_ri, ri_data%ri_basis_type, qs_kind_set)
1262 CALL get_particle_set(particle_set, qs_kind_set, nsgf=ri_data%bsizes_RI, basis=basis_set_ri)
1263 CALL basis_set_list_setup(basis_set_ao, ri_data%orb_basis_type, qs_kind_set)
1264 CALL get_particle_set(particle_set, qs_kind_set, nsgf=ri_data%bsizes_AO, basis=basis_set_ao)
1266 ALLOCATE (dist_ri(natom))
1267 ALLOCATE (dist_ao_1(natom))
1268 ALLOCATE (dist_ao_2(natom))
1269 CALL dbt_default_distvec(natom, pdims(1), ri_data%bsizes_RI, dist_ri)
1270 CALL dbt_default_distvec(natom, pdims(2), ri_data%bsizes_AO, dist_ao_1)
1271 CALL dbt_default_distvec(natom, pdims(3), ri_data%bsizes_AO, dist_ao_2)
1272 CALL distribution_3d_create(dist_3d, dist_ri, dist_ao_1, dist_ao_2, nkind, particle_set, &
1273 mp_comm_3d, own_comm=.true.)
1275 ALLOCATE (ri_data%pgrid)
1276 CALL dbt_pgrid_create(para_env, pdims, ri_data%pgrid)
1278 ALLOCATE (ri_data%pgrid_2d)
1280 CALL dbt_pgrid_create(para_env, pdims_2d, ri_data%pgrid_2d)
1282 ri_data%dist_3d = dist_3d
1284 CALL dbt_distribution_new(ri_data%dist, ri_data%pgrid, &
1285 dist_ri, dist_ao_1, dist_ao_2)
1287 DEALLOCATE (dist_ao_1, dist_ao_2, dist_ri)
1289 ri_data%num_pe = para_env%num_pe
1292 CALL pgf_block_sizes(atomic_kind_set, basis_set_ao, ri_data%min_bsize, ri_data%bsizes_AO_split)
1293 CALL pgf_block_sizes(atomic_kind_set, basis_set_ri, ri_data%min_bsize, ri_data%bsizes_RI_split)
1295 CALL pgf_block_sizes(atomic_kind_set, basis_set_ao, 1, bsizes_ao_store)
1296 CALL pgf_block_sizes(atomic_kind_set, basis_set_ri, 1, bsizes_ri_store)
1298 CALL split_block_sizes([sum(ri_data%bsizes_AO)], ri_data%bsizes_AO_fit, default_block_size)
1299 CALL split_block_sizes([sum(ri_data%bsizes_RI)], ri_data%bsizes_RI_fit, default_block_size)
1301 IF (ri_data%flavor == ri_pmat)
THEN
1304 ri_data%n_mem = ri_data%n_mem_input
1305 ri_data%n_mem_RI = ri_data%n_mem_input
1307 CALL create_tensor_batches(ri_data%bsizes_AO_split, ri_data%n_mem, ri_data%starts_array_mem, &
1308 ri_data%ends_array_mem, ri_data%starts_array_mem_block, &
1309 ri_data%ends_array_mem_block)
1311 CALL create_tensor_batches(ri_data%bsizes_RI_split, ri_data%n_mem_RI, &
1312 ri_data%starts_array_RI_mem, ri_data%ends_array_RI_mem, &
1313 ri_data%starts_array_RI_mem_block, ri_data%ends_array_RI_mem_block)
1315 ALLOCATE (ri_data%pgrid_1)
1316 ALLOCATE (ri_data%pgrid_2)
1319 CALL dbt_mp_dims_create(nproc, pdims, [
SIZE(ri_data%bsizes_AO_split),
SIZE(ri_data%bsizes_RI_split), &
1320 SIZE(ri_data%bsizes_AO_split)])
1322 CALL dbt_pgrid_create(para_env, pdims, ri_data%pgrid_1)
1324 pdims = pdims([2, 1, 3])
1325 CALL dbt_pgrid_create(para_env, pdims, ri_data%pgrid_2)
1327 ALLOCATE (ri_data%t_3c_int_ctr_1(1, 1))
1328 CALL create_3c_tensor(ri_data%t_3c_int_ctr_1(1, 1), dist1, dist2, dist3, &
1329 ri_data%pgrid_1, ri_data%bsizes_AO_split, ri_data%bsizes_RI_split, &
1330 ri_data%bsizes_AO_split, [1, 2], [3], name=
"(AO RI | AO)")
1331 DEALLOCATE (dist1, dist2, dist3)
1333 ALLOCATE (ri_data%blk_indices(ri_data%n_mem, ri_data%n_mem_RI))
1334 ALLOCATE (ri_data%store_3c(ri_data%n_mem, ri_data%n_mem_RI))
1335 DO i_mem = 1, ri_data%n_mem
1336 DO j_mem = 1, ri_data%n_mem_RI
1341 ALLOCATE (ri_data%t_3c_int_ctr_2(1, 1))
1342 CALL create_3c_tensor(ri_data%t_3c_int_ctr_2(1, 1), dist1, dist2, dist3, &
1343 ri_data%pgrid_1, ri_data%bsizes_AO_split, ri_data%bsizes_RI_split, &
1344 ri_data%bsizes_AO_split, [1, 2], [3], name=
"(AO RI | AO)")
1345 DEALLOCATE (dist1, dist2, dist3)
1347 ALLOCATE (ri_data%t_3c_int_ctr_3(1, 1))
1348 CALL create_3c_tensor(ri_data%t_3c_int_ctr_3(1, 1), dist1, dist2, dist3, &
1349 ri_data%pgrid_2, ri_data%bsizes_RI_split, ri_data%bsizes_AO_split, &
1350 ri_data%bsizes_AO_split, [1], [2, 3], name=
"(RI | AO AO)")
1351 DEALLOCATE (dist1, dist2, dist3)
1353 ALLOCATE (ri_data%t_2c_int(1, 1))
1354 CALL create_2c_tensor(ri_data%t_2c_int(1, 1), dist1, dist2, ri_data%pgrid_2d, &
1355 ri_data%bsizes_RI_split, ri_data%bsizes_RI_split, &
1357 DEALLOCATE (dist1, dist2)
1360 ALLOCATE (ri_data%rho_ao_t(2, 1))
1361 CALL create_2c_tensor(ri_data%rho_ao_t(1, 1), dist1, dist2, ri_data%pgrid_2d, &
1362 ri_data%bsizes_AO_split, ri_data%bsizes_AO_split, &
1364 DEALLOCATE (dist1, dist2)
1365 CALL dbt_create(ri_data%rho_ao_t(1, 1), ri_data%rho_ao_t(2, 1))
1367 ALLOCATE (ri_data%ks_t(2, 1))
1368 CALL create_2c_tensor(ri_data%ks_t(1, 1), dist1, dist2, ri_data%pgrid_2d, &
1369 ri_data%bsizes_AO_split, ri_data%bsizes_AO_split, &
1371 DEALLOCATE (dist1, dist2)
1372 CALL dbt_create(ri_data%ks_t(1, 1), ri_data%ks_t(2, 1))
1374 ELSEIF (ri_data%flavor == ri_mo)
THEN
1375 ALLOCATE (ri_data%t_2c_int(2, 1))
1377 CALL create_2c_tensor(ri_data%t_2c_int(1, 1), dist1, dist2, ri_data%pgrid_2d, &
1378 ri_data%bsizes_RI_fit, ri_data%bsizes_RI_fit, &
1380 CALL dbt_create(ri_data%t_2c_int(1, 1), ri_data%t_2c_int(2, 1))
1382 DEALLOCATE (dist1, dist2)
1384 ALLOCATE (ri_data%t_3c_int_ctr_1(1, 1))
1386 ALLOCATE (ri_data%pgrid_1)
1387 ALLOCATE (ri_data%pgrid_2)
1390 ri_data%n_mem = ri_data%n_mem_input**2
1391 IF (ri_data%n_mem > ri_data%nelectron_total/2) ri_data%n_mem = max(ri_data%nelectron_total/2, 1)
1396 mo_dim = max((ri_data%nelectron_total/2 - 1)/ri_data%n_mem + 1, 1)
1397 mo_dim = (mo_dim - 1)/ri_data%max_bsize_MO + 1
1400 CALL dbt_mp_dims_create(nproc, pdims, [
SIZE(ri_data%bsizes_AO_split),
SIZE(ri_data%bsizes_RI_split), mo_dim])
1402 CALL dbt_pgrid_create(para_env, pdims, ri_data%pgrid_1)
1404 pdims = pdims([3, 2, 1])
1405 CALL dbt_pgrid_create(para_env, pdims, ri_data%pgrid_2)
1407 CALL create_3c_tensor(ri_data%t_3c_int_ctr_1(1, 1), dist1, dist2, dist3, &
1408 ri_data%pgrid_1, ri_data%bsizes_AO_split, ri_data%bsizes_RI_split, ri_data%bsizes_AO_split, &
1409 [1, 2], [3], name=
"(AO RI | AO)")
1410 DEALLOCATE (dist1, dist2, dist3)
1412 ALLOCATE (ri_data%t_3c_int_ctr_2(1, 1))
1413 CALL create_3c_tensor(ri_data%t_3c_int_ctr_2(1, 1), dist1, dist2, dist3, &
1414 ri_data%pgrid_2, ri_data%bsizes_AO_split, ri_data%bsizes_RI_split, ri_data%bsizes_AO_split, &
1415 [1], [2, 3], name=
"(AO | RI AO)")
1416 DEALLOCATE (dist1, dist2, dist3)
1421 ALLOCATE (ri_data%t_2c_inv(1, 1))
1422 CALL create_2c_tensor(ri_data%t_2c_inv(1, 1), dist1, dist2, ri_data%pgrid_2d, &
1423 ri_data%bsizes_RI_split, ri_data%bsizes_RI_split, &
1425 DEALLOCATE (dist1, dist2)
1427 ALLOCATE (ri_data%t_2c_pot(1, 1))
1428 CALL create_2c_tensor(ri_data%t_2c_pot(1, 1), dist1, dist2, ri_data%pgrid_2d, &
1429 ri_data%bsizes_RI_split, ri_data%bsizes_RI_split, &
1431 DEALLOCATE (dist1, dist2)
1433 CALL timestop(handle)
1441 SUBROUTINE hfx_ri_write_stats(ri_data)
1444 REAL(dp) :: my_flop_rate
1446 associate(unit_nr => ri_data%unit_nr, dbcsr_nflop => ri_data%dbcsr_nflop, &
1447 dbcsr_time => ri_data%dbcsr_time, num_pe => ri_data%num_pe)
1448 my_flop_rate = real(dbcsr_nflop, dp)/(1.0e09_dp*ri_data%dbcsr_time)
1449 IF (unit_nr > 0)
WRITE (unit=unit_nr, fmt=
"(/T2,A,T73,ES8.2)") &
1450 "RI-HFX PERFORMANCE| DBT total number of flops:", real(dbcsr_nflop*num_pe, dp)
1451 IF (unit_nr > 0)
WRITE (unit=unit_nr, fmt=
"(T2,A,T66,F15.2)") &
1452 "RI-HFX PERFORMANCE| DBT total execution time:", dbcsr_time
1453 IF (unit_nr > 0)
WRITE (unit=unit_nr, fmt=
"(T2,A,T66,F15.2)") &
1454 "RI-HFX PERFORMANCE| DBT flop rate (Gflops / MPI rank):", my_flop_rate
1465 LOGICAL,
OPTIONAL :: write_stats
1467 CHARACTER(LEN=*),
PARAMETER :: routinen =
'hfx_ri_release'
1469 INTEGER :: handle, i, i_mem, ispin, j, j_mem, unused
1470 LOGICAL :: my_write_stats
1472 CALL timeset(routinen, handle)
1475 CALL cp_libint_static_cleanup()
1477 my_write_stats = .true.
1478 IF (
PRESENT(write_stats)) my_write_stats = write_stats
1479 IF (my_write_stats)
CALL hfx_ri_write_stats(ri_data)
1481 IF (
ASSOCIATED(ri_data%pgrid))
THEN
1482 CALL dbt_pgrid_destroy(ri_data%pgrid)
1483 DEALLOCATE (ri_data%pgrid)
1485 IF (
ASSOCIATED(ri_data%pgrid_1))
THEN
1486 CALL dbt_pgrid_destroy(ri_data%pgrid_1)
1487 DEALLOCATE (ri_data%pgrid_1)
1489 IF (
ASSOCIATED(ri_data%pgrid_2))
THEN
1490 CALL dbt_pgrid_destroy(ri_data%pgrid_2)
1491 DEALLOCATE (ri_data%pgrid_2)
1493 IF (
ASSOCIATED(ri_data%pgrid_2d))
THEN
1494 CALL dbt_pgrid_destroy(ri_data%pgrid_2d)
1495 DEALLOCATE (ri_data%pgrid_2d)
1498 CALL distribution_3d_destroy(ri_data%dist_3d)
1499 CALL dbt_distribution_destroy(ri_data%dist)
1501 DEALLOCATE (ri_data%bsizes_RI)
1502 DEALLOCATE (ri_data%bsizes_AO)
1503 DEALLOCATE (ri_data%bsizes_AO_split)
1504 DEALLOCATE (ri_data%bsizes_RI_split)
1505 DEALLOCATE (ri_data%bsizes_AO_fit)
1506 DEALLOCATE (ri_data%bsizes_RI_fit)
1508 IF (ri_data%flavor == ri_pmat)
THEN
1509 DO i_mem = 1, ri_data%n_mem
1510 DO j_mem = 1, ri_data%n_mem_RI
1515 DO j = 1,
SIZE(ri_data%t_3c_int_ctr_1, 2)
1516 DO i = 1,
SIZE(ri_data%t_3c_int_ctr_1, 1)
1517 CALL dbt_destroy(ri_data%t_3c_int_ctr_1(i, j))
1520 DEALLOCATE (ri_data%t_3c_int_ctr_1)
1522 DO j = 1,
SIZE(ri_data%t_3c_int_ctr_2, 2)
1523 DO i = 1,
SIZE(ri_data%t_3c_int_ctr_2, 1)
1524 CALL dbt_destroy(ri_data%t_3c_int_ctr_2(i, j))
1527 DEALLOCATE (ri_data%t_3c_int_ctr_2)
1529 DO j = 1,
SIZE(ri_data%t_3c_int_ctr_3, 2)
1530 DO i = 1,
SIZE(ri_data%t_3c_int_ctr_3, 1)
1531 CALL dbt_destroy(ri_data%t_3c_int_ctr_3(i, j))
1534 DEALLOCATE (ri_data%t_3c_int_ctr_3)
1536 DO j = 1,
SIZE(ri_data%t_2c_int, 2)
1537 DO i = 1,
SIZE(ri_data%t_2c_int, 1)
1538 CALL dbt_destroy(ri_data%t_2c_int(i, j))
1541 DEALLOCATE (ri_data%t_2c_int)
1543 DO j = 1,
SIZE(ri_data%rho_ao_t, 2)
1544 DO i = 1,
SIZE(ri_data%rho_ao_t, 1)
1545 CALL dbt_destroy(ri_data%rho_ao_t(i, j))
1548 DEALLOCATE (ri_data%rho_ao_t)
1550 DO j = 1,
SIZE(ri_data%ks_t, 2)
1551 DO i = 1,
SIZE(ri_data%ks_t, 1)
1552 CALL dbt_destroy(ri_data%ks_t(i, j))
1555 DEALLOCATE (ri_data%ks_t)
1557 DEALLOCATE (ri_data%starts_array_mem_block, ri_data%ends_array_mem_block, &
1558 ri_data%starts_array_mem, ri_data%ends_array_mem)
1559 DEALLOCATE (ri_data%starts_array_RI_mem_block, ri_data%ends_array_RI_mem_block, &
1560 ri_data%starts_array_RI_mem, ri_data%ends_array_RI_mem)
1562 DEALLOCATE (ri_data%blk_indices)
1563 DEALLOCATE (ri_data%store_3c)
1564 ELSEIF (ri_data%flavor == ri_mo)
THEN
1565 CALL dbt_destroy(ri_data%t_3c_int_ctr_1(1, 1))
1566 CALL dbt_destroy(ri_data%t_3c_int_ctr_2(1, 1))
1567 DEALLOCATE (ri_data%t_3c_int_ctr_1)
1568 DEALLOCATE (ri_data%t_3c_int_ctr_2)
1570 DO ispin = 1,
SIZE(ri_data%t_3c_int_mo, 1)
1571 CALL dbt_destroy(ri_data%t_3c_int_mo(ispin, 1, 1))
1572 CALL dbt_destroy(ri_data%t_3c_ctr_RI(ispin, 1, 1))
1573 CALL dbt_destroy(ri_data%t_3c_ctr_KS(ispin, 1, 1))
1574 CALL dbt_destroy(ri_data%t_3c_ctr_KS_copy(ispin, 1, 1))
1577 CALL dbt_destroy(ri_data%t_2c_int(ispin, 1))
1579 DEALLOCATE (ri_data%t_2c_int)
1580 DEALLOCATE (ri_data%t_3c_int_mo)
1581 DEALLOCATE (ri_data%t_3c_ctr_RI)
1582 DEALLOCATE (ri_data%t_3c_ctr_KS)
1583 DEALLOCATE (ri_data%t_3c_ctr_KS_copy)
1586 DO j = 1,
SIZE(ri_data%t_2c_inv, 2)
1587 DO i = 1,
SIZE(ri_data%t_2c_inv, 1)
1588 CALL dbt_destroy(ri_data%t_2c_inv(i, j))
1591 DEALLOCATE (ri_data%t_2c_inv)
1593 DO j = 1,
SIZE(ri_data%t_2c_pot, 2)
1594 DO i = 1,
SIZE(ri_data%t_2c_pot, 1)
1595 CALL dbt_destroy(ri_data%t_2c_pot(i, j))
1598 DEALLOCATE (ri_data%t_2c_pot)
1600 IF (
ALLOCATED(ri_data%kp_mat_2c_pot))
THEN
1601 DO j = 1,
SIZE(ri_data%kp_mat_2c_pot, 2)
1602 DO i = 1,
SIZE(ri_data%kp_mat_2c_pot, 1)
1603 CALL dbcsr_release(ri_data%kp_mat_2c_pot(i, j))
1606 DEALLOCATE (ri_data%kp_mat_2c_pot)
1609 IF (
ALLOCATED(ri_data%kp_t_3c_int))
THEN
1610 DO i = 1,
SIZE(ri_data%kp_t_3c_int)
1611 CALL dbt_destroy(ri_data%kp_t_3c_int(i))
1613 DEALLOCATE (ri_data%kp_t_3c_int)
1616 IF (
ALLOCATED(ri_data%rho_ao_t))
THEN
1617 DO j = 1,
SIZE(ri_data%rho_ao_t, 2)
1618 DO i = 1,
SIZE(ri_data%rho_ao_t, 1)
1619 CALL dbt_destroy(ri_data%rho_ao_t(i, j))
1622 DEALLOCATE (ri_data%rho_ao_t)
1625 IF (
ALLOCATED(ri_data%ks_t))
THEN
1626 DO j = 1,
SIZE(ri_data%ks_t, 2)
1627 DO i = 1,
SIZE(ri_data%ks_t, 1)
1628 CALL dbt_destroy(ri_data%ks_t(i, j))
1631 DEALLOCATE (ri_data%ks_t)
1634 IF (
ALLOCATED(ri_data%iatom_to_subgroup))
THEN
1635 DO i = 1,
SIZE(ri_data%iatom_to_subgroup)
1636 DEALLOCATE (ri_data%iatom_to_subgroup(i)%array)
1638 DEALLOCATE (ri_data%iatom_to_subgroup)
1641 CALL timestop(handle)
1657 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1658 CHARACTER(LEN=*) :: basis_type
1660 CHARACTER(LEN=*),
PARAMETER :: routinen =
'hfx_create_basis_types'
1662 INTEGER :: co_counter, handle, i, ikind, ipgf, iset, j, k, la, max_am_kind, max_coeff, &
1663 max_nsgfl, max_pgf, max_pgf_kind, max_set, nkind, nl_count, nset, nseta, offset_a, &
1664 offset_a1, s_offset_nl_a, sgfa, so_counter
1665 INTEGER,
DIMENSION(:),
POINTER :: la_max, la_min, npgfa, nshell
1666 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgfa, nl_a
1667 REAL(dp),
DIMENSION(:, :),
POINTER :: sphi_a
1668 TYPE(gto_basis_set_type),
POINTER :: orb_basis_a
1670 CALL timeset(routinen, handle)
1673 nkind =
SIZE(qs_kind_set, 1)
1675 ALLOCATE (basis_parameter(nkind))
1678 CALL get_qs_kind(qs_kind_set(ikind), basis_set=orb_basis_a, basis_type=basis_type)
1679 CALL get_qs_kind_set(qs_kind_set, &
1680 maxsgf=basis_info%max_sgf, &
1681 maxnset=basis_info%max_set, &
1682 maxlgto=basis_info%max_am, &
1683 basis_type=basis_type)
1684 IF (basis_info%max_set < max_set) cpabort(
"UNEXPECTED MAX_SET")
1685 max_set = max(max_set, basis_info%max_set)
1686 CALL get_gto_basis_set(gto_basis_set=orb_basis_a, &
1687 lmax=basis_parameter(ikind)%lmax, &
1688 lmin=basis_parameter(ikind)%lmin, &
1689 npgf=basis_parameter(ikind)%npgf, &
1690 nset=basis_parameter(ikind)%nset, &
1691 zet=basis_parameter(ikind)%zet, &
1692 nsgf_set=basis_parameter(ikind)%nsgf, &
1693 first_sgf=basis_parameter(ikind)%first_sgf, &
1694 sphi=basis_parameter(ikind)%sphi, &
1695 nsgf=basis_parameter(ikind)%nsgf_total, &
1696 l=basis_parameter(ikind)%nl, &
1697 nshell=basis_parameter(ikind)%nshell, &
1698 set_radius=basis_parameter(ikind)%set_radius, &
1699 pgf_radius=basis_parameter(ikind)%pgf_radius, &
1700 kind_radius=basis_parameter(ikind)%kind_radius)
1703 ALLOCATE (basis_parameter(ikind)%nsgfl(0:basis_info%max_am, max_set))
1704 basis_parameter(ikind)%nsgfl = 0
1705 nset = basis_parameter(ikind)%nset
1706 nshell => basis_parameter(ikind)%nshell
1708 DO i = 0, basis_info%max_am
1710 DO j = 1, nshell(iset)
1711 IF (basis_parameter(ikind)%nl(j, iset) == i) nl_count = nl_count + 1
1713 basis_parameter(ikind)%nsgfl(i, iset) = nl_count
1724 npgfa => basis_parameter(ikind)%npgf
1725 nseta = basis_parameter(ikind)%nset
1726 nl_a => basis_parameter(ikind)%nsgfl
1727 la_max => basis_parameter(ikind)%lmax
1728 la_min => basis_parameter(ikind)%lmin
1730 max_pgf_kind = max(max_pgf_kind, npgfa(iset))
1731 max_pgf = max(max_pgf, npgfa(iset))
1732 DO la = la_min(iset), la_max(iset)
1733 max_nsgfl = max(max_nsgfl, nl_a(la, iset))
1734 max_coeff = max(max_coeff, nso(la)*nl_a(la, iset)*nco(la))
1735 max_am_kind = max(max_am_kind, la)
1738 ALLOCATE (basis_parameter(ikind)%sphi_ext(max_coeff, 0:max_am_kind, max_pgf_kind, nseta))
1739 basis_parameter(ikind)%sphi_ext = 0.0_dp
1743 sphi_a => basis_parameter(ikind)%sphi
1744 nseta = basis_parameter(ikind)%nset
1745 la_max => basis_parameter(ikind)%lmax
1746 la_min => basis_parameter(ikind)%lmin
1747 npgfa => basis_parameter(ikind)%npgf
1748 first_sgfa => basis_parameter(ikind)%first_sgf
1749 nl_a => basis_parameter(ikind)%nsgfl
1751 sgfa = first_sgfa(1, iset)
1752 DO ipgf = 1, npgfa(iset)
1753 offset_a1 = (ipgf - 1)*
ncoset(la_max(iset))
1755 DO la = la_min(iset), la_max(iset)
1756 offset_a = offset_a1 +
ncoset(la - 1)
1758 co_counter = co_counter + 1
1760 DO k = sgfa + s_offset_nl_a, sgfa + s_offset_nl_a + nso(la)*nl_a(la, iset) - 1
1761 DO i = offset_a + 1, offset_a + nco(la)
1762 so_counter = so_counter + 1
1763 basis_parameter(ikind)%sphi_ext(so_counter, la, ipgf, iset) = sphi_a(i, k)
1766 s_offset_nl_a = s_offset_nl_a + nso(la)*(nl_a(la, iset))
1772 CALL timestop(handle)
1783 CHARACTER(LEN=*),
PARAMETER :: routinen =
'hfx_release_basis_types'
1785 INTEGER :: handle, i
1787 CALL timeset(routinen, handle)
1790 DO i = 1,
SIZE(basis_parameter)
1791 DEALLOCATE (basis_parameter(i)%nsgfl)
1792 DEALLOCATE (basis_parameter(i)%sphi_ext)
1794 DEALLOCATE (basis_parameter)
1795 CALL timestop(handle)
1812 i_thread, n_threads, para_env, irep, skip_disk, skip_in_core_forces)
1814 TYPE(section_vals_type),
POINTER :: hf_sub_section
1815 INTEGER,
INTENT(OUT),
OPTIONAL :: storage_id
1816 INTEGER,
INTENT(IN),
OPTIONAL :: i_thread, n_threads
1817 TYPE(mp_para_env_type),
OPTIONAL :: para_env
1818 INTEGER,
INTENT(IN),
OPTIONAL :: irep
1819 LOGICAL,
INTENT(IN) :: skip_disk, skip_in_core_forces
1821 CHARACTER(LEN=512) :: error_msg
1822 CHARACTER(LEN=default_path_length) :: char_val, filename, orig_wd
1823 INTEGER :: int_val, stat
1824 LOGICAL :: check, logic_val
1825 REAL(dp) :: real_val
1827 check = (
PRESENT(storage_id) .EQV.
PRESENT(i_thread)) .AND. &
1828 (
PRESENT(storage_id) .EQV.
PRESENT(n_threads)) .AND. &
1829 (
PRESENT(storage_id) .EQV.
PRESENT(para_env)) .AND. &
1830 (
PRESENT(storage_id) .EQV.
PRESENT(irep))
1834 CALL section_vals_val_get(hf_sub_section,
"MAX_MEMORY", i_val=int_val)
1835 memory_parameter%max_memory = int_val
1836 memory_parameter%max_compression_counter = int_val*1024_int_8*128_int_8
1837 CALL section_vals_val_get(hf_sub_section,
"EPS_STORAGE", r_val=real_val)
1838 memory_parameter%eps_storage_scaling = real_val
1839 IF (int_val == 0)
THEN
1840 memory_parameter%do_all_on_the_fly = .true.
1842 memory_parameter%do_all_on_the_fly = .false.
1844 memory_parameter%cache_size = cache_size
1845 memory_parameter%bits_max_val = bits_max_val
1846 memory_parameter%actual_memory_usage = 1
1847 IF (.NOT. skip_in_core_forces)
THEN
1848 CALL section_vals_val_get(hf_sub_section,
"TREAT_FORCES_IN_CORE", l_val=logic_val)
1849 memory_parameter%treat_forces_in_core = logic_val
1853 IF (memory_parameter%do_all_on_the_fly) memory_parameter%treat_forces_in_core = .false.
1856 IF (.NOT. skip_disk)
THEN
1857 memory_parameter%actual_memory_usage_disk = 1
1858 CALL section_vals_val_get(hf_sub_section,
"MAX_DISK_SPACE", i_val=int_val)
1859 memory_parameter%max_compression_counter_disk = int_val*1024_int_8*128_int_8
1860 IF (int_val == 0)
THEN
1861 memory_parameter%do_disk_storage = .false.
1863 memory_parameter%do_disk_storage = .true.
1865 CALL section_vals_val_get(hf_sub_section,
"STORAGE_LOCATION", c_val=char_val)
1866 CALL compress(char_val, .true.)
1869 IF (scan(char_val,
"/", .true.) /= len_trim(char_val))
THEN
1870 WRITE (filename,
'(A,A)') trim(char_val),
"/"
1871 CALL compress(filename)
1873 filename = trim(char_val)
1875 CALL compress(filename, .true.)
1878 CALL m_getcwd(orig_wd)
1879 CALL m_chdir(trim(filename), stat)
1881 WRITE (error_msg,
'(A,A,A)')
"Request for disk storage failed due to unknown error while writing to ", &
1882 trim(filename),
". Please check STORAGE_LOCATION"
1885 CALL m_chdir(orig_wd, stat)
1887 memory_parameter%storage_location = filename
1888 CALL compress(memory_parameter%storage_location, .true.)
1890 memory_parameter%do_disk_storage = .false.
1892 IF (
PRESENT(storage_id))
THEN
1893 storage_id = (irep - 1)*para_env%num_pe*n_threads + para_env%mepos*n_threads + i_thread - 1
1905 TYPE(
hfx_type),
DIMENSION(:, :),
POINTER :: x_data
1907 INTEGER :: i, i_thread, irep, n_rep_hf, n_threads
1908 TYPE(cp_logger_type),
POINTER :: logger
1909 TYPE(
hfx_type),
POINTER :: actual_x_data
1913 n_rep_hf = x_data(1, 1)%n_rep_hf
1914 n_threads =
SIZE(x_data, 2)
1916 IF (x_data(1, 1)%potential_parameter%potential_type == do_potential_truncated .OR. &
1917 x_data(1, 1)%potential_parameter%potential_type == do_potential_mix_cl_trunc)
THEN
1921 DO i_thread = 1, n_threads
1922 DO irep = 1, n_rep_hf
1923 actual_x_data => x_data(irep, i_thread)
1924 DEALLOCATE (actual_x_data%neighbor_cells)
1925 DEALLOCATE (actual_x_data%distribution_energy)
1926 DEALLOCATE (actual_x_data%distribution_forces)
1928 IF (actual_x_data%load_balance_parameter%blocks_initialized)
THEN
1929 DEALLOCATE (actual_x_data%blocks)
1930 IF (i_thread == 1)
THEN
1931 DEALLOCATE (actual_x_data%pmax_block)
1935 IF (i_thread == 1)
THEN
1936 DEALLOCATE (actual_x_data%atomic_pair_list)
1937 DEALLOCATE (actual_x_data%atomic_pair_list_forces)
1940 IF (actual_x_data%screening_parameter%do_initial_p_screening .OR. &
1941 actual_x_data%screening_parameter%do_p_screening_forces)
THEN
1942 IF (i_thread == 1)
THEN
1943 DEALLOCATE (actual_x_data%pmax_atom)
1944 DO i = 1,
SIZE(actual_x_data%initial_p)
1945 DEALLOCATE (actual_x_data%initial_p(i)%p_kind)
1947 DEALLOCATE (actual_x_data%initial_p)
1949 DEALLOCATE (actual_x_data%pmax_atom_forces)
1950 DO i = 1,
SIZE(actual_x_data%initial_p_forces)
1951 DEALLOCATE (actual_x_data%initial_p_forces(i)%p_kind)
1953 DEALLOCATE (actual_x_data%initial_p_forces)
1955 DEALLOCATE (actual_x_data%map_atom_to_kind_atom)
1957 IF (i_thread == 1)
THEN
1958 DEALLOCATE (actual_x_data%is_assoc_atomic_block)
1959 DEALLOCATE (actual_x_data%atomic_block_offset)
1960 DEALLOCATE (actual_x_data%set_offset)
1961 DEALLOCATE (actual_x_data%block_offset)
1968 CALL cp_libint_cleanup_eri(actual_x_data%lib)
1969 CALL cp_libint_cleanup_eri1(actual_x_data%lib_deriv)
1970 CALL cp_libint_static_cleanup()
1973 CALL dealloc_containers(actual_x_data%store_ints, actual_x_data%memory_parameter%actual_memory_usage)
1974 CALL dealloc_containers(actual_x_data%store_forces, actual_x_data%memory_parameter%actual_memory_usage)
1978 actual_x_data%memory_parameter%actual_memory_usage_disk, &
1980 IF (actual_x_data%memory_parameter%do_disk_storage)
THEN
1981 CALL close_file(unit_number=actual_x_data%store_ints%maxval_container_disk%unit, file_status=
"DELETE")
1983 DEALLOCATE (actual_x_data%store_ints%maxval_container_disk%first)
1984 DEALLOCATE (actual_x_data%store_ints%maxval_container_disk)
1988 actual_x_data%memory_parameter%actual_memory_usage_disk, &
1990 IF (actual_x_data%memory_parameter%do_disk_storage)
THEN
1991 CALL close_file(unit_number=actual_x_data%store_ints%integral_containers_disk(i)%unit, file_status=
"DELETE")
1993 DEALLOCATE (actual_x_data%store_ints%integral_containers_disk(i)%first)
1995 DEALLOCATE (actual_x_data%store_ints%integral_containers_disk)
1998 IF (actual_x_data%screen_funct_is_initialized)
THEN
1999 DEALLOCATE (actual_x_data%screen_funct_coeffs_set)
2000 DEALLOCATE (actual_x_data%screen_funct_coeffs_kind)
2001 DEALLOCATE (actual_x_data%pair_dist_radii_pgf)
2002 DEALLOCATE (actual_x_data%screen_funct_coeffs_pgf)
2003 actual_x_data%screen_funct_is_initialized = .false.
2007 IF (
ASSOCIATED(actual_x_data%map_atoms_to_cpus))
THEN
2008 DO i = 1,
SIZE(actual_x_data%map_atoms_to_cpus)
2009 DEALLOCATE (actual_x_data%map_atoms_to_cpus(i)%iatom_list)
2010 DEALLOCATE (actual_x_data%map_atoms_to_cpus(i)%jatom_list)
2012 DEALLOCATE (actual_x_data%map_atoms_to_cpus)
2015 IF (actual_x_data%do_hfx_ri)
THEN
2017 IF (
ASSOCIATED(actual_x_data%ri_data%ri_section))
THEN
2018 logger => cp_get_default_logger()
2019 CALL cp_print_key_finished_output(actual_x_data%ri_data%unit_nr_dbcsr, logger, actual_x_data%ri_data%ri_section, &
2022 IF (
ASSOCIATED(actual_x_data%ri_data%hfx_section))
THEN
2023 logger => cp_get_default_logger()
2024 CALL cp_print_key_finished_output(actual_x_data%ri_data%unit_nr, logger, actual_x_data%ri_data%hfx_section, &
2027 DEALLOCATE (actual_x_data%ri_data)
2050 INTEGER,
INTENT(INOUT) :: pbc_shells
2051 TYPE(cell_type),
POINTER :: cell
2052 INTEGER,
INTENT(IN) :: i_thread
2053 INTEGER,
DIMENSION(3),
OPTIONAL :: nkp_grid
2055 CHARACTER(LEN=512) :: error_msg
2056 CHARACTER(LEN=64) :: char_nshells
2057 INTEGER :: i,
idx, ikind, ipgf, iset, ishell, j, jkind, jpgf, jset, jshell, k, kshell, l, &
2058 m(3), max_shell, nkp(3), nseta, nsetb, perd(3), total_number_of_cells, ub, ub_max
2059 INTEGER,
DIMENSION(:),
POINTER :: la_max, lb_max, npgfa, npgfb
2060 LOGICAL :: do_kpoints, image_cell_found, &
2062 REAL(dp) :: cross_product(3), dist_min, distance(14), l_min, normal(3, 6), p(3, 14), &
2063 plane_vector(3, 2), point_in_plane(3), r(3), r1, r_max, r_max_stress, s(3), x, y, z, zeta1
2064 REAL(dp),
DIMENSION(:, :),
POINTER :: zeta, zetb
2065 TYPE(
hfx_cell_type),
ALLOCATABLE,
DIMENSION(:) :: tmp_neighbor_cells
2067 total_number_of_cells = 0
2070 IF (
PRESENT(nkp_grid)) nkp = nkp_grid
2071 do_kpoints = any(nkp > 1)
2074 IF (i_thread == 1)
THEN
2075 IF (x_data%potential_parameter%potential_type /= do_potential_truncated .AND. &
2076 x_data%potential_parameter%potential_type /= do_potential_short .AND. &
2077 x_data%potential_parameter%potential_type /= do_potential_mix_cl_trunc .AND. &
2078 x_data%potential_parameter%potential_type /= do_potential_id)
THEN
2079 CALL cp_warn(__location__, &
2080 "Periodic Hartree Fock calculation requested without use "// &
2081 "of a truncated or shortrange potential. This may lead to unphysical total energies. "// &
2082 "Use a truncated potential to avoid possible problems.")
2083 ELSE IF (x_data%potential_parameter%potential_type /= do_potential_id)
THEN
2085 l_min = min(real(nkp(1), dp)*plane_distance(1, 0, 0, cell), &
2086 REAL(nkp(2), dp)*plane_distance(0, 1, 0, cell), &
2087 REAL(nkp(3), dp)*plane_distance(0, 0, 1, cell))
2088 l_min = 0.5_dp*l_min
2089 IF (x_data%potential_parameter%cutoff_radius >= l_min)
THEN
2090 IF (.NOT. do_kpoints)
THEN
2091 CALL cp_warn(__location__, &
2092 "Periodic Hartree Fock calculation requested with the use "// &
2093 "of a truncated or shortrange potential. The cutoff radius is larger than half "// &
2094 "the minimal cell dimension. This may lead to unphysical "// &
2095 "total energies. Reduce the cutoff radius in order to avoid "// &
2096 "possible problems.")
2098 CALL cp_warn(__location__, &
2099 "K-point Hartree-Fock calculation requested with the use of a "// &
2100 "truncated or shortrange potential. The cutoff radius is larger than "// &
2101 "half the minimal Born-von Karman supercell dimension. This may lead "// &
2102 "to unphysical total energies. Reduce the cutoff radius or increase "// &
2103 "the number of K-points in order to avoid possible problems.")
2109 SELECT CASE (x_data%potential_parameter%potential_type)
2110 CASE (do_potential_truncated, do_potential_mix_cl_trunc, do_potential_short)
2112 DO ikind = 1,
SIZE(x_data%basis_parameter)
2113 la_max => x_data%basis_parameter(ikind)%lmax
2114 zeta => x_data%basis_parameter(ikind)%zet
2115 nseta = x_data%basis_parameter(ikind)%nset
2116 npgfa => x_data%basis_parameter(ikind)%npgf
2117 DO jkind = 1,
SIZE(x_data%basis_parameter)
2118 lb_max => x_data%basis_parameter(jkind)%lmax
2119 zetb => x_data%basis_parameter(jkind)%zet
2120 nsetb = x_data%basis_parameter(jkind)%nset
2121 npgfb => x_data%basis_parameter(jkind)%npgf
2124 DO ipgf = 1, npgfa(iset)
2125 DO jpgf = 1, npgfb(jset)
2126 zeta1 = zeta(ipgf, iset) + zetb(jpgf, jset)
2127 r1 = 1.0_dp/sqrt(zeta1)*
mul_fact(la_max(iset) + lb_max(jset))* &
2128 sqrt(-log(x_data%screening_parameter%eps_schwarz))
2129 r_max = max(r1, r_max)
2137 r_max = 2.0_dp*r_max + x_data%potential_parameter%cutoff_radius
2138 nothing_more_to_add = .false.
2140 total_number_of_cells = 0
2142 DEALLOCATE (x_data%neighbor_cells)
2143 ALLOCATE (x_data%neighbor_cells(1))
2144 x_data%neighbor_cells(1)%cell = 0.0_dp
2145 x_data%neighbor_cells(1)%cell_r = 0.0_dp
2182 DO WHILE (.NOT. nothing_more_to_add)
2184 image_cell_found = .false.
2185 ALLOCATE (tmp_neighbor_cells(1:ub))
2187 tmp_neighbor_cells(i) = x_data%neighbor_cells(i)
2189 ub_max = (2*max_shell + 1)**3
2190 DEALLOCATE (x_data%neighbor_cells)
2191 ALLOCATE (x_data%neighbor_cells(1:ub_max))
2193 x_data%neighbor_cells(i) = tmp_neighbor_cells(i)
2196 x_data%neighbor_cells(i)%cell = 0.0_dp
2197 x_data%neighbor_cells(i)%cell_r = 0.0_dp
2200 DEALLOCATE (tmp_neighbor_cells)
2202 perd(1:3) = x_data%periodic_parameter%perd(1:3)
2204 DO ishell = -max_shell*perd(1), max_shell*perd(1)
2205 DO jshell = -max_shell*perd(2), max_shell*perd(2)
2206 DO kshell = -max_shell*perd(3), max_shell*perd(3)
2207 IF (max(abs(ishell), abs(jshell), abs(kshell)) /= max_shell) cycle
2210 x = -1.0_dp/2.0_dp + j*1.0_dp
2212 y = -1.0_dp/2.0_dp + k*1.0_dp
2214 z = -1.0_dp/2.0_dp + l*1.0_dp
2216 p(1,
idx) = x + ishell
2217 p(2,
idx) = y + jshell
2218 p(3,
idx) = z + kshell
2219 CALL scaled_to_real(r, p(:,
idx), cell)
2220 distance(
idx) = sqrt(sum(r**2))
2229 plane_vector(:, 1) = p(:, 3) - p(:, 1)
2230 plane_vector(:, 2) = p(:, 2) - p(:, 1)
2231 cross_product(1) = plane_vector(2, 1)*plane_vector(3, 2) - plane_vector(3, 1)*plane_vector(2, 2)
2232 cross_product(2) = plane_vector(3, 1)*plane_vector(1, 2) - plane_vector(1, 1)*plane_vector(3, 2)
2233 cross_product(3) = plane_vector(1, 1)*plane_vector(2, 2) - plane_vector(2, 1)*plane_vector(1, 2)
2234 normal(:, 1) = cross_product/sqrt(sum(cross_product**2))
2235 point_in_plane = -normal(:, 1)*(normal(1, 1)*p(1, 1) + normal(2, 1)*p(2, 1) + normal(3, 1)*p(3, 1))
2237 IF (point_is_in_quadrilateral(p(:, 1), p(:, 3), p(:, 4), p(:, 2), point_in_plane))
THEN
2238 distance(
idx) = abs(normal(1, 1)*p(1, 1) + normal(2, 1)*p(2, 1) + normal(3, 1)*p(3, 1))
2240 distance(
idx) = huge(distance(
idx))
2245 plane_vector(:, 1) = p(:, 2) - p(:, 1)
2246 plane_vector(:, 2) = p(:, 5) - p(:, 1)
2247 cross_product(1) = plane_vector(2, 1)*plane_vector(3, 2) - plane_vector(3, 1)*plane_vector(2, 2)
2248 cross_product(2) = plane_vector(3, 1)*plane_vector(1, 2) - plane_vector(1, 1)*plane_vector(3, 2)
2249 cross_product(3) = plane_vector(1, 1)*plane_vector(2, 2) - plane_vector(2, 1)*plane_vector(1, 2)
2250 normal(:, 1) = cross_product/sqrt(sum(cross_product**2))
2251 point_in_plane = -normal(:, 1)*(normal(1, 1)*p(1, 1) + normal(2, 1)*p(2, 1) + normal(3, 1)*p(3, 1))
2253 IF (point_is_in_quadrilateral(p(:, 1), p(:, 5), p(:, 6), p(:, 2), point_in_plane))
THEN
2254 distance(
idx) = abs(normal(1, 1)*p(1, 1) + normal(2, 1)*p(2, 1) + normal(3, 1)*p(3, 1))
2256 distance(
idx) = huge(distance(
idx))
2261 plane_vector(:, 1) = p(:, 7) - p(:, 5)
2262 plane_vector(:, 2) = p(:, 6) - p(:, 5)
2263 cross_product(1) = plane_vector(2, 1)*plane_vector(3, 2) - plane_vector(3, 1)*plane_vector(2, 2)
2264 cross_product(2) = plane_vector(3, 1)*plane_vector(1, 2) - plane_vector(1, 1)*plane_vector(3, 2)
2265 cross_product(3) = plane_vector(1, 1)*plane_vector(2, 2) - plane_vector(2, 1)*plane_vector(1, 2)
2266 normal(:, 1) = cross_product/sqrt(sum(cross_product**2))
2267 point_in_plane = -normal(:, 1)*(normal(1, 1)*p(1, 5) + normal(2, 1)*p(2, 5) + normal(3, 1)*p(3, 5))
2269 IF (point_is_in_quadrilateral(p(:, 5), p(:, 7), p(:, 8), p(:, 6), point_in_plane))
THEN
2270 distance(
idx) = abs(normal(1, 1)*p(1, 5) + normal(2, 1)*p(2, 5) + normal(3, 1)*p(3, 5))
2272 distance(
idx) = huge(distance(
idx))
2277 plane_vector(:, 1) = p(:, 7) - p(:, 3)
2278 plane_vector(:, 2) = p(:, 4) - p(:, 3)
2279 cross_product(1) = plane_vector(2, 1)*plane_vector(3, 2) - plane_vector(3, 1)*plane_vector(2, 2)
2280 cross_product(2) = plane_vector(3, 1)*plane_vector(1, 2) - plane_vector(1, 1)*plane_vector(3, 2)
2281 cross_product(3) = plane_vector(1, 1)*plane_vector(2, 2) - plane_vector(2, 1)*plane_vector(1, 2)
2282 normal(:, 1) = cross_product/sqrt(sum(cross_product**2))
2283 point_in_plane = -normal(:, 1)*(normal(1, 1)*p(1, 3) + normal(2, 1)*p(2, 3) + normal(3, 1)*p(3, 3))
2285 IF (point_is_in_quadrilateral(p(:, 3), p(:, 7), p(:, 8), p(:, 4), point_in_plane))
THEN
2286 distance(
idx) = abs(normal(1, 1)*p(1, 3) + normal(2, 1)*p(2, 3) + normal(3, 1)*p(3, 3))
2288 distance(
idx) = huge(distance(
idx))
2293 plane_vector(:, 1) = p(:, 6) - p(:, 2)
2294 plane_vector(:, 2) = p(:, 4) - p(:, 2)
2295 cross_product(1) = plane_vector(2, 1)*plane_vector(3, 2) - plane_vector(3, 1)*plane_vector(2, 2)
2296 cross_product(2) = plane_vector(3, 1)*plane_vector(1, 2) - plane_vector(1, 1)*plane_vector(3, 2)
2297 cross_product(3) = plane_vector(1, 1)*plane_vector(2, 2) - plane_vector(2, 1)*plane_vector(1, 2)
2298 normal(:, 1) = cross_product/sqrt(sum(cross_product**2))
2299 point_in_plane = -normal(:, 1)*(normal(1, 1)*p(1, 2) + normal(2, 1)*p(2, 2) + normal(3, 1)*p(3, 2))
2301 IF (point_is_in_quadrilateral(p(:, 2), p(:, 6), p(:, 8), p(:, 4), point_in_plane))
THEN
2302 distance(
idx) = abs(normal(1, 1)*p(1, 2) + normal(2, 1)*p(2, 2) + normal(3, 1)*p(3, 2))
2304 distance(
idx) = huge(distance(
idx))
2309 plane_vector(:, 1) = p(:, 5) - p(:, 1)
2310 plane_vector(:, 2) = p(:, 3) - p(:, 1)
2311 cross_product(1) = plane_vector(2, 1)*plane_vector(3, 2) - plane_vector(3, 1)*plane_vector(2, 2)
2312 cross_product(2) = plane_vector(3, 1)*plane_vector(1, 2) - plane_vector(1, 1)*plane_vector(3, 2)
2313 cross_product(3) = plane_vector(1, 1)*plane_vector(2, 2) - plane_vector(2, 1)*plane_vector(1, 2)
2314 normal(:, 1) = cross_product/sqrt(sum(cross_product**2))
2315 point_in_plane = -normal(:, 1)*(normal(1, 1)*p(1, 1) + normal(2, 1)*p(2, 1) + normal(3, 1)*p(3, 1))
2317 IF (point_is_in_quadrilateral(p(:, 1), p(:, 5), p(:, 7), p(:, 3), point_in_plane))
THEN
2318 distance(
idx) = abs(normal(1, 1)*p(1, 1) + normal(2, 1)*p(2, 1) + normal(3, 1)*p(3, 1))
2320 distance(
idx) = huge(distance(
idx))
2323 dist_min = minval(distance)
2324 IF (max_shell == 0)
THEN
2325 image_cell_found = .true.
2327 IF (dist_min < r_max)
THEN
2328 total_number_of_cells = total_number_of_cells + 1
2329 x_data%neighbor_cells(ub)%cell = real((/ishell, jshell, kshell/), dp)
2331 image_cell_found = .true.
2337 IF (image_cell_found)
THEN
2338 max_shell = max_shell + 1
2340 nothing_more_to_add = .true.
2344 ALLOCATE (tmp_neighbor_cells(total_number_of_cells))
2346 tmp_neighbor_cells(i) = x_data%neighbor_cells(i)
2348 DEALLOCATE (x_data%neighbor_cells)
2350 IF (total_number_of_cells == 0)
THEN
2351 total_number_of_cells = 1
2352 ALLOCATE (x_data%neighbor_cells(total_number_of_cells))
2353 DO i = 1, total_number_of_cells
2354 x_data%neighbor_cells(i)%cell = 0.0_dp
2355 x_data%neighbor_cells(i)%cell_r = 0.0_dp
2358 ALLOCATE (x_data%neighbor_cells(total_number_of_cells))
2359 DO i = 1, total_number_of_cells
2360 x_data%neighbor_cells(i) = tmp_neighbor_cells(i)
2363 DEALLOCATE (tmp_neighbor_cells)
2365 IF (x_data%periodic_parameter%number_of_shells == do_hfx_auto_shells)
THEN
2368 total_number_of_cells = 0
2369 DO i = 0, x_data%periodic_parameter%number_of_shells
2370 total_number_of_cells = total_number_of_cells + count_cells_perd(i, x_data%periodic_parameter%perd)
2372 IF (total_number_of_cells <
SIZE(x_data%neighbor_cells))
THEN
2373 IF (i_thread == 1)
THEN
2374 WRITE (char_nshells,
'(I3)')
SIZE(x_data%neighbor_cells)
2375 WRITE (error_msg,
'(A,A,A)')
"Periodic Hartree Fock calculation requested with use "// &
2376 "of a truncated potential. The number of shells to be considered "// &
2377 "might be too small. CP2K conservatively estimates to need "//trim(char_nshells)//
" periodic images "// &
2378 "Please carefully check if you get converged results."
2382 total_number_of_cells = 0
2383 DO i = 0, x_data%periodic_parameter%number_of_shells
2384 total_number_of_cells = total_number_of_cells + count_cells_perd(i, x_data%periodic_parameter%perd)
2386 DEALLOCATE (x_data%neighbor_cells)
2388 ALLOCATE (x_data%neighbor_cells(total_number_of_cells))
2391 DO WHILE (sum(m**2) <= x_data%periodic_parameter%number_of_shells)
2392 x_data%neighbor_cells(i)%cell = real(m, dp)
2393 CALL next_image_cell_perd(m, x_data%periodic_parameter%perd)
2398 total_number_of_cells = 0
2399 IF (pbc_shells == -1) pbc_shells = 0
2400 DO i = 0, pbc_shells
2401 total_number_of_cells = total_number_of_cells + count_cells_perd(i, x_data%periodic_parameter%perd)
2403 DEALLOCATE (x_data%neighbor_cells)
2405 ALLOCATE (x_data%neighbor_cells(total_number_of_cells))
2409 DO WHILE (sum(m**2) <= pbc_shells)
2410 x_data%neighbor_cells(i)%cell = real(m, dp)
2411 CALL next_image_cell_perd(m, x_data%periodic_parameter%perd)
2417 DO i = 1,
SIZE(x_data%neighbor_cells)
2419 x_data%neighbor_cells(i)%cell_r(:) = 0.0_dp
2420 s = x_data%neighbor_cells(i)%cell(:)
2421 CALL scaled_to_real(x_data%neighbor_cells(i)%cell_r, s, cell)
2423 x_data%periodic_parameter%number_of_shells = pbc_shells
2425 r_max_stress = 0.0_dp
2426 DO i = 1,
SIZE(x_data%neighbor_cells)
2427 r_max_stress = max(r_max_stress, maxval(abs(x_data%neighbor_cells(i)%cell_r(:))))
2429 r_max_stress = r_max_stress + abs(maxval(cell%hmat(:, :)))
2430 x_data%periodic_parameter%R_max_stress = r_max_stress
2444 FUNCTION point_is_in_quadrilateral(A, B, C, D, P)
2445 REAL(dp) :: a(3), b(3), c(3), d(3), p(3)
2446 LOGICAL :: point_is_in_quadrilateral
2448 REAL(dp),
PARAMETER :: fuzzy = 1000.0_dp*epsilon(1.0_dp)
2450 REAL(dp) :: dot00, dot01, dot02, dot11, dot12, &
2451 invdenom, u, v, v0(3), v1(3), v2(3)
2453 point_is_in_quadrilateral = .false.
2472 dot00 = dot_product(v0, v0)
2473 dot01 = dot_product(v0, v1)
2474 dot02 = dot_product(v0, v2)
2475 dot11 = dot_product(v1, v1)
2476 dot12 = dot_product(v1, v2)
2479 invdenom = 1/(dot00*dot11 - dot01*dot01)
2480 u = (dot11*dot02 - dot01*dot12)*invdenom
2481 v = (dot00*dot12 - dot01*dot02)*invdenom
2483 IF ((u >= 0 - fuzzy) .AND. (v >= 0 - fuzzy) .AND. (u + v <= 1 + fuzzy))
THEN
2484 point_is_in_quadrilateral = .true.
2492 dot00 = dot_product(v0, v0)
2493 dot01 = dot_product(v0, v1)
2494 dot02 = dot_product(v0, v2)
2495 dot11 = dot_product(v1, v1)
2496 dot12 = dot_product(v1, v2)
2499 invdenom = 1/(dot00*dot11 - dot01*dot01)
2500 u = (dot11*dot02 - dot01*dot12)*invdenom
2501 v = (dot00*dot12 - dot01*dot02)*invdenom
2504 IF ((u >= 0 - fuzzy) .AND. (v >= 0 - fuzzy) .AND. (u + v <= 1 + fuzzy))
THEN
2505 point_is_in_quadrilateral = .true.
2509 END FUNCTION point_is_in_quadrilateral
2523 INTEGER :: memory_usage
2524 LOGICAL :: do_disk_storage
2526 TYPE(hfx_container_node),
POINTER :: current, next
2530 current => container%first
2531 DO WHILE (
ASSOCIATED(current))
2532 next => current%next
2533 DEALLOCATE (current)
2538 ALLOCATE (container%first)
2539 container%first%prev => null()
2540 container%first%next => null()
2541 container%current => container%first
2542 container%current%data = 0
2543 container%element_counter = 1
2546 IF (do_disk_storage)
THEN
2548 IF (container%unit /= -1)
THEN
2549 CALL close_file(unit_number=container%unit)
2551 CALL open_file(file_name=trim(container%filename), file_status=
"UNKNOWN", file_form=
"UNFORMATTED", file_action=
"WRITE", &
2552 unit_number=container%unit)
2570 DEALLOCATE (x_data%distribution_energy)
2572 ALLOCATE (x_data%distribution_energy(
SIZE(ptr_to_distr)))
2573 x_data%distribution_energy = ptr_to_distr
2590 DEALLOCATE (x_data%distribution_forces)
2592 ALLOCATE (x_data%distribution_forces(
SIZE(ptr_to_distr)))
2593 x_data%distribution_forces = ptr_to_distr
2610 INTEGER(int_8),
INTENT(IN) :: subtr_size_mb
2612 INTEGER(int_8) :: max_memory
2614 max_memory = memory_parameter%max_memory
2615 max_memory = max_memory - subtr_size_mb
2616 IF (max_memory <= 0)
THEN
2617 memory_parameter%do_all_on_the_fly = .true.
2618 memory_parameter%max_compression_counter = 0
2620 memory_parameter%do_all_on_the_fly = .false.
2621 memory_parameter%max_compression_counter = max_memory*1024_int_8*128_int_8
2633 SUBROUTINE hfx_print_std_info(x_data, hfx_section)
2635 TYPE(section_vals_type),
POINTER :: hfx_section
2638 TYPE(cp_logger_type),
POINTER :: logger
2641 logger => cp_get_default_logger()
2643 iw = cp_print_key_unit_nr(logger, hfx_section,
"HF_INFO", &
2644 extension=
".scfLog")
2647 WRITE (unit=iw, fmt=
"((T3,A,T73,ES8.1))") &
2648 "HFX_INFO| EPS_SCHWARZ: ", x_data%screening_parameter%eps_schwarz
2649 WRITE (unit=iw, fmt=
"((T3,A,T73,ES8.1))") &
2650 "HFX_INFO| EPS_SCHWARZ_FORCES ", x_data%screening_parameter%eps_schwarz_forces
2651 WRITE (unit=iw, fmt=
"((T3,A,T73,ES8.1))") &
2652 "HFX_INFO| EPS_STORAGE_SCALING: ", x_data%memory_parameter%eps_storage_scaling
2653 WRITE (unit=iw, fmt=
"((T3,A,T61,I20))") &
2654 "HFX_INFO| NBINS: ", x_data%load_balance_parameter%nbins
2655 WRITE (unit=iw, fmt=
"((T3,A,T61,I20))") &
2656 "HFX_INFO| BLOCK_SIZE: ", x_data%load_balance_parameter%block_size
2657 IF (x_data%periodic_parameter%do_periodic)
THEN
2658 IF (x_data%periodic_parameter%mode == -1)
THEN
2659 WRITE (unit=iw, fmt=
"((T3,A,T77,A))") &
2660 "HFX_INFO| NUMBER_OF_SHELLS: ",
"AUTO"
2662 WRITE (unit=iw, fmt=
"((T3,A,T61,I20))") &
2663 "HFX_INFO| NUMBER_OF_SHELLS: ", x_data%periodic_parameter%mode
2665 WRITE (unit=iw, fmt=
"((T3,A,T61,I20))") &
2666 "HFX_INFO| Number of periodic shells considered: ", x_data%periodic_parameter%number_of_shells
2667 WRITE (unit=iw, fmt=
"((T3,A,T61,I20),/)") &
2668 "HFX_INFO| Number of periodic cells considered: ",
SIZE(x_data%neighbor_cells)
2670 WRITE (unit=iw, fmt=
"((T3,A,T77,A))") &
2671 "HFX_INFO| Number of periodic shells considered: ",
"NONE"
2672 WRITE (unit=iw, fmt=
"((T3,A,T77,A),/)") &
2673 "HFX_INFO| Number of periodic cells considered: ",
"NONE"
2676 END SUBROUTINE hfx_print_std_info
2683 SUBROUTINE hfx_print_ri_info(ri_data, hfx_section)
2685 TYPE(section_vals_type),
POINTER :: hfx_section
2689 TYPE(cp_logger_type),
POINTER :: logger
2690 TYPE(section_vals_type),
POINTER :: ri_section
2692 NULLIFY (logger, ri_section)
2693 logger => cp_get_default_logger()
2695 ri_section => ri_data%ri_section
2697 iw = cp_print_key_unit_nr(logger, hfx_section,
"HF_INFO", &
2698 extension=
".scfLog")
2702 associate(ri_metric => ri_data%ri_metric, hfx_pot => ri_data%hfx_pot)
2703 SELECT CASE (ri_metric%potential_type)
2704 CASE (do_potential_coulomb)
2705 WRITE (unit=iw, fmt=
"(/T3,A,T74,A)") &
2706 "HFX_RI_INFO| RI metric: ",
"COULOMB"
2707 CASE (do_potential_short)
2708 WRITE (unit=iw, fmt=
"(T3,A,T71,A)") &
2709 "HFX_RI_INFO| RI metric: ",
"SHORTRANGE"
2710 WRITE (iw,
'(T3,A,T61,F20.10)') &
2711 "HFX_RI_INFO| Omega: ", ri_metric%omega
2712 rc_ang = cp_unit_from_cp2k(ri_metric%cutoff_radius,
"angstrom")
2713 WRITE (iw,
'(T3,A,T61,F20.10)') &
2714 "HFX_RI_INFO| Cutoff Radius [angstrom]: ", rc_ang
2715 CASE (do_potential_long)
2716 WRITE (unit=iw, fmt=
"(T3,A,T72,A)") &
2717 "HFX_RI_INFO| RI metric: ",
"LONGRANGE"
2718 WRITE (iw,
'(T3,A,T61,F20.10)') &
2719 "HFX_RI_INFO| Omega: ", ri_metric%omega
2720 CASE (do_potential_id)
2721 WRITE (unit=iw, fmt=
"(T3,A,T73,A)") &
2722 "HFX_RI_INFO| RI metric: ",
"OVERLAP"
2723 CASE (do_potential_truncated)
2724 WRITE (unit=iw, fmt=
"(T3,A,T72,A)") &
2725 "HFX_RI_INFO| RI metric: ",
"TRUNCATED COULOMB"
2726 rc_ang = cp_unit_from_cp2k(ri_metric%cutoff_radius,
"angstrom")
2727 WRITE (iw,
'(T3,A,T61,F20.10)') &
2728 "HFX_RI_INFO| Cutoff Radius [angstrom]: ", rc_ang
2732 SELECT CASE (ri_data%flavor)
2734 WRITE (unit=iw, fmt=
"(T3, A, T79, A)") &
2735 "HFX_RI_INFO| RI flavor: ",
"MO"
2737 WRITE (unit=iw, fmt=
"(T3, A, T78, A)") &
2738 "HFX_RI_INFO| RI flavor: ",
"RHO"
2740 SELECT CASE (ri_data%t2c_method)
2741 CASE (hfx_ri_do_2c_iter)
2742 WRITE (unit=iw, fmt=
"(T3, A, T69, A)") &
2743 "HFX_RI_INFO| Matrix SQRT/INV",
"DBCSR / iter"
2744 CASE (hfx_ri_do_2c_diag)
2745 WRITE (unit=iw, fmt=
"(T3, A, T65, A)") &
2746 "HFX_RI_INFO| Matrix SQRT/INV",
"Dense / diag"
2748 WRITE (unit=iw, fmt=
"(T3, A, T73, ES8.1)") &
2749 "HFX_RI_INFO| EPS_FILTER", ri_data%filter_eps
2750 WRITE (unit=iw, fmt=
"(T3, A, T73, ES8.1)") &
2751 "HFX_RI_INFO| EPS_FILTER 2-center", ri_data%filter_eps_2c
2752 WRITE (unit=iw, fmt=
"(T3, A, T73, ES8.1)") &
2753 "HFX_RI_INFO| EPS_FILTER storage", ri_data%filter_eps_storage
2754 WRITE (unit=iw, fmt=
"(T3, A, T73, ES8.1)") &
2755 "HFX_RI_INFO| EPS_FILTER MO", ri_data%filter_eps_mo
2756 WRITE (unit=iw, fmt=
"(T3, A, T73, ES8.1)") &
2757 "HFX_RI_INFO| EPS_PGF_ORB", ri_data%eps_pgf_orb
2758 WRITE (unit=iw, fmt=
"((T3, A, T73, ES8.1))") &
2759 "HFX_RI_INFO| EPS_SCHWARZ: ", ri_data%eps_schwarz
2760 WRITE (unit=iw, fmt=
"((T3, A, T73, ES8.1))") &
2761 "HFX_RI_INFO| EPS_SCHWARZ_FORCES: ", ri_data%eps_schwarz_forces
2762 WRITE (unit=iw, fmt=
"(T3, A, T78, I3)") &
2763 "HFX_RI_INFO| Minimum block size", ri_data%min_bsize
2764 WRITE (unit=iw, fmt=
"(T3, A, T78, I3)") &
2765 "HFX_RI_INFO| MO block size", ri_data%max_bsize_MO
2766 WRITE (unit=iw, fmt=
"(T3, A, T79, I2)") &
2767 "HFX_RI_INFO| Memory reduction factor", ri_data%n_mem_input
2778 SUBROUTINE hfx_print_info(x_data, hfx_section, i_rep)
2780 TYPE(section_vals_type),
POINTER :: hfx_section
2781 INTEGER,
INTENT(IN) :: i_rep
2785 TYPE(cp_logger_type),
POINTER :: logger
2788 logger => cp_get_default_logger()
2790 iw = cp_print_key_unit_nr(logger, hfx_section,
"HF_INFO", &
2791 extension=
".scfLog")
2794 WRITE (unit=iw, fmt=
"(/,(T3,A,T61,I20))") &
2795 "HFX_INFO| Replica ID: ", i_rep
2797 WRITE (iw,
'(T3,A,T61,F20.10)') &
2798 "HFX_INFO| FRACTION: ", x_data%general_parameter%fraction
2799 SELECT CASE (x_data%potential_parameter%potential_type)
2800 CASE (do_potential_coulomb)
2801 WRITE (unit=iw, fmt=
"((T3,A,T74,A))") &
2802 "HFX_INFO| Interaction Potential: ",
"COULOMB"
2803 CASE (do_potential_short)
2804 WRITE (unit=iw, fmt=
"((T3,A,T71,A))") &
2805 "HFX_INFO| Interaction Potential: ",
"SHORTRANGE"
2806 WRITE (iw,
'(T3,A,T61,F20.10)') &
2807 "HFX_INFO| Omega: ", x_data%potential_parameter%omega
2808 rc_ang = cp_unit_from_cp2k(x_data%potential_parameter%cutoff_radius,
"angstrom")
2809 WRITE (iw,
'(T3,A,T61,F20.10)') &
2810 "HFX_INFO| Cutoff Radius [angstrom]: ", rc_ang
2811 CASE (do_potential_long)
2812 WRITE (unit=iw, fmt=
"((T3,A,T72,A))") &
2813 "HFX_INFO| Interaction Potential: ",
"LONGRANGE"
2814 WRITE (iw,
'(T3,A,T61,F20.10)') &
2815 "HFX_INFO| Omega: ", x_data%potential_parameter%omega
2816 CASE (do_potential_mix_cl)
2817 WRITE (unit=iw, fmt=
"((T3,A,T75,A))") &
2818 "HFX_INFO| Interaction Potential: ",
"MIX_CL"
2819 WRITE (iw,
'(T3,A,T61,F20.10)') &
2820 "HFX_INFO| Omega: ", x_data%potential_parameter%omega
2821 WRITE (iw,
'(T3,A,T61,F20.10)') &
2822 "HFX_INFO| SCALE_COULOMB: ", x_data%potential_parameter%scale_coulomb
2823 WRITE (iw,
'(T3,A,T61,F20.10)') &
2824 "HFX_INFO| SCALE_LONGRANGE: ", x_data%potential_parameter%scale_longrange
2825 CASE (do_potential_gaussian)
2826 WRITE (unit=iw, fmt=
"((T3,A,T73,A))") &
2827 "HFX_INFO| Interaction Potential: ",
"GAUSSIAN"
2828 WRITE (iw,
'(T3,A,T61,F20.10)') &
2829 "HFX_INFO| Omega: ", x_data%potential_parameter%omega
2830 CASE (do_potential_mix_lg)
2831 WRITE (unit=iw, fmt=
"((T3,A,T75,A))") &
2832 "HFX_INFO| Interaction Potential: ",
"MIX_LG"
2833 WRITE (iw,
'(T3,A,T61,F20.10)') &
2834 "HFX_INFO| Omega: ", x_data%potential_parameter%omega
2835 WRITE (iw,
'(T3,A,T61,F20.10)') &
2836 "HFX_INFO| SCALE_LONGRANGE: ", x_data%potential_parameter%scale_longrange
2837 WRITE (iw,
'(T3,A,T61,F20.10)') &
2838 "HFX_INFO| SCALE_GAUSSIAN: ", x_data%potential_parameter%scale_gaussian
2839 CASE (do_potential_id)
2840 WRITE (unit=iw, fmt=
"((T3,A,T73,A))") &
2841 "HFX_INFO| Interaction Potential: ",
"IDENTITY"
2842 CASE (do_potential_truncated)
2843 WRITE (unit=iw, fmt=
"((T3,A,T72,A))") &
2844 "HFX_INFO| Interaction Potential: ",
"TRUNCATED"
2845 rc_ang = cp_unit_from_cp2k(x_data%potential_parameter%cutoff_radius,
"angstrom")
2846 WRITE (iw,
'(T3,A,T61,F20.10)') &
2847 "HFX_INFO| Cutoff Radius [angstrom]: ", rc_ang
2848 CASE (do_potential_mix_cl_trunc)
2849 WRITE (unit=iw, fmt=
"((T3,A,T65,A))") &
2850 "HFX_INFO| Interaction Potential: ",
"TRUNCATED MIX_CL"
2851 rc_ang = cp_unit_from_cp2k(x_data%potential_parameter%cutoff_radius,
"angstrom")
2852 WRITE (iw,
'(T3,A,T61,F20.10)') &
2853 "HFX_INFO| Cutoff Radius [angstrom]: ", rc_ang
2857 IF (x_data%do_hfx_ri)
THEN
2858 CALL hfx_print_ri_info(x_data%ri_data, hfx_section)
2860 CALL hfx_print_std_info(x_data, hfx_section)
2863 CALL cp_print_key_finished_output(iw, logger, hfx_section, &
2874 INTEGER :: memory_usage
2878 DO bin = 1,
SIZE(data%maxval_container)
2881 DEALLOCATE (data%maxval_container(bin)%first)
2883 DEALLOCATE (data%maxval_container)
2884 DEALLOCATE (data%maxval_cache)
2886 DO bin = 1,
SIZE(data%integral_containers, 2)
2890 DEALLOCATE (data%integral_containers(i, bin)%first)
2893 DEALLOCATE (data%integral_containers)
2895 DEALLOCATE (data%integral_caches)
2906 INTEGER,
INTENT(IN) :: bin_size
2910 ALLOCATE (data%maxval_cache(bin_size))
2911 DO bin = 1, bin_size
2912 data%maxval_cache(bin)%element_counter = 1
2914 ALLOCATE (data%maxval_container(bin_size))
2915 DO bin = 1, bin_size
2916 ALLOCATE (data%maxval_container(bin)%first)
2917 data%maxval_container(bin)%first%prev => null()
2918 data%maxval_container(bin)%first%next => null()
2919 data%maxval_container(bin)%current => data%maxval_container(bin)%first
2920 data%maxval_container(bin)%current%data = 0
2921 data%maxval_container(bin)%element_counter = 1
2924 ALLOCATE (data%integral_containers(64, bin_size))
2925 ALLOCATE (data%integral_caches(64, bin_size))
2927 DO bin = 1, bin_size
2929 data%integral_caches(i, bin)%element_counter = 1
2930 data%integral_caches(i, bin)%data = 0
2931 ALLOCATE (data%integral_containers(i, bin)%first)
2932 data%integral_containers(i, bin)%first%prev => null()
2933 data%integral_containers(i, bin)%first%next => null()
2934 data%integral_containers(i, bin)%current => data%integral_containers(i, bin)%first
2935 data%integral_containers(i, bin)%current%data = 0
2936 data%integral_containers(i, bin)%element_counter = 1
2953 TYPE(section_vals_type),
POINTER :: hfx_section1, hfx_section2
2954 LOGICAL,
INTENT(OUT) :: is_identical
2955 LOGICAL,
INTENT(OUT),
OPTIONAL :: same_except_frac
2957 CHARACTER(LEN=default_path_length) :: cval1, cval2
2958 INTEGER :: irep, ival1, ival2, n_rep_hf1, n_rep_hf2
2959 LOGICAL :: lval1, lval2
2960 REAL(dp) :: rval1, rval2
2961 TYPE(section_vals_type),
POINTER :: hfx_sub_section1, hfx_sub_section2
2963 is_identical = .true.
2964 IF (
PRESENT(same_except_frac)) same_except_frac = .false.
2966 CALL section_vals_get(hfx_section1, n_repetition=n_rep_hf1)
2967 CALL section_vals_get(hfx_section2, n_repetition=n_rep_hf2)
2968 is_identical = n_rep_hf1 == n_rep_hf2
2969 IF (.NOT. is_identical)
RETURN
2971 DO irep = 1, n_rep_hf1
2972 CALL section_vals_val_get(hfx_section1,
"PW_HFX", l_val=lval1, i_rep_section=irep)
2973 CALL section_vals_val_get(hfx_section2,
"PW_HFX", l_val=lval2, i_rep_section=irep)
2974 IF (lval1 .NEQV. lval2) is_identical = .false.
2976 CALL section_vals_val_get(hfx_section1,
"PW_HFX_BLOCKSIZE", i_val=ival1, i_rep_section=irep)
2977 CALL section_vals_val_get(hfx_section2,
"PW_HFX_BLOCKSIZE", i_val=ival2, i_rep_section=irep)
2978 IF (ival1 .NE. ival2) is_identical = .false.
2980 CALL section_vals_val_get(hfx_section1,
"TREAT_LSD_IN_CORE", l_val=lval1, i_rep_section=irep)
2981 CALL section_vals_val_get(hfx_section2,
"TREAT_LSD_IN_CORE", l_val=lval2, i_rep_section=irep)
2982 IF (lval1 .NEQV. lval2) is_identical = .false.
2984 hfx_sub_section1 => section_vals_get_subs_vals(hfx_section1,
"INTERACTION_POTENTIAL", i_rep_section=irep)
2985 hfx_sub_section2 => section_vals_get_subs_vals(hfx_section2,
"INTERACTION_POTENTIAL", i_rep_section=irep)
2987 CALL section_vals_val_get(hfx_sub_section1,
"OMEGA", r_val=rval1, i_rep_section=irep)
2988 CALL section_vals_val_get(hfx_sub_section2,
"OMEGA", r_val=rval2, i_rep_section=irep)
2989 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
2991 CALL section_vals_val_get(hfx_sub_section1,
"POTENTIAL_TYPE", i_val=ival1, i_rep_section=irep)
2992 CALL section_vals_val_get(hfx_sub_section2,
"POTENTIAL_TYPE", i_val=ival2, i_rep_section=irep)
2993 IF (ival1 .NE. ival2) is_identical = .false.
2994 IF (.NOT. is_identical)
RETURN
2996 IF (ival1 == do_potential_truncated .OR. ival1 == do_potential_mix_cl_trunc)
THEN
2997 CALL section_vals_val_get(hfx_sub_section1,
"CUTOFF_RADIUS", r_val=rval1, i_rep_section=irep)
2998 CALL section_vals_val_get(hfx_sub_section2,
"CUTOFF_RADIUS", r_val=rval2, i_rep_section=irep)
2999 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
3001 CALL section_vals_val_get(hfx_sub_section1,
"T_C_G_DATA", c_val=cval1, i_rep_section=irep)
3002 CALL section_vals_val_get(hfx_sub_section2,
"T_C_G_DATA", c_val=cval2, i_rep_section=irep)
3003 IF (cval1 .NE. cval2) is_identical = .false.
3006 CALL section_vals_val_get(hfx_sub_section1,
"SCALE_COULOMB", r_val=rval1, i_rep_section=irep)
3007 CALL section_vals_val_get(hfx_sub_section2,
"SCALE_COULOMB", r_val=rval2, i_rep_section=irep)
3008 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
3010 CALL section_vals_val_get(hfx_sub_section1,
"SCALE_GAUSSIAN", r_val=rval1, i_rep_section=irep)
3011 CALL section_vals_val_get(hfx_sub_section2,
"SCALE_GAUSSIAN", r_val=rval2, i_rep_section=irep)
3012 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
3014 CALL section_vals_val_get(hfx_sub_section1,
"SCALE_LONGRANGE", r_val=rval1, i_rep_section=irep)
3015 CALL section_vals_val_get(hfx_sub_section2,
"SCALE_LONGRANGE", r_val=rval2, i_rep_section=irep)
3016 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
3018 hfx_sub_section1 => section_vals_get_subs_vals(hfx_section1,
"PERIODIC", i_rep_section=irep)
3019 hfx_sub_section2 => section_vals_get_subs_vals(hfx_section2,
"PERIODIC", i_rep_section=irep)
3021 CALL section_vals_val_get(hfx_sub_section1,
"NUMBER_OF_SHELLS", i_val=ival1, i_rep_section=irep)
3022 CALL section_vals_val_get(hfx_sub_section2,
"NUMBER_OF_SHELLS", i_val=ival2, i_rep_section=irep)
3023 IF (ival1 .NE. ival2) is_identical = .false.
3025 hfx_sub_section1 => section_vals_get_subs_vals(hfx_section1,
"RI", i_rep_section=irep)
3026 hfx_sub_section2 => section_vals_get_subs_vals(hfx_section2,
"RI", i_rep_section=irep)
3028 CALL section_vals_val_get(hfx_sub_section1,
"_SECTION_PARAMETERS_", l_val=lval1, i_rep_section=irep)
3029 CALL section_vals_val_get(hfx_sub_section2,
"_SECTION_PARAMETERS_", l_val=lval2, i_rep_section=irep)
3030 IF (lval1 .NEQV. lval2) is_identical = .false.
3032 CALL section_vals_val_get(hfx_sub_section1,
"CUTOFF_RADIUS", r_val=rval1, i_rep_section=irep)
3033 CALL section_vals_val_get(hfx_sub_section2,
"CUTOFF_RADIUS", r_val=rval2, i_rep_section=irep)
3034 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
3036 CALL section_vals_val_get(hfx_sub_section1,
"EPS_EIGVAL", r_val=rval1, i_rep_section=irep)
3037 CALL section_vals_val_get(hfx_sub_section2,
"EPS_EIGVAL", r_val=rval2, i_rep_section=irep)
3038 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
3040 CALL section_vals_val_get(hfx_sub_section1,
"EPS_FILTER", r_val=rval1, i_rep_section=irep)
3041 CALL section_vals_val_get(hfx_sub_section2,
"EPS_FILTER", r_val=rval2, i_rep_section=irep)
3042 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
3044 CALL section_vals_val_get(hfx_sub_section1,
"EPS_FILTER_2C", r_val=rval1, i_rep_section=irep)
3045 CALL section_vals_val_get(hfx_sub_section2,
"EPS_FILTER_2C", r_val=rval2, i_rep_section=irep)
3046 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
3048 CALL section_vals_val_get(hfx_sub_section1,
"EPS_FILTER_MO", r_val=rval1, i_rep_section=irep)
3049 CALL section_vals_val_get(hfx_sub_section2,
"EPS_FILTER_MO", r_val=rval2, i_rep_section=irep)
3050 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
3052 CALL section_vals_val_get(hfx_sub_section1,
"EPS_PGF_ORB", r_val=rval1, i_rep_section=irep)
3053 CALL section_vals_val_get(hfx_sub_section2,
"EPS_PGF_ORB", r_val=rval2, i_rep_section=irep)
3054 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
3056 CALL section_vals_val_get(hfx_sub_section1,
"MAX_BLOCK_SIZE_MO", i_val=ival1, i_rep_section=irep)
3057 CALL section_vals_val_get(hfx_sub_section2,
"MAX_BLOCK_SIZE_MO", i_val=ival2, i_rep_section=irep)
3058 IF (ival1 .NE. ival2) is_identical = .false.
3060 CALL section_vals_val_get(hfx_sub_section1,
"MIN_BLOCK_SIZE", i_val=ival1, i_rep_section=irep)
3061 CALL section_vals_val_get(hfx_sub_section2,
"MIN_BLOCK_SIZE", i_val=ival2, i_rep_section=irep)
3062 IF (ival1 .NE. ival2) is_identical = .false.
3064 CALL section_vals_val_get(hfx_sub_section1,
"OMEGA", r_val=rval1, i_rep_section=irep)
3065 CALL section_vals_val_get(hfx_sub_section2,
"OMEGA", r_val=rval2, i_rep_section=irep)
3066 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
3068 CALL section_vals_val_get(hfx_sub_section1,
"RI_FLAVOR", i_val=ival1, i_rep_section=irep)
3069 CALL section_vals_val_get(hfx_sub_section2,
"RI_FLAVOR", i_val=ival2, i_rep_section=irep)
3070 IF (ival1 .NE. ival2) is_identical = .false.
3072 CALL section_vals_val_get(hfx_sub_section1,
"RI_METRIC", i_val=ival1, i_rep_section=irep)
3073 CALL section_vals_val_get(hfx_sub_section2,
"RI_METRIC", i_val=ival2, i_rep_section=irep)
3074 IF (ival1 .NE. ival2) is_identical = .false.
3076 hfx_sub_section1 => section_vals_get_subs_vals(hfx_section1,
"SCREENING", i_rep_section=irep)
3077 hfx_sub_section2 => section_vals_get_subs_vals(hfx_section2,
"SCREENING", i_rep_section=irep)
3079 CALL section_vals_val_get(hfx_sub_section1,
"EPS_SCHWARZ", r_val=rval1, i_rep_section=irep)
3080 CALL section_vals_val_get(hfx_sub_section2,
"EPS_SCHWARZ", r_val=rval2, i_rep_section=irep)
3081 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
3083 CALL section_vals_val_get(hfx_sub_section1,
"EPS_SCHWARZ_FORCES", r_val=rval1, i_rep_section=irep)
3084 CALL section_vals_val_get(hfx_sub_section2,
"EPS_SCHWARZ_FORCES", r_val=rval2, i_rep_section=irep)
3085 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
3087 CALL section_vals_val_get(hfx_sub_section1,
"P_SCREEN_CORRECTION_FACTOR", r_val=rval1, i_rep_section=irep)
3088 CALL section_vals_val_get(hfx_sub_section2,
"P_SCREEN_CORRECTION_FACTOR", r_val=rval2, i_rep_section=irep)
3089 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
3091 CALL section_vals_val_get(hfx_sub_section1,
"SCREEN_ON_INITIAL_P", l_val=lval1, i_rep_section=irep)
3092 CALL section_vals_val_get(hfx_sub_section2,
"SCREEN_ON_INITIAL_P", l_val=lval2, i_rep_section=irep)
3093 IF (lval1 .NEQV. lval2) is_identical = .false.
3095 CALL section_vals_val_get(hfx_sub_section1,
"SCREEN_P_FORCES", l_val=lval1, i_rep_section=irep)
3096 CALL section_vals_val_get(hfx_sub_section2,
"SCREEN_P_FORCES", l_val=lval2, i_rep_section=irep)
3097 IF (lval1 .NEQV. lval2) is_identical = .false.
3102 IF (is_identical)
THEN
3103 DO irep = 1, n_rep_hf1
3104 CALL section_vals_val_get(hfx_section1,
"FRACTION", r_val=rval1, i_rep_section=irep)
3105 CALL section_vals_val_get(hfx_section2,
"FRACTION", r_val=rval2, i_rep_section=irep)
3106 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
3109 IF (
PRESENT(same_except_frac))
THEN
3110 IF (.NOT. is_identical) same_except_frac = .true.
static GRID_HOST_DEVICE int ncoset(const int l)
Number of Cartesian orbitals up to given angular momentum quantum.
static GRID_HOST_DEVICE int idx(const orbital a)
Return coset index of given orbital angular momentum.
Define the atomic kind types and their sub types.
subroutine, public get_atomic_kind_set(atomic_kind_set, atom_of_kind, kind_of, natom_of_kind, maxatom, natom, nshell, fist_potential_present, shell_present, shell_adiabatic, shell_check_distance, damping_present)
Get attributes of an atomic kind set.
subroutine, public get_atomic_kind(atomic_kind, fist_potential, element_symbol, name, mass, kind_number, natom, atom_list, rcov, rvdw, z, qeff, apol, cpol, mm_radius, shell, shell_active, damping)
Get attributes of an atomic kind.
subroutine, public get_gto_basis_set(gto_basis_set, name, aliases, norm_type, kind_radius, ncgf, nset, nsgf, cgf_symbol, sgf_symbol, norm_cgf, set_radius, lmax, lmin, lx, ly, lz, m, ncgf_set, npgf, nsgf_set, nshell, cphi, pgf_radius, sphi, scon, zet, first_cgf, first_sgf, l, last_cgf, last_sgf, n, gcc, maxco, maxl, maxpgf, maxsgf_set, maxshell, maxso, nco_sum, npgf_sum, nshell_sum, maxder, short_kind_radius, npgf_seg_sum)
...
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public guidon2008
integer, save, public guidon2009
integer, save, public bussy2023
Handles all functions related to the CELL.
subroutine, public scaled_to_real(r, s, cell)
Transform scaled cell coordinates real coordinates. r=h*s.
subroutine, public get_cell(cell, alpha, beta, gamma, deth, orthorhombic, abc, periodic, h, h_inv, symmetry_id, tag)
Get informations about a simulation cell.
real(kind=dp) function, public plane_distance(h, k, l, cell)
Calculate the distance between two lattice planes as defined by a triple of Miller indices (hkl).
various utilities that regard array of different kinds: output, allocation,... maybe it is not a good...
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
subroutine, public dbcsr_release(matrix)
...
Utility routines to open and close files. Tracking of preconnections.
subroutine, public open_file(file_name, file_status, file_form, file_action, file_position, file_pad, unit_number, debug, skip_get_unit_number, file_access)
Opens the requested file using a free unit number.
subroutine, public close_file(unit_number, file_status, keep_preconnection)
Close an open file given by its logical unit number. Optionally, keep the file and unit preconnected.
logical function, public file_exists(file_name)
Checks if file exists, considering also the file discovery mechanism.
various routines to log and control the output. The idea is that decisions about where to log should ...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
real(kind=dp) function, public cp_unit_from_cp2k(value, unit_str, defaults, power)
converts from the internal cp2k units to the given unit
This is the start of a dbt_api, all publically needed functions are exported here....
Some auxiliary functions and subroutines needed for HFX calculations.
integer function, public count_cells_perd(shell, perd)
Auxiliary function for creating periodic neighbor cells
subroutine, public next_image_cell_perd(m, perd)
Auxiliary function for creating periodic neighbor cells
Types and set/get functions for HFX.
subroutine, public hfx_create(x_data, para_env, hfx_section, atomic_kind_set, qs_kind_set, particle_set, dft_control, cell, orb_basis, ri_basis, nelectron_total, nkp_grid)
This routine allocates and initializes all types in hfx_data
subroutine, public hfx_init_container(container, memory_usage, do_disk_storage)
This routine deletes all list entries in a container in order to deallocate the memory.
subroutine, public hfx_set_distr_energy(ptr_to_distr, x_data)
This routine stores the data obtained from the load balance routine for the energy
subroutine, public hfx_set_distr_forces(ptr_to_distr, x_data)
This routine stores the data obtained from the load balance routine for the forces
integer, parameter, public max_atom_block
subroutine, public parse_memory_section(memory_parameter, hf_sub_section, storage_id, i_thread, n_threads, para_env, irep, skip_disk, skip_in_core_forces)
Parses the memory section
subroutine, public hfx_release_basis_types(basis_parameter)
...
integer, save, public init_t_c_g0_lmax
real(dp), parameter, public log_zero
integer, parameter, public max_images
subroutine, public hfx_release(x_data)
This routine deallocates all data structures
subroutine, public alloc_containers(data, bin_size)
...
subroutine, public hfx_create_neighbor_cells(x_data, pbc_shells, cell, i_thread, nkp_grid)
This routine computes the neighbor cells that are taken into account in periodic runs
subroutine, public dealloc_containers(data, memory_usage)
...
subroutine, public hfx_create_basis_types(basis_parameter, basis_info, qs_kind_set, basis_type)
This routine allocates and initializes the basis_info and basis_parameter types
subroutine, public hfx_ri_init(ri_data, qs_kind_set, particle_set, atomic_kind_set, para_env)
...
subroutine, public compare_hfx_sections(hfx_section1, hfx_section2, is_identical, same_except_frac)
Compares the non-technical parts of two HFX input section and check whether they are the same Ignore ...
real(kind=dp), dimension(0:10), parameter, public mul_fact
real(dp), parameter, public powell_min_log
subroutine, public hfx_reset_memory_usage_counter(memory_parameter, subtr_size_mb)
resets the maximum memory usage for a HFX calculation subtracting all relevant buffers from the input...
subroutine, public hfx_ri_release(ri_data, write_stats)
...
Defines the basic variable types.
integer, parameter, public int_8
integer, parameter, public dp
integer, parameter, public default_string_length
integer, parameter, public default_path_length
2- and 3-center electron repulsion integral routines based on libint2 Currently available operators: ...
Interface to the Libint-Library or a c++ wrapper.
subroutine, public cp_libint_init_eri1(lib, max_am)
integer, parameter, public prim_data_f_size
subroutine, public cp_libint_cleanup_eri1(lib)
subroutine, public cp_libint_static_cleanup()
subroutine, public cp_libint_init_eri(lib, max_am)
subroutine, public cp_libint_static_init()
subroutine, public cp_libint_cleanup_eri(lib)
subroutine, public cp_libint_set_contrdepth(lib, contrdepth)
Machine interface based on Fortran 2003 and POSIX.
subroutine, public m_getcwd(curdir)
...
subroutine, public m_chdir(dir, ierror)
...
Collection of simple mathematical functions and subroutines.
subroutine, public erfc_cutoff(eps, omg, r_cutoff)
compute a truncation radius for the shortrange operator
Interface to the message passing library MPI.
Provides Cartesian and spherical orbital pointers and indices.
integer, dimension(:), allocatable, public nco
integer, dimension(:), allocatable, public ncoset
integer, dimension(:), allocatable, public nso
Define methods related to particle_type.
subroutine, public get_particle_set(particle_set, qs_kind_set, first_sgf, last_sgf, nsgf, nmao, basis)
Get the components of a particle set.
Define the data structure for the particle information.
Some utility functions for the calculation of integrals.
subroutine, public basis_set_list_setup(basis_set_list, basis_type, qs_kind_set)
Set up an easy accessible list of the basis sets for all kinds.
Define the quickstep kind type and their sub types.
subroutine, public get_qs_kind(qs_kind, basis_set, basis_type, ncgf, nsgf, all_potential, tnadd_potential, gth_potential, sgp_potential, upf_potential, se_parameter, dftb_parameter, xtb_parameter, dftb3_param, zatom, zeff, elec_conf, mao, lmax_dftb, alpha_core_charge, ccore_charge, core_charge, core_charge_radius, paw_proj_set, paw_atom, hard_radius, hard0_radius, max_rad_local, covalent_radius, vdw_radius, gpw_type_forced, harmonics, max_iso_not0, max_s_harm, grid_atom, ngrid_ang, ngrid_rad, lmax_rho0, dft_plus_u_atom, l_of_dft_plus_u, n_of_dft_plus_u, u_minus_j, u_of_dft_plus_u, j_of_dft_plus_u, alpha_of_dft_plus_u, beta_of_dft_plus_u, j0_of_dft_plus_u, occupation_of_dft_plus_u, dispersion, bs_occupation, magnetization, no_optimize, addel, laddel, naddel, orbitals, max_scf, eps_scf, smear, u_ramping, u_minus_j_target, eps_u_ramping, init_u_ramping_each_scf, reltmat, ghost, floating, name, element_symbol, pao_basis_size, pao_model_file, pao_potentials, pao_descriptors, nelec)
Get attributes of an atomic kind.
subroutine, public get_qs_kind_set(qs_kind_set, all_potential_present, tnadd_potential_present, gth_potential_present, sgp_potential_present, paw_atom_present, dft_plus_u_atom_present, maxcgf, maxsgf, maxco, maxco_proj, maxgtops, maxlgto, maxlprj, maxnset, maxsgf_set, ncgf, npgf, nset, nsgf, nshell, maxpol, maxlppl, maxlppnl, maxppnl, nelectron, maxder, max_ngrid_rad, max_sph_harm, maxg_iso_not0, lmax_rho0, basis_rcut, basis_type, total_zeff_corr, npgf_seg)
Get attributes of an atomic kind set.
Utility methods to build 3-center integral tensors of various types.
subroutine, public distribution_3d_create(dist_3d, dist1, dist2, dist3, nkind, particle_set, mp_comm_3d, own_comm)
Create a 3d distribution.
integer, parameter, public default_block_size
subroutine, public create_2c_tensor(t2c, dist_1, dist_2, pgrid, sizes_1, sizes_2, order, name)
...
subroutine, public split_block_sizes(blk_sizes, blk_sizes_split, max_size)
...
subroutine, public pgf_block_sizes(atomic_kind_set, basis, min_blk_size, pgf_blk_sizes)
...
subroutine, public distribution_3d_destroy(dist)
Destroy a 3d distribution.
subroutine, public create_tensor_batches(sizes, nbatches, starts_array, ends_array, starts_array_block, ends_array_block)
...
subroutine, public create_3c_tensor(t3c, dist_1, dist_2, dist_3, pgrid, sizes_1, sizes_2, sizes_3, map1, map2, name)
...
Utilities for string manipulations.
subroutine, public compress(string, full)
Eliminate multiple space characters in a string. If full is .TRUE., then all spaces are eliminated.
This module computes the basic integrals for the truncated coulomb operator.
subroutine, public free_c0()
...
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
represent a pointer to a 1d array
type of a logger, at the moment it contains just a print level starting at which level it should be l...
stores some data used in construction of Kohn-Sham matrix
stores all the informations relevant to an mpi environment
Provides all information about a quickstep kind.