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 28669 : 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 28669 : CPASSERT(.NOT. ASSOCIATED(section))
76 28669 : my_coupled_thermostat = .FALSE.
77 28669 : IF (PRESENT(coupled_thermostat)) my_coupled_thermostat = coupled_thermostat
78 28669 : 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 28669 : n_keywords=1, n_subsections=0, repeats=.FALSE.)
83 28669 : NULLIFY (keyword)
84 :
85 28669 : 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 28669 : enum_desc=s2a("Uses only the Nose-Hoover thermostat."))
93 28669 : CALL section_add_keyword(section, keyword)
94 28669 : 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 28669 : default_i_val=do_region_global)
103 28669 : CALL section_add_keyword(section, keyword)
104 28669 : CALL keyword_release(keyword)
105 :
106 28669 : CALL create_region_section(region_section, "slow thermostat")
107 28669 : CALL section_add_subsection(section, region_section)
108 28669 : 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 28669 : CALL create_nose_section(nose_section)
124 28669 : CALL section_add_subsection(section, nose_section)
125 28669 : 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 28669 : 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 28669 : 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 28669 : CPASSERT(.NOT. ASSOCIATED(section))
149 28669 : my_coupled_thermostat = .FALSE.
150 28669 : IF (PRESENT(coupled_thermostat)) my_coupled_thermostat = coupled_thermostat
151 28669 : 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 28669 : n_keywords=1, n_subsections=0, repeats=.FALSE.)
156 28669 : NULLIFY (keyword)
157 :
158 28669 : 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 28669 : enum_desc=s2a("Uses only the Nose-Hoover thermostat."))
166 28669 : CALL section_add_keyword(section, keyword)
167 28669 : 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 28669 : default_i_val=do_region_global)
176 28669 : CALL section_add_keyword(section, keyword)
177 28669 : CALL keyword_release(keyword)
178 :
179 28669 : CALL create_region_section(region_section, "fast thermostat")
180 28669 : CALL section_add_subsection(section, region_section)
181 28669 : 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 28669 : CALL create_nose_section(nose_section)
197 28669 : CALL section_add_subsection(section, nose_section)
198 28669 : 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 28669 : 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 86007 : 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 86007 : CPASSERT(.NOT. ASSOCIATED(section))
224 86007 : my_coupled_thermostat = .FALSE.
225 86007 : IF (PRESENT(coupled_thermostat)) my_coupled_thermostat = coupled_thermostat
226 86007 : 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 86007 : n_keywords=1, n_subsections=0, repeats=.FALSE.)
231 86007 : NULLIFY (keyword)
232 :
233 86007 : 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 57338 : "Uses adaptive-Langevin thermostat"))
245 57338 : CALL section_add_keyword(section, keyword)
246 57338 : 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 57338 : default_i_val=do_region_global)
255 57338 : CALL section_add_keyword(section, keyword)
256 57338 : CALL keyword_release(keyword)
257 :
258 57338 : CALL create_region_section(region_section, "thermostat")
259 57338 : CALL section_add_subsection(section, region_section)
260 57338 : 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 28669 : "Uses the canonical sampling through velocity rescaling."))
271 28669 : CALL section_add_keyword(section, keyword)
272 28669 : CALL keyword_release(keyword)
273 : END IF
274 :
275 86007 : CALL create_nose_section(nose_section)
276 86007 : CALL section_add_subsection(section, nose_section)
277 86007 : CALL section_release(nose_section)
278 :
279 86007 : CALL create_csvr_section(csvr_section)
280 86007 : CALL section_add_subsection(section, csvr_section)
281 86007 : CALL section_release(csvr_section)
282 :
283 86007 : CALL create_gle_section(gle_section)
284 86007 : CALL section_add_subsection(section, gle_section)
285 86007 : CALL section_release(gle_section)
286 :
287 86007 : CALL create_al_section(al_section)
288 86007 : CALL section_add_subsection(section, al_section)
289 86007 : CALL section_release(al_section)
290 :
291 : ! Print Section
292 86007 : CALL create_print_section(subsection)
293 86007 : CALL section_add_subsection(section, subsection)
294 86007 : CALL section_release(subsection)
295 :
296 86007 : 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 86007 : SUBROUTINE create_print_section(section)
304 : TYPE(section_type), POINTER :: section
305 :
306 : TYPE(section_type), POINTER :: print_key
307 :
308 86007 : CPASSERT(.NOT. ASSOCIATED(section))
309 86007 : NULLIFY (print_key)
310 : CALL section_create(section, __LOCATION__, name="PRINT", &
311 : description="Collects all print_keys for thermostat", &
312 86007 : 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 86007 : filename="__STD_OUT__")
318 86007 : CALL section_add_subsection(section, print_key)
319 86007 : 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 86007 : filename="")
326 86007 : CALL section_add_subsection(section, print_key)
327 86007 : 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 86007 : filename="")
333 86007 : CALL section_add_subsection(section, print_key)
334 86007 : CALL section_release(print_key)
335 86007 : 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 143345 : 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 143345 : 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 143345 : n_keywords=1, n_subsections=0, repeats=.TRUE.)
355 :
356 143345 : 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 143345 : n_var=-1, type_of_var=integer_t)
361 143345 : CALL section_add_keyword(section, keyword)
362 143345 : 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 286690 : n_var=-1, type_of_var=char_t)
369 143345 : CALL section_add_keyword(section, keyword)
370 143345 : 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 286690 : default_i_val=do_constr_none, repeats=.FALSE.)
382 143345 : CALL section_add_keyword(section, keyword)
383 143345 : 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 143345 : default_i_val=do_constr_none, repeats=.FALSE.)
394 143345 : CALL section_add_keyword(section, keyword)
395 143345 : CALL keyword_release(keyword)
396 :
397 143345 : END SUBROUTINE create_region_section
398 :
399 : ! **************************************************************************************************
400 : !> \brief ...
401 : !> \param section will contain the ewald section
402 : !> \author gloria
403 : ! **************************************************************************************************
404 143345 : 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 143345 : CPASSERT(.NOT. ASSOCIATED(section))
411 : CALL section_create(section, __LOCATION__, name="nose", &
412 : description="paramameters of the Nose Hoover thermostat chain", &
413 430035 : citations=(/Nose1984a, Nose1984b/))
414 :
415 143345 : NULLIFY (keyword, subsection)
416 : CALL keyword_create(keyword, __LOCATION__, name="length", &
417 : description="length of the Nose-Hoover chain", usage="length integer", &
418 143345 : default_i_val=3)
419 143345 : CALL section_add_keyword(section, keyword)
420 143345 : 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 143345 : default_i_val=3)
426 143345 : CALL section_add_keyword(section, keyword)
427 143345 : 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 143345 : unit_str="fs")
434 143345 : CALL section_add_keyword(section, keyword)
435 143345 : 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 143345 : default_i_val=2)
442 143345 : CALL section_add_keyword(section, keyword)
443 143345 : CALL keyword_release(keyword)
444 :
445 143345 : CALL create_coord_section(subsection, "NOSE HOOVER")
446 143345 : CALL section_add_subsection(section, subsection)
447 143345 : CALL section_release(subsection)
448 :
449 143345 : CALL create_velocity_section(subsection, "NOSE HOOVER")
450 143345 : CALL section_add_subsection(section, subsection)
451 143345 : CALL section_release(subsection)
452 :
453 143345 : CALL create_mass_section(subsection, "NOSE HOOVER")
454 143345 : CALL section_add_subsection(section, subsection)
455 143345 : CALL section_release(subsection)
456 :
457 143345 : CALL create_force_section(subsection, "NOSE HOOVER")
458 143345 : CALL section_add_subsection(section, subsection)
459 143345 : CALL section_release(subsection)
460 :
461 143345 : END SUBROUTINE create_nose_section
462 :
463 : ! **************************************************************************************************
464 : !> \brief ...
465 : !> \param section ...
466 : !> \param
467 : !> \author
468 : ! **************************************************************************************************
469 94537 : 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 94537 : 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 283611 : citations=(/Ceriotti2009, Ceriotti2009b/))
480 :
481 94537 : NULLIFY (keyword, subsection)
482 :
483 : CALL keyword_create(keyword, __LOCATION__, name="NDIM", &
484 : description="Size of the gle matrix", usage="NDIM 6", &
485 94537 : default_i_val=5)
486 94537 : CALL section_add_keyword(section, keyword)
487 94537 : 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 94537 : default_r_val=cp_unit_to_cp2k(1.0_dp, "ps^-1"), unit_str="ps^-1")
493 94537 : CALL section_add_keyword(section, keyword)
494 94537 : 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 94537 : 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 94537 : CALL section_add_keyword(section, keyword)
509 94537 : 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 94537 : type_of_var=real_t, n_var=-1, repeats=.TRUE.)
515 94537 : CALL section_add_keyword(section, keyword)
516 94537 : CALL keyword_release(keyword)
517 :
518 94537 : CALL create_thermo_energy_section(subsection)
519 94537 : CALL section_add_subsection(section, subsection)
520 94537 : CALL section_release(subsection)
521 :
522 94537 : CALL create_rng_section(subsection)
523 94537 : CALL section_add_subsection(section, subsection)
524 94537 : CALL section_release(subsection)
525 :
526 94537 : CALL create_gles_section(subsection)
527 94537 : CALL section_add_subsection(section, subsection)
528 94537 : CALL section_release(subsection)
529 :
530 94537 : 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 94537 : SUBROUTINE create_gles_section(section)
538 : TYPE(section_type), POINTER :: section
539 :
540 : TYPE(keyword_type), POINTER :: keyword
541 :
542 94537 : CPASSERT(.NOT. ASSOCIATED(section))
543 : CALL section_create(section, __LOCATION__, name="s", &
544 : description="The s variable for GLE used for restart", &
545 94537 : n_keywords=1, n_subsections=0, repeats=.FALSE.)
546 94537 : NULLIFY (keyword)
547 :
548 : CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
549 : description="Specify s variable for GLE thermostat ", repeats=.FALSE., &
550 94537 : usage="{Real} ...", type_of_var=real_t, n_var=-1)
551 94537 : CALL section_add_keyword(section, keyword)
552 94537 : CALL keyword_release(keyword)
553 :
554 94537 : 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 86007 : 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 86007 : CPASSERT(.NOT. ASSOCIATED(section))
568 : CALL section_create(section, __LOCATION__, name="csvr", &
569 : description="Parameters of the canonical sampling through velocity rescaling thermostat.", &
570 172014 : citations=(/Bussi2007/))
571 :
572 86007 : 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 86007 : unit_str="fs")
582 86007 : CALL section_add_keyword(section, keyword)
583 86007 : CALL keyword_release(keyword)
584 :
585 86007 : CALL create_thermo_energy_section(subsection)
586 86007 : CALL section_add_subsection(section, subsection)
587 86007 : CALL section_release(subsection)
588 :
589 86007 : CALL create_rng_section(subsection)
590 86007 : CALL section_add_subsection(section, subsection)
591 86007 : CALL section_release(subsection)
592 :
593 86007 : END SUBROUTINE create_csvr_section
594 :
595 : ! **************************************************************************************************
596 : !> \brief ...
597 : !> \param section will contain the adaptive langevin section
598 : !> \author Noam [bernstei]
599 : ! **************************************************************************************************
600 86007 : 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 86007 : 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 172014 : citations=(/Jones2011/))
614 :
615 86007 : 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 86007 : unit_str="fs")
625 86007 : CALL section_add_keyword(section, keyword)
626 86007 : 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 86007 : unit_str="fs")
636 86007 : CALL section_add_keyword(section, keyword)
637 86007 : CALL keyword_release(keyword)
638 :
639 86007 : CALL create_thermo_chi_mass_section(subsection, "CHI")
640 86007 : CALL section_add_subsection(section, subsection)
641 86007 : CALL section_release(subsection)
642 :
643 86007 : CALL create_thermo_chi_mass_section(subsection, "MASS")
644 86007 : CALL section_add_subsection(section, subsection)
645 86007 : CALL section_release(subsection)
646 :
647 86007 : 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 172014 : 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 172014 : 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 172014 : n_keywords=1, n_subsections=0, repeats=.FALSE.)
665 172014 : 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 172014 : unit_str="fs^-1", type_of_var=real_t)
671 172014 : CALL section_add_keyword(section, keyword)
672 172014 : CALL keyword_release(keyword)
673 :
674 172014 : 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 180544 : SUBROUTINE create_thermo_energy_section(section)
682 : TYPE(section_type), POINTER :: section
683 :
684 : TYPE(keyword_type), POINTER :: keyword
685 :
686 180544 : CPASSERT(.NOT. ASSOCIATED(section))
687 : CALL section_create(section, __LOCATION__, name="THERMOSTAT_ENERGY", &
688 : description="Information to initialize the CSVR thermostat energy.", &
689 180544 : n_keywords=1, n_subsections=0, repeats=.FALSE.)
690 180544 : NULLIFY (keyword)
691 :
692 : CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
693 : description="Specify an initial thermostat energy for CSVR thermostat.", &
694 180544 : repeats=.TRUE., unit_str="internal_cp2k", type_of_var=real_t)
695 180544 : CALL section_add_keyword(section, keyword)
696 180544 : CALL keyword_release(keyword)
697 :
698 180544 : 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 143345 : 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 143345 : CPASSERT(.NOT. ASSOCIATED(section))
713 : CALL section_create(section, __LOCATION__, name="force", &
714 : description="The forces for "//TRIM(name)//" used for restart", &
715 143345 : n_keywords=1, n_subsections=0, repeats=.FALSE.)
716 143345 : NULLIFY (keyword)
717 :
718 : CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
719 : description="Specify masses of the system", repeats=.FALSE., &
720 143345 : usage="{Real} ...", type_of_var=real_t, n_var=-1)
721 143345 : CALL section_add_keyword(section, keyword)
722 143345 : CALL keyword_release(keyword)
723 :
724 143345 : 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 172014 : 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 172014 : CPASSERT(.NOT. ASSOCIATED(section))
739 : CALL section_create(section, __LOCATION__, name="mass", &
740 : description="The masses for "//TRIM(name)//" used for restart", &
741 172014 : n_keywords=1, n_subsections=0, repeats=.FALSE.)
742 172014 : NULLIFY (keyword)
743 :
744 : CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
745 : description="Specify masses of the system", repeats=.FALSE., &
746 172014 : usage="{Real} ...", type_of_var=real_t, n_var=-1)
747 172014 : CALL section_add_keyword(section, keyword)
748 172014 : CALL keyword_release(keyword)
749 :
750 172014 : 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 197893 : 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 197893 : CPASSERT(.NOT. ASSOCIATED(section))
765 : CALL section_create(section, __LOCATION__, name="velocity", &
766 : description="The velocities for "//TRIM(name)//" used for restart", &
767 197893 : n_keywords=1, n_subsections=0, repeats=.FALSE.)
768 197893 : NULLIFY (keyword)
769 :
770 : CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
771 : description="Specify velocities of the system", repeats=.TRUE., &
772 197893 : usage="{Real} ...", type_of_var=real_t, n_var=-1)
773 197893 : CALL section_add_keyword(section, keyword)
774 197893 : CALL keyword_release(keyword)
775 :
776 197893 : 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 177754 : 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 177754 : CPASSERT(.NOT. ASSOCIATED(section))
791 : CALL section_create(section, __LOCATION__, name="coord", &
792 : description="The positions for "//TRIM(name)//" used for restart", &
793 177754 : n_keywords=1, n_subsections=0, repeats=.FALSE.)
794 177754 : NULLIFY (keyword)
795 :
796 : CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
797 : description="Specify positions of the system", repeats=.TRUE., &
798 177754 : usage="{Real} ...", type_of_var=real_t, n_var=-1)
799 177754 : CALL section_add_keyword(section, keyword)
800 177754 : CALL keyword_release(keyword)
801 :
802 177754 : END SUBROUTINE create_coord_section
803 :
804 : END MODULE input_cp2k_thermostats
|