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