44 dbt_create, dbt_default_distvec, dbt_destroy, dbt_distribution_destroy, &
45 dbt_distribution_new, dbt_distribution_type, dbt_mp_dims_create, dbt_pgrid_create, &
46 dbt_pgrid_destroy, dbt_pgrid_type, dbt_type
94#include "./base/base_uses.f90"
116#define CACHE_SIZE 1024
117#define BITS_MAX_VAL 6
119 CHARACTER(LEN=*),
PARAMETER,
PRIVATE :: moduleN =
'hfx_types'
124 REAL(kind=
dp),
DIMENSION(0:10), &
125 PARAMETER,
PUBLIC ::
mul_fact = [1.0_dp, &
141 REAL(
dp) :: eps_schwarz = 0.0_dp
142 REAL(
dp) :: eps_schwarz_forces = 0.0_dp
143 LOGICAL :: do_p_screening_forces = .false.
144 LOGICAL :: do_initial_p_screening = .false.
149 INTEGER :: max_memory = 0
150 INTEGER(int_8) :: max_compression_counter = 0_int_8
151 INTEGER(int_8) :: final_comp_counter_energy = 0_int_8
152 LOGICAL :: do_all_on_the_fly = .false.
153 REAL(
dp) :: eps_storage_scaling = 0.0_dp
154 INTEGER :: cache_size = 0
155 INTEGER :: bits_max_val = 0
156 INTEGER :: actual_memory_usage = 0
157 INTEGER :: actual_memory_usage_disk = 0
158 INTEGER(int_8) :: max_compression_counter_disk = 0_int_8
159 LOGICAL :: do_disk_storage = .false.
160 CHARACTER(LEN=default_path_length) :: storage_location =
""
161 INTEGER(int_8) :: ram_counter = 0_int_8
162 INTEGER(int_8) :: ram_counter_forces = 0_int_8
163 INTEGER(int_8) :: size_p_screen = 0_int_8
164 LOGICAL :: treat_forces_in_core = .false.
165 LOGICAL :: recalc_forces = .false.
169 TYPE hfx_periodic_type
170 INTEGER :: number_of_shells = -1
171 LOGICAL :: do_periodic = .false.
172 INTEGER :: perd(3) = -1
174 REAL(
dp) :: r_max_stress = 0.0_dp
175 INTEGER :: number_of_shells_from_input = 0
176 END TYPE hfx_periodic_type
181 INTEGER :: block_size = 0
182 INTEGER :: nblocks = 0
183 LOGICAL :: rtp_redistribute = .false.
184 LOGICAL :: blocks_initialized = .false.
185 LOGICAL :: do_randomize = .false.
190 REAL(
dp) :: fraction = 0.0_dp
191 INTEGER :: hfx_library = 0
192 LOGICAL :: treat_lsd_in_core = .false.
197 INTEGER(int_8) :: istart = 0_int_8
198 INTEGER(int_8) :: number_of_atom_quartets = 0_int_8
199 INTEGER(int_8) :: cost = 0_int_8
200 REAL(kind=
dp) :: time_first_scf = 0.0_dp
201 REAL(kind=
dp) :: time_other_scf = 0.0_dp
202 REAL(kind=
dp) :: time_forces = 0.0_dp
203 INTEGER(int_8) :: ram_counter = 0_int_8
208 INTEGER,
DIMENSION(2) :: pair = 0
209 INTEGER,
DIMENSION(2) :: set_bounds = 0
210 INTEGER,
DIMENSION(2) :: kind_pair = 0
211 REAL(kind=
dp) :: r1(3) = 0.0_dp, r2(3) = 0.0_dp
212 REAL(kind=
dp) :: dist2 = 0.0_dp
217 INTEGER,
DIMENSION(2) :: pair = 0
223 INTEGER :: n_element = 0
228 INTEGER(int_8),
DIMENSION(CACHE_SIZE) :: data = 0_int_8
229 INTEGER :: element_counter = 0
234 REAL(
dp),
DIMENSION(CACHE_SIZE) :: data = 0.0_dp
235 INTEGER :: element_counter = 0
239 TYPE hfx_container_node
240 TYPE(hfx_container_node),
POINTER :: next => null(), prev => null()
241 INTEGER(int_8),
DIMENSION(CACHE_SIZE) :: data = 0_int_8
242 END TYPE hfx_container_node
246 TYPE(hfx_container_node),
POINTER :: first => null(), current => null()
247 INTEGER :: element_counter = 0
248 INTEGER(int_8) :: file_counter = 0
249 CHARACTER(LEN=5) :: desc =
""
251 CHARACTER(default_path_length) :: filename =
""
256 INTEGER,
DIMENSION(:),
POINTER :: lmax => null()
257 INTEGER,
DIMENSION(:),
POINTER :: lmin => null()
258 INTEGER,
DIMENSION(:),
POINTER :: npgf => null()
260 REAL(
dp),
DIMENSION(:, :),
POINTER :: zet => null()
261 INTEGER,
DIMENSION(:),
POINTER :: nsgf => null()
262 INTEGER,
DIMENSION(:, :),
POINTER :: first_sgf => null()
263 REAL(
dp),
DIMENSION(:, :),
POINTER :: sphi => null()
264 INTEGER :: nsgf_total = 0
265 INTEGER,
DIMENSION(:, :),
POINTER :: nl => null()
266 INTEGER,
DIMENSION(:, :),
POINTER :: nsgfl => null()
267 INTEGER,
DIMENSION(:),
POINTER :: nshell => null()
269 REAL(
dp),
DIMENSION(:, :, :),
POINTER :: gcc => null()
270 REAL(
dp),
DIMENSION(:),
POINTER :: set_radius => null()
271 REAL(
dp),
DIMENSION(:, :),
POINTER :: pgf_radius => null()
272 REAL(
dp) :: kind_radius = 0.0_dp
277 INTEGER :: max_set = 0
278 INTEGER :: max_sgf = 0
279 INTEGER :: max_am = 0
284 REAL(
dp),
DIMENSION(:, :, :, :),
POINTER :: p_kind => null()
289 INTEGER,
DIMENSION(:),
POINTER :: iatom_list => null()
290 INTEGER,
DIMENSION(:),
POINTER :: jatom_list => null()
295 INTEGER :: istart = 0, iend = 0
296 INTEGER(int_8) :: cost = 0_int_8
301 INTEGER :: thread_id = 0
302 INTEGER :: bin_id = 0
303 INTEGER(int_8) :: cost = 0_int_8
308 POINTER :: maxval_container => null()
310 POINTER :: maxval_cache => null()
312 POINTER :: integral_containers => null()
314 POINTER :: integral_caches => null()
319 DIMENSION(:) :: integral_containers_disk => null()
323 INTEGER,
DIMENSION(:, :),
ALLOCATABLE :: ind
328 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, &
329 eps_lanczos = 0.0_dp, eps_pgf_orb = 0.0_dp, eps_eigval = 0.0_dp, kp_ri_range = 0.0_dp, &
330 kp_image_range = 0.0_dp, kp_bump_rad = 0.0_dp
331 INTEGER :: t2c_sqrt_order = 0, max_iter_lanczos = 0, flavor = 0, unit_nr_dbcsr = -1, unit_nr = -1, &
332 min_bsize = 0, max_bsize_mo = 0, t2c_method = 0, nelectron_total = 0, input_flavor = 0, &
333 ncell_ri = 0, nimg = 0, kp_stack_size = 0, nimg_nze = 0, kp_ngroups = 1
334 LOGICAL :: check_2c_inv = .false., calc_condnum = .false.
340 LOGICAL :: explicit_hfx_cutoff = .false.
341 REAL(kind=
dp) :: eps_schwarz = 0.0_dp
342 REAL(kind=
dp) :: eps_schwarz_forces = 0.0_dp
344 LOGICAL :: same_op = .false.
347 TYPE(dbt_pgrid_type),
POINTER :: pgrid => null()
348 TYPE(dbt_pgrid_type),
POINTER :: pgrid_2d => null()
352 TYPE(dbt_distribution_type) :: dist
355 INTEGER,
DIMENSION(:),
ALLOCATABLE :: bsizes_ri, bsizes_ao, bsizes_ri_split, bsizes_ao_split, &
356 bsizes_ri_fit, bsizes_ao_fit
359 INTEGER,
DIMENSION(:),
ALLOCATABLE :: img_to_ri_cell, present_images, idx_to_img, img_to_idx, &
363 REAL(
dp),
DIMENSION(:, :, :),
ALLOCATABLE :: kp_cost
371 TYPE(dbt_type),
DIMENSION(:),
ALLOCATABLE :: kp_t_3c_g_sub
372 INTEGER,
ALLOCATABLE :: kp_g_to_ri(:, :), kp_ri_atom(:)
373 LOGICAL,
ALLOCATABLE :: kp_ri_neighbors(:, :)
374 INTEGER :: kp_g_ngroups = 0
377 TYPE(dbt_type),
DIMENSION(:),
ALLOCATABLE :: kp_t_3c_int
383 TYPE(dbt_type),
DIMENSION(:, :),
ALLOCATABLE :: rho_ao_t, ks_t
386 TYPE(dbt_type),
DIMENSION(:, :),
ALLOCATABLE :: t_2c_inv
387 TYPE(dbt_type),
DIMENSION(:, :),
ALLOCATABLE :: t_2c_pot
390 TYPE(
dbcsr_type),
DIMENSION(:, :),
ALLOCATABLE :: kp_mat_2c_pot
393 TYPE(dbt_type),
DIMENSION(:, :),
ALLOCATABLE :: t_2c_int
396 TYPE(dbt_type),
DIMENSION(:, :),
ALLOCATABLE :: t_3c_int_ctr_1
398 TYPE(dbt_pgrid_type),
POINTER :: pgrid_1 => null()
401 TYPE(dbt_type),
DIMENSION(:, :),
ALLOCATABLE :: t_3c_int_ctr_2
402 TYPE(dbt_pgrid_type),
POINTER :: pgrid_2 => null()
405 TYPE(dbt_type),
DIMENSION(:, :),
ALLOCATABLE :: t_3c_int_ctr_3
408 TYPE(dbt_type),
DIMENSION(:, :, :),
ALLOCATABLE :: t_3c_int_mo
409 TYPE(dbt_type),
DIMENSION(:, :, :),
ALLOCATABLE :: t_3c_ctr_ri
410 TYPE(dbt_type),
DIMENSION(:, :, :),
ALLOCATABLE :: t_3c_ctr_ks
411 TYPE(dbt_type),
DIMENSION(:, :, :),
ALLOCATABLE :: t_3c_ctr_ks_copy
419 CHARACTER(LEN=default_string_length) :: orb_basis_type =
"", ri_basis_type =
""
422 INTEGER :: n_mem_input = 0, n_mem = 0, n_mem_ri = 0, n_mem_flavor_switch = 0
425 INTEGER,
DIMENSION(:),
ALLOCATABLE :: starts_array_mem_block, ends_array_mem_block
426 INTEGER,
DIMENSION(:),
ALLOCATABLE :: starts_array_mem, ends_array_mem
428 INTEGER,
DIMENSION(:),
ALLOCATABLE :: starts_array_ri_mem_block, ends_array_ri_mem_block
429 INTEGER,
DIMENSION(:),
ALLOCATABLE :: starts_array_ri_mem, ends_array_ri_mem
431 INTEGER(int_8) :: dbcsr_nflop = 0_int_8
432 REAL(
dp) :: dbcsr_time = 0.0_dp
433 INTEGER :: num_pe = 0
474 TYPE(hfx_potential_type) :: potential_parameter = hfx_potential_type()
477 TYPE(hfx_periodic_type) :: periodic_parameter = hfx_periodic_type()
484 TYPE(hfx_cell_type),
DIMENSION(:), &
485 POINTER :: neighbor_cells => null()
487 POINTER :: distribution_energy => null()
489 POINTER :: distribution_forces => null()
490 INTEGER,
DIMENSION(:, :),
POINTER :: is_assoc_atomic_block => null()
491 INTEGER :: number_of_p_entries = 0
493 POINTER :: basis_parameter => null()
494 INTEGER :: n_rep_hf = 0
495 LOGICAL :: b_first_load_balance_energy = .false., &
496 b_first_load_balance_forces = .false.
497 REAL(
dp),
DIMENSION(:, :),
POINTER :: full_ks_alpha => null()
498 REAL(
dp),
DIMENSION(:, :),
POINTER :: full_ks_beta => null()
501 TYPE(hfx_screen_coeff_type), &
502 DIMENSION(:, :, :, :, :, :),
POINTER :: screen_funct_coeffs_pgf => null(), &
503 pair_dist_radii_pgf => null()
504 TYPE(hfx_screen_coeff_type), &
505 DIMENSION(:, :, :, :),
POINTER :: screen_funct_coeffs_set => null()
506 TYPE(hfx_screen_coeff_type), &
507 DIMENSION(:, :),
POINTER :: screen_funct_coeffs_kind => null()
508 LOGICAL :: screen_funct_is_initialized = .false.
509 TYPE(
hfx_p_kind),
DIMENSION(:),
POINTER :: initial_p => null()
510 TYPE(
hfx_p_kind),
DIMENSION(:),
POINTER :: initial_p_forces => null()
511 INTEGER,
DIMENSION(:),
POINTER :: map_atom_to_kind_atom => null()
512 TYPE(
hfx_2d_map),
DIMENSION(:),
POINTER :: map_atoms_to_cpus => null()
513 INTEGER,
DIMENSION(:, :),
POINTER :: atomic_block_offset => null()
514 INTEGER,
DIMENSION(:, :, :, :),
POINTER :: set_offset => null()
515 INTEGER,
DIMENSION(:),
POINTER :: block_offset => null()
517 POINTER :: blocks => null()
519 POINTER :: task_list => null()
520 REAL(
dp),
DIMENSION(:, :),
POINTER :: pmax_atom => null(), pmax_atom_forces => null()
521 REAL(
dp),
DIMENSION(:, :),
POINTER :: pmax_block => null()
522 LOGICAL,
DIMENSION(:, :),
POINTER :: atomic_pair_list => null()
523 LOGICAL,
DIMENSION(:, :),
POINTER :: atomic_pair_list_forces => null()
524 LOGICAL :: do_hfx_ri = .false.
528 LOGICAL :: use_ace = .false.
529 INTEGER :: ace_rebuild_freq = 20
532 LOGICAL :: ace_is_built = .false.
533 INTEGER :: ace_build_counter = 0
562 SUBROUTINE hfx_create(x_data, para_env, hfx_section, atomic_kind_set, qs_kind_set, &
563 particle_set, dft_control, cell, orb_basis, ri_basis, &
564 nelectron_total, nkp_grid)
565 TYPE(
hfx_type),
DIMENSION(:, :),
POINTER :: x_data
569 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
573 CHARACTER(LEN=*),
OPTIONAL :: orb_basis, ri_basis
574 INTEGER,
OPTIONAL :: nelectron_total
575 INTEGER,
DIMENSION(3),
OPTIONAL :: nkp_grid
577 CHARACTER(LEN=*),
PARAMETER :: routinen =
'hfx_create'
579 CHARACTER(LEN=512) :: error_msg
580 CHARACTER(LEN=default_path_length) :: char_val
581 CHARACTER(LEN=default_string_length) :: orb_basis_type, ri_basis_type
582 INTEGER :: handle, i, i_thread, iatom, ikind, int_val, irep, jkind, max_set, n_rep_hf, &
583 n_threads, natom, natom_a, natom_b, nkind, nseta, nsetb, pbc_shells, storage_id
584 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: atom2kind, kind_of
585 LOGICAL :: do_ri, explicit, logic_val
587 TYPE(
hfx_type),
POINTER :: actual_x_data
591 CALL timeset(routinen, handle)
596 natom =
SIZE(particle_set)
604 IF (do_ri) n_threads = 1
606 IF (
PRESENT(orb_basis))
THEN
607 orb_basis_type = orb_basis
609 orb_basis_type =
"ORB"
611 IF (
PRESENT(ri_basis))
THEN
612 ri_basis_type = ri_basis
614 ri_basis_type =
"RI_HFX"
617 ALLOCATE (x_data(n_rep_hf, n_threads))
618 DO i_thread = 1, n_threads
619 DO irep = 1, n_rep_hf
620 actual_x_data => x_data(irep, i_thread)
625 actual_x_data%general_parameter%fraction = real_val
626 actual_x_data%n_rep_hf = n_rep_hf
628 NULLIFY (actual_x_data%map_atoms_to_cpus)
630 CALL section_vals_val_get(hfx_section,
"TREAT_LSD_IN_CORE", l_val=logic_val, i_rep_section=irep)
631 actual_x_data%general_parameter%treat_lsd_in_core = logic_val
634 actual_x_data%general_parameter%hfx_library = int_val
637 CALL section_vals_val_get(hfx_ri_section,
"_SECTION_PARAMETERS_", l_val=actual_x_data%do_hfx_ri)
641 CALL parse_memory_section(actual_x_data%memory_parameter, hf_sub_section, storage_id, i_thread, &
642 n_threads, para_env, irep, skip_disk=.false., skip_in_core_forces=.false.)
647 actual_x_data%periodic_parameter%number_of_shells = int_val
648 actual_x_data%periodic_parameter%mode = int_val
649 CALL get_cell(cell=cell, periodic=actual_x_data%periodic_parameter%perd)
650 IF (sum(actual_x_data%periodic_parameter%perd) == 0)
THEN
651 actual_x_data%periodic_parameter%do_periodic = .false.
653 actual_x_data%periodic_parameter%do_periodic = .true.
659 actual_x_data%screening_parameter%eps_schwarz = real_val
660 CALL section_vals_val_get(hf_sub_section,
"EPS_SCHWARZ_FORCES", r_val=real_val, explicit=explicit)
662 actual_x_data%screening_parameter%eps_schwarz_forces = real_val
664 actual_x_data%screening_parameter%eps_schwarz_forces = &
665 100._dp*actual_x_data%screening_parameter%eps_schwarz
668 actual_x_data%screening_parameter%do_p_screening_forces = logic_val
670 actual_x_data%screening_parameter%do_initial_p_screening = logic_val
671 actual_x_data%screen_funct_is_initialized = .false.
676 actual_x_data%potential_parameter%potential_type = int_val
678 actual_x_data%potential_parameter%omega = real_val
680 actual_x_data%potential_parameter%scale_coulomb = real_val
682 actual_x_data%potential_parameter%scale_longrange = real_val
684 actual_x_data%potential_parameter%scale_gaussian = real_val
688 actual_x_data%potential_parameter%cutoff_radius = real_val
693 WRITE (error_msg,
'(A,A,A)')
"Truncated hfx calculation requested. The file containing "// &
694 "the data could not be found at ", trim(char_val),
" Please check T_C_G_DATA "// &
695 "in the INTERACTION_POTENTIAL section"
698 actual_x_data%potential_parameter%filename = char_val
702 CALL erfc_cutoff(actual_x_data%screening_parameter%eps_schwarz, &
703 actual_x_data%potential_parameter%omega, &
704 actual_x_data%potential_parameter%cutoff_radius)
708 IF (real_val < actual_x_data%potential_parameter%cutoff_radius .AND. &
709 i_thread == 1 .AND. irep == 1)
THEN
710 WRITE (error_msg,
'(A,F6.3,A,ES8.1,A,F6.3,A,F6.3,A)') &
711 "Periodic Hartree Fock calculation requested with the use "// &
712 "of a shortrange potential erfc(omega*r)/r. Given omega = ", &
713 actual_x_data%potential_parameter%omega,
" and EPS_SCHWARZ = ", &
714 actual_x_data%screening_parameter%eps_schwarz,
", the requested "// &
715 "cutoff radius ", real_val*
a_bohr*1e+10_dp,
" A is smaller than "// &
716 "what is necessary to satisfy erfc(omega*r)/r = EPS_SCHWARZ at r = ", &
717 actual_x_data%potential_parameter%cutoff_radius*
a_bohr*1e+10_dp, &
718 " A. Increase input value (or omit keyword to use program default) "// &
719 "to ensure accuracy."
722 actual_x_data%potential_parameter%cutoff_radius = real_val
725 IF (actual_x_data%potential_parameter%potential_type ==
do_potential_id)
THEN
726 actual_x_data%potential_parameter%cutoff_radius = 0.0_dp
732 actual_x_data%load_balance_parameter%nbins = max(1, int_val)
733 actual_x_data%load_balance_parameter%blocks_initialized = .false.
736 actual_x_data%load_balance_parameter%do_randomize = logic_val
738 actual_x_data%load_balance_parameter%rtp_redistribute = .false.
739 IF (
ASSOCIATED(dft_control%rtp_control))
THEN
740 actual_x_data%load_balance_parameter%rtp_redistribute = dft_control%rtp_control%hfx_redistribute
745 IF (int_val <= 0)
THEN
747 int_val = ceiling(0.1_dp*natom/ &
748 REAL(actual_x_data%load_balance_parameter%nbins*n_threads*para_env%num_pe, kind=
dp)**(0.25_dp))
751 actual_x_data%load_balance_parameter%block_size = min(
max_atom_block, max(1, int_val))
853 IF (actual_x_data%periodic_parameter%do_periodic)
THEN
856 actual_x_data%periodic_parameter%number_of_shells_from_input = pbc_shells
857 ALLOCATE (actual_x_data%neighbor_cells(1))
860 ALLOCATE (actual_x_data%neighbor_cells(1))
862 actual_x_data%periodic_parameter%R_max_stress = 1.0_dp
865 nkind =
SIZE(qs_kind_set, 1)
866 max_set = actual_x_data%basis_info%max_set
869 IF (i_thread == 1)
THEN
870 ALLOCATE (actual_x_data%is_assoc_atomic_block(natom, natom))
871 ALLOCATE (actual_x_data%atomic_block_offset(natom, natom))
872 ALLOCATE (actual_x_data%set_offset(max_set, max_set, nkind, nkind))
873 ALLOCATE (actual_x_data%block_offset(para_env%num_pe + 1))
876 ALLOCATE (actual_x_data%distribution_forces(1))
877 ALLOCATE (actual_x_data%distribution_energy(1))
879 actual_x_data%memory_parameter%size_p_screen = 0_int_8
880 IF (i_thread == 1)
THEN
881 ALLOCATE (actual_x_data%atomic_pair_list(natom, natom))
882 ALLOCATE (actual_x_data%atomic_pair_list_forces(natom, natom))
885 IF (actual_x_data%screening_parameter%do_initial_p_screening .OR. &
886 actual_x_data%screening_parameter%do_p_screening_forces)
THEN
888 IF (i_thread == 1)
THEN
889 ALLOCATE (actual_x_data%pmax_atom(natom, natom))
890 ALLOCATE (actual_x_data%initial_p(nkind*(nkind + 1)/2))
894 nseta = actual_x_data%basis_parameter(ikind)%nset
895 DO jkind = ikind, nkind
897 nsetb = actual_x_data%basis_parameter(jkind)%nset
898 ALLOCATE (actual_x_data%initial_p(i)%p_kind(nseta, nsetb, natom_a, natom_b))
899 actual_x_data%memory_parameter%size_p_screen = &
900 actual_x_data%memory_parameter%size_p_screen + nseta*nsetb*natom_a*natom_b
905 ALLOCATE (actual_x_data%pmax_atom_forces(natom, natom))
906 ALLOCATE (actual_x_data%initial_p_forces(nkind*(nkind + 1)/2))
910 nseta = actual_x_data%basis_parameter(ikind)%nset
911 DO jkind = ikind, nkind
913 nsetb = actual_x_data%basis_parameter(jkind)%nset
914 ALLOCATE (actual_x_data%initial_p_forces(i)%p_kind(nseta, nsetb, natom_a, natom_b))
915 actual_x_data%memory_parameter%size_p_screen = &
916 actual_x_data%memory_parameter%size_p_screen + nseta*nsetb*natom_a*natom_b
921 ALLOCATE (actual_x_data%map_atom_to_kind_atom(natom))
924 ALLOCATE (atom2kind(nkind))
927 ikind = kind_of(iatom)
928 atom2kind(ikind) = atom2kind(ikind) + 1
929 actual_x_data%map_atom_to_kind_atom(iatom) = atom2kind(ikind)
931 DEALLOCATE (kind_of, atom2kind)
939 actual_x_data%store_ints%maxval_cache_disk%element_counter = 1
940 ALLOCATE (actual_x_data%store_ints%maxval_container_disk)
941 ALLOCATE (actual_x_data%store_ints%maxval_container_disk%first)
942 actual_x_data%store_ints%maxval_container_disk%first%prev => null()
943 actual_x_data%store_ints%maxval_container_disk%first%next => null()
944 actual_x_data%store_ints%maxval_container_disk%current => actual_x_data%store_ints%maxval_container_disk%first
945 actual_x_data%store_ints%maxval_container_disk%current%data = 0
946 actual_x_data%store_ints%maxval_container_disk%element_counter = 1
947 actual_x_data%store_ints%maxval_container_disk%file_counter = 1
948 actual_x_data%store_ints%maxval_container_disk%desc =
'Max_'
949 actual_x_data%store_ints%maxval_container_disk%unit = -1
950 WRITE (actual_x_data%store_ints%maxval_container_disk%filename,
'(A,I0,A,A,A)') &
951 trim(actual_x_data%memory_parameter%storage_location), &
952 storage_id,
"_", actual_x_data%store_ints%maxval_container_disk%desc,
"6"
953 CALL compress(actual_x_data%store_ints%maxval_container_disk%filename, .true.)
954 ALLOCATE (actual_x_data%store_ints%integral_containers_disk(64))
956 actual_x_data%store_ints%integral_caches_disk(i)%element_counter = 1
957 actual_x_data%store_ints%integral_caches_disk(i)%data = 0
958 ALLOCATE (actual_x_data%store_ints%integral_containers_disk(i)%first)
959 actual_x_data%store_ints%integral_containers_disk(i)%first%prev => null()
960 actual_x_data%store_ints%integral_containers_disk(i)%first%next => null()
961 actual_x_data%store_ints%integral_containers_disk(i)%current => &
962 actual_x_data%store_ints%integral_containers_disk(i)%first
963 actual_x_data%store_ints%integral_containers_disk(i)%current%data = 0
964 actual_x_data%store_ints%integral_containers_disk(i)%element_counter = 1
965 actual_x_data%store_ints%integral_containers_disk(i)%file_counter = 1
966 actual_x_data%store_ints%integral_containers_disk(i)%desc =
'Int_'
967 actual_x_data%store_ints%integral_containers_disk(i)%unit = -1
968 WRITE (actual_x_data%store_ints%integral_containers_disk(i)%filename,
'(A,I0,A,A,I0)') &
969 trim(actual_x_data%memory_parameter%storage_location), &
970 storage_id,
"_", actual_x_data%store_ints%integral_containers_disk(i)%desc, i
971 CALL compress(actual_x_data%store_ints%integral_containers_disk(i)%filename, .true.)
974 actual_x_data%b_first_load_balance_energy = .true.
975 actual_x_data%b_first_load_balance_forces = .true.
978 IF (actual_x_data%do_hfx_ri)
THEN
979 cpassert(
PRESENT(nelectron_total))
980 ALLOCATE (actual_x_data%ri_data)
981 CALL hfx_ri_init_read_input_from_hfx(actual_x_data%ri_data, actual_x_data, hfx_section, &
982 hf_sub_section, qs_kind_set, &
983 particle_set, atomic_kind_set, dft_control, para_env, irep, &
984 nelectron_total, orb_basis_type, ri_basis_type)
988 IF (i_thread == 1)
THEN
994 l_val=actual_x_data%use_ace)
996 i_val=actual_x_data%ace_rebuild_freq)
999 IF (actual_x_data%use_ace)
THEN
1001 IF (actual_x_data%general_parameter%fraction <= 0.0_dp)
THEN
1002 cpabort(
"ACE requires FRACTION > 0.")
1005 IF (actual_x_data%ace_rebuild_freq < 1)
THEN
1006 cpabort(
"ACE: REBUILD_FREQUENCY must be >= 1")
1013 DO irep = 1, n_rep_hf
1014 actual_x_data => x_data(irep, 1)
1015 CALL hfx_print_info(actual_x_data, hfx_section, irep)
1018 CALL timestop(handle)
1038 SUBROUTINE hfx_ri_init_read_input_from_hfx(ri_data, x_data, hfx_section, ri_section, qs_kind_set, &
1039 particle_set, atomic_kind_set, dft_control, para_env, irep, &
1040 nelectron_total, orb_basis_type, ri_basis_type)
1042 TYPE(
hfx_type),
INTENT(INOUT) :: x_data
1044 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1049 INTEGER,
INTENT(IN) :: irep, nelectron_total
1050 CHARACTER(LEN=*) :: orb_basis_type, ri_basis_type
1052 CHARACTER(LEN=*),
PARAMETER :: routinen =
'hfx_ri_init_read_input_from_hfx'
1054 CHARACTER(LEN=512) :: error_msg
1055 CHARACTER(LEN=default_path_length) :: char_val, t_c_filename
1056 INTEGER :: handle, unit_nr, unit_nr_dbcsr
1060 CALL timeset(routinen, handle)
1062 NULLIFY (hf_sub_section)
1064 ri_data%hfx_pot = x_data%potential_parameter
1065 ri_data%ri_section => ri_section
1066 ri_data%hfx_section => hfx_section
1067 ri_data%eps_schwarz = x_data%screening_parameter%eps_schwarz
1068 ri_data%eps_schwarz_forces = x_data%screening_parameter%eps_schwarz_forces
1072 extension=
".dbcsrLog")
1075 extension=
".scfLog")
1078 CALL section_vals_val_get(hf_sub_section,
"CUTOFF_RADIUS", explicit=ri_data%explicit_hfx_cutoff)
1083 WRITE (error_msg,
'(A,A,A)')
"File not found. Please check T_C_G_DATA "// &
1084 "in the INTERACTION_POTENTIAL section"
1087 t_c_filename = char_val
1090 CALL hfx_ri_init_read_input(ri_data, ri_section, qs_kind_set, particle_set, atomic_kind_set, &
1091 orb_basis_type, ri_basis_type, para_env, unit_nr, unit_nr_dbcsr, &
1092 nelectron_total, t_c_filename=t_c_filename)
1094 IF (dft_control%smear .AND. ri_data%flavor ==
ri_mo)
THEN
1095 cpabort(
"RI_FLAVOR MO is not consistent with smearing. Please use RI_FLAVOR RHO.")
1098 CALL timestop(handle)
1100 END SUBROUTINE hfx_ri_init_read_input_from_hfx
1117 SUBROUTINE hfx_ri_init_read_input(ri_data, ri_section, qs_kind_set, &
1118 particle_set, atomic_kind_set, orb_basis_type, ri_basis_type, para_env, &
1119 unit_nr, unit_nr_dbcsr, nelectron_total, t_c_filename)
1122 TYPE(
qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1125 CHARACTER(LEN=*),
INTENT(IN) :: orb_basis_type, ri_basis_type
1127 INTEGER,
INTENT(IN) :: unit_nr, unit_nr_dbcsr, nelectron_total
1128 CHARACTER(LEN=*),
INTENT(IN),
OPTIONAL :: t_c_filename
1130 CHARACTER(LEN=*),
PARAMETER :: routinen =
'hfx_ri_init_read_input'
1133 LOGICAL :: explicit, explicit_ri_cutoff
1134 REAL(
dp) :: eps_storage_scaling
1136 CALL timeset(routinen, handle)
1141 ri_data%filter_eps_storage = ri_data%filter_eps*eps_storage_scaling
1144 associate(ri_metric => ri_data%ri_metric, hfx_pot => ri_data%hfx_pot)
1145 CALL section_vals_val_get(ri_section,
"RI_METRIC", i_val=ri_metric%potential_type, explicit=explicit)
1146 IF (.NOT. explicit .OR. ri_metric%potential_type == 0)
THEN
1147 ri_metric%potential_type = hfx_pot%potential_type
1151 IF (.NOT. explicit)
THEN
1152 ri_metric%omega = hfx_pot%omega
1155 CALL section_vals_val_get(ri_section,
"CUTOFF_RADIUS", r_val=ri_metric%cutoff_radius, explicit=explicit_ri_cutoff)
1156 IF (.NOT. explicit_ri_cutoff)
THEN
1158 CALL erfc_cutoff(ri_data%eps_schwarz, ri_metric%omega, ri_metric%cutoff_radius)
1160 ri_metric%cutoff_radius = hfx_pot%cutoff_radius
1164 CALL section_vals_val_get(ri_section,
"SCALE_COULOMB", r_val=ri_metric%scale_coulomb, explicit=explicit)
1165 IF (.NOT. explicit)
THEN
1166 ri_metric%scale_coulomb = hfx_pot%scale_coulomb
1169 CALL section_vals_val_get(ri_section,
"SCALE_LONGRANGE", r_val=ri_metric%scale_longrange, explicit=explicit)
1170 IF (.NOT. explicit)
THEN
1171 ri_metric%scale_longrange = hfx_pot%scale_longrange
1174 IF (ri_metric%potential_type ==
do_potential_id) ri_metric%cutoff_radius = 0.0_dp
1175 IF (hfx_pot%potential_type ==
do_potential_short .AND. .NOT. ri_data%explicit_hfx_cutoff)
THEN
1177 CALL erfc_cutoff(ri_data%filter_eps_2c, hfx_pot%omega, hfx_pot%cutoff_radius)
1182 (explicit_ri_cutoff .OR. ri_data%explicit_hfx_cutoff))
THEN
1184 ri_data%same_op = ri_data%same_op .AND. ri_metric%cutoff_radius == hfx_pot%cutoff_radius
1200 CALL section_vals_val_get(ri_section,
"FLAVOR_SWITCH_MEMORY_CUT", i_val=ri_data%n_mem_flavor_switch)
1202 ri_data%orb_basis_type = orb_basis_type
1203 ri_data%ri_basis_type = ri_basis_type
1204 ri_data%nelectron_total = nelectron_total
1205 ri_data%input_flavor = ri_data%flavor
1207 IF (
PRESENT(t_c_filename))
THEN
1208 ri_data%ri_metric%filename = t_c_filename
1209 ri_data%hfx_pot%filename = t_c_filename
1212 ri_data%unit_nr_dbcsr = unit_nr_dbcsr
1213 ri_data%unit_nr = unit_nr
1214 ri_data%dbcsr_nflop = 0
1215 ri_data%dbcsr_time = 0.0_dp
1217 CALL hfx_ri_init(ri_data, qs_kind_set, particle_set, atomic_kind_set, para_env)
1219 CALL timestop(handle)
1221 END SUBROUTINE hfx_ri_init_read_input
1231 SUBROUTINE hfx_ri_init(ri_data, qs_kind_set, particle_set, atomic_kind_set, para_env)
1233 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1234 TYPE(particle_type),
DIMENSION(:),
POINTER :: particle_set
1235 TYPE(atomic_kind_type),
DIMENSION(:),
POINTER :: atomic_kind_set
1236 TYPE(mp_para_env_type) :: para_env
1238 CHARACTER(LEN=*),
PARAMETER :: routinen =
'hfx_ri_init'
1240 INTEGER :: handle, i_mem, j_mem, mo_dim, natom, &
1242 INTEGER,
ALLOCATABLE,
DIMENSION(:) :: bsizes_ao_store, bsizes_ri_store, dist1, &
1243 dist2, dist3, dist_ao_1, dist_ao_2, &
1245 INTEGER,
DIMENSION(2) :: pdims_2d
1246 INTEGER,
DIMENSION(3) :: pdims
1247 TYPE(distribution_3d_type) :: dist_3d
1248 TYPE(gto_basis_set_p_type),
ALLOCATABLE, &
1249 DIMENSION(:) :: basis_set_ao, basis_set_ri
1250 TYPE(mp_cart_type) :: mp_comm_3d
1252 CALL cite_reference(bussy2023)
1254 CALL timeset(routinen, handle)
1256 natom =
SIZE(particle_set)
1257 nkind =
SIZE(qs_kind_set, 1)
1258 nproc = para_env%num_pe
1261 CALL mp_comm_3d%create(para_env, 3, pdims)
1263 ALLOCATE (ri_data%bsizes_RI(natom))
1264 ALLOCATE (ri_data%bsizes_AO(natom))
1265 ALLOCATE (basis_set_ri(nkind), basis_set_ao(nkind))
1266 CALL basis_set_list_setup(basis_set_ri, ri_data%ri_basis_type, qs_kind_set)
1267 CALL get_particle_set(particle_set, qs_kind_set, nsgf=ri_data%bsizes_RI, basis=basis_set_ri)
1268 CALL basis_set_list_setup(basis_set_ao, ri_data%orb_basis_type, qs_kind_set)
1269 CALL get_particle_set(particle_set, qs_kind_set, nsgf=ri_data%bsizes_AO, basis=basis_set_ao)
1271 ALLOCATE (dist_ri(natom))
1272 ALLOCATE (dist_ao_1(natom))
1273 ALLOCATE (dist_ao_2(natom))
1274 CALL dbt_default_distvec(natom, pdims(1), ri_data%bsizes_RI, dist_ri)
1275 CALL dbt_default_distvec(natom, pdims(2), ri_data%bsizes_AO, dist_ao_1)
1276 CALL dbt_default_distvec(natom, pdims(3), ri_data%bsizes_AO, dist_ao_2)
1277 CALL distribution_3d_create(dist_3d, dist_ri, dist_ao_1, dist_ao_2, nkind, particle_set, &
1278 mp_comm_3d, own_comm=.true.)
1280 ALLOCATE (ri_data%pgrid)
1281 CALL dbt_pgrid_create(para_env, pdims, ri_data%pgrid)
1283 ALLOCATE (ri_data%pgrid_2d)
1285 CALL dbt_pgrid_create(para_env, pdims_2d, ri_data%pgrid_2d)
1287 ri_data%dist_3d = dist_3d
1289 CALL dbt_distribution_new(ri_data%dist, ri_data%pgrid, &
1290 dist_ri, dist_ao_1, dist_ao_2)
1292 DEALLOCATE (dist_ao_1, dist_ao_2, dist_ri)
1294 ri_data%num_pe = para_env%num_pe
1297 CALL pgf_block_sizes(atomic_kind_set, basis_set_ao, ri_data%min_bsize, ri_data%bsizes_AO_split)
1298 CALL pgf_block_sizes(atomic_kind_set, basis_set_ri, ri_data%min_bsize, ri_data%bsizes_RI_split)
1300 CALL pgf_block_sizes(atomic_kind_set, basis_set_ao, 1, bsizes_ao_store)
1301 CALL pgf_block_sizes(atomic_kind_set, basis_set_ri, 1, bsizes_ri_store)
1303 CALL split_block_sizes([sum(ri_data%bsizes_AO)], ri_data%bsizes_AO_fit, default_block_size)
1304 CALL split_block_sizes([sum(ri_data%bsizes_RI)], ri_data%bsizes_RI_fit, default_block_size)
1306 IF (ri_data%flavor == ri_pmat)
THEN
1309 ri_data%n_mem = ri_data%n_mem_input
1310 ri_data%n_mem_RI = ri_data%n_mem_input
1312 CALL create_tensor_batches(ri_data%bsizes_AO_split, ri_data%n_mem, ri_data%starts_array_mem, &
1313 ri_data%ends_array_mem, ri_data%starts_array_mem_block, &
1314 ri_data%ends_array_mem_block)
1316 CALL create_tensor_batches(ri_data%bsizes_RI_split, ri_data%n_mem_RI, &
1317 ri_data%starts_array_RI_mem, ri_data%ends_array_RI_mem, &
1318 ri_data%starts_array_RI_mem_block, ri_data%ends_array_RI_mem_block)
1320 ALLOCATE (ri_data%pgrid_1)
1321 ALLOCATE (ri_data%pgrid_2)
1324 CALL dbt_mp_dims_create(nproc, pdims, [
SIZE(ri_data%bsizes_AO_split),
SIZE(ri_data%bsizes_RI_split), &
1325 SIZE(ri_data%bsizes_AO_split)])
1327 CALL dbt_pgrid_create(para_env, pdims, ri_data%pgrid_1)
1329 pdims = pdims([2, 1, 3])
1330 CALL dbt_pgrid_create(para_env, pdims, ri_data%pgrid_2)
1332 ALLOCATE (ri_data%t_3c_int_ctr_1(1, 1))
1333 CALL create_3c_tensor(ri_data%t_3c_int_ctr_1(1, 1), dist1, dist2, dist3, &
1334 ri_data%pgrid_1, ri_data%bsizes_AO_split, ri_data%bsizes_RI_split, &
1335 ri_data%bsizes_AO_split, [1, 2], [3], name=
"(AO RI | AO)")
1336 DEALLOCATE (dist1, dist2, dist3)
1338 ALLOCATE (ri_data%blk_indices(ri_data%n_mem, ri_data%n_mem_RI))
1339 ALLOCATE (ri_data%store_3c(ri_data%n_mem, ri_data%n_mem_RI))
1340 DO i_mem = 1, ri_data%n_mem
1341 DO j_mem = 1, ri_data%n_mem_RI
1346 ALLOCATE (ri_data%t_3c_int_ctr_2(1, 1))
1347 CALL create_3c_tensor(ri_data%t_3c_int_ctr_2(1, 1), dist1, dist2, dist3, &
1348 ri_data%pgrid_1, ri_data%bsizes_AO_split, ri_data%bsizes_RI_split, &
1349 ri_data%bsizes_AO_split, [1, 2], [3], name=
"(AO RI | AO)")
1350 DEALLOCATE (dist1, dist2, dist3)
1352 ALLOCATE (ri_data%t_3c_int_ctr_3(1, 1))
1353 CALL create_3c_tensor(ri_data%t_3c_int_ctr_3(1, 1), dist1, dist2, dist3, &
1354 ri_data%pgrid_2, ri_data%bsizes_RI_split, ri_data%bsizes_AO_split, &
1355 ri_data%bsizes_AO_split, [1], [2, 3], name=
"(RI | AO AO)")
1356 DEALLOCATE (dist1, dist2, dist3)
1358 ALLOCATE (ri_data%t_2c_int(1, 1))
1359 CALL create_2c_tensor(ri_data%t_2c_int(1, 1), dist1, dist2, ri_data%pgrid_2d, &
1360 ri_data%bsizes_RI_split, ri_data%bsizes_RI_split, &
1362 DEALLOCATE (dist1, dist2)
1365 ALLOCATE (ri_data%rho_ao_t(2, 1))
1366 CALL create_2c_tensor(ri_data%rho_ao_t(1, 1), dist1, dist2, ri_data%pgrid_2d, &
1367 ri_data%bsizes_AO_split, ri_data%bsizes_AO_split, &
1369 DEALLOCATE (dist1, dist2)
1370 CALL dbt_create(ri_data%rho_ao_t(1, 1), ri_data%rho_ao_t(2, 1))
1372 ALLOCATE (ri_data%ks_t(2, 1))
1373 CALL create_2c_tensor(ri_data%ks_t(1, 1), dist1, dist2, ri_data%pgrid_2d, &
1374 ri_data%bsizes_AO_split, ri_data%bsizes_AO_split, &
1376 DEALLOCATE (dist1, dist2)
1377 CALL dbt_create(ri_data%ks_t(1, 1), ri_data%ks_t(2, 1))
1379 ELSE IF (ri_data%flavor == ri_mo)
THEN
1380 ALLOCATE (ri_data%t_2c_int(2, 1))
1382 CALL create_2c_tensor(ri_data%t_2c_int(1, 1), dist1, dist2, ri_data%pgrid_2d, &
1383 ri_data%bsizes_RI_fit, ri_data%bsizes_RI_fit, &
1385 CALL dbt_create(ri_data%t_2c_int(1, 1), ri_data%t_2c_int(2, 1))
1387 DEALLOCATE (dist1, dist2)
1389 ALLOCATE (ri_data%t_3c_int_ctr_1(1, 1))
1391 ALLOCATE (ri_data%pgrid_1)
1392 ALLOCATE (ri_data%pgrid_2)
1395 ri_data%n_mem = ri_data%n_mem_input**2
1396 IF (ri_data%n_mem > ri_data%nelectron_total/2) ri_data%n_mem = max(ri_data%nelectron_total/2, 1)
1401 mo_dim = max((ri_data%nelectron_total/2 - 1)/ri_data%n_mem + 1, 1)
1402 mo_dim = (mo_dim - 1)/ri_data%max_bsize_MO + 1
1405 CALL dbt_mp_dims_create(nproc, pdims, [
SIZE(ri_data%bsizes_AO_split),
SIZE(ri_data%bsizes_RI_split), mo_dim])
1407 CALL dbt_pgrid_create(para_env, pdims, ri_data%pgrid_1)
1409 pdims = pdims([3, 2, 1])
1410 CALL dbt_pgrid_create(para_env, pdims, ri_data%pgrid_2)
1412 CALL create_3c_tensor(ri_data%t_3c_int_ctr_1(1, 1), dist1, dist2, dist3, &
1413 ri_data%pgrid_1, ri_data%bsizes_AO_split, ri_data%bsizes_RI_split, ri_data%bsizes_AO_split, &
1414 [1, 2], [3], name=
"(AO RI | AO)")
1415 DEALLOCATE (dist1, dist2, dist3)
1417 ALLOCATE (ri_data%t_3c_int_ctr_2(1, 1))
1418 CALL create_3c_tensor(ri_data%t_3c_int_ctr_2(1, 1), dist1, dist2, dist3, &
1419 ri_data%pgrid_2, ri_data%bsizes_AO_split, ri_data%bsizes_RI_split, ri_data%bsizes_AO_split, &
1420 [1], [2, 3], name=
"(AO | RI AO)")
1421 DEALLOCATE (dist1, dist2, dist3)
1426 ALLOCATE (ri_data%t_2c_inv(1, 1))
1427 CALL create_2c_tensor(ri_data%t_2c_inv(1, 1), dist1, dist2, ri_data%pgrid_2d, &
1428 ri_data%bsizes_RI_split, ri_data%bsizes_RI_split, &
1430 DEALLOCATE (dist1, dist2)
1432 ALLOCATE (ri_data%t_2c_pot(1, 1))
1433 CALL create_2c_tensor(ri_data%t_2c_pot(1, 1), dist1, dist2, ri_data%pgrid_2d, &
1434 ri_data%bsizes_RI_split, ri_data%bsizes_RI_split, &
1436 DEALLOCATE (dist1, dist2)
1438 CALL timestop(handle)
1446 SUBROUTINE hfx_ri_write_stats(ri_data)
1449 REAL(dp) :: my_flop_rate
1451 associate(unit_nr => ri_data%unit_nr, dbcsr_nflop => ri_data%dbcsr_nflop, &
1452 dbcsr_time => ri_data%dbcsr_time, num_pe => ri_data%num_pe)
1453 my_flop_rate = real(dbcsr_nflop, dp)/(1.0e09_dp*ri_data%dbcsr_time)
1454 IF (unit_nr > 0)
WRITE (unit=unit_nr, fmt=
"(/T2,A,T73,ES8.2)") &
1455 "RI-HFX PERFORMANCE| DBT total number of flops:", real(dbcsr_nflop*num_pe, dp)
1456 IF (unit_nr > 0)
WRITE (unit=unit_nr, fmt=
"(T2,A,T66,F15.2)") &
1457 "RI-HFX PERFORMANCE| DBT total execution time:", dbcsr_time
1458 IF (unit_nr > 0)
WRITE (unit=unit_nr, fmt=
"(T2,A,T66,F15.2)") &
1459 "RI-HFX PERFORMANCE| DBT flop rate (Gflops / MPI rank):", my_flop_rate
1461 END SUBROUTINE hfx_ri_write_stats
1470 LOGICAL,
OPTIONAL :: write_stats
1472 CHARACTER(LEN=*),
PARAMETER :: routinen =
'hfx_ri_release'
1474 INTEGER :: handle, i, i_mem, ispin, j, j_mem, unused
1475 LOGICAL :: my_write_stats
1477 CALL timeset(routinen, handle)
1479 my_write_stats = .true.
1480 IF (
PRESENT(write_stats)) my_write_stats = write_stats
1481 IF (my_write_stats)
CALL hfx_ri_write_stats(ri_data)
1483 IF (
ASSOCIATED(ri_data%pgrid))
THEN
1484 CALL dbt_pgrid_destroy(ri_data%pgrid)
1485 DEALLOCATE (ri_data%pgrid)
1487 IF (
ASSOCIATED(ri_data%pgrid_1))
THEN
1488 CALL dbt_pgrid_destroy(ri_data%pgrid_1)
1489 DEALLOCATE (ri_data%pgrid_1)
1491 IF (
ASSOCIATED(ri_data%pgrid_2))
THEN
1492 CALL dbt_pgrid_destroy(ri_data%pgrid_2)
1493 DEALLOCATE (ri_data%pgrid_2)
1495 IF (
ASSOCIATED(ri_data%pgrid_2d))
THEN
1496 CALL dbt_pgrid_destroy(ri_data%pgrid_2d)
1497 DEALLOCATE (ri_data%pgrid_2d)
1500 CALL distribution_3d_destroy(ri_data%dist_3d)
1501 CALL dbt_distribution_destroy(ri_data%dist)
1503 DEALLOCATE (ri_data%bsizes_RI)
1504 DEALLOCATE (ri_data%bsizes_AO)
1505 DEALLOCATE (ri_data%bsizes_AO_split)
1506 DEALLOCATE (ri_data%bsizes_RI_split)
1507 DEALLOCATE (ri_data%bsizes_AO_fit)
1508 DEALLOCATE (ri_data%bsizes_RI_fit)
1510 IF (ri_data%flavor == ri_pmat)
THEN
1511 DO i_mem = 1, ri_data%n_mem
1512 DO j_mem = 1, ri_data%n_mem_RI
1517 DO j = 1,
SIZE(ri_data%t_3c_int_ctr_1, 2)
1518 DO i = 1,
SIZE(ri_data%t_3c_int_ctr_1, 1)
1519 CALL dbt_destroy(ri_data%t_3c_int_ctr_1(i, j))
1522 DEALLOCATE (ri_data%t_3c_int_ctr_1)
1524 DO j = 1,
SIZE(ri_data%t_3c_int_ctr_2, 2)
1525 DO i = 1,
SIZE(ri_data%t_3c_int_ctr_2, 1)
1526 CALL dbt_destroy(ri_data%t_3c_int_ctr_2(i, j))
1529 DEALLOCATE (ri_data%t_3c_int_ctr_2)
1531 DO j = 1,
SIZE(ri_data%t_3c_int_ctr_3, 2)
1532 DO i = 1,
SIZE(ri_data%t_3c_int_ctr_3, 1)
1533 CALL dbt_destroy(ri_data%t_3c_int_ctr_3(i, j))
1536 DEALLOCATE (ri_data%t_3c_int_ctr_3)
1538 DO j = 1,
SIZE(ri_data%t_2c_int, 2)
1539 DO i = 1,
SIZE(ri_data%t_2c_int, 1)
1540 CALL dbt_destroy(ri_data%t_2c_int(i, j))
1543 DEALLOCATE (ri_data%t_2c_int)
1545 DO j = 1,
SIZE(ri_data%rho_ao_t, 2)
1546 DO i = 1,
SIZE(ri_data%rho_ao_t, 1)
1547 CALL dbt_destroy(ri_data%rho_ao_t(i, j))
1550 DEALLOCATE (ri_data%rho_ao_t)
1552 DO j = 1,
SIZE(ri_data%ks_t, 2)
1553 DO i = 1,
SIZE(ri_data%ks_t, 1)
1554 CALL dbt_destroy(ri_data%ks_t(i, j))
1557 DEALLOCATE (ri_data%ks_t)
1559 DEALLOCATE (ri_data%starts_array_mem_block, ri_data%ends_array_mem_block, &
1560 ri_data%starts_array_mem, ri_data%ends_array_mem)
1561 DEALLOCATE (ri_data%starts_array_RI_mem_block, ri_data%ends_array_RI_mem_block, &
1562 ri_data%starts_array_RI_mem, ri_data%ends_array_RI_mem)
1564 DEALLOCATE (ri_data%blk_indices)
1565 DEALLOCATE (ri_data%store_3c)
1566 ELSE IF (ri_data%flavor == ri_mo)
THEN
1567 CALL dbt_destroy(ri_data%t_3c_int_ctr_1(1, 1))
1568 CALL dbt_destroy(ri_data%t_3c_int_ctr_2(1, 1))
1569 DEALLOCATE (ri_data%t_3c_int_ctr_1)
1570 DEALLOCATE (ri_data%t_3c_int_ctr_2)
1572 DO ispin = 1,
SIZE(ri_data%t_3c_int_mo, 1)
1573 CALL dbt_destroy(ri_data%t_3c_int_mo(ispin, 1, 1))
1574 CALL dbt_destroy(ri_data%t_3c_ctr_RI(ispin, 1, 1))
1575 CALL dbt_destroy(ri_data%t_3c_ctr_KS(ispin, 1, 1))
1576 CALL dbt_destroy(ri_data%t_3c_ctr_KS_copy(ispin, 1, 1))
1579 CALL dbt_destroy(ri_data%t_2c_int(ispin, 1))
1581 DEALLOCATE (ri_data%t_2c_int)
1582 DEALLOCATE (ri_data%t_3c_int_mo)
1583 DEALLOCATE (ri_data%t_3c_ctr_RI)
1584 DEALLOCATE (ri_data%t_3c_ctr_KS)
1585 DEALLOCATE (ri_data%t_3c_ctr_KS_copy)
1588 DO j = 1,
SIZE(ri_data%t_2c_inv, 2)
1589 DO i = 1,
SIZE(ri_data%t_2c_inv, 1)
1590 CALL dbt_destroy(ri_data%t_2c_inv(i, j))
1593 DEALLOCATE (ri_data%t_2c_inv)
1595 DO j = 1,
SIZE(ri_data%t_2c_pot, 2)
1596 DO i = 1,
SIZE(ri_data%t_2c_pot, 1)
1597 CALL dbt_destroy(ri_data%t_2c_pot(i, j))
1600 DEALLOCATE (ri_data%t_2c_pot)
1602 IF (
ALLOCATED(ri_data%kp_mat_2c_pot))
THEN
1603 DO j = 1,
SIZE(ri_data%kp_mat_2c_pot, 2)
1604 DO i = 1,
SIZE(ri_data%kp_mat_2c_pot, 1)
1605 CALL dbcsr_release(ri_data%kp_mat_2c_pot(i, j))
1608 DEALLOCATE (ri_data%kp_mat_2c_pot)
1611 IF (
ALLOCATED(ri_data%kp_t_3c_G_sub))
THEN
1612 DO i = 1,
SIZE(ri_data%kp_t_3c_G_sub)
1613 CALL dbt_destroy(ri_data%kp_t_3c_G_sub(i))
1615 DEALLOCATE (ri_data%kp_t_3c_G_sub)
1617 IF (
ALLOCATED(ri_data%kp_G_to_RI))
DEALLOCATE (ri_data%kp_G_to_RI)
1618 IF (
ALLOCATED(ri_data%kp_RI_atom))
DEALLOCATE (ri_data%kp_RI_atom)
1619 IF (
ALLOCATED(ri_data%kp_RI_neighbors))
DEALLOCATE (ri_data%kp_RI_neighbors)
1620 ri_data%kp_G_ngroups = 0
1622 IF (
ALLOCATED(ri_data%kp_t_3c_int))
THEN
1623 DO i = 1,
SIZE(ri_data%kp_t_3c_int)
1624 CALL dbt_destroy(ri_data%kp_t_3c_int(i))
1626 DEALLOCATE (ri_data%kp_t_3c_int)
1629 IF (
ALLOCATED(ri_data%rho_ao_t))
THEN
1630 DO j = 1,
SIZE(ri_data%rho_ao_t, 2)
1631 DO i = 1,
SIZE(ri_data%rho_ao_t, 1)
1632 CALL dbt_destroy(ri_data%rho_ao_t(i, j))
1635 DEALLOCATE (ri_data%rho_ao_t)
1638 IF (
ALLOCATED(ri_data%ks_t))
THEN
1639 DO j = 1,
SIZE(ri_data%ks_t, 2)
1640 DO i = 1,
SIZE(ri_data%ks_t, 1)
1641 CALL dbt_destroy(ri_data%ks_t(i, j))
1644 DEALLOCATE (ri_data%ks_t)
1647 IF (
ALLOCATED(ri_data%iatom_to_subgroup))
THEN
1648 DO i = 1,
SIZE(ri_data%iatom_to_subgroup)
1649 DEALLOCATE (ri_data%iatom_to_subgroup(i)%array)
1651 DEALLOCATE (ri_data%iatom_to_subgroup)
1654 CALL timestop(handle)
1670 TYPE(qs_kind_type),
DIMENSION(:),
POINTER :: qs_kind_set
1671 CHARACTER(LEN=*) :: basis_type
1673 CHARACTER(LEN=*),
PARAMETER :: routinen =
'hfx_create_basis_types'
1675 INTEGER :: handle, i, ikind, iset, j, max_set, &
1676 nkind, nl_count, nset
1677 INTEGER,
DIMENSION(:),
POINTER :: nshell
1678 TYPE(gto_basis_set_type),
POINTER :: orb_basis_a
1680 CALL timeset(routinen, handle)
1683 nkind =
SIZE(qs_kind_set, 1)
1685 ALLOCATE (basis_parameter(nkind))
1688 CALL get_qs_kind(qs_kind_set(ikind), basis_set=orb_basis_a, basis_type=basis_type)
1689 CALL get_qs_kind_set(qs_kind_set, &
1690 maxsgf=basis_info%max_sgf, &
1691 maxnset=basis_info%max_set, &
1692 maxlgto=basis_info%max_am, &
1693 basis_type=basis_type)
1694 IF (basis_info%max_set < max_set) cpabort(
"UNEXPECTED MAX_SET")
1695 max_set = max(max_set, basis_info%max_set)
1696 CALL get_gto_basis_set(gto_basis_set=orb_basis_a, &
1697 lmax=basis_parameter(ikind)%lmax, &
1698 lmin=basis_parameter(ikind)%lmin, &
1699 npgf=basis_parameter(ikind)%npgf, &
1700 nset=basis_parameter(ikind)%nset, &
1701 zet=basis_parameter(ikind)%zet, &
1702 nsgf_set=basis_parameter(ikind)%nsgf, &
1703 first_sgf=basis_parameter(ikind)%first_sgf, &
1704 sphi=basis_parameter(ikind)%sphi, &
1705 gcc=basis_parameter(ikind)%gcc, &
1706 nsgf=basis_parameter(ikind)%nsgf_total, &
1707 l=basis_parameter(ikind)%nl, &
1708 nshell=basis_parameter(ikind)%nshell, &
1709 set_radius=basis_parameter(ikind)%set_radius, &
1710 pgf_radius=basis_parameter(ikind)%pgf_radius, &
1711 kind_radius=basis_parameter(ikind)%kind_radius)
1712 CALL prepare_eri4_contraction(orb_basis_a, basis_parameter(ikind)%contraction)
1715 ALLOCATE (basis_parameter(ikind)%nsgfl(0:basis_info%max_am, max_set))
1716 basis_parameter(ikind)%nsgfl = 0
1717 nset = basis_parameter(ikind)%nset
1718 nshell => basis_parameter(ikind)%nshell
1720 DO i = 0, basis_info%max_am
1722 DO j = 1, nshell(iset)
1723 IF (basis_parameter(ikind)%nl(j, iset) == i) nl_count = nl_count + 1
1725 basis_parameter(ikind)%nsgfl(i, iset) = nl_count
1730 CALL timestop(handle)
1741 CHARACTER(LEN=*),
PARAMETER :: routinen =
'hfx_release_basis_types'
1743 INTEGER :: handle, i
1745 CALL timeset(routinen, handle)
1747 DO i = 1,
SIZE(basis_parameter)
1748 IF (
ASSOCIATED(basis_parameter(i)%nsgfl))
DEALLOCATE (basis_parameter(i)%nsgfl)
1750 IF (
ALLOCATED(basis_parameter(i)%contraction))
DEALLOCATE (basis_parameter(i)%contraction)
1752 DEALLOCATE (basis_parameter)
1753 CALL timestop(handle)
1770 i_thread, n_threads, para_env, irep, skip_disk, skip_in_core_forces)
1772 TYPE(section_vals_type),
POINTER :: hf_sub_section
1773 INTEGER,
INTENT(OUT),
OPTIONAL :: storage_id
1774 INTEGER,
INTENT(IN),
OPTIONAL :: i_thread, n_threads
1775 TYPE(mp_para_env_type),
OPTIONAL :: para_env
1776 INTEGER,
INTENT(IN),
OPTIONAL :: irep
1777 LOGICAL,
INTENT(IN) :: skip_disk, skip_in_core_forces
1779 CHARACTER(LEN=512) :: error_msg
1780 CHARACTER(LEN=default_path_length) :: char_val, filename, orig_wd
1781 INTEGER :: int_val, stat
1782 LOGICAL :: check, logic_val
1783 REAL(dp) :: real_val
1785 check = (
PRESENT(storage_id) .EQV.
PRESENT(i_thread)) .AND. &
1786 (
PRESENT(storage_id) .EQV.
PRESENT(n_threads)) .AND. &
1787 (
PRESENT(storage_id) .EQV.
PRESENT(para_env)) .AND. &
1788 (
PRESENT(storage_id) .EQV.
PRESENT(irep))
1792 CALL section_vals_val_get(hf_sub_section,
"MAX_MEMORY", i_val=int_val)
1793 memory_parameter%max_memory = int_val
1794 memory_parameter%max_compression_counter = int_val*1024_int_8*128_int_8
1795 CALL section_vals_val_get(hf_sub_section,
"EPS_STORAGE", r_val=real_val)
1796 memory_parameter%eps_storage_scaling = real_val
1797 IF (int_val == 0)
THEN
1798 memory_parameter%do_all_on_the_fly = .true.
1800 memory_parameter%do_all_on_the_fly = .false.
1802 memory_parameter%cache_size = cache_size
1803 memory_parameter%bits_max_val = bits_max_val
1804 memory_parameter%actual_memory_usage = 1
1805 IF (.NOT. skip_in_core_forces)
THEN
1806 CALL section_vals_val_get(hf_sub_section,
"TREAT_FORCES_IN_CORE", l_val=logic_val)
1807 memory_parameter%treat_forces_in_core = logic_val
1811 IF (memory_parameter%do_all_on_the_fly) memory_parameter%treat_forces_in_core = .false.
1814 IF (.NOT. skip_disk)
THEN
1815 memory_parameter%actual_memory_usage_disk = 1
1816 CALL section_vals_val_get(hf_sub_section,
"MAX_DISK_SPACE", i_val=int_val)
1817 memory_parameter%max_compression_counter_disk = int_val*1024_int_8*128_int_8
1818 IF (int_val == 0)
THEN
1819 memory_parameter%do_disk_storage = .false.
1821 memory_parameter%do_disk_storage = .true.
1823 CALL section_vals_val_get(hf_sub_section,
"STORAGE_LOCATION", c_val=char_val)
1824 CALL compress(char_val, .true.)
1827 IF (scan(char_val,
"/", .true.) /= len_trim(char_val))
THEN
1828 WRITE (filename,
'(A,A)') trim(char_val),
"/"
1829 CALL compress(filename)
1831 filename = trim(char_val)
1833 CALL compress(filename, .true.)
1836 CALL m_getcwd(orig_wd)
1837 CALL m_chdir(trim(filename), stat)
1839 WRITE (error_msg,
'(A,A,A)')
"Request for disk storage failed due to unknown error while writing to ", &
1840 trim(filename),
". Please check STORAGE_LOCATION"
1843 CALL m_chdir(orig_wd, stat)
1845 memory_parameter%storage_location = filename
1846 CALL compress(memory_parameter%storage_location, .true.)
1848 memory_parameter%do_disk_storage = .false.
1850 IF (
PRESENT(storage_id))
THEN
1851 storage_id = (irep - 1)*para_env%num_pe*n_threads + para_env%mepos*n_threads + i_thread - 1
1863 TYPE(
hfx_type),
DIMENSION(:, :),
POINTER :: x_data
1865 INTEGER :: i, i_thread, irep, n_rep_hf, n_threads
1866 TYPE(cp_logger_type),
POINTER :: logger
1867 TYPE(
hfx_type),
POINTER :: actual_x_data
1871 n_rep_hf = x_data(1, 1)%n_rep_hf
1872 n_threads =
SIZE(x_data, 2)
1874 DO i_thread = 1, n_threads
1875 DO irep = 1, n_rep_hf
1876 actual_x_data => x_data(irep, i_thread)
1877 DEALLOCATE (actual_x_data%neighbor_cells)
1878 DEALLOCATE (actual_x_data%distribution_energy)
1879 DEALLOCATE (actual_x_data%distribution_forces)
1881 IF (actual_x_data%load_balance_parameter%blocks_initialized)
THEN
1882 DEALLOCATE (actual_x_data%blocks)
1883 IF (i_thread == 1)
THEN
1884 DEALLOCATE (actual_x_data%pmax_block)
1888 IF (i_thread == 1)
THEN
1889 DEALLOCATE (actual_x_data%atomic_pair_list)
1890 DEALLOCATE (actual_x_data%atomic_pair_list_forces)
1893 IF (actual_x_data%screening_parameter%do_initial_p_screening .OR. &
1894 actual_x_data%screening_parameter%do_p_screening_forces)
THEN
1895 IF (i_thread == 1)
THEN
1896 DEALLOCATE (actual_x_data%pmax_atom)
1897 DO i = 1,
SIZE(actual_x_data%initial_p)
1898 DEALLOCATE (actual_x_data%initial_p(i)%p_kind)
1900 DEALLOCATE (actual_x_data%initial_p)
1902 DEALLOCATE (actual_x_data%pmax_atom_forces)
1903 DO i = 1,
SIZE(actual_x_data%initial_p_forces)
1904 DEALLOCATE (actual_x_data%initial_p_forces(i)%p_kind)
1906 DEALLOCATE (actual_x_data%initial_p_forces)
1908 DEALLOCATE (actual_x_data%map_atom_to_kind_atom)
1910 IF (i_thread == 1)
THEN
1911 DEALLOCATE (actual_x_data%is_assoc_atomic_block)
1912 DEALLOCATE (actual_x_data%atomic_block_offset)
1913 DEALLOCATE (actual_x_data%set_offset)
1914 DEALLOCATE (actual_x_data%block_offset)
1920 CALL four_center_integral_cleanup(actual_x_data%eri4_context)
1923 CALL dealloc_containers(actual_x_data%store_ints, actual_x_data%memory_parameter%actual_memory_usage)
1924 CALL dealloc_containers(actual_x_data%store_forces, actual_x_data%memory_parameter%actual_memory_usage)
1928 actual_x_data%memory_parameter%actual_memory_usage_disk, &
1930 IF (actual_x_data%memory_parameter%do_disk_storage)
THEN
1931 CALL close_file(unit_number=actual_x_data%store_ints%maxval_container_disk%unit, file_status=
"DELETE")
1933 DEALLOCATE (actual_x_data%store_ints%maxval_container_disk%first)
1934 DEALLOCATE (actual_x_data%store_ints%maxval_container_disk)
1938 actual_x_data%memory_parameter%actual_memory_usage_disk, &
1940 IF (actual_x_data%memory_parameter%do_disk_storage)
THEN
1941 CALL close_file(unit_number=actual_x_data%store_ints%integral_containers_disk(i)%unit, file_status=
"DELETE")
1943 DEALLOCATE (actual_x_data%store_ints%integral_containers_disk(i)%first)
1945 DEALLOCATE (actual_x_data%store_ints%integral_containers_disk)
1948 IF (actual_x_data%screen_funct_is_initialized)
THEN
1949 DEALLOCATE (actual_x_data%screen_funct_coeffs_set)
1950 DEALLOCATE (actual_x_data%screen_funct_coeffs_kind)
1951 DEALLOCATE (actual_x_data%pair_dist_radii_pgf)
1952 DEALLOCATE (actual_x_data%screen_funct_coeffs_pgf)
1953 actual_x_data%screen_funct_is_initialized = .false.
1957 IF (
ASSOCIATED(actual_x_data%map_atoms_to_cpus))
THEN
1958 DO i = 1,
SIZE(actual_x_data%map_atoms_to_cpus)
1959 DEALLOCATE (actual_x_data%map_atoms_to_cpus(i)%iatom_list)
1960 DEALLOCATE (actual_x_data%map_atoms_to_cpus(i)%jatom_list)
1962 DEALLOCATE (actual_x_data%map_atoms_to_cpus)
1965 IF (actual_x_data%do_hfx_ri)
THEN
1967 IF (
ASSOCIATED(actual_x_data%ri_data%ri_section))
THEN
1968 logger => cp_get_default_logger()
1969 CALL cp_print_key_finished_output(actual_x_data%ri_data%unit_nr_dbcsr, logger, actual_x_data%ri_data%ri_section, &
1972 IF (
ASSOCIATED(actual_x_data%ri_data%hfx_section))
THEN
1973 logger => cp_get_default_logger()
1974 CALL cp_print_key_finished_output(actual_x_data%ri_data%unit_nr, logger, actual_x_data%ri_data%hfx_section, &
1977 DEALLOCATE (actual_x_data%ri_data)
1981 actual_x_data%use_ace = .false.
1982 actual_x_data%ace_is_built = .false.
1983 actual_x_data%ace_build_counter = 0
2005 INTEGER,
INTENT(INOUT) :: pbc_shells
2006 TYPE(cell_type),
POINTER :: cell
2007 INTEGER,
INTENT(IN) :: i_thread
2008 INTEGER,
DIMENSION(3),
OPTIONAL :: nkp_grid
2010 CHARACTER(LEN=512) :: error_msg
2011 CHARACTER(LEN=64) :: char_nshells
2012 INTEGER :: i,
idx, ikind, ipgf, iset, ishell, j, jkind, jpgf, jset, jshell, k, kshell, l, &
2013 m(3), max_shell, nkp(3), nseta, nsetb, perd(3), total_number_of_cells, ub, ub_max
2014 INTEGER,
DIMENSION(:),
POINTER :: la_max, lb_max, npgfa, npgfb
2015 LOGICAL :: do_kpoints, image_cell_found, &
2017 REAL(dp) :: cross_product(3), dist_min, distance(14), l_min, normal(3, 6), p(3, 14), &
2018 plane_vector(3, 2), point_in_plane(3), r(3), r1, r_max, r_max_stress, s(3), x, y, z, zeta1
2019 REAL(dp),
DIMENSION(:, :),
POINTER :: zeta, zetb
2020 TYPE(hfx_cell_type),
ALLOCATABLE,
DIMENSION(:) :: tmp_neighbor_cells
2022 total_number_of_cells = 0
2025 IF (
PRESENT(nkp_grid)) nkp = nkp_grid
2026 do_kpoints = any(nkp > 1)
2029 IF (i_thread == 1)
THEN
2030 IF (x_data%potential_parameter%potential_type /= do_potential_truncated .AND. &
2031 x_data%potential_parameter%potential_type /= do_potential_short .AND. &
2032 x_data%potential_parameter%potential_type /= do_potential_mix_cl_trunc .AND. &
2033 x_data%potential_parameter%potential_type /= do_potential_id)
THEN
2034 CALL cp_warn(__location__, &
2035 "Periodic Hartree Fock calculation requested without use "// &
2036 "of a truncated or shortrange potential. This may lead to unphysical total energies. "// &
2037 "Use a truncated potential to avoid possible problems.")
2038 ELSE IF (x_data%potential_parameter%potential_type /= do_potential_id)
THEN
2040 l_min = min(real(nkp(1), dp)*plane_distance(1, 0, 0, cell), &
2041 REAL(nkp(2), dp)*plane_distance(0, 1, 0, cell), &
2042 REAL(nkp(3), dp)*plane_distance(0, 0, 1, cell))
2043 l_min = 0.5_dp*l_min
2044 IF (x_data%potential_parameter%cutoff_radius >= l_min)
THEN
2045 IF (.NOT. do_kpoints)
THEN
2046 WRITE (error_msg,
"(A,F6.3,A,F6.3,A)") &
2047 "Periodic Hartree Fock calculation requested with the use "// &
2048 "of a truncated or shortrange potential. "// &
2049 "The cutoff radius (", x_data%potential_parameter%cutoff_radius*a_bohr*1e+10_dp, &
2050 " A) is larger than half the minimal cell dimension (", &
2051 l_min*a_bohr*1e+10_dp,
" A). This may lead to unphysical "// &
2052 "total energies. Reduce the cutoff radius in order to avoid "// &
2053 "possible problems."
2055 WRITE (error_msg,
"(A,F6.3,A,F6.3,A)") &
2056 "K-point Hartree-Fock calculation requested with the use of a "// &
2057 "truncated or shortrange potential. The cutoff radius (", &
2058 x_data%potential_parameter%cutoff_radius*a_bohr*1e+10_dp, &
2059 " A) is larger than half the minimal Born-von Karman supercell dimension (", &
2060 l_min*a_bohr*1e+10_dp,
" A). This may lead "// &
2061 "to unphysical total energies. Reduce the cutoff radius or increase "// &
2062 "the number of K-points in order to avoid possible problems."
2064 CALL cp_warn(__location__, error_msg)
2069 SELECT CASE (x_data%potential_parameter%potential_type)
2070 CASE (do_potential_truncated, do_potential_mix_cl_trunc, do_potential_short)
2072 DO ikind = 1,
SIZE(x_data%basis_parameter)
2073 la_max => x_data%basis_parameter(ikind)%lmax
2074 zeta => x_data%basis_parameter(ikind)%zet
2075 nseta = x_data%basis_parameter(ikind)%nset
2076 npgfa => x_data%basis_parameter(ikind)%npgf
2077 DO jkind = 1,
SIZE(x_data%basis_parameter)
2078 lb_max => x_data%basis_parameter(jkind)%lmax
2079 zetb => x_data%basis_parameter(jkind)%zet
2080 nsetb = x_data%basis_parameter(jkind)%nset
2081 npgfb => x_data%basis_parameter(jkind)%npgf
2084 DO ipgf = 1, npgfa(iset)
2085 DO jpgf = 1, npgfb(jset)
2086 zeta1 = zeta(ipgf, iset) + zetb(jpgf, jset)
2087 r1 = 1.0_dp/sqrt(zeta1)*
mul_fact(la_max(iset) + lb_max(jset))* &
2088 sqrt(-log(x_data%screening_parameter%eps_schwarz))
2089 r_max = max(r1, r_max)
2097 r_max = 2.0_dp*r_max + x_data%potential_parameter%cutoff_radius
2098 nothing_more_to_add = .false.
2100 total_number_of_cells = 0
2102 DEALLOCATE (x_data%neighbor_cells)
2103 ALLOCATE (x_data%neighbor_cells(1))
2104 x_data%neighbor_cells(1)%cell = 0.0_dp
2105 x_data%neighbor_cells(1)%cell_r = 0.0_dp
2142 DO WHILE (.NOT. nothing_more_to_add)
2144 image_cell_found = .false.
2145 ALLOCATE (tmp_neighbor_cells(1:ub))
2147 tmp_neighbor_cells(i) = x_data%neighbor_cells(i)
2149 ub_max = (2*max_shell + 1)**3
2150 DEALLOCATE (x_data%neighbor_cells)
2151 ALLOCATE (x_data%neighbor_cells(1:ub_max))
2153 x_data%neighbor_cells(i) = tmp_neighbor_cells(i)
2156 x_data%neighbor_cells(i)%cell = 0.0_dp
2157 x_data%neighbor_cells(i)%cell_r = 0.0_dp
2160 DEALLOCATE (tmp_neighbor_cells)
2162 perd(1:3) = x_data%periodic_parameter%perd(1:3)
2164 DO ishell = -max_shell*perd(1), max_shell*perd(1)
2165 DO jshell = -max_shell*perd(2), max_shell*perd(2)
2166 DO kshell = -max_shell*perd(3), max_shell*perd(3)
2167 IF (max(abs(ishell), abs(jshell), abs(kshell)) /= max_shell) cycle
2170 x = -1.0_dp/2.0_dp + j*1.0_dp
2172 y = -1.0_dp/2.0_dp + k*1.0_dp
2174 z = -1.0_dp/2.0_dp + l*1.0_dp
2176 p(1,
idx) = x + ishell
2177 p(2,
idx) = y + jshell
2178 p(3,
idx) = z + kshell
2179 CALL scaled_to_real(r, p(:,
idx), cell)
2180 distance(
idx) = sqrt(sum(r**2))
2189 plane_vector(:, 1) = p(:, 3) - p(:, 1)
2190 plane_vector(:, 2) = p(:, 2) - p(:, 1)
2191 cross_product(1) = plane_vector(2, 1)*plane_vector(3, 2) - plane_vector(3, 1)*plane_vector(2, 2)
2192 cross_product(2) = plane_vector(3, 1)*plane_vector(1, 2) - plane_vector(1, 1)*plane_vector(3, 2)
2193 cross_product(3) = plane_vector(1, 1)*plane_vector(2, 2) - plane_vector(2, 1)*plane_vector(1, 2)
2194 normal(:, 1) = cross_product/sqrt(sum(cross_product**2))
2195 point_in_plane = -normal(:, 1)*(normal(1, 1)*p(1, 1) + normal(2, 1)*p(2, 1) + normal(3, 1)*p(3, 1))
2197 IF (point_is_in_quadrilateral(p(:, 1), p(:, 3), p(:, 4), p(:, 2), point_in_plane))
THEN
2198 distance(
idx) = abs(normal(1, 1)*p(1, 1) + normal(2, 1)*p(2, 1) + normal(3, 1)*p(3, 1))
2200 distance(
idx) = huge(distance(
idx))
2205 plane_vector(:, 1) = p(:, 2) - p(:, 1)
2206 plane_vector(:, 2) = p(:, 5) - p(:, 1)
2207 cross_product(1) = plane_vector(2, 1)*plane_vector(3, 2) - plane_vector(3, 1)*plane_vector(2, 2)
2208 cross_product(2) = plane_vector(3, 1)*plane_vector(1, 2) - plane_vector(1, 1)*plane_vector(3, 2)
2209 cross_product(3) = plane_vector(1, 1)*plane_vector(2, 2) - plane_vector(2, 1)*plane_vector(1, 2)
2210 normal(:, 1) = cross_product/sqrt(sum(cross_product**2))
2211 point_in_plane = -normal(:, 1)*(normal(1, 1)*p(1, 1) + normal(2, 1)*p(2, 1) + normal(3, 1)*p(3, 1))
2213 IF (point_is_in_quadrilateral(p(:, 1), p(:, 5), p(:, 6), p(:, 2), point_in_plane))
THEN
2214 distance(
idx) = abs(normal(1, 1)*p(1, 1) + normal(2, 1)*p(2, 1) + normal(3, 1)*p(3, 1))
2216 distance(
idx) = huge(distance(
idx))
2221 plane_vector(:, 1) = p(:, 7) - p(:, 5)
2222 plane_vector(:, 2) = p(:, 6) - p(:, 5)
2223 cross_product(1) = plane_vector(2, 1)*plane_vector(3, 2) - plane_vector(3, 1)*plane_vector(2, 2)
2224 cross_product(2) = plane_vector(3, 1)*plane_vector(1, 2) - plane_vector(1, 1)*plane_vector(3, 2)
2225 cross_product(3) = plane_vector(1, 1)*plane_vector(2, 2) - plane_vector(2, 1)*plane_vector(1, 2)
2226 normal(:, 1) = cross_product/sqrt(sum(cross_product**2))
2227 point_in_plane = -normal(:, 1)*(normal(1, 1)*p(1, 5) + normal(2, 1)*p(2, 5) + normal(3, 1)*p(3, 5))
2229 IF (point_is_in_quadrilateral(p(:, 5), p(:, 7), p(:, 8), p(:, 6), point_in_plane))
THEN
2230 distance(
idx) = abs(normal(1, 1)*p(1, 5) + normal(2, 1)*p(2, 5) + normal(3, 1)*p(3, 5))
2232 distance(
idx) = huge(distance(
idx))
2237 plane_vector(:, 1) = p(:, 7) - p(:, 3)
2238 plane_vector(:, 2) = p(:, 4) - p(:, 3)
2239 cross_product(1) = plane_vector(2, 1)*plane_vector(3, 2) - plane_vector(3, 1)*plane_vector(2, 2)
2240 cross_product(2) = plane_vector(3, 1)*plane_vector(1, 2) - plane_vector(1, 1)*plane_vector(3, 2)
2241 cross_product(3) = plane_vector(1, 1)*plane_vector(2, 2) - plane_vector(2, 1)*plane_vector(1, 2)
2242 normal(:, 1) = cross_product/sqrt(sum(cross_product**2))
2243 point_in_plane = -normal(:, 1)*(normal(1, 1)*p(1, 3) + normal(2, 1)*p(2, 3) + normal(3, 1)*p(3, 3))
2245 IF (point_is_in_quadrilateral(p(:, 3), p(:, 7), p(:, 8), p(:, 4), point_in_plane))
THEN
2246 distance(
idx) = abs(normal(1, 1)*p(1, 3) + normal(2, 1)*p(2, 3) + normal(3, 1)*p(3, 3))
2248 distance(
idx) = huge(distance(
idx))
2253 plane_vector(:, 1) = p(:, 6) - p(:, 2)
2254 plane_vector(:, 2) = p(:, 4) - p(:, 2)
2255 cross_product(1) = plane_vector(2, 1)*plane_vector(3, 2) - plane_vector(3, 1)*plane_vector(2, 2)
2256 cross_product(2) = plane_vector(3, 1)*plane_vector(1, 2) - plane_vector(1, 1)*plane_vector(3, 2)
2257 cross_product(3) = plane_vector(1, 1)*plane_vector(2, 2) - plane_vector(2, 1)*plane_vector(1, 2)
2258 normal(:, 1) = cross_product/sqrt(sum(cross_product**2))
2259 point_in_plane = -normal(:, 1)*(normal(1, 1)*p(1, 2) + normal(2, 1)*p(2, 2) + normal(3, 1)*p(3, 2))
2261 IF (point_is_in_quadrilateral(p(:, 2), p(:, 6), p(:, 8), p(:, 4), point_in_plane))
THEN
2262 distance(
idx) = abs(normal(1, 1)*p(1, 2) + normal(2, 1)*p(2, 2) + normal(3, 1)*p(3, 2))
2264 distance(
idx) = huge(distance(
idx))
2269 plane_vector(:, 1) = p(:, 5) - p(:, 1)
2270 plane_vector(:, 2) = p(:, 3) - p(:, 1)
2271 cross_product(1) = plane_vector(2, 1)*plane_vector(3, 2) - plane_vector(3, 1)*plane_vector(2, 2)
2272 cross_product(2) = plane_vector(3, 1)*plane_vector(1, 2) - plane_vector(1, 1)*plane_vector(3, 2)
2273 cross_product(3) = plane_vector(1, 1)*plane_vector(2, 2) - plane_vector(2, 1)*plane_vector(1, 2)
2274 normal(:, 1) = cross_product/sqrt(sum(cross_product**2))
2275 point_in_plane = -normal(:, 1)*(normal(1, 1)*p(1, 1) + normal(2, 1)*p(2, 1) + normal(3, 1)*p(3, 1))
2277 IF (point_is_in_quadrilateral(p(:, 1), p(:, 5), p(:, 7), p(:, 3), point_in_plane))
THEN
2278 distance(
idx) = abs(normal(1, 1)*p(1, 1) + normal(2, 1)*p(2, 1) + normal(3, 1)*p(3, 1))
2280 distance(
idx) = huge(distance(
idx))
2283 dist_min = minval(distance)
2284 IF (max_shell == 0)
THEN
2285 image_cell_found = .true.
2287 IF (dist_min < r_max)
THEN
2288 total_number_of_cells = total_number_of_cells + 1
2289 x_data%neighbor_cells(ub)%cell = real([ishell, jshell, kshell], dp)
2291 image_cell_found = .true.
2297 IF (image_cell_found)
THEN
2298 max_shell = max_shell + 1
2300 nothing_more_to_add = .true.
2304 ALLOCATE (tmp_neighbor_cells(total_number_of_cells))
2306 tmp_neighbor_cells(i) = x_data%neighbor_cells(i)
2308 DEALLOCATE (x_data%neighbor_cells)
2310 IF (total_number_of_cells == 0)
THEN
2311 total_number_of_cells = 1
2312 ALLOCATE (x_data%neighbor_cells(total_number_of_cells))
2313 DO i = 1, total_number_of_cells
2314 x_data%neighbor_cells(i)%cell = 0.0_dp
2315 x_data%neighbor_cells(i)%cell_r = 0.0_dp
2318 ALLOCATE (x_data%neighbor_cells(total_number_of_cells))
2319 DO i = 1, total_number_of_cells
2320 x_data%neighbor_cells(i) = tmp_neighbor_cells(i)
2323 DEALLOCATE (tmp_neighbor_cells)
2325 IF (x_data%periodic_parameter%number_of_shells == do_hfx_auto_shells)
THEN
2328 total_number_of_cells = 0
2329 DO i = 0, x_data%periodic_parameter%number_of_shells
2330 total_number_of_cells = total_number_of_cells + count_cells_perd(i, x_data%periodic_parameter%perd)
2332 IF (total_number_of_cells <
SIZE(x_data%neighbor_cells))
THEN
2333 IF (i_thread == 1)
THEN
2334 WRITE (char_nshells,
'(I3)')
SIZE(x_data%neighbor_cells)
2335 WRITE (error_msg,
'(A,A,A)')
"Periodic Hartree Fock calculation requested with use "// &
2336 "of a truncated potential. The number of shells to be considered "// &
2337 "might be too small. CP2K conservatively estimates to need "//trim(char_nshells)//
" periodic images "// &
2338 "Please carefully check if you get converged results."
2342 total_number_of_cells = 0
2343 DO i = 0, x_data%periodic_parameter%number_of_shells
2344 total_number_of_cells = total_number_of_cells + count_cells_perd(i, x_data%periodic_parameter%perd)
2346 DEALLOCATE (x_data%neighbor_cells)
2348 ALLOCATE (x_data%neighbor_cells(total_number_of_cells))
2351 DO WHILE (sum(m**2) <= x_data%periodic_parameter%number_of_shells)
2352 x_data%neighbor_cells(i)%cell = real(m, dp)
2353 CALL next_image_cell_perd(m, x_data%periodic_parameter%perd)
2358 total_number_of_cells = 0
2359 IF (pbc_shells == -1) pbc_shells = 0
2360 DO i = 0, pbc_shells
2361 total_number_of_cells = total_number_of_cells + count_cells_perd(i, x_data%periodic_parameter%perd)
2363 DEALLOCATE (x_data%neighbor_cells)
2365 ALLOCATE (x_data%neighbor_cells(total_number_of_cells))
2369 DO WHILE (sum(m**2) <= pbc_shells)
2370 x_data%neighbor_cells(i)%cell = real(m, dp)
2371 CALL next_image_cell_perd(m, x_data%periodic_parameter%perd)
2377 DO i = 1,
SIZE(x_data%neighbor_cells)
2379 x_data%neighbor_cells(i)%cell_r(:) = 0.0_dp
2380 s = x_data%neighbor_cells(i)%cell(:)
2381 CALL scaled_to_real(x_data%neighbor_cells(i)%cell_r, s, cell)
2383 x_data%periodic_parameter%number_of_shells = pbc_shells
2385 r_max_stress = 0.0_dp
2386 DO i = 1,
SIZE(x_data%neighbor_cells)
2387 r_max_stress = max(r_max_stress, maxval(abs(x_data%neighbor_cells(i)%cell_r(:))))
2389 r_max_stress = r_max_stress + abs(maxval(cell%hmat(:, :)))
2390 x_data%periodic_parameter%R_max_stress = r_max_stress
2404 FUNCTION point_is_in_quadrilateral(A, B, C, D, P)
2405 REAL(dp) :: a(3), b(3), c(3), d(3), p(3)
2406 LOGICAL :: point_is_in_quadrilateral
2408 REAL(dp),
PARAMETER :: fuzzy = 1000.0_dp*epsilon(1.0_dp)
2410 REAL(dp) :: dot00, dot01, dot02, dot11, dot12, &
2411 invdenom, u, v, v0(3), v1(3), v2(3)
2413 point_is_in_quadrilateral = .false.
2432 dot00 = dot_product(v0, v0)
2433 dot01 = dot_product(v0, v1)
2434 dot02 = dot_product(v0, v2)
2435 dot11 = dot_product(v1, v1)
2436 dot12 = dot_product(v1, v2)
2439 invdenom = 1/(dot00*dot11 - dot01*dot01)
2440 u = (dot11*dot02 - dot01*dot12)*invdenom
2441 v = (dot00*dot12 - dot01*dot02)*invdenom
2443 IF ((u >= 0 - fuzzy) .AND. (v >= 0 - fuzzy) .AND. (u + v <= 1 + fuzzy))
THEN
2444 point_is_in_quadrilateral = .true.
2452 dot00 = dot_product(v0, v0)
2453 dot01 = dot_product(v0, v1)
2454 dot02 = dot_product(v0, v2)
2455 dot11 = dot_product(v1, v1)
2456 dot12 = dot_product(v1, v2)
2459 invdenom = 1/(dot00*dot11 - dot01*dot01)
2460 u = (dot11*dot02 - dot01*dot12)*invdenom
2461 v = (dot00*dot12 - dot01*dot02)*invdenom
2464 IF ((u >= 0 - fuzzy) .AND. (v >= 0 - fuzzy) .AND. (u + v <= 1 + fuzzy))
THEN
2465 point_is_in_quadrilateral = .true.
2469 END FUNCTION point_is_in_quadrilateral
2483 INTEGER :: memory_usage
2484 LOGICAL :: do_disk_storage
2486 TYPE(hfx_container_node),
POINTER :: current, next
2490 current => container%first
2491 DO WHILE (
ASSOCIATED(current))
2492 next => current%next
2493 DEALLOCATE (current)
2498 ALLOCATE (container%first)
2499 container%first%prev => null()
2500 container%first%next => null()
2501 container%current => container%first
2502 container%current%data = 0
2503 container%element_counter = 1
2506 IF (do_disk_storage)
THEN
2508 IF (container%unit /= -1)
THEN
2509 CALL close_file(unit_number=container%unit)
2511 CALL open_file(file_name=trim(container%filename), file_status=
"UNKNOWN", file_form=
"UNFORMATTED", file_action=
"WRITE", &
2512 unit_number=container%unit)
2530 DEALLOCATE (x_data%distribution_energy)
2532 ALLOCATE (x_data%distribution_energy(
SIZE(ptr_to_distr)))
2533 x_data%distribution_energy = ptr_to_distr
2550 DEALLOCATE (x_data%distribution_forces)
2552 ALLOCATE (x_data%distribution_forces(
SIZE(ptr_to_distr)))
2553 x_data%distribution_forces = ptr_to_distr
2570 INTEGER(int_8),
INTENT(IN) :: subtr_size_mb
2572 INTEGER(int_8) :: max_memory
2574 max_memory = memory_parameter%max_memory
2575 max_memory = max_memory - subtr_size_mb
2576 IF (max_memory <= 0)
THEN
2577 memory_parameter%do_all_on_the_fly = .true.
2578 memory_parameter%max_compression_counter = 0
2580 memory_parameter%do_all_on_the_fly = .false.
2581 memory_parameter%max_compression_counter = max_memory*1024_int_8*128_int_8
2593 SUBROUTINE hfx_print_std_info(x_data, hfx_section)
2595 TYPE(section_vals_type),
POINTER :: hfx_section
2598 TYPE(cp_logger_type),
POINTER :: logger
2601 logger => cp_get_default_logger()
2603 iw = cp_print_key_unit_nr(logger, hfx_section,
"HF_INFO", &
2604 extension=
".scfLog")
2607 WRITE (unit=iw, fmt=
"((T3,A,T73,ES8.1))") &
2608 "HFX_INFO| EPS_SCHWARZ: ", x_data%screening_parameter%eps_schwarz
2609 WRITE (unit=iw, fmt=
"((T3,A,T73,ES8.1))") &
2610 "HFX_INFO| EPS_SCHWARZ_FORCES ", x_data%screening_parameter%eps_schwarz_forces
2611 WRITE (unit=iw, fmt=
"((T3,A,T73,ES8.1))") &
2612 "HFX_INFO| EPS_STORAGE_SCALING: ", x_data%memory_parameter%eps_storage_scaling
2613 WRITE (unit=iw, fmt=
"((T3,A,T61,I20))") &
2614 "HFX_INFO| NBINS: ", x_data%load_balance_parameter%nbins
2615 WRITE (unit=iw, fmt=
"((T3,A,T61,I20))") &
2616 "HFX_INFO| BLOCK_SIZE: ", x_data%load_balance_parameter%block_size
2617 IF (x_data%periodic_parameter%do_periodic)
THEN
2618 IF (x_data%periodic_parameter%mode == -1)
THEN
2619 WRITE (unit=iw, fmt=
"((T3,A,T77,A))") &
2620 "HFX_INFO| NUMBER_OF_SHELLS: ",
"AUTO"
2622 WRITE (unit=iw, fmt=
"((T3,A,T61,I20))") &
2623 "HFX_INFO| NUMBER_OF_SHELLS: ", x_data%periodic_parameter%mode
2625 WRITE (unit=iw, fmt=
"((T3,A,T61,I20))") &
2626 "HFX_INFO| Number of periodic shells considered: ", x_data%periodic_parameter%number_of_shells
2627 WRITE (unit=iw, fmt=
"((T3,A,T61,I20),/)") &
2628 "HFX_INFO| Number of periodic cells considered: ",
SIZE(x_data%neighbor_cells)
2630 WRITE (unit=iw, fmt=
"((T3,A,T77,A))") &
2631 "HFX_INFO| Number of periodic shells considered: ",
"NONE"
2632 WRITE (unit=iw, fmt=
"((T3,A,T77,A),/)") &
2633 "HFX_INFO| Number of periodic cells considered: ",
"NONE"
2636 END SUBROUTINE hfx_print_std_info
2643 SUBROUTINE hfx_print_ri_info(ri_data, hfx_section)
2645 TYPE(section_vals_type),
POINTER :: hfx_section
2649 TYPE(cp_logger_type),
POINTER :: logger
2650 TYPE(section_vals_type),
POINTER :: ri_section
2652 NULLIFY (logger, ri_section)
2653 logger => cp_get_default_logger()
2655 ri_section => ri_data%ri_section
2657 iw = cp_print_key_unit_nr(logger, hfx_section,
"HF_INFO", &
2658 extension=
".scfLog")
2662 associate(ri_metric => ri_data%ri_metric, hfx_pot => ri_data%hfx_pot)
2663 SELECT CASE (ri_metric%potential_type)
2664 CASE (do_potential_coulomb)
2665 WRITE (unit=iw, fmt=
"(/T3,A,T74,A)") &
2666 "HFX_RI_INFO| RI metric: ",
"COULOMB"
2667 CASE (do_potential_short)
2668 WRITE (unit=iw, fmt=
"(T3,A,T71,A)") &
2669 "HFX_RI_INFO| RI metric: ",
"SHORTRANGE"
2670 WRITE (iw,
'(T3,A,T61,F20.10)') &
2671 "HFX_RI_INFO| Omega: ", ri_metric%omega
2672 rc_ang = cp_unit_from_cp2k(ri_metric%cutoff_radius,
"angstrom")
2673 WRITE (iw,
'(T3,A,T61,F20.10)') &
2674 "HFX_RI_INFO| Cutoff Radius [angstrom]: ", rc_ang
2675 CASE (do_potential_long)
2676 WRITE (unit=iw, fmt=
"(T3,A,T72,A)") &
2677 "HFX_RI_INFO| RI metric: ",
"LONGRANGE"
2678 WRITE (iw,
'(T3,A,T61,F20.10)') &
2679 "HFX_RI_INFO| Omega: ", ri_metric%omega
2680 CASE (do_potential_id)
2681 WRITE (unit=iw, fmt=
"(T3,A,T74,A)") &
2682 "HFX_RI_INFO| RI metric: ",
"OVERLAP"
2683 CASE (do_potential_truncated)
2684 WRITE (unit=iw, fmt=
"(T3,A,T64,A)") &
2685 "HFX_RI_INFO| RI metric: ",
"TRUNCATED COULOMB"
2686 rc_ang = cp_unit_from_cp2k(ri_metric%cutoff_radius,
"angstrom")
2687 WRITE (iw,
'(T3,A,T61,F20.10)') &
2688 "HFX_RI_INFO| Cutoff Radius [angstrom]: ", rc_ang
2692 SELECT CASE (ri_data%flavor)
2694 WRITE (unit=iw, fmt=
"(T3, A, T79, A)") &
2695 "HFX_RI_INFO| RI flavor: ",
"MO"
2697 WRITE (unit=iw, fmt=
"(T3, A, T78, A)") &
2698 "HFX_RI_INFO| RI flavor: ",
"RHO"
2700 SELECT CASE (ri_data%t2c_method)
2701 CASE (hfx_ri_do_2c_iter)
2702 WRITE (unit=iw, fmt=
"(T3, A, T69, A)") &
2703 "HFX_RI_INFO| Matrix SQRT/INV",
"DBCSR / iter"
2704 CASE (hfx_ri_do_2c_diag)
2705 WRITE (unit=iw, fmt=
"(T3, A, T65, A)") &
2706 "HFX_RI_INFO| Matrix SQRT/INV",
"Dense / diag"
2708 WRITE (unit=iw, fmt=
"(T3, A, T73, ES8.1)") &
2709 "HFX_RI_INFO| EPS_FILTER", ri_data%filter_eps
2710 WRITE (unit=iw, fmt=
"(T3, A, T73, ES8.1)") &
2711 "HFX_RI_INFO| EPS_FILTER 2-center", ri_data%filter_eps_2c
2712 WRITE (unit=iw, fmt=
"(T3, A, T73, ES8.1)") &
2713 "HFX_RI_INFO| EPS_FILTER storage", ri_data%filter_eps_storage
2714 WRITE (unit=iw, fmt=
"(T3, A, T73, ES8.1)") &
2715 "HFX_RI_INFO| EPS_FILTER MO", ri_data%filter_eps_mo
2716 WRITE (unit=iw, fmt=
"(T3, A, T73, ES8.1)") &
2717 "HFX_RI_INFO| EPS_PGF_ORB", ri_data%eps_pgf_orb
2718 WRITE (unit=iw, fmt=
"((T3, A, T73, ES8.1))") &
2719 "HFX_RI_INFO| EPS_SCHWARZ: ", ri_data%eps_schwarz
2720 WRITE (unit=iw, fmt=
"((T3, A, T73, ES8.1))") &
2721 "HFX_RI_INFO| EPS_SCHWARZ_FORCES: ", ri_data%eps_schwarz_forces
2722 WRITE (unit=iw, fmt=
"(T3, A, T78, I3)") &
2723 "HFX_RI_INFO| Minimum block size", ri_data%min_bsize
2724 WRITE (unit=iw, fmt=
"(T3, A, T78, I3)") &
2725 "HFX_RI_INFO| MO block size", ri_data%max_bsize_MO
2726 WRITE (unit=iw, fmt=
"(T3, A, T79, I2)") &
2727 "HFX_RI_INFO| Memory reduction factor", ri_data%n_mem_input
2730 END SUBROUTINE hfx_print_ri_info
2738 SUBROUTINE hfx_print_info(x_data, hfx_section, i_rep)
2740 TYPE(section_vals_type),
POINTER :: hfx_section
2741 INTEGER,
INTENT(IN) :: i_rep
2745 TYPE(cp_logger_type),
POINTER :: logger
2748 logger => cp_get_default_logger()
2750 iw = cp_print_key_unit_nr(logger, hfx_section,
"HF_INFO", &
2751 extension=
".scfLog")
2754 WRITE (unit=iw, fmt=
"(/,(T3,A,T61,I20))") &
2755 "HFX_INFO| Replica ID: ", i_rep
2757 WRITE (iw,
'(T3,A,T61,F20.10)') &
2758 "HFX_INFO| FRACTION: ", x_data%general_parameter%fraction
2759 SELECT CASE (x_data%potential_parameter%potential_type)
2760 CASE (do_potential_coulomb)
2761 WRITE (unit=iw, fmt=
"((T3,A,T74,A))") &
2762 "HFX_INFO| Interaction Potential: ",
"COULOMB"
2763 CASE (do_potential_short)
2764 WRITE (unit=iw, fmt=
"((T3,A,T71,A))") &
2765 "HFX_INFO| Interaction Potential: ",
"SHORTRANGE"
2766 WRITE (iw,
'(T3,A,T61,F20.10)') &
2767 "HFX_INFO| Omega: ", x_data%potential_parameter%omega
2768 rc_ang = cp_unit_from_cp2k(x_data%potential_parameter%cutoff_radius,
"angstrom")
2769 WRITE (iw,
'(T3,A,T61,F20.10)') &
2770 "HFX_INFO| Cutoff Radius [angstrom]: ", rc_ang
2771 CASE (do_potential_long)
2772 WRITE (unit=iw, fmt=
"((T3,A,T72,A))") &
2773 "HFX_INFO| Interaction Potential: ",
"LONGRANGE"
2774 WRITE (iw,
'(T3,A,T61,F20.10)') &
2775 "HFX_INFO| Omega: ", x_data%potential_parameter%omega
2776 CASE (do_potential_mix_cl)
2777 WRITE (unit=iw, fmt=
"((T3,A,T75,A))") &
2778 "HFX_INFO| Interaction Potential: ",
"MIX_CL"
2779 WRITE (iw,
'(T3,A,T61,F20.10)') &
2780 "HFX_INFO| Omega: ", x_data%potential_parameter%omega
2781 WRITE (iw,
'(T3,A,T61,F20.10)') &
2782 "HFX_INFO| SCALE_COULOMB: ", x_data%potential_parameter%scale_coulomb
2783 WRITE (iw,
'(T3,A,T61,F20.10)') &
2784 "HFX_INFO| SCALE_LONGRANGE: ", x_data%potential_parameter%scale_longrange
2785 CASE (do_potential_gaussian)
2786 WRITE (unit=iw, fmt=
"((T3,A,T73,A))") &
2787 "HFX_INFO| Interaction Potential: ",
"GAUSSIAN"
2788 WRITE (iw,
'(T3,A,T61,F20.10)') &
2789 "HFX_INFO| Omega: ", x_data%potential_parameter%omega
2790 CASE (do_potential_mix_lg)
2791 WRITE (unit=iw, fmt=
"((T3,A,T75,A))") &
2792 "HFX_INFO| Interaction Potential: ",
"MIX_LG"
2793 WRITE (iw,
'(T3,A,T61,F20.10)') &
2794 "HFX_INFO| Omega: ", x_data%potential_parameter%omega
2795 WRITE (iw,
'(T3,A,T61,F20.10)') &
2796 "HFX_INFO| SCALE_LONGRANGE: ", x_data%potential_parameter%scale_longrange
2797 WRITE (iw,
'(T3,A,T61,F20.10)') &
2798 "HFX_INFO| SCALE_GAUSSIAN: ", x_data%potential_parameter%scale_gaussian
2799 CASE (do_potential_id)
2800 WRITE (unit=iw, fmt=
"((T3,A,T73,A))") &
2801 "HFX_INFO| Interaction Potential: ",
"IDENTITY"
2802 CASE (do_potential_truncated)
2803 WRITE (unit=iw, fmt=
"((T3,A,T72,A))") &
2804 "HFX_INFO| Interaction Potential: ",
"TRUNCATED"
2805 rc_ang = cp_unit_from_cp2k(x_data%potential_parameter%cutoff_radius,
"angstrom")
2806 WRITE (iw,
'(T3,A,T61,F20.10)') &
2807 "HFX_INFO| Cutoff Radius [angstrom]: ", rc_ang
2808 CASE (do_potential_mix_cl_trunc)
2809 WRITE (unit=iw, fmt=
"((T3,A,T65,A))") &
2810 "HFX_INFO| Interaction Potential: ",
"TRUNCATED MIX_CL"
2811 rc_ang = cp_unit_from_cp2k(x_data%potential_parameter%cutoff_radius,
"angstrom")
2812 WRITE (iw,
'(T3,A,T61,F20.10)') &
2813 "HFX_INFO| Cutoff Radius [angstrom]: ", rc_ang
2817 IF (x_data%do_hfx_ri)
THEN
2818 CALL hfx_print_ri_info(x_data%ri_data, hfx_section)
2820 CALL hfx_print_std_info(x_data, hfx_section)
2824 IF (x_data%use_ace .AND. iw > 0)
THEN
2825 WRITE (unit=iw, fmt=
"(/,T3,A)") &
2826 "HFX_INFO| ACE (Adaptively Compressed Exchange): ACTIVE"
2827 WRITE (unit=iw, fmt=
"(T3,A,T61,I20)") &
2828 "HFX_INFO| ACE rebuild frequency: ", x_data%ace_rebuild_freq
2831 CALL cp_print_key_finished_output(iw, logger, hfx_section, &
2833 END SUBROUTINE hfx_print_info
2842 INTEGER :: memory_usage
2846 DO bin = 1,
SIZE(data%maxval_container)
2849 DEALLOCATE (data%maxval_container(bin)%first)
2851 DEALLOCATE (data%maxval_container)
2853 IF (
ASSOCIATED(data%maxval_cache))
DEALLOCATE (data%maxval_cache)
2855 DO bin = 1,
SIZE(data%integral_containers, 2)
2859 DEALLOCATE (data%integral_containers(i, bin)%first)
2862 DEALLOCATE (data%integral_containers)
2864 IF (
ASSOCIATED(data%integral_caches))
DEALLOCATE (data%integral_caches)
2875 INTEGER,
INTENT(IN) :: bin_size
2879 ALLOCATE (data%maxval_cache(bin_size))
2880 DO bin = 1, bin_size
2881 data%maxval_cache(bin)%element_counter = 1
2883 ALLOCATE (data%maxval_container(bin_size))
2884 DO bin = 1, bin_size
2885 ALLOCATE (data%maxval_container(bin)%first)
2886 data%maxval_container(bin)%first%prev => null()
2887 data%maxval_container(bin)%first%next => null()
2888 data%maxval_container(bin)%current => data%maxval_container(bin)%first
2889 data%maxval_container(bin)%current%data = 0
2890 data%maxval_container(bin)%element_counter = 1
2893 ALLOCATE (data%integral_containers(64, bin_size))
2894 ALLOCATE (data%integral_caches(64, bin_size))
2896 DO bin = 1, bin_size
2898 data%integral_caches(i, bin)%element_counter = 1
2899 data%integral_caches(i, bin)%data = 0
2900 ALLOCATE (data%integral_containers(i, bin)%first)
2901 data%integral_containers(i, bin)%first%prev => null()
2902 data%integral_containers(i, bin)%first%next => null()
2903 data%integral_containers(i, bin)%current => data%integral_containers(i, bin)%first
2904 data%integral_containers(i, bin)%current%data = 0
2905 data%integral_containers(i, bin)%element_counter = 1
2922 TYPE(section_vals_type),
POINTER :: hfx_section1, hfx_section2
2923 LOGICAL,
INTENT(OUT) :: is_identical
2924 LOGICAL,
INTENT(OUT),
OPTIONAL :: same_except_frac
2926 CHARACTER(LEN=default_path_length) :: cval1, cval2
2927 INTEGER :: irep, ival1, ival2, n_rep_hf1, n_rep_hf2
2928 LOGICAL :: explicit1, explicit2, lval1, lval2
2929 REAL(dp) :: rval1, rval2
2930 TYPE(section_vals_type),
POINTER :: hfx_sub_section1, hfx_sub_section2
2932 is_identical = .true.
2933 IF (
PRESENT(same_except_frac)) same_except_frac = .false.
2935 CALL section_vals_get(hfx_section1, n_repetition=n_rep_hf1)
2936 CALL section_vals_get(hfx_section2, n_repetition=n_rep_hf2)
2937 is_identical = n_rep_hf1 == n_rep_hf2
2938 IF (.NOT. is_identical)
RETURN
2940 DO irep = 1, n_rep_hf1
2941 CALL section_vals_val_get(hfx_section1,
"PW_HFX", l_val=lval1, i_rep_section=irep)
2942 CALL section_vals_val_get(hfx_section2,
"PW_HFX", l_val=lval2, i_rep_section=irep)
2943 IF (lval1 .NEQV. lval2) is_identical = .false.
2945 CALL section_vals_val_get(hfx_section1,
"PW_HFX_BLOCKSIZE", i_val=ival1, i_rep_section=irep)
2946 CALL section_vals_val_get(hfx_section2,
"PW_HFX_BLOCKSIZE", i_val=ival2, i_rep_section=irep)
2947 IF (ival1 /= ival2) is_identical = .false.
2949 CALL section_vals_val_get(hfx_section1,
"TREAT_LSD_IN_CORE", l_val=lval1, i_rep_section=irep)
2950 CALL section_vals_val_get(hfx_section2,
"TREAT_LSD_IN_CORE", l_val=lval2, i_rep_section=irep)
2951 IF (lval1 .NEQV. lval2) is_identical = .false.
2953 hfx_sub_section1 => section_vals_get_subs_vals(hfx_section1,
"INTERACTION_POTENTIAL", i_rep_section=irep)
2954 hfx_sub_section2 => section_vals_get_subs_vals(hfx_section2,
"INTERACTION_POTENTIAL", i_rep_section=irep)
2956 CALL section_vals_val_get(hfx_sub_section1,
"OMEGA", r_val=rval1, i_rep_section=irep)
2957 CALL section_vals_val_get(hfx_sub_section2,
"OMEGA", r_val=rval2, i_rep_section=irep)
2958 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
2960 CALL section_vals_val_get(hfx_sub_section1,
"POTENTIAL_TYPE", i_val=ival1, i_rep_section=irep)
2961 CALL section_vals_val_get(hfx_sub_section2,
"POTENTIAL_TYPE", i_val=ival2, i_rep_section=irep)
2962 IF (ival1 /= ival2) is_identical = .false.
2963 IF (.NOT. is_identical)
RETURN
2965 IF (ival1 == do_potential_short)
THEN
2966 CALL section_vals_val_get(hfx_sub_section1,
"CUTOFF_RADIUS", explicit=explicit1)
2967 CALL section_vals_val_get(hfx_sub_section2,
"CUTOFF_RADIUS", explicit=explicit2)
2968 IF (explicit1 .NEQV. explicit2) is_identical = .false.
2969 IF (explicit1 .AND. explicit2)
THEN
2970 CALL section_vals_val_get(hfx_sub_section1,
"CUTOFF_RADIUS", r_val=rval1)
2971 CALL section_vals_val_get(hfx_sub_section2,
"CUTOFF_RADIUS", r_val=rval2)
2972 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
2976 IF (ival1 == do_potential_truncated .OR. ival1 == do_potential_mix_cl_trunc)
THEN
2977 CALL section_vals_val_get(hfx_sub_section1,
"CUTOFF_RADIUS", r_val=rval1, i_rep_section=irep)
2978 CALL section_vals_val_get(hfx_sub_section2,
"CUTOFF_RADIUS", r_val=rval2, i_rep_section=irep)
2979 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
2981 CALL section_vals_val_get(hfx_sub_section1,
"T_C_G_DATA", c_val=cval1, i_rep_section=irep)
2982 CALL section_vals_val_get(hfx_sub_section2,
"T_C_G_DATA", c_val=cval2, i_rep_section=irep)
2983 IF (cval1 /= cval2) is_identical = .false.
2986 CALL section_vals_val_get(hfx_sub_section1,
"SCALE_COULOMB", r_val=rval1, i_rep_section=irep)
2987 CALL section_vals_val_get(hfx_sub_section2,
"SCALE_COULOMB", r_val=rval2, i_rep_section=irep)
2988 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
2990 CALL section_vals_val_get(hfx_sub_section1,
"SCALE_GAUSSIAN", r_val=rval1, i_rep_section=irep)
2991 CALL section_vals_val_get(hfx_sub_section2,
"SCALE_GAUSSIAN", r_val=rval2, i_rep_section=irep)
2992 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
2994 CALL section_vals_val_get(hfx_sub_section1,
"SCALE_LONGRANGE", r_val=rval1, i_rep_section=irep)
2995 CALL section_vals_val_get(hfx_sub_section2,
"SCALE_LONGRANGE", r_val=rval2, i_rep_section=irep)
2996 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
2998 hfx_sub_section1 => section_vals_get_subs_vals(hfx_section1,
"PERIODIC", i_rep_section=irep)
2999 hfx_sub_section2 => section_vals_get_subs_vals(hfx_section2,
"PERIODIC", i_rep_section=irep)
3001 CALL section_vals_val_get(hfx_sub_section1,
"NUMBER_OF_SHELLS", i_val=ival1, i_rep_section=irep)
3002 CALL section_vals_val_get(hfx_sub_section2,
"NUMBER_OF_SHELLS", i_val=ival2, i_rep_section=irep)
3003 IF (ival1 /= ival2) is_identical = .false.
3005 hfx_sub_section1 => section_vals_get_subs_vals(hfx_section1,
"RI", i_rep_section=irep)
3006 hfx_sub_section2 => section_vals_get_subs_vals(hfx_section2,
"RI", i_rep_section=irep)
3008 CALL section_vals_val_get(hfx_sub_section1,
"_SECTION_PARAMETERS_", l_val=lval1, i_rep_section=irep)
3009 CALL section_vals_val_get(hfx_sub_section2,
"_SECTION_PARAMETERS_", l_val=lval2, i_rep_section=irep)
3010 IF (lval1 .NEQV. lval2) is_identical = .false.
3012 CALL section_vals_val_get(hfx_sub_section1,
"CUTOFF_RADIUS", r_val=rval1, i_rep_section=irep)
3013 CALL section_vals_val_get(hfx_sub_section2,
"CUTOFF_RADIUS", r_val=rval2, i_rep_section=irep)
3014 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
3016 CALL section_vals_val_get(hfx_sub_section1,
"EPS_EIGVAL", r_val=rval1, i_rep_section=irep)
3017 CALL section_vals_val_get(hfx_sub_section2,
"EPS_EIGVAL", r_val=rval2, i_rep_section=irep)
3018 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
3020 CALL section_vals_val_get(hfx_sub_section1,
"EPS_FILTER", r_val=rval1, i_rep_section=irep)
3021 CALL section_vals_val_get(hfx_sub_section2,
"EPS_FILTER", r_val=rval2, i_rep_section=irep)
3022 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
3024 CALL section_vals_val_get(hfx_sub_section1,
"EPS_FILTER_2C", r_val=rval1, i_rep_section=irep)
3025 CALL section_vals_val_get(hfx_sub_section2,
"EPS_FILTER_2C", r_val=rval2, i_rep_section=irep)
3026 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
3028 CALL section_vals_val_get(hfx_sub_section1,
"EPS_FILTER_MO", r_val=rval1, i_rep_section=irep)
3029 CALL section_vals_val_get(hfx_sub_section2,
"EPS_FILTER_MO", r_val=rval2, i_rep_section=irep)
3030 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
3032 CALL section_vals_val_get(hfx_sub_section1,
"EPS_PGF_ORB", r_val=rval1, i_rep_section=irep)
3033 CALL section_vals_val_get(hfx_sub_section2,
"EPS_PGF_ORB", 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,
"MAX_BLOCK_SIZE_MO", i_val=ival1, i_rep_section=irep)
3037 CALL section_vals_val_get(hfx_sub_section2,
"MAX_BLOCK_SIZE_MO", i_val=ival2, i_rep_section=irep)
3038 IF (ival1 /= ival2) is_identical = .false.
3040 CALL section_vals_val_get(hfx_sub_section1,
"MIN_BLOCK_SIZE", i_val=ival1, i_rep_section=irep)
3041 CALL section_vals_val_get(hfx_sub_section2,
"MIN_BLOCK_SIZE", i_val=ival2, i_rep_section=irep)
3042 IF (ival1 /= ival2) is_identical = .false.
3044 CALL section_vals_val_get(hfx_sub_section1,
"OMEGA", r_val=rval1, i_rep_section=irep)
3045 CALL section_vals_val_get(hfx_sub_section2,
"OMEGA", 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,
"RI_FLAVOR", i_val=ival1, i_rep_section=irep)
3049 CALL section_vals_val_get(hfx_sub_section2,
"RI_FLAVOR", i_val=ival2, i_rep_section=irep)
3050 IF (ival1 /= ival2) is_identical = .false.
3052 CALL section_vals_val_get(hfx_sub_section1,
"RI_METRIC", i_val=ival1, i_rep_section=irep)
3053 CALL section_vals_val_get(hfx_sub_section2,
"RI_METRIC", i_val=ival2, i_rep_section=irep)
3054 IF (ival1 /= ival2) is_identical = .false.
3056 hfx_sub_section1 => section_vals_get_subs_vals(hfx_section1,
"SCREENING", i_rep_section=irep)
3057 hfx_sub_section2 => section_vals_get_subs_vals(hfx_section2,
"SCREENING", i_rep_section=irep)
3059 CALL section_vals_val_get(hfx_sub_section1,
"EPS_SCHWARZ", r_val=rval1, i_rep_section=irep)
3060 CALL section_vals_val_get(hfx_sub_section2,
"EPS_SCHWARZ", r_val=rval2, i_rep_section=irep)
3061 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
3063 CALL section_vals_val_get(hfx_sub_section1,
"EPS_SCHWARZ_FORCES", r_val=rval1, i_rep_section=irep)
3064 CALL section_vals_val_get(hfx_sub_section2,
"EPS_SCHWARZ_FORCES", r_val=rval2, i_rep_section=irep)
3065 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
3067 CALL section_vals_val_get(hfx_sub_section1,
"P_SCREEN_CORRECTION_FACTOR", r_val=rval1, i_rep_section=irep)
3068 CALL section_vals_val_get(hfx_sub_section2,
"P_SCREEN_CORRECTION_FACTOR", r_val=rval2, i_rep_section=irep)
3069 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
3071 CALL section_vals_val_get(hfx_sub_section1,
"SCREEN_ON_INITIAL_P", l_val=lval1, i_rep_section=irep)
3072 CALL section_vals_val_get(hfx_sub_section2,
"SCREEN_ON_INITIAL_P", l_val=lval2, i_rep_section=irep)
3073 IF (lval1 .NEQV. lval2) is_identical = .false.
3075 CALL section_vals_val_get(hfx_sub_section1,
"SCREEN_P_FORCES", l_val=lval1, i_rep_section=irep)
3076 CALL section_vals_val_get(hfx_sub_section2,
"SCREEN_P_FORCES", l_val=lval2, i_rep_section=irep)
3077 IF (lval1 .NEQV. lval2) is_identical = .false.
3082 IF (is_identical)
THEN
3083 DO irep = 1, n_rep_hf1
3084 CALL section_vals_val_get(hfx_section1,
"FRACTION", r_val=rval1, i_rep_section=irep)
3085 CALL section_vals_val_get(hfx_section2,
"FRACTION", r_val=rval2, i_rep_section=irep)
3086 IF (abs(rval1 - rval2) > epsilon(1.0_dp)) is_identical = .false.
3089 IF (
PRESENT(same_except_frac))
THEN
3090 IF (.NOT. is_identical) same_except_frac = .true.
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, ccon)
...
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.
logical function, public file_exists(file_name)
Checks if a file exists, considering also the file discovery mechanism.
subroutine, public open_file(file_name, unit_number, file_status, file_form, file_action, file_position, file_pad, file_access, debug)
Opens a file and returns its logical unit number.
subroutine, public close_file(unit_number, file_status)
Closes an open file given by its logical unit number.
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...
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,...
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, file_access)
...
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....
Four-center integral evaluation with an encapsulated Libint backend.
subroutine, public four_center_integral_init(context, max_am)
Initialize the four-center energy and first-derivative workspaces.
subroutine, public four_center_integral_cleanup(context)
Release the workspaces of an owning four-center context.
Gaussian-product geometry and radial seeds shared by four-center evaluation and screening.
subroutine, public prepare_eri4_contraction(basis, contraction)
Split the initialized basis coefficients into angular and radial factors.
Primitive Gaussian pairs and products for four-center integrals.
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)
...
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)
...
Library choices for electronic integral APIs.
pure logical function, public compare_potential_types(potential1, potential2)
Compare the parameters defining two radial operators.
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
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.
Define methods related to particle_type.
subroutine, public get_particle_set(particle_set, qs_kind_set, first_sgf, last_sgf, nsgf, nmao, basis, ncgf)
Get the components of a particle set.
Define the data structure for the particle information.
Definition of physical constants:
real(kind=dp), parameter, public a_bohr
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, cneo_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, hund_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, proj_shell_charge, lr_atom, do_mtlr, u_j_loop, ao_coef, init_u_ramping_each_scf, reltmat, ghost, monovalent, 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, do_mtlr_present, basis_type, total_zeff_corr, npgf_seg, cneo_potential_present, nkind_q, natom_q)
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.
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...
Context owning the energy and first-derivative backend workspaces.
Contraction data for one angular momentum in a basis set.
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.