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, sirius_object_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'
80 cpassert(.NOT.
ASSOCIATED(section))
82 description=
"DFT calculation using plane waves basis can be set in this section. "// &
83 "The backend called SIRIUS, computes the basic properties of the system, "// &
84 "such as ground state, forces and stresses tensors which can be used by "// &
85 "cp2k afterwards. The engine has all these features build-in, support of "// &
86 "pseudo-potentials and full-potentials, spin-orbit coupling, collinear and "// &
87 "non collinear magnetism, Hubbard correction, all exchange functionals "// &
88 "supported by libxc and Van der Waals corrections (libvdwxc).")
92 name=
'ignore_convergence_failure', &
93 description=
"when set to true, calculation will continue irrespectively "// &
94 "of the convergence status of SIRIUS", &
97 default_l_val=.false., &
98 lone_keyword_l_val=.true.)
103 CALL create_sirius_section(subsection,
'control')
107 CALL create_sirius_section(subsection,
'parameters')
111 CALL create_sirius_section(subsection,
'settings')
115 CALL create_sirius_section(subsection,
'mixer')
119 CALL create_sirius_section(subsection,
'iterative_solver')
126#if defined(__SIRIUS_NLCG)
127 CALL create_sirius_section(subsection,
'nlcg')
132#if defined(__SIRIUS_VCSQNM)
133 CALL create_sirius_section(subsection,
'vcsqnm')
138#if defined(__SIRIUS_DFTD4)
139 CALL create_sirius_section(subsection,
"dftd4")
143 CALL create_sirius_section(subsection,
"dftd3")
148 CALL create_print_section(subsection)
160 SUBROUTINE create_sirius_section(section, section_name)
162 CHARACTER(len=*),
INTENT(in) :: section_name
166 cpassert(.NOT.
ASSOCIATED(section))
167 CALL sirius_option_get_section_length(trim(adjustl(section_name)), length)
170 name=trim(adjustl(section_name)), &
171 description=trim(section_name)//
" section", &
176 CALL fill_in_section(section, trim(adjustl(section_name)))
177 END SUBROUTINE create_sirius_section
184 SUBROUTINE fill_in_section(section, section_name)
186 CHARACTER(len=*),
INTENT(in) :: section_name
188 CHARACTER(len=128) :: name
189 CHARACTER(len=128),
TARGET :: possible_values(1:256)
190 CHARACTER(len=4096) :: description, usage
191 INTEGER :: ctype, enum_length, i, j, length, &
193 INTEGER,
ALLOCATABLE,
DIMENSION(:),
TARGET :: enum_i_val, ivec
194 INTEGER,
TARGET :: dummy_i
195 LOGICAL :: jump_dft_parameters, lvecl(1:16)
196 LOGICAL(4),
ALLOCATABLE,
DIMENSION(:),
TARGET :: lvec
197 LOGICAL(4),
TARGET :: dummy_l
198 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:),
TARGET :: rvec
199 REAL(kind=
dp),
TARGET :: dummy_r
202 ALLOCATE (ivec(1:16))
203 ALLOCATE (rvec(1:16))
204 ALLOCATE (lvec(1:16))
205 ALLOCATE (enum_i_val(1:256))
206 jump_dft_parameters = .false.
208 IF (section_name ==
"parameters")
THEN
210 CALL keyword_create(keyword, __location__, name=
"VDW_FUNCTIONAL", &
211 description=
"Select the Van der Walls functionals corrections type", &
214 enum_c_vals=
s2a(
"NONE",
"FUNC_VDWDF",
"FUNC_VDWDF2",
"FUNC_VDWDFCX"), &
215 enum_desc=
s2a(
"No VdW correction", &
224 CALL sirius_option_get_section_length(section_name, length)
231 CALL sirius_option_get_info(section_name, &
236 num_possible_values, &
245 name = trim(adjustl(name))
247#if defined(__SIRIUS_DFTD4)
249 IF (((section_name ==
'dftd3') .OR. (section_name ==
'dftd4')) .AND. (name ==
'parameters'))
THEN
259 IF ((name /=
'xc_functionals') .AND. (name /=
'memory_usage') .AND. (name /=
'vk'))
THEN
262 CASE (sirius_integer_type)
263 CALL sirius_option_get(section_name, name, ctype, c_loc(dummy_i))
266 description=trim(adjustl(description)), &
270 default_i_val=dummy_i)
273 CASE (sirius_number_type)
274 CALL sirius_option_get(section_name, name, ctype, c_loc(dummy_r))
277 description=trim(adjustl(description)), &
281 default_r_val=dummy_r)
284 CASE (sirius_logical_type)
286 CALL sirius_option_get(section_name, name, ctype, c_loc(dummy_l))
290 description=trim(adjustl(description)), &
294 default_l_val=.true., &
295 lone_keyword_l_val=.true.)
299 description=trim(adjustl(description)), &
303 default_l_val=.false., &
304 lone_keyword_l_val=.true.)
308 CASE (sirius_string_type)
309 IF (enum_length >= 1)
THEN
310 DO j = 1, enum_length
311 possible_values(j) =
''
312 CALL sirius_option_get(section_name, name, ctype, c_loc(possible_values(j)), max_length=128, enum_idx=j)
314 possible_values(j) = trim(adjustl(possible_values(j)))
317 IF (enum_length > 1)
THEN
320 description=trim(adjustl(description)), &
323 enum_i_vals=enum_i_val(1:enum_length), &
324 enum_c_vals=possible_values(1:enum_length), &
329 description=trim(adjustl(description)), &
332 default_c_val=possible_values(1), &
338 description=trim(adjustl(description)), &
346 CASE (sirius_integer_array_type)
347 CALL sirius_option_get(section_name, name, ctype, c_loc(ivec(1)), max_length=16)
349 IF (num_possible_values == 0)
THEN
352 description=trim(adjustl(description)), &
359 description=trim(adjustl(description)), &
362 n_var=num_possible_values, &
363 default_i_vals=ivec(1:num_possible_values))
367 CASE (sirius_logical_array_type)
368 CALL sirius_option_get(section_name, name, ctype, c_loc(lvec(1)), max_length=16)
369 DO j = 1, num_possible_values
372 IF (num_possible_values > 0)
THEN
375 description=trim(adjustl(description)), &
379 n_var=num_possible_values, &
380 default_l_vals=lvecl(1:num_possible_values))
384 description=trim(adjustl(description)), &
392 CASE (sirius_number_array_type)
393 CALL sirius_option_get(section_name, name, ctype, c_loc(rvec(1)), max_length=16)
395 IF (num_possible_values == 0)
THEN
398 description=trim(adjustl(description)), &
406 description=trim(adjustl(description)), &
410 n_var=num_possible_values, &
411 default_r_vals=rvec(1:num_possible_values))
427 DEALLOCATE (enum_i_val)
428 END SUBROUTINE fill_in_section
435 SUBROUTINE create_print_section(section)
440 cpassert(.NOT.
ASSOCIATED(section))
442 description=
"Section of possible print options in PW_DFT code.", &
443 n_keywords=0, n_subsections=1, repeats=.false.)
446 CALL create_dos_section(print_key)
450 END SUBROUTINE create_print_section
456 SUBROUTINE create_dos_section(print_key)
465 description=
"Print Density of States (DOS) (only available states from SCF)", &
469 description=
"Append the DOS obtained at different iterations to the output file. "// &
470 "By default the file is overwritten", &
471 usage=
"APPEND", default_l_val=.false., &
472 lone_keyword_l_val=.true.)
477 description=
"Histogramm energy spacing.", &
478 usage=
"DELTA_E 0.0005", type_of_var=
real_t, default_r_val=0.001_dp)
482 END SUBROUTINE create_dos_section
492 cpassert(.NOT.
ASSOCIATED(section))
495 description=
"This section contains all information to run an "// &
496 "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.