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||NONE)", &
251 enum_c_vals=
s2a(
"GLOBAL",
"MOLECULE",
"MASSIVE",
"DEFINED",
"NONE"), &
263 description=
"Specify the thermostat used for the constant temperature ensembles.", &
266 enum_c_vals=
s2a(
"SAME_AS_PARTICLE",
"NOSE",
"CSVR"), &
268 enum_desc=
s2a(
"Use the same kind of thermostat used for particles.", &
269 "Uses the Nose-Hoover thermostat.", &
270 "Uses the canonical sampling through velocity rescaling."))
275 CALL create_nose_section(nose_section)
279 CALL create_csvr_section(csvr_section)
287 CALL create_al_section(al_section)
292 CALL create_print_section(subsection)
303 SUBROUTINE create_print_section(section)
308 cpassert(.NOT.
ASSOCIATED(section))
311 description=
"Collects all print_keys for thermostat", &
312 n_keywords=1, n_subsections=0, repeats=.false.)
315 description=
"Controls output information of the corresponding thermostat.", &
317 filename=
"__STD_OUT__")
322 description=
"Controls the output of the temperatures of the regions corresponding to "// &
323 "the present thermostat", &
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, &
335 END SUBROUTINE create_print_section
345 CHARACTER(LEN=*),
INTENT(IN) :: label
349 cpassert(.NOT.
ASSOCIATED(section))
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 n_keywords=1, n_subsections=0, repeats=.true.)
358 description=
"Specifies a list of atoms to thermostat.", &
359 usage=
"LIST {integer} {integer} .. {integer}", repeats=.true., &
365 variants=(/
"SEGNAME"/), &
366 description=
"Specifies the name of the molecules to thermostat", &
367 usage=
"MOLNAME WAT MEOH", repeats=.true., &
368 n_var=-1, type_of_var=
char_t)
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"), &
378 enum_desc=
s2a(
"Thermostat nothing", &
379 "Only the MM atoms itself", &
380 "The full molecule/residue that contains a MM atom"), &
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"), &
404 SUBROUTINE create_nose_section(section)
410 cpassert(.NOT.
ASSOCIATED(section))
412 description=
"paramameters of the Nose Hoover thermostat chain", &
415 NULLIFY (keyword, subsection)
417 description=
"length of the Nose-Hoover chain", usage=
"length integer", &
423 description=
"order of the yoshida integrator used for the thermostat", &
424 usage=
"Yoshida integer", &
430 description=
"timeconstant of the thermostat chain", &
431 usage=
"timecon <REAL>", &
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", &
445 CALL create_coord_section(subsection,
"NOSE HOOVER")
449 CALL create_velocity_section(subsection,
"NOSE HOOVER")
457 CALL create_force_section(subsection,
"NOSE HOOVER")
461 END SUBROUTINE create_nose_section
475 cpassert(.NOT.
ASSOCIATED(section))
477 description=
"paramameters of the gle thermostat. This section can be generated "// &
478 "from <https://gle4md.org/index.html?page=matrix>.", &
481 NULLIFY (keyword, subsection)
484 description=
"Size of the gle matrix", usage=
"NDIM 6", &
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", &
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 n_var=-1, repeats=.true.)
512 description=
"C matrix", usage=
"C_LIST real real real", &
514 type_of_var=
real_t, n_var=-1, repeats=.true.)
518 CALL create_thermo_energy_section(subsection)
526 CALL create_gles_section(subsection)
537 SUBROUTINE create_gles_section(section)
542 cpassert(.NOT.
ASSOCIATED(section))
544 description=
"The s variable for GLE used for restart", &
545 n_keywords=1, n_subsections=0, repeats=.false.)
548 CALL keyword_create(keyword, __location__, name=
"_DEFAULT_KEYWORD_", &
549 description=
"Specify s variable for GLE thermostat ", repeats=.false., &
550 usage=
"{Real} ...", type_of_var=
real_t, n_var=-1)
554 END SUBROUTINE create_gles_section
561 SUBROUTINE create_csvr_section(section)
567 cpassert(.NOT.
ASSOCIATED(section))
569 description=
"Parameters of the canonical sampling through velocity rescaling thermostat.", &
572 NULLIFY (keyword, subsection)
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>", &
585 CALL create_thermo_energy_section(subsection)
593 END SUBROUTINE create_csvr_section
600 SUBROUTINE create_al_section(section)
606 cpassert(.NOT.
ASSOCIATED(section))
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)", &
615 NULLIFY (keyword, subsection)
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>", &
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>", &
639 CALL create_thermo_chi_mass_section(subsection,
"CHI")
643 CALL create_thermo_chi_mass_section(subsection,
"MASS")
647 END SUBROUTINE create_al_section
655 SUBROUTINE create_thermo_chi_mass_section(section, sec_name)
657 CHARACTER(len=*) :: sec_name
661 cpassert(.NOT.
ASSOCIATED(section))
663 description=
"Information to initialize the Ad-Langevin thermostat DOF "//trim(sec_name), &
664 n_keywords=1, n_subsections=0, repeats=.false.)
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 unit_str=
"fs^-1", type_of_var=
real_t)
674 END SUBROUTINE create_thermo_chi_mass_section
681 SUBROUTINE create_thermo_energy_section(section)
686 cpassert(.NOT.
ASSOCIATED(section))
687 CALL section_create(section, __location__, name=
"THERMOSTAT_ENERGY", &
688 description=
"Information to initialize the CSVR thermostat energy.", &
689 n_keywords=1, n_subsections=0, repeats=.false.)
692 CALL keyword_create(keyword, __location__, name=
"_DEFAULT_KEYWORD_", &
693 description=
"Specify an initial thermostat energy for CSVR thermostat.", &
694 repeats=.true., unit_str=
"internal_cp2k", type_of_var=
real_t)
698 END SUBROUTINE create_thermo_energy_section
706 SUBROUTINE create_force_section(section, name)
708 CHARACTER(LEN=*),
INTENT(IN) :: name
712 cpassert(.NOT.
ASSOCIATED(section))
714 description=
"The forces for "//trim(name)//
" used for restart", &
715 n_keywords=1, n_subsections=0, repeats=.false.)
718 CALL keyword_create(keyword, __location__, name=
"_DEFAULT_KEYWORD_", &
719 description=
"Specify masses of the system", repeats=.false., &
720 usage=
"{Real} ...", type_of_var=
real_t, n_var=-1)
724 END SUBROUTINE create_force_section
734 CHARACTER(LEN=*),
INTENT(IN) :: name
738 cpassert(.NOT.
ASSOCIATED(section))
740 description=
"The masses for "//trim(name)//
" used for restart", &
741 n_keywords=1, n_subsections=0, repeats=.false.)
744 CALL keyword_create(keyword, __location__, name=
"_DEFAULT_KEYWORD_", &
745 description=
"Specify masses of the system", repeats=.false., &
746 usage=
"{Real} ...", type_of_var=
real_t, n_var=-1)
758 SUBROUTINE create_velocity_section(section, name)
760 CHARACTER(LEN=*),
INTENT(IN) :: name
764 cpassert(.NOT.
ASSOCIATED(section))
766 description=
"The velocities for "//trim(name)//
" used for restart", &
767 n_keywords=1, n_subsections=0, repeats=.false.)
770 CALL keyword_create(keyword, __location__, name=
"_DEFAULT_KEYWORD_", &
771 description=
"Specify velocities of the system", repeats=.true., &
772 usage=
"{Real} ...", type_of_var=
real_t, n_var=-1)
776 END SUBROUTINE create_velocity_section
784 SUBROUTINE create_coord_section(section, name)
786 CHARACTER(LEN=*),
INTENT(IN) :: name
790 cpassert(.NOT.
ASSOCIATED(section))
792 description=
"The positions for "//trim(name)//
" used for restart", &
793 n_keywords=1, n_subsections=0, repeats=.false.)
796 CALL keyword_create(keyword, __location__, name=
"_DEFAULT_KEYWORD_", &
797 description=
"Specify positions of the system", repeats=.true., &
798 usage=
"{Real} ...", type_of_var=
real_t, n_var=-1)
802 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.