Line data Source code
1 : !--------------------------------------------------------------------------------------------------!
2 : ! CP2K: A general program to perform molecular dynamics simulations !
3 : ! Copyright 2000-2025 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 1296123 : ELEMENTAL SUBROUTINE xc_rho_cflags_setall(cflags, value)
63 : TYPE(xc_rho_cflags_type), INTENT(out) :: cflags
64 : LOGICAL, INTENT(in) :: value
65 :
66 1296123 : cflags%rho = value
67 1296123 : cflags%rho_spin = value
68 1296123 : cflags%drho = value
69 1296123 : cflags%drho_spin = value
70 1296123 : cflags%norm_drho = value
71 1296123 : cflags%norm_drho_spin = value
72 1296123 : cflags%rho_1_3 = value
73 1296123 : cflags%rho_spin_1_3 = value
74 1296123 : cflags%tau = value
75 1296123 : cflags%tau_spin = value
76 1296123 : cflags%laplace_rho = value
77 1296123 : cflags%laplace_rho_spin = value
78 1296123 : 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 156015 : 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 156015 : (cflags1%laplace_rho_spin .EQV. cflags2%laplace_rho_spin))
102 :
103 156015 : END FUNCTION xc_rho_cflags_equal
104 :
105 0 : END MODULE xc_rho_cflags_types
|