-
Notifications
You must be signed in to change notification settings - Fork 1
/
input_cp2k_kpoints.F
209 lines (184 loc) · 10.6 KB
/
input_cp2k_kpoints.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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
!--------------------------------------------------------------------------------------------------!
! 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 function that build the kpoints section of the input
!> \par History
!> init [07.2014]
!> \author JGH
! **************************************************************************************************
MODULE input_cp2k_kpoints
USE bibliography, ONLY: MacDonald1978,&
Monkhorst1976
USE input_keyword_types, ONLY: keyword_create,&
keyword_release,&
keyword_type
USE input_section_types, ONLY: section_add_keyword,&
section_create,&
section_type
USE input_val_types, ONLY: char_t,&
real_t
USE kinds, ONLY: default_path_length,&
dp
USE string_utilities, ONLY: newline,&
s2a
#include "./base/base_uses.f90"
IMPLICIT NONE
PRIVATE
CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_kpoints'
INTEGER, PARAMETER :: use_real_wfn = 101, &
use_complex_wfn = 100
PUBLIC :: create_kpoints_section
PUBLIC :: create_kpoint_set_section
PUBLIC :: use_real_wfn, use_complex_wfn
CONTAINS
! **************************************************************************************************
!> \brief Creates the Kpoints section
!> SECTION: &kpoint... &end
!> SCHEME [None, Gamma, Monkhorst-Pack, MacDonald, General]
!> { nx ny nz }
!> { nx ny nz sx sy sz }
!> KPOINT x1 y1 z1 w1
!> SYMMETRY [on, off]
!> WAVEFUNCTION [real, complex]
!> FULL_GRID [on, off]
!> VERBOSE [on, off]
!> EPS_GEO value
!> PARALLEL_GROUP_SIZE [-1,0,n]
!>
!> \param section the section to create
!> \author JGH
! **************************************************************************************************
SUBROUTINE create_kpoints_section(section)
TYPE(section_type), POINTER :: section
TYPE(keyword_type), POINTER :: keyword
CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, __LOCATION__, name="KPOINTS", &
description="Sets up the kpoints.", &
n_keywords=1, n_subsections=0, repeats=.FALSE.)
NULLIFY (keyword)
CALL keyword_create(keyword, __LOCATION__, name="SCHEME", &
description="Kpoint scheme to be used. Available options are:"//newline// &
"- `NONE`"//newline// &
"- `GAMMA`"//newline// &
"- `MONKHORST-PACK`"//newline// &
"- `MACDONALD`"//newline// &
"- `GENERAL`"//newline// &
newline// &
"For `MONKHORST-PACK` and `MACDONALD` the number of k points in all "// &
"3 dimensions has to be supplied along with the keyword. "// &
"E.g. `MONKHORST-PACK 12 12 8`", &
usage="SCHEME {KPMETHOD} {integer} {integer} ..", &
citations=(/Monkhorst1976, MacDonald1978/), &
n_var=-1, type_of_var=char_t)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="KPOINT", &
description="Specify kpoint coordinates and weight. ", &
usage="KPOINT x y z w", repeats=.TRUE., &
n_var=4, type_of_var=real_t)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="UNITS", &
description="Special k-points are defined either in units"// &
" of reciprocal lattice vectors or in Cartesian coordinates in uints of 2Pi/len."// &
" B_VECTOR: in multiples of the reciprocal lattice vectors (b)."// &
" CART_ANGSTROM: In units of 2*Pi/Angstrom."// &
" CART_BOHR: In units of 2*Pi/Bohr.", &
usage="UNITS <value>", type_of_var=char_t, default_c_val="B_VECTOR")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="SYMMETRY", &
description="Use symmetry to reduce the number of kpoints.", &
usage="SYMMETRY <LOGICAL>", &
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="FULL_GRID", &
description="Use full non-reduced kpoint grid.", &
usage="FULL_GRID <LOGICAL>", &
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="VERBOSE", &
description="Verbose output information.", &
usage="VERBOSE <LOGICAL>", &
default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="EPS_GEO", &
description="Accuracy in symmetry determination.", &
usage="EPS_GEO <real>", &
default_r_val=1.0e-6_dp)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="PARALLEL_GROUP_SIZE", &
description="Number of processors to be used for a single kpoint."// &
" This number must divide the total number of processes."// &
" The number of groups must divide the total number of kpoints."// &
" Value=-1 (smallest possible number of processes per group, satisfying the constraints)."// &
" Value=0 (all processes)."// &
" Value=n (exactly n processes).", &
usage="PARALLEL_GROUP_SIZE <integer>", &
default_i_val=-1)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
CALL keyword_create(keyword, __LOCATION__, name="WAVEFUNCTIONS", &
description="Use real/complex wavefunctions if possible.", &
usage="WAVEFUNCTIONS REAL", &
default_i_val=use_complex_wfn, &
enum_c_vals=s2a("REAL", "COMPLEX"), &
enum_desc=s2a("Use real wavefunctions (if possible by kpoints specified).", &
"Use complex wavefunctions (default)."), &
enum_i_vals=(/use_real_wfn, use_complex_wfn/))
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
END SUBROUTINE create_kpoints_section
! **************************************************************************************************
!> \brief ...
!> \param section ...
!> \param section_name ...
!> \author JGH
! **************************************************************************************************
SUBROUTINE create_kpoint_set_section(section, section_name)
TYPE(section_type), POINTER :: section
CHARACTER(LEN=*), OPTIONAL :: section_name
CHARACTER(len=default_path_length) :: my_section_name
TYPE(keyword_type), POINTER :: keyword
IF (PRESENT(section_name)) THEN
my_section_name = section_name
ELSE
my_section_name = "KPOINT_SET"
END IF
CPASSERT(.NOT. ASSOCIATED(section))
CALL section_create(section, __LOCATION__, name=my_section_name, &
description="Specifies a k-point line to be calculated.", &
n_keywords=0, n_subsections=0, repeats=.TRUE.)
! keywords
NULLIFY (keyword)
CALL keyword_create(keyword, __LOCATION__, name="SPECIAL_POINT", &
description="Name and coordinates of a special k-point", &
usage="SPECIAL_POINT GAMMA 0.0 0.0 0.0", n_var=-1, type_of_var=char_t, repeats=.TRUE.)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
!
CALL keyword_create(keyword, __LOCATION__, name="NPOINTS", &
description="Number of k-points along the line.", &
default_i_val=0)
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
!
CALL keyword_create(keyword, __LOCATION__, name="UNITS", &
description="Special k-points are defined either in units"// &
" of reciprocal lattice vectors or in Cartesian coordinates in uints of 2Pi/len."// &
" B_VECTOR: in multiples of the reciprocal lattice vectors (b)."// &
" CART_ANGSTROM: In units of 2*Pi/Angstrom."// &
" CART_BOHR: In units of 2*Pi/Bohr.", &
usage="UNITS <value>", type_of_var=char_t, default_c_val="B_VECTOR")
CALL section_add_keyword(section, keyword)
CALL keyword_release(keyword)
END SUBROUTINE create_kpoint_set_section
END MODULE input_cp2k_kpoints