28#include "./base/base_uses.f90"
36 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'semi_empirical_store_int_types'
44 LOGICAL :: filling_containers = .false., compress = .false.
45 INTEGER :: nbuffer = -1
46 REAL(kind=
dp),
POINTER,
DIMENSION(:) :: max_val_buffer => null(), uncompressed_container => null()
49 POINTER :: integral_caches => null()
51 POINTER :: integral_containers => null()
73 LOGICAL,
INTENT(in),
OPTIONAL :: compression
78 cpassert(.NOT.
ASSOCIATED(store_int_env))
79 ALLOCATE (store_int_env)
80 store_int_env%filling_containers = .true.
81 store_int_env%nbuffer = 0
82 NULLIFY (store_int_env%max_val_buffer, store_int_env%uncompressed_container)
86 IF (
PRESENT(compression))
THEN
87 store_int_env%compress = compression
92 skip_in_core_forces=.true.)
93 store_int_env%memory_parameter%ram_counter = 0
95 IF (.NOT. store_int_env%compress)
THEN
96 store_int_env%memory_parameter%cache_size = 1
100 IF (store_int_env%memory_parameter%do_disk_storage)
THEN
101 cpabort(
"Disk storage for SEMIEMPIRICAL methods disabled! ")
105 IF (.NOT. store_int_env%memory_parameter%do_all_on_the_fly .AND. store_int_env%compress)
THEN
106 ALLOCATE (store_int_env%integral_containers(64))
107 ALLOCATE (store_int_env%integral_caches(64))
109 store_int_env%integral_caches(i)%element_counter = 1
110 store_int_env%integral_caches(i)%data = 0
111 ALLOCATE (store_int_env%integral_containers(i)%first)
112 store_int_env%integral_containers(i)%first%prev => null()
113 store_int_env%integral_containers(i)%first%next => null()
114 store_int_env%integral_containers(i)%current => store_int_env%integral_containers(i)%first
115 store_int_env%integral_containers(i)%current%data = 0
116 store_int_env%integral_containers(i)%element_counter = 1
132 IF (
ASSOCIATED(store_int_env))
THEN
134 IF (.NOT. store_int_env%memory_parameter%do_all_on_the_fly)
THEN
135 IF (store_int_env%compress)
THEN
139 store_int_env%memory_parameter%actual_memory_usage, &
141 DEALLOCATE (store_int_env%integral_containers(i)%first)
143 IF (
ASSOCIATED(store_int_env%max_val_buffer))
THEN
144 DEALLOCATE (store_int_env%max_val_buffer)
146 DEALLOCATE (store_int_env%integral_containers)
147 DEALLOCATE (store_int_env%integral_caches)
149 IF (
ASSOCIATED(store_int_env%uncompressed_container))
THEN
150 DEALLOCATE (store_int_env%uncompressed_container)
155 DEALLOCATE (store_int_env)
169 LOGICAL,
INTENT(IN) :: geometry_did_change
173 IF (
ASSOCIATED(store_int_env))
THEN
174 IF (.NOT. store_int_env%memory_parameter%do_all_on_the_fly)
THEN
175 IF (geometry_did_change)
THEN
176 store_int_env%filling_containers = .true.
177 store_int_env%nbuffer = 0
178 store_int_env%memory_parameter%ram_counter = huge(store_int_env%memory_parameter%ram_counter)
179 IF (store_int_env%compress)
THEN
181 CALL reallocate(store_int_env%max_val_buffer, 1, store_int_env%nbuffer)
185 store_int_env%memory_parameter%actual_memory_usage, &
190 CALL reallocate(store_int_env%uncompressed_container, 1, 0)
191 store_int_env%memory_parameter%actual_memory_usage = 1
194 store_int_env%filling_containers = .false.
195 store_int_env%nbuffer = 0
196 IF (store_int_env%compress)
THEN
200 store_int_env%integral_containers(i), &
201 store_int_env%memory_parameter%actual_memory_usage, .false.)
204 store_int_env%memory_parameter%actual_memory_usage = 1
221 LOGICAL,
INTENT(IN) :: geometry_did_change
225 IF (
ASSOCIATED(store_int_env))
THEN
226 IF (.NOT. store_int_env%memory_parameter%do_all_on_the_fly)
THEN
227 IF (geometry_did_change)
THEN
228 IF (store_int_env%compress)
THEN
232 store_int_env%integral_containers(i), &
233 store_int_env%memory_parameter%actual_memory_usage, .false.)
236 CALL reallocate(store_int_env%max_val_buffer, 1, store_int_env%nbuffer)
239 CALL reallocate(store_int_env%uncompressed_container, 1, &
240 store_int_env%memory_parameter%actual_memory_usage - 1)
243 IF (store_int_env%compress)
THEN
247 store_int_env%integral_caches(i), &
248 store_int_env%integral_containers(i), store_int_env%memory_parameter%actual_memory_usage, &
routines and types for Hartree-Fock-Exchange
subroutine, public hfx_flush_last_cache(nbits, cache, container, memory_usage, use_disk_storage)
This routine compresses the last probably not yet compressed cache into a container
subroutine, public hfx_decompress_first_cache(nbits, cache, container, memory_usage, use_disk_storage)
This routine decompresses the first bunch of data in a container and copies them into a cache
subroutine, public hfx_reset_cache_and_container(cache, container, memory_usage, do_disk_storage)
This routine resets the containers list pointer to the first element and moves the element counters o...
Types and set/get functions for HFX.
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 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
Defines the basic variable types.
integer, parameter, public dp
Utility routines for the memory handling.
Type to store integrals for semi-empirical calculations.
subroutine, public semi_empirical_si_finalize(store_int_env, geometry_did_change)
Deallocate the semi-empirical store integrals type.
subroutine, public semi_empirical_si_initialize(store_int_env, geometry_did_change)
Deallocate the semi-empirical store integrals type.
subroutine, public semi_empirical_si_release(store_int_env)
Deallocate the semi-empirical store integrals type.
subroutine, public semi_empirical_si_create(store_int_env, se_section, compression)
Allocate semi-empirical store integrals type.
Semi-empirical store integrals type.