Line data Source code
1 : !--------------------------------------------------------------------------------------------------!
2 : ! CP2K: A general program to perform molecular dynamics simulations !
3 : ! Copyright 2000-2024 CP2K developers group <https://cp2k.org> !
4 : ! !
5 : ! SPDX-License-Identifier: GPL-2.0-or-later !
6 : !--------------------------------------------------------------------------------------------------!
7 :
8 : ! **************************************************************************************************
9 : !> \brief checks the input and perform some automatic "magic" on it
10 : !> \par History
11 : !> 01.2006 created [fawzi]
12 : !> \author fawzi
13 : ! **************************************************************************************************
14 : MODULE input_cp2k_check
15 : USE cp_log_handling, ONLY: cp_to_string
16 : USE cp_parser_types, ONLY: cp_parser_type,&
17 : parser_create,&
18 : parser_release
19 : USE cp_units, ONLY: cp_unit_set_create,&
20 : cp_unit_set_release,&
21 : cp_unit_set_type
22 : USE input_constants, ONLY: &
23 : do_region_global, do_thermo_al, do_thermo_csvr, do_thermo_gle, do_thermo_nose, &
24 : do_thermo_same_as_part, negf_run, npt_f_ensemble, npt_i_ensemble, npt_ia_ensemble, &
25 : vdw_nl_LMKLL, xc_funct_b3lyp, xc_funct_beefvdw, xc_funct_blyp, xc_funct_bp, &
26 : xc_funct_hcth120, xc_funct_no_shortcut, xc_funct_olyp, xc_funct_pade, xc_funct_pbe, &
27 : xc_funct_pbe0, xc_funct_tpss, xc_funct_xwpbe, xc_none, xc_vdw_fun_nonloc
28 : USE input_keyword_types, ONLY: keyword_type
29 : USE input_parsing, ONLY: section_vals_parse
30 : USE input_section_types, ONLY: &
31 : section_type, section_vals_create, section_vals_get, section_vals_get_subs_vals, &
32 : section_vals_get_subs_vals2, section_vals_get_subs_vals3, section_vals_release, &
33 : section_vals_remove_values, section_vals_set_subs_vals, section_vals_type, &
34 : section_vals_val_get, section_vals_val_set, section_vals_val_unset
35 : USE input_val_types, ONLY: logical_t
36 : USE kinds, ONLY: default_path_length,&
37 : default_string_length,&
38 : dp
39 : USE memory_utilities, ONLY: reallocate
40 : USE message_passing, ONLY: mp_para_env_type
41 : USE xc_input_constants, ONLY: do_vwn5
42 : #include "./base/base_uses.f90"
43 :
44 : IMPLICIT NONE
45 : PRIVATE
46 :
47 : LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .TRUE.
48 : CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_check'
49 :
50 : PUBLIC :: check_cp2k_input, xc_functionals_expand, remove_restart_info
51 :
52 : CONTAINS
53 :
54 : ! **************************************************************************************************
55 : !> \brief performs further checks on an input that parsed successfully
56 : !> \param input_declaration ...
57 : !> \param input_file the parsed input
58 : !> \param para_env ...
59 : !> \param output_unit ...
60 : !> \author fawzi
61 : !> \note
62 : !> at the moment does nothing
63 : ! **************************************************************************************************
64 69020 : SUBROUTINE check_cp2k_input(input_declaration, input_file, para_env, output_unit)
65 : TYPE(section_type), POINTER :: input_declaration
66 : TYPE(section_vals_type), POINTER :: input_file
67 : TYPE(mp_para_env_type), POINTER :: para_env
68 : INTEGER, INTENT(IN), OPTIONAL :: output_unit
69 :
70 : CHARACTER(len=*), PARAMETER :: routineN = 'check_cp2k_input'
71 :
72 : INTEGER :: handle, iforce_eval, nforce_eval, &
73 : run_type
74 : LOGICAL :: explicit, explicit_embed, explicit_mix
75 : TYPE(section_vals_type), POINTER :: section, section1, section2, section3, &
76 : section4, sections
77 :
78 17255 : CALL timeset(routineN, handle)
79 17255 : CPASSERT(ASSOCIATED(input_file))
80 17255 : CPASSERT(input_file%ref_count > 0)
81 : ! ext_restart
82 17255 : IF (PRESENT(output_unit)) &
83 17255 : CALL handle_ext_restart(input_declaration, input_file, para_env, output_unit)
84 :
85 : ! checks on force_eval section
86 17255 : sections => section_vals_get_subs_vals(input_file, "FORCE_EVAL")
87 17255 : CALL section_vals_get(sections, n_repetition=nforce_eval)
88 :
89 : ! multiple force_eval only if present RESPA, or MIXED or EMBED calculation is performed
90 17255 : section2 => section_vals_get_subs_vals(input_file, "MOTION%MD%RESPA")
91 17255 : CALL section_vals_get(section2, explicit=explicit)
92 33962 : DO iforce_eval = 1, nforce_eval
93 : section3 => section_vals_get_subs_vals(sections, "MIXED", &
94 16961 : i_rep_section=iforce_eval)
95 16961 : CALL section_vals_get(section3, explicit=explicit_mix)
96 33962 : IF (explicit_mix) EXIT
97 : END DO
98 34540 : DO iforce_eval = 1, nforce_eval
99 : section4 => section_vals_get_subs_vals(sections, "EMBED", &
100 17333 : i_rep_section=iforce_eval)
101 17333 : CALL section_vals_get(section4, explicit=explicit_embed)
102 34540 : IF (explicit_embed) EXIT
103 : END DO
104 : ! also allow multiple force_eval for NEGF run
105 17255 : CALL section_vals_val_get(input_file, "GLOBAL%RUN_TYPE", i_val=run_type)
106 :
107 17255 : IF (((explicit .AND. (nforce_eval == 1)) .OR. (.NOT. explicit .AND. (nforce_eval > 1))) .AND. run_type /= negf_run) THEN
108 302 : IF ((explicit_mix .AND. (nforce_eval == 1)) .OR. (.NOT. explicit_mix .AND. (nforce_eval > 1))) THEN
109 48 : IF ((explicit_embed .AND. (nforce_eval == 1)) .OR. (.NOT. explicit_embed .AND. (nforce_eval > 1))) THEN
110 : CALL cp_abort(__LOCATION__, &
111 : "Error multiple force_env without RESPA or MIXED or EMBED, or RESPA with one single "// &
112 0 : "or MIXED with only two force_env section.")
113 : END IF
114 : END IF
115 : END IF
116 34780 : DO iforce_eval = 1, nforce_eval
117 17525 : section => section_vals_get_subs_vals3(sections, "DFT", i_rep_section=iforce_eval)
118 : ! xc: expand and fix default for tddfpt
119 17525 : section1 => section_vals_get_subs_vals(section, "XC")
120 17525 : section2 => section_vals_get_subs_vals(section, "XC%XC_FUNCTIONAL")
121 17525 : CALL xc_functionals_expand(section2, section1)
122 17525 : section1 => section_vals_get_subs_vals(section, "XAS_TDP%KERNEL")
123 17525 : section2 => section_vals_get_subs_vals(section, "XAS_TDP%KERNEL%XC_FUNCTIONAL")
124 17525 : CALL xc_functionals_expand(section2, section1)
125 17525 : section1 => section_vals_get_subs_vals(section, "TDDFPT%XC")
126 17525 : section2 => section_vals_get_subs_vals(section, "TDDFPT%XC%XC_FUNCTIONAL")
127 17525 : CALL section_vals_get(section2, explicit=explicit)
128 34780 : IF (explicit) THEN
129 5038 : CALL xc_functionals_expand(section2, section1)
130 : ELSE
131 12487 : section2 => section_vals_get_subs_vals(section, "XC%XC_FUNCTIONAL")
132 12487 : CALL section_vals_set_subs_vals(section, "TDDFPT%XC%XC_FUNCTIONAL", section2)
133 : END IF
134 : END DO
135 :
136 17255 : CALL timestop(handle)
137 17255 : END SUBROUTINE check_cp2k_input
138 :
139 : ! **************************************************************************************************
140 : !> \brief expand a shortcutted functional section
141 : !> \param functionals the functional section to expand
142 : !> \param xc_section ...
143 : !> \author fawzi
144 : ! **************************************************************************************************
145 42292 : SUBROUTINE xc_functionals_expand(functionals, xc_section)
146 : TYPE(section_vals_type), POINTER :: functionals, xc_section
147 :
148 : CHARACTER(LEN=512) :: wrn_msg
149 : INTEGER :: ifun, nfun, shortcut
150 : TYPE(section_vals_type), POINTER :: xc_fun
151 :
152 : CALL section_vals_val_get(functionals, "_SECTION_PARAMETERS_", &
153 42292 : i_val=shortcut)
154 :
155 42292 : ifun = 0
156 42292 : nfun = 0
157 13319 : DO
158 55611 : ifun = ifun + 1
159 55611 : xc_fun => section_vals_get_subs_vals2(functionals, i_section=ifun)
160 55611 : IF (.NOT. ASSOCIATED(xc_fun)) EXIT
161 13319 : nfun = nfun + 1
162 : END DO
163 : !
164 42292 : IF (shortcut /= xc_funct_no_shortcut .AND. shortcut /= xc_none .AND. nfun > 0) THEN
165 : WRITE (wrn_msg, '(A)') "User requested a shortcut while defining an explicit XC functional. "// &
166 98 : "This is not recommended as it could lead to spurious behaviour. Please check input parameters."
167 98 : CPWARN(wrn_msg)
168 : END IF
169 :
170 238 : SELECT CASE (shortcut)
171 : CASE (xc_funct_no_shortcut, xc_none)
172 : ! nothing to expand
173 : CASE (xc_funct_pbe0)
174 : CALL section_vals_val_set(functionals, "PBE%_SECTION_PARAMETERS_", &
175 238 : l_val=.TRUE.)
176 : CALL section_vals_val_set(functionals, "PBE%SCALE_X", &
177 238 : r_val=0.75_dp)
178 : CALL section_vals_val_set(functionals, "PBE%SCALE_C", &
179 238 : r_val=1.0_dp)
180 : ! Hartree Fock Exact Exchange
181 : CALL section_vals_val_set(xc_section, "HF%FRACTION", &
182 238 : r_val=0.25_dp)
183 : CALL section_vals_val_set(functionals, "_SECTION_PARAMETERS_", &
184 238 : i_val=xc_funct_no_shortcut)
185 : CASE (xc_funct_beefvdw)
186 : CALL section_vals_val_set(functionals, "PBE%_SECTION_PARAMETERS_", & !40% PBEc
187 2 : l_val=.TRUE.)
188 : CALL section_vals_val_set(functionals, "PBE%SCALE_C", &
189 2 : r_val=0.3998335231_dp)
190 : CALL section_vals_val_set(functionals, "PBE%SCALE_X", & !no PBEx
191 2 : r_val=0.0000000000_dp)
192 :
193 : !PW92 correlation functional from libxc is required.
194 : !The cp2k-native PW92 gives disagreeing results (in the 0.01E_H
195 : !decimal) and yields inconsistent forces in a DEBUG run.
196 : !(rk, 6.3.2014)
197 : CALL section_vals_val_set(functionals, "LDA_C_PW%_SECTION_PARAMETERS_", & !60%LDA
198 2 : l_val=.TRUE.)
199 : CALL section_vals_val_set(functionals, "LDA_C_PW%SCALE", &
200 2 : r_val=0.6001664769_dp)
201 :
202 : CALL section_vals_val_set(functionals, "BEEF%_SECTION_PARAMETERS_", & !BEEF exchange
203 2 : l_val=.TRUE.)
204 :
205 : !NONLOCAL, LMKLL.
206 : CALL section_vals_val_set(xc_section, "VDW_POTENTIAL%DISPERSION_FUNCTIONAL", &
207 2 : i_val=xc_vdw_fun_nonloc)
208 : CALL section_vals_val_set(xc_section, "VDW_POTENTIAL%NON_LOCAL%TYPE", &
209 2 : i_val=vdw_nl_LMKLL)
210 : CALL section_vals_val_set(functionals, "_SECTION_PARAMETERS_", &
211 2 : i_val=xc_funct_no_shortcut)
212 : CASE (xc_funct_b3lyp)
213 : CALL section_vals_val_set(functionals, "BECKE88%_SECTION_PARAMETERS_", &
214 24 : l_val=.TRUE.)
215 : CALL section_vals_val_set(functionals, "BECKE88%SCALE_X", &
216 24 : r_val=0.72_dp)
217 : CALL section_vals_val_set(functionals, "LYP%_SECTION_PARAMETERS_", &
218 24 : l_val=.TRUE.)
219 : CALL section_vals_val_set(functionals, "LYP%SCALE_C", &
220 24 : r_val=0.81_dp)
221 : CALL section_vals_val_set(functionals, "VWN%_SECTION_PARAMETERS_", &
222 24 : l_val=.TRUE.)
223 : CALL section_vals_val_set(functionals, "VWN%FUNCTIONAL_TYPE", &
224 24 : i_val=do_vwn5)
225 : CALL section_vals_val_set(functionals, "VWN%SCALE_C", &
226 24 : r_val=0.19_dp)
227 : CALL section_vals_val_set(functionals, "XALPHA%_SECTION_PARAMETERS_", &
228 24 : l_val=.TRUE.)
229 : CALL section_vals_val_set(functionals, "XALPHA%SCALE_X", &
230 24 : r_val=0.08_dp)
231 : ! Hartree Fock Exact Exchange
232 : CALL section_vals_val_set(xc_section, "HF%FRACTION", &
233 24 : r_val=0.20_dp)
234 : CALL section_vals_val_set(functionals, "_SECTION_PARAMETERS_", &
235 24 : i_val=xc_funct_no_shortcut)
236 : CASE (xc_funct_blyp)
237 : CALL section_vals_val_set(functionals, "BECKE88%_SECTION_PARAMETERS_", &
238 428 : l_val=.TRUE.)
239 : CALL section_vals_val_set(functionals, "LYP%_SECTION_PARAMETERS_", &
240 428 : l_val=.TRUE.)
241 : CALL section_vals_val_set(functionals, "_SECTION_PARAMETERS_", &
242 428 : i_val=xc_funct_no_shortcut)
243 : CASE (xc_funct_bp)
244 : CALL section_vals_val_set(functionals, "BECKE88%_SECTION_PARAMETERS_", &
245 2 : l_val=.TRUE.)
246 : CALL section_vals_val_set(functionals, "P86C%_SECTION_PARAMETERS_", &
247 2 : l_val=.TRUE.)
248 : CALL section_vals_val_set(functionals, "_SECTION_PARAMETERS_", &
249 2 : i_val=xc_funct_no_shortcut)
250 : CASE (xc_funct_pade)
251 : CALL section_vals_val_set(functionals, "PADE%_SECTION_PARAMETERS_", &
252 1925 : l_val=.TRUE.)
253 : CALL section_vals_val_set(functionals, "_SECTION_PARAMETERS_", &
254 1925 : i_val=xc_funct_no_shortcut)
255 : CASE (xc_funct_pbe)
256 : CALL section_vals_val_set(functionals, "PBE%_SECTION_PARAMETERS_", &
257 1664 : l_val=.TRUE.)
258 : CALL section_vals_val_set(functionals, "_SECTION_PARAMETERS_", &
259 1664 : i_val=xc_funct_no_shortcut)
260 : CASE (xc_funct_xwpbe)
261 : CALL section_vals_val_set(functionals, "XWPBE%_SECTION_PARAMETERS_", &
262 0 : l_val=.TRUE.)
263 : CALL section_vals_val_set(functionals, "_SECTION_PARAMETERS_", &
264 0 : i_val=xc_funct_no_shortcut)
265 : CASE (xc_funct_tpss)
266 : CALL section_vals_val_set(functionals, "TPSS%_SECTION_PARAMETERS_", &
267 40 : l_val=.TRUE.)
268 : CALL section_vals_val_set(functionals, "_SECTION_PARAMETERS_", &
269 40 : i_val=xc_funct_no_shortcut)
270 : CASE (xc_funct_olyp)
271 : CALL section_vals_val_set(functionals, "OPTX%_SECTION_PARAMETERS_", &
272 6 : l_val=.TRUE.)
273 : CALL section_vals_val_set(functionals, "LYP%_SECTION_PARAMETERS_", &
274 6 : l_val=.TRUE.)
275 : CALL section_vals_val_set(functionals, "_SECTION_PARAMETERS_", &
276 6 : i_val=xc_funct_no_shortcut)
277 : CASE (xc_funct_hcth120)
278 : CALL section_vals_val_set(functionals, "HCTH%_SECTION_PARAMETERS_", &
279 14 : l_val=.TRUE.)
280 : CALL section_vals_val_set(functionals, "HCTH%PARAMETER_SET", &
281 14 : i_val=120)
282 : CALL section_vals_val_set(functionals, "_SECTION_PARAMETERS_", &
283 14 : i_val=xc_funct_no_shortcut)
284 : CASE default
285 42292 : CPABORT("unknown shortcut "//TRIM(ADJUSTL(cp_to_string(shortcut))))
286 : END SELECT
287 42292 : END SUBROUTINE xc_functionals_expand
288 :
289 : ! **************************************************************************************************
290 : !> \brief Replaces the requested sections in the input with those found
291 : !> in the external restart (EXT_RESTART%RESTART_FILE_NAME).
292 : !> \param input_declaration ...
293 : !> \param input_file the input file to initialize
294 : !> \param para_env ...
295 : !> \param output_unit ...
296 : !> \author fawzi
297 : ! **************************************************************************************************
298 17255 : SUBROUTINE handle_ext_restart(input_declaration, input_file, para_env, output_unit)
299 : TYPE(section_type), POINTER :: input_declaration
300 : TYPE(section_vals_type), POINTER :: input_file
301 : TYPE(mp_para_env_type), POINTER :: para_env
302 : INTEGER, INTENT(IN) :: output_unit
303 :
304 : CHARACTER(len=*), PARAMETER :: routineN = 'handle_ext_restart'
305 :
306 : CHARACTER(default_path_length) :: r_file_path
307 : INTEGER :: handle
308 : TYPE(section_vals_type), POINTER :: r_section
309 :
310 17255 : CALL timeset(routineN, handle)
311 : ! Handle restart file
312 17255 : r_section => section_vals_get_subs_vals(input_file, "EXT_RESTART")
313 17255 : CALL section_vals_val_get(r_section, "RESTART_FILE_NAME", c_val=r_file_path)
314 :
315 17255 : IF (r_file_path /= " ") THEN
316 : BLOCK
317 : CHARACTER(default_path_length) :: binary_restart_file
318 : CHARACTER(default_string_length) :: path
319 : CHARACTER(LEN=default_string_length), &
320 216 : DIMENSION(:), POINTER :: restarted_infos
321 : INTEGER :: ensemble, i_rep_val, &
322 : iforce_eval, myi, n_rep_val, &
323 : nforce_eval1, nforce_eval2
324 216 : INTEGER, DIMENSION(:), POINTER :: ivec, iwalkers_status, iwork, &
325 216 : rwalkers_status
326 : LOGICAL :: bsse_check, check, explicit1, explicit2, &
327 : flag, flag2, qmmm_check, subsys_check
328 : REAL(KIND=dp) :: myt
329 216 : REAL(KIND=dp), DIMENSION(:), POINTER :: vec, work
330 : TYPE(section_vals_type), POINTER :: rep_sections, restart_file, &
331 : section, section1, section2, &
332 : sections1, sections2
333 :
334 216 : NULLIFY (restarted_infos, iwalkers_status, rwalkers_status, vec, ivec, work, iwork)
335 216 : CALL section_vals_val_get(r_section, "BINARY_RESTART_FILE_NAME", c_val=binary_restart_file)
336 :
337 : BLOCK
338 : TYPE(cp_parser_type) :: cpparser
339 : TYPE(cp_unit_set_type) :: default_units
340 : ! parse the input
341 216 : NULLIFY (restart_file)
342 216 : CALL section_vals_create(restart_file, input_declaration)
343 216 : CALL parser_create(cpparser, file_name=r_file_path, para_env=para_env)
344 216 : CALL cp_unit_set_create(default_units, "OUTPUT")
345 : CALL section_vals_parse(restart_file, cpparser, root_section=.FALSE., &
346 216 : default_units=default_units)
347 216 : CALL cp_unit_set_release(default_units)
348 3024 : CALL parser_release(cpparser)
349 : END BLOCK
350 :
351 : ! Restart and input files same number of force_env sections
352 216 : sections1 => section_vals_get_subs_vals(restart_file, "FORCE_EVAL")
353 216 : CALL section_vals_get(sections1, n_repetition=nforce_eval1)
354 216 : sections2 => section_vals_get_subs_vals(input_file, "FORCE_EVAL")
355 216 : CALL section_vals_get(sections2, n_repetition=nforce_eval2)
356 216 : IF (nforce_eval1 /= nforce_eval2) THEN
357 0 : CPABORT("Restart and input file MUST have the number of force_env sections")
358 : END IF
359 : ! Handle default restarts
360 216 : CALL handle_defaults_restart(r_section)
361 :
362 : ! Real restart of force_evals
363 448 : DO iforce_eval = 1, nforce_eval1
364 : section1 => section_vals_get_subs_vals3(sections1, "SUBSYS", &
365 232 : i_rep_section=iforce_eval)
366 : section2 => section_vals_get_subs_vals3(sections2, "SUBSYS", &
367 232 : i_rep_section=iforce_eval)
368 : ! Some care needs to be handled when treating multiple force_eval
369 : ! Both subsys need to be consistently associated or not
370 : ! Mixed stuff will be rejected for safety reason..
371 232 : subsys_check = (ASSOCIATED(section1) .EQV. ASSOCIATED(section2))
372 232 : IF (subsys_check) THEN
373 232 : IF (ASSOCIATED(section1)) THEN
374 232 : CALL section_vals_val_get(r_section, "RESTART_CELL", l_val=flag)
375 232 : IF (flag) THEN
376 210 : section => section_vals_get_subs_vals(section1, "CELL")
377 210 : CALL section_vals_set_subs_vals(section2, "CELL", section)
378 210 : CALL set_restart_info("CELL", restarted_infos)
379 : END IF
380 :
381 232 : CALL section_vals_val_get(r_section, "RESTART_POS", l_val=flag)
382 232 : IF (flag) THEN
383 220 : section => section_vals_get_subs_vals(section1, "COORD")
384 220 : CALL section_vals_set_subs_vals(section2, "COORD", section)
385 220 : CALL set_restart_info("COORDINATES", restarted_infos)
386 : ! Copy over also the information on the multiple_unit_cell
387 220 : CALL section_vals_val_get(section1, "TOPOLOGY%MULTIPLE_UNIT_CELL", i_vals=ivec)
388 220 : ALLOCATE (iwork(3))
389 1540 : iwork = ivec
390 220 : CALL section_vals_val_set(section2, "TOPOLOGY%MULTIPLE_UNIT_CELL", i_vals_ptr=iwork)
391 : END IF
392 :
393 232 : CALL section_vals_val_get(r_section, "RESTART_RANDOMG", l_val=flag)
394 232 : IF (flag) THEN
395 200 : section => section_vals_get_subs_vals(section1, "RNG_INIT")
396 200 : CALL section_vals_set_subs_vals(section2, "RNG_INIT", section)
397 200 : CALL set_restart_info("RANDOM NUMBER GENERATOR", restarted_infos)
398 : END IF
399 :
400 232 : CALL section_vals_val_get(r_section, "RESTART_VEL", l_val=flag)
401 232 : IF (flag) THEN
402 214 : section => section_vals_get_subs_vals(section1, "VELOCITY")
403 214 : CALL section_vals_set_subs_vals(section2, "VELOCITY", section)
404 214 : CALL set_restart_info("VELOCITIES", restarted_infos)
405 : END IF
406 :
407 : ! Core-Shell information "restarted" only when strictly necessary
408 232 : CALL section_vals_val_get(r_section, "RESTART_SHELL_POS", l_val=flag)
409 232 : IF (flag) THEN
410 220 : section => section_vals_get_subs_vals(section1, "SHELL_COORD")
411 220 : CALL section_vals_set_subs_vals(section2, "SHELL_COORD", section)
412 220 : IF (check_restart(section1, section2, "SHELL_COORD")) &
413 32 : CALL set_restart_info("SHELL COORDINATES", restarted_infos)
414 : END IF
415 232 : CALL section_vals_val_get(r_section, "RESTART_CORE_POS", l_val=flag)
416 232 : IF (flag) THEN
417 220 : section => section_vals_get_subs_vals(section1, "CORE_COORD")
418 220 : CALL section_vals_set_subs_vals(section2, "CORE_COORD", section)
419 220 : IF (check_restart(section1, section2, "CORE_COORD")) &
420 32 : CALL set_restart_info("CORE COORDINATES", restarted_infos)
421 : END IF
422 232 : CALL section_vals_val_get(r_section, "RESTART_SHELL_VELOCITY", l_val=flag)
423 232 : IF (flag) THEN
424 220 : section => section_vals_get_subs_vals(section1, "SHELL_VELOCITY")
425 220 : CALL section_vals_set_subs_vals(section2, "SHELL_VELOCITY", section)
426 220 : IF (check_restart(section1, section2, "SHELL_VELOCITY")) &
427 24 : CALL set_restart_info("SHELL VELOCITIES", restarted_infos)
428 : END IF
429 232 : CALL section_vals_val_get(r_section, "RESTART_CORE_VELOCITY", l_val=flag)
430 232 : IF (flag) THEN
431 220 : section => section_vals_get_subs_vals(section1, "CORE_VELOCITY")
432 220 : CALL section_vals_set_subs_vals(section2, "CORE_VELOCITY", section)
433 220 : IF (check_restart(section1, section2, "CORE_VELOCITY")) &
434 24 : CALL set_restart_info("CORE VELOCITIES", restarted_infos)
435 : END IF
436 : END IF
437 : ELSE
438 : CALL cp_abort(__LOCATION__, &
439 : "Error while reading the restart file. Two force_eval have incompatible"// &
440 : " subsys.One of them has an allocated subsys while the other has not! Check your"// &
441 0 : " input file or whether the restart file is compatible with the input!")
442 : END IF
443 : ! QMMM restarts
444 232 : CALL section_vals_val_get(r_section, "RESTART_QMMM", l_val=flag)
445 232 : section1 => section_vals_get_subs_vals3(sections1, "QMMM", i_rep_section=iforce_eval)
446 232 : section2 => section_vals_get_subs_vals3(sections2, "QMMM", i_rep_section=iforce_eval)
447 232 : CALL section_vals_get(section1, explicit=explicit1)
448 232 : CALL section_vals_get(section2, explicit=explicit2)
449 232 : qmmm_check = (explicit1 .AND. explicit2)
450 232 : IF (flag .AND. qmmm_check) THEN
451 0 : CALL set_restart_info("QMMM TRANSLATION VECTOR", restarted_infos)
452 0 : CALL section_vals_val_get(section1, "INITIAL_TRANSLATION_VECTOR", r_vals=vec)
453 0 : ALLOCATE (work(3))
454 0 : work = vec
455 0 : CALL section_vals_val_set(section2, "INITIAL_TRANSLATION_VECTOR", r_vals_ptr=work)
456 : END IF
457 : ! BSSE restarts
458 232 : CALL section_vals_val_get(r_section, "RESTART_BSSE", l_val=flag)
459 232 : section1 => section_vals_get_subs_vals3(sections1, "BSSE", i_rep_section=iforce_eval)
460 232 : section2 => section_vals_get_subs_vals3(sections2, "BSSE", i_rep_section=iforce_eval)
461 232 : CALL section_vals_get(section1, explicit=explicit1)
462 232 : CALL section_vals_get(section2, explicit=explicit2)
463 232 : bsse_check = (explicit1 .AND. explicit2)
464 1376 : IF (flag .AND. bsse_check) THEN
465 2 : section => section_vals_get_subs_vals(section1, "FRAGMENT_ENERGIES")
466 2 : CALL section_vals_set_subs_vals(section2, "FRAGMENT_ENERGIES", section)
467 2 : CALL set_restart_info("BSSE FRAGMENT ENERGIES", restarted_infos)
468 : END IF
469 : END DO
470 :
471 216 : CALL section_vals_val_get(r_section, "RESTART_COUNTERS", l_val=flag)
472 216 : IF (flag) THEN
473 208 : IF (check_restart(input_file, restart_file, "MOTION%MD")) THEN
474 168 : CALL section_vals_val_get(restart_file, "MOTION%MD%STEP_START_VAL", i_val=myi)
475 168 : CALL section_vals_val_set(input_file, "MOTION%MD%STEP_START_VAL", i_val=myi)
476 168 : CALL section_vals_val_get(restart_file, "MOTION%MD%TIME_START_VAL", r_val=myt)
477 168 : CALL section_vals_val_set(input_file, "MOTION%MD%TIME_START_VAL", r_val=myt)
478 168 : CALL section_vals_val_get(restart_file, "MOTION%MD%ECONS_START_VAL", r_val=myt)
479 168 : CALL section_vals_val_set(input_file, "MOTION%MD%ECONS_START_VAL", r_val=myt)
480 168 : CALL set_restart_info("MD COUNTERS", restarted_infos)
481 : END IF
482 : !
483 208 : IF (check_restart(input_file, restart_file, "MOTION%GEO_OPT")) THEN
484 : ! GEO_OPT
485 18 : CALL section_vals_val_get(restart_file, "MOTION%GEO_OPT%STEP_START_VAL", i_val=myi)
486 18 : CALL section_vals_val_set(input_file, "MOTION%GEO_OPT%STEP_START_VAL", i_val=myi)
487 18 : CALL set_restart_info("GEO_OPT COUNTERS", restarted_infos)
488 : ! ROT_OPT
489 18 : IF (check_restart(input_file, restart_file, "MOTION%GEO_OPT%TRANSITION_STATE%DIMER%ROT_OPT")) THEN
490 : CALL section_vals_val_get(restart_file, "MOTION%GEO_OPT%TRANSITION_STATE%DIMER%ROT_OPT%STEP_START_VAL", &
491 2 : i_val=myi)
492 : CALL section_vals_val_set(input_file, "MOTION%GEO_OPT%TRANSITION_STATE%DIMER%ROT_OPT%STEP_START_VAL", &
493 2 : i_val=myi)
494 2 : CALL set_restart_info("ROT_OPT COUNTERS", restarted_infos)
495 : END IF
496 : END IF
497 : !
498 208 : IF (check_restart(input_file, restart_file, "MOTION%GEO_OPT")) THEN
499 : ! CELL_OPT
500 18 : CALL section_vals_val_get(restart_file, "MOTION%CELL_OPT%STEP_START_VAL", i_val=myi)
501 18 : CALL section_vals_val_set(input_file, "MOTION%CELL_OPT%STEP_START_VAL", i_val=myi)
502 18 : CALL set_restart_info("CELL_OPT COUNTERS", restarted_infos)
503 : END IF
504 : !
505 208 : IF (check_restart(input_file, restart_file, "OPTIMIZE_INPUT")) THEN
506 2 : CALL section_vals_val_get(restart_file, "OPTIMIZE_INPUT%ITER_START_VAL", i_val=myi)
507 2 : CALL section_vals_val_set(input_file, "OPTIMIZE_INPUT%ITER_START_VAL", i_val=myi)
508 2 : CALL set_restart_info("OPTIMIZE_INPUT ITERATION NUMBER", restarted_infos)
509 : END IF
510 : !
511 208 : IF (check_restart(input_file, restart_file, "MOTION%PINT")) THEN
512 : ! PINT
513 10 : CALL section_vals_val_get(restart_file, "MOTION%PINT%ITERATION", i_val=myi)
514 10 : CALL section_vals_val_set(input_file, "MOTION%PINT%ITERATION", i_val=myi)
515 10 : CALL set_restart_info("PINT ITERATION NUMBER", restarted_infos)
516 : END IF
517 : !
518 208 : CALL section_vals_val_get(r_section, "RESTART_METADYNAMICS", l_val=flag2)
519 208 : IF (flag2 .AND. check_restart(input_file, restart_file, "MOTION%FREE_ENERGY%METADYN")) THEN
520 : CALL section_vals_val_get(restart_file, &
521 12 : "MOTION%FREE_ENERGY%METADYN%STEP_START_VAL", i_val=myi)
522 : CALL section_vals_val_set(input_file, &
523 12 : "MOTION%FREE_ENERGY%METADYN%STEP_START_VAL", i_val=myi)
524 : CALL section_vals_val_get(restart_file, &
525 12 : "MOTION%FREE_ENERGY%METADYN%NHILLS_START_VAL", i_val=myi)
526 : CALL section_vals_val_set(input_file, &
527 12 : "MOTION%FREE_ENERGY%METADYN%NHILLS_START_VAL", i_val=myi)
528 : !RG Adaptive hills
529 : CALL section_vals_val_get(restart_file, &
530 12 : "MOTION%FREE_ENERGY%METADYN%OLD_HILL_NUMBER", i_val=myi)
531 : CALL section_vals_val_set(input_file, &
532 12 : "MOTION%FREE_ENERGY%METADYN%OLD_HILL_NUMBER", i_val=myi)
533 : CALL section_vals_val_get(restart_file, &
534 12 : "MOTION%FREE_ENERGY%METADYN%OLD_HILL_STEP", i_val=myi)
535 : CALL section_vals_val_set(input_file, &
536 12 : "MOTION%FREE_ENERGY%METADYN%OLD_HILL_STEP", i_val=myi)
537 : !RG Adaptive hills
538 12 : CALL set_restart_info("METADYNAMIC COUNTERS", restarted_infos)
539 : END IF
540 : END IF
541 :
542 216 : CALL section_vals_val_get(r_section, "RESTART_AVERAGES", l_val=flag)
543 216 : IF (flag) THEN
544 204 : IF (check_restart(input_file, restart_file, "MOTION%MD")) THEN
545 174 : rep_sections => section_vals_get_subs_vals(restart_file, "MOTION%MD%AVERAGES%RESTART_AVERAGES")
546 174 : CALL section_vals_set_subs_vals(input_file, "MOTION%MD%AVERAGES%RESTART_AVERAGES", rep_sections)
547 174 : CALL set_restart_info("MD AVERAGES", restarted_infos)
548 : END IF
549 : END IF
550 :
551 216 : CALL section_vals_val_get(r_section, "RESTART_BAND", l_val=flag)
552 216 : IF (flag .AND. check_restart(input_file, restart_file, "MOTION%BAND")) THEN
553 6 : rep_sections => section_vals_get_subs_vals(restart_file, "MOTION%BAND%REPLICA")
554 6 : CALL section_vals_set_subs_vals(input_file, "MOTION%BAND%REPLICA", rep_sections)
555 6 : CALL set_restart_info("BAND CALCULATION", restarted_infos)
556 : END IF
557 :
558 216 : CALL section_vals_val_get(r_section, "RESTART_OPTIMIZE_INPUT_VARIABLES", l_val=flag)
559 216 : IF (flag .AND. check_restart(input_file, restart_file, "OPTIMIZE_INPUT%VARIABLE")) THEN
560 2 : rep_sections => section_vals_get_subs_vals(restart_file, "OPTIMIZE_INPUT%VARIABLE")
561 2 : CALL section_vals_set_subs_vals(input_file, "OPTIMIZE_INPUT%VARIABLE", rep_sections)
562 2 : CALL set_restart_info("OPTIMIZE_INPUT: VARIABLES", restarted_infos)
563 : END IF
564 :
565 216 : CALL section_vals_val_get(r_section, "RESTART_BAROSTAT", l_val=flag)
566 216 : IF (flag .AND. check_restart(input_file, restart_file, "MOTION%MD%BAROSTAT")) THEN
567 : section => section_vals_get_subs_vals(restart_file, &
568 22 : "MOTION%MD%BAROSTAT%MASS")
569 : CALL section_vals_set_subs_vals(input_file, "MOTION%MD%BAROSTAT%MASS", &
570 22 : section)
571 : section => section_vals_get_subs_vals(restart_file, &
572 22 : "MOTION%MD%BAROSTAT%VELOCITY")
573 : CALL section_vals_set_subs_vals(input_file, "MOTION%MD%BAROSTAT%VELOCITY", &
574 22 : section)
575 22 : CALL set_restart_info("BAROSTAT", restarted_infos)
576 : END IF
577 :
578 216 : flag = check_restart(input_file, restart_file, "MOTION%MD")
579 216 : IF (flag) THEN
580 176 : CALL section_vals_val_get(input_file, "MOTION%MD%ENSEMBLE", i_val=ensemble)
581 176 : IF (ensemble == npt_i_ensemble .OR. ensemble == npt_f_ensemble .OR. ensemble == npt_ia_ensemble) THEN
582 32 : CALL section_vals_val_get(r_section, "RESTART_BAROSTAT_THERMOSTAT", l_val=flag)
583 32 : check = check_restart(input_file, restart_file, "MOTION%MD%BAROSTAT")
584 : CALL restart_thermostat(flag, input_file, restart_file, "MOTION%MD%BAROSTAT%THERMOSTAT", &
585 32 : check=check)
586 32 : IF (flag .AND. check) CALL set_restart_info("THERMOSTAT OF BAROSTAT", restarted_infos)
587 : END IF
588 : END IF
589 :
590 216 : check = check_restart(input_file, restart_file, "MOTION%MD%SHELL")
591 216 : IF (check) THEN
592 18 : CALL section_vals_val_get(r_section, "RESTART_SHELL_THERMOSTAT", l_val=flag)
593 18 : CALL restart_thermostat(flag, input_file, restart_file, "MOTION%MD%SHELL%THERMOSTAT")
594 18 : CALL set_restart_info("SHELL THERMOSTAT", restarted_infos)
595 : END IF
596 :
597 216 : CALL section_vals_val_get(r_section, "RESTART_THERMOSTAT", l_val=flag)
598 216 : CALL restart_thermostat(flag, input_file, restart_file, "MOTION%MD%THERMOSTAT")
599 216 : IF (flag) CALL set_restart_info("PARTICLE THERMOSTAT", restarted_infos)
600 :
601 216 : CALL section_vals_val_get(r_section, "RESTART_CONSTRAINT", l_val=flag)
602 216 : IF (flag .AND. check_restart(input_file, restart_file, "MOTION%CONSTRAINT")) THEN
603 38 : section => section_vals_get_subs_vals(restart_file, "MOTION%CONSTRAINT")
604 38 : CALL section_vals_set_subs_vals(input_file, "MOTION%CONSTRAINT", section)
605 38 : CALL set_restart_info("CONSTRAINTS/RESTRAINTS", restarted_infos)
606 : END IF
607 :
608 216 : CALL section_vals_val_get(r_section, "RESTART_METADYNAMICS", l_val=flag)
609 216 : IF (flag .AND. check_restart(input_file, restart_file, "MOTION%FREE_ENERGY%METADYN")) THEN
610 : section => section_vals_get_subs_vals(restart_file, &
611 12 : "MOTION%FREE_ENERGY%METADYN%SPAWNED_HILLS_POS")
612 : CALL section_vals_set_subs_vals(input_file, "MOTION%FREE_ENERGY%METADYN%SPAWNED_HILLS_POS", &
613 12 : section)
614 : section => section_vals_get_subs_vals(restart_file, &
615 12 : "MOTION%FREE_ENERGY%METADYN%SPAWNED_HILLS_SCALE")
616 : CALL section_vals_set_subs_vals(input_file, "MOTION%FREE_ENERGY%METADYN%SPAWNED_HILLS_SCALE", &
617 12 : section)
618 : section => section_vals_get_subs_vals(restart_file, &
619 12 : "MOTION%FREE_ENERGY%METADYN%SPAWNED_HILLS_HEIGHT")
620 : CALL section_vals_set_subs_vals(input_file, "MOTION%FREE_ENERGY%METADYN%SPAWNED_HILLS_HEIGHT", &
621 12 : section)
622 : section => section_vals_get_subs_vals(restart_file, &
623 12 : "MOTION%FREE_ENERGY%METADYN%SPAWNED_HILLS_INVDT")
624 : CALL section_vals_set_subs_vals(input_file, "MOTION%FREE_ENERGY%METADYN%SPAWNED_HILLS_INVDT", &
625 12 : section)
626 : ! Extended Lagrangian
627 : section => section_vals_get_subs_vals(restart_file, &
628 12 : "MOTION%FREE_ENERGY%METADYN%EXT_LAGRANGE_SS0")
629 : CALL section_vals_set_subs_vals(input_file, "MOTION%FREE_ENERGY%METADYN%EXT_LAGRANGE_SS0", &
630 12 : section)
631 : section => section_vals_get_subs_vals(restart_file, &
632 12 : "MOTION%FREE_ENERGY%METADYN%EXT_LAGRANGE_VVP")
633 : CALL section_vals_set_subs_vals(input_file, "MOTION%FREE_ENERGY%METADYN%EXT_LAGRANGE_VVP", &
634 12 : section)
635 : section => section_vals_get_subs_vals(restart_file, &
636 12 : "MOTION%FREE_ENERGY%METADYN%EXT_LAGRANGE_SS")
637 : CALL section_vals_set_subs_vals(input_file, "MOTION%FREE_ENERGY%METADYN%EXT_LAGRANGE_SS", &
638 12 : section)
639 : section => section_vals_get_subs_vals(restart_file, &
640 12 : "MOTION%FREE_ENERGY%METADYN%EXT_LAGRANGE_FS")
641 : CALL section_vals_set_subs_vals(input_file, "MOTION%FREE_ENERGY%METADYN%EXT_LAGRANGE_FS", &
642 12 : section)
643 12 : CALL set_restart_info("METADYNAMICS", restarted_infos)
644 : END IF
645 :
646 216 : CALL section_vals_val_get(r_section, "RESTART_TEMPERATURE_ANNEALING", l_val=flag)
647 216 : IF (flag .AND. check_restart(input_file, restart_file, "MOTION%MD")) THEN
648 2 : CALL section_vals_val_get(input_file, "MOTION%MD%TEMPERATURE_ANNEALING", r_val=myt, explicit=explicit1)
649 2 : IF ((.NOT. explicit1) .OR. (ABS(1._dp - myt) <= 1.E-10_dp)) THEN
650 : CALL cp_warn(__LOCATION__, &
651 : "I'm about to override the input temperature "// &
652 : "with the temperature found in external restart "// &
653 0 : "but TEMPERATURE_ANNEALING isn't explicitly given or it is set to 1.")
654 : END IF
655 2 : CALL section_vals_val_get(restart_file, "MOTION%MD%TEMPERATURE", r_val=myt, explicit=explicit1)
656 2 : IF (explicit1) THEN
657 2 : CALL section_vals_val_get(input_file, "MOTION%MD%TEMPERATURE", r_val=myt)
658 : ELSE
659 : CALL cp_warn(__LOCATION__, &
660 : "I'm not going to override the input temperature "// &
661 0 : "since the temperature isn't explicitly given in the external restart.")
662 : END IF
663 : END IF
664 :
665 216 : CALL section_vals_val_get(r_section, "RESTART_WALKERS", l_val=flag)
666 216 : IF (flag .AND. check_restart(input_file, restart_file, "MOTION%FREE_ENERGY%METADYN%MULTIPLE_WALKERS")) THEN
667 : CALL section_vals_val_get(restart_file, "MOTION%FREE_ENERGY%METADYN%MULTIPLE_WALKERS%WALKERS_STATUS", &
668 4 : i_vals=rwalkers_status)
669 12 : ALLOCATE (iwalkers_status(SIZE(rwalkers_status)))
670 20 : iwalkers_status = rwalkers_status
671 : CALL section_vals_val_set(input_file, "MOTION%FREE_ENERGY%METADYN%MULTIPLE_WALKERS%WALKERS_STATUS", &
672 4 : i_vals_ptr=iwalkers_status)
673 4 : CALL set_restart_info("WALKERS INFO", restarted_infos)
674 : END IF
675 :
676 216 : CALL section_vals_val_get(r_section, "RESTART_DIMER", l_val=flag)
677 216 : IF (flag .AND. check_restart(input_file, restart_file, "MOTION%GEO_OPT%TRANSITION_STATE%DIMER")) THEN
678 : section => section_vals_get_subs_vals(restart_file, &
679 2 : "MOTION%GEO_OPT%TRANSITION_STATE%DIMER%DIMER_VECTOR")
680 : CALL section_vals_set_subs_vals(input_file, "MOTION%GEO_OPT%TRANSITION_STATE%DIMER%DIMER_VECTOR", &
681 2 : section)
682 2 : CALL set_restart_info("DIMER TRANSITION STATE SEARCH", restarted_infos)
683 : END IF
684 :
685 216 : CALL section_vals_val_get(r_section, "CUSTOM_PATH", n_rep_val=n_rep_val)
686 216 : DO i_rep_val = 1, n_rep_val
687 0 : CALL section_vals_val_get(r_section, "CUSTOM_PATH", i_rep_val=i_rep_val, c_val=path)
688 216 : IF (path /= " ") THEN
689 0 : section => section_vals_get_subs_vals(restart_file, path)
690 0 : CALL section_vals_set_subs_vals(input_file, path, section)
691 0 : CALL set_restart_info("USER RESTART: "//TRIM(path), restarted_infos)
692 : END IF
693 : END DO
694 :
695 216 : CALL section_vals_val_get(r_section, "RESTART_RTP", l_val=flag)
696 : ! IF(flag.AND.check_restart(input_file, restart_file, "FORCE_EVAL%DFT%REAL_TIME_PROPAGATION")) THEN
697 216 : IF (flag) THEN
698 : section => section_vals_get_subs_vals(restart_file, &
699 204 : "FORCE_EVAL%DFT%REAL_TIME_PROPAGATION")
700 204 : CALL section_vals_val_get(section, "INITIAL_WFN", i_val=myi)
701 : CALL section_vals_val_set(input_file, "FORCE_EVAL%DFT%REAL_TIME_PROPAGATION%INITIAL_WFN", &
702 204 : i_val=myi)
703 204 : CALL set_restart_info("REAL TIME PROPAGATION", restarted_infos)
704 : END IF
705 :
706 : ! PIMD
707 216 : CALL section_vals_val_get(r_section, "RESTART_PINT_POS", l_val=flag)
708 216 : IF (flag) THEN
709 210 : section => section_vals_get_subs_vals(restart_file, "MOTION%PINT%BEADS%COORD")
710 210 : CALL section_vals_set_subs_vals(input_file, "MOTION%PINT%BEADS%COORD", section)
711 210 : CALL set_restart_info("PINT BEAD POSITIONS", restarted_infos)
712 : END IF
713 216 : CALL section_vals_val_get(r_section, "RESTART_PINT_VEL", l_val=flag)
714 216 : IF (flag) THEN
715 210 : section => section_vals_get_subs_vals(restart_file, "MOTION%PINT%BEADS%VELOCITY")
716 210 : CALL section_vals_set_subs_vals(input_file, "MOTION%PINT%BEADS%VELOCITY", section)
717 210 : CALL set_restart_info("PINT BEAD VELOCITIES", restarted_infos)
718 : END IF
719 216 : CALL section_vals_val_get(r_section, "RESTART_PINT_NOSE", l_val=flag)
720 216 : IF (flag) THEN
721 210 : section => section_vals_get_subs_vals(restart_file, "MOTION%PINT%NOSE%COORD")
722 210 : CALL section_vals_set_subs_vals(input_file, "MOTION%PINT%NOSE%COORD", section)
723 210 : section => section_vals_get_subs_vals(restart_file, "MOTION%PINT%NOSE%VELOCITY")
724 210 : CALL section_vals_set_subs_vals(input_file, "MOTION%PINT%NOSE%VELOCITY", section)
725 210 : CALL set_restart_info("PINT NOSE THERMOSTAT", restarted_infos)
726 : END IF
727 216 : CALL section_vals_val_get(r_section, "RESTART_PINT_GLE", l_val=flag)
728 216 : IF (flag) THEN
729 204 : section => section_vals_get_subs_vals(restart_file, "MOTION%PINT%GLE")
730 204 : CALL section_vals_set_subs_vals(input_file, "MOTION%PINT%GLE", section)
731 204 : CALL set_restart_info("PINT GLE THERMOSTAT", restarted_infos)
732 : END IF
733 :
734 : ! PIMC
735 : !
736 216 : CALL section_vals_val_get(r_section, "RESTART_HELIUM_POS", l_val=flag)
737 216 : IF (flag) THEN
738 : CALL section_vals_val_get(input_file, "MOTION%PINT%HELIUM%NUM_ENV", &
739 210 : explicit=explicit1)
740 210 : IF (.NOT. explicit1) THEN
741 204 : CALL section_vals_val_get(restart_file, "MOTION%PINT%HELIUM%NUM_ENV", i_val=myi)
742 204 : CALL section_vals_val_set(input_file, "MOTION%PINT%HELIUM%NUM_ENV", i_val=myi)
743 : END IF
744 210 : section => section_vals_get_subs_vals(restart_file, "MOTION%PINT%HELIUM%COORD")
745 210 : CALL section_vals_set_subs_vals(input_file, "MOTION%PINT%HELIUM%COORD", section)
746 210 : CALL set_restart_info("HELIUM BEAD POSITIONS", restarted_infos)
747 : END IF
748 : !
749 216 : CALL section_vals_val_get(r_section, "RESTART_HELIUM_PERMUTATION", l_val=flag)
750 216 : IF (flag) THEN
751 : CALL section_vals_val_get(input_file, "MOTION%PINT%HELIUM%NUM_ENV", &
752 210 : explicit=explicit1)
753 210 : IF (.NOT. explicit1) THEN
754 0 : CALL section_vals_val_get(restart_file, "MOTION%PINT%HELIUM%NUM_ENV", i_val=myi)
755 0 : CALL section_vals_val_set(input_file, "MOTION%PINT%HELIUM%NUM_ENV", i_val=myi)
756 : END IF
757 210 : section => section_vals_get_subs_vals(restart_file, "MOTION%PINT%HELIUM%PERM")
758 210 : CALL section_vals_set_subs_vals(input_file, "MOTION%PINT%HELIUM%PERM", section)
759 210 : CALL set_restart_info("HELIUM PERMUTATION STATE", restarted_infos)
760 : END IF
761 : !
762 216 : CALL section_vals_val_get(r_section, "RESTART_HELIUM_FORCE", l_val=flag)
763 216 : IF (flag) THEN
764 : CALL section_vals_val_get(input_file, "MOTION%PINT%HELIUM%NUM_ENV", &
765 206 : explicit=explicit1)
766 206 : IF (.NOT. explicit1) THEN
767 0 : CALL section_vals_val_get(restart_file, "MOTION%PINT%HELIUM%NUM_ENV", i_val=myi)
768 0 : CALL section_vals_val_set(input_file, "MOTION%PINT%HELIUM%NUM_ENV", i_val=myi)
769 : END IF
770 206 : section => section_vals_get_subs_vals(restart_file, "MOTION%PINT%HELIUM%FORCE")
771 206 : CALL section_vals_set_subs_vals(input_file, "MOTION%PINT%HELIUM%FORCE", section)
772 206 : CALL set_restart_info("HELIUM FORCES ON SOLUTE", restarted_infos)
773 : END IF
774 : !
775 216 : CALL section_vals_val_get(r_section, "RESTART_HELIUM_RNG", l_val=flag)
776 216 : IF (flag) THEN
777 : CALL section_vals_val_get(input_file, "MOTION%PINT%HELIUM%NUM_ENV", &
778 210 : explicit=explicit1)
779 210 : IF (.NOT. explicit1) THEN
780 0 : CALL section_vals_val_get(restart_file, "MOTION%PINT%HELIUM%NUM_ENV", i_val=myi)
781 0 : CALL section_vals_val_set(input_file, "MOTION%PINT%HELIUM%NUM_ENV", i_val=myi)
782 : END IF
783 210 : section => section_vals_get_subs_vals(restart_file, "MOTION%PINT%HELIUM%RNG_STATE")
784 210 : CALL section_vals_set_subs_vals(input_file, "MOTION%PINT%HELIUM%RNG_STATE", section)
785 210 : CALL set_restart_info("HELIUM RNG STATE", restarted_infos)
786 : END IF
787 : !
788 : !
789 216 : CALL section_vals_val_get(r_section, "RESTART_HELIUM_DENSITIES", l_val=flag)
790 216 : IF (flag) THEN
791 : CALL section_vals_val_get(input_file, "MOTION%PINT%HELIUM%NUM_ENV", &
792 0 : explicit=explicit1)
793 0 : IF (.NOT. explicit1) THEN
794 0 : CALL section_vals_val_get(restart_file, "MOTION%PINT%HELIUM%NUM_ENV", i_val=myi)
795 0 : CALL section_vals_val_set(input_file, "MOTION%PINT%HELIUM%NUM_ENV", i_val=myi)
796 : END IF
797 0 : section => section_vals_get_subs_vals(restart_file, "MOTION%PINT%HELIUM%RHO")
798 0 : CALL section_vals_set_subs_vals(input_file, "MOTION%PINT%HELIUM%RHO", section)
799 0 : CALL set_restart_info("HELIUM DENSITIES", restarted_infos)
800 : END IF
801 : !
802 216 : CALL section_vals_val_set(r_section, "RESTART_FILE_NAME", c_val=" ")
803 216 : CALL section_vals_release(restart_file)
804 : CALL release_restart_info(restarted_infos, r_file_path, binary_restart_file, &
805 5832 : output_unit)
806 : END BLOCK
807 : END IF
808 17255 : CALL timestop(handle)
809 17255 : END SUBROUTINE handle_ext_restart
810 :
811 : ! **************************************************************************************************
812 : !> \brief store information on the restarted quantities
813 : !> \param label ...
814 : !> \param restarted_infos ...
815 : !> \author Teodoro Laino [tlaino] 09.2008 - University of Zurich
816 : ! **************************************************************************************************
817 3550 : SUBROUTINE set_restart_info(label, restarted_infos)
818 :
819 : CHARACTER(LEN=*), INTENT(IN) :: label
820 : CHARACTER(LEN=default_string_length), &
821 : DIMENSION(:), POINTER :: restarted_infos
822 :
823 : INTEGER :: isize
824 :
825 3550 : isize = 0
826 3336 : IF (ASSOCIATED(restarted_infos)) isize = SIZE(restarted_infos)
827 3550 : isize = isize + 1
828 3550 : CALL reallocate(restarted_infos, 1, isize)
829 3550 : restarted_infos(isize) = TRIM(label)
830 :
831 3550 : END SUBROUTINE set_restart_info
832 :
833 : ! **************************************************************************************************
834 : !> \brief dumps on output the information on the information effectively restarted
835 : !> \param restarted_infos ...
836 : !> \param r_file_path ...
837 : !> \param binary_restart_file ...
838 : !> \param output_unit ...
839 : !> \author Teodoro Laino [tlaino] 09.2008 - University of Zurich
840 : ! **************************************************************************************************
841 216 : SUBROUTINE release_restart_info(restarted_infos, r_file_path, &
842 : binary_restart_file, output_unit)
843 : CHARACTER(LEN=default_string_length), &
844 : DIMENSION(:), POINTER :: restarted_infos
845 : CHARACTER(LEN=*), INTENT(IN) :: r_file_path, binary_restart_file
846 : INTEGER, INTENT(IN) :: output_unit
847 :
848 : INTEGER :: i, j
849 :
850 216 : IF (output_unit > 0 .AND. ASSOCIATED(restarted_infos)) THEN
851 107 : WRITE (output_unit, '(1X,79("*"))')
852 107 : WRITE (output_unit, '(1X,"*",T30,A,T80,"*")') " RESTART INFORMATION "
853 107 : WRITE (output_unit, '(1X,79("*"))')
854 107 : WRITE (output_unit, '(1X,"*",T80,"*")')
855 107 : i = 1
856 107 : WRITE (output_unit, '(1X,"*",A,T26,A,T80,"*")') " RESTART FILE NAME: ", &
857 214 : r_file_path(53*(i - 1) + 1:53*i)
858 107 : DO i = 2, CEILING(REAL(LEN_TRIM(r_file_path), KIND=dp)/53.0_dp)
859 107 : WRITE (output_unit, '(T1,1X,"*",T26,A,T80,"*")') r_file_path(53*(i - 1) + 1:53*i)
860 : END DO
861 107 : IF (LEN_TRIM(binary_restart_file) > 0) THEN
862 23 : i = 1
863 23 : WRITE (output_unit, '(1X,"*",A,T26,A,T80,"*")') " BINARY RESTART FILE: ", &
864 46 : binary_restart_file(53*(i - 1) + 1:53*i)
865 23 : DO i = 2, CEILING(REAL(LEN_TRIM(binary_restart_file), KIND=dp)/53.0_dp)
866 23 : WRITE (output_unit, '(T1,1X,"*",T26,A,T80,"*")') binary_restart_file(53*(i - 1) + 1:53*i)
867 : END DO
868 : END IF
869 107 : WRITE (output_unit, '(1X,"*",T80,"*")')
870 107 : WRITE (output_unit, '(1X,"*", A,T80,"*")') " RESTARTED QUANTITIES: "
871 1882 : DO j = 1, SIZE(restarted_infos)
872 3657 : DO i = 1, CEILING(REAL(LEN_TRIM(restarted_infos(j)), KIND=dp)/53.0_dp)
873 3550 : WRITE (output_unit, '(T1,1X,"*",T26,A,T80,"*")') restarted_infos(j) (53*(i - 1) + 1:53*i)
874 : END DO
875 : END DO
876 107 : WRITE (output_unit, '(1X,79("*"),/)')
877 : END IF
878 216 : IF (ASSOCIATED(restarted_infos)) THEN
879 214 : DEALLOCATE (restarted_infos)
880 : END IF
881 216 : END SUBROUTINE release_restart_info
882 :
883 : ! **************************************************************************************************
884 : !> \brief Possibly restart thermostats information
885 : !> \param flag ...
886 : !> \param input_file the input file to initialize
887 : !> \param restart_file ...
888 : !> \param path ...
889 : !> \param check ...
890 : !> \author Teodoro Laino [tlaino] 10.2007- University of Zurich
891 : ! **************************************************************************************************
892 266 : SUBROUTINE restart_thermostat(flag, input_file, restart_file, path, check)
893 : LOGICAL, INTENT(IN) :: flag
894 : TYPE(section_vals_type), POINTER :: input_file, restart_file
895 : CHARACTER(LEN=*), INTENT(IN) :: path
896 : LOGICAL, INTENT(IN), OPTIONAL :: check
897 :
898 : INTEGER :: input_region, input_type, &
899 : restart_region, restart_type
900 : LOGICAL :: check_loc, skip_other_checks
901 : TYPE(section_vals_type), POINTER :: section
902 :
903 266 : check_loc = check_restart(input_file, restart_file, TRIM(path))
904 266 : skip_other_checks = PRESENT(check)
905 266 : IF (skip_other_checks) check_loc = check
906 266 : IF (flag .AND. check_loc) THEN
907 : ! Let's check if the thermostat type is different otherwise it does not make any
908 : ! sense to do any kind of restart
909 134 : CALL section_vals_val_get(input_file, TRIM(path)//"%TYPE", i_val=input_type)
910 134 : CALL section_vals_val_get(restart_file, TRIM(path)//"%TYPE", i_val=restart_type)
911 :
912 134 : IF (input_type == do_thermo_same_as_part) THEN
913 18 : CALL section_vals_val_get(input_file, "MOTION%MD%THERMOSTAT%TYPE", i_val=input_type)
914 : END IF
915 :
916 134 : IF (skip_other_checks) THEN
917 20 : input_region = do_region_global
918 20 : restart_region = do_region_global
919 : ELSE
920 : ! Also the regions must be the same..
921 114 : CALL section_vals_val_get(input_file, TRIM(path)//"%REGION", i_val=input_region)
922 114 : CALL section_vals_val_get(restart_file, TRIM(path)//"%REGION", i_val=restart_region)
923 : END IF
924 :
925 134 : IF ((input_type == restart_type) .AND. (input_region == restart_region)) THEN
926 110 : SELECT CASE (input_type)
927 : CASE (do_thermo_nose)
928 110 : section => section_vals_get_subs_vals(restart_file, TRIM(path)//"%NOSE%COORD")
929 110 : CALL section_vals_set_subs_vals(input_file, TRIM(path)//"%NOSE%COORD", section)
930 :
931 110 : section => section_vals_get_subs_vals(restart_file, TRIM(path)//"%NOSE%VELOCITY")
932 110 : CALL section_vals_set_subs_vals(input_file, TRIM(path)//"%NOSE%VELOCITY", section)
933 :
934 110 : section => section_vals_get_subs_vals(restart_file, TRIM(path)//"%NOSE%MASS")
935 110 : CALL section_vals_set_subs_vals(input_file, TRIM(path)//"%NOSE%MASS", section)
936 :
937 110 : section => section_vals_get_subs_vals(restart_file, TRIM(path)//"%NOSE%FORCE")
938 110 : CALL section_vals_set_subs_vals(input_file, TRIM(path)//"%NOSE%FORCE", section)
939 : CASE (do_thermo_csvr)
940 22 : section => section_vals_get_subs_vals(restart_file, TRIM(path)//"%CSVR%THERMOSTAT_ENERGY")
941 22 : CALL section_vals_set_subs_vals(input_file, TRIM(path)//"%CSVR%THERMOSTAT_ENERGY", section)
942 22 : section => section_vals_get_subs_vals(restart_file, TRIM(path)//"%CSVR%RNG_INIT")
943 22 : CALL section_vals_set_subs_vals(input_file, TRIM(path)//"%CSVR%RNG_INIT", section)
944 : CASE (do_thermo_gle)
945 2 : section => section_vals_get_subs_vals(restart_file, TRIM(path)//"%GLE%THERMOSTAT_ENERGY")
946 2 : CALL section_vals_set_subs_vals(input_file, TRIM(path)//"%GLE%THERMOSTAT_ENERGY", section)
947 2 : section => section_vals_get_subs_vals(restart_file, TRIM(path)//"%GLE%RNG_INIT")
948 2 : CALL section_vals_set_subs_vals(input_file, TRIM(path)//"%GLE%RNG_INIT", section)
949 2 : section => section_vals_get_subs_vals(restart_file, TRIM(path)//"%GLE%S")
950 2 : CALL section_vals_set_subs_vals(input_file, TRIM(path)//"%GLE%S", section)
951 : CASE (do_thermo_al)
952 0 : section => section_vals_get_subs_vals(restart_file, TRIM(path)//"%AD_LANGEVIN%CHI")
953 0 : CALL section_vals_set_subs_vals(input_file, TRIM(path)//"%AD_LANGEVIN%CHI", section)
954 0 : section => section_vals_get_subs_vals(restart_file, TRIM(path)//"%AD_LANGEVIN%MASS")
955 134 : CALL section_vals_set_subs_vals(input_file, TRIM(path)//"%AD_LANGEVIN%MASS", section)
956 : END SELECT
957 : ELSE
958 0 : IF (input_type /= restart_type) &
959 : CALL cp_warn(__LOCATION__, &
960 : "Requested to restart thermostat: "//TRIM(path)//". The thermostat "// &
961 : "specified in the input file and the information present in the restart "// &
962 : "file do not match the same type of thermostat! Restarting is not possible! "// &
963 0 : "Thermostat will not be restarted! ")
964 0 : IF (input_region /= restart_region) &
965 : CALL cp_warn(__LOCATION__, &
966 : "Requested to restart thermostat: "//TRIM(path)//". The thermostat "// &
967 : "specified in the input file and the information present in the restart "// &
968 : "file do not match the same type of REGION! Restarting is not possible! "// &
969 0 : "Thermostat will not be restarted! ")
970 : END IF
971 : END IF
972 266 : END SUBROUTINE restart_thermostat
973 :
974 : ! **************************************************************************************************
975 : !> \brief Checks if there are the proper conditions to do a restart
976 : !> \param input_file the input file to initialize
977 : !> \param restart_file ...
978 : !> \param tag_section ...
979 : !> \return ...
980 : !> \author teo
981 : ! **************************************************************************************************
982 13440 : FUNCTION check_restart(input_file, restart_file, tag_section) RESULT(do_restart)
983 : TYPE(section_vals_type), POINTER :: input_file, restart_file
984 : CHARACTER(LEN=*), INTENT(IN) :: tag_section
985 : LOGICAL :: do_restart
986 :
987 : CHARACTER(len=*), PARAMETER :: routineN = 'check_restart'
988 :
989 : INTEGER :: handle
990 : LOGICAL :: explicit1, explicit2
991 : TYPE(section_vals_type), POINTER :: work_section
992 :
993 4480 : CALL timeset(routineN, handle)
994 4480 : NULLIFY (work_section)
995 4480 : work_section => section_vals_get_subs_vals(input_file, TRIM(tag_section))
996 4480 : CALL section_vals_get(work_section, explicit=explicit1)
997 4480 : work_section => section_vals_get_subs_vals(restart_file, TRIM(tag_section))
998 4480 : CALL section_vals_get(work_section, explicit=explicit2)
999 :
1000 4480 : do_restart = explicit1 .AND. explicit2
1001 4480 : CALL timestop(handle)
1002 4480 : END FUNCTION check_restart
1003 :
1004 : ! **************************************************************************************************
1005 : !> \brief Removes section used to restart a calculation from an
1006 : !> input file in memory
1007 : !> \param input_file the input file to initialize
1008 : !> \author teo
1009 : ! **************************************************************************************************
1010 7304 : SUBROUTINE remove_restart_info(input_file)
1011 : TYPE(section_vals_type), POINTER :: input_file
1012 :
1013 : CHARACTER(len=*), PARAMETER :: routineN = 'remove_restart_info'
1014 :
1015 : INTEGER :: handle, iforce_eval, nforce_eval1
1016 : LOGICAL :: explicit1
1017 : TYPE(section_vals_type), POINTER :: md_section, motion_section, section1, &
1018 : section_to_delete, sections1, &
1019 : work_section
1020 :
1021 1826 : CALL timeset(routineN, handle)
1022 :
1023 1826 : NULLIFY (work_section)
1024 1826 : section_to_delete => section_vals_get_subs_vals(input_file, "EXT_RESTART")
1025 1826 : CALL section_vals_remove_values(section_to_delete)
1026 1826 : sections1 => section_vals_get_subs_vals(input_file, "FORCE_EVAL")
1027 1826 : CALL section_vals_get(sections1, n_repetition=nforce_eval1)
1028 :
1029 3762 : DO iforce_eval = 1, nforce_eval1
1030 1936 : section1 => section_vals_get_subs_vals3(sections1, "SUBSYS", i_rep_section=iforce_eval)
1031 1936 : section_to_delete => section_vals_get_subs_vals(section1, "COORD")
1032 1936 : CALL section_vals_remove_values(section_to_delete)
1033 1936 : section_to_delete => section_vals_get_subs_vals(section1, "VELOCITY")
1034 3762 : CALL section_vals_remove_values(section_to_delete)
1035 : END DO
1036 :
1037 1826 : motion_section => section_vals_get_subs_vals(input_file, "MOTION")
1038 1826 : md_section => section_vals_get_subs_vals(motion_section, "MD")
1039 1826 : CALL section_vals_get(md_section, explicit=explicit1)
1040 1826 : IF (explicit1) THEN
1041 1766 : CALL section_vals_val_unset(md_section, "STEP_START_VAL")
1042 1766 : CALL section_vals_val_unset(md_section, "TIME_START_VAL")
1043 1766 : CALL section_vals_val_unset(md_section, "ECONS_START_VAL")
1044 : END IF
1045 1826 : work_section => section_vals_get_subs_vals(motion_section, "FREE_ENERGY%METADYN")
1046 1826 : CALL section_vals_get(work_section, explicit=explicit1)
1047 1826 : IF (explicit1) THEN
1048 158 : CALL section_vals_val_unset(motion_section, "FREE_ENERGY%METADYN%STEP_START_VAL")
1049 158 : CALL section_vals_val_unset(motion_section, "FREE_ENERGY%METADYN%NHILLS_START_VAL")
1050 : END IF
1051 1826 : section_to_delete => section_vals_get_subs_vals(motion_section, "BAND%REPLICA")
1052 1826 : CALL section_vals_remove_values(section_to_delete)
1053 1826 : section_to_delete => section_vals_get_subs_vals(md_section, "AVERAGES%RESTART_AVERAGES")
1054 1826 : CALL section_vals_remove_values(section_to_delete)
1055 1826 : section_to_delete => section_vals_get_subs_vals(md_section, "THERMOSTAT%NOSE%COORD")
1056 1826 : CALL section_vals_remove_values(section_to_delete)
1057 1826 : section_to_delete => section_vals_get_subs_vals(md_section, "THERMOSTAT%NOSE%VELOCITY")
1058 1826 : CALL section_vals_remove_values(section_to_delete)
1059 1826 : section_to_delete => section_vals_get_subs_vals(md_section, "THERMOSTAT%NOSE%MASS")
1060 1826 : CALL section_vals_remove_values(section_to_delete)
1061 1826 : section_to_delete => section_vals_get_subs_vals(md_section, "THERMOSTAT%NOSE%FORCE")
1062 1826 : CALL section_vals_remove_values(section_to_delete)
1063 1826 : section_to_delete => section_vals_get_subs_vals(md_section, "BAROSTAT%MASS")
1064 1826 : CALL section_vals_remove_values(section_to_delete)
1065 1826 : section_to_delete => section_vals_get_subs_vals(md_section, "BAROSTAT%VELOCITY")
1066 1826 : CALL section_vals_remove_values(section_to_delete)
1067 1826 : section_to_delete => section_vals_get_subs_vals(md_section, "BAROSTAT%THERMOSTAT%NOSE%COORD")
1068 1826 : CALL section_vals_remove_values(section_to_delete)
1069 1826 : section_to_delete => section_vals_get_subs_vals(md_section, "BAROSTAT%THERMOSTAT%NOSE%VELOCITY")
1070 1826 : CALL section_vals_remove_values(section_to_delete)
1071 1826 : section_to_delete => section_vals_get_subs_vals(md_section, "BAROSTAT%THERMOSTAT%NOSE%MASS")
1072 1826 : CALL section_vals_remove_values(section_to_delete)
1073 1826 : section_to_delete => section_vals_get_subs_vals(md_section, "BAROSTAT%THERMOSTAT%NOSE%FORCE")
1074 1826 : CALL section_vals_remove_values(section_to_delete)
1075 1826 : section_to_delete => section_vals_get_subs_vals(md_section, "SHELL%THERMOSTAT%NOSE%COORD")
1076 1826 : CALL section_vals_remove_values(section_to_delete)
1077 1826 : section_to_delete => section_vals_get_subs_vals(md_section, "SHELL%THERMOSTAT%NOSE%VELOCITY")
1078 1826 : CALL section_vals_remove_values(section_to_delete)
1079 1826 : section_to_delete => section_vals_get_subs_vals(md_section, "SHELL%THERMOSTAT%NOSE%MASS")
1080 1826 : CALL section_vals_remove_values(section_to_delete)
1081 1826 : section_to_delete => section_vals_get_subs_vals(md_section, "SHELL%THERMOSTAT%NOSE%FORCE")
1082 1826 : CALL section_vals_remove_values(section_to_delete)
1083 : ! Constrained/Restrained section
1084 1826 : section_to_delete => section_vals_get_subs_vals(motion_section, "CONSTRAINT%FIX_ATOM_RESTART")
1085 1826 : CALL section_vals_remove_values(section_to_delete)
1086 1826 : section_to_delete => section_vals_get_subs_vals(motion_section, "CONSTRAINT%COLVAR_RESTART")
1087 1826 : CALL section_vals_remove_values(section_to_delete)
1088 : ! Free energies restarts
1089 1826 : section_to_delete => section_vals_get_subs_vals(motion_section, "FREE_ENERGY%METADYN%SPAWNED_HILLS_POS")
1090 1826 : CALL section_vals_remove_values(section_to_delete)
1091 1826 : section_to_delete => section_vals_get_subs_vals(motion_section, "FREE_ENERGY%METADYN%SPAWNED_HILLS_SCALE")
1092 1826 : CALL section_vals_remove_values(section_to_delete)
1093 1826 : section_to_delete => section_vals_get_subs_vals(motion_section, "FREE_ENERGY%METADYN%SPAWNED_HILLS_HEIGHT")
1094 1826 : CALL section_vals_remove_values(section_to_delete)
1095 1826 : section_to_delete => section_vals_get_subs_vals(motion_section, "FREE_ENERGY%METADYN%SPAWNED_HILLS_INVDT")
1096 1826 : CALL section_vals_remove_values(section_to_delete)
1097 1826 : section_to_delete => section_vals_get_subs_vals(motion_section, "FREE_ENERGY%METADYN%EXT_LAGRANGE_SS0")
1098 1826 : CALL section_vals_remove_values(section_to_delete)
1099 1826 : section_to_delete => section_vals_get_subs_vals(motion_section, "FREE_ENERGY%METADYN%EXT_LAGRANGE_VVP")
1100 1826 : CALL section_vals_remove_values(section_to_delete)
1101 1826 : section_to_delete => section_vals_get_subs_vals(motion_section, "FREE_ENERGY%METADYN%EXT_LAGRANGE_SS")
1102 1826 : CALL section_vals_remove_values(section_to_delete)
1103 1826 : section_to_delete => section_vals_get_subs_vals(motion_section, "FREE_ENERGY%METADYN%EXT_LAGRANGE_FS")
1104 1826 : CALL section_vals_remove_values(section_to_delete)
1105 1826 : CALL timestop(handle)
1106 1826 : END SUBROUTINE remove_restart_info
1107 :
1108 : ! **************************************************************************************************
1109 : !> \brief This subroutine controls the defaults for the restartable quantities..
1110 : !> \param r_section ...
1111 : !> \author teo - University of Zurich - 09.2007 [tlaino]
1112 : ! **************************************************************************************************
1113 432 : SUBROUTINE handle_defaults_restart(r_section)
1114 : TYPE(section_vals_type), POINTER :: r_section
1115 :
1116 : CHARACTER(len=*), PARAMETER :: routineN = 'handle_defaults_restart'
1117 :
1118 : INTEGER :: handle, ik, nval
1119 : LOGICAL :: restart_default
1120 : TYPE(keyword_type), POINTER :: keyword
1121 : TYPE(section_type), POINTER :: section
1122 :
1123 216 : CALL timeset(routineN, handle)
1124 216 : NULLIFY (keyword, section)
1125 216 : CALL section_vals_get(r_section, section=section)
1126 216 : CALL section_vals_val_get(r_section, "RESTART_DEFAULT", l_val=restart_default)
1127 8856 : DO ik = -1, section%n_keywords
1128 8640 : keyword => section%keywords(ik)%keyword
1129 8856 : IF (ASSOCIATED(keyword)) THEN
1130 8208 : IF (keyword%type_of_var == logical_t .AND. keyword%names(1) (1:8) == "RESTART_") THEN
1131 7560 : IF (TRIM(keyword%names(1)) == "RESTART_DEFAULT") CYCLE
1132 7344 : CALL section_vals_val_get(r_section, keyword%names(1), n_rep_val=nval)
1133 7344 : IF (nval == 0) THEN
1134 : ! User didn't specify any value, use the value of the RESTART_DEFAULT keyword..
1135 6366 : CALL section_vals_val_set(r_section, keyword%names(1), l_val=restart_default)
1136 : END IF
1137 : END IF
1138 : END IF
1139 : END DO
1140 216 : CALL timestop(handle)
1141 :
1142 216 : END SUBROUTINE handle_defaults_restart
1143 :
1144 : END MODULE input_cp2k_check
|