LCOV - code coverage report
Current view: top level - src - input_cp2k_thermostats.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:42dac4a) Lines: 97.7 % 257 251
Test Date: 2025-07-25 12:55:17 Functions: 100.0 % 16 16

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

Generated by: LCOV version 2.0-1