42#include "./base/base_uses.f90"
47 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .true.
48 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'input_cp2k_thermostats'
53 create_coord_section, &
55 create_velocity_section, &
69 LOGICAL,
INTENT(IN),
OPTIONAL :: coupled_thermostat
71 LOGICAL :: my_coupled_thermostat
73 TYPE(
section_type),
POINTER :: nose_section, region_section
75 cpassert(.NOT.
ASSOCIATED(section))
76 my_coupled_thermostat = .false.
77 IF (
PRESENT(coupled_thermostat)) my_coupled_thermostat = coupled_thermostat
78 NULLIFY (nose_section, region_section)
80 CALL section_create(section, __location__, name=
"THERMOSTAT_SLOW", &
81 description=
"Specify thermostat type and parameters controlling the thermostat.", &
82 n_keywords=1, n_subsections=0, repeats=.false.)
85 IF (.NOT. my_coupled_thermostat)
THEN
87 description=
"Specify the thermostat used for the constant temperature ensembles.", &
90 enum_c_vals=
s2a(
"NOSE"), &
92 enum_desc=
s2a(
"Uses only the Nose-Hoover thermostat."))
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"), &
111 description=
"Specify the thermostat used for the constant temperature ensembles.", &
112 usage=
"thermostat NOSE", &
114 enum_c_vals=
s2a(
"SAME_AS_PARTICLE",
"NOSE",
"CSVR"), &
116 enum_desc=
s2a(
"Use the same kind of thermostat used for particles.", &
117 "Uses the Nose-Hoover thermostat.", &
118 "Uses the canonical sampling through velocity rescaling."))
123 CALL create_nose_section(nose_section)
142 LOGICAL,
INTENT(IN),
OPTIONAL :: coupled_thermostat
144 LOGICAL :: my_coupled_thermostat
146 TYPE(
section_type),
POINTER :: nose_section, region_section
148 cpassert(.NOT.
ASSOCIATED(section))
149 my_coupled_thermostat = .false.
150 IF (
PRESENT(coupled_thermostat)) my_coupled_thermostat = coupled_thermostat
151 NULLIFY (nose_section, region_section)
153 CALL section_create(section, __location__, name=
"THERMOSTAT_FAST", &
154 description=
"Specify thermostat type and parameters controlling the thermostat.", &
155 n_keywords=1, n_subsections=0, repeats=.false.)
158 IF (.NOT. my_coupled_thermostat)
THEN
160 description=
"Specify the thermostat used for the constant temperature ensembles.", &
163 enum_c_vals=
s2a(
"NOSE"), &
165 enum_desc=
s2a(
"Uses only the Nose-Hoover thermostat."))
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"), &
184 description=
"Specify the thermostat used for the constant temperature ensembles.", &
185 usage=
"thermostat NOSE", &
187 enum_c_vals=
s2a(
"SAME_AS_PARTICLE",
"NOSE",
"CSVR"), &
189 enum_desc=
s2a(
"Use the same kind of thermostat used for particles.", &
190 "Uses the Nose-Hoover thermostat.", &
191 "Uses the canonical sampling through velocity rescaling."))
196 CALL create_nose_section(nose_section)
215 LOGICAL,
INTENT(IN),
OPTIONAL :: coupled_thermostat
217 LOGICAL :: my_coupled_thermostat
219 TYPE(
section_type),
POINTER :: al_section, csvr_section, gle_section, &
220 nose_section, region_section, &
223 cpassert(.NOT.
ASSOCIATED(section))
224 my_coupled_thermostat = .false.
225 IF (
PRESENT(coupled_thermostat)) my_coupled_thermostat = coupled_thermostat
226 NULLIFY (csvr_section, gle_section, al_section, nose_section, subsection, region_section)
229 description=
"Specify thermostat type and parameters controlling the thermostat.", &
230 n_keywords=1, n_subsections=0, repeats=.false.)
233 IF (.NOT. my_coupled_thermostat)
THEN
235 description=
"Specify the thermostat used for the constant temperature ensembles.", &
238 enum_c_vals=
s2a(
"NOSE",
"CSVR",
"GLE",
"AD_LANGEVIN"), &
241 enum_desc=
s2a(
"Uses the Nose-Hoover thermostat.", &
242 "Uses the canonical sampling through velocity rescaling.", &
243 "Uses GLE thermostat", &
244 "Uses adaptive-Langevin thermostat"))
249 description=
"Determines the region each thermostat is attached to.", &
250 usage=
"REGION (GLOBAL|MOLECULE|MASSIVE|DEFINED|THERMAL|NONE)", &
251 enum_c_vals=
s2a(
"GLOBAL",
"MOLECULE",
"MASSIVE",
"DEFINED",
"THERMAL",
"NONE"), &
254 enum_desc=
s2a(
"Apply one thermostat to the whole system (default)", &
255 "Apply one thermostat to each molecule kind", &
256 "Apply one thermostat to each degree of freedom", &
257 "Apply one thermostat to each defined region from THERMOSTAT/DEFINE_REGION", &
258 "Apply one thermostat to each defined region from THERMAL_REGION/DEFINE_REGION", &
259 "No thermostat is applied"), &
269 description=
"Specify the thermostat used for the constant temperature ensembles.", &
272 enum_c_vals=
s2a(
"SAME_AS_PARTICLE",
"NOSE",
"CSVR"), &
274 enum_desc=
s2a(
"Use the same kind of thermostat used for particles.", &
275 "Uses the Nose-Hoover thermostat.", &
276 "Uses the canonical sampling through velocity rescaling."))
281 CALL create_nose_section(nose_section)
285 CALL create_csvr_section(csvr_section)
293 CALL create_al_section(al_section)
298 CALL create_print_section(subsection)
309 SUBROUTINE create_print_section(section)
314 cpassert(.NOT.
ASSOCIATED(section))
317 description=
"Collects all print_keys for thermostat", &
318 n_keywords=1, n_subsections=0, repeats=.false.)
321 description=
"Controls output information of the corresponding thermostat.", &
323 filename=
"__STD_OUT__")
328 description=
"Controls the output of the temperatures of the regions corresponding to "// &
329 "the present thermostat", &
336 description=
"Controls the output of kinetic energy, and potential energy "// &
337 "of the defined thermostat.", print_level=
high_print_level, common_iter_levels=1, &
341 END SUBROUTINE create_print_section
351 CHARACTER(LEN=*),
INTENT(IN) :: label
355 cpassert(.NOT.
ASSOCIATED(section))
357 CALL section_create(section, __location__, name=
"DEFINE_REGION", &
358 description=
"This section provides the possibility to define arbitrary region "// &
359 "for the "//trim(label)//
".", &
360 n_keywords=1, n_subsections=0, repeats=.true.)
364 description=
"Specifies a list of atoms to thermostat.", &
365 usage=
"LIST {integer} {integer} .. {integer}", repeats=.true., &
371 variants=[
"SEGNAME"], &
372 description=
"Specifies the name of the molecules to thermostat", &
373 usage=
"MOLNAME WAT MEOH", repeats=.true., &
374 n_var=-1, type_of_var=
char_t)
379 variants=[
"PROTEIN"], &
380 description=
"In a QM/MM run all MM atoms are specified as a whole ensemble to be thermostated", &
381 usage=
"MM_SUBSYS (NONE|ATOMIC|MOLECULAR)", &
382 enum_c_vals=
s2a(
"NONE",
"ATOMIC",
"MOLECULAR"), &
384 enum_desc=
s2a(
"Thermostat nothing", &
385 "Only the MM atoms itself", &
386 "The full molecule/residue that contains a MM atom"), &
392 description=
"In a QM/MM run all QM atoms are specified as a whole ensemble to be thermostated", &
393 usage=
"QM_SUBSYS (NONE|ATOMIC|MOLECULAR)", &
394 enum_c_vals=
s2a(
"NONE",
"ATOMIC",
"MOLECULAR"), &
395 enum_desc=
s2a(
"Thermostat nothing", &
396 "Only the QM atoms itself", &
397 "The full molecule/residue that contains a QM atom"), &
410 SUBROUTINE create_nose_section(section)
416 cpassert(.NOT.
ASSOCIATED(section))
418 description=
"paramameters of the Nose Hoover thermostat chain", &
421 NULLIFY (keyword, subsection)
423 description=
"length of the Nose-Hoover chain", usage=
"length integer", &
429 description=
"order of the yoshida integrator used for the thermostat", &
430 usage=
"Yoshida integer", &
436 description=
"timeconstant of the thermostat chain", &
437 usage=
"timecon <REAL>", &
444 variants=
s2a(
"multiple_time_steps",
"mult_t_steps"), &
445 description=
"number of multiple timesteps to be used for the NoseHoover chain", &
446 usage=
"mts integer", &
451 CALL create_coord_section(subsection,
"NOSE HOOVER")
455 CALL create_velocity_section(subsection,
"NOSE HOOVER")
463 CALL create_force_section(subsection,
"NOSE HOOVER")
467 END SUBROUTINE create_nose_section
481 cpassert(.NOT.
ASSOCIATED(section))
483 description=
"paramameters of the gle thermostat. This section can be generated "// &
484 "from <https://gle4md.org/index.html?page=matrix>.", &
487 NULLIFY (keyword, subsection)
490 description=
"Size of the gle matrix", usage=
"NDIM 6", &
496 description=
"scaling factor for matrix A (for generic matrix A, depends "// &
497 "on the characteristic frequency of the system).", usage=
"A_SCALE 0.5", &
503 description=
"A matrix The defaults give optimal sampling for most "// &
504 "cristalline and liquid compounds. Generated with the parameters set kv_4-4.a "// &
505 "centered on w_0=40 cm^-1.", usage=
"A_LIST real real real", &
506 type_of_var=
real_t, unit_str=
"internal_cp2k", &
507 n_var=-1, repeats=.true.)
518 description=
"C matrix", usage=
"C_LIST real real real", &
520 type_of_var=
real_t, n_var=-1, repeats=.true.)
524 CALL create_thermo_energy_section(subsection)
532 CALL create_gles_section(subsection)
543 SUBROUTINE create_gles_section(section)
548 cpassert(.NOT.
ASSOCIATED(section))
550 description=
"The s variable for GLE used for restart", &
551 n_keywords=1, n_subsections=0, repeats=.false.)
554 CALL keyword_create(keyword, __location__, name=
"_DEFAULT_KEYWORD_", &
555 description=
"Specify s variable for GLE thermostat ", repeats=.false., &
556 usage=
"{Real} ...", type_of_var=
real_t, n_var=-1)
560 END SUBROUTINE create_gles_section
567 SUBROUTINE create_csvr_section(section)
573 cpassert(.NOT.
ASSOCIATED(section))
575 description=
"Parameters of the canonical sampling through velocity rescaling thermostat.", &
578 NULLIFY (keyword, subsection)
581 description=
"Time constant of the CSVR thermostat. A small time "// &
582 "constant will result in strong thermostatting (useful for "// &
583 "initial equilibrations) and a large time constant would be adequate "// &
584 "to get weak thermostatting in production runs.", &
585 usage=
"timecon <REAL>", &
591 CALL create_thermo_energy_section(subsection)
599 END SUBROUTINE create_csvr_section
606 SUBROUTINE create_al_section(section)
612 cpassert(.NOT.
ASSOCIATED(section))
614 description=
"Parameters of the adaptive-Langevin thermostat."// &
615 " Known to work with NVT ensemble, but not tested with"// &
616 " other ensembles. Also tested with FIXED_ATOMS constraints, but"// &
617 " may not work with other constraints (restraints should be OK, but"// &
618 " haven't been well tested)", &
621 NULLIFY (keyword, subsection)
624 description=
"Time constant of the Nose-Hoover part of the AD_LANGEVIN thermostat. A small time "// &
625 "constant will result in strong thermostatting (useful for "// &
626 "initial equilibrations) and a large time constant would be adequate "// &
627 "to get weak thermostatting in production runs.", &
628 usage=
"timecon_nh <REAL>", &
634 CALL keyword_create(keyword, __location__, name=
"timecon_langevin", &
635 description=
"Time constant of the Langevin part of the AD_LANGEVIN thermostat. A small time "// &
636 "constant will result in strong thermostatting (useful for "// &
637 "initial equilibrations) and a large time constant would be adequate "// &
638 "to get weak thermostatting in production runs.", &
639 usage=
"timecon_langevin <REAL>", &
645 CALL create_thermo_chi_mass_section(subsection,
"CHI")
649 CALL create_thermo_chi_mass_section(subsection,
"MASS")
653 END SUBROUTINE create_al_section
661 SUBROUTINE create_thermo_chi_mass_section(section, sec_name)
663 CHARACTER(len=*) :: sec_name
667 cpassert(.NOT.
ASSOCIATED(section))
669 description=
"Information to initialize the Ad-Langevin thermostat DOF "//trim(sec_name), &
670 n_keywords=1, n_subsections=0, repeats=.false.)
673 CALL keyword_create(keyword, __location__, name=
"_DEFAULT_KEYWORD_", &
674 description=
"Specify an initial thermostat DOF "//trim(sec_name)// &
675 " for Ad-Langevin thermostat.", repeats=.true., &
676 unit_str=
"fs^-1", type_of_var=
real_t)
680 END SUBROUTINE create_thermo_chi_mass_section
687 SUBROUTINE create_thermo_energy_section(section)
692 cpassert(.NOT.
ASSOCIATED(section))
693 CALL section_create(section, __location__, name=
"THERMOSTAT_ENERGY", &
694 description=
"Information to initialize the CSVR thermostat energy.", &
695 n_keywords=1, n_subsections=0, repeats=.false.)
698 CALL keyword_create(keyword, __location__, name=
"_DEFAULT_KEYWORD_", &
699 description=
"Specify an initial thermostat energy for CSVR thermostat.", &
700 repeats=.true., unit_str=
"internal_cp2k", type_of_var=
real_t)
704 END SUBROUTINE create_thermo_energy_section
712 SUBROUTINE create_force_section(section, name)
714 CHARACTER(LEN=*),
INTENT(IN) :: name
718 cpassert(.NOT.
ASSOCIATED(section))
720 description=
"The forces for "//trim(name)//
" used for restart", &
721 n_keywords=1, n_subsections=0, repeats=.false.)
724 CALL keyword_create(keyword, __location__, name=
"_DEFAULT_KEYWORD_", &
725 description=
"Specify masses of the system", repeats=.false., &
726 usage=
"{Real} ...", type_of_var=
real_t, n_var=-1)
730 END SUBROUTINE create_force_section
740 CHARACTER(LEN=*),
INTENT(IN) :: name
744 cpassert(.NOT.
ASSOCIATED(section))
746 description=
"The masses for "//trim(name)//
" used for restart", &
747 n_keywords=1, n_subsections=0, repeats=.false.)
750 CALL keyword_create(keyword, __location__, name=
"_DEFAULT_KEYWORD_", &
751 description=
"Specify masses of the system", repeats=.false., &
752 usage=
"{Real} ...", type_of_var=
real_t, n_var=-1)
764 SUBROUTINE create_velocity_section(section, name)
766 CHARACTER(LEN=*),
INTENT(IN) :: name
770 cpassert(.NOT.
ASSOCIATED(section))
772 description=
"The velocities for "//trim(name)//
" used for restart", &
773 n_keywords=1, n_subsections=0, repeats=.false.)
776 CALL keyword_create(keyword, __location__, name=
"_DEFAULT_KEYWORD_", &
777 description=
"Specify velocities of the system", repeats=.true., &
778 usage=
"{Real} ...", type_of_var=
real_t, n_var=-1)
782 END SUBROUTINE create_velocity_section
790 SUBROUTINE create_coord_section(section, name)
792 CHARACTER(LEN=*),
INTENT(IN) :: name
796 cpassert(.NOT.
ASSOCIATED(section))
798 description=
"The positions for "//trim(name)//
" used for restart", &
799 n_keywords=1, n_subsections=0, repeats=.false.)
802 CALL keyword_create(keyword, __location__, name=
"_DEFAULT_KEYWORD_", &
803 description=
"Specify positions of the system", repeats=.true., &
804 usage=
"{Real} ...", type_of_var=
real_t, n_var=-1)
808 END SUBROUTINE create_coord_section
collects all references to literature in CP2K as new algorithms / method are included from literature...
integer, save, public nose1984a
integer, save, public ceriotti2009
integer, save, public jones2011
integer, save, public nose1984b
integer, save, public bussi2007
integer, save, public ceriotti2009b
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer, parameter, public low_print_level
integer, parameter, public high_print_level
subroutine, public cp_print_key_section_create(print_key_section, location, name, description, print_level, each_iter_names, each_iter_values, add_last, filename, common_iter_levels, citations, unit_str)
creates a print_key section
real(kind=dp) function, public cp_unit_to_cp2k(value, unit_str, defaults, power)
converts to the internal cp2k units to the given unit
Defines the basic variable types.
integer, parameter, public dp
Utilities for string manipulations.