LCOV - code coverage report
Current view: top level - src - xc_write_output.F (source / functions) Hit Total Coverage
Test: CP2K Regtests (git:2fce0f8) Lines: 22 22 100.0 %
Date: 2024-12-21 06:28:57 Functions: 1 1 100.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 Writes information on XC functionals to output
      10             : ! **************************************************************************************************
      11             : MODULE xc_write_output
      12             : 
      13             :    USE input_constants,                 ONLY: xc_none
      14             :    USE input_cp2k_check,                ONLY: xc_functionals_expand
      15             :    USE input_section_types,             ONLY: section_vals_get_subs_vals,&
      16             :                                               section_vals_get_subs_vals2,&
      17             :                                               section_vals_type,&
      18             :                                               section_vals_val_get
      19             :    USE kinds,                           ONLY: default_string_length
      20             :    USE xc_derivatives,                  ONLY: xc_functional_get_info
      21             :    USE xc_libxc,                        ONLY: libxc_check_existence_in_libxc,&
      22             :                                               libxc_get_reference_length
      23             : #include "./base/base_uses.f90"
      24             : 
      25             :    IMPLICIT NONE
      26             : 
      27             :    PRIVATE
      28             : 
      29             :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'xc_write_output'
      30             : 
      31             :    PUBLIC :: xc_write
      32             : 
      33             : CONTAINS
      34             : 
      35             : ! **************************************************************************************************
      36             : !> \brief ...
      37             : !> \param iounit ...
      38             : !> \param xc_section ...
      39             : !> \param lsd ...
      40             : ! **************************************************************************************************
      41        1639 :    SUBROUTINE xc_write(iounit, xc_section, lsd)
      42             :       INTEGER, INTENT(IN)                                :: iounit
      43             :       TYPE(section_vals_type), POINTER                   :: xc_section
      44             :       LOGICAL, INTENT(IN)                                :: lsd
      45             : 
      46             :       CHARACTER(LEN=2*default_string_length)             :: shortform
      47        1639 :       CHARACTER(LEN=:), ALLOCATABLE                      :: reference
      48             :       INTEGER                                            :: ifun, il, myfun
      49             :       TYPE(section_vals_type), POINTER                   :: xc_fun, xc_fun_section
      50             : 
      51        1639 :       IF (iounit > 0) THEN
      52             : 
      53             :          xc_fun_section => section_vals_get_subs_vals(xc_section, &
      54        1639 :                                                       "XC_FUNCTIONAL")
      55        1639 :          CALL section_vals_val_get(xc_fun_section, "_SECTION_PARAMETERS_", i_val=myfun)
      56        1639 :          IF (myfun /= xc_none) THEN
      57             : 
      58             :             !check if FUNCTIONAL_ROUTINE keyword present
      59             : 
      60        1459 :             CALL xc_functionals_expand(xc_fun_section, xc_section)
      61        1459 :             ifun = 0
      62        1616 :             DO
      63        3075 :                ifun = ifun + 1
      64        3075 :                xc_fun => section_vals_get_subs_vals2(xc_fun_section, i_section=ifun)
      65        3075 :                IF (.NOT. ASSOCIATED(xc_fun)) EXIT
      66        1616 :                IF (libxc_check_existence_in_libxc(xc_fun)) THEN
      67          67 :                   ALLOCATE (CHARACTER(LEN=libxc_get_reference_length(xc_fun, lsd)) :: reference)
      68             :                ELSE
      69        1549 :                   ALLOCATE (CHARACTER(LEN=20*default_string_length) :: reference)
      70             :                END IF
      71        1616 :                CALL xc_functional_get_info(xc_fun, lsd=lsd, reference=reference, shortform=shortform)
      72             :                WRITE (iounit, fmt="(' FUNCTIONAL| ',a,':')") &
      73        1616 :                   TRIM(xc_fun%section%name)
      74        4647 :                DO il = 1, LEN_TRIM(reference), 67
      75        4647 :                   WRITE (iounit, fmt="(' FUNCTIONAL| ',a67)") reference(il:)
      76             :                END DO
      77        3075 :                DEALLOCATE (reference)
      78             :             END DO
      79             :          ELSE
      80         180 :             WRITE (iounit, fmt="(' FUNCTIONAL| NO EXCHANGE-CORRELATION FUNCTIONAL USED.')")
      81             :          END IF
      82             :       END IF
      83             : 
      84        1639 :    END SUBROUTINE xc_write
      85             : 
      86             : END MODULE xc_write_output

Generated by: LCOV version 1.15