32#include "./base/base_uses.f90"
40 TYPE mixed_cdft_result_type
42 REAL(KIND=
dp),
ALLOCATABLE,
DIMENSION(:) :: lowdin, nonortho, &
45 REAL(KIND=
dp),
ALLOCATABLE,
DIMENSION(:) :: energy
47 REAL(KIND=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: strength
49 REAL(KIND=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: metric
51 REAL(KIND=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: h
53 REAL(KIND=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: s
55 REAL(KIND=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: s_minushalf
57 REAL(KIND=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: wad, wda
59 REAL(KIND=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: w_diagonal
60 END TYPE mixed_cdft_result_type
65 TYPE mixed_cdft_work_type
67 TYPE(dbcsr_p_type),
DIMENSION(:, :),
POINTER :: w_matrix => null()
69 TYPE(dbcsr_type),
POINTER :: mixed_matrix_s => null()
71 TYPE(cp_fm_type),
DIMENSION(:, :),
POINTER :: mixed_mo_coeff => null()
73 TYPE(dbcsr_p_type),
DIMENSION(:, :),
POINTER :: density_matrix => null()
74 END TYPE mixed_cdft_work_type
85 INTEGER :: rank(2) = -1, tag(2) = -1
86 REAL(KIND=
dp),
POINTER, &
87 DIMENSION(:, :, :) :: cavity => null(), weight => null()
88 REAL(KIND=
dp),
POINTER, &
89 DIMENSION(:, :, :, :) :: gradients => null()
96 TYPE(buffers),
DIMENSION(:),
POINTER :: buffs => null()
104 INTEGER,
DIMENSION(:),
POINTER :: matrix_info => null()
105 INTEGER,
DIMENSION(:, :),
POINTER :: target_list => null()
136 TYPE mixed_cdft_dlb_type
137 INTEGER :: my_source = -1, distributed(2) = -1, &
138 my_dest_repl(2) = -1, dest_tags_repl(2) = -1, &
140 INTEGER,
DIMENSION(:),
POINTER :: bo => null(), expected_work => null(), &
141 prediction_error => null()
142 INTEGER,
DIMENSION(:, :),
POINTER :: target_list => null()
143 LOGICAL :: recv_work = .false., send_work = .false.
144 LOGICAL,
DIMENSION(:),
POINTER :: recv_work_repl => null()
145 REAL(KIND=
dp) :: load_scale = 0.0_dp, very_overloaded = 0.0_dp
146 REAL(KIND=
dp),
POINTER, &
147 DIMENSION(:, :, :) :: cavity => null(), weight => null()
148 REAL(KIND=
dp),
POINTER, &
149 DIMENSION(:, :, :, :) :: gradients => null()
151 TYPE(buffers),
DIMENSION(:),
POINTER :: sendbuff => null()
152 TYPE(p_buffers),
DIMENSION(:),
POINTER :: recvbuff => null()
153 TYPE(repl_info),
DIMENSION(:),
POINTER :: recv_info => null()
154 END TYPE mixed_cdft_dlb_type
205 INTEGER :: sim_step = -1, multiplicity = -1, &
208 INTEGER,
DIMENSION(:, :),
ALLOCATABLE :: constraint_type
209 INTEGER,
POINTER,
DIMENSION(:) :: source_list => null(), dest_list => null(), &
210 recv_bo => null(), source_list_save => null(), &
211 dest_list_save => null()
212 INTEGER,
POINTER,
DIMENSION(:, :) :: source_list_bo => null(), dest_list_bo => null(), &
213 source_bo_save => null(), dest_bo_save => null()
214 LOGICAL :: is_pencil = .false., dlb = .false., &
215 is_special = .false., first_iteration = .false., &
216 calculate_metric = .false., &
217 wfn_overlap_method = .false., &
218 has_unit_metric = .false., &
219 use_lowdin = .false., &
220 do_ci = .false., nonortho_coupling = .false., &
221 identical_constraints = .false., &
222 block_diagonalize = .false.
223 REAL(kind=
dp) :: eps_rho_rspace = 0.0_dp, sim_dt = 0.0_dp, &
225 REAL(kind=
dp),
POINTER,
DIMENSION(:, :, :) :: weight => null(), cavity => null()
227 TYPE(buffers),
DIMENSION(:),
POINTER :: sendbuff => null()
229 DIMENSION(:, :) :: occupations
232 TYPE(mixed_cdft_result_type) :: results = mixed_cdft_result_type()
233 TYPE(mixed_cdft_work_type) :: matrix = mixed_cdft_work_type()
234 TYPE(mixed_cdft_dlb_type),
POINTER :: dlb_control => null()
237 POINTER :: qs_kind_set => null()
244 LOGICAL :: is_spherical = .false., &
246 LOGICAL,
DIMENSION(:, :),
POINTER :: sb => null()
247 INTEGER :: ncdft = -1, &
249 INTEGER,
DIMENSION(2, 3) :: bo = -1
250 INTEGER,
DIMENSION(:),
POINTER :: grid_span => null(), &
251 spherical => null(), &
253 INTEGER,
DIMENSION(:, :),
POINTER :: si => null(), &
257 REAL(kind=
dp) :: radius = 0.0_dp
258 REAL(kind=
dp),
DIMENSION(:),
POINTER :: cutoff => null(), &
260 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: sr => null(), &
280 CHARACTER(len=*),
PARAMETER,
PRIVATE :: modulen =
'mixed_cdft_types'
292 NULLIFY (cdft_control%pw_env, cdft_control%blacs_env, cdft_control%qs_kind_set)
293 NULLIFY (cdft_control%dlb_control, cdft_control%dest_list_bo, cdft_control%dest_list)
294 NULLIFY (cdft_control%dest_bo_save, cdft_control%dest_list_save, cdft_control%source_list)
295 NULLIFY (cdft_control%source_list_save, cdft_control%source_bo_save, cdft_control%source_list_bo)
296 NULLIFY (cdft_control%cavity, cdft_control%weight, cdft_control%sendbuff)
297 NULLIFY (cdft_control%cdft_control, cdft_control%recv_bo)
298 NULLIFY (cdft_control%sub_logger)
313 IF (
ASSOCIATED(cdft_control%dest_list))
THEN
314 DEALLOCATE (cdft_control%dest_list)
316 IF (
ASSOCIATED(cdft_control%dest_list_save))
THEN
317 DEALLOCATE (cdft_control%dest_list_save)
319 IF (
ASSOCIATED(cdft_control%dest_list_bo))
THEN
320 DEALLOCATE (cdft_control%dest_list_bo)
322 IF (
ASSOCIATED(cdft_control%dest_bo_save))
THEN
323 DEALLOCATE (cdft_control%dest_bo_save)
325 IF (
ASSOCIATED(cdft_control%source_list))
THEN
326 DEALLOCATE (cdft_control%source_list)
328 IF (
ASSOCIATED(cdft_control%source_list_save))
THEN
329 DEALLOCATE (cdft_control%source_list_save)
331 IF (
ASSOCIATED(cdft_control%source_list_bo))
THEN
332 DEALLOCATE (cdft_control%source_list_bo)
334 IF (
ASSOCIATED(cdft_control%source_bo_save))
THEN
335 DEALLOCATE (cdft_control%source_bo_save)
337 IF (
ASSOCIATED(cdft_control%recv_bo))
THEN
338 DEALLOCATE (cdft_control%recv_bo)
340 IF (
ASSOCIATED(cdft_control%weight))
THEN
341 DEALLOCATE (cdft_control%weight)
343 IF (
ASSOCIATED(cdft_control%cavity))
THEN
344 DEALLOCATE (cdft_control%cavity)
346 IF (
ALLOCATED(cdft_control%constraint_type))
THEN
347 DEALLOCATE (cdft_control%constraint_type)
349 IF (
ALLOCATED(cdft_control%occupations))
THEN
350 DO i = 1,
SIZE(cdft_control%occupations, 1)
351 DO j = 1,
SIZE(cdft_control%occupations, 2)
352 IF (
ASSOCIATED(cdft_control%occupations(i, j)%array))
THEN
353 DEALLOCATE (cdft_control%occupations(i, j)%array)
357 DEALLOCATE (cdft_control%occupations)
359 IF (
ASSOCIATED(cdft_control%dlb_control))
THEN
360 CALL mixed_cdft_dlb_release(cdft_control%dlb_control)
362 IF (
ASSOCIATED(cdft_control%sendbuff))
THEN
363 DO i = 1,
SIZE(cdft_control%sendbuff)
364 CALL mixed_cdft_buffers_release(cdft_control%sendbuff(i))
366 DEALLOCATE (cdft_control%sendbuff)
368 IF (
ASSOCIATED(cdft_control%cdft_control))
THEN
370 DEALLOCATE (cdft_control%cdft_control)
372 IF (
ASSOCIATED(cdft_control%blacs_env))
THEN
375 IF (
ASSOCIATED(cdft_control%qs_kind_set))
THEN
378 IF (
ASSOCIATED(cdft_control%sub_logger))
THEN
379 DO i = 1,
SIZE(cdft_control%sub_logger)
382 DEALLOCATE (cdft_control%sub_logger)
386 DEALLOCATE (cdft_control)
395 SUBROUTINE mixed_cdft_dlb_release(dlb_control)
396 TYPE(mixed_cdft_dlb_type),
POINTER :: dlb_control
400 IF (
ASSOCIATED(dlb_control%recv_work_repl))
THEN
401 DEALLOCATE (dlb_control%recv_work_repl)
403 IF (
ASSOCIATED(dlb_control%sendbuff))
THEN
404 DO i = 1,
SIZE(dlb_control%sendbuff)
405 CALL mixed_cdft_buffers_release(dlb_control%sendbuff(i))
407 DEALLOCATE (dlb_control%sendbuff)
409 IF (
ASSOCIATED(dlb_control%recvbuff))
THEN
410 DO i = 1,
SIZE(dlb_control%recvbuff)
411 CALL mixed_cdft_p_buffers_release(dlb_control%recvbuff(i))
413 DEALLOCATE (dlb_control%recvbuff)
415 IF (
ASSOCIATED(dlb_control%recv_info))
THEN
416 DO i = 1,
SIZE(dlb_control%recv_info)
417 IF (
ASSOCIATED(dlb_control%recv_info(i)%matrix_info))
THEN
418 DEALLOCATE (dlb_control%recv_info(i)%matrix_info)
420 IF (
ASSOCIATED(dlb_control%recv_info(i)%target_list))
THEN
421 DEALLOCATE (dlb_control%recv_info(i)%target_list)
424 DEALLOCATE (dlb_control%recv_info)
426 IF (
ASSOCIATED(dlb_control%bo))
THEN
427 DEALLOCATE (dlb_control%bo)
429 IF (
ASSOCIATED(dlb_control%expected_work))
THEN
430 DEALLOCATE (dlb_control%expected_work)
432 IF (
ASSOCIATED(dlb_control%prediction_error))
THEN
433 DEALLOCATE (dlb_control%prediction_error)
435 IF (
ASSOCIATED(dlb_control%target_list))
THEN
436 DEALLOCATE (dlb_control%target_list)
438 IF (
ASSOCIATED(dlb_control%cavity))
THEN
439 DEALLOCATE (dlb_control%cavity)
441 IF (
ASSOCIATED(dlb_control%weight))
THEN
442 DEALLOCATE (dlb_control%weight)
444 IF (
ASSOCIATED(dlb_control%gradients))
THEN
445 DEALLOCATE (dlb_control%gradients)
447 DEALLOCATE (dlb_control)
449 END SUBROUTINE mixed_cdft_dlb_release
456 SUBROUTINE mixed_cdft_buffers_release(buffer)
457 TYPE(buffers) :: buffer
459 IF (
ASSOCIATED(buffer%cavity))
THEN
460 DEALLOCATE (buffer%cavity)
462 IF (
ASSOCIATED(buffer%weight))
THEN
463 DEALLOCATE (buffer%weight)
465 IF (
ASSOCIATED(buffer%gradients))
THEN
466 DEALLOCATE (buffer%gradients)
469 END SUBROUTINE mixed_cdft_buffers_release
476 SUBROUTINE mixed_cdft_p_buffers_release(p_buffer)
477 TYPE(p_buffers) :: p_buffer
481 IF (
ASSOCIATED(p_buffer%buffs))
THEN
482 DO i = 1,
SIZE(p_buffer%buffs)
483 CALL mixed_cdft_buffers_release(p_buffer%buffs(i))
485 DEALLOCATE (p_buffer%buffs)
488 END SUBROUTINE mixed_cdft_p_buffers_release
509 H, S, Wad, Wda, W_diagonal, energy, strength, S_minushalf)
510 TYPE(mixed_cdft_result_type) :: results
511 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL :: lowdin, wfn, nonortho
512 REAL(kind=
dp),
DIMENSION(:, :),
OPTIONAL :: metric
513 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL :: rotation
514 REAL(kind=
dp),
DIMENSION(:, :),
OPTIONAL :: h, s, wad, wda, w_diagonal
515 REAL(kind=
dp),
DIMENSION(:),
OPTIONAL :: energy
516 REAL(kind=
dp),
DIMENSION(:, :),
OPTIONAL :: strength, s_minushalf
518 IF (
PRESENT(lowdin))
THEN
519 IF (
ALLOCATED(results%lowdin))
DEALLOCATE (results%lowdin)
520 ALLOCATE (results%lowdin(
SIZE(lowdin)))
521 results%lowdin(:) = lowdin(:)
523 IF (
PRESENT(wfn))
THEN
524 IF (
ALLOCATED(results%wfn))
DEALLOCATE (results%wfn)
525 ALLOCATE (results%wfn(
SIZE(wfn)))
526 results%wfn(:) = wfn(:)
528 IF (
PRESENT(nonortho))
THEN
529 IF (
ALLOCATED(results%nonortho))
DEALLOCATE (results%nonortho)
530 ALLOCATE (results%nonortho(
SIZE(nonortho)))
531 results%nonortho(:) = nonortho(:)
533 IF (
PRESENT(rotation))
THEN
534 IF (
ALLOCATED(results%rotation))
DEALLOCATE (results%rotation)
535 ALLOCATE (results%rotation(
SIZE(rotation)))
536 results%rotation(:) = rotation(:)
538 IF (
PRESENT(energy))
THEN
539 IF (
ALLOCATED(results%energy))
DEALLOCATE (results%energy)
540 ALLOCATE (results%energy(
SIZE(energy)))
541 results%energy(:) = energy(:)
543 IF (
PRESENT(strength))
THEN
544 IF (
ALLOCATED(results%strength))
DEALLOCATE (results%strength)
545 ALLOCATE (results%strength(
SIZE(strength, 1),
SIZE(strength, 2)))
546 results%strength(:, :) = strength(:, :)
548 IF (
PRESENT(metric))
THEN
549 IF (
ALLOCATED(results%metric))
DEALLOCATE (results%metric)
550 ALLOCATE (results%metric(
SIZE(metric, 1),
SIZE(metric, 2)))
551 results%metric(:, :) = metric(:, :)
554 IF (
ALLOCATED(results%H))
DEALLOCATE (results%H)
555 ALLOCATE (results%H(
SIZE(h, 1),
SIZE(h, 2)))
556 results%H(:, :) = h(:, :)
559 IF (
ALLOCATED(results%S))
DEALLOCATE (results%S)
560 ALLOCATE (results%S(
SIZE(s, 1),
SIZE(s, 2)))
561 results%S(:, :) = s(:, :)
563 IF (
PRESENT(s_minushalf))
THEN
564 IF (
ALLOCATED(results%S_minushalf))
DEALLOCATE (results%S_minushalf)
565 ALLOCATE (results%S_minushalf(
SIZE(s_minushalf, 1),
SIZE(s_minushalf, 2)))
566 results%S_minushalf(:, :) = s_minushalf(:, :)
568 IF (
PRESENT(wad))
THEN
569 IF (
ALLOCATED(results%Wad))
DEALLOCATE (results%Wad)
570 ALLOCATE (results%Wad(
SIZE(wad, 1),
SIZE(wad, 2)))
571 results%Wad(:, :) = wad(:, :)
573 IF (
PRESENT(wda))
THEN
574 IF (
ALLOCATED(results%Wda))
DEALLOCATE (results%Wda)
575 ALLOCATE (results%Wda(
SIZE(wda, 1),
SIZE(wda, 2)))
576 results%Wda(:, :) = wda(:, :)
578 IF (
PRESENT(w_diagonal))
THEN
579 IF (
ALLOCATED(results%W_diagonal))
DEALLOCATE (results%W_diagonal)
580 ALLOCATE (results%W_diagonal(
SIZE(w_diagonal, 1),
SIZE(w_diagonal, 2)))
581 results%W_diagonal(:, :) = w_diagonal(:, :)
592 TYPE(mixed_cdft_result_type) :: results
594 IF (
ALLOCATED(results%lowdin))
DEALLOCATE (results%lowdin)
595 IF (
ALLOCATED(results%wfn))
DEALLOCATE (results%wfn)
596 IF (
ALLOCATED(results%metric))
DEALLOCATE (results%metric)
597 IF (
ALLOCATED(results%nonortho))
DEALLOCATE (results%nonortho)
598 IF (
ALLOCATED(results%rotation))
DEALLOCATE (results%rotation)
599 IF (
ALLOCATED(results%H))
DEALLOCATE (results%H)
600 IF (
ALLOCATED(results%S))
DEALLOCATE (results%S)
601 IF (
ALLOCATED(results%S_minushalf))
DEALLOCATE (results%S_minushalf)
602 IF (
ALLOCATED(results%Wad))
DEALLOCATE (results%Wad)
603 IF (
ALLOCATED(results%Wda))
DEALLOCATE (results%Wda)
604 IF (
ALLOCATED(results%W_diagonal))
DEALLOCATE (results%W_diagonal)
605 IF (
ALLOCATED(results%energy))
DEALLOCATE (results%energy)
606 IF (
ALLOCATED(results%strength))
DEALLOCATE (results%strength)
616 TYPE(mixed_cdft_work_type) :: matrix
618 NULLIFY (matrix%w_matrix)
619 NULLIFY (matrix%mixed_matrix_s)
620 NULLIFY (matrix%mixed_mo_coeff)
621 NULLIFY (matrix%density_matrix)
631 TYPE(mixed_cdft_work_type) :: matrix
635 IF (
ASSOCIATED(matrix%w_matrix))
THEN
636 DO i = 1,
SIZE(matrix%w_matrix, 2)
637 DO j = 1,
SIZE(matrix%w_matrix, 1)
641 DEALLOCATE (matrix%w_matrix)
643 IF (
ASSOCIATED(matrix%mixed_matrix_s))
THEN
646 IF (
ASSOCIATED(matrix%mixed_mo_coeff))
THEN
647 DO i = 1,
SIZE(matrix%mixed_mo_coeff, 2)
648 DO j = 1,
SIZE(matrix%mixed_mo_coeff, 1)
652 DEALLOCATE (matrix%mixed_mo_coeff)
654 IF (
ASSOCIATED(matrix%density_matrix))
THEN
655 DO i = 1,
SIZE(matrix%density_matrix, 2)
656 DO j = 1,
SIZE(matrix%density_matrix, 1)
660 DEALLOCATE (matrix%density_matrix)
various utilities that regard array of different kinds: output, allocation,... maybe it is not a good...
methods related to the blacs parallel environment
subroutine, public cp_blacs_env_release(blacs_env)
releases the given blacs_env
subroutine, public dbcsr_release_p(matrix)
...
represent a full matrix distributed on many processors
various routines to log and control the output. The idea is that decisions about where to log should ...
subroutine, public cp_logger_release(logger)
releases this logger
Defines the basic variable types.
integer, parameter, public dp
Types for mixed CDFT calculations.
subroutine, public mixed_cdft_type_release(cdft_control)
releases the given mixed_cdft_type
subroutine, public mixed_cdft_result_type_set(results, lowdin, wfn, nonortho, metric, rotation, h, s, wad, wda, w_diagonal, energy, strength, s_minushalf)
Updates arrays within the mixed CDFT result container.
subroutine, public mixed_cdft_result_type_release(results)
Releases all arrays within the mixed CDFT result container.
subroutine, public mixed_cdft_work_type_init(matrix)
Initializes the mixed_cdft_work_type.
subroutine, public mixed_cdft_type_create(cdft_control)
inits the given mixed_cdft_type
subroutine, public mixed_cdft_work_type_release(matrix)
Releases arrays within the mixed CDFT work matrix container.
container for various plainwaves related things
subroutine, public pw_env_release(pw_env, para_env)
releases the given pw_env (see doc/ReferenceCounting.html)
Defines CDFT control structures.
subroutine, public cdft_control_release(cdft_control)
release the cdft_control_type
Define the quickstep kind type and their sub types.
subroutine, public deallocate_qs_kind_set(qs_kind_set)
Destructor routine for a set of qs kinds.
represent a pointer to a 1d array
represent a blacs multidimensional parallel environment (for the mpi corrispective see cp_paratypes/m...
Container for constraint settings to check consistency of force_evals.
Main mixed CDFT control type.
contained for different pw related things
Provides all information about a quickstep kind.