17 USE iso_c_binding,
ONLY: c_loc
20 sirius_option_get_section_length, sirius_option_get_info, &
21 sirius_integer_type, sirius_number_type, sirius_string_type, &
22 sirius_logical_type, sirius_array_type, sirius_integer_array_type, sirius_logical_array_type, &
23 sirius_number_array_type, sirius_string_array_type, string_f2c
47 #include "./base/base_uses.f90"
52 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .true.
53 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'input_cp2k_pwdft'
73 TYPE(section_type),
POINTER :: section
75 TYPE(section_type),
POINTER :: subsection
79 cpassert(.NOT.
ASSOCIATED(section))
81 description=
"DFT calculation using plane waves basis can be set in this section. "// &
82 "The backend called SIRIUS, computes the basic properties of the system, "// &
83 "such as ground state, forces and stresses tensors which can be used by "// &
84 "cp2k afterwards. The engine has all these features build-in, support of "// &
85 "pseudo-potentials and full-potentials, spin-orbit coupling, collinear and "// &
86 "non collinear magnetism, Hubbard correction, all exchange functionals "// &
87 "supported by libxc and Van der Waals corrections (libvdwxc).")
90 CALL create_sirius_section(subsection,
'control')
94 CALL create_sirius_section(subsection,
'parameters')
98 CALL create_sirius_section(subsection,
'settings')
102 CALL create_sirius_section(subsection,
'mixer')
106 CALL create_sirius_section(subsection,
'iterative_solver')
118 CALL create_print_section(subsection)
130 SUBROUTINE create_sirius_section(section, section_name)
131 TYPE(section_type),
POINTER :: section
132 CHARACTER(len=*),
INTENT(in) :: section_name
136 cpassert(.NOT.
ASSOCIATED(section))
137 CALL sirius_option_get_section_length(trim(adjustl(section_name)), length)
140 name=trim(adjustl(section_name)), &
141 description=trim(section_name)//
" section", &
146 CALL fill_in_section(section, trim(adjustl(section_name)))
147 END SUBROUTINE create_sirius_section
154 SUBROUTINE fill_in_section(section, section_name)
155 TYPE(section_type),
POINTER :: section
156 CHARACTER(len=*),
INTENT(in) :: section_name
158 CHARACTER(len=128) :: name
159 CHARACTER(len=128),
TARGET :: possible_values(1:16)
160 CHARACTER(len=4096) :: description, usage
161 INTEGER :: ctype, enum_i_val(1:16), enum_length, i, &
162 j, length, num_possible_values
163 INTEGER,
ALLOCATABLE,
DIMENSION(:),
TARGET :: ivec
164 INTEGER,
TARGET :: dummy_i
165 LOGICAL :: lvecl(1:16)
166 LOGICAL(4),
ALLOCATABLE,
DIMENSION(:),
TARGET :: lvec
167 LOGICAL(4),
TARGET :: dummy_l
168 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:),
TARGET :: rvec
169 REAL(kind=
dp),
TARGET :: dummy_r
170 TYPE(keyword_type),
POINTER :: keyword
172 ALLOCATE (ivec(1:16))
173 ALLOCATE (rvec(1:16))
174 ALLOCATE (lvec(1:16))
177 IF (section_name ==
"parameters")
THEN
179 CALL keyword_create(keyword, __location__, name=
"VDW_FUNCTIONAL", &
180 description=
"Select the Van der Walls functionals corrections type", &
183 enum_c_vals=s2a(
"NONE",
"FUNC_VDWDF",
"FUNC_VDWDF2",
"FUNC_VDWDFCX"), &
184 enum_desc=s2a(
"No VdW correction", &
193 CALL sirius_option_get_section_length(section_name, length)
200 CALL sirius_option_get_info(section_name, &
205 num_possible_values, &
214 name = trim(adjustl(name))
220 IF ((name /=
'xc_functionals') .AND. (name /=
'memory_usage') .AND. (name /=
'vk'))
THEN
223 CASE (sirius_integer_type)
224 CALL sirius_option_get(section_name, name, ctype, c_loc(dummy_i))
227 description=trim(adjustl(description)), &
231 default_i_val=dummy_i)
234 CASE (sirius_number_type)
235 CALL sirius_option_get(section_name, name, ctype, c_loc(dummy_r))
238 description=trim(adjustl(description)), &
242 default_r_val=dummy_r)
245 CASE (sirius_logical_type)
247 CALL sirius_option_get(section_name, name, ctype, c_loc(dummy_l))
251 description=trim(adjustl(description)), &
255 default_l_val=.true., &
256 lone_keyword_l_val=.true.)
260 description=trim(adjustl(description)), &
264 default_l_val=.false., &
265 lone_keyword_l_val=.true.)
269 CASE (sirius_string_type)
270 IF (enum_length >= 1)
THEN
271 DO j = 1, enum_length
272 possible_values(j) =
''
273 CALL sirius_option_get(section_name, name, ctype, c_loc(possible_values(j)), max_length=128, enum_idx=j)
275 possible_values(j) = trim(adjustl(possible_values(j)))
278 IF (enum_length > 1)
THEN
281 description=trim(adjustl(description)), &
284 enum_i_vals=enum_i_val(1:enum_length), &
285 enum_c_vals=possible_values(1:enum_length), &
290 description=trim(adjustl(description)), &
293 default_c_val=possible_values(1), &
299 description=trim(adjustl(description)), &
307 CASE (sirius_integer_array_type)
308 CALL sirius_option_get(section_name, name, ctype, c_loc(ivec(1)), max_length=16)
310 IF (num_possible_values .EQ. 0)
THEN
313 description=trim(adjustl(description)), &
320 description=trim(adjustl(description)), &
323 n_var=num_possible_values, &
324 default_i_vals=ivec(1:num_possible_values))
328 CASE (sirius_logical_array_type)
329 CALL sirius_option_get(section_name, name, ctype, c_loc(lvec(1)), max_length=16)
330 DO j = 1, num_possible_values
333 IF (num_possible_values > 0)
THEN
336 description=trim(adjustl(description)), &
340 n_var=num_possible_values, &
341 default_l_vals=lvecl(1:num_possible_values))
345 description=trim(adjustl(description)), &
353 CASE (sirius_number_array_type)
354 CALL sirius_option_get(section_name, name, ctype, c_loc(rvec(1)), max_length=16)
356 IF (num_possible_values .EQ. 0)
THEN
359 description=trim(adjustl(description)), &
367 description=trim(adjustl(description)), &
371 n_var=num_possible_values, &
372 default_r_vals=rvec(1:num_possible_values))
380 END SUBROUTINE fill_in_section
387 SUBROUTINE create_print_section(section)
388 TYPE(section_type),
POINTER :: section
390 TYPE(section_type),
POINTER :: print_key
392 cpassert(.NOT.
ASSOCIATED(section))
394 description=
"Section of possible print options in PW_DFT code.", &
395 n_keywords=0, n_subsections=1, repeats=.false.)
398 CALL create_dos_section(print_key)
402 END SUBROUTINE create_print_section
408 SUBROUTINE create_dos_section(print_key)
410 TYPE(section_type),
POINTER :: print_key
412 TYPE(keyword_type),
POINTER :: keyword
417 description=
"Print Density of States (DOS) (only available states from SCF)", &
421 description=
"Append the DOS obtained at different iterations to the output file. "// &
422 "By default the file is overwritten", &
423 usage=
"APPEND", default_l_val=.false., &
424 lone_keyword_l_val=.true.)
429 description=
"Histogramm energy spacing.", &
430 usage=
"DELTA_E 0.0005", type_of_var=
real_t, default_r_val=0.001_dp)
434 END SUBROUTINE create_dos_section
442 TYPE(section_type),
POINTER :: section
444 cpassert(.NOT.
ASSOCIATED(section))
447 description=
"This section contains all information to run an "// &
448 "SIRIUS PW calculation.", &
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer, parameter, public debug_print_level
integer, parameter, public low_print_level
integer, parameter, public medium_print_level
integer, parameter, public high_print_level
integer, parameter, public add_last_numeric
integer, parameter, public silent_print_level
subroutine, public cp_print_key_section_create(print_key_section, location, name, description, print_level, each_iter_names, each_iter_values, add_last, filename, common_iter_levels, citations, unit_str)
creates a print_key section
Defines the basic variable types.
integer, parameter, public dp
Utilities for string manipulations.