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_DFTD3)
139 CALL create_sirius_section(subsection,
"dftd3")
144#if defined(__SIRIUS_DFTD4)
145 CALL create_sirius_section(subsection,
"dftd4")
150 CALL create_print_section(subsection)
162 SUBROUTINE create_sirius_section(section, section_name)
164 CHARACTER(len=*),
INTENT(in) :: section_name
168 cpassert(.NOT.
ASSOCIATED(section))
169 CALL sirius_option_get_section_length(trim(adjustl(section_name)), length)
172 name=trim(adjustl(section_name)), &
173 description=trim(section_name)//
" section", &
178 CALL fill_in_section(section, trim(adjustl(section_name)))
179 END SUBROUTINE create_sirius_section
186 SUBROUTINE fill_in_section(section, section_name)
188 CHARACTER(len=*),
INTENT(in) :: section_name
190 CHARACTER(len=128) :: name
191 CHARACTER(len=128),
TARGET :: possible_values(1:256)
192 CHARACTER(len=4096) :: description, usage
193 INTEGER :: ctype, enum_length, i, j, length, &
195 INTEGER,
ALLOCATABLE,
DIMENSION(:),
TARGET :: enum_i_val, ivec
196 INTEGER,
TARGET :: dummy_i
197 LOGICAL :: jump_dft_parameters, lvecl(1:16)
198 LOGICAL(4),
ALLOCATABLE,
DIMENSION(:),
TARGET :: lvec
199 LOGICAL(4),
TARGET :: dummy_l
200 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:),
TARGET :: rvec
201 REAL(kind=
dp),
TARGET :: dummy_r
204 ALLOCATE (ivec(1:16))
205 ALLOCATE (rvec(1:16))
206 ALLOCATE (lvec(1:16))
207 ALLOCATE (enum_i_val(1:256))
208 jump_dft_parameters = .false.
210 IF (section_name ==
"parameters")
THEN
212 CALL keyword_create(keyword, __location__, name=
"VDW_FUNCTIONAL", &
213 description=
"Select the Van der Walls functionals corrections type", &
216 enum_c_vals=
s2a(
"NONE",
"FUNC_VDWDF",
"FUNC_VDWDF2",
"FUNC_VDWDFCX"), &
217 enum_desc=
s2a(
"No VdW correction", &
226 CALL sirius_option_get_section_length(section_name, length)
233 CALL sirius_option_get_info(section_name, &
238 num_possible_values, &
247 name = trim(adjustl(name))
249#if defined(__SIRIUS_DFTD3)
250 IF ((section_name ==
'dftd3') .AND. (name ==
'parameters'))
THEN
254#if defined(__SIRIUS_DFTD4)
256 IF ((section_name ==
'dftd4') .AND. (name ==
'parameters'))
THEN
266 IF ((name /=
'xc_functionals') .AND. (name /=
'memory_usage') .AND. (name /=
'vk'))
THEN
269 CASE (sirius_integer_type)
270 CALL sirius_option_get(section_name, name, ctype, c_loc(dummy_i))
273 description=trim(adjustl(description)), &
277 default_i_val=dummy_i)
280 CASE (sirius_number_type)
281 CALL sirius_option_get(section_name, name, ctype, c_loc(dummy_r))
284 description=trim(adjustl(description)), &
288 default_r_val=dummy_r)
291 CASE (sirius_logical_type)
293 CALL sirius_option_get(section_name, name, ctype, c_loc(dummy_l))
297 description=trim(adjustl(description)), &
301 default_l_val=.true., &
302 lone_keyword_l_val=.true.)
306 description=trim(adjustl(description)), &
310 default_l_val=.false., &
311 lone_keyword_l_val=.true.)
315 CASE (sirius_string_type)
316 IF (enum_length >= 1)
THEN
317 DO j = 1, enum_length
318 possible_values(j) =
''
319 CALL sirius_option_get(section_name, name, ctype, c_loc(possible_values(j)), max_length=128, enum_idx=j)
321 possible_values(j) = trim(adjustl(possible_values(j)))
324 IF (enum_length > 1)
THEN
327 description=trim(adjustl(description)), &
330 enum_i_vals=enum_i_val(1:enum_length), &
331 enum_c_vals=possible_values(1:enum_length), &
336 description=trim(adjustl(description)), &
339 default_c_val=possible_values(1), &
345 description=trim(adjustl(description)), &
353 CASE (sirius_integer_array_type)
354 CALL sirius_option_get(section_name, name, ctype, c_loc(ivec(1)), max_length=16)
356 IF (num_possible_values == 0)
THEN
359 description=trim(adjustl(description)), &
366 description=trim(adjustl(description)), &
369 n_var=num_possible_values, &
370 default_i_vals=ivec(1:num_possible_values))
374 CASE (sirius_logical_array_type)
375 CALL sirius_option_get(section_name, name, ctype, c_loc(lvec(1)), max_length=16)
376 DO j = 1, num_possible_values
379 IF (num_possible_values > 0)
THEN
382 description=trim(adjustl(description)), &
386 n_var=num_possible_values, &
387 default_l_vals=lvecl(1:num_possible_values))
391 description=trim(adjustl(description)), &
399 CASE (sirius_number_array_type)
400 CALL sirius_option_get(section_name, name, ctype, c_loc(rvec(1)), max_length=16)
402 IF (num_possible_values == 0)
THEN
405 description=trim(adjustl(description)), &
413 description=trim(adjustl(description)), &
417 n_var=num_possible_values, &
418 default_r_vals=rvec(1:num_possible_values))
434 DEALLOCATE (enum_i_val)
435 END SUBROUTINE fill_in_section
442 SUBROUTINE create_print_section(section)
447 cpassert(.NOT.
ASSOCIATED(section))
449 description=
"Section of possible print options in PW_DFT code.", &
450 n_keywords=0, n_subsections=1, repeats=.false.)
453 CALL create_dos_section(print_key)
457 END SUBROUTINE create_print_section
463 SUBROUTINE create_dos_section(print_key)
472 description=
"Print Density of States (DOS) (only available states from SCF)", &
476 description=
"Append the DOS obtained at different iterations to the output file. "// &
477 "By default the file is overwritten", &
478 usage=
"APPEND", default_l_val=.false., &
479 lone_keyword_l_val=.true.)
484 description=
"Histogramm energy spacing.", &
485 usage=
"DELTA_E 0.0005", type_of_var=
real_t, default_r_val=0.001_dp)
489 END SUBROUTINE create_dos_section
499 cpassert(.NOT.
ASSOCIATED(section))
502 description=
"This section contains all information to run an "// &
503 "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.