45#include "./base/base_uses.f90"
51 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'semi_empirical_integrals'
71 SUBROUTINE rotint(sepi, sepj, rij, w, anag, se_int_control, se_taper, store_int_env)
73 REAL(
dp),
DIMENSION(3),
INTENT(IN) :: rij
74 REAL(
dp),
DIMENSION(2025),
INTENT(OUT) :: w
80 INTEGER :: buffer_left, buffer_size, buffer_start, &
81 cache_size, memory_usage, nbits, &
83 INTEGER(KIND=int_8) :: mem_compression_counter
84 LOGICAL :: buffer_overflow
85 REAL(kind=
dp) :: eps_storage
88 IF (.NOT. store_int_env%memory_parameter%do_all_on_the_fly)
THEN
89 nints = (sepi%natorb*(sepi%natorb + 1)/2)*(sepj%natorb*(sepj%natorb + 1)/2)
90 cache_size = store_int_env%memory_parameter%cache_size
91 eps_storage = store_int_env%memory_parameter%eps_storage_scaling
92 IF (store_int_env%filling_containers)
THEN
93 mem_compression_counter = store_int_env%memory_parameter%actual_memory_usage*cache_size
94 IF (mem_compression_counter > store_int_env%memory_parameter%max_compression_counter)
THEN
95 buffer_overflow = .true.
96 store_int_env%memory_parameter%ram_counter = store_int_env%nbuffer
98 store_int_env%nbuffer = store_int_env%nbuffer + 1
99 buffer_overflow = .false.
103 CALL rotint_gks(sepi, sepj, rij, w, se_int_control=se_int_control)
106 CALL rotint_ana(sepi, sepj, rij, w, se_int_control=se_int_control, se_taper=se_taper)
108 CALL rotint_num(sepi, sepj, rij, w, se_int_control=se_int_control, se_taper=se_taper)
112 IF (.NOT. buffer_overflow)
THEN
113 IF (store_int_env%compress)
THEN
115 IF (store_int_env%nbuffer >
SIZE(store_int_env%max_val_buffer))
THEN
116 new_size = store_int_env%nbuffer + 1000
117 CALL reallocate(store_int_env%max_val_buffer, 1, new_size)
119 store_int_env%max_val_buffer(store_int_env%nbuffer) = maxval(abs(w(1:nints)))
121 nbits = exponent(store_int_env%max_val_buffer(store_int_env%nbuffer)/eps_storage) + 1
124 DO WHILE (buffer_left > 0)
125 buffer_size = min(buffer_left, cache_size)
127 buffer_size, nbits, &
128 store_int_env%integral_caches(nbits), &
129 store_int_env%integral_containers(nbits), &
130 eps_storage, 1.0_dp, &
131 store_int_env%memory_parameter%actual_memory_usage, &
133 buffer_left = buffer_left - buffer_size
134 buffer_start = buffer_start + buffer_size
138 memory_usage = store_int_env%memory_parameter%actual_memory_usage
139 cpassert((nints/1.2_dp) <= huge(0) - memory_usage)
140 IF (memory_usage + nints >
SIZE(store_int_env%uncompressed_container))
THEN
141 new_size = int((memory_usage + nints)*1.2_dp)
142 CALL reallocate(store_int_env%uncompressed_container, 1, new_size)
144 store_int_env%uncompressed_container(memory_usage:memory_usage + nints - 1) = w(1:nints)
145 store_int_env%memory_parameter%actual_memory_usage = memory_usage + nints
150 IF (store_int_env%memory_parameter%ram_counter == store_int_env%nbuffer)
THEN
151 buffer_overflow = .true.
153 store_int_env%nbuffer = store_int_env%nbuffer + 1
154 buffer_overflow = .false.
157 IF (.NOT. buffer_overflow)
THEN
158 IF (store_int_env%compress)
THEN
160 nbits = exponent(store_int_env%max_val_buffer(store_int_env%nbuffer)/eps_storage) + 1
163 DO WHILE (buffer_left > 0)
164 buffer_size = min(buffer_left, cache_size)
166 buffer_size, nbits, &
167 store_int_env%integral_caches(nbits), &
168 store_int_env%integral_containers(nbits), &
169 eps_storage, 1.0_dp, &
170 store_int_env%memory_parameter%actual_memory_usage, &
172 buffer_left = buffer_left - buffer_size
173 buffer_start = buffer_start + buffer_size
177 memory_usage = store_int_env%memory_parameter%actual_memory_usage
178 w(1:nints) = store_int_env%uncompressed_container(memory_usage:memory_usage + nints - 1)
179 store_int_env%memory_parameter%actual_memory_usage = memory_usage + nints
183 CALL rotint_gks(sepi, sepj, rij, w, se_int_control=se_int_control)
186 CALL rotint_ana(sepi, sepj, rij, w, se_int_control=se_int_control, se_taper=se_taper)
188 CALL rotint_num(sepi, sepj, rij, w, se_int_control=se_int_control, se_taper=se_taper)
195 CALL rotint_gks(sepi, sepj, rij, w, se_int_control=se_int_control)
198 CALL rotint_ana(sepi, sepj, rij, w, se_int_control=se_int_control, se_taper=se_taper)
200 CALL rotint_num(sepi, sepj, rij, w, se_int_control=se_int_control, se_taper=se_taper)
221 SUBROUTINE rotnuc(sepi, sepj, rij, e1b, e2a, itype, anag, se_int_control, se_taper, store_int_env)
223 REAL(
dp),
DIMENSION(3),
INTENT(IN) :: rij
224 REAL(
dp),
DIMENSION(45),
INTENT(OUT),
OPTIONAL :: e1b, e2a
225 INTEGER,
INTENT(IN) :: itype
226 LOGICAL,
INTENT(IN) :: anag
231 INTEGER :: buffer_left, buffer_size, buffer_start, &
232 cache_size, memory_usage, nbits, &
233 new_size, nints, nints_1, nints_2
234 INTEGER(KIND=int_8) :: mem_compression_counter
235 LOGICAL :: buffer_overflow, do_all_on_the_fly
236 REAL(kind=
dp) :: eps_storage, w(90)
238 do_all_on_the_fly = .true.
239 IF (
PRESENT(e1b)) e1b(:) = 0.0_dp
240 IF (
PRESENT(e2a)) e2a(:) = 0.0_dp
241 IF (
PRESENT(store_int_env)) do_all_on_the_fly = store_int_env%memory_parameter%do_all_on_the_fly
242 IF (.NOT. do_all_on_the_fly)
THEN
245 IF (
PRESENT(e1b)) nints_1 = (sepi%natorb*(sepi%natorb + 1)/2)
246 IF (
PRESENT(e2a)) nints_2 = (sepj%natorb*(sepj%natorb + 1)/2)
247 nints = nints_1 + nints_2
249 cpassert(nints <= 90)
250 cache_size = store_int_env%memory_parameter%cache_size
251 eps_storage = store_int_env%memory_parameter%eps_storage_scaling
252 IF (store_int_env%filling_containers)
THEN
253 mem_compression_counter = store_int_env%memory_parameter%actual_memory_usage*cache_size
254 IF (mem_compression_counter > store_int_env%memory_parameter%max_compression_counter)
THEN
255 buffer_overflow = .true.
256 store_int_env%memory_parameter%ram_counter = store_int_env%nbuffer
258 store_int_env%nbuffer = store_int_env%nbuffer + 1
259 buffer_overflow = .false.
263 CALL rotnuc_gks(sepi, sepj, rij, e1b=e1b, e2a=e2a, &
264 se_int_control=se_int_control)
267 CALL rotnuc_ana(sepi, sepj, rij, e1b=e1b, e2a=e2a, itype=itype, &
268 se_int_control=se_int_control, se_taper=se_taper)
270 CALL rotnuc_num(sepi, sepj, rij, e1b=e1b, e2a=e2a, itype=itype, &
271 se_int_control=se_int_control, se_taper=se_taper)
275 IF (.NOT. buffer_overflow)
THEN
276 IF (
PRESENT(e1b)) w(1:nints_1) = e1b(1:nints_1)
277 IF (
PRESENT(e2a)) w(nints_1 + 1:nints) = e2a(1:nints_2)
279 IF (store_int_env%compress)
THEN
281 IF (store_int_env%nbuffer >
SIZE(store_int_env%max_val_buffer))
THEN
282 new_size = store_int_env%nbuffer + 1000
283 CALL reallocate(store_int_env%max_val_buffer, 1, new_size)
285 store_int_env%max_val_buffer(store_int_env%nbuffer) = maxval(abs(w(1:nints)))
287 nbits = exponent(store_int_env%max_val_buffer(store_int_env%nbuffer)/eps_storage) + 1
290 DO WHILE (buffer_left > 0)
291 buffer_size = min(buffer_left, cache_size)
293 buffer_size, nbits, &
294 store_int_env%integral_caches(nbits), &
295 store_int_env%integral_containers(nbits), &
296 eps_storage, 1.0_dp, &
297 store_int_env%memory_parameter%actual_memory_usage, &
299 buffer_left = buffer_left - buffer_size
300 buffer_start = buffer_start + buffer_size
304 memory_usage = store_int_env%memory_parameter%actual_memory_usage
305 cpassert((nints/1.2_dp) <= huge(0) - memory_usage)
306 IF (memory_usage + nints >
SIZE(store_int_env%uncompressed_container))
THEN
307 new_size = int((memory_usage + nints)*1.2_dp)
308 CALL reallocate(store_int_env%uncompressed_container, 1, new_size)
310 store_int_env%uncompressed_container(memory_usage:memory_usage + nints - 1) = w(1:nints)
311 store_int_env%memory_parameter%actual_memory_usage = memory_usage + nints
316 IF (store_int_env%memory_parameter%ram_counter == store_int_env%nbuffer)
THEN
317 buffer_overflow = .true.
319 store_int_env%nbuffer = store_int_env%nbuffer + 1
320 buffer_overflow = .false.
323 IF (.NOT. buffer_overflow)
THEN
324 IF (store_int_env%compress)
THEN
326 nbits = exponent(store_int_env%max_val_buffer(store_int_env%nbuffer)/eps_storage) + 1
329 DO WHILE (buffer_left > 0)
330 buffer_size = min(buffer_left, cache_size)
332 buffer_size, nbits, &
333 store_int_env%integral_caches(nbits), &
334 store_int_env%integral_containers(nbits), &
335 eps_storage, 1.0_dp, &
336 store_int_env%memory_parameter%actual_memory_usage, &
338 buffer_left = buffer_left - buffer_size
339 buffer_start = buffer_start + buffer_size
343 memory_usage = store_int_env%memory_parameter%actual_memory_usage
344 w(1:nints) = store_int_env%uncompressed_container(memory_usage:memory_usage + nints - 1)
345 store_int_env%memory_parameter%actual_memory_usage = memory_usage + nints
347 IF (
PRESENT(e1b)) e1b(1:nints_1) = w(1:nints_1)
348 IF (
PRESENT(e2a)) e2a(1:nints_2) = w(nints_1 + 1:nints)
351 CALL rotnuc_gks(sepi, sepj, rij, e1b=e1b, e2a=e2a, &
352 se_int_control=se_int_control)
355 CALL rotnuc_ana(sepi, sepj, rij, e1b=e1b, e2a=e2a, itype=itype, &
356 se_int_control=se_int_control, se_taper=se_taper)
358 CALL rotnuc_num(sepi, sepj, rij, e1b=e1b, e2a=e2a, itype=itype, &
359 se_int_control=se_int_control, se_taper=se_taper)
366 CALL rotnuc_gks(sepi, sepj, rij, e1b=e1b, e2a=e2a, &
367 se_int_control=se_int_control)
370 CALL rotnuc_ana(sepi, sepj, rij, e1b=e1b, e2a=e2a, itype=itype, &
371 se_int_control=se_int_control, se_taper=se_taper)
373 CALL rotnuc_num(sepi, sepj, rij, e1b=e1b, e2a=e2a, itype=itype, &
374 se_int_control=se_int_control, se_taper=se_taper)
397 SUBROUTINE corecore(sepi, sepj, rij, enuc, itype, anag, se_int_control, se_taper)
399 REAL(
dp),
DIMENSION(3),
INTENT(IN) :: rij
400 REAL(
dp),
INTENT(OUT) :: enuc
401 INTEGER,
INTENT(IN) :: itype
402 LOGICAL,
INTENT(IN) :: anag
408 CALL corecore_gks(sepi, sepj, rij, enuc=enuc, se_int_control=se_int_control)
411 CALL corecore_ana(sepi, sepj, rij, enuc=enuc, itype=itype, se_int_control=se_int_control, &
414 CALL corecore_num(sepi, sepj, rij, enuc=enuc, itype=itype, se_int_control=se_int_control, &
436 SUBROUTINE corecore_el(sepi, sepj, rij, enuc, itype, anag, se_int_control, se_taper)
438 REAL(
dp),
DIMENSION(3),
INTENT(IN) :: rij
439 REAL(
dp),
INTENT(OUT) :: enuc
440 INTEGER,
INTENT(IN) :: itype
441 LOGICAL,
INTENT(IN) :: anag
447 CALL corecore_el_ana(sepi, sepj, rij, enuc=enuc, itype=itype, se_int_control=se_int_control, &
450 CALL corecore_el_num(sepi, sepj, rij, enuc=enuc, itype=itype, se_int_control=se_int_control, &
469 SUBROUTINE drotint(sepi, sepj, rij, dw, delta, anag, se_int_control, se_taper)
471 REAL(
dp),
DIMENSION(3),
INTENT(IN) :: rij
472 REAL(
dp),
DIMENSION(3, 2025),
INTENT(OUT) :: dw
473 REAL(
dp),
INTENT(IN) :: delta
474 LOGICAL,
INTENT(IN) :: anag
480 CALL drotint_gks(sepi, sepj, rij, dw=dw, se_int_control=se_int_control)
483 CALL rotint_ana(sepi, sepj, rij, dw=dw, se_int_control=se_int_control, se_taper=se_taper)
485 CALL drotint_num(sepi, sepj, rij, dw, delta, se_int_control=se_int_control, se_taper=se_taper)
506 SUBROUTINE drotnuc(sepi, sepj, rij, de1b, de2a, itype, delta, anag, se_int_control, se_taper)
508 REAL(
dp),
DIMENSION(3),
INTENT(IN) :: rij
509 REAL(
dp),
DIMENSION(3, 45),
INTENT(OUT),
OPTIONAL :: de1b, de2a
510 INTEGER,
INTENT(IN) :: itype
511 REAL(
dp),
INTENT(IN) :: delta
512 LOGICAL,
INTENT(IN) :: anag
516 IF (
PRESENT(de1b)) de1b(:, :) = 0.0_dp
517 IF (
PRESENT(de2a)) de2a(:, :) = 0.0_dp
519 CALL drotnuc_gks(sepi, sepj, rij, de1b=de1b, de2a=de2a, &
520 se_int_control=se_int_control)
523 CALL rotnuc_ana(sepi, sepj, rij, de1b=de1b, de2a=de2a, itype=itype, &
524 se_int_control=se_int_control, se_taper=se_taper)
526 CALL drotnuc_num(sepi, sepj, rij, de1b=de1b, de2a=de2a, itype=itype, &
527 delta=delta, se_int_control=se_int_control, se_taper=se_taper)
547 SUBROUTINE dcorecore(sepi, sepj, rij, denuc, itype, delta, anag, se_int_control, se_taper)
549 REAL(
dp),
DIMENSION(3),
INTENT(IN) :: rij
550 REAL(
dp),
DIMENSION(3),
INTENT(OUT) :: denuc
551 INTEGER,
INTENT(IN) :: itype
552 REAL(
dp),
INTENT(IN) :: delta
553 LOGICAL,
INTENT(IN) :: anag
559 CALL corecore_gks(sepi, sepj, rij, denuc=denuc, se_int_control=se_int_control)
562 CALL corecore_ana(sepi, sepj, rij, denuc=denuc, itype=itype, se_int_control=se_int_control, &
565 CALL dcorecore_num(sepi, sepj, rij, denuc=denuc, delta=delta, itype=itype, &
566 se_int_control=se_int_control, se_taper=se_taper)
588 SUBROUTINE dcorecore_el(sepi, sepj, rij, denuc, itype, delta, anag, se_int_control, se_taper)
590 REAL(
dp),
DIMENSION(3),
INTENT(IN) :: rij
591 REAL(
dp),
DIMENSION(3),
INTENT(OUT) :: denuc
592 INTEGER,
INTENT(IN) :: itype
593 REAL(
dp),
INTENT(IN) :: delta
594 LOGICAL,
INTENT(IN) :: anag
600 CALL corecore_el_ana(sepi, sepj, rij, denuc=denuc, itype=itype, se_int_control=se_int_control, &
603 CALL dcorecore_el_num(sepi, sepj, rij, denuc=denuc, delta=delta, itype=itype, &
604 se_int_control=se_int_control, se_taper=se_taper)
routines and types for Hartree-Fock-Exchange
subroutine, public hfx_get_mult_cache_elements(values, nints, nbits, cache, container, eps_schwarz, pmax_entry, memory_usage, use_disk_storage)
This routine returns a bunch real values from a cache. If the cache is empty a decompression routine ...
subroutine, public hfx_add_mult_cache_elements(values, nints, nbits, cache, container, eps_schwarz, pmax_entry, memory_usage, use_disk_storage)
This routine adds an a few real values to a cache. If the cache is full a compression routine is invo...
Defines the basic variable types.
integer, parameter, public int_8
integer, parameter, public dp
Utility routines for the memory handling.
Analytical derivatives of Integrals for semi-empirical methods.
recursive subroutine, public rotint_ana(sepi, sepj, rijv, w, dw, se_int_control, se_taper)
calculates the derivative of the two-particle interactions
recursive subroutine, public corecore_el_ana(sepi, sepj, rijv, itype, enuc, denuc, se_int_control, se_taper)
Computes analytical gradients for semiempirical core-core electrostatic interaction only.
recursive subroutine, public corecore_ana(sepi, sepj, rijv, itype, enuc, denuc, se_int_control, se_taper)
Computes analytical gradients for semiempirical core-core interaction.
recursive subroutine, public rotnuc_ana(sepi, sepj, rijv, itype, e1b, e2a, de1b, de2a, se_int_control, se_taper)
Computes analytical gradients for semiempirical integrals.
Integral GKS scheme: The order of the integrals in makeCoul reflects the standard order by MOPAC.
subroutine, public drotnuc_gks(sepi, sepj, rij, de1b, de2a, se_int_control)
Computes the derivatives of the electron-nuclei integrals.
subroutine, public corecore_gks(sepi, sepj, rijv, enuc, denuc, se_int_control)
Computes nuclei-nuclei interactions.
subroutine, public drotint_gks(sepi, sepj, rij, dw, se_int_control)
Computes the derivatives of the electron-electron integrals.
subroutine, public rotnuc_gks(sepi, sepj, rij, e1b, e2a, se_int_control)
Computes the electron-nuclei integrals.
subroutine, public rotint_gks(sepi, sepj, rij, w, se_int_control)
Computes the electron-electron integrals.
Integrals for semi-empiric methods.
subroutine, public rotnuc_num(sepi, sepj, rijv, e1b, e2a, itype, se_int_control, se_taper)
Computes the two-particle interactions.
subroutine, public corecore_el_num(sepi, sepj, rijv, enuc, itype, se_int_control, se_taper)
Computes the electrostatic core-core interactions only.
subroutine, public rotint_num(sepi, sepj, rijv, w, se_int_control, se_taper)
Computes the two particle interactions in the lab frame.
subroutine, public drotint_num(sepi, sepj, r, dw, delta, se_int_control, se_taper)
Numerical Derivatives for rotint.
subroutine, public drotnuc_num(sepi, sepj, r, de1b, de2a, itype, delta, se_int_control, se_taper)
Numerical Derivatives for rotnuc.
subroutine, public dcorecore_num(sepi, sepj, r, denuc, itype, delta, se_int_control, se_taper)
Numerical Derivatives for corecore.
subroutine, public dcorecore_el_num(sepi, sepj, r, denuc, itype, delta, se_int_control, se_taper)
Numerical Derivatives for corecore.
subroutine, public corecore_num(sepi, sepj, rijv, enuc, itype, se_int_control, se_taper)
Computes the core-core interactions.
Set of wrappers for semi-empirical analytical/numerical Integrals routines.
subroutine, public dcorecore_el(sepi, sepj, rij, denuc, itype, delta, anag, se_int_control, se_taper)
wrapper for numerical/analytical routines core-core electrostatic (only) integrals derivatives
subroutine, public rotnuc(sepi, sepj, rij, e1b, e2a, itype, anag, se_int_control, se_taper, store_int_env)
wrapper for numerical/analytical 1 center 1 electron integrals
subroutine, public corecore_el(sepi, sepj, rij, enuc, itype, anag, se_int_control, se_taper)
wrapper for numerical/analytical routines core-core electrostatic (only) integrals
subroutine, public dcorecore(sepi, sepj, rij, denuc, itype, delta, anag, se_int_control, se_taper)
wrapper for numerical/analytical routines
subroutine, public corecore(sepi, sepj, rij, enuc, itype, anag, se_int_control, se_taper)
wrapper for numerical/analytical routines core-core integrals, since are evaluated only once do not n...
subroutine, public drotint(sepi, sepj, rij, dw, delta, anag, se_int_control, se_taper)
wrapper for numerical/analytical routines
subroutine, public rotint(sepi, sepj, rij, w, anag, se_int_control, se_taper, store_int_env)
wrapper for numerical/analytical 2 center 2 electrons integrals routines with possibility of incore s...
subroutine, public drotnuc(sepi, sepj, rij, de1b, de2a, itype, delta, anag, se_int_control, se_taper)
wrapper for numerical/analytical routines
Type to store integrals for semi-empirical calculations.
Definition of the semi empirical parameter types.
Semi-empirical store integrals type.
Taper type use in semi-empirical calculations.