Octopus
xc_cam.F90
Go to the documentation of this file.
1!! Copyright (C) 2025. A Buccheri
2!!
3!! This program is free software; you can redistribute it and/or modify
4!! it under the terms of the GNU General Public License as published by
5!! the Free Software Foundation; either version 2, or (at your option)
6!! any later version.
7!!
8!! This program is distributed in the hope that it will be useful,
9!! but WITHOUT ANY WARRANTY; without even the implied warranty of
10!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11!! GNU General Public License for more details.
12!!
13!! You should have received a copy of the GNU General Public License
14!! along with this program; if not, write to the Free Software
15!! Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16!! 02110-1301, USA.
17!!
18#include "global.h"
19
20module xc_cam_oct_m
21 use, intrinsic :: iso_fortran_env
22
23 use debug_oct_m
24 use global_oct_m
28
29 implicit none
30 private
31 public :: xc_cam_t, &
32 cam_null, &
34
46 type xc_cam_t
47 real(real64) :: omega = 0.0_real64
48 real(real64) :: alpha = 0.0_real64
49 real(real64) :: beta = 0.0_real64
50 contains
51 procedure :: is_null => xc_cam_is_null
52 procedure :: print => xc_cam_print
53 procedure :: as_array => xc_cam_as_array
54 end type xc_cam_t
55
57 type(xc_cam_t), parameter :: cam_null = xc_cam_t(0.0_real64, 0.0_real64, 0.0_real64)
58
60 type(xc_cam_t), parameter :: cam_exact_exchange = xc_cam_t(0.0_real64, 1.0_real64, 0.0_real64)
61
62contains
63
65 pure function xc_cam_is_null(this) result(is_null)
66 class(xc_cam_t), intent(in) :: this
67
68 logical :: is_null
69
70 is_null = all(abs([this%omega, this%alpha, this%beta]) <= m_epsilon)
71
72 end function xc_cam_is_null
73
75 subroutine xc_cam_print(this, namespace, msg)
76 class(xc_cam_t), intent(in) :: this
77 type(namespace_t), intent(in) :: namespace
78 character(len=*), optional, intent(in) :: msg
79
80 character(len=256) :: info_message
81
82 push_sub(xc_cam_print)
83
84 if (present(msg)) then
85 info_message = msg
86 else
87 info_message = "CAM parameters are:"
88 endif
89
90 write(message(1), '(1x)')
91 write(message(2), '(a)') "Info: " // trim(adjustl(info_message))
92 write(message(2), '(a,f8.5)') " alpha = ", this%alpha
93 write(message(3), '(a,f8.5)') " beta = ", this%beta
94 write(message(4), '(a,f8.5)') " omega = ", this%omega
95 call messages_info(4, namespace=namespace)
96
97 pop_sub(xc_cam_print)
98
99 end subroutine xc_cam_print
100
109 pure function xc_cam_as_array(this) result(params)
110 class(xc_cam_t), intent(in) :: this
111
112 real(real64) :: params(3)
114 params = [this%alpha, this%beta, this%omega]
115
116 end function xc_cam_as_array
117
118end module xc_cam_oct_m
real(real64), parameter, public m_epsilon
Definition: global.F90:204
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
Definition: messages.F90:160
subroutine, public messages_info(no_lines, iunit, debug_only, stress, all_nodes, namespace)
Definition: messages.F90:616
type(xc_cam_t), parameter, public cam_null
All CAM parameters set to zero.
Definition: xc_cam.F90:150
pure real(real64) function, dimension(3) xc_cam_as_array(this)
@ brief Return attributes as an array of reals. LibXC interface expects an array of reals,...
Definition: xc_cam.F90:203
pure logical function xc_cam_is_null(this)
Are all attributes of a xc_cam_t instance set to their default (null) values.
Definition: xc_cam.F90:159
type(xc_cam_t), parameter, public cam_exact_exchange
Use only Hartree Fock exact exchange.
Definition: xc_cam.F90:153
subroutine xc_cam_print(this, namespace, msg)
Print attribute values.
Definition: xc_cam.F90:169
Coulomb-attenuating method parameters, used in the partitioning of the Coulomb potential into a short...
Definition: xc_cam.F90:139