LCOV - code coverage report
Current view: top level - src/motion - input_cp2k_md.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:c24029e) Lines: 100.0 % 519 519
Test Date: 2026-07-04 06:36:57 Functions: 100.0 % 15 15

            Line data    Source code
       1              : !--------------------------------------------------------------------------------------------------!
       2              : !   CP2K: A general program to perform molecular dynamics simulations                              !
       3              : !   Copyright 2000-2026 CP2K developers group <https://cp2k.org>                                   !
       4              : !                                                                                                  !
       5              : !   SPDX-License-Identifier: GPL-2.0-or-later                                                      !
       6              : !--------------------------------------------------------------------------------------------------!
       7              : 
       8              : ! **************************************************************************************************
       9              : !> \par History
      10              : !>      - taken out of input_cp2k_motion
      11              : !> \author Ole Schuett
      12              : ! **************************************************************************************************
      13              : 
      14              : MODULE input_cp2k_md
      15              :    USE bibliography,                    ONLY: &
      16              :         Evans1983, Guidon2008, Kantorovich2008, Kantorovich2008a, Kuhne2007, Minary2003, &
      17              :         Rengaraj2020, Ricci2003, Tuckerman1992, VandeVondele2002, West2006
      18              :    USE cp_output_handling,              ONLY: add_last_numeric,&
      19              :                                               cp_print_key_section_create,&
      20              :                                               debug_print_level,&
      21              :                                               high_print_level,&
      22              :                                               low_print_level,&
      23              :                                               medium_print_level
      24              :    USE cp_units,                        ONLY: cp_unit_to_cp2k
      25              :    USE fparser,                         ONLY: docf
      26              :    USE input_constants,                 ONLY: &
      27              :         do_constr_atomic, do_constr_molec, do_constr_none, isokin_ensemble, langevin_ensemble, &
      28              :         md_init_default, md_init_vib, npe_f_ensemble, npe_i_ensemble, nph_ensemble, &
      29              :         nph_uniaxial_damped_ensemble, nph_uniaxial_ensemble, npt_f_ensemble, npt_i_ensemble, &
      30              :         npt_ia_ensemble, nve_ensemble, nvt_adiabatic_ensemble, nvt_ensemble, reftraj_ensemble
      31              :    USE input_cp2k_barostats,            ONLY: create_barostat_section
      32              :    USE input_cp2k_thermostats,          ONLY: create_region_section,&
      33              :                                               create_thermo_fast_section,&
      34              :                                               create_thermo_slow_section,&
      35              :                                               create_thermostat_section
      36              :    USE input_keyword_types,             ONLY: keyword_create,&
      37              :                                               keyword_release,&
      38              :                                               keyword_type
      39              :    USE input_section_types,             ONLY: section_add_keyword,&
      40              :                                               section_add_subsection,&
      41              :                                               section_create,&
      42              :                                               section_release,&
      43              :                                               section_type
      44              :    USE input_val_types,                 ONLY: char_t,&
      45              :                                               integer_t,&
      46              :                                               lchar_t,&
      47              :                                               real_t
      48              :    USE kinds,                           ONLY: dp
      49              :    USE reftraj_types,                   ONLY: REFTRAJ_EVAL_ENERGY,&
      50              :                                               REFTRAJ_EVAL_ENERGY_FORCES,&
      51              :                                               REFTRAJ_EVAL_NONE,&
      52              :                                               REFTRAJ_WRAP_CENTRAL,&
      53              :                                               REFTRAJ_WRAP_NONE,&
      54              :                                               REFTRAJ_WRAP_POSITIVE
      55              :    USE string_utilities,                ONLY: newline,&
      56              :                                               s2a
      57              : #include "../base/base_uses.f90"
      58              : 
      59              :    IMPLICIT NONE
      60              :    PRIVATE
      61              : 
      62              :    LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .TRUE.
      63              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_md'
      64              : 
      65              :    PUBLIC :: create_md_section
      66              : 
      67              : CONTAINS
      68              : 
      69              : ! **************************************************************************************************
      70              : !> \brief ...
      71              : !> \param section will contain the md section
      72              : !> \author fawzi
      73              : ! **************************************************************************************************
      74        30706 :    SUBROUTINE create_md_section(section)
      75              :       TYPE(section_type), POINTER                        :: section
      76              : 
      77              :       TYPE(keyword_type), POINTER                        :: keyword
      78              :       TYPE(section_type), POINTER                        :: subsection
      79              : 
      80        30706 :       CPASSERT(.NOT. ASSOCIATED(section))
      81              :       CALL section_create(section, __LOCATION__, name="MD", &
      82              :                           description="This section defines the whole set of parameters needed perform an MD run.", &
      83        30706 :                           n_keywords=13, n_subsections=6, repeats=.FALSE.)
      84              : 
      85        30706 :       NULLIFY (keyword, subsection)
      86              :       CALL keyword_create(keyword, __LOCATION__, name="ensemble", &
      87              :                           description="The ensemble/integrator that you want to use for MD propagation", &
      88              :                           usage="ensemble nve", &
      89              :                           default_i_val=nve_ensemble, &
      90              :                           enum_c_vals=s2a("NVE", "NVT", "NPT_I", "NPT_F", "MSST", "MSST_DAMPED", &
      91              :                                           "HYDROSTATICSHOCK", "ISOKIN", "REFTRAJ", "LANGEVIN", "NPE_F", &
      92              :                                           "NPE_I", "NVT_ADIABATIC", "NPT_IA"), &
      93              :                           enum_desc=s2a("constant energy (microcanonical)", &
      94              :                                         "constant temperature and volume (canonical)", &
      95              :                                         "constant temperature and pressure using an isotropic cell", &
      96              :                                         "constant temperature and pressure using a flexible cell", &
      97              :                                         "simulate steady shock (uniaxial)", &
      98              :                                         "simulate steady shock (uniaxial) with extra viscosity", &
      99              :                                         "simulate steady shock with hydrostatic pressure", &
     100              :                                         "constant kinetic energy", &
     101              :                                         "reading frames from a file called reftraj.xyz (e.g. for property calculation)", &
     102              :                                         "langevin dynamics (constant temperature)", &
     103              :                                         "constant pressure ensemble (no thermostat)", &
     104              :                                         "constant pressure ensemble using an isotropic cell (no thermostat)", &
     105              :                                         "adiabatic dynamics in constant temperature and volume ensemble (CAFES)", &
     106              :                                         "NPT_I ensemble with frozen atoms in absolute coordinate"), &
     107              :                           citations=[Evans1983, VandeVondele2002, Minary2003], &
     108              :                           enum_i_vals=[nve_ensemble, nvt_ensemble, npt_i_ensemble, npt_f_ensemble, &
     109              :                                        nph_uniaxial_ensemble, nph_uniaxial_damped_ensemble, nph_ensemble, isokin_ensemble, &
     110              :                                        reftraj_ensemble, langevin_ensemble, npe_f_ensemble, npe_i_ensemble, &
     111       122824 :                                        nvt_adiabatic_ensemble, npt_ia_ensemble])
     112        30706 :       CALL section_add_keyword(section, keyword)
     113        30706 :       CALL keyword_release(keyword)
     114              : 
     115              :       CALL keyword_create(keyword, __LOCATION__, name="STEPS", &
     116              :                           description="The number of MD steps to perform, counting from step_start_val. ", &
     117        30706 :                           usage="STEPS 100", default_i_val=3)
     118        30706 :       CALL section_add_keyword(section, keyword)
     119        30706 :       CALL keyword_release(keyword)
     120              : 
     121              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_STEPS", &
     122              :                           description="The number of MD steps to perform, counting from step 1", &
     123        30706 :                           usage="MAX_STEPS 100", default_i_val=1000000000)
     124        30706 :       CALL section_add_keyword(section, keyword)
     125        30706 :       CALL keyword_release(keyword)
     126              : 
     127              :       CALL keyword_create(keyword, __LOCATION__, name="TIMESTEP", &
     128              :                           description="The length of an integration step (in case RESPA the large TIMESTEP)", &
     129              :                           usage="TIMESTEP 1.0", default_r_val=cp_unit_to_cp2k(value=0.5_dp, unit_str="fs"), &
     130        30706 :                           unit_str="fs")
     131        30706 :       CALL section_add_keyword(section, keyword)
     132        30706 :       CALL keyword_release(keyword)
     133              : 
     134              :       CALL keyword_create(keyword, __LOCATION__, name="STEP_START_VAL", &
     135              :                           description="The starting step value for the MD", usage="STEP_START_VAL <integer>", &
     136        30706 :                           default_i_val=0)
     137        30706 :       CALL section_add_keyword(section, keyword)
     138        30706 :       CALL keyword_release(keyword)
     139              : 
     140              :       CALL keyword_create(keyword, __LOCATION__, name="TIME_START_VAL", &
     141              :                           description="The starting timer value for the MD", &
     142              :                           usage="TIME_START_VAL <real>", default_r_val=cp_unit_to_cp2k(value=0.0_dp, unit_str="fs"), &
     143        30706 :                           unit_str="fs")
     144        30706 :       CALL section_add_keyword(section, keyword)
     145        30706 :       CALL keyword_release(keyword)
     146              : 
     147              :       CALL keyword_create(keyword, __LOCATION__, name="ECONS_START_VAL", &
     148              :                           description="The starting  value of the conserved quantity", &
     149              :                           usage="ECONS_START_VAL <real>", default_r_val=0.0_dp, &
     150        30706 :                           unit_str="hartree")
     151        30706 :       CALL section_add_keyword(section, keyword)
     152        30706 :       CALL keyword_release(keyword)
     153              : 
     154              :       CALL keyword_create(keyword, __LOCATION__, name="TEMPERATURE", &
     155              :                           description="The temperature in K used to initialize "// &
     156              :                           "the velocities with init and pos restart, and in the NPT/NVT simulations", &
     157              :                           usage="TEMPERATURE 325.0", default_r_val=cp_unit_to_cp2k(value=300.0_dp, unit_str="K"), &
     158        30706 :                           unit_str="K")
     159        30706 :       CALL section_add_keyword(section, keyword)
     160        30706 :       CALL keyword_release(keyword)
     161              : 
     162              :       CALL keyword_create(keyword, __LOCATION__, name="TEMP_TOL", &
     163              :                           variants=s2a("temp_to", "temperature_tolerance"), &
     164              :                           description="The maximum accepted deviation of the (global) temperature "// &
     165              :                           "from the desired target temperature before a rescaling of the velocities "// &
     166              :                           "is performed. If it is 0 no rescaling is performed. NOTE: This keyword is "// &
     167              :                           "obsolescent; Using a CSVR thermostat with a short timeconstant is "// &
     168              :                           "recommended as a better alternative.", &
     169        30706 :                           usage="TEMP_TOL 0.0", default_r_val=0.0_dp, unit_str='K')
     170        30706 :       CALL section_add_keyword(section, keyword)
     171        30706 :       CALL keyword_release(keyword)
     172              : 
     173              :       CALL keyword_create(keyword, __LOCATION__, name="TEMP_KIND", &
     174              :                           description="Compute the temperature per each kind separately", &
     175              :                           usage="TEMP_KIND LOGICAL", &
     176        30706 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     177        30706 :       CALL section_add_keyword(section, keyword)
     178        30706 :       CALL keyword_release(keyword)
     179              : 
     180              :       CALL keyword_create(keyword, __LOCATION__, name="SCALE_TEMP_KIND", &
     181              :                           description="When necessary rescale the temperature per each kind separately", &
     182              :                           usage="SCALE_TEMP_KIND LOGICAL", &
     183        30706 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     184        30706 :       CALL section_add_keyword(section, keyword)
     185        30706 :       CALL keyword_release(keyword)
     186              : 
     187              :       CALL keyword_create(keyword, __LOCATION__, name="COMVEL_TOL", &
     188              :                           description="The maximum accepted velocity of the center of mass. "// &
     189              :                           "With Shell-Model, comvel may drift if MD%THERMOSTAT%REGION /= GLOBAL ", &
     190        30706 :                           usage="COMVEL_TOL 0.1", type_of_var=real_t, n_var=1, unit_str="bohr*au_t^-1")
     191        30706 :       CALL section_add_keyword(section, keyword)
     192        30706 :       CALL keyword_release(keyword)
     193              : 
     194              :       CALL keyword_create(keyword, __LOCATION__, name="ANGVEL_TOL", &
     195              :                           description="The maximum accepted angular velocity. This option is ignored "// &
     196              :                           "when the system is periodic. Removes the components of the velocities that "// &
     197              :                           "project on the external rotational degrees of freedom.", &
     198        30706 :                           usage="ANGVEL_TOL 0.1", type_of_var=real_t, n_var=1, unit_str="bohr*au_t^-1")
     199        30706 :       CALL section_add_keyword(section, keyword)
     200        30706 :       CALL keyword_release(keyword)
     201              : 
     202              :       CALL keyword_create(keyword, __LOCATION__, name="ANGVEL_ZERO", &
     203              :                           description="Set the initial angular velocity to zero. This option is ignored "// &
     204              :                           "when the system is periodic or when initial velocities are defined. Technically, "// &
     205              :                           "the part of the random initial velocities that projects on the external "// &
     206              :                           "rotational degrees of freedom is subtracted.", &
     207              :                           usage="ANGVEL_ZERO LOGICAL", &
     208        30706 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     209        30706 :       CALL section_add_keyword(section, keyword)
     210        30706 :       CALL keyword_release(keyword)
     211              : 
     212              :       CALL keyword_create(keyword, __LOCATION__, name="ANNEALING", &
     213              :                           description="Specifies the rescaling factor for annealing velocities. "// &
     214              :                           "Automatically enables the annealing procedure. This scheme works only for ensembles "// &
     215              :                           "that do not have thermostats on particles.", &
     216        30706 :                           usage="annealing <REAL>", default_r_val=1.0_dp)
     217        30706 :       CALL section_add_keyword(section, keyword)
     218        30706 :       CALL keyword_release(keyword)
     219              : 
     220              :       CALL keyword_create(keyword, __LOCATION__, name="ANNEALING_CELL", &
     221              :                           description="Specifies the rescaling factor for annealing velocities of the CELL "// &
     222              :                           "Automatically enables the annealing procedure for the CELL. This scheme works only "// &
     223              :                           "for ensambles that do not have thermostat on CELLS velocities.", &
     224        30706 :                           usage="ANNEALING_CELL <REAL>", default_r_val=1.0_dp)
     225        30706 :       CALL section_add_keyword(section, keyword)
     226        30706 :       CALL keyword_release(keyword)
     227              : 
     228              :       CALL keyword_create(keyword, __LOCATION__, name="TEMPERATURE_ANNEALING", &
     229              :                           description="Specifies the rescaling factor for the external temperature. "// &
     230              :                           "This scheme works only for the Langevin ensemble.", &
     231        30706 :                           usage="TEMPERATURE_ANNEALING <REAL>", default_r_val=1.0_dp)
     232        30706 :       CALL section_add_keyword(section, keyword)
     233        30706 :       CALL keyword_release(keyword)
     234              : 
     235              :       CALL keyword_create(keyword, __LOCATION__, name="DISPLACEMENT_TOL", &
     236              :                           description="This keyword sets a maximum atomic displacement "// &
     237              :                           "in each Cartesian direction. "// &
     238              :                           "The maximum velocity is evaluated and if it is too large to remain "// &
     239              :                           "within the assigned limit, the time step is rescaled accordingly, "// &
     240              :                           "and the first half step of the velocity verlet is repeated.", &
     241              :                           usage="DISPLACEMENT_TOL <REAL>", default_r_val=100.0_dp, &
     242        30706 :                           unit_str='angstrom')
     243        30706 :       CALL section_add_keyword(section, keyword)
     244        30706 :       CALL keyword_release(keyword)
     245              : 
     246              :       CALL keyword_create(keyword, __LOCATION__, name="INITIALIZATION_METHOD", &
     247              :                           description="This keyword selects which method to use to initialize MD. "// &
     248              :                           "If velecities are not set explicitly, DEFAULT optioin will assign "// &
     249              :                           "random velocities and then scale according to TEMPERATURE; VIBRATIONAL "// &
     250              :                           "option will then use previously calculated vibrational modes to "// &
     251              :                           "initialise both the atomic positions and velocities so that the "// &
     252              :                           "starting point for MD is as close to canonical ensemble as possible, "// &
     253              :                           "without the need for lengthy equilibration steps. See PRL 96, 115504 "// &
     254              :                           "(2006). The user input atomic positions in this case are expected to "// &
     255              :                           "be already geometry optimised. Further options for VIBRATIONAL mode "// &
     256              :                           "is can be set in INITIAL_VIBRATION subsection. If unspecified, then "// &
     257              :                           "the DEFAULT mode will be used.", &
     258              :                           usage="INITIALIZATION_METHOD DEFAULT", &
     259              :                           default_i_val=md_init_default, &
     260              :                           enum_c_vals=s2a("DEFAULT", "VIBRATIONAL"), &
     261              :                           enum_desc=s2a("Assign random velocities and then scale according to "// &
     262              :                                         "TEMPERATURE", &
     263              :                                         "Initialise positions and velocities to give canonical ensemble "// &
     264              :                                         "with TEMPERATURE, using the method described in PRL 96, 115504 (2006)"), &
     265        30706 :                           enum_i_vals=[md_init_default, md_init_vib])
     266        30706 :       CALL section_add_keyword(section, keyword)
     267        30706 :       CALL keyword_release(keyword)
     268              : 
     269        30706 :       CALL create_langevin_section(subsection)
     270        30706 :       CALL section_add_subsection(section, subsection)
     271        30706 :       CALL section_release(subsection)
     272              : 
     273        30706 :       CALL create_msst_section(subsection)
     274        30706 :       CALL section_add_subsection(section, subsection)
     275        30706 :       CALL section_release(subsection)
     276              : 
     277        30706 :       CALL create_barostat_section(subsection)
     278        30706 :       CALL section_add_subsection(section, subsection)
     279        30706 :       CALL section_release(subsection)
     280              : 
     281        30706 :       CALL create_thermostat_section(subsection)
     282        30706 :       CALL section_add_subsection(section, subsection)
     283        30706 :       CALL section_release(subsection)
     284              : 
     285        30706 :       CALL create_respa_section(subsection)
     286        30706 :       CALL section_add_subsection(section, subsection)
     287        30706 :       CALL section_release(subsection)
     288              : 
     289        30706 :       CALL create_shell_section(subsection)
     290        30706 :       CALL section_add_subsection(section, subsection)
     291        30706 :       CALL section_release(subsection)
     292              : 
     293        30706 :       CALL create_adiabatic_section(subsection)
     294        30706 :       CALL section_add_subsection(section, subsection)
     295        30706 :       CALL section_release(subsection)
     296              : 
     297        30706 :       CALL create_softening_section(subsection)
     298        30706 :       CALL section_add_subsection(section, subsection)
     299        30706 :       CALL section_release(subsection)
     300              : 
     301        30706 :       CALL create_reftraj_section(subsection)
     302        30706 :       CALL section_add_subsection(section, subsection)
     303        30706 :       CALL section_release(subsection)
     304              : 
     305        30706 :       CALL create_avgs_section(subsection)
     306        30706 :       CALL section_add_subsection(section, subsection)
     307        30706 :       CALL section_release(subsection)
     308              : 
     309        30706 :       CALL create_thermal_region_section(subsection)
     310        30706 :       CALL section_add_subsection(section, subsection)
     311        30706 :       CALL section_release(subsection)
     312              : 
     313        30706 :       CALL create_md_print_section(subsection)
     314        30706 :       CALL section_add_subsection(section, subsection)
     315        30706 :       CALL section_release(subsection)
     316              : 
     317        30706 :       CALL create_cascade_section(subsection)
     318        30706 :       CALL section_add_subsection(section, subsection)
     319        30706 :       CALL section_release(subsection)
     320              : 
     321        30706 :       CALL create_vib_init_section(subsection)
     322        30706 :       CALL section_add_subsection(section, subsection)
     323        30706 :       CALL section_release(subsection)
     324              : 
     325        30706 :    END SUBROUTINE create_md_section
     326              : 
     327              : ! **************************************************************************************************
     328              : !> \brief Defines LANGEVIN section
     329              : !> \param section ...
     330              : !> \author teo
     331              : ! **************************************************************************************************
     332        30706 :    SUBROUTINE create_langevin_section(section)
     333              :       TYPE(section_type), POINTER                        :: section
     334              : 
     335              :       TYPE(keyword_type), POINTER                        :: keyword
     336              : 
     337        30706 :       CPASSERT(.NOT. ASSOCIATED(section))
     338              :       CALL section_create(section, __LOCATION__, name="Langevin", &
     339              :                           description="Controls the set of parameters to run a Langevin MD. "// &
     340              :                           "The integrator used follows that given in the article by Ricci et al. "// &
     341              :                           "The user can define regions in the system where the atoms inside "// &
     342              :                           "undergoes Langevin MD, while those outside the regions undergoes "// &
     343              :                           "NVE Born Oppenheimer MD. To define the regions, the user should "// &
     344              :                           "use THERMAL_REGION subsection of MOTION%MD. ", &
     345              :                           citations=[Ricci2003, Kuhne2007, Rengaraj2020], &
     346       122824 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
     347        30706 :       NULLIFY (keyword)
     348              : 
     349              :       CALL keyword_create(keyword, __LOCATION__, name="gamma", &
     350              :                           description="Gamma parameter for the Langevin dynamics (LD)", &
     351              :                           usage="gamma 0.001", &
     352        30706 :                           default_r_val=0.0_dp, unit_str='fs^-1')
     353        30706 :       CALL section_add_keyword(section, keyword)
     354        30706 :       CALL keyword_release(keyword)
     355              : 
     356              :       CALL keyword_create(keyword, __LOCATION__, name="Noisy_Gamma", &
     357              :                           variants=["NoisyGamma"], &
     358              :                           description="Imaginary Langevin Friction term for LD with noisy forces.", &
     359              :                           citations=[Kuhne2007], &
     360        92118 :                           usage="Noisy_Gamma 4.0E-5", default_r_val=0.0_dp, unit_str='fs^-1')
     361        30706 :       CALL section_add_keyword(section, keyword)
     362        30706 :       CALL keyword_release(keyword)
     363              : 
     364              :       CALL keyword_create(keyword, __LOCATION__, name="Shadow_Gamma", &
     365              :                           variants=["ShadowGamma"], &
     366              :                           description="Shadow Langevin Friction term for LD with noisy forces in order to adjust Noisy_Gamma.", &
     367              :                           citations=[Rengaraj2020], &
     368        92118 :                           usage="Shadow_Gamma 0.001", default_r_val=0.0_dp, unit_str='fs^-1')
     369        30706 :       CALL section_add_keyword(section, keyword)
     370        30706 :       CALL keyword_release(keyword)
     371        30706 :    END SUBROUTINE create_langevin_section
     372              : 
     373              : ! **************************************************************************************************
     374              : !> \brief Defines print section for MD
     375              : !> \param section ...
     376              : !> \author teo
     377              : ! **************************************************************************************************
     378        30706 :    SUBROUTINE create_md_print_section(section)
     379              :       TYPE(section_type), POINTER                        :: section
     380              : 
     381              :       TYPE(keyword_type), POINTER                        :: keyword
     382              :       TYPE(section_type), POINTER                        :: print_key
     383              : 
     384        30706 :       CPASSERT(.NOT. ASSOCIATED(section))
     385              :       CALL section_create(section, __LOCATION__, name="print", &
     386              :                           description="Controls the printing properties during an MD run", &
     387        30706 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
     388        30706 :       NULLIFY (print_key, keyword)
     389              : 
     390              :       CALL keyword_create(keyword, __LOCATION__, name="FORCE_LAST", &
     391              :                           description="Print the output and restart file if walltime is reached or "// &
     392              :                           "if an external EXIT command is given. It still requires the keyword LAST "// &
     393              :                           "to be present for the specific print key (in case the last step should not "// &
     394              :                           "match with the print_key iteration number).", &
     395              :                           usage="FORCE_LAST LOGICAL", &
     396        30706 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     397        30706 :       CALL section_add_keyword(section, keyword)
     398        30706 :       CALL keyword_release(keyword)
     399              : 
     400              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "ENERGY", &
     401              :                                        description="Controls the output the ener file", &
     402              :                                        print_level=low_print_level, common_iter_levels=1, &
     403        30706 :                                        filename="")
     404        30706 :       CALL section_add_subsection(section, print_key)
     405        30706 :       CALL section_release(print_key)
     406              : 
     407              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "SHELL_ENERGY", &
     408              :                                        description="Controls the output of the shell-energy file (only if shell-model)", &
     409              :                                        print_level=medium_print_level, common_iter_levels=1, &
     410        30706 :                                        filename="")
     411        30706 :       CALL section_add_subsection(section, print_key)
     412        30706 :       CALL section_release(print_key)
     413              : 
     414              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "TEMP_KIND", &
     415              :                                        description="Controls the output of the temperature"// &
     416              :                                        " computed separately for each kind", &
     417              :                                        print_level=high_print_level, common_iter_levels=1, &
     418        30706 :                                        filename="")
     419        30706 :       CALL section_add_subsection(section, print_key)
     420        30706 :       CALL section_release(print_key)
     421              : 
     422              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "TEMP_SHELL_KIND", &
     423              :                                        description="Controls the output of the temperature of the"// &
     424              :                                        " shell-core motion computed separately for each kind", &
     425              :                                        print_level=high_print_level, common_iter_levels=1, &
     426        30706 :                                        filename="")
     427        30706 :       CALL section_add_subsection(section, print_key)
     428        30706 :       CALL section_release(print_key)
     429              : 
     430              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "CENTER_OF_MASS", &
     431              :                                        description="Controls the printing of COM velocity during an MD", &
     432              :                                        print_level=medium_print_level, common_iter_levels=1, &
     433        30706 :                                        filename="__STD_OUT__")
     434        30706 :       CALL section_add_subsection(section, print_key)
     435        30706 :       CALL section_release(print_key)
     436              : 
     437              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "COEFFICIENTS", &
     438              :                                        description="Controls the printing of coefficients during an MD run.", &
     439              :                                        print_level=medium_print_level, common_iter_levels=1, &
     440        30706 :                                        filename="")
     441        30706 :       CALL section_add_subsection(section, print_key)
     442        30706 :       CALL section_release(print_key)
     443              : 
     444              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "ROTATIONAL_INFO", &
     445              :                                        description="Controls the printing basic info during the calculation of the "// &
     446              :                                        "translational/rotational degrees of freedom.", print_level=low_print_level, &
     447        30706 :                                        add_last=add_last_numeric, filename="__STD_OUT__")
     448              :       CALL keyword_create(keyword, __LOCATION__, name="COORDINATES", &
     449              :                           description="Prints atomic coordinates in the standard orientation. "// &
     450              :                           "Coordinates are not affected during the calculation.", &
     451        30706 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     452        30706 :       CALL section_add_keyword(print_key, keyword)
     453        30706 :       CALL keyword_release(keyword)
     454        30706 :       CALL section_add_subsection(section, print_key)
     455        30706 :       CALL section_release(print_key)
     456              : 
     457              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PROGRAM_RUN_INFO", &
     458              :                                        description="Controls the printing of basic and summary information during the"// &
     459              :                                        " Molecular Dynamics", &
     460        30706 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
     461        30706 :       CALL section_add_subsection(section, print_key)
     462        30706 :       CALL section_release(print_key)
     463        30706 :    END SUBROUTINE create_md_print_section
     464              : 
     465              : ! **************************************************************************************************
     466              : !> \brief Defines parameters for RESPA integration scheme
     467              : !> \param section will contain the coeff section
     468              : !> \author teo
     469              : ! **************************************************************************************************
     470        30706 :    SUBROUTINE create_respa_section(section)
     471              :       TYPE(section_type), POINTER                        :: section
     472              : 
     473              :       TYPE(keyword_type), POINTER                        :: keyword
     474              : 
     475        30706 :       CPASSERT(.NOT. ASSOCIATED(section))
     476              : 
     477              :       CALL section_create(section, __LOCATION__, name="RESPA", &
     478              :                           description="Multiple timestep integration based on RESPA (implemented for NVE only)."// &
     479              :                           " RESPA exploits multiple force_eval."// &
     480              :                           " In this case the order of the force_eval maps"// &
     481              :                           " the order of the respa shells from the slowest to the fastest force evaluation."// &
     482              :                           " If force_evals share the same subsys, it's enough then to specify the"// &
     483              :                           " subsys in the force_eval corresponding at the first index in the multiple_force_eval list."// &
     484              :                           " Can be used to speedup classical and ab initio MD simulations.", &
     485              :                           n_keywords=1, n_subsections=0, repeats=.FALSE., &
     486        92118 :                           citations=[Tuckerman1992, Guidon2008])
     487              : 
     488        30706 :       NULLIFY (keyword)
     489              :       CALL keyword_create(keyword, __LOCATION__, name="FREQUENCY", &
     490              :                           description="The number of reference MD steps between two RESPA corrections.", &
     491        30706 :                           usage="FREQUENCY <INTEGER>", default_i_val=5)
     492        30706 :       CALL section_add_keyword(section, keyword)
     493        30706 :       CALL keyword_release(keyword)
     494              : 
     495        30706 :    END SUBROUTINE create_respa_section
     496              : 
     497              : ! **************************************************************************************************
     498              : !> \brief Defines parameters for REFTRAJ analysis
     499              : !> \param section will contain the coeff section
     500              : !> \author teo
     501              : ! **************************************************************************************************
     502        30706 :    SUBROUTINE create_reftraj_section(section)
     503              :       TYPE(section_type), POINTER                        :: section
     504              : 
     505              :       TYPE(keyword_type), POINTER                        :: keyword
     506              :       TYPE(section_type), POINTER                        :: print_key, subsection
     507              : 
     508        30706 :       CPASSERT(.NOT. ASSOCIATED(section))
     509              : 
     510              :       CALL section_create(section, __LOCATION__, name="REFTRAJ", &
     511              :                           description="Loads an external trajectory file and performs analysis on "// &
     512              :                           "the loaded snapshots; optionally, calculates per-frame potential energy, "// &
     513              :                           "forces and other properties as requested by the keyword `EVAL` below with "// &
     514              :                           "the force method specified in the `&FORCE_EVAL` section. Time integration "// &
     515              :                           "is not performed here, and quantities of velocity, temperature and kinetic "// &
     516              :                           "energy from nuclear motion are therefore irrelevant. Such a REFTRAJ run is "// &
     517              :                           "essentially a series of single-point calculations; the snapshots are not "// &
     518              :                           "necessarily from MD and may be from custom concatenation."//newline//newline// &
     519              :                           "The trajectory should be a multi-frame XYZ file where each frame has the "// &
     520              :                           "same number of atoms and kind specification as the `&FORCE_EVAL/&SUBSYS` "// &
     521              :                           "down to the exact ordering, but cell (box) size and shape can be different. "// &
     522              :                           "The comment line of each frame is parsed for additional information such "// &
     523              :                           "as cell, step, time and energy; currently the parser supports the same "// &
     524              :                           "formats as the XYZ option of `&FORCE_EVAL/&SUBSYS/&CELL/CELL_FILE_FORMAT`, "// &
     525              :                           "corresponding to trajectory files printed from `&MOTION/&PRINT/&TRAJECTORY` "// &
     526              :                           "as XYZ and EXTXYZ and from the external `dumpdcd` tool."//newline//newline// &
     527              :                           "A minimal working example trajectory in the extended XYZ format should have "// &
     528              :                           '`Lattice="<Ax> <Ay> <Az> <Bx> <By> <Bz> <Cx> <Cy> <Cz>"` for the components '// &
     529              :                           "of cell vectors A, B, C, and `Step=<integer>` for the integer timestep. "// &
     530              :                           "`Time=<real>` and `Energy=<real>` for simulation time and potential energy "// &
     531              :                           "respectively are also parsed; if omitted, the default value will be 0.0 . "// &
     532              :                           "Note that the parser is case insensitive, but whitespaces are only used "// &
     533              :                           "between key-value pairs as delimiters and not around the = signs in an "// &
     534              :                           "extended XYZ file. `Properties=species:S:1:pos:R:3` is always assumed for "// &
     535              :                           "backwards compatibility with the primitive XYZ specification: the first "// &
     536              :                           "column is a string for element symbol (or kind alias), followed by three "// &
     537              :                           "columns of real values for Cartesian coordinates in angstrom."//newline//newline// &
     538              :                           "Alternatively, the legacy brief format from `&TRAJECTORY` output where the "// &
     539              :                           "comment line starts with `i = <integer>` for the integer timestep can also "// &
     540              :                           "be used, this time with the = sign surrounded by whitespaces. The cell "// &
     541              :                           "information may come from a separate file requested by `CELL_FILE_NAME` if "// &
     542              :                           "variable, or may be taken as the `&FORCE_EVAL/&SUBSYS/&CELL` if constant.", &
     543        30706 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
     544              : 
     545        30706 :       NULLIFY (keyword, print_key, subsection)
     546              : 
     547              :       CALL keyword_create(keyword, __LOCATION__, name="TRAJ_FILE_NAME", &
     548              :                           description="Specify the filename where the trajectory is stored.", &
     549              :                           repeats=.FALSE., &
     550        30706 :                           usage="TRAJ_FILE_NAME <CHARACTER>", default_lc_val="reftraj.xyz")
     551        30706 :       CALL section_add_keyword(section, keyword)
     552        30706 :       CALL keyword_release(keyword)
     553              : 
     554              :       CALL keyword_create(keyword, __LOCATION__, name="CELL_FILE_NAME", &
     555              :                           description="Specify the filename where the cell is stored "// &
     556              :                           "(for trajectories generated within variable cell ensembles). "// &
     557              :                           "This file will be parsed only when no cell information is found "// &
     558              :                           "in the trajectory file and VARIABLE_VOLUME is set to .TRUE.", &
     559              :                           repeats=.FALSE., &
     560        30706 :                           usage="CELL_FILE_NAME <CHARACTER>", default_lc_val="reftraj.cell")
     561        30706 :       CALL section_add_keyword(section, keyword)
     562        30706 :       CALL keyword_release(keyword)
     563              : 
     564              :       CALL keyword_create(keyword, __LOCATION__, name="VARIABLE_VOLUME", &
     565              :                           description="Enables the possibility to read a CELL file with "// &
     566              :                           "information on the CELL size during the MD. This keyword will be "// &
     567              :                           "ignored if cell information is already available in the trajectory file.", &
     568        30706 :                           repeats=.FALSE., default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     569        30706 :       CALL section_add_keyword(section, keyword)
     570        30706 :       CALL keyword_release(keyword)
     571              : 
     572              :       CALL keyword_create(keyword, __LOCATION__, name="FIRST_SNAPSHOT", &
     573              :                           description="Index of the snapshot stored in the trajectory file "// &
     574              :                           "from which to start a REFTRAJ run", &
     575        30706 :                           repeats=.FALSE., usage="FIRST_SNAPSHOT <INTEGER>", default_i_val=1)
     576        30706 :       CALL section_add_keyword(section, keyword)
     577        30706 :       CALL keyword_release(keyword)
     578              : 
     579              :       CALL keyword_create(keyword, __LOCATION__, name="LAST_SNAPSHOT", &
     580              :                           description="Index of the last snapshot stored in the trajectory file "// &
     581              :                           "that is read along a REFTRAJ run. Must be specified as default is 0. "// &
     582              :                           "Must be specified exactly as LAST_SNAPSHOT = FIRST_SNAPSHOT + STRIDE*(number of strides) "// &
     583              :                           "to avoid an error 'Unexpected EOF'. Note that STRIDE*(number of strides) "// &
     584              :                           "is simply the number of steps between the first to last snapshot.", &
     585        30706 :                           repeats=.FALSE., usage="LAST_SNAPSHOT", default_i_val=0)
     586        30706 :       CALL section_add_keyword(section, keyword)
     587        30706 :       CALL keyword_release(keyword)
     588              : 
     589              :       CALL keyword_create(keyword, __LOCATION__, name="STRIDE", &
     590              :                           description=" Stride in number of snapshot for the  reftraj analysis", &
     591        30706 :                           repeats=.FALSE., usage="STRIDE", default_i_val=1)
     592        30706 :       CALL section_add_keyword(section, keyword)
     593        30706 :       CALL keyword_release(keyword)
     594              : 
     595              :       CALL keyword_create(keyword, __LOCATION__, name="EVAL", &
     596              :                           description="Selects the mode of energy and force evaluation for each "// &
     597              :                           "retrieved snapshot during a REFTRAJ run, which determines availability "// &
     598              :                           "of other properties and the time consumption in the computation. The "// &
     599              :                           "default is NONE, a conservative option useful for analyses concerning "// &
     600              :                           "structure only that are independent of force method, such as MSD and "// &
     601              :                           "`&MOTION/&PRINT/&STRUCTURE_DATA`. This keyword supersedes the logical "// &
     602              :                           "keywords `EVAL_<mode>` in older versions of the program.", &
     603              :                           default_i_val=REFTRAJ_EVAL_NONE, &
     604              :                           enum_i_vals=[REFTRAJ_EVAL_NONE, REFTRAJ_EVAL_ENERGY, REFTRAJ_EVAL_ENERGY_FORCES], &
     605              :                           enum_c_vals=s2a("NONE", "ENERGY", "ENERGY_FORCES"), &
     606              :                           enum_desc=s2a("Do not evaluate energy or force", &
     607              :                                         "Evaluate only the energy", &
     608        30706 :                                         "Evaluate energy and forces"))
     609        30706 :       CALL section_add_keyword(section, keyword)
     610        30706 :       CALL keyword_release(keyword)
     611              : 
     612              :       CALL keyword_create(keyword, __LOCATION__, name="WRAP", &
     613              :                           description="Whether and how atoms would be wrapped to inside the "// &
     614              :                           "simulation box according to periodic boundary condition before any "// &
     615              :                           "subsequent analysis. Useful when there is need to convert the raw, "// &
     616              :                           "unwrapped coordinates produced from `MOTION%PRINT%TRAJECTORY` for "// &
     617              :                           "post-processing. This keyword will be ignored when requesting MSD "// &
     618              :                           "calculation because wrapping coordinates makes displacement discontinuous.", &
     619              :                           default_i_val=REFTRAJ_WRAP_NONE, &
     620              :                           enum_i_vals=[REFTRAJ_WRAP_NONE, REFTRAJ_WRAP_POSITIVE, REFTRAJ_WRAP_CENTRAL], &
     621              :                           enum_c_vals=s2a("NONE", "POSITIVE", "CENTRAL"), &
     622              :                           enum_desc=s2a("Do not wrap atoms at all and use coordinates exactly as input", &
     623              :                                         "Wrap atoms so that fractional coordinates are within [0, 1]", &
     624        30706 :                                         "Wrap atoms so that fractional coordinates are within [-1/2, +1/2]"))
     625        30706 :       CALL section_add_keyword(section, keyword)
     626        30706 :       CALL keyword_release(keyword)
     627              : 
     628        30706 :       CALL create_msd_section(subsection)
     629        30706 :       CALL section_add_subsection(section, subsection)
     630        30706 :       CALL section_release(subsection)
     631              : 
     632              :       CALL section_create(subsection, __LOCATION__, name="print", &
     633              :                           description="The section that controls the output of a reftraj run", &
     634        30706 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     635              : 
     636        30706 :       NULLIFY (print_key)
     637              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "msd_kind", &
     638              :                                        description="Controls the output of msd per kind", &
     639              :                                        print_level=low_print_level, common_iter_levels=1, &
     640        30706 :                                        filename="")
     641        30706 :       CALL section_add_subsection(subsection, print_key)
     642        30706 :       CALL section_release(print_key)
     643              : 
     644              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "msd_molecule", &
     645              :                                        description="Controls the output of msd per molecule kind", &
     646              :                                        print_level=low_print_level, common_iter_levels=1, &
     647        30706 :                                        filename="")
     648        30706 :       CALL section_add_subsection(subsection, print_key)
     649        30706 :       CALL section_release(print_key)
     650              : 
     651              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "displaced_atom", &
     652              :                                        description="Controls the output of index and dislacement of "// &
     653              :                                        "atoms that moved away from the initial position of more than a "// &
     654              :                                        "given distance (see msd%disp_tol)", &
     655              :                                        print_level=low_print_level, common_iter_levels=1, &
     656        30706 :                                        filename="")
     657        30706 :       CALL section_add_subsection(subsection, print_key)
     658        30706 :       CALL section_release(print_key)
     659              : 
     660        30706 :       CALL section_add_subsection(section, subsection)
     661        30706 :       CALL section_release(subsection)
     662              : 
     663        30706 :    END SUBROUTINE create_reftraj_section
     664              : 
     665              : ! **************************************************************************************************
     666              : !> \brief Defines parameters for MSD calculation along a REFTRAJ analysis
     667              : !> \param section will contain the coeff section
     668              : !> \author MI
     669              : ! **************************************************************************************************
     670        30706 :    SUBROUTINE create_msd_section(section)
     671              :       TYPE(section_type), POINTER                        :: section
     672              : 
     673              :       TYPE(keyword_type), POINTER                        :: keyword
     674              :       TYPE(section_type), POINTER                        :: subsection
     675              : 
     676        30706 :       CPASSERT(.NOT. ASSOCIATED(section))
     677              : 
     678              :       CALL section_create(section, __LOCATION__, name="MSD", &
     679              :                           description="Loads an external trajectory file and performs analysis on the"// &
     680              :                           " loaded snapshots.", &
     681        30706 :                           n_keywords=3, n_subsections=0, repeats=.FALSE.)
     682              : 
     683        30706 :       NULLIFY (keyword, subsection)
     684              : 
     685              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     686              :                           description="controls the activation of core-level spectroscopy simulations", &
     687              :                           usage="&MSD T", &
     688              :                           default_l_val=.FALSE., &
     689        30706 :                           lone_keyword_l_val=.TRUE.)
     690        30706 :       CALL section_add_keyword(section, keyword)
     691        30706 :       CALL keyword_release(keyword)
     692              : 
     693              :       CALL keyword_create(keyword, __LOCATION__, name="REF0_FILENAME", &
     694              :                           description="Specify the filename where the initial reference configuration is stored.", &
     695        30706 :                           repeats=.FALSE., usage="REF0_FILENAME <CHARACTER>", default_lc_val="")
     696        30706 :       CALL section_add_keyword(section, keyword)
     697        30706 :       CALL keyword_release(keyword)
     698              : 
     699              :       CALL keyword_create(keyword, __LOCATION__, name="MSD_PER_KIND", &
     700              :                           description="Set up the calculation of the MSD for each atomic kind", &
     701              :                           usage="MSD_PER_KIND <LOGICAL>", repeats=.FALSE., &
     702        30706 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     703        30706 :       CALL section_add_keyword(section, keyword)
     704        30706 :       CALL keyword_release(keyword)
     705              : 
     706              :       CALL keyword_create(keyword, __LOCATION__, name="MSD_PER_MOLKIND", &
     707              :                           description="Set up the calculation of the MSD for each molecule kind. "// &
     708              :                           "The position of the center of mass of the molecule is considered.", &
     709              :                           usage="MSD_PER_MOLKIND <LOGICAL>", repeats=.FALSE., &
     710        30706 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     711        30706 :       CALL section_add_keyword(section, keyword)
     712        30706 :       CALL keyword_release(keyword)
     713              : 
     714              :       CALL keyword_create(keyword, __LOCATION__, name="MSD_PER_REGION", &
     715              :                           description="Set up the calculation of the MSD for each defined region.", &
     716              :                           usage="MSD_PER_REGION <LOGICAL>", repeats=.FALSE., &
     717        30706 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     718        30706 :       CALL section_add_keyword(section, keyword)
     719        30706 :       CALL keyword_release(keyword)
     720              : 
     721        30706 :       CALL create_region_section(subsection, "MSD calculation")
     722        30706 :       CALL section_add_subsection(section, subsection)
     723        30706 :       CALL section_release(subsection)
     724              : 
     725              :       CALL keyword_create(keyword, __LOCATION__, name="DISPLACED_ATOM", &
     726              :                           description="Identify the atoms that moved from their initial "// &
     727              :                           "position of a distance larger than a given tolerance (see msd%displacement_tol).", &
     728              :                           usage="DISPLACED_ATOM <LOGICAL>", repeats=.FALSE., &
     729        30706 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     730        30706 :       CALL section_add_keyword(section, keyword)
     731        30706 :       CALL keyword_release(keyword)
     732              : 
     733              :       CALL keyword_create(keyword, __LOCATION__, name="displacement_tol", &
     734              :                           description="Lower limit to define displaced atoms", &
     735              :                           usage="DISPLACEMENT_TOL real", &
     736        30706 :                           default_r_val=0._dp, n_var=1, unit_str='bohr')
     737        30706 :       CALL section_add_keyword(section, keyword)
     738        30706 :       CALL keyword_release(keyword)
     739              : 
     740        30706 :    END SUBROUTINE create_msd_section
     741              : 
     742              : ! **************************************************************************************************
     743              : !> \brief ...
     744              : !> \param section will contain the coeff section
     745              : !> \author teo
     746              : ! **************************************************************************************************
     747        30706 :    SUBROUTINE create_msst_section(section)
     748              :       TYPE(section_type), POINTER                        :: section
     749              : 
     750              :       TYPE(keyword_type), POINTER                        :: keyword
     751              : 
     752        30706 :       CPASSERT(.NOT. ASSOCIATED(section))
     753              : 
     754              :       CALL section_create(section, __LOCATION__, name="msst", &
     755              :                           description="Parameters for Multi-Scale Shock Technique (MSST) "// &
     756              :                           "which simulate the effect of a steady planar shock on a unit cell. "// &
     757              :                           "Reed et. al. Physical Review Letters 90, 235503 (2003).", &
     758        30706 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     759              : 
     760        30706 :       NULLIFY (keyword)
     761              :       CALL keyword_create(keyword, __LOCATION__, name="PRESSURE", &
     762              :                           description="Initial pressure", &
     763              :                           usage="PRESSURE real", &
     764        30706 :                           default_r_val=0._dp, n_var=1, unit_str='bar')
     765        30706 :       CALL section_add_keyword(section, keyword)
     766        30706 :       CALL keyword_release(keyword)
     767              : 
     768              :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY", &
     769              :                           description="Initial energy", &
     770              :                           usage="ENERGY real", &
     771        30706 :                           default_r_val=0._dp, n_var=1, unit_str='hartree')
     772        30706 :       CALL section_add_keyword(section, keyword)
     773        30706 :       CALL keyword_release(keyword)
     774              : 
     775              :       CALL keyword_create(keyword, __LOCATION__, name="VOLUME", &
     776              :                           description="Initial volume", &
     777              :                           usage="VOLUME real", &
     778        30706 :                           default_r_val=0._dp, n_var=1, unit_str='angstrom^3')
     779        30706 :       CALL section_add_keyword(section, keyword)
     780        30706 :       CALL keyword_release(keyword)
     781              : 
     782              :       CALL keyword_create(keyword, __LOCATION__, name="CMASS", &
     783              :                           description="Effective cell mass", &
     784              :                           usage="CMASS real", &
     785        30706 :                           default_r_val=0._dp, n_var=1, unit_str='au_m')
     786        30706 :       CALL section_add_keyword(section, keyword)
     787        30706 :       CALL keyword_release(keyword)
     788              : 
     789              :       CALL keyword_create(keyword, __LOCATION__, name="VSHOCK", variants=["V_SHOCK"], &
     790              :                           description="Velocity shock", &
     791              :                           usage="VSHOCK real", &
     792        61412 :                           default_r_val=0._dp, n_var=1, unit_str='m/s')
     793        30706 :       CALL section_add_keyword(section, keyword)
     794        30706 :       CALL keyword_release(keyword)
     795              : 
     796              :       CALL keyword_create(keyword, __LOCATION__, name="GAMMA", &
     797              :                           description="Damping coefficient for cell volume", &
     798              :                           usage="GAMMA real", &
     799              :                           unit_str='fs^-1', &
     800        30706 :                           default_r_val=0.0_dp)
     801        30706 :       CALL section_add_keyword(section, keyword)
     802        30706 :       CALL keyword_release(keyword)
     803              : 
     804        30706 :    END SUBROUTINE create_msst_section
     805              : 
     806              : ! **************************************************************************************************
     807              : !> \brief section will contain some parameters for the shells dynamics
     808              : !> \param section ...
     809              : ! **************************************************************************************************
     810        30706 :    SUBROUTINE create_shell_section(section)
     811              :       TYPE(section_type), POINTER                        :: section
     812              : 
     813              :       TYPE(keyword_type), POINTER                        :: keyword
     814              :       TYPE(section_type), POINTER                        :: thermo_section
     815              : 
     816        30706 :       CPASSERT(.NOT. ASSOCIATED(section))
     817              : 
     818              :       CALL section_create(section, __LOCATION__, name="shell", &
     819              :                           description="Parameters of shell model in adiabatic dynamics.", &
     820        30706 :                           n_keywords=4, n_subsections=1, repeats=.FALSE.)
     821              : 
     822        30706 :       NULLIFY (keyword, thermo_section)
     823              : 
     824              :       CALL keyword_create(keyword, __LOCATION__, name="temperature", &
     825              :                           description="Temperature in K used to control "// &
     826              :                           "the internal velocities of the core-shell motion ", &
     827              :                           usage="temperature 5.0", &
     828              :                           default_r_val=cp_unit_to_cp2k(value=0.0_dp, unit_str="K"), &
     829        30706 :                           unit_str="K")
     830        30706 :       CALL section_add_keyword(section, keyword)
     831        30706 :       CALL keyword_release(keyword)
     832              : 
     833              :       CALL keyword_create(keyword, __LOCATION__, name="temp_tol", &
     834              :                           description="Maximum accepted temperature deviation"// &
     835              :                           " from the expected value, for the internal core-shell motion."// &
     836              :                           " If 0, no rescaling is performed", &
     837        30706 :                           usage="temp_tol 0.0", default_r_val=0.0_dp, unit_str='K')
     838        30706 :       CALL section_add_keyword(section, keyword)
     839        30706 :       CALL keyword_release(keyword)
     840              : 
     841              :       CALL keyword_create(keyword, __LOCATION__, name="nose_particle", &
     842              :                           description="If nvt or npt, the core and shell velocities are controlled "// &
     843              :                           "by the same thermostat used for the particle. This might favour heat exchange "// &
     844              :                           "and additional rescaling of the internal core-shell velocity is needed (TEMP_TOL)", &
     845        30706 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     846        30706 :       CALL section_add_keyword(section, keyword)
     847        30706 :       CALL keyword_release(keyword)
     848              : 
     849              :       CALL keyword_create(keyword, __LOCATION__, name="DISPLACEMENT_SHELL_TOL", &
     850              :                           description="This keyword sets a maximum variation of the shell"// &
     851              :                           " core distance in each Cartesian direction."// &
     852              :                           " The maximum internal core-shell velocity is evaluated and"// &
     853              :                           " if it is too large to remain"// &
     854              :                           " within the assigned limit, the time step is rescaled accordingly,"// &
     855              :                           " and the first half step of the velocity verlet is repeated.", &
     856              :                           usage="DISPLACEMENT_SHELL_TOL <REAL>", default_r_val=100.0_dp, &
     857        30706 :                           unit_str='angstrom')
     858        30706 :       CALL section_add_keyword(section, keyword)
     859        30706 :       CALL keyword_release(keyword)
     860              : 
     861        30706 :       CALL create_thermostat_section(thermo_section)
     862        30706 :       CALL section_add_subsection(section, thermo_section)
     863        30706 :       CALL section_release(thermo_section)
     864              : 
     865        30706 :    END SUBROUTINE create_shell_section
     866              : 
     867              : ! **************************************************************************************************
     868              : !> \brief section will contain some parameters for the adiabatic dynamics
     869              : !> \param section ...
     870              : ! **************************************************************************************************
     871        30706 :    SUBROUTINE create_adiabatic_section(section)
     872              :       TYPE(section_type), POINTER                        :: section
     873              : 
     874              :       TYPE(keyword_type), POINTER                        :: keyword
     875              :       TYPE(section_type), POINTER                        :: thermo_fast_section, thermo_slow_section
     876              : 
     877        30706 :       CPASSERT(.NOT. ASSOCIATED(section))
     878              : 
     879              :       CALL section_create(section, __LOCATION__, name="ADIABATIC_DYNAMICS", &
     880              :                           description="Parameters used in canonical adiabatic free energy sampling (CAFES).", &
     881              :                           n_keywords=5, n_subsections=2, repeats=.FALSE., &
     882        61412 :                           citations=[VandeVondele2002])
     883              : 
     884        30706 :       NULLIFY (keyword, thermo_fast_section, thermo_slow_section)
     885              : 
     886              :       CALL keyword_create(keyword, __LOCATION__, name="temp_fast", &
     887              :                           description="Temperature in K used to control "// &
     888              :                           "the fast degrees of freedom ", &
     889              :                           usage="temp_fast 5.0", &
     890              :                           default_r_val=cp_unit_to_cp2k(value=0.0_dp, unit_str="K"), &
     891        30706 :                           unit_str="K")
     892        30706 :       CALL section_add_keyword(section, keyword)
     893        30706 :       CALL keyword_release(keyword)
     894              : 
     895              :       CALL keyword_create(keyword, __LOCATION__, name="temp_slow", &
     896              :                           description="Temperature in K used to control "// &
     897              :                           "the slow degrees of freedom ", &
     898              :                           usage="temp_slow 5.0", &
     899              :                           default_r_val=cp_unit_to_cp2k(value=0.0_dp, unit_str="K"), &
     900        30706 :                           unit_str="K")
     901        30706 :       CALL section_add_keyword(section, keyword)
     902        30706 :       CALL keyword_release(keyword)
     903              : 
     904              :       CALL keyword_create(keyword, __LOCATION__, name="temp_tol_fast", &
     905              :                           description="Maximum accepted temperature deviation"// &
     906              :                           " from the expected value, for the fast motion."// &
     907              :                           " If 0, no rescaling is performed", &
     908        30706 :                           usage="temp_tol_fast 0.0", default_r_val=0.0_dp, unit_str='K')
     909        30706 :       CALL section_add_keyword(section, keyword)
     910        30706 :       CALL keyword_release(keyword)
     911              : 
     912              :       CALL keyword_create(keyword, __LOCATION__, name="temp_tol_slow", &
     913              :                           description="Maximum accepted temperature deviation"// &
     914              :                           " from the expected value, for the slow motion."// &
     915              :                           " If 0, no rescaling is performed", &
     916        30706 :                           usage="temp_tol_slow 0.0", default_r_val=0.0_dp, unit_str='K')
     917        30706 :       CALL section_add_keyword(section, keyword)
     918        30706 :       CALL keyword_release(keyword)
     919              : 
     920              :       CALL keyword_create(keyword, __LOCATION__, name="n_resp_fast", &
     921              :                           description="number of respa steps for fast degrees of freedom", &
     922        30706 :                           repeats=.FALSE., default_i_val=1)
     923        30706 :       CALL section_add_keyword(section, keyword)
     924        30706 :       CALL keyword_release(keyword)
     925              : 
     926        30706 :       CALL create_thermo_fast_section(thermo_fast_section)
     927        30706 :       CALL section_add_subsection(section, thermo_fast_section)
     928        30706 :       CALL section_release(thermo_fast_section)
     929              : 
     930        30706 :       CALL create_thermo_slow_section(thermo_slow_section)
     931        30706 :       CALL section_add_subsection(section, thermo_slow_section)
     932        30706 :       CALL section_release(thermo_slow_section)
     933              : 
     934        30706 :    END SUBROUTINE create_adiabatic_section
     935              : 
     936              : ! **************************************************************************************************
     937              : !> \brief section will contain parameters for the velocity softening
     938              : !> \param section ...
     939              : !> \author Ole Schuett
     940              : ! **************************************************************************************************
     941        30706 :    SUBROUTINE create_softening_section(section)
     942              :       TYPE(section_type), POINTER                        :: section
     943              : 
     944              :       TYPE(keyword_type), POINTER                        :: keyword
     945              : 
     946              :       CALL section_create(section, __LOCATION__, name="VELOCITY_SOFTENING", &
     947              :                           description="A method to initialize the velocities along low-curvature " &
     948              :                           //"directions in order to favors MD trajectories to cross rapidly over " &
     949              :                           //"small energy barriers into neighboring basins. " &
     950              :                           //"In each iteration the forces are calculated at a point y, which " &
     951              :                           //"is slightly displaced from the current positions x in the direction " &
     952              :                           //"of the original velocities v. The velocities are then updated with " &
     953              :                           //"the force component F_t, which is perpendicular to N. " &
     954              :                           //"N = v / |v|;  y = x + delta * N;  F_t = F(y) - &lang; F(y) | N &rang; * N; " &
     955        30706 :                           //"v' = v + alpha * F_t")
     956              : 
     957        30706 :       NULLIFY (keyword)
     958              :       CALL keyword_create(keyword, __LOCATION__, name="STEPS", &
     959              :                           description="Number of softening iterations performed. " &
     960              :                           //"Typical values are around 40 steps.", &
     961        30706 :                           default_i_val=0)
     962        30706 :       CALL section_add_keyword(section, keyword)
     963        30706 :       CALL keyword_release(keyword)
     964              : 
     965              :       CALL keyword_create(keyword, __LOCATION__, name="DELTA", &
     966              :                           description="Displacement used to obtain y.", &
     967        30706 :                           default_r_val=0.1_dp)
     968        30706 :       CALL section_add_keyword(section, keyword)
     969        30706 :       CALL keyword_release(keyword)
     970              : 
     971              :       CALL keyword_create(keyword, __LOCATION__, name="ALPHA", &
     972              :                           description="Mixing factor used for updating velocities.", &
     973        30706 :                           default_r_val=0.15_dp)
     974        30706 :       CALL section_add_keyword(section, keyword)
     975        30706 :       CALL keyword_release(keyword)
     976              : 
     977        30706 :    END SUBROUTINE create_softening_section
     978              : 
     979              : ! **************************************************************************************************
     980              : !> \brief input section used to define regions with different temperature
     981              : !>        initialization and control
     982              : !> \param section ...
     983              : !> \par History
     984              : !>   - Added input for langevin regions in thermal regions section
     985              : !>     (2014/02/04, LT)
     986              : ! **************************************************************************************************
     987        30706 :    SUBROUTINE create_thermal_region_section(section)
     988              :       TYPE(section_type), POINTER                        :: section
     989              : 
     990              :       TYPE(keyword_type), POINTER                        :: keyword
     991              :       TYPE(section_type), POINTER                        :: print_key, region_section, subsection, &
     992              :                                                             tfunc_section
     993              : 
     994        30706 :       CPASSERT(.NOT. ASSOCIATED(section))
     995              : 
     996              :       CALL section_create(section, __LOCATION__, name="THERMAL_REGION", &
     997              :                           description="Define regions where different initialization and control "// &
     998              :                           "of the temperature is used. When MOTION%MD%ENSEMBLE is set to LANGEVIN, "// &
     999              :                           "this section controls if the atoms defined inside and outside the "// &
    1000              :                           "thermal regions should undergo Langevin MD or NVE Born-Oppenheimer MD. "// &
    1001              :                           "The theory behind Langevin MD using different regions can be found in "// &
    1002              :                           "articles by Kantorovitch et al. listed below.", &
    1003              :                           citations=[Kantorovich2008, Kantorovich2008a], &
    1004        92118 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    1005              : 
    1006        30706 :       NULLIFY (region_section)
    1007        30706 :       NULLIFY (keyword, subsection, tfunc_section)
    1008              : 
    1009              :       CALL keyword_create(keyword, __LOCATION__, name="FORCE_RESCALING", &
    1010              :                           description="Control the rescaling ot the velocities in all the regions, "// &
    1011              :                           "according to the temperature assigned to each reagion, when "// &
    1012              :                           "RESTART_VELOCITY in EXT_RESTART is active.", &
    1013        30706 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1014        30706 :       CALL section_add_keyword(section, keyword)
    1015        30706 :       CALL keyword_release(keyword)
    1016              : 
    1017              :       CALL keyword_create(keyword, __LOCATION__, name="DO_LANGEVIN_DEFAULT", &
    1018              :                           description="If ENSEMBLE is set to LANGEVIN, controls whether the "// &
    1019              :                           "atoms NOT defined in the thermal regions to undergo langevin MD "// &
    1020              :                           "or not. If not, then the atoms will undergo NVE Born-Oppenheimer MD.", &
    1021              :                           usage="DO_LANGEVIN_DEFAULT .FALSE.", &
    1022        30706 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1023        30706 :       CALL section_add_keyword(section, keyword)
    1024        30706 :       CALL keyword_release(keyword)
    1025              : 
    1026              :       CALL section_create(region_section, __LOCATION__, name="DEFINE_REGION", &
    1027              :                           description="Define arbitrary thermal region with distinct "// &
    1028              :                           "temperature controls. For thermostat regions, see section "// &
    1029              :                           "MOTION%MD%THERMOSTAT%DEFINE_REGION; when the keyword "// &
    1030              :                           "MOTION%MD%THERMOSTAT%REGION is set to THERMAL, the "// &
    1031              :                           "definition of thermostat regions will be the same as "// &
    1032              :                           "that of thermal regions.", &
    1033        30706 :                           n_keywords=3, n_subsections=1, repeats=.TRUE.)
    1034              : 
    1035        30706 :       NULLIFY (keyword)
    1036              :       CALL keyword_create(keyword, __LOCATION__, name="LIST", &
    1037              :                           description="Specifies a list of atoms belonging to the region.", &
    1038              :                           usage="LIST {integer} {integer} .. {integer}", &
    1039        30706 :                           repeats=.TRUE., n_var=-1, type_of_var=integer_t)
    1040        30706 :       CALL section_add_keyword(region_section, keyword)
    1041        30706 :       CALL keyword_release(keyword)
    1042              : 
    1043              :       CALL keyword_create(keyword, __LOCATION__, name="MOLNAME", &
    1044              :                           variants=["SEGNAME"], &
    1045              :                           description="Specifies the name of the molecules belonging to the region.", &
    1046              :                           usage="MOLNAME WAT MEOH", repeats=.TRUE., &
    1047        61412 :                           n_var=-1, type_of_var=char_t)
    1048        30706 :       CALL section_add_keyword(region_section, keyword)
    1049        30706 :       CALL keyword_release(keyword)
    1050              : 
    1051              :       CALL keyword_create(keyword, __LOCATION__, name="MM_SUBSYS", &
    1052              :                           variants=["PROTEIN"], &
    1053              :                           description="Not yet implemented: In a QM/MM run all "// &
    1054              :                           "MM atoms are specified as a whole region", &
    1055              :                           usage="MM_SUBSYS (NONE|ATOMIC|MOLECULAR)", &
    1056              :                           enum_c_vals=s2a("NONE", "ATOMIC", "MOLECULAR"), &
    1057              :                           enum_i_vals=[do_constr_none, do_constr_atomic, do_constr_molec], &
    1058              :                           enum_desc=s2a("Nothing in the region", &
    1059              :                                         "Only the MM atoms itself", &
    1060              :                                         "The full molecule/residue that contains a MM atom"), &
    1061        61412 :                           default_i_val=do_constr_none, repeats=.FALSE.)
    1062        30706 :       CALL section_add_keyword(region_section, keyword)
    1063        30706 :       CALL keyword_release(keyword)
    1064              : 
    1065              :       CALL keyword_create(keyword, __LOCATION__, name="QM_SUBSYS", &
    1066              :                           description="Not yet implemented: In a QM/MM run all "// &
    1067              :                           "QM atoms are specified as a whole region", &
    1068              :                           usage="QM_SUBSYS (NONE|ATOMIC|MOLECULAR)", &
    1069              :                           enum_c_vals=s2a("NONE", "ATOMIC", "MOLECULAR"), &
    1070              :                           enum_desc=s2a("Nothing in the region", &
    1071              :                                         "Only the QM atoms itself", &
    1072              :                                         "The full molecule/residue that contains a QM atom"), &
    1073              :                           enum_i_vals=[do_constr_none, do_constr_atomic, do_constr_molec], &
    1074        30706 :                           default_i_val=do_constr_none, repeats=.FALSE.)
    1075        30706 :       CALL section_add_keyword(region_section, keyword)
    1076        30706 :       CALL keyword_release(keyword)
    1077              : 
    1078              :       CALL keyword_create(keyword, __LOCATION__, name="TEMPERATURE", &
    1079              :                           description="The temperature in K used to initialize the velocities "// &
    1080              :                           "of the atoms in this region. It overrides the value evaluated by the "// &
    1081              :                           "function defined in TFUNC section.", &
    1082              :                           usage="TEMPERATURE 5.0", &
    1083              :                           default_r_val=cp_unit_to_cp2k(value=0.0_dp, unit_str="K"), &
    1084        30706 :                           unit_str="K")
    1085        30706 :       CALL section_add_keyword(region_section, keyword)
    1086        30706 :       CALL keyword_release(keyword)
    1087              : 
    1088              :       CALL keyword_create(keyword, __LOCATION__, name="TEMP_TOL", &
    1089              :                           description="Maximum accepted temperature deviation from the target "// &
    1090              :                           "value for this region, which is defined by TEMPERATURE or evaluated "// &
    1091              :                           "with the function defined in TFUNC section. Default value is 0 that "// &
    1092              :                           "turns off rescaling.", &
    1093              :                           usage="TEMP_TOL 0.0", &
    1094        30706 :                           default_r_val=0.0_dp, unit_str='K')
    1095        30706 :       CALL section_add_keyword(region_section, keyword)
    1096        30706 :       CALL keyword_release(keyword)
    1097              : 
    1098              :       CALL keyword_create(keyword, __LOCATION__, name="DO_LANGEVIN", &
    1099              :                           description="When ENSEMBLE is set to LANGEVIN, Controls whether "// &
    1100              :                           "the atoms in the thermal region should undergo Langevin MD. If "// &
    1101              :                           "not, then they will undergo NVE Born-Oppenheimer MD.", &
    1102              :                           usage="DO_LANGEVIN .TRUE.", &
    1103        30706 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    1104        30706 :       CALL section_add_keyword(region_section, keyword)
    1105        30706 :       CALL keyword_release(keyword)
    1106              : 
    1107              :       CALL keyword_create(keyword, __LOCATION__, name="NOISY_GAMMA_REGION", &
    1108              :                           description="Special imaginary Langevin Friction term"// &
    1109              :                           " for Langevin Dynamics with noisy forces for the atoms in this region."// &
    1110              :                           " When set, overrides the general value set by NOISY_GAMMA in the MOTION%MD%LANGEVIN section."// &
    1111              :                           " When unset for a defined region, the general NOISY_GAMMA value applies.", &
    1112              :                           citations=[Kuhne2007], usage="NOISY_GAMMA_REGION 4.0E-5", &
    1113              :                           type_of_var=real_t, &
    1114        61412 :                           unit_str="fs^-1")
    1115        30706 :       CALL section_add_keyword(region_section, keyword)
    1116        30706 :       CALL keyword_release(keyword)
    1117              : 
    1118              :       ! Define temperature function start
    1119              :       CALL section_create(tfunc_section, __LOCATION__, name="TFUNC", &
    1120              :                           description="This section specifies the target temperature by using "// &
    1121              :                           "the time step and the temperature of the last step, allowing for "// &
    1122              :                           "simple region-wise simulated annealing (heating/cooling) controls. "// &
    1123              :                           "When the absolute difference between target and actual temperature "// &
    1124              :                           "is larger than TEMP_TOL value, the atomic velocities in this region "// &
    1125              :                           "are rescaled to match the target temperature. However, note that "// &
    1126              :                           "the actual temperature is subject to thermostat coupling as well "// &
    1127              :                           "and a small restrictive TEMP_TOL together with a rapidly varying "// &
    1128              :                           "target temperature function leaves little time for the system to "// &
    1129              :                           "adjust itself, possibly showing unphysical relaxation behaviors. "// &
    1130              :                           newline//newline//"Further notes about temperature. "//docf(), &
    1131        30706 :                           n_keywords=4, n_subsections=0, repeats=.FALSE.)
    1132              : 
    1133        30706 :       NULLIFY (keyword)
    1134              :       CALL keyword_create(keyword, __LOCATION__, name="FUNCTION", &
    1135              :                           description="Specifies the functional form of the temperature "// &
    1136              :                           "in Kelvin in mathematical notation. Two variables are available "// &
    1137              :                           "with one denoted S for the integer time step and another denoted "// &
    1138              :                           "T for the temperature of the last step in Kelvin respectively. When "// &
    1139              :                           "DEFINE_REGION%TEMPERATURE is not explicitly set, the function "// &
    1140              :                           "will be evaluated at S set in MD%STEP_START_VAL and T = 0.0 "// &
    1141              :                           "to initialize the velocities of atoms in the region.", &
    1142              :                           usage="FUNCTION  A*T+(1-A)*B*(2/(1+EXP(-0.001*S))-1)", &
    1143        30706 :                           type_of_var=lchar_t, n_var=1)
    1144        30706 :       CALL section_add_keyword(tfunc_section, keyword)
    1145        30706 :       CALL keyword_release(keyword)
    1146              : 
    1147              :       CALL keyword_create(keyword, __LOCATION__, name="PARAMETERS", &
    1148              :                           description="Defines the parameters of the functional form", &
    1149              :                           usage="PARAMETERS A B", type_of_var=char_t, &
    1150        30706 :                           n_var=-1, repeats=.TRUE.)
    1151        30706 :       CALL section_add_keyword(tfunc_section, keyword)
    1152        30706 :       CALL keyword_release(keyword)
    1153              : 
    1154              :       CALL keyword_create(keyword, __LOCATION__, name="UNITS", &
    1155              :                           description="Optionally, allows to define valid CP2K unit strings for each parameter value. "// &
    1156              :                           "It is assumed that the corresponding parameter value is specified in this unit.", &
    1157              :                           usage="UNITS ", type_of_var=char_t, &
    1158        30706 :                           n_var=-1, repeats=.TRUE.)
    1159        30706 :       CALL section_add_keyword(tfunc_section, keyword)
    1160        30706 :       CALL keyword_release(keyword)
    1161              : 
    1162              :       CALL keyword_create(keyword, __LOCATION__, name="VALUES", &
    1163              :                           description="Defines the values of the parameter of the functional form", &
    1164              :                           usage="VALUES 0.75 3.00E+2", type_of_var=real_t, &
    1165        30706 :                           n_var=-1, repeats=.TRUE., unit_str="internal_cp2k")
    1166        30706 :       CALL section_add_keyword(tfunc_section, keyword)
    1167        30706 :       CALL keyword_release(keyword)
    1168              : 
    1169        30706 :       CALL section_add_subsection(region_section, tfunc_section)
    1170        30706 :       CALL section_release(tfunc_section)
    1171              :       ! Define temperature function end
    1172              : 
    1173        30706 :       CALL section_add_subsection(section, region_section)
    1174        30706 :       CALL section_release(region_section)
    1175              : 
    1176        30706 :       NULLIFY (print_key)
    1177              :       CALL section_create(subsection, __LOCATION__, name="PRINT", &
    1178              :                           description="Collects all print_keys for thermal_regions", &
    1179        30706 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
    1180              : 
    1181              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "TEMPERATURE", &
    1182              :                                        description="Controls the output of the temperature per "// &
    1183              :                                        "region. The first three columns are: step number, time "// &
    1184              :                                        "(in fs), and the temperature of atoms not in any temperature "// &
    1185              :                                        "region (or zero if all atoms are in some temperature region). "// &
    1186              :                                        "Subsequent columns are, in pairs, the target value "// &
    1187              :                                        "(calculated by TFUNC or specified by TEMPERATURE) "// &
    1188              :                                        "and the actual value of the temperature for each region.", &
    1189              :                                        print_level=high_print_level, common_iter_levels=1, &
    1190        30706 :                                        filename="")
    1191        30706 :       CALL section_add_subsection(subsection, print_key)
    1192        30706 :       CALL section_release(print_key)
    1193              : 
    1194              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "LANGEVIN_REGIONS", &
    1195              :                                        description="Controls output of information on which atoms "// &
    1196              :                                        "underwent Langevin MD and which atoms did not.", &
    1197              :                                        print_level=high_print_level, &
    1198        30706 :                                        filename="")
    1199        30706 :       CALL section_add_subsection(subsection, print_key)
    1200        30706 :       CALL section_release(print_key)
    1201              : 
    1202        30706 :       CALL section_add_subsection(section, subsection)
    1203        30706 :       CALL section_release(subsection)
    1204              : 
    1205        30706 :    END SUBROUTINE create_thermal_region_section
    1206              : 
    1207              : ! **************************************************************************************************
    1208              : !> \brief   Defines the parameters for the setup of a cascade simulation
    1209              : !> \param section ...
    1210              : !> \date    03.02.2012
    1211              : !> \author  Matthias Krack (MK)
    1212              : !> \version 1.0
    1213              : ! **************************************************************************************************
    1214        30706 :    SUBROUTINE create_cascade_section(section)
    1215              : 
    1216              :       TYPE(section_type), POINTER                        :: section
    1217              : 
    1218              :       TYPE(keyword_type), POINTER                        :: keyword
    1219              :       TYPE(section_type), POINTER                        :: subsection
    1220              : 
    1221        30706 :       NULLIFY (keyword)
    1222        30706 :       NULLIFY (subsection)
    1223        30706 :       CPASSERT(.NOT. ASSOCIATED(section))
    1224              : 
    1225              :       CALL section_create(section, __LOCATION__, name="CASCADE", &
    1226              :                           description="Defines the parameters for the setup of a cascade simulation.", &
    1227              :                           n_keywords=1, &
    1228              :                           n_subsections=1, &
    1229        30706 :                           repeats=.FALSE.)
    1230              : 
    1231              :       CALL keyword_create(keyword, __LOCATION__, &
    1232              :                           name="_SECTION_PARAMETERS_", &
    1233              :                           description="Controls the activation of the CASCADE section.", &
    1234              :                           usage="&CASCADE on", &
    1235              :                           default_l_val=.FALSE., &
    1236        30706 :                           lone_keyword_l_val=.TRUE.)
    1237        30706 :       CALL section_add_keyword(section, keyword)
    1238        30706 :       CALL keyword_release(keyword)
    1239              : 
    1240              :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY", &
    1241              :                           description="Total energy transferred to the system during the cascade event.", &
    1242              :                           usage="ENERGY 20.0", &
    1243              :                           default_r_val=0.0_dp, &
    1244        30706 :                           unit_str="keV")
    1245        30706 :       CALL section_add_keyword(section, keyword)
    1246        30706 :       CALL keyword_release(keyword)
    1247              : 
    1248              :       CALL section_create(subsection, __LOCATION__, name="ATOM_LIST", &
    1249              :                           description="Defines a list of atoms for which the initial velocities are modified", &
    1250              :                           n_keywords=1, &
    1251              :                           n_subsections=0, &
    1252        30706 :                           repeats=.FALSE.)
    1253              : 
    1254              :       CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
    1255              :                           description="Defines the list of atoms for which the velocities are modified. "// &
    1256              :                           "Each record consists of the atomic index, the velocity vector, and "// &
    1257              :                           "a weight to define which fraction of the total energy is assigned "// &
    1258              :                           "to the current atom: `Atomic_index  v_x  v_y  v_z  Weight`", &
    1259              :                           usage="{{Integer} {Real} {Real} {Real} {Real}}", &
    1260              :                           repeats=.TRUE., &
    1261        30706 :                           type_of_var=lchar_t)
    1262        30706 :       CALL section_add_keyword(subsection, keyword)
    1263        30706 :       CALL keyword_release(keyword)
    1264              : 
    1265        30706 :       CALL section_add_subsection(section, subsection)
    1266        30706 :       CALL section_release(subsection)
    1267              : 
    1268        30706 :    END SUBROUTINE create_cascade_section
    1269              : 
    1270              : ! **************************************************************************************************
    1271              : !> \brief Defines AVERAGES section
    1272              : !> \param section ...
    1273              : !> \author teo
    1274              : ! **************************************************************************************************
    1275        30706 :    SUBROUTINE create_avgs_section(section)
    1276              :       TYPE(section_type), POINTER                        :: section
    1277              : 
    1278              :       TYPE(keyword_type), POINTER                        :: keyword
    1279              :       TYPE(section_type), POINTER                        :: print_key, subsection
    1280              : 
    1281        30706 :       CPASSERT(.NOT. ASSOCIATED(section))
    1282              :       CALL section_create(section, __LOCATION__, name="Averages", &
    1283              :                           description="Controls the calculation of the averages during an MD run.", &
    1284        30706 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
    1285        30706 :       NULLIFY (keyword, print_key, subsection)
    1286              : 
    1287              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
    1288              :                           description="Controls the calculations of the averages.", &
    1289        30706 :                           usage="&AVERAGES T", default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    1290        30706 :       CALL section_add_keyword(section, keyword)
    1291        30706 :       CALL keyword_release(keyword)
    1292              : 
    1293              :       CALL keyword_create(keyword, __LOCATION__, name="ACQUISITION_START_TIME", &
    1294              :                           description="Setup up the simulation time when the acquisition process to compute"// &
    1295              :                           " averages is started.", &
    1296              :                           usage="ACQUISITION_START_TIME <REAL>", &
    1297        30706 :                           default_r_val=0.0_dp, unit_str='fs')
    1298        30706 :       CALL section_add_keyword(section, keyword)
    1299        30706 :       CALL keyword_release(keyword)
    1300              : 
    1301              :       CALL keyword_create(keyword, __LOCATION__, name="AVERAGE_COLVAR", &
    1302              :                           description="Switch for computing the averages of COLVARs.", &
    1303              :                           usage="AVERAGE_COLVAR <LOGICAL>", default_l_val=.FALSE., &
    1304        30706 :                           lone_keyword_l_val=.TRUE.)
    1305        30706 :       CALL section_add_keyword(section, keyword)
    1306        30706 :       CALL keyword_release(keyword)
    1307              : 
    1308              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PRINT_AVERAGES", &
    1309              :                                        description="Controls the output the averaged quantities", &
    1310              :                                        print_level=debug_print_level + 1, common_iter_levels=1, &
    1311        30706 :                                        filename="")
    1312        30706 :       CALL section_add_subsection(section, print_key)
    1313        30706 :       CALL section_release(print_key)
    1314              : 
    1315        30706 :       CALL create_avgs_restart_section(subsection)
    1316        30706 :       CALL section_add_subsection(section, subsection)
    1317        30706 :       CALL section_release(subsection)
    1318        30706 :    END SUBROUTINE create_avgs_section
    1319              : 
    1320              : ! **************************************************************************************************
    1321              : !> \brief Defines the AVERAGES RESTART section
    1322              : !> \param section ...
    1323              : !> \author teo
    1324              : ! **************************************************************************************************
    1325        30706 :    SUBROUTINE create_avgs_restart_section(section)
    1326              :       TYPE(section_type), POINTER                        :: section
    1327              : 
    1328              :       TYPE(keyword_type), POINTER                        :: keyword
    1329              : 
    1330        30706 :       CPASSERT(.NOT. ASSOCIATED(section))
    1331              :       CALL section_create(section, __LOCATION__, name="RESTART_AVERAGES", &
    1332              :                           description="Stores information for restarting averages.", &
    1333        30706 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
    1334        30706 :       NULLIFY (keyword)
    1335              : 
    1336              :       CALL keyword_create(keyword, __LOCATION__, name="ITIMES_START", &
    1337              :                           description="TIME STEP starting the evaluation of averages", &
    1338        30706 :                           usage="ITIMES_START <INTEGER>", type_of_var=integer_t, n_var=1)
    1339        30706 :       CALL section_add_keyword(section, keyword)
    1340        30706 :       CALL keyword_release(keyword)
    1341              : 
    1342              :       CALL keyword_create(keyword, __LOCATION__, name="AVECPU", &
    1343              :                           description="CPU average", usage="AVECPU <REAL>", &
    1344        30706 :                           type_of_var=real_t, n_var=1)
    1345        30706 :       CALL section_add_keyword(section, keyword)
    1346        30706 :       CALL keyword_release(keyword)
    1347              : 
    1348              :       CALL keyword_create(keyword, __LOCATION__, name="AVEHUGONIOT", &
    1349              :                           description="HUGONIOT average", usage="AVEHUGONIOT <REAL>", &
    1350        30706 :                           type_of_var=real_t, n_var=1)
    1351        30706 :       CALL section_add_keyword(section, keyword)
    1352        30706 :       CALL keyword_release(keyword)
    1353              : 
    1354              :       CALL keyword_create(keyword, __LOCATION__, name="AVETEMP_BARO", &
    1355              :                           description="BAROSTAT TEMPERATURE average", usage="AVETEMP_BARO <REAL>", &
    1356        30706 :                           type_of_var=real_t, n_var=1)
    1357        30706 :       CALL section_add_keyword(section, keyword)
    1358        30706 :       CALL keyword_release(keyword)
    1359              : 
    1360              :       CALL keyword_create(keyword, __LOCATION__, name="AVEPOT", &
    1361              :                           description="POTENTIAL ENERGY average", usage="AVEPOT <REAL>", &
    1362        30706 :                           type_of_var=real_t, n_var=1)
    1363        30706 :       CALL section_add_keyword(section, keyword)
    1364        30706 :       CALL keyword_release(keyword)
    1365              : 
    1366              :       CALL keyword_create(keyword, __LOCATION__, name="AVEKIN", &
    1367              :                           description="KINETIC ENERGY average", usage="AVEKIN <REAL>", &
    1368        30706 :                           type_of_var=real_t, n_var=1)
    1369        30706 :       CALL section_add_keyword(section, keyword)
    1370        30706 :       CALL keyword_release(keyword)
    1371              : 
    1372              :       CALL keyword_create(keyword, __LOCATION__, name="AVETEMP", &
    1373              :                           description="TEMPERATURE average", usage="AVETEMP <REAL>", &
    1374        30706 :                           type_of_var=real_t, n_var=1)
    1375        30706 :       CALL section_add_keyword(section, keyword)
    1376        30706 :       CALL keyword_release(keyword)
    1377              : 
    1378              :       CALL keyword_create(keyword, __LOCATION__, name="AVEKIN_QM", &
    1379              :                           description="QM KINETIC ENERGY average in QMMM runs", usage="AVEKIN_QM <REAL>", &
    1380        30706 :                           type_of_var=real_t, n_var=1)
    1381        30706 :       CALL section_add_keyword(section, keyword)
    1382        30706 :       CALL keyword_release(keyword)
    1383              : 
    1384              :       CALL keyword_create(keyword, __LOCATION__, name="AVETEMP_QM", &
    1385              :                           description="QM TEMPERATURE average in QMMM runs", usage="AVETEMP_QM <REAL>", &
    1386        30706 :                           type_of_var=real_t, n_var=1)
    1387        30706 :       CALL section_add_keyword(section, keyword)
    1388        30706 :       CALL keyword_release(keyword)
    1389              : 
    1390              :       CALL keyword_create(keyword, __LOCATION__, name="AVEVOL", &
    1391              :                           description="VOLUME average", usage="AVEVOL <REAL>", &
    1392        30706 :                           type_of_var=real_t, n_var=1)
    1393        30706 :       CALL section_add_keyword(section, keyword)
    1394        30706 :       CALL keyword_release(keyword)
    1395              : 
    1396              :       CALL keyword_create(keyword, __LOCATION__, name="AVECELL_A", &
    1397              :                           description="CELL VECTOR A average", usage="AVECELL_A <REAL>", &
    1398        30706 :                           type_of_var=real_t, n_var=1)
    1399        30706 :       CALL section_add_keyword(section, keyword)
    1400        30706 :       CALL keyword_release(keyword)
    1401              : 
    1402              :       CALL keyword_create(keyword, __LOCATION__, name="AVECELL_B", &
    1403              :                           description="CELL VECTOR B average", usage="AVECELL_B <REAL>", &
    1404        30706 :                           type_of_var=real_t, n_var=1)
    1405        30706 :       CALL section_add_keyword(section, keyword)
    1406        30706 :       CALL keyword_release(keyword)
    1407              : 
    1408              :       CALL keyword_create(keyword, __LOCATION__, name="AVECELL_C", &
    1409              :                           description="CELL VECTOR C average", usage="AVECELL_C <REAL>", &
    1410        30706 :                           type_of_var=real_t, n_var=1)
    1411        30706 :       CALL section_add_keyword(section, keyword)
    1412        30706 :       CALL keyword_release(keyword)
    1413              : 
    1414              :       CALL keyword_create(keyword, __LOCATION__, name="AVEALPHA", &
    1415              :                           description="ALPHA cell angle average", usage="AVEALPHA <REAL>", &
    1416        30706 :                           type_of_var=real_t, n_var=1)
    1417        30706 :       CALL section_add_keyword(section, keyword)
    1418        30706 :       CALL keyword_release(keyword)
    1419              : 
    1420              :       CALL keyword_create(keyword, __LOCATION__, name="AVEBETA", &
    1421              :                           description="BETA cell angle average", usage="AVEBETA <REAL>", &
    1422        30706 :                           type_of_var=real_t, n_var=1)
    1423        30706 :       CALL section_add_keyword(section, keyword)
    1424        30706 :       CALL keyword_release(keyword)
    1425              : 
    1426              :       CALL keyword_create(keyword, __LOCATION__, name="AVEGAMMA", &
    1427              :                           description="GAMMA cell angle average", usage="AVEGAMMA <REAL>", &
    1428        30706 :                           type_of_var=real_t, n_var=1)
    1429        30706 :       CALL section_add_keyword(section, keyword)
    1430        30706 :       CALL keyword_release(keyword)
    1431              : 
    1432              :       CALL keyword_create(keyword, __LOCATION__, name="AVE_ECONS", &
    1433              :                           description="CONSTANT ENERGY average", usage="AVE_ECONS <REAL>", &
    1434        30706 :                           type_of_var=real_t, n_var=1)
    1435        30706 :       CALL section_add_keyword(section, keyword)
    1436        30706 :       CALL keyword_release(keyword)
    1437              : 
    1438              :       CALL keyword_create(keyword, __LOCATION__, name="AVE_PRESS", &
    1439              :                           description="PRESSURE average", usage="AVE_PRESS <REAL>", &
    1440        30706 :                           type_of_var=real_t, n_var=1)
    1441        30706 :       CALL section_add_keyword(section, keyword)
    1442        30706 :       CALL keyword_release(keyword)
    1443              : 
    1444              :       CALL keyword_create(keyword, __LOCATION__, name="AVE_PXX", &
    1445              :                           description="P_{XX} average", usage="AVE_PXX <REAL>", &
    1446        30706 :                           type_of_var=real_t, n_var=1)
    1447        30706 :       CALL section_add_keyword(section, keyword)
    1448        30706 :       CALL keyword_release(keyword)
    1449              : 
    1450              :       CALL keyword_create(keyword, __LOCATION__, name="AVE_PV_VIR", &
    1451              :                           description="PV VIRIAL average", usage="AVE_PV_VIR <REAL> .. <REAL>", &
    1452        30706 :                           type_of_var=real_t, n_var=9)
    1453        30706 :       CALL section_add_keyword(section, keyword)
    1454        30706 :       CALL keyword_release(keyword)
    1455              : 
    1456              :       CALL keyword_create(keyword, __LOCATION__, name="AVE_PV_TOT", &
    1457              :                           description="PV TOTAL average", usage="AVE_PV_TOT <REAL> .. <REAL>", &
    1458        30706 :                           type_of_var=real_t, n_var=9)
    1459        30706 :       CALL section_add_keyword(section, keyword)
    1460        30706 :       CALL keyword_release(keyword)
    1461              : 
    1462              :       CALL keyword_create(keyword, __LOCATION__, name="AVE_PV_KIN", &
    1463              :                           description="PV KINETIC average", usage="AVE_PV_KIN <REAL> .. <REAL>", &
    1464        30706 :                           type_of_var=real_t, n_var=9)
    1465        30706 :       CALL section_add_keyword(section, keyword)
    1466        30706 :       CALL keyword_release(keyword)
    1467              : 
    1468              :       CALL keyword_create(keyword, __LOCATION__, name="AVE_PV_CNSTR", &
    1469              :                           description="PV CONSTRAINTS average", usage="AVE_PV_CNSTR <REAL> .. <REAL>", &
    1470        30706 :                           type_of_var=real_t, n_var=9)
    1471        30706 :       CALL section_add_keyword(section, keyword)
    1472        30706 :       CALL keyword_release(keyword)
    1473              : 
    1474              :       CALL keyword_create(keyword, __LOCATION__, name="AVE_PV_XC", &
    1475              :                           description="PV XC average", usage="AVE_PV_XC <REAL> .. <REAL>", &
    1476        30706 :                           type_of_var=real_t, n_var=9)
    1477        30706 :       CALL section_add_keyword(section, keyword)
    1478        30706 :       CALL keyword_release(keyword)
    1479              : 
    1480              :       CALL keyword_create(keyword, __LOCATION__, name="AVE_PV_FOCK_4C", &
    1481              :                           description="PV XC average", usage="AVE_PV_FOCK_4C <REAL> .. <REAL>", &
    1482        30706 :                           type_of_var=real_t, n_var=9)
    1483        30706 :       CALL section_add_keyword(section, keyword)
    1484        30706 :       CALL keyword_release(keyword)
    1485              : 
    1486              :       CALL keyword_create(keyword, __LOCATION__, name="AVE_COLVARS", &
    1487              :                           description="COLVARS averages", usage="AVE_COLVARS <REAL> .. <REAL>", &
    1488        30706 :                           type_of_var=real_t, n_var=-1)
    1489        30706 :       CALL section_add_keyword(section, keyword)
    1490        30706 :       CALL keyword_release(keyword)
    1491              : 
    1492              :       CALL keyword_create(keyword, __LOCATION__, name="AVE_MMATRIX", &
    1493              :                           description="METRIC TENSOR averages", usage="AVE_MMATRIX <REAL> .. <REAL>", &
    1494        30706 :                           type_of_var=real_t, n_var=-1)
    1495        30706 :       CALL section_add_keyword(section, keyword)
    1496        30706 :       CALL keyword_release(keyword)
    1497        30706 :    END SUBROUTINE create_avgs_restart_section
    1498              : 
    1499              : ! **************************************************************************************************
    1500              : !> \brief Defines the INITIAL_VIBRATION section
    1501              : !> \param section ...
    1502              : !> \author Lianheng Tong
    1503              : ! **************************************************************************************************
    1504        30706 :    SUBROUTINE create_vib_init_section(section)
    1505              :       TYPE(section_type), POINTER                        :: section
    1506              : 
    1507              :       TYPE(keyword_type), POINTER                        :: keyword
    1508              : 
    1509        30706 :       CPASSERT(.NOT. ASSOCIATED(section))
    1510              :       CALL section_create(section, __LOCATION__, name="INITIAL_VIBRATION", &
    1511              :                           description="Controls the set of parameters for MD initialisation "// &
    1512              :                           "based on vibration analysis data. The starting atomic coordinates "// &
    1513              :                           "should be based on the relaxed positions obtained from a previous "// &
    1514              :                           "geometry/cell optimisation calculation, and the vibrational "// &
    1515              :                           "frequencies and displacements data should be obtained from a "// &
    1516              :                           "vibrational analysis calculation done based on the relaxed "// &
    1517              :                           "coordinates. The MD initialisation process expects the user has "// &
    1518              :                           "performed both geometry optimisation and vibrational analysis "// &
    1519              :                           "before hand, and won't perform those calculations automatically ", &
    1520              :                           citations=[West2006], &
    1521        61412 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    1522        30706 :       NULLIFY (keyword)
    1523              :       CALL keyword_create(keyword, __LOCATION__, name="VIB_EIGS_FILE_NAME", &
    1524              :                           description="The file name of vibrational frequency (eigenvalue) "// &
    1525              :                           "and displacement (eigenvector) data calculated from the a "// &
    1526              :                           "vibrational analysis calculation done previously. This file must "// &
    1527              :                           "be the same unformatted binary file as referred to by "// &
    1528              :                           "VIBRATIONAL_ANALYSIS%PRINT%CARTESIAN_EIGS keyword. If this keyword "// &
    1529              :                           "is not explicitly defined by the user, then the default file "// &
    1530              :                           "name of: <project_name>-<CARTESIAN_EIGS_FILENAME>.eig will be used", &
    1531              :                           usage="VIB_EIGS_FILE_NAME <FILENAME>", &
    1532        30706 :                           type_of_var=lchar_t)
    1533        30706 :       CALL section_add_keyword(section, keyword)
    1534        30706 :       CALL keyword_release(keyword)
    1535        30706 :       NULLIFY (keyword)
    1536              :       CALL keyword_create(keyword, __LOCATION__, name="PHASE", &
    1537              :                           description="Controls the initial ratio of potential and kinetic "// &
    1538              :                           "contribution to the total energy. The contribution is determined by "// &
    1539              :                           "COS**2(2*pi*PHASE) for potential energy, and SIN**2(2*pi*PHASE) "// &
    1540              :                           "for kinetic energy. If PHASE is negative, then for each vibration "// &
    1541              :                           "mode the phase is determined randomly. Otherwise, PHASE must be "// &
    1542              :                           "between 0.0 and 1.0 and will be the same for all vibration modes. "// &
    1543              :                           "If value > 1.0 it will just be treated as 1.0. "// &
    1544              :                           "For example, setting PHASE = 0.25 would set all modes to "// &
    1545              :                           "begin with entirely kinetic energy --- in other words, the initial "// &
    1546              :                           "atomic positions will remain at their optimised location", &
    1547              :                           default_r_val=-1.0_dp, &
    1548        30706 :                           usage="PHASE <REAL>")
    1549        30706 :       CALL section_add_keyword(section, keyword)
    1550        30706 :       CALL keyword_release(keyword)
    1551        30706 :    END SUBROUTINE create_vib_init_section
    1552              : 
    1553              : END MODULE input_cp2k_md
        

Generated by: LCOV version 2.0-1