LCOV - code coverage report
Current view: top level - src - ct_types.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:42dac4a) Lines: 0.0 % 126 0
Test Date: 2025-07-25 12:55:17 Functions: 0.0 % 5 0

            Line data    Source code
       1              : !--------------------------------------------------------------------------------------------------!
       2              : !   CP2K: A general program to perform molecular dynamics simulations                              !
       3              : !   Copyright 2000-2025 CP2K developers group <https://cp2k.org>                                   !
       4              : !                                                                                                  !
       5              : !   SPDX-License-Identifier: GPL-2.0-or-later                                                      !
       6              : !--------------------------------------------------------------------------------------------------!
       7              : 
       8              : ! **************************************************************************************************
       9              : !> \brief Types for all cayley transformation methods
      10              : !> \par History
      11              : !>       2011.06 created [Rustam Z Khaliullin]
      12              : !> \author Rustam Z Khaliullin
      13              : ! **************************************************************************************************
      14              : MODULE ct_types
      15              :    USE cp_blacs_env,                    ONLY: cp_blacs_env_type
      16              :    USE cp_dbcsr_api,                    ONLY: dbcsr_copy,&
      17              :                                               dbcsr_release,&
      18              :                                               dbcsr_type
      19              :    USE input_constants,                 ONLY: cg_polak_ribiere,&
      20              :                                               tensor_orthogonal
      21              :    USE kinds,                           ONLY: dp
      22              :    USE message_passing,                 ONLY: mp_para_env_type
      23              : #include "./base/base_uses.f90"
      24              : 
      25              :    IMPLICIT NONE
      26              : 
      27              :    PRIVATE
      28              : 
      29              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'ct_types'
      30              : 
      31              :    ! Public types
      32              :    PUBLIC :: ct_step_env_type
      33              : 
      34              :    ! Public subroutines
      35              :    PUBLIC :: ct_step_env_init, ct_step_env_set, ct_step_env_get, ct_step_env_clean
      36              : 
      37              :    TYPE ct_step_env_type
      38              : 
      39              :       ! this type contains options for cayley transformation routines
      40              : 
      41              :       ! use orbitals or projectors?
      42              :       LOGICAL :: use_occ_orbs = .FALSE., use_virt_orbs = .FALSE.
      43              :       LOGICAL :: occ_orbs_orthogonal = .FALSE., virt_orbs_orthogonal = .FALSE.
      44              :       ! tensor properties of matrix indeces:
      45              :       ! tensor_up_down, tensor_orthogonal
      46              :       INTEGER :: tensor_type = 0
      47              :       ! neglect the quadratic term in riccati equations?
      48              :       LOGICAL :: neglect_quadratic_term = .FALSE.
      49              :       ! what kind of output do we produce?
      50              :       LOGICAL :: update_p = .FALSE., update_q = .FALSE., calculate_energy_corr = .FALSE.
      51              :       ! variety of conjugate gradient
      52              :       INTEGER :: conjugator = 0
      53              : 
      54              :       ! type of preconditioner
      55              :       LOGICAL :: pp_preconditioner_full = .FALSE., &
      56              :                  qq_preconditioner_full = .FALSE.
      57              : 
      58              :       REAL(KIND=dp)         :: eps_convergence = 0.0_dp
      59              :       REAL(KIND=dp)         :: eps_filter = 0.0_dp
      60              :       INTEGER               :: max_iter = 0
      61              :       !INTEGER               :: nspins
      62              :       LOGICAL               :: converged = .FALSE.
      63              :       INTEGER               :: order_lanczos = 0
      64              :       REAL(KIND=dp)         :: eps_lancsoz = 0.0_dp
      65              :       INTEGER               :: max_iter_lanczos = 0
      66              : 
      67              :       REAL(KIND=dp)         :: energy_correction = 0.0_dp
      68              : 
      69              : !SPIN!!!    ! metric matrices for covariant to contravariant transformations
      70              : !SPIN!!!    TYPE(dbcsr_type), DIMENSION(:), POINTER  :: p_index_up=>NULL()
      71              : !SPIN!!!    TYPE(dbcsr_type), DIMENSION(:), POINTER  :: p_index_down=>NULL()
      72              : !SPIN!!!    TYPE(dbcsr_type), DIMENSION(:), POINTER  :: q_index_up=>NULL()
      73              : !SPIN!!!    TYPE(dbcsr_type), DIMENSION(:), POINTER  :: q_index_down=>NULL()
      74              : !SPIN!!!
      75              : !SPIN!!!    ! kohn-sham, covariant-covariant representation
      76              : !SPIN!!!    TYPE(dbcsr_type), DIMENSION(:), POINTER  :: matrix_ks=>NULL()
      77              : !SPIN!!!    ! density, contravariant-contravariant representation
      78              : !SPIN!!!    TYPE(dbcsr_type), DIMENSION(:), POINTER  :: matrix_p=>NULL()
      79              : !SPIN!!!    ! occ orbitals, contravariant-covariant representation
      80              : !SPIN!!!    TYPE(dbcsr_type), DIMENSION(:), POINTER  :: matrix_t=>NULL()
      81              : !SPIN!!!    ! virt orbitals, contravariant-covariant representation
      82              : !SPIN!!!    TYPE(dbcsr_type), DIMENSION(:), POINTER  :: matrix_v=>NULL()
      83              : !SPIN!!!
      84              : !SPIN!!!    ! to avoid building Occ-by-N and Virt-vy-N matrices inside
      85              : !SPIN!!!    ! the ct routines get them from the external code
      86              : !SPIN!!!    TYPE(dbcsr_type), DIMENSION(:), POINTER  :: matrix_qp_template=>NULL()
      87              : !SPIN!!!    TYPE(dbcsr_type), DIMENSION(:), POINTER  :: matrix_pq_template=>NULL()
      88              : !SPIN!!!
      89              : !SPIN!!!    ! single excitation amplitudes
      90              : !SPIN!!!    TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE  :: matrix_x
      91              : !SPIN!!!    ! residuals
      92              : !SPIN!!!    TYPE(dbcsr_type), DIMENSION(:), ALLOCATABLE  :: matrix_res
      93              : 
      94              :       ! metric matrices for covariant to contravariant transformations
      95              :       TYPE(dbcsr_type), POINTER  :: p_index_up => NULL()
      96              :       TYPE(dbcsr_type), POINTER  :: p_index_down => NULL()
      97              :       TYPE(dbcsr_type), POINTER  :: q_index_up => NULL()
      98              :       TYPE(dbcsr_type), POINTER  :: q_index_down => NULL()
      99              : 
     100              :       ! kohn-sham, covariant-covariant representation
     101              :       TYPE(dbcsr_type), POINTER  :: matrix_ks => NULL()
     102              :       ! density, contravariant-contravariant representation
     103              :       TYPE(dbcsr_type), POINTER  :: matrix_p => NULL()
     104              :       ! occ orbitals, contravariant-covariant representation
     105              :       TYPE(dbcsr_type), POINTER  :: matrix_t => NULL()
     106              :       ! virt orbitals, contravariant-covariant representation
     107              :       TYPE(dbcsr_type), POINTER  :: matrix_v => NULL()
     108              : 
     109              :       ! to avoid building Occ-by-N and Virt-vy-N matrices inside
     110              :       ! the ct routines get them from the external code
     111              :       TYPE(dbcsr_type), POINTER  :: matrix_qp_template => NULL()
     112              :       TYPE(dbcsr_type), POINTER  :: matrix_pq_template => NULL()
     113              : 
     114              :       ! guess for single excitation amplitudes
     115              :       ! it is used exclusively as a guess, not modified
     116              :       ! it should be given in the up_down representation
     117              :       TYPE(dbcsr_type), POINTER  :: matrix_x_guess => NULL()
     118              : 
     119              :       ! single excitation amplitudes
     120              :       TYPE(dbcsr_type)           :: matrix_x
     121              :       ! residuals
     122              :       TYPE(dbcsr_type)           :: matrix_res
     123              : 
     124              :       TYPE(mp_para_env_type), POINTER  :: para_env => NULL()
     125              :       TYPE(cp_blacs_env_type), POINTER  :: blacs_env => NULL()
     126              : 
     127              :    END TYPE
     128              : 
     129              : CONTAINS
     130              : 
     131              : ! **************************************************************************************************
     132              : !> \brief ...
     133              : !> \param env ...
     134              : ! **************************************************************************************************
     135            0 :    SUBROUTINE ct_step_env_init(env)
     136              : 
     137              :       TYPE(ct_step_env_type)                             :: env
     138              : 
     139            0 :       env%use_occ_orbs = .TRUE.
     140            0 :       env%use_virt_orbs = .FALSE.
     141            0 :       env%occ_orbs_orthogonal = .FALSE.
     142            0 :       env%virt_orbs_orthogonal = .FALSE.
     143            0 :       env%tensor_type = tensor_orthogonal
     144            0 :       env%neglect_quadratic_term = .FALSE.
     145            0 :       env%calculate_energy_corr = .TRUE.
     146            0 :       env%update_p = .FALSE.
     147            0 :       env%update_q = .FALSE.
     148            0 :       env%pp_preconditioner_full = .TRUE.
     149            0 :       env%qq_preconditioner_full = .FALSE.
     150              : 
     151            0 :       env%eps_convergence = 1.0E-8_dp
     152            0 :       env%eps_filter = 1.0E-8_dp
     153            0 :       env%max_iter = 400
     154            0 :       env%order_lanczos = 3
     155            0 :       env%eps_lancsoz = 1.0E-4_dp
     156            0 :       env%max_iter_lanczos = 40
     157              :       !env%nspins = -1
     158            0 :       env%converged = .FALSE.
     159            0 :       env%conjugator = cg_polak_ribiere
     160              : 
     161            0 :       NULLIFY (env%p_index_up)
     162            0 :       NULLIFY (env%p_index_down)
     163            0 :       NULLIFY (env%q_index_up)
     164            0 :       NULLIFY (env%q_index_down)
     165              : 
     166            0 :       NULLIFY (env%matrix_ks)
     167            0 :       NULLIFY (env%matrix_p)
     168            0 :       NULLIFY (env%matrix_t)
     169            0 :       NULLIFY (env%matrix_v)
     170            0 :       NULLIFY (env%matrix_x_guess)
     171            0 :       NULLIFY (env%matrix_qp_template)
     172            0 :       NULLIFY (env%matrix_pq_template)
     173              : 
     174              :       !RZK-warning read_parameters_from_input
     175              : 
     176            0 :    END SUBROUTINE ct_step_env_init
     177              : 
     178              : ! **************************************************************************************************
     179              : !> \brief ...
     180              : !> \param env ...
     181              : !> \param use_occ_orbs ...
     182              : !> \param use_virt_orbs ...
     183              : !> \param tensor_type ...
     184              : !> \param occ_orbs_orthogonal ...
     185              : !> \param virt_orbs_orthogonal ...
     186              : !> \param neglect_quadratic_term ...
     187              : !> \param update_p ...
     188              : !> \param update_q ...
     189              : !> \param eps_convergence ...
     190              : !> \param eps_filter ...
     191              : !> \param max_iter ...
     192              : !> \param p_index_up ...
     193              : !> \param p_index_down ...
     194              : !> \param q_index_up ...
     195              : !> \param q_index_down ...
     196              : !> \param matrix_ks ...
     197              : !> \param matrix_p ...
     198              : !> \param matrix_qp_template ...
     199              : !> \param matrix_pq_template ...
     200              : !> \param matrix_t ...
     201              : !> \param matrix_v ...
     202              : !> \param copy_matrix_x ...
     203              : !> \param energy_correction ...
     204              : !> \param calculate_energy_corr ...
     205              : !> \param converged ...
     206              : !> \param qq_preconditioner_full ...
     207              : !> \param pp_preconditioner_full ...
     208              : ! **************************************************************************************************
     209            0 :    SUBROUTINE ct_step_env_get(env, use_occ_orbs, use_virt_orbs, tensor_type, &
     210              :                               occ_orbs_orthogonal, virt_orbs_orthogonal, neglect_quadratic_term, &
     211              :                               update_p, update_q, eps_convergence, eps_filter, max_iter, &
     212              :                               p_index_up, p_index_down, q_index_up, q_index_down, matrix_ks, matrix_p, &
     213              :                               matrix_qp_template, matrix_pq_template, &
     214              :                               matrix_t, matrix_v, copy_matrix_x, energy_correction, calculate_energy_corr, &
     215              :                               converged, qq_preconditioner_full, pp_preconditioner_full)
     216              : 
     217              :       TYPE(ct_step_env_type)                             :: env
     218              :       LOGICAL, OPTIONAL                                  :: use_occ_orbs, use_virt_orbs
     219              :       INTEGER, OPTIONAL                                  :: tensor_type
     220              :       LOGICAL, OPTIONAL                                  :: occ_orbs_orthogonal, &
     221              :                                                             virt_orbs_orthogonal, &
     222              :                                                             neglect_quadratic_term, update_p, &
     223              :                                                             update_q
     224              :       REAL(KIND=dp), OPTIONAL                            :: eps_convergence, eps_filter
     225              :       INTEGER, OPTIONAL                                  :: max_iter
     226              :       TYPE(dbcsr_type), OPTIONAL, POINTER :: p_index_up, p_index_down, q_index_up, q_index_down, &
     227              :          matrix_ks, matrix_p, matrix_qp_template, matrix_pq_template, matrix_t, matrix_v
     228              :       TYPE(dbcsr_type), OPTIONAL                         :: copy_matrix_x
     229              :       REAL(KIND=dp), OPTIONAL                            :: energy_correction
     230              :       LOGICAL, OPTIONAL                                  :: calculate_energy_corr, converged, &
     231              :                                                             qq_preconditioner_full, &
     232              :                                                             pp_preconditioner_full
     233              : 
     234              : !INTEGER      , OPTIONAL                     :: nspins
     235              : !SPIN!!!    TYPE(dbcsr_type), DIMENSION(:), POINTER, OPTIONAL  :: p_index_up
     236              : !SPIN!!!    TYPE(dbcsr_type), DIMENSION(:), POINTER, OPTIONAL  :: p_index_down
     237              : !SPIN!!!    TYPE(dbcsr_type), DIMENSION(:), POINTER, OPTIONAL  :: q_index_up
     238              : !SPIN!!!    TYPE(dbcsr_type), DIMENSION(:), POINTER, OPTIONAL  :: q_index_down
     239              : !SPIN!!!    TYPE(dbcsr_type), DIMENSION(:), POINTER, OPTIONAL  :: matrix_ks
     240              : !SPIN!!!    TYPE(dbcsr_type), DIMENSION(:), POINTER, OPTIONAL  :: matrix_p
     241              : !SPIN!!!    TYPE(dbcsr_type), DIMENSION(:), POINTER, OPTIONAL  :: matrix_t
     242              : !SPIN!!!    TYPE(dbcsr_type), DIMENSION(:), POINTER, OPTIONAL  :: matrix_v
     243              : !SPIN!!!    TYPE(dbcsr_type), DIMENSION(:), POINTER, OPTIONAL  :: matrix_qp_template
     244              : !SPIN!!!    TYPE(dbcsr_type), DIMENSION(:), POINTER, OPTIONAL  :: matrix_pq_template
     245              : !SPIN!!!    TYPE(dbcsr_type), DIMENSION(:), POINTER, OPTIONAL  :: matrix_x
     246              : !SPIN!!!
     247              : !SPIN!!!    TYPE(dbcsr_type), DIMENSION(:), OPTIONAL           :: copy_matrix_x
     248              : !INTEGER                                               :: ispin
     249              : 
     250            0 :       IF (PRESENT(use_occ_orbs)) use_occ_orbs = env%use_occ_orbs
     251            0 :       IF (PRESENT(use_virt_orbs)) use_virt_orbs = env%use_virt_orbs
     252            0 :       IF (PRESENT(occ_orbs_orthogonal)) occ_orbs_orthogonal = &
     253            0 :          env%occ_orbs_orthogonal
     254            0 :       IF (PRESENT(virt_orbs_orthogonal)) virt_orbs_orthogonal = &
     255            0 :          env%virt_orbs_orthogonal
     256            0 :       IF (PRESENT(tensor_type)) tensor_type = env%tensor_type
     257            0 :       IF (PRESENT(neglect_quadratic_term)) neglect_quadratic_term = &
     258            0 :          env%neglect_quadratic_term
     259            0 :       IF (PRESENT(calculate_energy_corr)) calculate_energy_corr = &
     260            0 :          env%calculate_energy_corr
     261            0 :       IF (PRESENT(update_p)) update_p = env%update_p
     262            0 :       IF (PRESENT(update_q)) update_q = env%update_q
     263            0 :       IF (PRESENT(pp_preconditioner_full)) pp_preconditioner_full = &
     264            0 :          env%pp_preconditioner_full
     265            0 :       IF (PRESENT(qq_preconditioner_full)) qq_preconditioner_full = &
     266            0 :          env%qq_preconditioner_full
     267            0 :       IF (PRESENT(eps_convergence)) eps_convergence = env%eps_convergence
     268            0 :       IF (PRESENT(eps_filter)) eps_filter = env%eps_filter
     269            0 :       IF (PRESENT(max_iter)) max_iter = env%max_iter
     270              :       !IF (PRESENT(nspins)) nspins = env%nspins
     271            0 :       IF (PRESENT(matrix_ks)) matrix_ks => env%matrix_ks
     272            0 :       IF (PRESENT(matrix_p)) matrix_p => env%matrix_p
     273            0 :       IF (PRESENT(matrix_t)) matrix_t => env%matrix_t
     274            0 :       IF (PRESENT(matrix_v)) matrix_v => env%matrix_v
     275            0 :       IF (PRESENT(matrix_qp_template)) matrix_qp_template => &
     276            0 :          env%matrix_qp_template
     277            0 :       IF (PRESENT(matrix_pq_template)) matrix_pq_template => &
     278            0 :          env%matrix_pq_template
     279            0 :       IF (PRESENT(p_index_up)) p_index_up => env%p_index_up
     280            0 :       IF (PRESENT(q_index_up)) q_index_up => env%q_index_up
     281            0 :       IF (PRESENT(p_index_down)) p_index_down => env%p_index_down
     282            0 :       IF (PRESENT(q_index_down)) q_index_down => env%q_index_down
     283            0 :       IF (PRESENT(copy_matrix_x)) THEN
     284              :          !DO ispin=1,env%nspins
     285              :          !CALL dbcsr_copy(copy_matrix_x(ispin),env%matrix_x(ispin))
     286            0 :          CALL dbcsr_copy(copy_matrix_x, env%matrix_x)
     287              :          !ENDDO
     288              :       END IF
     289              :       !IF (PRESENT(matrix_x)) matrix_x => env%matrix_x
     290            0 :       IF (PRESENT(energy_correction)) energy_correction = env%energy_correction
     291            0 :       IF (PRESENT(converged)) converged = env%converged
     292              : 
     293            0 :    END SUBROUTINE ct_step_env_get
     294              : 
     295              : ! **************************************************************************************************
     296              : !> \brief ...
     297              : !> \param env ...
     298              : !> \param para_env ...
     299              : !> \param blacs_env ...
     300              : !> \param use_occ_orbs ...
     301              : !> \param use_virt_orbs ...
     302              : !> \param tensor_type ...
     303              : !> \param occ_orbs_orthogonal ...
     304              : !> \param virt_orbs_orthogonal ...
     305              : !> \param neglect_quadratic_term ...
     306              : !> \param update_p ...
     307              : !> \param update_q ...
     308              : !> \param eps_convergence ...
     309              : !> \param eps_filter ...
     310              : !> \param max_iter ...
     311              : !> \param p_index_up ...
     312              : !> \param p_index_down ...
     313              : !> \param q_index_up ...
     314              : !> \param q_index_down ...
     315              : !> \param matrix_ks ...
     316              : !> \param matrix_p ...
     317              : !> \param matrix_qp_template ...
     318              : !> \param matrix_pq_template ...
     319              : !> \param matrix_t ...
     320              : !> \param matrix_v ...
     321              : !> \param matrix_x_guess ...
     322              : !> \param calculate_energy_corr ...
     323              : !> \param conjugator ...
     324              : !> \param qq_preconditioner_full ...
     325              : !> \param pp_preconditioner_full ...
     326              : ! **************************************************************************************************
     327            0 :    SUBROUTINE ct_step_env_set(env, para_env, blacs_env, use_occ_orbs, &
     328              :                               use_virt_orbs, tensor_type, &
     329              :                               occ_orbs_orthogonal, virt_orbs_orthogonal, neglect_quadratic_term, &
     330              :                               update_p, update_q, eps_convergence, eps_filter, max_iter, &
     331              :                               p_index_up, p_index_down, q_index_up, q_index_down, matrix_ks, matrix_p, &
     332              :                               matrix_qp_template, matrix_pq_template, &
     333              :                               matrix_t, matrix_v, matrix_x_guess, calculate_energy_corr, conjugator, &
     334              :                               qq_preconditioner_full, pp_preconditioner_full)
     335              : 
     336              :       TYPE(ct_step_env_type)                             :: env
     337              :       TYPE(mp_para_env_type), POINTER                    :: para_env
     338              :       TYPE(cp_blacs_env_type), POINTER                   :: blacs_env
     339              :       LOGICAL, OPTIONAL                                  :: use_occ_orbs, use_virt_orbs
     340              :       INTEGER, OPTIONAL                                  :: tensor_type
     341              :       LOGICAL, OPTIONAL                                  :: occ_orbs_orthogonal, &
     342              :                                                             virt_orbs_orthogonal, &
     343              :                                                             neglect_quadratic_term, update_p, &
     344              :                                                             update_q
     345              :       REAL(KIND=dp), OPTIONAL                            :: eps_convergence, eps_filter
     346              :       INTEGER, OPTIONAL                                  :: max_iter
     347              :       TYPE(dbcsr_type), OPTIONAL, TARGET :: p_index_up, p_index_down, q_index_up, q_index_down, &
     348              :          matrix_ks, matrix_p, matrix_qp_template, matrix_pq_template, matrix_t, matrix_v, &
     349              :          matrix_x_guess
     350              :       LOGICAL, OPTIONAL                                  :: calculate_energy_corr
     351              :       INTEGER, OPTIONAL                                  :: conjugator
     352              :       LOGICAL, OPTIONAL                                  :: qq_preconditioner_full, &
     353              :                                                             pp_preconditioner_full
     354              : 
     355              : !INTEGER      , OPTIONAL                     :: nspins
     356              : !SPIN!!!    TYPE(dbcsr_type), TARGET, DIMENSION(:), OPTIONAL  :: p_index_up
     357              : !SPIN!!!    TYPE(dbcsr_type), TARGET, DIMENSION(:), OPTIONAL  :: p_index_down
     358              : !SPIN!!!    TYPE(dbcsr_type), TARGET, DIMENSION(:), OPTIONAL  :: q_index_up
     359              : !SPIN!!!    TYPE(dbcsr_type), TARGET, DIMENSION(:), OPTIONAL  :: q_index_down
     360              : !SPIN!!!    TYPE(dbcsr_type), TARGET, DIMENSION(:), OPTIONAL  :: matrix_ks
     361              : !SPIN!!!    TYPE(dbcsr_type), TARGET, DIMENSION(:), OPTIONAL  :: matrix_p
     362              : !SPIN!!!    TYPE(dbcsr_type), TARGET, DIMENSION(:), OPTIONAL  :: matrix_t
     363              : !SPIN!!!    TYPE(dbcsr_type), TARGET, DIMENSION(:), OPTIONAL  :: matrix_v
     364              : !SPIN!!!    TYPE(dbcsr_type), TARGET, DIMENSION(:), OPTIONAL  :: matrix_qp_template
     365              : !SPIN!!!    TYPE(dbcsr_type), TARGET, DIMENSION(:), OPTIONAL  :: matrix_pq_template
     366              : ! set para_env and blacs_env which are needed to operate with full matrices
     367              : ! it would be nice to have everything with cp_dbcsr matrices, well maybe later
     368              : 
     369            0 :       env%para_env => para_env
     370            0 :       env%blacs_env => blacs_env
     371              : 
     372            0 :       IF (PRESENT(use_occ_orbs)) env%use_occ_orbs = use_occ_orbs
     373            0 :       IF (PRESENT(use_virt_orbs)) env%use_virt_orbs = use_virt_orbs
     374            0 :       IF (PRESENT(occ_orbs_orthogonal)) env%occ_orbs_orthogonal = &
     375            0 :          occ_orbs_orthogonal
     376            0 :       IF (PRESENT(virt_orbs_orthogonal)) env%virt_orbs_orthogonal = &
     377            0 :          virt_orbs_orthogonal
     378            0 :       IF (PRESENT(tensor_type)) env%tensor_type = tensor_type
     379            0 :       IF (PRESENT(neglect_quadratic_term)) env%neglect_quadratic_term = &
     380            0 :          neglect_quadratic_term
     381            0 :       IF (PRESENT(calculate_energy_corr)) env%calculate_energy_corr = &
     382            0 :          calculate_energy_corr
     383            0 :       IF (PRESENT(update_p)) env%update_p = update_p
     384            0 :       IF (PRESENT(update_q)) env%update_q = update_q
     385            0 :       IF (PRESENT(pp_preconditioner_full)) env%pp_preconditioner_full = &
     386            0 :          pp_preconditioner_full
     387            0 :       IF (PRESENT(qq_preconditioner_full)) env%qq_preconditioner_full = &
     388            0 :          qq_preconditioner_full
     389            0 :       IF (PRESENT(eps_convergence)) env%eps_convergence = eps_convergence
     390            0 :       IF (PRESENT(eps_filter)) env%eps_filter = eps_filter
     391            0 :       IF (PRESENT(max_iter)) env%max_iter = max_iter
     392              :       !IF (PRESENT(nspins)) env%nspins = nspins
     393            0 :       IF (PRESENT(conjugator)) env%conjugator = conjugator
     394            0 :       IF (PRESENT(matrix_ks)) env%matrix_ks => matrix_ks
     395            0 :       IF (PRESENT(matrix_p)) env%matrix_p => matrix_p
     396            0 :       IF (PRESENT(matrix_t)) env%matrix_t => matrix_t
     397            0 :       IF (PRESENT(matrix_v)) env%matrix_v => matrix_v
     398            0 :       IF (PRESENT(matrix_x_guess)) env%matrix_x_guess => matrix_x_guess
     399            0 :       IF (PRESENT(matrix_qp_template)) env%matrix_qp_template => &
     400            0 :          matrix_qp_template
     401            0 :       IF (PRESENT(matrix_pq_template)) env%matrix_pq_template => &
     402            0 :          matrix_pq_template
     403            0 :       IF (PRESENT(p_index_up)) env%p_index_up => p_index_up
     404            0 :       IF (PRESENT(q_index_up)) env%q_index_up => q_index_up
     405            0 :       IF (PRESENT(p_index_down)) env%p_index_down => p_index_down
     406            0 :       IF (PRESENT(q_index_down)) env%q_index_down => q_index_down
     407              : 
     408            0 :    END SUBROUTINE ct_step_env_set
     409              : 
     410              : ! **************************************************************************************************
     411              : !> \brief ...
     412              : !> \param env ...
     413              : ! **************************************************************************************************
     414            0 :    SUBROUTINE ct_step_env_clean(env)
     415              : 
     416              :       TYPE(ct_step_env_type)                             :: env
     417              : 
     418              : !INTEGER                                     :: ispin
     419              : 
     420            0 :       NULLIFY (env%para_env)
     421            0 :       NULLIFY (env%blacs_env)
     422              : 
     423              :       !DO ispin=1,env%nspins
     424            0 :       CALL dbcsr_release(env%matrix_x)
     425            0 :       CALL dbcsr_release(env%matrix_res)
     426              :       !CALL dbcsr_release(env%matrix_x(ispin))
     427              :       !CALL dbcsr_release(env%matrix_res(ispin))
     428              :       !ENDDO
     429              :       !DEALLOCATE(env%matrix_x,env%matrix_res)
     430              : 
     431            0 :       NULLIFY (env%p_index_up)
     432            0 :       NULLIFY (env%p_index_down)
     433            0 :       NULLIFY (env%q_index_up)
     434            0 :       NULLIFY (env%q_index_down)
     435              : 
     436            0 :       NULLIFY (env%matrix_ks)
     437            0 :       NULLIFY (env%matrix_p)
     438            0 :       NULLIFY (env%matrix_t)
     439            0 :       NULLIFY (env%matrix_v)
     440            0 :       NULLIFY (env%matrix_x_guess)
     441            0 :       NULLIFY (env%matrix_qp_template)
     442            0 :       NULLIFY (env%matrix_pq_template)
     443              : 
     444            0 :    END SUBROUTINE ct_step_env_clean
     445              : 
     446            0 : END MODULE ct_types
     447              : 
        

Generated by: LCOV version 2.0-1