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 : !> \par History
10 : !> 10.2005 split input_cp2k into smaller modules [fawzi]
11 : !> \author teo & fawzi
12 : ! **************************************************************************************************
13 : MODULE input_cp2k_thermostats
14 : USE bibliography, ONLY: Bussi2007,&
15 : Ceriotti2009,&
16 : Ceriotti2009b,&
17 : Jones2011,&
18 : Nose1984a,&
19 : Nose1984b
20 : USE cp_output_handling, ONLY: cp_print_key_section_create,&
21 : high_print_level,&
22 : low_print_level
23 : USE cp_units, ONLY: cp_unit_to_cp2k
24 : USE input_constants, ONLY: &
25 : do_constr_atomic, do_constr_molec, do_constr_none, do_region_defined, do_region_global, &
26 : do_region_massive, do_region_molecule, do_region_none, do_thermo_al, do_thermo_csvr, &
27 : do_thermo_gle, do_thermo_nose, do_thermo_same_as_part
28 : USE input_cp2k_subsys, ONLY: create_rng_section
29 : USE input_keyword_types, ONLY: keyword_create,&
30 : keyword_release,&
31 : keyword_type
32 : USE input_section_types, ONLY: section_add_keyword,&
33 : section_add_subsection,&
34 : section_create,&
35 : section_release,&
36 : section_type
37 : USE input_val_types, ONLY: char_t,&
38 : integer_t,&
39 : real_t
40 : USE kinds, ONLY: dp
41 : USE string_utilities, ONLY: s2a
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_thermostats'
49 :
50 : PUBLIC :: create_thermostat_section, &
51 : create_thermo_fast_section, &
52 : create_thermo_slow_section, &
53 : create_coord_section, &
54 : create_region_section, &
55 : create_velocity_section, &
56 : create_mass_section, &
57 : create_gle_section
58 :
59 : !***
60 : CONTAINS
61 : ! **************************************************************************************************
62 : !> \brief Specifies parameter for thermostat for constant temperature ensembles
63 : !> \param section will contain the coeff section
64 : !> \param coupled_thermostat ...
65 : !> \author teo [tlaino] - University of Zurich - 09.2007
66 : ! **************************************************************************************************
67 29313 : SUBROUTINE create_thermo_slow_section(section, coupled_thermostat)
68 : TYPE(section_type), POINTER :: section
69 : LOGICAL, INTENT(IN), OPTIONAL :: coupled_thermostat
70 :
71 : LOGICAL :: my_coupled_thermostat
72 : TYPE(keyword_type), POINTER :: keyword
73 : TYPE(section_type), POINTER :: nose_section, region_section
74 :
75 29313 : CPASSERT(.NOT. ASSOCIATED(section))
76 29313 : my_coupled_thermostat = .FALSE.
77 29313 : IF (PRESENT(coupled_thermostat)) my_coupled_thermostat = coupled_thermostat
78 29313 : NULLIFY (nose_section, region_section)
79 :
80 : CALL section_create(section, __LOCATION__, name="THERMOSTAT_SLOW", &
81 : description="Specify thermostat type and parameters controlling the thermostat.", &
82 29313 : n_keywords=1, n_subsections=0, repeats=.FALSE.)
83 29313 : NULLIFY (keyword)
84 :
85 29313 : IF (.NOT. my_coupled_thermostat) THEN
86 : CALL keyword_create(keyword, __LOCATION__, name="TYPE", &
87 : description="Specify the thermostat used for the constant temperature ensembles.", &
88 : usage="thermostat NOSE", &
89 : default_i_val=do_thermo_nose, &
90 : enum_c_vals=s2a("NOSE"), &
91 : enum_i_vals=(/do_thermo_nose/), &
92 29313 : enum_desc=s2a("Uses only the Nose-Hoover thermostat."))
93 29313 : CALL section_add_keyword(section, keyword)
94 29313 : CALL keyword_release(keyword)
95 :
96 : CALL keyword_create(keyword, __LOCATION__, name="REGION", &
97 : description="Determines the defined region for slow thermostat", &
98 : usage="REGION (GLOBAL||MOLECULE||MASSIVE||DEFINED||NONE)", &
99 : enum_c_vals=s2a("GLOBAL", "MOLECULE", "MASSIVE", "DEFINED", "NONE"), &
100 : enum_i_vals=(/do_region_global, do_region_molecule, &
101 : do_region_massive, do_region_defined, do_region_none/), &
102 29313 : default_i_val=do_region_global)
103 29313 : CALL section_add_keyword(section, keyword)
104 29313 : CALL keyword_release(keyword)
105 :
106 29313 : CALL create_region_section(region_section, "slow thermostat")
107 29313 : CALL section_add_subsection(section, region_section)
108 29313 : CALL section_release(region_section)
109 : ELSE
110 : CALL keyword_create(keyword, __LOCATION__, name="TYPE", &
111 : description="Specify the thermostat used for the constant temperature ensembles.", &
112 : usage="thermostat NOSE", &
113 : default_i_val=do_thermo_same_as_part, &
114 : enum_c_vals=s2a("SAME_AS_PARTICLE", "NOSE", "CSVR"), &
115 : enum_i_vals=(/do_thermo_same_as_part, do_thermo_nose, do_thermo_csvr/), &
116 : enum_desc=s2a("Use the same kind of thermostat used for particles.", &
117 : "Uses the Nose-Hoover thermostat.", &
118 0 : "Uses the canonical sampling through velocity rescaling."))
119 0 : CALL section_add_keyword(section, keyword)
120 0 : CALL keyword_release(keyword)
121 : END IF
122 :
123 29313 : CALL create_nose_section(nose_section)
124 29313 : CALL section_add_subsection(section, nose_section)
125 29313 : CALL section_release(nose_section)
126 :
127 : ! Print Section
128 : ! CALL create_print_section(subsection)
129 : ! CALL section_add_subsection(section, subsection)
130 : ! CALL section_release(subsection)
131 :
132 29313 : END SUBROUTINE create_thermo_slow_section
133 :
134 : ! **************************************************************************************************
135 : !> \brief Specifies parameter for thermostat for constant temperature ensembles
136 : !> \param section will contain the coeff section
137 : !> \param coupled_thermostat ...
138 : !> \author teo [tlaino] - University of Zurich - 09.2007
139 : ! **************************************************************************************************
140 29313 : SUBROUTINE create_thermo_fast_section(section, coupled_thermostat)
141 : TYPE(section_type), POINTER :: section
142 : LOGICAL, INTENT(IN), OPTIONAL :: coupled_thermostat
143 :
144 : LOGICAL :: my_coupled_thermostat
145 : TYPE(keyword_type), POINTER :: keyword
146 : TYPE(section_type), POINTER :: nose_section, region_section
147 :
148 29313 : CPASSERT(.NOT. ASSOCIATED(section))
149 29313 : my_coupled_thermostat = .FALSE.
150 29313 : IF (PRESENT(coupled_thermostat)) my_coupled_thermostat = coupled_thermostat
151 29313 : NULLIFY (nose_section, region_section)
152 :
153 : CALL section_create(section, __LOCATION__, name="THERMOSTAT_FAST", &
154 : description="Specify thermostat type and parameters controlling the thermostat.", &
155 29313 : n_keywords=1, n_subsections=0, repeats=.FALSE.)
156 29313 : NULLIFY (keyword)
157 :
158 29313 : IF (.NOT. my_coupled_thermostat) THEN
159 : CALL keyword_create(keyword, __LOCATION__, name="TYPE", &
160 : description="Specify the thermostat used for the constant temperature ensembles.", &
161 : usage="thermostat NOSE", &
162 : default_i_val=do_thermo_nose, &
163 : enum_c_vals=s2a("NOSE"), &
164 : enum_i_vals=(/do_thermo_nose/), &
165 29313 : enum_desc=s2a("Uses only the Nose-Hoover thermostat."))
166 29313 : CALL section_add_keyword(section, keyword)
167 29313 : CALL keyword_release(keyword)
168 :
169 : CALL keyword_create(keyword, __LOCATION__, name="REGION", &
170 : description="Determines the defined region for fast thermostat", &
171 : usage="REGION (GLOBAL||MOLECULE||MASSIVE||DEFINED||NONE)", &
172 : enum_c_vals=s2a("GLOBAL", "MOLECULE", "MASSIVE", "DEFINED", "NONE"), &
173 : enum_i_vals=(/do_region_global, do_region_molecule, &
174 : do_region_massive, do_region_defined, do_region_none/), &
175 29313 : default_i_val=do_region_global)
176 29313 : CALL section_add_keyword(section, keyword)
177 29313 : CALL keyword_release(keyword)
178 :
179 29313 : CALL create_region_section(region_section, "fast thermostat")
180 29313 : CALL section_add_subsection(section, region_section)
181 29313 : CALL section_release(region_section)
182 : ELSE
183 : CALL keyword_create(keyword, __LOCATION__, name="TYPE", &
184 : description="Specify the thermostat used for the constant temperature ensembles.", &
185 : usage="thermostat NOSE", &
186 : default_i_val=do_thermo_same_as_part, &
187 : enum_c_vals=s2a("SAME_AS_PARTICLE", "NOSE", "CSVR"), &
188 : enum_i_vals=(/do_thermo_same_as_part, do_thermo_nose, do_thermo_csvr/), &
189 : enum_desc=s2a("Use the same kind of thermostat used for particles.", &
190 : "Uses the Nose-Hoover thermostat.", &
191 0 : "Uses the canonical sampling through velocity rescaling."))
192 0 : CALL section_add_keyword(section, keyword)
193 0 : CALL keyword_release(keyword)
194 : END IF
195 :
196 29313 : CALL create_nose_section(nose_section)
197 29313 : CALL section_add_subsection(section, nose_section)
198 29313 : CALL section_release(nose_section)
199 :
200 : ! Print Section
201 : ! CALL create_print_section(subsection)
202 : ! CALL section_add_subsection(section, subsection)
203 : ! CALL section_release(subsection)
204 :
205 29313 : END SUBROUTINE create_thermo_fast_section
206 :
207 : ! **************************************************************************************************
208 : !> \brief Specifies parameter for thermostat for constant temperature ensembles
209 : !> \param section will contain the coeff section
210 : !> \param coupled_thermostat ...
211 : !> \author teo [tlaino] - University of Zurich - 09.2007
212 : ! **************************************************************************************************
213 87939 : SUBROUTINE create_thermostat_section(section, coupled_thermostat)
214 : TYPE(section_type), POINTER :: section
215 : LOGICAL, INTENT(IN), OPTIONAL :: coupled_thermostat
216 :
217 : LOGICAL :: my_coupled_thermostat
218 : TYPE(keyword_type), POINTER :: keyword
219 : TYPE(section_type), POINTER :: al_section, csvr_section, gle_section, &
220 : nose_section, region_section, &
221 : subsection
222 :
223 87939 : CPASSERT(.NOT. ASSOCIATED(section))
224 87939 : my_coupled_thermostat = .FALSE.
225 87939 : IF (PRESENT(coupled_thermostat)) my_coupled_thermostat = coupled_thermostat
226 87939 : NULLIFY (csvr_section, gle_section, al_section, nose_section, subsection, region_section)
227 :
228 : CALL section_create(section, __LOCATION__, name="THERMOSTAT", &
229 : description="Specify thermostat type and parameters controlling the thermostat.", &
230 87939 : n_keywords=1, n_subsections=0, repeats=.FALSE.)
231 87939 : NULLIFY (keyword)
232 :
233 87939 : IF (.NOT. my_coupled_thermostat) THEN
234 : CALL keyword_create(keyword, __LOCATION__, name="TYPE", &
235 : description="Specify the thermostat used for the constant temperature ensembles.", &
236 : usage="thermostat NOSE", &
237 : default_i_val=do_thermo_nose, &
238 : enum_c_vals=s2a("NOSE", "CSVR", "GLE", "AD_LANGEVIN"), &
239 : enum_i_vals=(/do_thermo_nose, &
240 : do_thermo_csvr, do_thermo_gle, do_thermo_al/), &
241 : enum_desc=s2a("Uses the Nose-Hoover thermostat.", &
242 : "Uses the canonical sampling through velocity rescaling.", &
243 : "Uses GLE thermostat", &
244 58626 : "Uses adaptive-Langevin thermostat"))
245 58626 : CALL section_add_keyword(section, keyword)
246 58626 : CALL keyword_release(keyword)
247 :
248 : CALL keyword_create(keyword, __LOCATION__, name="REGION", &
249 : description="Determines the region each thermostat is attached to.", &
250 : usage="REGION (GLOBAL||MOLECULE||MASSIVE||DEFINED||NONE)", &
251 : enum_c_vals=s2a("GLOBAL", "MOLECULE", "MASSIVE", "DEFINED", "NONE"), &
252 : enum_i_vals=(/do_region_global, do_region_molecule, &
253 : do_region_massive, do_region_defined, do_region_none/), &
254 58626 : default_i_val=do_region_global)
255 58626 : CALL section_add_keyword(section, keyword)
256 58626 : CALL keyword_release(keyword)
257 :
258 58626 : CALL create_region_section(region_section, "thermostat")
259 58626 : CALL section_add_subsection(section, region_section)
260 58626 : CALL section_release(region_section)
261 : ELSE
262 : CALL keyword_create(keyword, __LOCATION__, name="TYPE", &
263 : description="Specify the thermostat used for the constant temperature ensembles.", &
264 : usage="thermostat NOSE", &
265 : default_i_val=do_thermo_same_as_part, &
266 : enum_c_vals=s2a("SAME_AS_PARTICLE", "NOSE", "CSVR"), &
267 : enum_i_vals=(/do_thermo_same_as_part, do_thermo_nose, do_thermo_csvr/), &
268 : enum_desc=s2a("Use the same kind of thermostat used for particles.", &
269 : "Uses the Nose-Hoover thermostat.", &
270 29313 : "Uses the canonical sampling through velocity rescaling."))
271 29313 : CALL section_add_keyword(section, keyword)
272 29313 : CALL keyword_release(keyword)
273 : END IF
274 :
275 87939 : CALL create_nose_section(nose_section)
276 87939 : CALL section_add_subsection(section, nose_section)
277 87939 : CALL section_release(nose_section)
278 :
279 87939 : CALL create_csvr_section(csvr_section)
280 87939 : CALL section_add_subsection(section, csvr_section)
281 87939 : CALL section_release(csvr_section)
282 :
283 87939 : CALL create_gle_section(gle_section)
284 87939 : CALL section_add_subsection(section, gle_section)
285 87939 : CALL section_release(gle_section)
286 :
287 87939 : CALL create_al_section(al_section)
288 87939 : CALL section_add_subsection(section, al_section)
289 87939 : CALL section_release(al_section)
290 :
291 : ! Print Section
292 87939 : CALL create_print_section(subsection)
293 87939 : CALL section_add_subsection(section, subsection)
294 87939 : CALL section_release(subsection)
295 :
296 87939 : END SUBROUTINE create_thermostat_section
297 :
298 : ! **************************************************************************************************
299 : !> \brief Creates print section for thermostat section
300 : !> \param section ...
301 : !> \author teo [tlaino] - University of Zurich - 02.2008
302 : ! **************************************************************************************************
303 87939 : SUBROUTINE create_print_section(section)
304 : TYPE(section_type), POINTER :: section
305 :
306 : TYPE(section_type), POINTER :: print_key
307 :
308 87939 : CPASSERT(.NOT. ASSOCIATED(section))
309 87939 : NULLIFY (print_key)
310 : CALL section_create(section, __LOCATION__, name="PRINT", &
311 : description="Collects all print_keys for thermostat", &
312 87939 : n_keywords=1, n_subsections=0, repeats=.FALSE.)
313 :
314 : CALL cp_print_key_section_create(print_key, __LOCATION__, "THERMOSTAT_INFO", &
315 : description="Controls output information of the corresponding thermostat.", &
316 : print_level=low_print_level, common_iter_levels=1, &
317 87939 : filename="__STD_OUT__")
318 87939 : CALL section_add_subsection(section, print_key)
319 87939 : CALL section_release(print_key)
320 :
321 : CALL cp_print_key_section_create(print_key, __LOCATION__, "TEMPERATURE", &
322 : description="Controls the output of the temperatures of the regions corresponding to "// &
323 : "the present thermostat", &
324 : print_level=high_print_level, common_iter_levels=1, &
325 87939 : filename="")
326 87939 : CALL section_add_subsection(section, print_key)
327 87939 : CALL section_release(print_key)
328 :
329 : CALL cp_print_key_section_create(print_key, __LOCATION__, "ENERGY", &
330 : description="Controls the output of kinetic energy, and potential energy "// &
331 : "of the defined thermostat.", print_level=high_print_level, common_iter_levels=1, &
332 87939 : filename="")
333 87939 : CALL section_add_subsection(section, print_key)
334 87939 : CALL section_release(print_key)
335 87939 : END SUBROUTINE create_print_section
336 :
337 : ! **************************************************************************************************
338 : !> \brief Creates a section to arbitrary define a region to thermostat
339 : !> \param section will contain the coeff section
340 : !> \param label ...
341 : !> \author teo
342 : ! **************************************************************************************************
343 146565 : SUBROUTINE create_region_section(section, label)
344 : TYPE(section_type), POINTER :: section
345 : CHARACTER(LEN=*), INTENT(IN) :: label
346 :
347 : TYPE(keyword_type), POINTER :: keyword
348 :
349 146565 : CPASSERT(.NOT. ASSOCIATED(section))
350 :
351 : CALL section_create(section, __LOCATION__, name="DEFINE_REGION", &
352 : description="This section provides the possibility to define arbitrary region "// &
353 : "for the "//TRIM(label)//".", &
354 146565 : n_keywords=1, n_subsections=0, repeats=.TRUE.)
355 :
356 146565 : NULLIFY (keyword)
357 : CALL keyword_create(keyword, __LOCATION__, name="LIST", &
358 : description="Specifies a list of atoms to thermostat.", &
359 : usage="LIST {integer} {integer} .. {integer}", repeats=.TRUE., &
360 146565 : n_var=-1, type_of_var=integer_t)
361 146565 : CALL section_add_keyword(section, keyword)
362 146565 : CALL keyword_release(keyword)
363 :
364 : CALL keyword_create(keyword, __LOCATION__, name="MOLNAME", &
365 : variants=(/"SEGNAME"/), &
366 : description="Specifies the name of the molecules to thermostat", &
367 : usage="MOLNAME WAT MEOH", repeats=.TRUE., &
368 293130 : n_var=-1, type_of_var=char_t)
369 146565 : CALL section_add_keyword(section, keyword)
370 146565 : CALL keyword_release(keyword)
371 :
372 : CALL keyword_create(keyword, __LOCATION__, name="MM_SUBSYS", &
373 : variants=(/"PROTEIN"/), &
374 : description="In a QM/MM run all MM atoms are specified as a whole ensemble to be thermostated", &
375 : usage="MM_SUBSYS (NONE|ATOMIC|MOLECULAR)", &
376 : enum_c_vals=s2a("NONE", "ATOMIC", "MOLECULAR"), &
377 : enum_i_vals=(/do_constr_none, do_constr_atomic, do_constr_molec/), &
378 : enum_desc=s2a("Thermostat nothing", &
379 : "Only the MM atoms itself", &
380 : "The full molecule/residue that contains a MM atom"), &
381 293130 : default_i_val=do_constr_none, repeats=.FALSE.)
382 146565 : CALL section_add_keyword(section, keyword)
383 146565 : CALL keyword_release(keyword)
384 :
385 : CALL keyword_create(keyword, __LOCATION__, name="QM_SUBSYS", &
386 : description="In a QM/MM run all QM atoms are specified as a whole ensemble to be thermostated", &
387 : usage="QM_SUBSYS (NONE|ATOMIC|MOLECULAR)", &
388 : enum_c_vals=s2a("NONE", "ATOMIC", "MOLECULAR"), &
389 : enum_desc=s2a("Thermostat nothing", &
390 : "Only the QM atoms itself", &
391 : "The full molecule/residue that contains a QM atom"), &
392 : enum_i_vals=(/do_constr_none, do_constr_atomic, do_constr_molec/), &
393 146565 : default_i_val=do_constr_none, repeats=.FALSE.)
394 146565 : CALL section_add_keyword(section, keyword)
395 146565 : CALL keyword_release(keyword)
396 :
397 146565 : END SUBROUTINE create_region_section
398 :
399 : ! **************************************************************************************************
400 : !> \brief ...
401 : !> \param section will contain the ewald section
402 : !> \author gloria
403 : ! **************************************************************************************************
404 146565 : SUBROUTINE create_nose_section(section)
405 : TYPE(section_type), POINTER :: section
406 :
407 : TYPE(keyword_type), POINTER :: keyword
408 : TYPE(section_type), POINTER :: subsection
409 :
410 146565 : CPASSERT(.NOT. ASSOCIATED(section))
411 : CALL section_create(section, __LOCATION__, name="nose", &
412 : description="paramameters of the Nose Hoover thermostat chain", &
413 439695 : citations=(/Nose1984a, Nose1984b/))
414 :
415 146565 : NULLIFY (keyword, subsection)
416 : CALL keyword_create(keyword, __LOCATION__, name="length", &
417 : description="length of the Nose-Hoover chain", usage="length integer", &
418 146565 : default_i_val=3)
419 146565 : CALL section_add_keyword(section, keyword)
420 146565 : CALL keyword_release(keyword)
421 :
422 : CALL keyword_create(keyword, __LOCATION__, name="Yoshida", &
423 : description="order of the yoshida integrator used for the thermostat", &
424 : usage="Yoshida integer", &
425 146565 : default_i_val=3)
426 146565 : CALL section_add_keyword(section, keyword)
427 146565 : CALL keyword_release(keyword)
428 :
429 : CALL keyword_create(keyword, __LOCATION__, name="timecon", &
430 : description="timeconstant of the thermostat chain", &
431 : usage="timecon <REAL>", &
432 : default_r_val=cp_unit_to_cp2k(1000.0_dp, "fs"), &
433 146565 : unit_str="fs")
434 146565 : CALL section_add_keyword(section, keyword)
435 146565 : CALL keyword_release(keyword)
436 :
437 : CALL keyword_create(keyword, __LOCATION__, name="mts", &
438 : variants=s2a("multiple_time_steps", "mult_t_steps"), &
439 : description="number of multiple timesteps to be used for the NoseHoover chain", &
440 : usage="mts integer", &
441 146565 : default_i_val=2)
442 146565 : CALL section_add_keyword(section, keyword)
443 146565 : CALL keyword_release(keyword)
444 :
445 146565 : CALL create_coord_section(subsection, "NOSE HOOVER")
446 146565 : CALL section_add_subsection(section, subsection)
447 146565 : CALL section_release(subsection)
448 :
449 146565 : CALL create_velocity_section(subsection, "NOSE HOOVER")
450 146565 : CALL section_add_subsection(section, subsection)
451 146565 : CALL section_release(subsection)
452 :
453 146565 : CALL create_mass_section(subsection, "NOSE HOOVER")
454 146565 : CALL section_add_subsection(section, subsection)
455 146565 : CALL section_release(subsection)
456 :
457 146565 : CALL create_force_section(subsection, "NOSE HOOVER")
458 146565 : CALL section_add_subsection(section, subsection)
459 146565 : CALL section_release(subsection)
460 :
461 146565 : END SUBROUTINE create_nose_section
462 :
463 : ! **************************************************************************************************
464 : !> \brief ...
465 : !> \param section ...
466 : !> \param
467 : !> \author
468 : ! **************************************************************************************************
469 97113 : SUBROUTINE create_gle_section(section)
470 : TYPE(section_type), POINTER :: section
471 :
472 : TYPE(keyword_type), POINTER :: keyword
473 : TYPE(section_type), POINTER :: subsection
474 :
475 97113 : CPASSERT(.NOT. ASSOCIATED(section))
476 : CALL section_create(section, __LOCATION__, name="GLE", &
477 : description="paramameters of the gle thermostat. This section can be generated "// &
478 : "from <https://gle4md.org/index.html?page=matrix>.", &
479 291339 : citations=(/Ceriotti2009, Ceriotti2009b/))
480 :
481 97113 : NULLIFY (keyword, subsection)
482 :
483 : CALL keyword_create(keyword, __LOCATION__, name="NDIM", &
484 : description="Size of the gle matrix", usage="NDIM 6", &
485 97113 : default_i_val=5)
486 97113 : CALL section_add_keyword(section, keyword)
487 97113 : CALL keyword_release(keyword)
488 :
489 : CALL keyword_create(keyword, __LOCATION__, name="A_SCALE", &
490 : description="scaling factor for matrix A (for generic matrix A, depends "// &
491 : "on the characteristic frequency of the system).", usage="A_SCALE 0.5", &
492 97113 : default_r_val=cp_unit_to_cp2k(1.0_dp, "ps^-1"), unit_str="ps^-1")
493 97113 : CALL section_add_keyword(section, keyword)
494 97113 : CALL keyword_release(keyword)
495 :
496 : CALL keyword_create(keyword, __LOCATION__, name="A_LIST", &
497 : description="A matrix The defaults give optimal sampling for most "// &
498 : "cristalline and liquid compounds. Generated with the parameters set kv_4-4.a "// &
499 : "centered on w_0=40 cm^-1.", usage="A_LIST real real real", &
500 : type_of_var=real_t, unit_str="internal_cp2k", &
501 97113 : n_var=-1, repeats=.TRUE.)
502 : ! default_r_vals=(/ &
503 : ! 1.859575861256e+2_dp, 2.726385349840e-1_dp, 1.152610045461e+1_dp, -3.641457826260e+1_dp, 2.317337581602e+2_dp, &
504 : ! -2.780952471206e-1_dp, 8.595159180871e-5_dp, 7.218904801765e-1_dp, -1.984453934386e-1_dp, 4.240925758342e-1_dp, &
505 : ! -1.482580813121e+1_dp, -7.218904801765e-1_dp, 1.359090212128e+0_dp, 5.149889628035e+0_dp, -9.994926845099e+0_dp, &
506 : ! -1.037218912688e+1_dp, 1.984453934386e-1_dp, -5.149889628035e+0_dp, 2.666191089117e+1_dp, 1.150771549531e+1_dp, &
507 : ! 2.180134636042e+2_dp, -4.240925758342e-1_dp, 9.994926845099e+0_dp, -1.150771549531e+1_dp, 3.095839456559e+2_dp /), &
508 97113 : CALL section_add_keyword(section, keyword)
509 97113 : CALL keyword_release(keyword)
510 :
511 : CALL keyword_create(keyword, __LOCATION__, name="C_LIST", &
512 : description="C matrix", usage="C_LIST real real real", &
513 : unit_str="K_e", &
514 97113 : type_of_var=real_t, n_var=-1, repeats=.TRUE.)
515 97113 : CALL section_add_keyword(section, keyword)
516 97113 : CALL keyword_release(keyword)
517 :
518 97113 : CALL create_thermo_energy_section(subsection)
519 97113 : CALL section_add_subsection(section, subsection)
520 97113 : CALL section_release(subsection)
521 :
522 97113 : CALL create_rng_section(subsection)
523 97113 : CALL section_add_subsection(section, subsection)
524 97113 : CALL section_release(subsection)
525 :
526 97113 : CALL create_gles_section(subsection)
527 97113 : CALL section_add_subsection(section, subsection)
528 97113 : CALL section_release(subsection)
529 :
530 97113 : END SUBROUTINE create_gle_section
531 :
532 : ! **************************************************************************************************
533 : !> \brief Creates the gles section
534 : !> \param section the section to create
535 : !> \author teo
536 : ! **************************************************************************************************
537 97113 : SUBROUTINE create_gles_section(section)
538 : TYPE(section_type), POINTER :: section
539 :
540 : TYPE(keyword_type), POINTER :: keyword
541 :
542 97113 : CPASSERT(.NOT. ASSOCIATED(section))
543 : CALL section_create(section, __LOCATION__, name="s", &
544 : description="The s variable for GLE used for restart", &
545 97113 : n_keywords=1, n_subsections=0, repeats=.FALSE.)
546 97113 : NULLIFY (keyword)
547 :
548 : CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
549 : description="Specify s variable for GLE thermostat ", repeats=.FALSE., &
550 97113 : usage="{Real} ...", type_of_var=real_t, n_var=-1)
551 97113 : CALL section_add_keyword(section, keyword)
552 97113 : CALL keyword_release(keyword)
553 :
554 97113 : END SUBROUTINE create_gles_section
555 :
556 : ! **************************************************************************************************
557 : !> \brief ...
558 : !> \param section will contain the ewald section
559 : !> \author teo [tlaino] - University of Zurich - 09.2007
560 : ! **************************************************************************************************
561 87939 : SUBROUTINE create_csvr_section(section)
562 : TYPE(section_type), POINTER :: section
563 :
564 : TYPE(keyword_type), POINTER :: keyword
565 : TYPE(section_type), POINTER :: subsection
566 :
567 87939 : CPASSERT(.NOT. ASSOCIATED(section))
568 : CALL section_create(section, __LOCATION__, name="csvr", &
569 : description="Parameters of the canonical sampling through velocity rescaling thermostat.", &
570 175878 : citations=(/Bussi2007/))
571 :
572 87939 : NULLIFY (keyword, subsection)
573 :
574 : CALL keyword_create(keyword, __LOCATION__, name="timecon", &
575 : description="Time constant of the CSVR thermostat. A small time "// &
576 : "constant will result in strong thermostatting (useful for "// &
577 : "initial equilibrations) and a large time constant would be adequate "// &
578 : "to get weak thermostatting in production runs.", &
579 : usage="timecon <REAL>", &
580 : default_r_val=cp_unit_to_cp2k(1000.0_dp, "fs"), &
581 87939 : unit_str="fs")
582 87939 : CALL section_add_keyword(section, keyword)
583 87939 : CALL keyword_release(keyword)
584 :
585 87939 : CALL create_thermo_energy_section(subsection)
586 87939 : CALL section_add_subsection(section, subsection)
587 87939 : CALL section_release(subsection)
588 :
589 87939 : CALL create_rng_section(subsection)
590 87939 : CALL section_add_subsection(section, subsection)
591 87939 : CALL section_release(subsection)
592 :
593 87939 : END SUBROUTINE create_csvr_section
594 :
595 : ! **************************************************************************************************
596 : !> \brief ...
597 : !> \param section will contain the adaptive langevin section
598 : !> \author Noam [bernstei]
599 : ! **************************************************************************************************
600 87939 : SUBROUTINE create_al_section(section)
601 : TYPE(section_type), POINTER :: section
602 :
603 : TYPE(keyword_type), POINTER :: keyword
604 : TYPE(section_type), POINTER :: subsection
605 :
606 87939 : CPASSERT(.NOT. ASSOCIATED(section))
607 : CALL section_create(section, __LOCATION__, name="ad_langevin", &
608 : description="Parameters of the adaptive-Langevin thermostat."// &
609 : " Known to work with NVT ensemble, but not tested with"// &
610 : " other ensembles. Also tested with FIXED_ATOMS constraints, but"// &
611 : " may not work with other constraints (restraints should be OK, but"// &
612 : " haven't been well tested)", &
613 175878 : citations=(/Jones2011/))
614 :
615 87939 : NULLIFY (keyword, subsection)
616 :
617 : CALL keyword_create(keyword, __LOCATION__, name="timecon_nh", &
618 : description="Time constant of the Nose-Hoover part of the AD_LANGEVIN thermostat. A small time "// &
619 : "constant will result in strong thermostatting (useful for "// &
620 : "initial equilibrations) and a large time constant would be adequate "// &
621 : "to get weak thermostatting in production runs.", &
622 : usage="timecon_nh <REAL>", &
623 : default_r_val=cp_unit_to_cp2k(1000.0_dp, "fs"), &
624 87939 : unit_str="fs")
625 87939 : CALL section_add_keyword(section, keyword)
626 87939 : CALL keyword_release(keyword)
627 :
628 : CALL keyword_create(keyword, __LOCATION__, name="timecon_langevin", &
629 : description="Time constant of the Langevin part of the AD_LANGEVIN thermostat. A small time "// &
630 : "constant will result in strong thermostatting (useful for "// &
631 : "initial equilibrations) and a large time constant would be adequate "// &
632 : "to get weak thermostatting in production runs.", &
633 : usage="timecon_langevin <REAL>", &
634 : default_r_val=cp_unit_to_cp2k(1000.0_dp, "fs"), &
635 87939 : unit_str="fs")
636 87939 : CALL section_add_keyword(section, keyword)
637 87939 : CALL keyword_release(keyword)
638 :
639 87939 : CALL create_thermo_chi_mass_section(subsection, "CHI")
640 87939 : CALL section_add_subsection(section, subsection)
641 87939 : CALL section_release(subsection)
642 :
643 87939 : CALL create_thermo_chi_mass_section(subsection, "MASS")
644 87939 : CALL section_add_subsection(section, subsection)
645 87939 : CALL section_release(subsection)
646 :
647 87939 : END SUBROUTINE create_al_section
648 :
649 : ! **************************************************************************************************
650 : !> \brief Creates the thermostat chi restarting section
651 : !> \param section the section to create
652 : !> \param sec_name ...
653 : !> \author teo
654 : ! **************************************************************************************************
655 175878 : SUBROUTINE create_thermo_chi_mass_section(section, sec_name)
656 : TYPE(section_type), POINTER :: section
657 : CHARACTER(len=*) :: sec_name
658 :
659 : TYPE(keyword_type), POINTER :: keyword
660 :
661 175878 : CPASSERT(.NOT. ASSOCIATED(section))
662 : CALL section_create(section, __LOCATION__, name=TRIM(sec_name), &
663 : description="Information to initialize the Ad-Langevin thermostat DOF "//TRIM(sec_name), &
664 175878 : n_keywords=1, n_subsections=0, repeats=.FALSE.)
665 175878 : NULLIFY (keyword)
666 :
667 : CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
668 : description="Specify an initial thermostat DOF "//TRIM(sec_name)// &
669 : " for Ad-Langevin thermostat.", repeats=.TRUE., &
670 175878 : unit_str="fs^-1", type_of_var=real_t)
671 175878 : CALL section_add_keyword(section, keyword)
672 175878 : CALL keyword_release(keyword)
673 :
674 175878 : END SUBROUTINE create_thermo_chi_mass_section
675 :
676 : ! **************************************************************************************************
677 : !> \brief Creates the thermostat energy restarting section
678 : !> \param section the section to create
679 : !> \author teo
680 : ! **************************************************************************************************
681 185052 : SUBROUTINE create_thermo_energy_section(section)
682 : TYPE(section_type), POINTER :: section
683 :
684 : TYPE(keyword_type), POINTER :: keyword
685 :
686 185052 : CPASSERT(.NOT. ASSOCIATED(section))
687 : CALL section_create(section, __LOCATION__, name="THERMOSTAT_ENERGY", &
688 : description="Information to initialize the CSVR thermostat energy.", &
689 185052 : n_keywords=1, n_subsections=0, repeats=.FALSE.)
690 185052 : NULLIFY (keyword)
691 :
692 : CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
693 : description="Specify an initial thermostat energy for CSVR thermostat.", &
694 185052 : repeats=.TRUE., unit_str="internal_cp2k", type_of_var=real_t)
695 185052 : CALL section_add_keyword(section, keyword)
696 185052 : CALL keyword_release(keyword)
697 :
698 185052 : END SUBROUTINE create_thermo_energy_section
699 :
700 : ! **************************************************************************************************
701 : !> \brief Creates the mass section
702 : !> \param section the section to create
703 : !> \param name ...
704 : !> \author teo
705 : ! **************************************************************************************************
706 146565 : SUBROUTINE create_force_section(section, name)
707 : TYPE(section_type), POINTER :: section
708 : CHARACTER(LEN=*), INTENT(IN) :: name
709 :
710 : TYPE(keyword_type), POINTER :: keyword
711 :
712 146565 : CPASSERT(.NOT. ASSOCIATED(section))
713 : CALL section_create(section, __LOCATION__, name="force", &
714 : description="The forces for "//TRIM(name)//" used for restart", &
715 146565 : n_keywords=1, n_subsections=0, repeats=.FALSE.)
716 146565 : NULLIFY (keyword)
717 :
718 : CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
719 : description="Specify masses of the system", repeats=.FALSE., &
720 146565 : usage="{Real} ...", type_of_var=real_t, n_var=-1)
721 146565 : CALL section_add_keyword(section, keyword)
722 146565 : CALL keyword_release(keyword)
723 :
724 146565 : END SUBROUTINE create_force_section
725 :
726 : ! **************************************************************************************************
727 : !> \brief Creates the mass section
728 : !> \param section the section to create
729 : !> \param name ...
730 : !> \author teo
731 : ! **************************************************************************************************
732 175878 : SUBROUTINE create_mass_section(section, name)
733 : TYPE(section_type), POINTER :: section
734 : CHARACTER(LEN=*), INTENT(IN) :: name
735 :
736 : TYPE(keyword_type), POINTER :: keyword
737 :
738 175878 : CPASSERT(.NOT. ASSOCIATED(section))
739 : CALL section_create(section, __LOCATION__, name="mass", &
740 : description="The masses for "//TRIM(name)//" used for restart", &
741 175878 : n_keywords=1, n_subsections=0, repeats=.FALSE.)
742 175878 : NULLIFY (keyword)
743 :
744 : CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
745 : description="Specify masses of the system", repeats=.FALSE., &
746 175878 : usage="{Real} ...", type_of_var=real_t, n_var=-1)
747 175878 : CALL section_add_keyword(section, keyword)
748 175878 : CALL keyword_release(keyword)
749 :
750 175878 : END SUBROUTINE create_mass_section
751 :
752 : ! **************************************************************************************************
753 : !> \brief Creates the velocity section
754 : !> \param section the section to create
755 : !> \param name ...
756 : !> \author teo
757 : ! **************************************************************************************************
758 203689 : SUBROUTINE create_velocity_section(section, name)
759 : TYPE(section_type), POINTER :: section
760 : CHARACTER(LEN=*), INTENT(IN) :: name
761 :
762 : TYPE(keyword_type), POINTER :: keyword
763 :
764 203689 : CPASSERT(.NOT. ASSOCIATED(section))
765 : CALL section_create(section, __LOCATION__, name="velocity", &
766 : description="The velocities for "//TRIM(name)//" used for restart", &
767 203689 : n_keywords=1, n_subsections=0, repeats=.FALSE.)
768 203689 : NULLIFY (keyword)
769 :
770 : CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
771 : description="Specify velocities of the system", repeats=.TRUE., &
772 203689 : usage="{Real} ...", type_of_var=real_t, n_var=-1)
773 203689 : CALL section_add_keyword(section, keyword)
774 203689 : CALL keyword_release(keyword)
775 :
776 203689 : END SUBROUTINE create_velocity_section
777 :
778 : ! **************************************************************************************************
779 : !> \brief Creates the coord section
780 : !> \param section the section to create
781 : !> \param name ...
782 : !> \author teo
783 : ! **************************************************************************************************
784 183550 : SUBROUTINE create_coord_section(section, name)
785 : TYPE(section_type), POINTER :: section
786 : CHARACTER(LEN=*), INTENT(IN) :: name
787 :
788 : TYPE(keyword_type), POINTER :: keyword
789 :
790 183550 : CPASSERT(.NOT. ASSOCIATED(section))
791 : CALL section_create(section, __LOCATION__, name="coord", &
792 : description="The positions for "//TRIM(name)//" used for restart", &
793 183550 : n_keywords=1, n_subsections=0, repeats=.FALSE.)
794 183550 : NULLIFY (keyword)
795 :
796 : CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
797 : description="Specify positions of the system", repeats=.TRUE., &
798 183550 : usage="{Real} ...", type_of_var=real_t, n_var=-1)
799 183550 : CALL section_add_keyword(section, keyword)
800 183550 : CALL keyword_release(keyword)
801 :
802 183550 : END SUBROUTINE create_coord_section
803 :
804 : END MODULE input_cp2k_thermostats
|