LCOV - code coverage report
Current view: top level - src/xc - xc_rho_cflags_types.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:b8e0b09) Lines: 17 18 94.4 %
Date: 2024-08-31 06:31:37 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 contains the structure
      10             : !> \par History
      11             : !>      11.2003 created [fawzi]
      12             : !> \author fawzi
      13             : ! **************************************************************************************************
      14             : MODULE xc_rho_cflags_types
      15             : 
      16             : #include "../base/base_uses.f90"
      17             :    IMPLICIT NONE
      18             :    PRIVATE
      19             :    LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .FALSE.
      20             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'xc_rho_cflags_types'
      21             : 
      22             :    PUBLIC :: xc_rho_cflags_type
      23             :    PUBLIC :: xc_rho_cflags_setall, &
      24             :              xc_rho_cflags_equal
      25             : 
      26             : ! **************************************************************************************************
      27             : !> \brief contains a flag for each component of xc_rho_set, so that you can
      28             : !>      use it to tell which components you need, which ones you need,....
      29             : !> \param rho flags for rho (the total density)
      30             : !> \param rho_spin flag for rhoa and rhob (the spin density with LSD)
      31             : !> \param drho flag for drho (the gradient of rho)
      32             : !> \param drho_spin flag for drhoa and drhob (the gradient of the spin
      33             : !>        density)
      34             : !> \param norm_drho flag for norm_drho (the norm of the gradient of rho)
      35             : !> \param norm_drho_spin flag for norm_drhoa, norm_drhob (the norm of the
      36             : !>        gradient of the spin density)
      37             : !> \param rho_ 1_3: flag for rho**(1.0_dp/3.0_dp)
      38             : !> \param rho_spin_ 1_3: flag for rhoa**(1.0_dp/3.0_dp) and rhob**(1.0_dp/3.0_dp)
      39             : !> \param tau flags for the kinetic (KS) part of rho
      40             : !> \param tau_spin flags for the kinetic (KS) part of rhoa and rhob
      41             : !> \note
      42             : !>      low_level type without retain/release
      43             : !> \par History
      44             : !>      11.2003 created [fawzi]
      45             : !>      12.2008 added laplace parts [mguidon]
      46             : !> \author fawzi
      47             : ! **************************************************************************************************
      48             :    TYPE xc_rho_cflags_type
      49             :       LOGICAL :: rho = .FALSE., rho_spin = .FALSE., drho = .FALSE., drho_spin = .FALSE., &
      50             :                  norm_drho = .FALSE., norm_drho_spin = .FALSE., &
      51             :                  rho_1_3 = .FALSE., rho_spin_1_3 = .FALSE., &
      52             :                  tau = .FALSE., tau_spin = .FALSE., laplace_rho = .FALSE., laplace_rho_spin = .FALSE.
      53             :    END TYPE xc_rho_cflags_type
      54             : 
      55             : CONTAINS
      56             : 
      57             : ! **************************************************************************************************
      58             : !> \brief sets all the flags to the given value
      59             : !> \param cflags the flags to set
      60             : !> \param value the value to set
      61             : ! **************************************************************************************************
      62     1252849 :    ELEMENTAL SUBROUTINE xc_rho_cflags_setall(cflags, value)
      63             :       TYPE(xc_rho_cflags_type), INTENT(out)              :: cflags
      64             :       LOGICAL, INTENT(in)                                :: value
      65             : 
      66     1252849 :       cflags%rho = value
      67     1252849 :       cflags%rho_spin = value
      68     1252849 :       cflags%drho = value
      69     1252849 :       cflags%drho_spin = value
      70     1252849 :       cflags%norm_drho = value
      71     1252849 :       cflags%norm_drho_spin = value
      72     1252849 :       cflags%rho_1_3 = value
      73     1252849 :       cflags%rho_spin_1_3 = value
      74     1252849 :       cflags%tau = value
      75     1252849 :       cflags%tau_spin = value
      76     1252849 :       cflags%laplace_rho = value
      77     1252849 :       cflags%laplace_rho_spin = value
      78     1252849 :    END SUBROUTINE xc_rho_cflags_setall
      79             : 
      80             : ! **************************************************************************************************
      81             : !> \brief return true if the two cflags are equal
      82             : !> \param cflags1 the flags to compare
      83             : !> \param cflags2 the flags to compare
      84             : !> \return ...
      85             : ! **************************************************************************************************
      86      151093 :    ELEMENTAL FUNCTION xc_rho_cflags_equal(cflags1, cflags2) RESULT(equal)
      87             :       TYPE(xc_rho_cflags_type), INTENT(in)               :: cflags1, cflags2
      88             :       LOGICAL                                            :: equal
      89             : 
      90             :       equal = ((cflags1%rho .EQV. cflags2%rho) .AND. &
      91             :                (cflags1%rho_spin .EQV. cflags2%rho_spin) .AND. &
      92             :                (cflags1%drho .EQV. cflags2%drho) .AND. &
      93             :                (cflags1%drho_spin .EQV. cflags2%drho_spin) .AND. &
      94             :                (cflags1%norm_drho .EQV. cflags2%norm_drho) .AND. &
      95             :                (cflags1%norm_drho_spin .EQV. cflags2%norm_drho_spin) .AND. &
      96             :                (cflags1%rho_1_3 .EQV. cflags2%rho_1_3) .AND. &
      97             :                (cflags1%rho_spin_1_3 .EQV. cflags2%rho_spin_1_3) .AND. &
      98             :                (cflags1%tau .EQV. cflags2%tau) .AND. &
      99             :                (cflags1%tau_spin .EQV. cflags2%tau_spin) .AND. &
     100             :                (cflags1%laplace_rho .EQV. cflags2%laplace_rho) .AND. &
     101      151093 :                (cflags1%laplace_rho_spin .EQV. cflags2%laplace_rho_spin))
     102             : 
     103      151093 :    END FUNCTION xc_rho_cflags_equal
     104             : 
     105           0 : END MODULE xc_rho_cflags_types

Generated by: LCOV version 1.15