LCOV - code coverage report
Current view: top level - src - qs_charges_types.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:0de0cc2) Lines: 17 20 85.0 %
Date: 2024-03-28 07:31:50 Functions: 2 3 66.7 %

          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 container for information about total charges on the grids
      10             : !> \par History
      11             : !>      10.2002 created [fawzi]
      12             : !> \author Fawzi Mohamed
      13             : ! **************************************************************************************************
      14             : MODULE qs_charges_types
      15             : 
      16             :    USE kinds,                           ONLY: dp
      17             : #include "./base/base_uses.f90"
      18             : 
      19             :    IMPLICIT NONE
      20             :    PRIVATE
      21             : 
      22             :    LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .TRUE.
      23             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qs_charges_types'
      24             : 
      25             :    PUBLIC :: qs_charges_type
      26             :    PUBLIC :: qs_charges_create, qs_charges_release
      27             : !***
      28             : 
      29             : ! **************************************************************************************************
      30             : !> \brief Container for information about total charges on the grids
      31             : !> \param total_rho_core_rspace total charge on the rho_core grid
      32             : !> \param total_rho_rspace total charge in the real space
      33             : !> \param total_rho_gspace total charge in the g space
      34             : !> \note
      35             : !>      this type is losing the reason to exist...
      36             : !> \par History
      37             : !>      10.2002 created [fawzi]
      38             : !>      11.2002 moved total_rho_elec_rspace to qs_rho_type
      39             : !> \author Fawzi Mohamed
      40             : ! **************************************************************************************************
      41             :    TYPE qs_charges_type
      42             :       REAL(KIND=dp) :: total_rho_core_rspace, total_rho_gspace
      43             :       REAL(KIND=dp) :: total_rho0_soft_rspace, total_rho0_hard_lebedev
      44             :       REAL(KIND=dp) :: total_rho_soft_gspace
      45             :       REAL(KIND=dp), DIMENSION(:), POINTER  :: total_rho1_hard, &
      46             :                                                total_rho1_soft
      47             :       REAL(KIND=dp) :: background
      48             :    END TYPE qs_charges_type
      49             : 
      50             : CONTAINS
      51             : 
      52             : ! **************************************************************************************************
      53             : !> \brief creates a charges object
      54             : !> \param qs_charges the charges object to create
      55             : !> \param nspins ...
      56             : !> \param total_rho_core_rspace ...
      57             : !> \param total_rho_gspace ...
      58             : !> \par History
      59             : !>      10.2002 created [fawzi]
      60             : !> \author Fawzi Mohamed
      61             : ! **************************************************************************************************
      62        6550 :    SUBROUTINE qs_charges_create(qs_charges, nspins, total_rho_core_rspace, &
      63             :                                 total_rho_gspace)
      64             :       TYPE(qs_charges_type), INTENT(OUT)                 :: qs_charges
      65             :       INTEGER, INTENT(in)                                :: nspins
      66             :       REAL(KIND=dp), INTENT(in), OPTIONAL                :: total_rho_core_rspace, total_rho_gspace
      67             : 
      68        6550 :       qs_charges%total_rho_core_rspace = 0.0_dp
      69        6550 :       IF (PRESENT(total_rho_core_rspace)) &
      70           0 :          qs_charges%total_rho_core_rspace = total_rho_core_rspace
      71        6550 :       qs_charges%total_rho_gspace = 0.0_dp
      72        6550 :       IF (PRESENT(total_rho_gspace)) &
      73           0 :          qs_charges%total_rho_gspace = total_rho_gspace
      74        6550 :       qs_charges%total_rho_soft_gspace = 0.0_dp
      75        6550 :       qs_charges%total_rho0_hard_lebedev = 0.0_dp
      76             :       qs_charges%total_rho_soft_gspace = 0.0_dp
      77        6550 :       qs_charges%background = 0.0_dp
      78       19650 :       ALLOCATE (qs_charges%total_rho1_hard(nspins))
      79       14571 :       qs_charges%total_rho1_hard(:) = 0.0_dp
      80       19650 :       ALLOCATE (qs_charges%total_rho1_soft(nspins))
      81       14571 :       qs_charges%total_rho1_soft(:) = 0.0_dp
      82        6550 :    END SUBROUTINE qs_charges_create
      83             : 
      84             : ! **************************************************************************************************
      85             : !> \brief releases the charges object (see cp2k/doc/ReferenceCounting.html)
      86             : !> \param qs_charges the object to be released
      87             : !> \par History
      88             : !>      10.2002 created [fawzi]
      89             : !> \author Fawzi Mohamed
      90             : ! **************************************************************************************************
      91        6550 :    SUBROUTINE qs_charges_release(qs_charges)
      92             :       TYPE(qs_charges_type), INTENT(INOUT)               :: qs_charges
      93             : 
      94        6550 :       DEALLOCATE (qs_charges%total_rho1_hard)
      95        6550 :       DEALLOCATE (qs_charges%total_rho1_soft)
      96             : 
      97        6550 :    END SUBROUTINE qs_charges_release
      98             : 
      99           0 : END MODULE qs_charges_types

Generated by: LCOV version 1.15