LCOV - code coverage report
Current view: top level - src - xas_env_types.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:4dc10b3) Lines: 108 119 90.8 %
Date: 2024-11-21 06:45:46 Functions: 4 5 80.0 %

          Line data    Source code
       1             : !--------------------------------------------------------------------------------------------------!
       2             : !   CP2K: A general program to perform molecular dynamics simulations                              !
       3             : !   Copyright 2000-2024 CP2K developers group <https://cp2k.org>                                   !
       4             : !                                                                                                  !
       5             : !   SPDX-License-Identifier: GPL-2.0-or-later                                                      !
       6             : !--------------------------------------------------------------------------------------------------!
       7             : 
       8             : ! **************************************************************************************************
       9             : !> \brief define create destroy get and put information
      10             : !>      in xas_env to calculate the x-ray absorption spectra
      11             : !> \par History
      12             : !>      created 05.2005
      13             : !> \author MI (05.2005)
      14             : ! **************************************************************************************************
      15             : MODULE xas_env_types
      16             : 
      17             :    USE basis_set_types,                 ONLY: deallocate_gto_basis_set,&
      18             :                                               gto_basis_set_p_type
      19             :    USE cp_array_utils,                  ONLY: cp_2d_r_p_type
      20             :    USE cp_dbcsr_api,                    ONLY: dbcsr_p_type
      21             :    USE cp_dbcsr_operations,             ONLY: dbcsr_deallocate_matrix_set
      22             :    USE cp_fm_pool_types,                ONLY: cp_fm_pool_p_type,&
      23             :                                               fm_pools_give_back_fm_vect
      24             :    USE cp_fm_types,                     ONLY: cp_fm_release,&
      25             :                                               cp_fm_type
      26             :    USE kinds,                           ONLY: dp
      27             :    USE qs_loc_types,                    ONLY: qs_loc_env_release,&
      28             :                                               qs_loc_env_type
      29             :    USE qs_scf_types,                    ONLY: qs_scf_env_type,&
      30             :                                               scf_env_release
      31             :    USE scf_control_types,               ONLY: scf_c_release,&
      32             :                                               scf_control_type
      33             : #include "./base/base_uses.f90"
      34             : 
      35             :    IMPLICIT NONE
      36             :    PRIVATE
      37             : 
      38             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'xas_env_types'
      39             : 
      40             : ! *** Public data types ***
      41             : 
      42             :    PUBLIC :: xas_environment_type
      43             : 
      44             : ! *** Public subroutines ***
      45             : 
      46             :    PUBLIC :: get_xas_env, set_xas_env, xas_env_create, xas_env_release
      47             : 
      48             : ! **************************************************************************************************
      49             : !> \param nao number of atomic orbitals in the basis
      50             : !> \param exc_state state that is now excited (this change atom by atom)
      51             : !> \param nvirtual number of empy states to take into account for the spectrum
      52             : !> \param state_of_atom for each atom the states that have to be excited (global index)
      53             : !>        dimension is the number of atoms to be excited by the largest number of included states
      54             : !> \param atom_of_state atom to which each state is assigned,
      55             : !>        dimension is the number of states occupied that might be excited
      56             : !> \param nexc_states number of states to be excited per atom
      57             : !>        dimension is the number of atoms to be excited
      58             : !> \param type_of_state character of the state (1s,2s,2p...)
      59             : !> \param spectrum for each excitation the energy and the oscillator strength
      60             : !> \param centers_wfn for each wfn the center of charge (optimized by localization)
      61             : !> \param groundstate_coeff temporary storage for the original mos coefficients
      62             : !> \param ostrength_sm sin and cos integrals computed for the contracted GTO functions
      63             : !> \param dip_fm_set fm for the sin and cos integrals to define the pos operator
      64             : !> \param qs_loc_env environment for the localization procedure
      65             : !> \par History
      66             : !>       created 05-2005
      67             : !> \author MI
      68             : ! **************************************************************************************************
      69             :    TYPE xas_environment_type
      70             :       INTEGER :: nao = 0, exc_state = 0, xas_estate = 0
      71             :       INTEGER :: nexc_search = 0, nexc_atoms = 0
      72             :       INTEGER :: spin_channel = 0
      73             :       INTEGER :: nvirtual = 0, nvirtual2 = 0
      74             :       INTEGER :: unoccupied_max_iter = 0
      75             : 
      76             :       INTEGER, DIMENSION(:), POINTER :: atom_of_state => NULL()
      77             :       INTEGER, DIMENSION(:), POINTER :: type_of_state => NULL()
      78             :       INTEGER, DIMENSION(:), POINTER :: mykind_of_atom => NULL()
      79             :       INTEGER, DIMENSION(:), POINTER :: mykind_of_kind => NULL()
      80             :       INTEGER, DIMENSION(:), POINTER :: exc_atoms => NULL()
      81             :       INTEGER, DIMENSION(:), POINTER :: nexc_states => NULL()
      82             :       INTEGER, DIMENSION(:, :), POINTER :: state_of_atom => NULL()
      83             : 
      84             :       REAL(dp) :: ip_energy = 0.0_dp, occ_estate = 0.0_dp, unoccupied_eps = 0.0_dp, xas_nelectron = 0.0_dp, homo_occ = 0.0_dp
      85             :       REAL(dp), DIMENSION(:), POINTER :: all_evals => NULL()
      86             :       REAL(dp), DIMENSION(:), POINTER :: unoccupied_evals => NULL()
      87             :       REAL(dp), DIMENSION(:, :), POINTER :: spectrum => NULL()
      88             :       REAL(dp), DIMENSION(:, :), POINTER :: centers_wfn => NULL()
      89             :       TYPE(cp_2d_r_p_type), DIMENSION(:), POINTER :: stogto_overlap => NULL()
      90             :       TYPE(gto_basis_set_p_type), DIMENSION(:), POINTER :: my_gto_basis => NULL()
      91             :       TYPE(cp_fm_type), DIMENSION(:), POINTER :: groundstate_coeff => NULL()
      92             :       TYPE(cp_fm_type), DIMENSION(:, :), POINTER :: dip_fm_set => NULL()
      93             :       TYPE(cp_fm_pool_p_type), DIMENSION(:), &
      94             :          POINTER                                   :: ao_mo_fm_pools => NULL()
      95             :       TYPE(cp_fm_type), POINTER :: excvec_coeff => NULL()
      96             :       TYPE(cp_fm_type), POINTER :: excvec_overlap => NULL()
      97             :       TYPE(cp_fm_type), POINTER :: unoccupied_orbs => NULL()
      98             :       TYPE(cp_fm_type), POINTER :: all_vectors => NULL()
      99             :       TYPE(dbcsr_p_type), DIMENSION(:), POINTER :: ostrength_sm => NULL()
     100             :       TYPE(qs_loc_env_type), POINTER :: qs_loc_env => NULL()
     101             :       TYPE(qs_scf_env_type), POINTER                        :: scf_env => NULL()
     102             :       TYPE(scf_control_type), POINTER          :: scf_control => NULL()
     103             : 
     104             :    END TYPE xas_environment_type
     105             : 
     106             : CONTAINS
     107             : ! **************************************************************************************************
     108             : !> \brief ...
     109             : !> \param xas_env ...
     110             : !> \param exc_state ...
     111             : !> \param nao ...
     112             : !> \param nvirtual ...
     113             : !> \param nvirtual2 ...
     114             : !> \param centers_wfn ...
     115             : !> \param atom_of_state ...
     116             : !> \param exc_atoms ...
     117             : !> \param nexc_states ...
     118             : !> \param type_of_state ...
     119             : !> \param mykind_of_atom ...
     120             : !> \param mykind_of_kind ...
     121             : !> \param state_of_atom ...
     122             : !> \param spectrum ...
     123             : !> \param groundstate_coeff ...
     124             : !> \param ostrength_sm ...
     125             : !> \param dip_fm_set ...
     126             : !> \param excvec_coeff ...
     127             : !> \param excvec_overlap ...
     128             : !> \param unoccupied_orbs ...
     129             : !> \param unoccupied_evals ...
     130             : !> \param unoccupied_max_iter ...
     131             : !> \param unoccupied_eps ...
     132             : !> \param all_vectors ...
     133             : !> \param all_evals ...
     134             : !> \param my_gto_basis ...
     135             : !> \param qs_loc_env ...
     136             : !> \param stogto_overlap ...
     137             : !> \param occ_estate ...
     138             : !> \param xas_nelectron ...
     139             : !> \param xas_estate ...
     140             : !> \param nexc_atoms ...
     141             : !> \param nexc_search ...
     142             : !> \param spin_channel ...
     143             : !> \param scf_env ...
     144             : !> \param scf_control ...
     145             : ! **************************************************************************************************
     146        3008 :    SUBROUTINE get_xas_env(xas_env, exc_state, nao, nvirtual, nvirtual2, &
     147             :                           centers_wfn, atom_of_state, exc_atoms, nexc_states, type_of_state, mykind_of_atom, &
     148             :                           mykind_of_kind, state_of_atom, spectrum, groundstate_coeff, ostrength_sm, &
     149             :                           dip_fm_set, excvec_coeff, excvec_overlap, &
     150             :                           unoccupied_orbs, unoccupied_evals, unoccupied_max_iter, unoccupied_eps, &
     151             :                           all_vectors, all_evals, my_gto_basis, qs_loc_env, &
     152             :                           stogto_overlap, occ_estate, xas_nelectron, xas_estate, nexc_atoms, nexc_search, spin_channel, &
     153             :                           scf_env, scf_control)
     154             : 
     155             :       TYPE(xas_environment_type), INTENT(IN)             :: xas_env
     156             :       INTEGER, INTENT(OUT), OPTIONAL                     :: exc_state, nao, nvirtual, nvirtual2
     157             :       REAL(dp), DIMENSION(:, :), OPTIONAL, POINTER       :: centers_wfn
     158             :       INTEGER, DIMENSION(:), OPTIONAL, POINTER           :: atom_of_state, exc_atoms, nexc_states, &
     159             :                                                             type_of_state, mykind_of_atom, &
     160             :                                                             mykind_of_kind
     161             :       INTEGER, DIMENSION(:, :), OPTIONAL, POINTER        :: state_of_atom
     162             :       REAL(dp), DIMENSION(:, :), OPTIONAL, POINTER       :: spectrum
     163             :       TYPE(cp_fm_type), DIMENSION(:), OPTIONAL, POINTER  :: groundstate_coeff
     164             :       TYPE(dbcsr_p_type), DIMENSION(:), OPTIONAL, &
     165             :          POINTER                                         :: ostrength_sm
     166             :       TYPE(cp_fm_type), DIMENSION(:, :), OPTIONAL, &
     167             :          POINTER                                         :: dip_fm_set
     168             :       TYPE(cp_fm_type), OPTIONAL, POINTER                :: excvec_coeff, excvec_overlap, &
     169             :                                                             unoccupied_orbs
     170             :       REAL(dp), DIMENSION(:), OPTIONAL, POINTER          :: unoccupied_evals
     171             :       INTEGER, INTENT(OUT), OPTIONAL                     :: unoccupied_max_iter
     172             :       REAL(dp), OPTIONAL                                 :: unoccupied_eps
     173             :       TYPE(cp_fm_type), OPTIONAL, POINTER                :: all_vectors
     174             :       REAL(dp), DIMENSION(:), OPTIONAL, POINTER          :: all_evals
     175             :       TYPE(gto_basis_set_p_type), DIMENSION(:), &
     176             :          OPTIONAL, POINTER                               :: my_gto_basis
     177             :       TYPE(qs_loc_env_type), OPTIONAL, POINTER           :: qs_loc_env
     178             :       TYPE(cp_2d_r_p_type), DIMENSION(:), OPTIONAL, &
     179             :          POINTER                                         :: stogto_overlap
     180             :       REAL(dp), INTENT(OUT), OPTIONAL                    :: occ_estate, xas_nelectron
     181             :       INTEGER, INTENT(OUT), OPTIONAL                     :: xas_estate, nexc_atoms, nexc_search, &
     182             :                                                             spin_channel
     183             :       TYPE(qs_scf_env_type), OPTIONAL, POINTER           :: scf_env
     184             :       TYPE(scf_control_type), OPTIONAL, POINTER          :: scf_control
     185             : 
     186        3008 :       IF (PRESENT(exc_state)) exc_state = xas_env%exc_state
     187        3008 :       IF (PRESENT(nao)) nao = xas_env%nao
     188        3008 :       IF (PRESENT(nvirtual)) nvirtual = xas_env%nvirtual
     189        3008 :       IF (PRESENT(nvirtual2)) nvirtual2 = xas_env%nvirtual2
     190        3008 :       IF (PRESENT(xas_nelectron)) xas_nelectron = xas_env%xas_nelectron
     191        3008 :       IF (PRESENT(occ_estate)) occ_estate = xas_env%occ_estate
     192        3008 :       IF (PRESENT(xas_estate)) xas_estate = xas_env%xas_estate
     193        3008 :       IF (PRESENT(nexc_search)) nexc_search = xas_env%nexc_search
     194        3008 :       IF (PRESENT(nexc_states)) nexc_states => xas_env%nexc_states
     195        3008 :       IF (PRESENT(spin_channel)) spin_channel = xas_env%spin_channel
     196        3008 :       IF (PRESENT(nexc_atoms)) nexc_atoms = xas_env%nexc_atoms
     197        3008 :       IF (PRESENT(unoccupied_eps)) unoccupied_eps = xas_env%unoccupied_eps
     198        3008 :       IF (PRESENT(unoccupied_max_iter)) unoccupied_max_iter = xas_env%unoccupied_max_iter
     199        3008 :       IF (PRESENT(centers_wfn)) centers_wfn => xas_env%centers_wfn
     200        3008 :       IF (PRESENT(atom_of_state)) atom_of_state => xas_env%atom_of_state
     201        3008 :       IF (PRESENT(exc_atoms)) exc_atoms => xas_env%exc_atoms
     202        3008 :       IF (PRESENT(type_of_state)) type_of_state => xas_env%type_of_state
     203        3008 :       IF (PRESENT(state_of_atom)) state_of_atom => xas_env%state_of_atom
     204        3008 :       IF (PRESENT(mykind_of_atom)) mykind_of_atom => xas_env%mykind_of_atom
     205        3008 :       IF (PRESENT(mykind_of_kind)) mykind_of_kind => xas_env%mykind_of_kind
     206        3008 :       IF (PRESENT(unoccupied_evals)) unoccupied_evals => xas_env%unoccupied_evals
     207        3008 :       IF (PRESENT(all_evals)) all_evals => xas_env%all_evals
     208        3008 :       IF (PRESENT(spectrum)) spectrum => xas_env%spectrum
     209        3008 :       IF (PRESENT(groundstate_coeff)) groundstate_coeff => xas_env%groundstate_coeff
     210        3008 :       IF (PRESENT(ostrength_sm)) ostrength_sm => xas_env%ostrength_sm
     211        3008 :       IF (PRESENT(excvec_overlap)) excvec_overlap => xas_env%excvec_overlap
     212        3008 :       IF (PRESENT(unoccupied_orbs)) unoccupied_orbs => xas_env%unoccupied_orbs
     213        3008 :       IF (PRESENT(all_vectors)) all_vectors => xas_env%all_vectors
     214        3008 :       IF (PRESENT(dip_fm_set)) dip_fm_set => xas_env%dip_fm_set
     215        3008 :       IF (PRESENT(qs_loc_env)) qs_loc_env => xas_env%qs_loc_env
     216        3008 :       IF (PRESENT(excvec_coeff)) excvec_coeff => xas_env%excvec_coeff
     217        3008 :       IF (PRESENT(my_gto_basis)) my_gto_basis => xas_env%my_gto_basis
     218        3008 :       IF (PRESENT(stogto_overlap)) stogto_overlap => xas_env%stogto_overlap
     219        3008 :       IF (PRESENT(scf_env)) scf_env => xas_env%scf_env
     220        3008 :       IF (PRESENT(scf_control)) scf_control => xas_env%scf_control
     221        3008 :    END SUBROUTINE get_xas_env
     222             : 
     223             : ! **************************************************************************************************
     224             : !> \brief ...
     225             : !> \param xas_env ...
     226             : !> \param nexc_search ...
     227             : !> \param spin_channel ...
     228             : !> \param nexc_atoms ...
     229             : !> \param nvirtual ...
     230             : !> \param nvirtual2 ...
     231             : !> \param ip_energy ...
     232             : !> \param occ_estate ...
     233             : !> \param qs_loc_env ...
     234             : !> \param xas_estate ...
     235             : !> \param xas_nelectron ...
     236             : !> \param homo_occ ...
     237             : !> \param scf_env ...
     238             : !> \param scf_control ...
     239             : ! **************************************************************************************************
     240        1068 :    SUBROUTINE set_xas_env(xas_env, nexc_search, spin_channel, nexc_atoms, &
     241             :                           nvirtual, nvirtual2, ip_energy, occ_estate, qs_loc_env, &
     242             :                           xas_estate, xas_nelectron, homo_occ, scf_env, scf_control)
     243             : 
     244             :       TYPE(xas_environment_type), INTENT(INOUT)          :: xas_env
     245             :       INTEGER, INTENT(IN), OPTIONAL                      :: nexc_search, spin_channel, nexc_atoms, &
     246             :                                                             nvirtual, nvirtual2
     247             :       REAL(dp), INTENT(IN), OPTIONAL                     :: ip_energy, occ_estate
     248             :       TYPE(qs_loc_env_type), OPTIONAL, POINTER           :: qs_loc_env
     249             :       INTEGER, INTENT(IN), OPTIONAL                      :: xas_estate
     250             :       REAL(dp), INTENT(IN), OPTIONAL                     :: xas_nelectron, homo_occ
     251             :       TYPE(qs_scf_env_type), OPTIONAL, POINTER           :: scf_env
     252             :       TYPE(scf_control_type), OPTIONAL, POINTER          :: scf_control
     253             : 
     254        1068 :       IF (PRESENT(nexc_search)) xas_env%nexc_search = nexc_search
     255        1068 :       IF (PRESENT(spin_channel)) xas_env%spin_channel = spin_channel
     256        1068 :       IF (PRESENT(nexc_atoms)) xas_env%nexc_atoms = nexc_atoms
     257        1068 :       IF (PRESENT(nvirtual)) xas_env%nvirtual = nvirtual
     258        1068 :       IF (PRESENT(nvirtual2)) xas_env%nvirtual2 = nvirtual2
     259        1068 :       IF (PRESENT(occ_estate)) xas_env%occ_estate = occ_estate
     260        1068 :       IF (PRESENT(xas_nelectron)) xas_env%xas_nelectron = xas_nelectron
     261        1068 :       IF (PRESENT(homo_occ)) xas_env%homo_occ = homo_occ
     262        1068 :       IF (PRESENT(xas_estate)) xas_env%xas_estate = xas_estate
     263        1068 :       IF (PRESENT(ip_energy)) xas_env%ip_energy = ip_energy
     264        1068 :       IF (PRESENT(qs_loc_env)) THEN
     265          42 :          IF (ASSOCIATED(xas_env%qs_loc_env)) THEN
     266           0 :             IF (.NOT. ASSOCIATED(xas_env%qs_loc_env, qs_loc_env)) THEN
     267           0 :                CALL qs_loc_env_release(xas_env%qs_loc_env)
     268           0 :                DEALLOCATE (xas_env%qs_loc_env)
     269             :             END IF
     270             :          END IF
     271          42 :          xas_env%qs_loc_env => qs_loc_env
     272             :       END IF
     273        1068 :       IF (PRESENT(scf_env)) THEN ! accept also null pointers ?
     274          46 :          IF (ASSOCIATED(xas_env%scf_env)) THEN
     275           0 :          IF (ASSOCIATED(xas_env%scf_env, scf_env)) THEN
     276           0 :             CALL scf_env_release(xas_env%scf_env)
     277           0 :             DEALLOCATE (xas_env%scf_env)
     278             :          END IF
     279             :          END IF
     280          46 :          xas_env%scf_env => scf_env
     281             :       END IF
     282        1068 :       IF (PRESENT(scf_control)) THEN ! accept also null pointers?
     283          42 :          IF (ASSOCIATED(xas_env%scf_control)) THEN
     284           0 :             IF (.NOT. ASSOCIATED(xas_env%scf_control, scf_control)) THEN
     285           0 :                CALL scf_c_release(xas_env%scf_control)
     286           0 :                DEALLOCATE (xas_env%scf_control)
     287             :             END IF
     288             :          END IF
     289          42 :          xas_env%scf_control => scf_control
     290             :       END IF
     291             : 
     292        1068 :    END SUBROUTINE set_xas_env
     293             : 
     294             : ! **************************************************************************************************
     295             : !> \brief ...
     296             : !> \param xas_env ...
     297             : ! **************************************************************************************************
     298          42 :    SUBROUTINE xas_env_create(xas_env)
     299             : 
     300             :       TYPE(xas_environment_type), INTENT(OUT)            :: xas_env
     301             : 
     302             :       xas_env%nvirtual = 0
     303             :       xas_env%nvirtual2 = 0
     304             : 
     305             :       NULLIFY (xas_env%ao_mo_fm_pools)
     306             :       NULLIFY (xas_env%my_gto_basis)
     307             :       NULLIFY (xas_env%atom_of_state)
     308             :       NULLIFY (xas_env%nexc_states)
     309             :       NULLIFY (xas_env%state_of_atom)
     310             :       NULLIFY (xas_env%exc_atoms)
     311             :       NULLIFY (xas_env%excvec_coeff, xas_env%excvec_overlap)
     312             :       NULLIFY (xas_env%type_of_state, xas_env%mykind_of_atom)
     313             :       NULLIFY (xas_env%type_of_state, xas_env%mykind_of_kind)
     314             :       NULLIFY (xas_env%groundstate_coeff, xas_env%dip_fm_set)
     315             :       NULLIFY (xas_env%ostrength_sm, xas_env%qs_loc_env, xas_env%spectrum)
     316             :       NULLIFY (xas_env%all_evals, xas_env%all_vectors)
     317             :       NULLIFY (xas_env%unoccupied_evals, xas_env%unoccupied_orbs)
     318             :       NULLIFY (xas_env%stogto_overlap)
     319             :       NULLIFY (xas_env%scf_env)
     320             :       NULLIFY (xas_env%scf_control)
     321             : 
     322          42 :    END SUBROUTINE xas_env_create
     323             : 
     324             : ! **************************************************************************************************
     325             : !> \brief ...
     326             : !> \param xas_env ...
     327             : ! **************************************************************************************************
     328          42 :    SUBROUTINE xas_env_release(xas_env)
     329             : 
     330             :       TYPE(xas_environment_type), INTENT(INOUT)          :: xas_env
     331             : 
     332             :       INTEGER                                            :: ik
     333             : 
     334          42 :       DEALLOCATE (xas_env%state_of_atom, xas_env%atom_of_state)
     335          42 :       DEALLOCATE (xas_env%nexc_states)
     336          42 :       DEALLOCATE (xas_env%type_of_state)
     337          42 :       DEALLOCATE (xas_env%mykind_of_atom)
     338          42 :       DEALLOCATE (xas_env%mykind_of_kind)
     339          42 :       DEALLOCATE (xas_env%exc_atoms)
     340          42 :       DEALLOCATE (xas_env%centers_wfn)
     341          42 :       IF (ASSOCIATED(xas_env%all_evals)) THEN
     342          42 :          DEALLOCATE (xas_env%all_evals)
     343             :       END IF
     344          42 :       IF (ASSOCIATED(xas_env%unoccupied_evals)) THEN
     345          40 :          DEALLOCATE (xas_env%unoccupied_evals)
     346             :       END IF
     347             :       CALL fm_pools_give_back_fm_vect(xas_env%ao_mo_fm_pools, &
     348          42 :                                       xas_env%groundstate_coeff)
     349             : 
     350          42 :       CALL cp_fm_release(xas_env%dip_fm_set)
     351             : 
     352          42 :       IF (ASSOCIATED(xas_env%excvec_coeff)) THEN
     353          42 :          CALL cp_fm_release(xas_env%excvec_coeff)
     354          42 :          DEALLOCATE (xas_env%excvec_coeff)
     355             :          NULLIFY (xas_env%excvec_coeff)
     356             :       END IF
     357          42 :       IF (ASSOCIATED(xas_env%excvec_overlap)) THEN
     358          42 :          CALL cp_fm_release(xas_env%excvec_overlap)
     359          42 :          DEALLOCATE (xas_env%excvec_overlap)
     360             :          NULLIFY (xas_env%excvec_overlap)
     361             :       END IF
     362          42 :       IF (ASSOCIATED(xas_env%unoccupied_orbs)) THEN
     363          40 :          CALL cp_fm_release(xas_env%unoccupied_orbs)
     364          40 :          DEALLOCATE (xas_env%unoccupied_orbs)
     365             :          NULLIFY (xas_env%unoccupied_orbs)
     366             :       END IF
     367          42 :       NULLIFY (xas_env%ao_mo_fm_pools)
     368          42 :       IF (ASSOCIATED(xas_env%all_vectors) .AND. xas_env%nvirtual .GT. 0) THEN
     369          42 :          CALL cp_fm_release(xas_env%all_vectors)
     370          42 :          DEALLOCATE (xas_env%all_vectors)
     371          42 :          NULLIFY (xas_env%all_vectors)
     372             :       ELSE
     373           0 :          NULLIFY (xas_env%all_vectors)
     374             :       END IF
     375             : 
     376          42 :       IF (ASSOCIATED(xas_env%ostrength_sm)) THEN
     377          42 :          CALL dbcsr_deallocate_matrix_set(xas_env%ostrength_sm)
     378             :       END IF
     379          42 :       IF (ASSOCIATED(xas_env%qs_loc_env)) THEN
     380          42 :          CALL qs_loc_env_release(xas_env%qs_loc_env)
     381          42 :          DEALLOCATE (xas_env%qs_loc_env)
     382             :       END IF
     383             : 
     384          42 :       IF (ASSOCIATED(xas_env%my_gto_basis)) THEN
     385         114 :          DO ik = 1, SIZE(xas_env%my_gto_basis, 1)
     386         114 :             CALL deallocate_gto_basis_set(xas_env%my_gto_basis(ik)%gto_basis_set)
     387             :          END DO
     388          42 :          DEALLOCATE (xas_env%my_gto_basis)
     389             :       END IF
     390             : 
     391          42 :       IF (ASSOCIATED(xas_env%stogto_overlap)) THEN
     392         114 :          DO ik = 1, SIZE(xas_env%stogto_overlap, 1)
     393         114 :             DEALLOCATE (xas_env%stogto_overlap(ik)%array)
     394             :          END DO
     395          42 :          DEALLOCATE (xas_env%stogto_overlap)
     396             :       END IF
     397             : 
     398          42 :       IF (ASSOCIATED(xas_env%scf_env)) THEN
     399           2 :          CALL scf_env_release(xas_env%scf_env)
     400           2 :          DEALLOCATE (xas_env%scf_env)
     401             :       END IF
     402          42 :       IF (ASSOCIATED(xas_env%scf_control)) THEN
     403          42 :          CALL scf_c_release(xas_env%scf_control)
     404          42 :          DEALLOCATE (xas_env%scf_control)
     405             :       END IF
     406             : 
     407          42 :    END SUBROUTINE xas_env_release
     408             : 
     409           0 : END MODULE xas_env_types
     410             : 

Generated by: LCOV version 1.15