(git:0de0cc2)
xc_write_output.F
Go to the documentation of this file.
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 ! **************************************************************************************************
12 
13  USE input_constants, ONLY: xc_none
17  section_vals_type,&
19  USE kinds, ONLY: default_string_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  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  CHARACTER(LEN=:), ALLOCATABLE :: reference
48  INTEGER :: ifun, il, myfun
49  TYPE(section_vals_type), POINTER :: xc_fun, xc_fun_section
50 
51  IF (iounit > 0) THEN
52 
53  xc_fun_section => section_vals_get_subs_vals(xc_section, &
54  "XC_FUNCTIONAL")
55  CALL section_vals_val_get(xc_fun_section, "_SECTION_PARAMETERS_", i_val=myfun)
56  IF (myfun /= xc_none) THEN
57 
58  !check if FUNCTIONAL_ROUTINE keyword present
59 
60  CALL xc_functionals_expand(xc_fun_section, xc_section)
61  ifun = 0
62  DO
63  ifun = ifun + 1
64  xc_fun => section_vals_get_subs_vals2(xc_fun_section, i_section=ifun)
65  IF (.NOT. ASSOCIATED(xc_fun)) EXIT
66  IF (libxc_check_existence_in_libxc(xc_fun)) THEN
67  ALLOCATE (CHARACTER(LEN=libxc_get_reference_length(xc_fun, lsd)) :: reference)
68  ELSE
69  ALLOCATE (CHARACTER(LEN=20*default_string_length) :: reference)
70  END IF
71  CALL xc_functional_get_info(xc_fun, lsd=lsd, reference=reference, shortform=shortform)
72  WRITE (iounit, fmt="(' FUNCTIONAL| ',a,':')") &
73  trim(xc_fun%section%name)
74  DO il = 1, len_trim(reference), 67
75  WRITE (iounit, fmt="(' FUNCTIONAL| ',a67)") reference(il:)
76  END DO
77  DEALLOCATE (reference)
78  END DO
79  ELSE
80  WRITE (iounit, fmt="(' FUNCTIONAL| NO EXCHANGE-CORRELATION FUNCTIONAL USED.')")
81  END IF
82  END IF
83 
84  END SUBROUTINE xc_write
85 
86 END MODULE xc_write_output
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public xc_none
checks the input and perform some automatic "magic" on it
subroutine, public xc_functionals_expand(functionals, xc_section)
expand a shortcutted functional section
objects that represent the structure of input sections and the data contained in an input section
type(section_vals_type) function, pointer, public section_vals_get_subs_vals2(section_vals, i_section, i_rep_section)
returns the values of the n-th non default subsection (null if no such section exists (not so many no...
recursive type(section_vals_type) function, pointer, public section_vals_get_subs_vals(section_vals, subsection_name, i_rep_section, can_return_null)
returns the values of the requested subsection
subroutine, public section_vals_val_get(section_vals, keyword_name, i_rep_section, i_rep_val, n_rep_val, val, l_val, i_val, r_val, c_val, l_vals, i_vals, r_vals, c_vals, explicit)
returns the requested value
Defines the basic variable types.
Definition: kinds.F:23
integer, parameter, public default_string_length
Definition: kinds.F:57
subroutine, public xc_functional_get_info(functional, lsd, reference, shortform, needs, max_deriv, print_warn)
get the information about the given functional
calculates a functional from libxc and its derivatives
Definition: xc_libxc.F:28
logical function, public libxc_check_existence_in_libxc(libxc_params)
This function checks whether a functional name belongs to LibXC.
Definition: xc_libxc.F:138
integer function, public libxc_get_reference_length(libxc_params, lsd)
This function returns the maximum length of the reference string for a given LibXC functional.
Definition: xc_libxc.F:159
Writes information on XC functionals to output.
subroutine, public xc_write(iounit, xc_section, lsd)
...