-
Notifications
You must be signed in to change notification settings - Fork 1
/
iao_types.F
175 lines (158 loc) · 8.75 KB
/
iao_types.F
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
!--------------------------------------------------------------------------------------------------!
! CP2K: A general program to perform molecular dynamics simulations !
! Copyright 2000-2024 CP2K developers group <https://cp2k.org> !
! !
! SPDX-License-Identifier: GPL-2.0-or-later !
!--------------------------------------------------------------------------------------------------!
! **************************************************************************************************
!> \brief Calculate ntrinsic atomic orbitals and analyze wavefunctions
!> \par History
!> 03.2023 created [JGH]
!> \author JGH
! **************************************************************************************************
MODULE iao_types
USE cell_types, ONLY: cell_type
USE input_constants, ONLY: do_iaoloc_enone,&
do_iaoloc_pm2
USE input_section_types, ONLY: section_vals_get,&
section_vals_get_subs_vals,&
section_vals_type,&
section_vals_val_get
USE kinds, ONLY: dp
#include "./base/base_uses.f90"
IMPLICIT NONE
PRIVATE
PUBLIC :: iao_env_type, iao_read_input, iao_set_default
! **************************************************************************************************
TYPE iao_env_type
LOGICAL :: do_iao = .FALSE.
!
REAL(KIND=dp) :: eps_svd = 0.0_dp
REAL(KIND=dp) :: eps_occ = 0.0_dp
! chages
LOGICAL :: do_charges = .FALSE.
! one-center expansion
LOGICAL :: do_oce = .FALSE.
INTEGER :: lmax_oce = 0
INTEGER :: nbas_oce = 0
LOGICAL :: append_oce = .FALSE.
! Bond orbitals
LOGICAL :: do_bondorbitals = .FALSE.
! Wannier centers
LOGICAL :: do_center = .FALSE.
LOGICAL :: pos_periodic = .FALSE.
INTEGER :: loc_operator = 0
INTEGER :: eloc_function = 0
REAL(KIND=dp) :: eloc_weight = 0.0_dp
! Molden
LOGICAL :: molden_iao = .FALSE.
LOGICAL :: molden_ibo = .FALSE.
! CUBE files
LOGICAL :: cubes_iao = .FALSE.
LOGICAL :: cubes_ibo = .FALSE.
! Input sections
TYPE(section_vals_type), POINTER :: iao_cubes_section => NULL(), &
iao_molden_section => NULL(), &
ibo_cubes_section => NULL(), &
ibo_molden_section => NULL(), &
ibo_cc_section => NULL()
END TYPE iao_env_type
! **************************************************************************************************
CONTAINS
! **************************************************************************************************
!> \brief ...
!> \param iao_env ...
! **************************************************************************************************
SUBROUTINE iao_set_default(iao_env)
TYPE(iao_env_type), INTENT(INOUT) :: iao_env
!iao
iao_env%do_iao = .FALSE.
iao_env%eps_svd = 0.0_dp
iao_env%eps_occ = 0.0_dp
! charges
iao_env%do_charges = .FALSE.
! one-center expansion
iao_env%do_oce = .FALSE.
iao_env%lmax_oce = 3
iao_env%nbas_oce = 10
iao_env%append_oce = .FALSE.
! Bond orbitals
iao_env%do_bondorbitals = .FALSE.
! Wannier centers
iao_env%do_center = .FALSE.
iao_env%pos_periodic = .FALSE.
iao_env%loc_operator = do_iaoloc_pm2
iao_env%eloc_function = do_iaoloc_enone
iao_env%eloc_weight = 0.0_dp
! i/o
iao_env%molden_iao = .FALSE.
iao_env%molden_ibo = .FALSE.
iao_env%cubes_iao = .FALSE.
iao_env%cubes_ibo = .FALSE.
! Input sections
NULLIFY (iao_env%iao_cubes_section, iao_env%iao_molden_section)
NULLIFY (iao_env%ibo_cubes_section, iao_env%ibo_molden_section)
NULLIFY (iao_env%ibo_cc_section)
END SUBROUTINE iao_set_default
! **************************************************************************************************
! **************************************************************************************************
!> \brief ...
!> \param iao_env ...
!> \param iao_section ...
!> \param cell ...
! **************************************************************************************************
SUBROUTINE iao_read_input(iao_env, iao_section, cell)
TYPE(iao_env_type), INTENT(INOUT) :: iao_env
TYPE(section_vals_type), POINTER :: iao_section
TYPE(cell_type), OPTIONAL :: cell
LOGICAL :: explicit, iao_explicit
TYPE(section_vals_type), POINTER :: subsection
CALL iao_set_default(iao_env)
CALL section_vals_get(iao_section, explicit=iao_explicit)
IF (iao_explicit) THEN
iao_env%do_iao = .TRUE.
! input options
CALL section_vals_val_get(iao_section, "EPS_SVD", r_val=iao_env%eps_svd)
CALL section_vals_val_get(iao_section, "EPS_OCC", r_val=iao_env%eps_occ)
CALL section_vals_val_get(iao_section, "ATOMIC_CHARGES", l_val=iao_env%do_charges)
iao_env%iao_molden_section => section_vals_get_subs_vals(iao_section, "IAO_MOLDEN")
CALL section_vals_get(iao_env%iao_molden_section, explicit=iao_env%molden_iao)
iao_env%iao_cubes_section => section_vals_get_subs_vals(iao_section, "IAO_CUBES")
CALL section_vals_get(iao_env%iao_cubes_section, explicit=iao_env%cubes_iao)
subsection => section_vals_get_subs_vals(iao_section, "ONE_CENTER_EXPANSION")
CALL section_vals_get(subsection, explicit=iao_env%do_oce)
IF (iao_env%do_oce) THEN
subsection => section_vals_get_subs_vals(iao_section, "ONE_CENTER_EXPANSION")
CALL section_vals_val_get(subsection, "LMAX", i_val=iao_env%lmax_oce)
CALL section_vals_val_get(subsection, "NBAS", i_val=iao_env%nbas_oce)
CALL section_vals_val_get(subsection, "APPEND", l_val=iao_env%append_oce)
END IF
subsection => section_vals_get_subs_vals(iao_section, "BOND_ORBITALS")
CALL section_vals_get(subsection, explicit=iao_env%do_bondorbitals)
IF (iao_env%do_bondorbitals) THEN
subsection => section_vals_get_subs_vals(iao_section, "BOND_ORBITALS")
CALL section_vals_val_get(subsection, "LOCALIZATION_OPERATOR", i_val=iao_env%loc_operator)
CALL section_vals_val_get(subsection, "ENERGY_LOCALIZATION_FUNCTION", i_val=iao_env%eloc_function)
CALL section_vals_val_get(subsection, "ENERGY_LOCALIZATION_WEIGHT", r_val=iao_env%eloc_weight)
iao_env%ibo_molden_section => section_vals_get_subs_vals(subsection, "IBO_MOLDEN")
CALL section_vals_get(iao_env%ibo_molden_section, explicit=iao_env%molden_ibo)
iao_env%ibo_cubes_section => section_vals_get_subs_vals(subsection, "IBO_CUBES")
CALL section_vals_get(iao_env%ibo_cubes_section, explicit=iao_env%cubes_ibo)
iao_env%ibo_cc_section => section_vals_get_subs_vals(subsection, "CHARGE_CENTER")
CALL section_vals_get(iao_env%ibo_cc_section, explicit=iao_env%do_center)
IF (iao_env%do_center) THEN
CALL section_vals_val_get(iao_env%ibo_cc_section, "POSITION_OPERATOR_BERRY", &
l_val=iao_env%pos_periodic, explicit=explicit)
IF (.NOT. explicit) THEN
! set default according to cell periodicity
iao_env%pos_periodic = .TRUE.
IF (PRESENT(cell)) THEN
IF (ALL(cell%perd == 0)) iao_env%pos_periodic = .FALSE.
END IF
END IF
END IF
END IF
END IF
END SUBROUTINE iao_read_input
! **************************************************************************************************
END MODULE iao_types