LCOV - code coverage report
Current view: top level - src/motion - input_cp2k_md.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:1be8651) Lines: 100.0 % 568 568
Test Date: 2026-11-24 01:22:08 Functions: 100.0 % 16 16

            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, Zhang2026
      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 generic_function_input,          ONLY: create_function_section
      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        22030 :    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        22030 :       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        22030 :                           n_keywords=13, n_subsections=6, repeats=.FALSE.)
      84              : 
      85        22030 :       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        88120 :                                        nvt_adiabatic_ensemble, npt_ia_ensemble])
     112        22030 :       CALL section_add_keyword(section, keyword)
     113        22030 :       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        22030 :                           usage="STEPS 100", default_i_val=3)
     118        22030 :       CALL section_add_keyword(section, keyword)
     119        22030 :       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        22030 :                           usage="MAX_STEPS 100", default_i_val=1000000000)
     124        22030 :       CALL section_add_keyword(section, keyword)
     125        22030 :       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        22030 :                           unit_str="fs")
     131        22030 :       CALL section_add_keyword(section, keyword)
     132        22030 :       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        22030 :                           default_i_val=0)
     137        22030 :       CALL section_add_keyword(section, keyword)
     138        22030 :       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        22030 :                           unit_str="fs")
     144        22030 :       CALL section_add_keyword(section, keyword)
     145        22030 :       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        22030 :                           unit_str="hartree")
     151        22030 :       CALL section_add_keyword(section, keyword)
     152        22030 :       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        22030 :                           unit_str="K")
     159        22030 :       CALL section_add_keyword(section, keyword)
     160        22030 :       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        22030 :                           usage="TEMP_TOL 0.0", default_r_val=0.0_dp, unit_str='K')
     170        22030 :       CALL section_add_keyword(section, keyword)
     171        22030 :       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        22030 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     177        22030 :       CALL section_add_keyword(section, keyword)
     178        22030 :       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        22030 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     184        22030 :       CALL section_add_keyword(section, keyword)
     185        22030 :       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        22030 :                           usage="COMVEL_TOL 0.1", type_of_var=real_t, n_var=1, unit_str="bohr*au_t^-1")
     191        22030 :       CALL section_add_keyword(section, keyword)
     192        22030 :       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        22030 :                           usage="ANGVEL_TOL 0.1", type_of_var=real_t, n_var=1, unit_str="bohr*au_t^-1")
     199        22030 :       CALL section_add_keyword(section, keyword)
     200        22030 :       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        22030 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     209        22030 :       CALL section_add_keyword(section, keyword)
     210        22030 :       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        22030 :                           usage="annealing <REAL>", default_r_val=1.0_dp)
     217        22030 :       CALL section_add_keyword(section, keyword)
     218        22030 :       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        22030 :                           usage="ANNEALING_CELL <REAL>", default_r_val=1.0_dp)
     225        22030 :       CALL section_add_keyword(section, keyword)
     226        22030 :       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        22030 :                           usage="TEMPERATURE_ANNEALING <REAL>", default_r_val=1.0_dp)
     232        22030 :       CALL section_add_keyword(section, keyword)
     233        22030 :       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        22030 :                           unit_str='angstrom')
     243        22030 :       CALL section_add_keyword(section, keyword)
     244        22030 :       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        22030 :                           enum_i_vals=[md_init_default, md_init_vib])
     266        22030 :       CALL section_add_keyword(section, keyword)
     267        22030 :       CALL keyword_release(keyword)
     268              : 
     269        22030 :       CALL create_langevin_section(subsection)
     270        22030 :       CALL section_add_subsection(section, subsection)
     271        22030 :       CALL section_release(subsection)
     272              : 
     273        22030 :       CALL create_msst_section(subsection)
     274        22030 :       CALL section_add_subsection(section, subsection)
     275        22030 :       CALL section_release(subsection)
     276              : 
     277        22030 :       CALL create_barostat_section(subsection)
     278        22030 :       CALL section_add_subsection(section, subsection)
     279        22030 :       CALL section_release(subsection)
     280              : 
     281        22030 :       CALL create_thermostat_section(subsection)
     282        22030 :       CALL section_add_subsection(section, subsection)
     283        22030 :       CALL section_release(subsection)
     284              : 
     285        22030 :       CALL create_respa_section(subsection)
     286        22030 :       CALL section_add_subsection(section, subsection)
     287        22030 :       CALL section_release(subsection)
     288              : 
     289        22030 :       CALL create_shell_section(subsection)
     290        22030 :       CALL section_add_subsection(section, subsection)
     291        22030 :       CALL section_release(subsection)
     292              : 
     293        22030 :       CALL create_adiabatic_section(subsection)
     294        22030 :       CALL section_add_subsection(section, subsection)
     295        22030 :       CALL section_release(subsection)
     296              : 
     297        22030 :       CALL create_softening_section(subsection)
     298        22030 :       CALL section_add_subsection(section, subsection)
     299        22030 :       CALL section_release(subsection)
     300              : 
     301        22030 :       CALL create_reftraj_section(subsection)
     302        22030 :       CALL section_add_subsection(section, subsection)
     303        22030 :       CALL section_release(subsection)
     304              : 
     305        22030 :       CALL create_avgs_section(subsection)
     306        22030 :       CALL section_add_subsection(section, subsection)
     307        22030 :       CALL section_release(subsection)
     308              : 
     309        22030 :       CALL create_thermal_region_section(subsection)
     310        22030 :       CALL section_add_subsection(section, subsection)
     311        22030 :       CALL section_release(subsection)
     312              : 
     313        22030 :       CALL create_md_print_section(subsection)
     314        22030 :       CALL section_add_subsection(section, subsection)
     315        22030 :       CALL section_release(subsection)
     316              : 
     317        22030 :       CALL create_cascade_section(subsection)
     318        22030 :       CALL section_add_subsection(section, subsection)
     319        22030 :       CALL section_release(subsection)
     320              : 
     321        22030 :       CALL create_vib_init_section(subsection)
     322        22030 :       CALL section_add_subsection(section, subsection)
     323        22030 :       CALL section_release(subsection)
     324              : 
     325        22030 :       CALL create_electrons_section(subsection)
     326        22030 :       CALL section_add_subsection(section, subsection)
     327        22030 :       CALL section_release(subsection)
     328              : 
     329        22030 :    END SUBROUTINE create_md_section
     330              : 
     331              : ! **************************************************************************************************
     332              : !> \brief Defines LANGEVIN section
     333              : !> \param section ...
     334              : !> \author teo
     335              : ! **************************************************************************************************
     336        22030 :    SUBROUTINE create_langevin_section(section)
     337              :       TYPE(section_type), POINTER                        :: section
     338              : 
     339              :       TYPE(keyword_type), POINTER                        :: keyword
     340              : 
     341        22030 :       CPASSERT(.NOT. ASSOCIATED(section))
     342              :       CALL section_create(section, __LOCATION__, name="Langevin", &
     343              :                           description="Controls the set of parameters to run a Langevin MD. "// &
     344              :                           "The integrator used follows that given in the article by Ricci et al. "// &
     345              :                           "The user can define regions in the system where the atoms inside "// &
     346              :                           "undergoes Langevin MD, while those outside the regions undergoes "// &
     347              :                           "NVE Born Oppenheimer MD. To define the regions, the user should "// &
     348              :                           "use THERMAL_REGION subsection of MOTION%MD. ", &
     349              :                           citations=[Ricci2003, Kuhne2007, Rengaraj2020], &
     350        88120 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
     351        22030 :       NULLIFY (keyword)
     352              : 
     353              :       CALL keyword_create(keyword, __LOCATION__, name="gamma", &
     354              :                           description="Gamma parameter for the Langevin dynamics (LD)", &
     355              :                           usage="gamma 0.001", &
     356        22030 :                           default_r_val=0.0_dp, unit_str='fs^-1')
     357        22030 :       CALL section_add_keyword(section, keyword)
     358        22030 :       CALL keyword_release(keyword)
     359              : 
     360              :       CALL keyword_create(keyword, __LOCATION__, name="Noisy_Gamma", &
     361              :                           variants=["NoisyGamma"], &
     362              :                           description="Imaginary Langevin Friction term for LD with noisy forces.", &
     363              :                           citations=[Kuhne2007], &
     364        66090 :                           usage="Noisy_Gamma 4.0E-5", default_r_val=0.0_dp, unit_str='fs^-1')
     365        22030 :       CALL section_add_keyword(section, keyword)
     366        22030 :       CALL keyword_release(keyword)
     367              : 
     368              :       CALL keyword_create(keyword, __LOCATION__, name="Shadow_Gamma", &
     369              :                           variants=["ShadowGamma"], &
     370              :                           description="Shadow Langevin Friction term for LD with noisy forces in order to adjust Noisy_Gamma.", &
     371              :                           citations=[Rengaraj2020], &
     372        66090 :                           usage="Shadow_Gamma 0.001", default_r_val=0.0_dp, unit_str='fs^-1')
     373        22030 :       CALL section_add_keyword(section, keyword)
     374        22030 :       CALL keyword_release(keyword)
     375        22030 :    END SUBROUTINE create_langevin_section
     376              : 
     377              : ! **************************************************************************************************
     378              : !> \brief Defines print section for MD
     379              : !> \param section ...
     380              : !> \author teo
     381              : ! **************************************************************************************************
     382        22030 :    SUBROUTINE create_md_print_section(section)
     383              :       TYPE(section_type), POINTER                        :: section
     384              : 
     385              :       TYPE(keyword_type), POINTER                        :: keyword
     386              :       TYPE(section_type), POINTER                        :: print_key
     387              : 
     388        22030 :       CPASSERT(.NOT. ASSOCIATED(section))
     389              :       CALL section_create(section, __LOCATION__, name="print", &
     390              :                           description="Controls the printing properties during an MD run", &
     391        22030 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
     392        22030 :       NULLIFY (print_key, keyword)
     393              : 
     394              :       CALL keyword_create(keyword, __LOCATION__, name="FORCE_LAST", &
     395              :                           description="Print the output and restart file if walltime is reached or "// &
     396              :                           "if an external EXIT command is given. It still requires the keyword LAST "// &
     397              :                           "to be present for the specific print key (in case the last step should not "// &
     398              :                           "match with the print_key iteration number).", &
     399              :                           usage="FORCE_LAST LOGICAL", &
     400        22030 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     401        22030 :       CALL section_add_keyword(section, keyword)
     402        22030 :       CALL keyword_release(keyword)
     403              : 
     404              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "ENERGY", &
     405              :                                        description="Controls the output the ener file", &
     406              :                                        print_level=low_print_level, common_iter_levels=1, &
     407        22030 :                                        filename="")
     408        22030 :       CALL section_add_subsection(section, print_key)
     409        22030 :       CALL section_release(print_key)
     410              : 
     411              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "SHELL_ENERGY", &
     412              :                                        description="Controls the output of the shell-energy file (only if shell-model)", &
     413              :                                        print_level=medium_print_level, common_iter_levels=1, &
     414        22030 :                                        filename="")
     415        22030 :       CALL section_add_subsection(section, print_key)
     416        22030 :       CALL section_release(print_key)
     417              : 
     418              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "TEMP_KIND", &
     419              :                                        description="Controls the output of the temperature"// &
     420              :                                        " computed separately for each kind", &
     421              :                                        print_level=high_print_level, common_iter_levels=1, &
     422        22030 :                                        filename="")
     423        22030 :       CALL section_add_subsection(section, print_key)
     424        22030 :       CALL section_release(print_key)
     425              : 
     426              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "TEMP_SHELL_KIND", &
     427              :                                        description="Controls the output of the temperature of the"// &
     428              :                                        " shell-core motion computed separately for each kind", &
     429              :                                        print_level=high_print_level, common_iter_levels=1, &
     430        22030 :                                        filename="")
     431        22030 :       CALL section_add_subsection(section, print_key)
     432        22030 :       CALL section_release(print_key)
     433              : 
     434              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "CENTER_OF_MASS", &
     435              :                                        description="Controls the printing of COM velocity during an MD", &
     436              :                                        print_level=medium_print_level, common_iter_levels=1, &
     437        22030 :                                        filename="__STD_OUT__")
     438        22030 :       CALL section_add_subsection(section, print_key)
     439        22030 :       CALL section_release(print_key)
     440              : 
     441              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "COEFFICIENTS", &
     442              :                                        description="Controls the printing of coefficients during an MD run.", &
     443              :                                        print_level=medium_print_level, common_iter_levels=1, &
     444        22030 :                                        filename="")
     445        22030 :       CALL section_add_subsection(section, print_key)
     446        22030 :       CALL section_release(print_key)
     447              : 
     448              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "ROTATIONAL_INFO", &
     449              :                                        description="Controls the printing basic info during the calculation of the "// &
     450              :                                        "translational/rotational degrees of freedom.", print_level=low_print_level, &
     451        22030 :                                        add_last=add_last_numeric, filename="__STD_OUT__")
     452              :       CALL keyword_create(keyword, __LOCATION__, name="COORDINATES", &
     453              :                           description="Prints atomic coordinates in the standard orientation. "// &
     454              :                           "Coordinates are not affected during the calculation.", &
     455        22030 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     456        22030 :       CALL section_add_keyword(print_key, keyword)
     457        22030 :       CALL keyword_release(keyword)
     458        22030 :       CALL section_add_subsection(section, print_key)
     459        22030 :       CALL section_release(print_key)
     460              : 
     461              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PROGRAM_RUN_INFO", &
     462              :                                        description="Controls the printing of basic and summary information during the"// &
     463              :                                        " Molecular Dynamics", &
     464        22030 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
     465        22030 :       CALL section_add_subsection(section, print_key)
     466        22030 :       CALL section_release(print_key)
     467        22030 :    END SUBROUTINE create_md_print_section
     468              : 
     469              : ! **************************************************************************************************
     470              : !> \brief Defines parameters for RESPA integration scheme
     471              : !> \param section will contain the coeff section
     472              : !> \author teo
     473              : ! **************************************************************************************************
     474        22030 :    SUBROUTINE create_respa_section(section)
     475              :       TYPE(section_type), POINTER                        :: section
     476              : 
     477              :       TYPE(keyword_type), POINTER                        :: keyword
     478              : 
     479        22030 :       CPASSERT(.NOT. ASSOCIATED(section))
     480              : 
     481              :       CALL section_create(section, __LOCATION__, name="RESPA", &
     482              :                           description="Multiple timestep integration based on RESPA (implemented for NVE only)."// &
     483              :                           " RESPA exploits multiple force_eval."// &
     484              :                           " In this case the order of the force_eval maps"// &
     485              :                           " the order of the respa shells from the slowest to the fastest force evaluation."// &
     486              :                           " If force_evals share the same subsys, it's enough then to specify the"// &
     487              :                           " subsys in the force_eval corresponding at the first index in the multiple_force_eval list."// &
     488              :                           " Can be used to speedup classical and ab initio MD simulations.", &
     489              :                           n_keywords=1, n_subsections=0, repeats=.FALSE., &
     490        66090 :                           citations=[Tuckerman1992, Guidon2008])
     491              : 
     492        22030 :       NULLIFY (keyword)
     493              :       CALL keyword_create(keyword, __LOCATION__, name="FREQUENCY", &
     494              :                           description="The number of reference MD steps between two RESPA corrections.", &
     495        22030 :                           usage="FREQUENCY <INTEGER>", default_i_val=5)
     496        22030 :       CALL section_add_keyword(section, keyword)
     497        22030 :       CALL keyword_release(keyword)
     498              : 
     499        22030 :    END SUBROUTINE create_respa_section
     500              : 
     501              : ! **************************************************************************************************
     502              : !> \brief Defines parameters for REFTRAJ analysis
     503              : !> \param section will contain the coeff section
     504              : !> \author teo
     505              : ! **************************************************************************************************
     506        22030 :    SUBROUTINE create_reftraj_section(section)
     507              :       TYPE(section_type), POINTER                        :: section
     508              : 
     509              :       TYPE(keyword_type), POINTER                        :: keyword
     510              :       TYPE(section_type), POINTER                        :: print_key, subsection
     511              : 
     512        22030 :       CPASSERT(.NOT. ASSOCIATED(section))
     513              : 
     514              :       CALL section_create(section, __LOCATION__, name="REFTRAJ", &
     515              :                           description="Loads an external trajectory file and performs analysis on "// &
     516              :                           "the loaded snapshots; optionally, calculates per-frame potential energy, "// &
     517              :                           "forces and other properties as requested by the keyword `EVAL` below with "// &
     518              :                           "the force method specified in the `&FORCE_EVAL` section. Time integration "// &
     519              :                           "is not performed here, and quantities of velocity, temperature and kinetic "// &
     520              :                           "energy from nuclear motion are therefore irrelevant. Such a REFTRAJ run is "// &
     521              :                           "essentially a series of single-point calculations; the snapshots are not "// &
     522              :                           "necessarily from MD and may be from custom concatenation."//newline//newline// &
     523              :                           "The trajectory should be a multi-frame XYZ file where each frame has the "// &
     524              :                           "same number of atoms and kind specification as the `&FORCE_EVAL/&SUBSYS` "// &
     525              :                           "down to the exact ordering, but cell (box) size and shape can be different. "// &
     526              :                           "The comment line of each frame is parsed for additional information such "// &
     527              :                           "as cell, step, time and energy; currently the parser supports the same "// &
     528              :                           "formats as the XYZ option of `&FORCE_EVAL/&SUBSYS/&CELL/CELL_FILE_FORMAT`, "// &
     529              :                           "corresponding to trajectory files printed from `&MOTION/&PRINT/&TRAJECTORY` "// &
     530              :                           "as XYZ and EXTXYZ and from the external `dumpdcd` tool."//newline//newline// &
     531              :                           "A minimal working example trajectory in the extended XYZ format should have "// &
     532              :                           '`Lattice="<Ax> <Ay> <Az> <Bx> <By> <Bz> <Cx> <Cy> <Cz>"` for the components '// &
     533              :                           "of cell vectors A, B, C, and `Step=<integer>` for the integer timestep. "// &
     534              :                           "`Time=<real>` and `Energy=<real>` for simulation time and potential energy "// &
     535              :                           "respectively are also parsed; if omitted, the default value will be 0.0 . "// &
     536              :                           "Note that the parser is case insensitive, but whitespaces are only used "// &
     537              :                           "between key-value pairs as delimiters and not around the = signs in an "// &
     538              :                           "extended XYZ file. `Properties=species:S:1:pos:R:3` is always assumed for "// &
     539              :                           "backwards compatibility with the primitive XYZ specification: the first "// &
     540              :                           "column is a string for element symbol (or kind alias), followed by three "// &
     541              :                           "columns of real values for Cartesian coordinates in angstrom."//newline//newline// &
     542              :                           "Alternatively, the legacy brief format from `&TRAJECTORY` output where the "// &
     543              :                           "comment line starts with `i = <integer>` for the integer timestep can also "// &
     544              :                           "be used, this time with the = sign surrounded by whitespaces. The cell "// &
     545              :                           "information may come from a separate file requested by `CELL_FILE_NAME` if "// &
     546              :                           "variable, or may be taken as the `&FORCE_EVAL/&SUBSYS/&CELL` if constant.", &
     547        22030 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
     548              : 
     549        22030 :       NULLIFY (keyword, print_key, subsection)
     550              : 
     551              :       CALL keyword_create(keyword, __LOCATION__, name="TRAJ_FILE_NAME", &
     552              :                           description="Specify the filename where the trajectory is stored.", &
     553              :                           repeats=.FALSE., &
     554        22030 :                           usage="TRAJ_FILE_NAME <CHARACTER>", default_lc_val="reftraj.xyz")
     555        22030 :       CALL section_add_keyword(section, keyword)
     556        22030 :       CALL keyword_release(keyword)
     557              : 
     558              :       CALL keyword_create(keyword, __LOCATION__, name="CELL_FILE_NAME", &
     559              :                           description="Specify the filename where the cell is stored "// &
     560              :                           "(for trajectories generated within variable cell ensembles). "// &
     561              :                           "This file will be parsed only when no cell information is found "// &
     562              :                           "in the trajectory file and VARIABLE_VOLUME is set to .TRUE.", &
     563              :                           repeats=.FALSE., &
     564        22030 :                           usage="CELL_FILE_NAME <CHARACTER>", default_lc_val="reftraj.cell")
     565        22030 :       CALL section_add_keyword(section, keyword)
     566        22030 :       CALL keyword_release(keyword)
     567              : 
     568              :       CALL keyword_create(keyword, __LOCATION__, name="VARIABLE_VOLUME", &
     569              :                           description="Enables the possibility to read a CELL file with "// &
     570              :                           "information on the CELL size during the MD. This keyword will be "// &
     571              :                           "ignored if cell information is already available in the trajectory file.", &
     572        22030 :                           repeats=.FALSE., default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     573        22030 :       CALL section_add_keyword(section, keyword)
     574        22030 :       CALL keyword_release(keyword)
     575              : 
     576              :       CALL keyword_create(keyword, __LOCATION__, name="FIRST_SNAPSHOT", &
     577              :                           description="Index of the snapshot stored in the trajectory file "// &
     578              :                           "from which to start a REFTRAJ run", &
     579        22030 :                           repeats=.FALSE., usage="FIRST_SNAPSHOT <INTEGER>", default_i_val=1)
     580        22030 :       CALL section_add_keyword(section, keyword)
     581        22030 :       CALL keyword_release(keyword)
     582              : 
     583              :       CALL keyword_create(keyword, __LOCATION__, name="LAST_SNAPSHOT", &
     584              :                           description="Index of the last snapshot stored in the trajectory file "// &
     585              :                           "that is read along a REFTRAJ run. Must be specified as default is 0. "// &
     586              :                           "Must be specified exactly as LAST_SNAPSHOT = FIRST_SNAPSHOT + STRIDE*(number of strides) "// &
     587              :                           "to avoid an error 'Unexpected EOF'. Note that STRIDE*(number of strides) "// &
     588              :                           "is simply the number of steps between the first to last snapshot.", &
     589        22030 :                           repeats=.FALSE., usage="LAST_SNAPSHOT", default_i_val=0)
     590        22030 :       CALL section_add_keyword(section, keyword)
     591        22030 :       CALL keyword_release(keyword)
     592              : 
     593              :       CALL keyword_create(keyword, __LOCATION__, name="STRIDE", &
     594              :                           description=" Stride in number of snapshot for the  reftraj analysis", &
     595        22030 :                           repeats=.FALSE., usage="STRIDE", default_i_val=1)
     596        22030 :       CALL section_add_keyword(section, keyword)
     597        22030 :       CALL keyword_release(keyword)
     598              : 
     599              :       CALL keyword_create(keyword, __LOCATION__, name="EVAL", &
     600              :                           description="Selects the mode of energy and force evaluation for each "// &
     601              :                           "retrieved snapshot during a REFTRAJ run, which determines availability "// &
     602              :                           "of other properties and the time consumption in the computation. The "// &
     603              :                           "default is NONE, a conservative option useful for analyses concerning "// &
     604              :                           "structure only that are independent of force method, such as MSD and "// &
     605              :                           "`&MOTION/&PRINT/&STRUCTURE_DATA`. This keyword supersedes the logical "// &
     606              :                           "keywords `EVAL_<mode>` in older versions of the program.", &
     607              :                           default_i_val=REFTRAJ_EVAL_NONE, &
     608              :                           enum_i_vals=[REFTRAJ_EVAL_NONE, REFTRAJ_EVAL_ENERGY, REFTRAJ_EVAL_ENERGY_FORCES], &
     609              :                           enum_c_vals=s2a("NONE", "ENERGY", "ENERGY_FORCES"), &
     610              :                           enum_desc=s2a("Do not evaluate energy or force", &
     611              :                                         "Evaluate only the energy", &
     612        22030 :                                         "Evaluate energy and forces"))
     613        22030 :       CALL section_add_keyword(section, keyword)
     614        22030 :       CALL keyword_release(keyword)
     615              : 
     616              :       CALL keyword_create(keyword, __LOCATION__, name="WRAP", &
     617              :                           description="Whether and how atoms would be wrapped to inside the "// &
     618              :                           "simulation box according to periodic boundary condition before any "// &
     619              :                           "subsequent analysis. Useful when there is need to convert the raw, "// &
     620              :                           "unwrapped coordinates produced from `MOTION%PRINT%TRAJECTORY` for "// &
     621              :                           "post-processing. This keyword will be ignored when requesting MSD "// &
     622              :                           "calculation because wrapping coordinates makes displacement discontinuous.", &
     623              :                           default_i_val=REFTRAJ_WRAP_NONE, &
     624              :                           enum_i_vals=[REFTRAJ_WRAP_NONE, REFTRAJ_WRAP_POSITIVE, REFTRAJ_WRAP_CENTRAL], &
     625              :                           enum_c_vals=s2a("NONE", "POSITIVE", "CENTRAL"), &
     626              :                           enum_desc=s2a("Do not wrap atoms at all and use coordinates exactly as input", &
     627              :                                         "Wrap atoms so that fractional coordinates are within [0, 1]", &
     628        22030 :                                         "Wrap atoms so that fractional coordinates are within [-1/2, +1/2]"))
     629        22030 :       CALL section_add_keyword(section, keyword)
     630        22030 :       CALL keyword_release(keyword)
     631              : 
     632        22030 :       CALL create_msd_section(subsection)
     633        22030 :       CALL section_add_subsection(section, subsection)
     634        22030 :       CALL section_release(subsection)
     635              : 
     636              :       CALL section_create(subsection, __LOCATION__, name="print", &
     637              :                           description="The section that controls the output of a reftraj run", &
     638        22030 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     639              : 
     640        22030 :       NULLIFY (print_key)
     641              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "msd_kind", &
     642              :                                        description="Controls the output of msd per kind", &
     643              :                                        print_level=low_print_level, common_iter_levels=1, &
     644        22030 :                                        filename="")
     645        22030 :       CALL section_add_subsection(subsection, print_key)
     646        22030 :       CALL section_release(print_key)
     647              : 
     648              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "msd_molecule", &
     649              :                                        description="Controls the output of msd per molecule kind", &
     650              :                                        print_level=low_print_level, common_iter_levels=1, &
     651        22030 :                                        filename="")
     652        22030 :       CALL section_add_subsection(subsection, print_key)
     653        22030 :       CALL section_release(print_key)
     654              : 
     655              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "displaced_atom", &
     656              :                                        description="Controls the output of index and dislacement of "// &
     657              :                                        "atoms that moved away from the initial position of more than a "// &
     658              :                                        "given distance (see msd%disp_tol)", &
     659              :                                        print_level=low_print_level, common_iter_levels=1, &
     660        22030 :                                        filename="")
     661        22030 :       CALL section_add_subsection(subsection, print_key)
     662        22030 :       CALL section_release(print_key)
     663              : 
     664        22030 :       CALL section_add_subsection(section, subsection)
     665        22030 :       CALL section_release(subsection)
     666              : 
     667        22030 :    END SUBROUTINE create_reftraj_section
     668              : 
     669              : ! **************************************************************************************************
     670              : !> \brief Defines parameters for MSD calculation along a REFTRAJ analysis
     671              : !> \param section will contain the coeff section
     672              : !> \author MI
     673              : ! **************************************************************************************************
     674        22030 :    SUBROUTINE create_msd_section(section)
     675              :       TYPE(section_type), POINTER                        :: section
     676              : 
     677              :       TYPE(keyword_type), POINTER                        :: keyword
     678              :       TYPE(section_type), POINTER                        :: subsection
     679              : 
     680        22030 :       CPASSERT(.NOT. ASSOCIATED(section))
     681              : 
     682              :       CALL section_create(section, __LOCATION__, name="MSD", &
     683              :                           description="Loads an external trajectory file and performs analysis on the"// &
     684              :                           " loaded snapshots.", &
     685        22030 :                           n_keywords=3, n_subsections=0, repeats=.FALSE.)
     686              : 
     687        22030 :       NULLIFY (keyword, subsection)
     688              : 
     689              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     690              :                           description="controls the activation of core-level spectroscopy simulations", &
     691              :                           usage="&MSD T", &
     692              :                           default_l_val=.FALSE., &
     693        22030 :                           lone_keyword_l_val=.TRUE.)
     694        22030 :       CALL section_add_keyword(section, keyword)
     695        22030 :       CALL keyword_release(keyword)
     696              : 
     697              :       CALL keyword_create(keyword, __LOCATION__, name="REF0_FILENAME", &
     698              :                           description="Specify the filename where the initial reference configuration is stored.", &
     699        22030 :                           repeats=.FALSE., usage="REF0_FILENAME <CHARACTER>", default_lc_val="")
     700        22030 :       CALL section_add_keyword(section, keyword)
     701        22030 :       CALL keyword_release(keyword)
     702              : 
     703              :       CALL keyword_create(keyword, __LOCATION__, name="MSD_PER_KIND", &
     704              :                           description="Set up the calculation of the MSD for each atomic kind", &
     705              :                           usage="MSD_PER_KIND <LOGICAL>", repeats=.FALSE., &
     706        22030 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     707        22030 :       CALL section_add_keyword(section, keyword)
     708        22030 :       CALL keyword_release(keyword)
     709              : 
     710              :       CALL keyword_create(keyword, __LOCATION__, name="MSD_PER_MOLKIND", &
     711              :                           description="Set up the calculation of the MSD for each molecule kind. "// &
     712              :                           "The position of the center of mass of the molecule is considered.", &
     713              :                           usage="MSD_PER_MOLKIND <LOGICAL>", repeats=.FALSE., &
     714        22030 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     715        22030 :       CALL section_add_keyword(section, keyword)
     716        22030 :       CALL keyword_release(keyword)
     717              : 
     718              :       CALL keyword_create(keyword, __LOCATION__, name="MSD_PER_REGION", &
     719              :                           description="Set up the calculation of the MSD for each defined region.", &
     720              :                           usage="MSD_PER_REGION <LOGICAL>", repeats=.FALSE., &
     721        22030 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     722        22030 :       CALL section_add_keyword(section, keyword)
     723        22030 :       CALL keyword_release(keyword)
     724              : 
     725        22030 :       CALL create_region_section(subsection, "MSD calculation")
     726        22030 :       CALL section_add_subsection(section, subsection)
     727        22030 :       CALL section_release(subsection)
     728              : 
     729              :       CALL keyword_create(keyword, __LOCATION__, name="DISPLACED_ATOM", &
     730              :                           description="Identify the atoms that moved from their initial "// &
     731              :                           "position of a distance larger than a given tolerance (see msd%displacement_tol).", &
     732              :                           usage="DISPLACED_ATOM <LOGICAL>", repeats=.FALSE., &
     733        22030 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     734        22030 :       CALL section_add_keyword(section, keyword)
     735        22030 :       CALL keyword_release(keyword)
     736              : 
     737              :       CALL keyword_create(keyword, __LOCATION__, name="displacement_tol", &
     738              :                           description="Lower limit to define displaced atoms", &
     739              :                           usage="DISPLACEMENT_TOL real", &
     740        22030 :                           default_r_val=0._dp, n_var=1, unit_str='bohr')
     741        22030 :       CALL section_add_keyword(section, keyword)
     742        22030 :       CALL keyword_release(keyword)
     743              : 
     744        22030 :    END SUBROUTINE create_msd_section
     745              : 
     746              : ! **************************************************************************************************
     747              : !> \brief ...
     748              : !> \param section will contain the coeff section
     749              : !> \author teo
     750              : ! **************************************************************************************************
     751        22030 :    SUBROUTINE create_msst_section(section)
     752              :       TYPE(section_type), POINTER                        :: section
     753              : 
     754              :       TYPE(keyword_type), POINTER                        :: keyword
     755              : 
     756        22030 :       CPASSERT(.NOT. ASSOCIATED(section))
     757              : 
     758              :       CALL section_create(section, __LOCATION__, name="msst", &
     759              :                           description="Parameters for Multi-Scale Shock Technique (MSST) "// &
     760              :                           "which simulate the effect of a steady planar shock on a unit cell. "// &
     761              :                           "Reed et. al. Physical Review Letters 90, 235503 (2003).", &
     762        22030 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     763              : 
     764        22030 :       NULLIFY (keyword)
     765              :       CALL keyword_create(keyword, __LOCATION__, name="PRESSURE", &
     766              :                           description="Initial pressure", &
     767              :                           usage="PRESSURE real", &
     768        22030 :                           default_r_val=0._dp, n_var=1, unit_str='bar')
     769        22030 :       CALL section_add_keyword(section, keyword)
     770        22030 :       CALL keyword_release(keyword)
     771              : 
     772              :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY", &
     773              :                           description="Initial energy", &
     774              :                           usage="ENERGY real", &
     775        22030 :                           default_r_val=0._dp, n_var=1, unit_str='hartree')
     776        22030 :       CALL section_add_keyword(section, keyword)
     777        22030 :       CALL keyword_release(keyword)
     778              : 
     779              :       CALL keyword_create(keyword, __LOCATION__, name="VOLUME", &
     780              :                           description="Initial volume", &
     781              :                           usage="VOLUME real", &
     782        22030 :                           default_r_val=0._dp, n_var=1, unit_str='angstrom^3')
     783        22030 :       CALL section_add_keyword(section, keyword)
     784        22030 :       CALL keyword_release(keyword)
     785              : 
     786              :       CALL keyword_create(keyword, __LOCATION__, name="CMASS", &
     787              :                           description="Effective cell mass", &
     788              :                           usage="CMASS real", &
     789        22030 :                           default_r_val=0._dp, n_var=1, unit_str='au_m')
     790        22030 :       CALL section_add_keyword(section, keyword)
     791        22030 :       CALL keyword_release(keyword)
     792              : 
     793              :       CALL keyword_create(keyword, __LOCATION__, name="VSHOCK", variants=["V_SHOCK"], &
     794              :                           description="Velocity shock", &
     795              :                           usage="VSHOCK real", &
     796        44060 :                           default_r_val=0._dp, n_var=1, unit_str='m/s')
     797        22030 :       CALL section_add_keyword(section, keyword)
     798        22030 :       CALL keyword_release(keyword)
     799              : 
     800              :       CALL keyword_create(keyword, __LOCATION__, name="GAMMA", &
     801              :                           description="Damping coefficient for cell volume", &
     802              :                           usage="GAMMA real", &
     803              :                           unit_str='fs^-1', &
     804        22030 :                           default_r_val=0.0_dp)
     805        22030 :       CALL section_add_keyword(section, keyword)
     806        22030 :       CALL keyword_release(keyword)
     807              : 
     808        22030 :    END SUBROUTINE create_msst_section
     809              : 
     810              : ! **************************************************************************************************
     811              : !> \brief section will contain some parameters for the shells dynamics
     812              : !> \param section ...
     813              : ! **************************************************************************************************
     814        22030 :    SUBROUTINE create_shell_section(section)
     815              :       TYPE(section_type), POINTER                        :: section
     816              : 
     817              :       TYPE(keyword_type), POINTER                        :: keyword
     818              :       TYPE(section_type), POINTER                        :: thermo_section
     819              : 
     820        22030 :       CPASSERT(.NOT. ASSOCIATED(section))
     821              : 
     822              :       CALL section_create(section, __LOCATION__, name="shell", &
     823              :                           description="Parameters of shell model in adiabatic dynamics.", &
     824        22030 :                           n_keywords=4, n_subsections=1, repeats=.FALSE.)
     825              : 
     826        22030 :       NULLIFY (keyword, thermo_section)
     827              : 
     828              :       CALL keyword_create(keyword, __LOCATION__, name="temperature", &
     829              :                           description="Temperature in K used to control "// &
     830              :                           "the internal velocities of the core-shell motion ", &
     831              :                           usage="temperature 5.0", &
     832              :                           default_r_val=cp_unit_to_cp2k(value=0.0_dp, unit_str="K"), &
     833        22030 :                           unit_str="K")
     834        22030 :       CALL section_add_keyword(section, keyword)
     835        22030 :       CALL keyword_release(keyword)
     836              : 
     837              :       CALL keyword_create(keyword, __LOCATION__, name="temp_tol", &
     838              :                           description="Maximum accepted temperature deviation"// &
     839              :                           " from the expected value, for the internal core-shell motion."// &
     840              :                           " If 0, no rescaling is performed", &
     841        22030 :                           usage="temp_tol 0.0", default_r_val=0.0_dp, unit_str='K')
     842        22030 :       CALL section_add_keyword(section, keyword)
     843        22030 :       CALL keyword_release(keyword)
     844              : 
     845              :       CALL keyword_create(keyword, __LOCATION__, name="nose_particle", &
     846              :                           description="If nvt or npt, the core and shell velocities are controlled "// &
     847              :                           "by the same thermostat used for the particle. This might favour heat exchange "// &
     848              :                           "and additional rescaling of the internal core-shell velocity is needed (TEMP_TOL)", &
     849        22030 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     850        22030 :       CALL section_add_keyword(section, keyword)
     851        22030 :       CALL keyword_release(keyword)
     852              : 
     853              :       CALL keyword_create(keyword, __LOCATION__, name="DISPLACEMENT_SHELL_TOL", &
     854              :                           description="This keyword sets a maximum variation of the shell"// &
     855              :                           " core distance in each Cartesian direction."// &
     856              :                           " The maximum internal core-shell velocity is evaluated and"// &
     857              :                           " if it is too large to remain"// &
     858              :                           " within the assigned limit, the time step is rescaled accordingly,"// &
     859              :                           " and the first half step of the velocity verlet is repeated.", &
     860              :                           usage="DISPLACEMENT_SHELL_TOL <REAL>", default_r_val=100.0_dp, &
     861        22030 :                           unit_str='angstrom')
     862        22030 :       CALL section_add_keyword(section, keyword)
     863        22030 :       CALL keyword_release(keyword)
     864              : 
     865        22030 :       CALL create_thermostat_section(thermo_section)
     866        22030 :       CALL section_add_subsection(section, thermo_section)
     867        22030 :       CALL section_release(thermo_section)
     868              : 
     869        22030 :    END SUBROUTINE create_shell_section
     870              : 
     871              : ! **************************************************************************************************
     872              : !> \brief section will contain some parameters for the adiabatic dynamics
     873              : !> \param section ...
     874              : ! **************************************************************************************************
     875        22030 :    SUBROUTINE create_adiabatic_section(section)
     876              :       TYPE(section_type), POINTER                        :: section
     877              : 
     878              :       TYPE(keyword_type), POINTER                        :: keyword
     879              :       TYPE(section_type), POINTER                        :: thermo_fast_section, thermo_slow_section
     880              : 
     881        22030 :       CPASSERT(.NOT. ASSOCIATED(section))
     882              : 
     883              :       CALL section_create(section, __LOCATION__, name="ADIABATIC_DYNAMICS", &
     884              :                           description="Parameters used in canonical adiabatic free energy sampling (CAFES).", &
     885              :                           n_keywords=5, n_subsections=2, repeats=.FALSE., &
     886        44060 :                           citations=[VandeVondele2002])
     887              : 
     888        22030 :       NULLIFY (keyword, thermo_fast_section, thermo_slow_section)
     889              : 
     890              :       CALL keyword_create(keyword, __LOCATION__, name="temp_fast", &
     891              :                           description="Temperature in K used to control "// &
     892              :                           "the fast degrees of freedom ", &
     893              :                           usage="temp_fast 5.0", &
     894              :                           default_r_val=cp_unit_to_cp2k(value=0.0_dp, unit_str="K"), &
     895        22030 :                           unit_str="K")
     896        22030 :       CALL section_add_keyword(section, keyword)
     897        22030 :       CALL keyword_release(keyword)
     898              : 
     899              :       CALL keyword_create(keyword, __LOCATION__, name="temp_slow", &
     900              :                           description="Temperature in K used to control "// &
     901              :                           "the slow degrees of freedom ", &
     902              :                           usage="temp_slow 5.0", &
     903              :                           default_r_val=cp_unit_to_cp2k(value=0.0_dp, unit_str="K"), &
     904        22030 :                           unit_str="K")
     905        22030 :       CALL section_add_keyword(section, keyword)
     906        22030 :       CALL keyword_release(keyword)
     907              : 
     908              :       CALL keyword_create(keyword, __LOCATION__, name="temp_tol_fast", &
     909              :                           description="Maximum accepted temperature deviation"// &
     910              :                           " from the expected value, for the fast motion."// &
     911              :                           " If 0, no rescaling is performed", &
     912        22030 :                           usage="temp_tol_fast 0.0", default_r_val=0.0_dp, unit_str='K')
     913        22030 :       CALL section_add_keyword(section, keyword)
     914        22030 :       CALL keyword_release(keyword)
     915              : 
     916              :       CALL keyword_create(keyword, __LOCATION__, name="temp_tol_slow", &
     917              :                           description="Maximum accepted temperature deviation"// &
     918              :                           " from the expected value, for the slow motion."// &
     919              :                           " If 0, no rescaling is performed", &
     920        22030 :                           usage="temp_tol_slow 0.0", default_r_val=0.0_dp, unit_str='K')
     921        22030 :       CALL section_add_keyword(section, keyword)
     922        22030 :       CALL keyword_release(keyword)
     923              : 
     924              :       CALL keyword_create(keyword, __LOCATION__, name="n_resp_fast", &
     925              :                           description="number of respa steps for fast degrees of freedom", &
     926        22030 :                           repeats=.FALSE., default_i_val=1)
     927        22030 :       CALL section_add_keyword(section, keyword)
     928        22030 :       CALL keyword_release(keyword)
     929              : 
     930        22030 :       CALL create_thermo_fast_section(thermo_fast_section)
     931        22030 :       CALL section_add_subsection(section, thermo_fast_section)
     932        22030 :       CALL section_release(thermo_fast_section)
     933              : 
     934        22030 :       CALL create_thermo_slow_section(thermo_slow_section)
     935        22030 :       CALL section_add_subsection(section, thermo_slow_section)
     936        22030 :       CALL section_release(thermo_slow_section)
     937              : 
     938        22030 :    END SUBROUTINE create_adiabatic_section
     939              : 
     940              : ! **************************************************************************************************
     941              : !> \brief section will contain parameters for the velocity softening
     942              : !> \param section ...
     943              : !> \author Ole Schuett
     944              : ! **************************************************************************************************
     945        22030 :    SUBROUTINE create_softening_section(section)
     946              :       TYPE(section_type), POINTER                        :: section
     947              : 
     948              :       TYPE(keyword_type), POINTER                        :: keyword
     949              : 
     950              :       CALL section_create(section, __LOCATION__, name="VELOCITY_SOFTENING", &
     951              :                           description="A method to initialize the velocities along low-curvature " &
     952              :                           //"directions in order to favors MD trajectories to cross rapidly over " &
     953              :                           //"small energy barriers into neighboring basins. " &
     954              :                           //"In each iteration the forces are calculated at a point y, which " &
     955              :                           //"is slightly displaced from the current positions x in the direction " &
     956              :                           //"of the original velocities v. The velocities are then updated with " &
     957              :                           //"the force component F_t, which is perpendicular to N. " &
     958              :                           //"N = v / |v|;  y = x + delta * N;  F_t = F(y) - &lang; F(y) | N &rang; * N; " &
     959        22030 :                           //"v' = v + alpha * F_t")
     960              : 
     961        22030 :       NULLIFY (keyword)
     962              :       CALL keyword_create(keyword, __LOCATION__, name="STEPS", &
     963              :                           description="Number of softening iterations performed. " &
     964              :                           //"Typical values are around 40 steps.", &
     965        22030 :                           default_i_val=0)
     966        22030 :       CALL section_add_keyword(section, keyword)
     967        22030 :       CALL keyword_release(keyword)
     968              : 
     969              :       CALL keyword_create(keyword, __LOCATION__, name="DELTA", &
     970              :                           description="Displacement used to obtain y.", &
     971        22030 :                           default_r_val=0.1_dp)
     972        22030 :       CALL section_add_keyword(section, keyword)
     973        22030 :       CALL keyword_release(keyword)
     974              : 
     975              :       CALL keyword_create(keyword, __LOCATION__, name="ALPHA", &
     976              :                           description="Mixing factor used for updating velocities.", &
     977        22030 :                           default_r_val=0.15_dp)
     978        22030 :       CALL section_add_keyword(section, keyword)
     979        22030 :       CALL keyword_release(keyword)
     980              : 
     981        22030 :    END SUBROUTINE create_softening_section
     982              : 
     983              : ! **************************************************************************************************
     984              : !> \brief input section used to define regions with different temperature
     985              : !>        initialization and control
     986              : !> \param section ...
     987              : !> \par History
     988              : !>   - Added input for langevin regions in thermal regions section
     989              : !>     (2014/02/04, LT)
     990              : ! **************************************************************************************************
     991        22030 :    SUBROUTINE create_thermal_region_section(section)
     992              :       TYPE(section_type), POINTER                        :: section
     993              : 
     994              :       TYPE(keyword_type), POINTER                        :: keyword
     995              :       TYPE(section_type), POINTER                        :: print_key, region_section, subsection, &
     996              :                                                             tfunc_section
     997              : 
     998        22030 :       CPASSERT(.NOT. ASSOCIATED(section))
     999              : 
    1000              :       CALL section_create(section, __LOCATION__, name="THERMAL_REGION", &
    1001              :                           description="Define regions where different initialization and control "// &
    1002              :                           "of the temperature is used. When MOTION%MD%ENSEMBLE is set to LANGEVIN, "// &
    1003              :                           "this section controls if the atoms defined inside and outside the "// &
    1004              :                           "thermal regions should undergo Langevin MD or NVE Born-Oppenheimer MD. "// &
    1005              :                           "The theory behind Langevin MD using different regions can be found in "// &
    1006              :                           "articles by Kantorovitch et al. listed below.", &
    1007              :                           citations=[Kantorovich2008, Kantorovich2008a], &
    1008        66090 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    1009              : 
    1010        22030 :       NULLIFY (region_section)
    1011        22030 :       NULLIFY (keyword, subsection, tfunc_section)
    1012              : 
    1013              :       CALL keyword_create(keyword, __LOCATION__, name="FORCE_RESCALING", &
    1014              :                           description="Control the rescaling ot the velocities in all the regions, "// &
    1015              :                           "according to the temperature assigned to each reagion, when "// &
    1016              :                           "RESTART_VELOCITY in EXT_RESTART is active.", &
    1017        22030 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1018        22030 :       CALL section_add_keyword(section, keyword)
    1019        22030 :       CALL keyword_release(keyword)
    1020              : 
    1021              :       CALL keyword_create(keyword, __LOCATION__, name="DO_LANGEVIN_DEFAULT", &
    1022              :                           description="If ENSEMBLE is set to LANGEVIN, controls whether the "// &
    1023              :                           "atoms NOT defined in the thermal regions to undergo langevin MD "// &
    1024              :                           "or not. If not, then the atoms will undergo NVE Born-Oppenheimer MD.", &
    1025              :                           usage="DO_LANGEVIN_DEFAULT .FALSE.", &
    1026        22030 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1027        22030 :       CALL section_add_keyword(section, keyword)
    1028        22030 :       CALL keyword_release(keyword)
    1029              : 
    1030              :       CALL section_create(region_section, __LOCATION__, name="DEFINE_REGION", &
    1031              :                           description="Define arbitrary thermal region with distinct "// &
    1032              :                           "temperature controls. For thermostat regions, see section "// &
    1033              :                           "MOTION%MD%THERMOSTAT%DEFINE_REGION; when the keyword "// &
    1034              :                           "MOTION%MD%THERMOSTAT%REGION is set to THERMAL, the "// &
    1035              :                           "definition of thermostat regions will be the same as "// &
    1036              :                           "that of thermal regions.", &
    1037        22030 :                           n_keywords=3, n_subsections=1, repeats=.TRUE.)
    1038              : 
    1039        22030 :       NULLIFY (keyword)
    1040              :       CALL keyword_create(keyword, __LOCATION__, name="LIST", &
    1041              :                           description="Specifies a list of atoms belonging to the region.", &
    1042              :                           usage="LIST {integer} {integer} .. {integer}", &
    1043        22030 :                           repeats=.TRUE., n_var=-1, type_of_var=integer_t)
    1044        22030 :       CALL section_add_keyword(region_section, keyword)
    1045        22030 :       CALL keyword_release(keyword)
    1046              : 
    1047              :       CALL keyword_create(keyword, __LOCATION__, name="MOLNAME", &
    1048              :                           variants=["SEGNAME"], &
    1049              :                           description="Specifies the name of the molecules belonging to the region.", &
    1050              :                           usage="MOLNAME WAT MEOH", repeats=.TRUE., &
    1051        44060 :                           n_var=-1, type_of_var=char_t)
    1052        22030 :       CALL section_add_keyword(region_section, keyword)
    1053        22030 :       CALL keyword_release(keyword)
    1054              : 
    1055              :       CALL keyword_create(keyword, __LOCATION__, name="MM_SUBSYS", &
    1056              :                           variants=["PROTEIN"], &
    1057              :                           description="Not yet implemented: In a QM/MM run all "// &
    1058              :                           "MM atoms are specified as a whole region", &
    1059              :                           usage="MM_SUBSYS (NONE|ATOMIC|MOLECULAR)", &
    1060              :                           enum_c_vals=s2a("NONE", "ATOMIC", "MOLECULAR"), &
    1061              :                           enum_i_vals=[do_constr_none, do_constr_atomic, do_constr_molec], &
    1062              :                           enum_desc=s2a("Nothing in the region", &
    1063              :                                         "Only the MM atoms itself", &
    1064              :                                         "The full molecule/residue that contains a MM atom"), &
    1065        44060 :                           default_i_val=do_constr_none, repeats=.FALSE.)
    1066        22030 :       CALL section_add_keyword(region_section, keyword)
    1067        22030 :       CALL keyword_release(keyword)
    1068              : 
    1069              :       CALL keyword_create(keyword, __LOCATION__, name="QM_SUBSYS", &
    1070              :                           description="Not yet implemented: In a QM/MM run all "// &
    1071              :                           "QM atoms are specified as a whole region", &
    1072              :                           usage="QM_SUBSYS (NONE|ATOMIC|MOLECULAR)", &
    1073              :                           enum_c_vals=s2a("NONE", "ATOMIC", "MOLECULAR"), &
    1074              :                           enum_desc=s2a("Nothing in the region", &
    1075              :                                         "Only the QM atoms itself", &
    1076              :                                         "The full molecule/residue that contains a QM atom"), &
    1077              :                           enum_i_vals=[do_constr_none, do_constr_atomic, do_constr_molec], &
    1078        22030 :                           default_i_val=do_constr_none, repeats=.FALSE.)
    1079        22030 :       CALL section_add_keyword(region_section, keyword)
    1080        22030 :       CALL keyword_release(keyword)
    1081              : 
    1082              :       CALL keyword_create(keyword, __LOCATION__, name="TEMPERATURE", &
    1083              :                           description="The temperature in K used to initialize the velocities "// &
    1084              :                           "of the atoms in this region. It overrides the value evaluated by the "// &
    1085              :                           "function defined in TFUNC section.", &
    1086              :                           usage="TEMPERATURE 5.0", &
    1087              :                           default_r_val=cp_unit_to_cp2k(value=0.0_dp, unit_str="K"), &
    1088        22030 :                           unit_str="K")
    1089        22030 :       CALL section_add_keyword(region_section, keyword)
    1090        22030 :       CALL keyword_release(keyword)
    1091              : 
    1092              :       CALL keyword_create(keyword, __LOCATION__, name="TEMP_TOL", &
    1093              :                           description="Maximum accepted temperature deviation from the target "// &
    1094              :                           "value for this region, which is defined by TEMPERATURE or evaluated "// &
    1095              :                           "with the function defined in TFUNC section. Default value is 0 that "// &
    1096              :                           "turns off rescaling.", &
    1097              :                           usage="TEMP_TOL 0.0", &
    1098        22030 :                           default_r_val=0.0_dp, unit_str='K')
    1099        22030 :       CALL section_add_keyword(region_section, keyword)
    1100        22030 :       CALL keyword_release(keyword)
    1101              : 
    1102              :       CALL keyword_create(keyword, __LOCATION__, name="DO_LANGEVIN", &
    1103              :                           description="When ENSEMBLE is set to LANGEVIN, Controls whether "// &
    1104              :                           "the atoms in the thermal region should undergo Langevin MD. If "// &
    1105              :                           "not, then they will undergo NVE Born-Oppenheimer MD.", &
    1106              :                           usage="DO_LANGEVIN .TRUE.", &
    1107        22030 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    1108        22030 :       CALL section_add_keyword(region_section, keyword)
    1109        22030 :       CALL keyword_release(keyword)
    1110              : 
    1111              :       CALL keyword_create(keyword, __LOCATION__, name="NOISY_GAMMA_REGION", &
    1112              :                           description="Special imaginary Langevin Friction term"// &
    1113              :                           " for Langevin Dynamics with noisy forces for the atoms in this region."// &
    1114              :                           " When set, overrides the general value set by NOISY_GAMMA in the MOTION%MD%LANGEVIN section."// &
    1115              :                           " When unset for a defined region, the general NOISY_GAMMA value applies.", &
    1116              :                           citations=[Kuhne2007], usage="NOISY_GAMMA_REGION 4.0E-5", &
    1117              :                           type_of_var=real_t, &
    1118        44060 :                           unit_str="fs^-1")
    1119        22030 :       CALL section_add_keyword(region_section, keyword)
    1120        22030 :       CALL keyword_release(keyword)
    1121              : 
    1122              :       ! Define temperature function start
    1123              :       CALL create_function_section(tfunc_section, section_name="TFUNC", func_name="FUNCTION", &
    1124              :                                    description="This section specifies the target temperature by "// &
    1125              :                                    "using the time step `S` and the temperature of the last step "// &
    1126              :                                    "in Kelvin `T` in a functional form, thus allowing for a simple "// &
    1127              :                                    "region-wise annealing (heating/cooling) controls in the absence "// &
    1128              :                                    "of a thermostat. Specifically, if the absolute difference between "// &
    1129              :                                    "target and actual temperature is larger than the TEMP_TOL value "// &
    1130              :                                    "on each step, the atomic velocities will be rescaled to match "// &
    1131              :                                    "the target temperature. However, note that a small restrictive "// &
    1132              :                                    "TEMP_TOL together with a rapidly varying target temperature "// &
    1133              :                                    "function and a large timestep leaves little time for the system to "// &
    1134              :                                    "adjust itself, possibly leading to unphysical relaxation behaviors "// &
    1135              :                                    "and structural artifacts."//newline//newline// &
    1136              :                                    "When DEFINE_REGION%TEMPERATURE is not set for this region explicitly, "// &
    1137              :                                    "the function will be evaluated at `S` set in MD%STEP_START_VAL and "// &
    1138              :                                    "`T = 0.00` to obtain the initial temperature (assumed positive) for "// &
    1139              :                                    "initialization of the atomic velocities in the region; if the result "// &
    1140              :                                    "of function evaluation is not positive, the MD%TEMPERATURE will be "// &
    1141              :                                    "used as a fallback."//newline//newline// &
    1142              :                                    "The function is interpreted directly as in Kelvin, with no need to "// &
    1143              :                                    "specify the UNITS keyword for the parameters. For instance, defining "// &
    1144              :                                    "`FUNCTION (ABS(S/N+M)-ABS(S/N-M))/2`, `PARAMETERS N M` and "// &
    1145              :                                    "`VALUES 50/3 300.0`, the target temperature will rise linearly and "// &
    1146              :                                    "reach 300.0 K at step `S = 5000`.", &
    1147        66090 :                                    repeats=.FALSE., input_variables=["S", "T"])
    1148              : 
    1149        22030 :       CALL section_add_subsection(region_section, tfunc_section)
    1150        22030 :       CALL section_release(tfunc_section)
    1151              :       ! Define temperature function end
    1152              : 
    1153        22030 :       CALL section_add_subsection(section, region_section)
    1154        22030 :       CALL section_release(region_section)
    1155              : 
    1156        22030 :       NULLIFY (print_key)
    1157              :       CALL section_create(subsection, __LOCATION__, name="PRINT", &
    1158              :                           description="Collects all print_keys for thermal_regions", &
    1159        22030 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
    1160              : 
    1161              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "TEMPERATURE", &
    1162              :                                        description="Controls the output of the temperature per "// &
    1163              :                                        "region. The first three columns are: step number, time "// &
    1164              :                                        "(in fs), and the temperature of atoms not in any temperature "// &
    1165              :                                        "region (or zero if all atoms are in some temperature region). "// &
    1166              :                                        "Subsequent columns are, in pairs, the target value "// &
    1167              :                                        "(calculated by TFUNC or specified by TEMPERATURE) "// &
    1168              :                                        "and the actual value of the temperature for each region.", &
    1169              :                                        print_level=high_print_level, common_iter_levels=1, &
    1170        22030 :                                        filename="")
    1171        22030 :       CALL section_add_subsection(subsection, print_key)
    1172        22030 :       CALL section_release(print_key)
    1173              : 
    1174              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "LANGEVIN_REGIONS", &
    1175              :                                        description="Controls output of information on which atoms "// &
    1176              :                                        "underwent Langevin MD and which atoms did not.", &
    1177              :                                        print_level=high_print_level, &
    1178        22030 :                                        filename="")
    1179        22030 :       CALL section_add_subsection(subsection, print_key)
    1180        22030 :       CALL section_release(print_key)
    1181              : 
    1182        22030 :       CALL section_add_subsection(section, subsection)
    1183        22030 :       CALL section_release(subsection)
    1184              : 
    1185        22030 :    END SUBROUTINE create_thermal_region_section
    1186              : 
    1187              : ! **************************************************************************************************
    1188              : !> \brief   Defines the parameters for the setup of a cascade simulation
    1189              : !> \param section ...
    1190              : !> \date    03.02.2012
    1191              : !> \author  Matthias Krack (MK)
    1192              : !> \version 1.0
    1193              : ! **************************************************************************************************
    1194        22030 :    SUBROUTINE create_cascade_section(section)
    1195              : 
    1196              :       TYPE(section_type), POINTER                        :: section
    1197              : 
    1198              :       TYPE(keyword_type), POINTER                        :: keyword
    1199              :       TYPE(section_type), POINTER                        :: subsection
    1200              : 
    1201        22030 :       NULLIFY (keyword)
    1202        22030 :       NULLIFY (subsection)
    1203        22030 :       CPASSERT(.NOT. ASSOCIATED(section))
    1204              : 
    1205              :       CALL section_create(section, __LOCATION__, name="CASCADE", &
    1206              :                           description="Defines the parameters for the setup of a cascade simulation.", &
    1207              :                           n_keywords=1, &
    1208              :                           n_subsections=1, &
    1209        22030 :                           repeats=.FALSE.)
    1210              : 
    1211              :       CALL keyword_create(keyword, __LOCATION__, &
    1212              :                           name="_SECTION_PARAMETERS_", &
    1213              :                           description="Controls the activation of the CASCADE section.", &
    1214              :                           usage="&CASCADE on", &
    1215              :                           default_l_val=.FALSE., &
    1216        22030 :                           lone_keyword_l_val=.TRUE.)
    1217        22030 :       CALL section_add_keyword(section, keyword)
    1218        22030 :       CALL keyword_release(keyword)
    1219              : 
    1220              :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY", &
    1221              :                           description="Total energy transferred to the system during the cascade event.", &
    1222              :                           usage="ENERGY 20.0", &
    1223              :                           default_r_val=0.0_dp, &
    1224        22030 :                           unit_str="keV")
    1225        22030 :       CALL section_add_keyword(section, keyword)
    1226        22030 :       CALL keyword_release(keyword)
    1227              : 
    1228              :       CALL section_create(subsection, __LOCATION__, name="ATOM_LIST", &
    1229              :                           description="Defines a list of atoms for which the initial velocities are modified", &
    1230              :                           n_keywords=1, &
    1231              :                           n_subsections=0, &
    1232        22030 :                           repeats=.FALSE.)
    1233              : 
    1234              :       CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
    1235              :                           description="Defines the list of atoms for which the velocities are modified. "// &
    1236              :                           "Each record consists of the atomic index, the velocity vector, and "// &
    1237              :                           "a weight to define which fraction of the total energy is assigned "// &
    1238              :                           "to the current atom: `Atomic_index  v_x  v_y  v_z  Weight`", &
    1239              :                           usage="{{Integer} {Real} {Real} {Real} {Real}}", &
    1240              :                           repeats=.TRUE., &
    1241        22030 :                           type_of_var=lchar_t)
    1242        22030 :       CALL section_add_keyword(subsection, keyword)
    1243        22030 :       CALL keyword_release(keyword)
    1244              : 
    1245        22030 :       CALL section_add_subsection(section, subsection)
    1246        22030 :       CALL section_release(subsection)
    1247              : 
    1248        22030 :    END SUBROUTINE create_cascade_section
    1249              : 
    1250              : ! **************************************************************************************************
    1251              : !> \brief Defines AVERAGES section
    1252              : !> \param section ...
    1253              : !> \author teo
    1254              : ! **************************************************************************************************
    1255        22030 :    SUBROUTINE create_avgs_section(section)
    1256              :       TYPE(section_type), POINTER                        :: section
    1257              : 
    1258              :       TYPE(keyword_type), POINTER                        :: keyword
    1259              :       TYPE(section_type), POINTER                        :: print_key, subsection
    1260              : 
    1261        22030 :       CPASSERT(.NOT. ASSOCIATED(section))
    1262              :       CALL section_create(section, __LOCATION__, name="Averages", &
    1263              :                           description="Controls the calculation of the averages during an MD run.", &
    1264        22030 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
    1265        22030 :       NULLIFY (keyword, print_key, subsection)
    1266              : 
    1267              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
    1268              :                           description="Controls the calculations of the averages.", &
    1269        22030 :                           usage="&AVERAGES T", default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    1270        22030 :       CALL section_add_keyword(section, keyword)
    1271        22030 :       CALL keyword_release(keyword)
    1272              : 
    1273              :       CALL keyword_create(keyword, __LOCATION__, name="ACQUISITION_START_TIME", &
    1274              :                           description="Setup up the simulation time when the acquisition process to compute"// &
    1275              :                           " averages is started.", &
    1276              :                           usage="ACQUISITION_START_TIME <REAL>", &
    1277        22030 :                           default_r_val=0.0_dp, unit_str='fs')
    1278        22030 :       CALL section_add_keyword(section, keyword)
    1279        22030 :       CALL keyword_release(keyword)
    1280              : 
    1281              :       CALL keyword_create(keyword, __LOCATION__, name="AVERAGE_COLVAR", &
    1282              :                           description="Switch for computing the averages of COLVARs.", &
    1283              :                           usage="AVERAGE_COLVAR <LOGICAL>", default_l_val=.FALSE., &
    1284        22030 :                           lone_keyword_l_val=.TRUE.)
    1285        22030 :       CALL section_add_keyword(section, keyword)
    1286        22030 :       CALL keyword_release(keyword)
    1287              : 
    1288              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PRINT_AVERAGES", &
    1289              :                                        description="Controls the output the averaged quantities", &
    1290              :                                        print_level=debug_print_level + 1, common_iter_levels=1, &
    1291        22030 :                                        filename="")
    1292        22030 :       CALL section_add_subsection(section, print_key)
    1293        22030 :       CALL section_release(print_key)
    1294              : 
    1295        22030 :       CALL create_avgs_restart_section(subsection)
    1296        22030 :       CALL section_add_subsection(section, subsection)
    1297        22030 :       CALL section_release(subsection)
    1298        22030 :    END SUBROUTINE create_avgs_section
    1299              : 
    1300              : ! **************************************************************************************************
    1301              : !> \brief Defines the ELECTRONS section: settings for the standalone electronic
    1302              : !>      potentiostat (constant-potential / Ne-electrode) driver.
    1303              : !> \param section ...
    1304              : ! **************************************************************************************************
    1305        22030 :    SUBROUTINE create_electrons_section(section)
    1306              :       TYPE(section_type), POINTER                        :: section
    1307              : 
    1308              :       TYPE(keyword_type), POINTER                        :: keyword
    1309              : 
    1310        22030 :       CPASSERT(.NOT. ASSOCIATED(section))
    1311              :       CALL section_create(section, __LOCATION__, name="ELECTRONS", &
    1312              :                           description="Settings for the electronic potentiostat driving a "// &
    1313              :                           "constant-potential / Ne-electrode MD run.", &
    1314              :                           citations=[Zhang2026], &
    1315        44060 :                           n_keywords=3, n_subsections=0, repeats=.FALSE.)
    1316              : 
    1317        22030 :       NULLIFY (keyword)
    1318              : 
    1319              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
    1320              :                           description="Controls the activation of the electronic potentiostat. "// &
    1321              :                           "There are three states, not two. Section ABSENT: nothing happens, no "// &
    1322              :                           ".cpcont file. Section present with T (or 1): full constant-potential "// &
    1323              :                           "dynamics -- q is propagated by the potentiostat, requires ENSEMBLE NVT "// &
    1324              :                           "or LANGEVIN. Section present with 0 (or F): REPORT-ONLY -- an ordinary "// &
    1325              :                           "MD run that additionally computes the Fermi level and work function "// &
    1326              :                           "every step and writes the .cpcont file, with q held at the system's "// &
    1327              :                           "electron count and TARGET_WORKFUNCTION reported as 0. Report-only needs "// &
    1328              :                           "only POTENTIAL_AVERAGE_AXIS and POTENTIAL_AVERAGE_REGION, works under "// &
    1329              :                           "any ensemble, and requires a plain FORCE_EVAL (not METHOD MIXED). Use "// &
    1330              :                           "it to measure the work function of a fixed-charge system -- for example "// &
    1331              :                           "to find the neutral work function before choosing TARGET_WORKFUNCTION "// &
    1332              :                           "and Q_INIT for a constant-potential run.", &
    1333        22030 :                           usage="&ELECTRONS T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1334        22030 :       CALL section_add_keyword(section, keyword)
    1335        22030 :       CALL keyword_release(keyword)
    1336              : 
    1337              :       CALL keyword_create(keyword, __LOCATION__, name="POTENTIAL_AVERAGE_AXIS", &
    1338              :                           description="Lattice axis along which the planar Hartree-potential "// &
    1339              :                           "average is computed for the work-function readback.", &
    1340              :                           usage="POTENTIAL_AVERAGE_AXIS Z", &
    1341              :                           default_i_val=3, &
    1342              :                           enum_c_vals=s2a("X", "Y", "Z"), &
    1343              :                           enum_desc=s2a("average along the x axis", &
    1344              :                                         "average along the y axis", &
    1345              :                                         "average along the z axis"), &
    1346        22030 :                           enum_i_vals=[1, 2, 3])
    1347        22030 :       CALL section_add_keyword(section, keyword)
    1348        22030 :       CALL keyword_release(keyword)
    1349              : 
    1350              :       CALL keyword_create(keyword, __LOCATION__, name="POTENTIAL_AVERAGE_REGION", &
    1351              :                           description="Minimum and maximum coordinate, along POTENTIAL_AVERAGE_AXIS, "// &
    1352              :                           "of the vacuum region over which the Hartree potential is averaged to "// &
    1353              :                           "obtain the work function.", &
    1354              :                           usage="POTENTIAL_AVERAGE_REGION 27.0 30.0", &
    1355        22030 :                           type_of_var=real_t, n_var=2, unit_str="angstrom")
    1356        22030 :       CALL section_add_keyword(section, keyword)
    1357        22030 :       CALL keyword_release(keyword)
    1358              : 
    1359              :       CALL keyword_create(keyword, __LOCATION__, name="NEUTRAL_ELECTRONS", &
    1360              :                           description="Reference (neutral-system) total electron count. Must match "// &
    1361              :                           "the actual DFT electron count of the simulated system -- there is no "// &
    1362              :                           "physically meaningful universal default. Plain number, not unit-converted.", &
    1363              :                           usage="NEUTRAL_ELECTRONS 1329.0", &
    1364        22030 :                           default_r_val=1329.0_dp)
    1365        22030 :       CALL section_add_keyword(section, keyword)
    1366        22030 :       CALL keyword_release(keyword)
    1367              : 
    1368              :       CALL keyword_create(keyword, __LOCATION__, name="Q_INIT", &
    1369              :                           description="Initial value of the potentiostat's electron-count variable q. "// &
    1370              :                           "Normally equal to NEUTRAL_ELECTRONS for a neutral start. Plain number, not "// &
    1371              :                           "unit-converted.", &
    1372              :                           usage="Q_INIT 1329.0", &
    1373        22030 :                           default_r_val=1329.0_dp)
    1374        22030 :       CALL section_add_keyword(section, keyword)
    1375        22030 :       CALL keyword_release(keyword)
    1376              : 
    1377              :       CALL keyword_create(keyword, __LOCATION__, name="TARGET_WORKFUNCTION", &
    1378              :                           description="Target work function the potentiostat drives toward. "// &
    1379              :                           "Accepts CP2K's usual [unit] qualifier, e.g. "// &
    1380              :                           "TARGET_WORKFUNCTION [eV] 4.81 or [hartree] 0.1768; a bare number is "// &
    1381              :                           "read as eV, so existing input decks are unaffected. The value is "// &
    1382              :                           "stored in atomic units and converted back to eV in md_run.F, because "// &
    1383              :                           "the potentiostat works in eV throughout.", &
    1384              :                           usage="TARGET_WORKFUNCTION [eV] 4.81", &
    1385              :                           default_r_val=cp_unit_to_cp2k(value=5.0_dp, unit_str="eV"), &
    1386        22030 :                           unit_str="eV")
    1387        22030 :       CALL section_add_keyword(section, keyword)
    1388        22030 :       CALL keyword_release(keyword)
    1389              : 
    1390              :       CALL keyword_create(keyword, __LOCATION__, name="MASS", &
    1391              :                           description="Fictitious mass of the electron-count degree of freedom, in "// &
    1392              :                           "atomic units. Plain number, not unit-converted.", &
    1393              :                           usage="MASS 400.0", &
    1394        22030 :                           default_r_val=400.0_dp)
    1395        22030 :       CALL section_add_keyword(section, keyword)
    1396        22030 :       CALL keyword_release(keyword)
    1397              : 
    1398              :       CALL keyword_create(keyword, __LOCATION__, name="TAU_POTENTIOSTAT", &
    1399              :                           description="Langevin relaxation time of the electronic potentiostat, in "// &
    1400              :                           "femtoseconds. Plain number, not unit-converted.", &
    1401              :                           usage="TAU_POTENTIOSTAT 200.0", &
    1402        22030 :                           default_r_val=200.0_dp)
    1403        22030 :       CALL section_add_keyword(section, keyword)
    1404        22030 :       CALL keyword_release(keyword)
    1405              : 
    1406              :       CALL keyword_create(keyword, __LOCATION__, name="TEMP_POTENTIOSTAT", &
    1407              :                           description="Target temperature of the electronic potentiostat Langevin "// &
    1408              :                           "thermostat, in kelvin. Plain number, not unit-converted. Set to 0.0 to "// &
    1409              :                           "disable stochastic noise (deterministic/damped dynamics only).", &
    1410              :                           usage="TEMP_POTENTIOSTAT 300.0", &
    1411        22030 :                           default_r_val=300.0_dp)
    1412        22030 :       CALL section_add_keyword(section, keyword)
    1413        22030 :       CALL keyword_release(keyword)
    1414              : 
    1415              :       CALL keyword_create(keyword, __LOCATION__, name="CHARGE_MIXING_INPLACE", &
    1416              :                           description="At a boundary crossing, mutate the stale endpoint's "// &
    1417              :                           "electron count IN PLACE instead of tearing it down and re-running "// &
    1418              :                           "qs_init. Only the electron count of the existing endpoint is changed. "// &
    1419              :                           "The converged wavefunction, "// &
    1420              :                           "the dispersion neighbour lists, pw_env and the atomic distributions "// &
    1421              :                           "all survive, so a crossing no longer cold-starts an SCF. Strongly "// &
    1422              :                           "recommended; FALSE only to fall back to the original rebuild path for "// &
    1423              :                           "comparison.", &
    1424              :                           usage="CHARGE_MIXING_INPLACE T", &
    1425        22030 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1426        22030 :       CALL section_add_keyword(section, keyword)
    1427        22030 :       CALL keyword_release(keyword)
    1428              : 
    1429              :       CALL keyword_create(keyword, __LOCATION__, name="LAMBDA", &
    1430              :                           description="Freeze the mixing weight at this value instead of deriving "// &
    1431              :                           "it from q. When given: q(t) is NOT propagated, the potentiostat is "// &
    1432              :                           "inactive, and the endpoints are never rebuilt -- the run becomes "// &
    1433              :                           "ordinary MD on the fixed combination (1-LAMBDA)*E(N_lo) + LAMBDA*E(N_hi) "// &
    1434              :                           "of the two integer-charge FORCE_EVALs, with N_lo/N_hi exactly as the "// &
    1435              :                           "input CHARGE keywords built them. Intended as a control experiment: it "// &
    1436              :                           "separates the charge mixing from the constant-potential dynamics. "// &
    1437              :                           "A run with LAMBDA set contains no constant-potential physics at all.", &
    1438              :                           usage="LAMBDA 0.5", &
    1439        22030 :                           type_of_var=real_t, default_r_val=HUGE(0.0_dp))
    1440        22030 :       CALL section_add_keyword(section, keyword)
    1441        22030 :       CALL keyword_release(keyword)
    1442              : 
    1443              :       CALL keyword_create(keyword, __LOCATION__, name="TARGET_FERMI_LEVEL", &
    1444              :                           description="Target Fermi level in eV. Setting this switches the "// &
    1445              :                           "potentiostat from work-function control to FERMI-LEVEL control: the "// &
    1446              :                           "generalized force becomes (TARGET_FERMI_LEVEL - current Fermi level) "// &
    1447              :                           "instead of (current work function - TARGET_WORKFUNCTION), and the "// &
    1448              :                           "grand-canonical potential becomes E - e_F_target*(q - N_neutral). "// &
    1449              :                           "TAKES PRECEDENCE over TARGET_WORKFUNCTION when both are present, so "// &
    1450              :                           "a restart file written in work-function mode can be switched to Fermi "// &
    1451              :                           "control by adding this one keyword. The two modes are NOT "// &
    1452              :                           "interchangeable: they differ by the vacuum level, whose derivative "// &
    1453              :                           "with respect to q is not zero for a charged slab, so holding one "// &
    1454              :                           "constant does not hold the other constant. "// &
    1455              :                           "Unset by default (sentinel HUGE). "// &
    1456              :                           "REFERENCE: this is an ABSOLUTE Kohn-Sham eigenvalue on CP2K's "// &
    1457              :                           "internal energy scale, NOT a shift relative to the neutral cell. "// &
    1458              :                           "In a periodic cell the G=0 Hartree term is set to zero, so that "// &
    1459              :                           "scale is referenced to the CELL-AVERAGE electrostatic potential: "// &
    1460              :                           "not to vacuum, and not to the Fermi level of the neutral system. "// &
    1461              :                           "To target a potential a known amount away from the neutral cell, "// &
    1462              :                           "first run the neutral cell once, read its Fermi level e_F(N0) from "// &
    1463              :                           "the output, and set TARGET_FERMI_LEVEL = e_F(N0) + your shift.", &
    1464              :                           usage="TARGET_FERMI_LEVEL -0.5", &
    1465        22030 :                           type_of_var=real_t, default_r_val=HUGE(0.0_dp))
    1466        22030 :       CALL section_add_keyword(section, keyword)
    1467        22030 :       CALL keyword_release(keyword)
    1468              : 
    1469              :       CALL keyword_create(keyword, __LOCATION__, name="CHARGE_MIXING", &
    1470              :                           description="Use dual integer-endpoint charge mixing (CP2K METHOD MIXED "// &
    1471              :                           "LINEAR_COMBINATION over two integer-charge FORCE_EVAL sections) instead "// &
    1472              :                           "of the Ne-electrode core correction. Q_INIT is the initial mixing "// &
    1473              :                           "coordinate q. NEUTRAL_ELECTRONS is REQUIRED here, contrary to what an "// &
    1474              :                           "earlier version of this text said: it sets the CHARGE of every rebuilt "// &
    1475              :                           "endpoint via NINT(neutral_electrons) - N, and defines the reference "// &
    1476              :                           "point of the grand-canonical potential.", &
    1477        22030 :                           usage="CHARGE_MIXING T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1478        22030 :       CALL section_add_keyword(section, keyword)
    1479        22030 :       CALL keyword_release(keyword)
    1480              : 
    1481              :       CALL keyword_create(keyword, __LOCATION__, name="CHARGE_MIXING_SPAN", &
    1482              :                           description="Integer span S between the two mixed FORCE_EVAL endpoints: "// &
    1483              :                           "N_lo=S*floor(q/S), N_hi=N_lo+S. Only used when CHARGE_MIXING is TRUE. "// &
    1484              :                           "S=2 keeps the endpoint parity fixed, which UKS with an explicit "// &
    1485              :                           "MULTIPLICITY requires. With CHARGE_MIXING_INPLACE, ADDED_MOS must "// &
    1486              :                           "cover every endpoint the run reaches (each crossing moves one by S).", &
    1487        22030 :                           usage="CHARGE_MIXING_SPAN 1", type_of_var=integer_t, default_i_val=1)
    1488        22030 :       CALL section_add_keyword(section, keyword)
    1489        22030 :       CALL keyword_release(keyword)
    1490              : 
    1491              :       ! ------------------------------------------------------------------
    1492              :       ! Restartable runtime state of the electronic extended variable.
    1493              :       ! These are rewritten into the input tree every step by md_run.F, so
    1494              :       ! CP2K's ordinary restart dump carries them and a continued run picks
    1495              :       ! up the electronic dynamics exactly where it left off.  Without them
    1496              :       ! a restart silently resets q to its original Q_INIT with p = 0 in the
    1497              :       ! middle of a trajectory.  Q_INIT above doubles as the restart slot for
    1498              :       ! q, exactly as CP2K reuses the input coordinates for the positions.
    1499              :       ! ------------------------------------------------------------------
    1500              : 
    1501              :       CALL keyword_create(keyword, __LOCATION__, name="P_INIT", &
    1502              :                           description="Initial (or restarted) momentum conjugate to the electronic "// &
    1503              :                           "coordinate q, in atomic units. Normally left at zero for a fresh run and "// &
    1504              :                           "written automatically into restart files.", &
    1505        22030 :                           usage="P_INIT 0.0", default_r_val=0.0_dp)
    1506        22030 :       CALL section_add_keyword(section, keyword)
    1507        22030 :       CALL keyword_release(keyword)
    1508              : 
    1509              :       CALL keyword_create(keyword, __LOCATION__, name="POTENTIOSTAT_ENERGY", &
    1510              :                           description="Accumulated heat exchanged with the electronic potentiostat, "// &
    1511              :                           "in atomic units, for conserved-quantity bookkeeping across restarts. "// &
    1512              :                           "Written automatically into restart files.", &
    1513        22030 :                           usage="POTENTIOSTAT_ENERGY 0.0", default_r_val=0.0_dp)
    1514        22030 :       CALL section_add_keyword(section, keyword)
    1515        22030 :       CALL keyword_release(keyword)
    1516              : 
    1517              :       CALL keyword_create(keyword, __LOCATION__, name="CURRENT_FERMI_LEVEL", &
    1518              :                           description="Last Fermi level in eV. Restart bookkeeping only: it is "// &
    1519              :                           "recomputed from the density at the first force evaluation, and exists so "// &
    1520              :                           "that the .cpcont column is meaningful on the restart step itself.", &
    1521        22030 :                           usage="CURRENT_FERMI_LEVEL 0.0", default_r_val=0.0_dp)
    1522        22030 :       CALL section_add_keyword(section, keyword)
    1523        22030 :       CALL keyword_release(keyword)
    1524              : 
    1525              :       CALL keyword_create(keyword, __LOCATION__, name="CURRENT_WORKFUNCTION", &
    1526              :                           description="Last work function in eV. Restart bookkeeping only, as for "// &
    1527              :                           "CURRENT_FERMI_LEVEL: md_run.F recomputes it at the initial force "// &
    1528              :                           "evaluation before the first electronic kick.", &
    1529        22030 :                           usage="CURRENT_WORKFUNCTION 0.0", default_r_val=0.0_dp)
    1530        22030 :       CALL section_add_keyword(section, keyword)
    1531        22030 :       CALL keyword_release(keyword)
    1532              : 
    1533        22030 :    END SUBROUTINE create_electrons_section
    1534              : 
    1535              : ! **************************************************************************************************
    1536              : !> \brief Defines the AVERAGES RESTART section
    1537              : !> \param section ...
    1538              : !> \author teo
    1539              : ! **************************************************************************************************
    1540        22030 :    SUBROUTINE create_avgs_restart_section(section)
    1541              :       TYPE(section_type), POINTER                        :: section
    1542              : 
    1543              :       TYPE(keyword_type), POINTER                        :: keyword
    1544              : 
    1545        22030 :       CPASSERT(.NOT. ASSOCIATED(section))
    1546              :       CALL section_create(section, __LOCATION__, name="RESTART_AVERAGES", &
    1547              :                           description="Stores information for restarting averages.", &
    1548        22030 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
    1549        22030 :       NULLIFY (keyword)
    1550              : 
    1551              :       CALL keyword_create(keyword, __LOCATION__, name="ITIMES_START", &
    1552              :                           description="TIME STEP starting the evaluation of averages", &
    1553        22030 :                           usage="ITIMES_START <INTEGER>", type_of_var=integer_t, n_var=1)
    1554        22030 :       CALL section_add_keyword(section, keyword)
    1555        22030 :       CALL keyword_release(keyword)
    1556              : 
    1557              :       CALL keyword_create(keyword, __LOCATION__, name="AVECPU", &
    1558              :                           description="CPU average", usage="AVECPU <REAL>", &
    1559        22030 :                           type_of_var=real_t, n_var=1)
    1560        22030 :       CALL section_add_keyword(section, keyword)
    1561        22030 :       CALL keyword_release(keyword)
    1562              : 
    1563              :       CALL keyword_create(keyword, __LOCATION__, name="AVEHUGONIOT", &
    1564              :                           description="HUGONIOT average", usage="AVEHUGONIOT <REAL>", &
    1565        22030 :                           type_of_var=real_t, n_var=1)
    1566        22030 :       CALL section_add_keyword(section, keyword)
    1567        22030 :       CALL keyword_release(keyword)
    1568              : 
    1569              :       CALL keyword_create(keyword, __LOCATION__, name="AVETEMP_BARO", &
    1570              :                           description="BAROSTAT TEMPERATURE average", usage="AVETEMP_BARO <REAL>", &
    1571        22030 :                           type_of_var=real_t, n_var=1)
    1572        22030 :       CALL section_add_keyword(section, keyword)
    1573        22030 :       CALL keyword_release(keyword)
    1574              : 
    1575              :       CALL keyword_create(keyword, __LOCATION__, name="AVEPOT", &
    1576              :                           description="POTENTIAL ENERGY average", usage="AVEPOT <REAL>", &
    1577        22030 :                           type_of_var=real_t, n_var=1)
    1578        22030 :       CALL section_add_keyword(section, keyword)
    1579        22030 :       CALL keyword_release(keyword)
    1580              : 
    1581              :       CALL keyword_create(keyword, __LOCATION__, name="AVEKIN", &
    1582              :                           description="KINETIC ENERGY average", usage="AVEKIN <REAL>", &
    1583        22030 :                           type_of_var=real_t, n_var=1)
    1584        22030 :       CALL section_add_keyword(section, keyword)
    1585        22030 :       CALL keyword_release(keyword)
    1586              : 
    1587              :       CALL keyword_create(keyword, __LOCATION__, name="AVETEMP", &
    1588              :                           description="TEMPERATURE average", usage="AVETEMP <REAL>", &
    1589        22030 :                           type_of_var=real_t, n_var=1)
    1590        22030 :       CALL section_add_keyword(section, keyword)
    1591        22030 :       CALL keyword_release(keyword)
    1592              : 
    1593              :       CALL keyword_create(keyword, __LOCATION__, name="AVEKIN_QM", &
    1594              :                           description="QM KINETIC ENERGY average in QMMM runs", usage="AVEKIN_QM <REAL>", &
    1595        22030 :                           type_of_var=real_t, n_var=1)
    1596        22030 :       CALL section_add_keyword(section, keyword)
    1597        22030 :       CALL keyword_release(keyword)
    1598              : 
    1599              :       CALL keyword_create(keyword, __LOCATION__, name="AVETEMP_QM", &
    1600              :                           description="QM TEMPERATURE average in QMMM runs", usage="AVETEMP_QM <REAL>", &
    1601        22030 :                           type_of_var=real_t, n_var=1)
    1602        22030 :       CALL section_add_keyword(section, keyword)
    1603        22030 :       CALL keyword_release(keyword)
    1604              : 
    1605              :       CALL keyword_create(keyword, __LOCATION__, name="AVEVOL", &
    1606              :                           description="VOLUME average", usage="AVEVOL <REAL>", &
    1607        22030 :                           type_of_var=real_t, n_var=1)
    1608        22030 :       CALL section_add_keyword(section, keyword)
    1609        22030 :       CALL keyword_release(keyword)
    1610              : 
    1611              :       CALL keyword_create(keyword, __LOCATION__, name="AVECELL_A", &
    1612              :                           description="CELL VECTOR A average", usage="AVECELL_A <REAL>", &
    1613        22030 :                           type_of_var=real_t, n_var=1)
    1614        22030 :       CALL section_add_keyword(section, keyword)
    1615        22030 :       CALL keyword_release(keyword)
    1616              : 
    1617              :       CALL keyword_create(keyword, __LOCATION__, name="AVECELL_B", &
    1618              :                           description="CELL VECTOR B average", usage="AVECELL_B <REAL>", &
    1619        22030 :                           type_of_var=real_t, n_var=1)
    1620        22030 :       CALL section_add_keyword(section, keyword)
    1621        22030 :       CALL keyword_release(keyword)
    1622              : 
    1623              :       CALL keyword_create(keyword, __LOCATION__, name="AVECELL_C", &
    1624              :                           description="CELL VECTOR C average", usage="AVECELL_C <REAL>", &
    1625        22030 :                           type_of_var=real_t, n_var=1)
    1626        22030 :       CALL section_add_keyword(section, keyword)
    1627        22030 :       CALL keyword_release(keyword)
    1628              : 
    1629              :       CALL keyword_create(keyword, __LOCATION__, name="AVEALPHA", &
    1630              :                           description="ALPHA cell angle average", usage="AVEALPHA <REAL>", &
    1631        22030 :                           type_of_var=real_t, n_var=1)
    1632        22030 :       CALL section_add_keyword(section, keyword)
    1633        22030 :       CALL keyword_release(keyword)
    1634              : 
    1635              :       CALL keyword_create(keyword, __LOCATION__, name="AVEBETA", &
    1636              :                           description="BETA cell angle average", usage="AVEBETA <REAL>", &
    1637        22030 :                           type_of_var=real_t, n_var=1)
    1638        22030 :       CALL section_add_keyword(section, keyword)
    1639        22030 :       CALL keyword_release(keyword)
    1640              : 
    1641              :       CALL keyword_create(keyword, __LOCATION__, name="AVEGAMMA", &
    1642              :                           description="GAMMA cell angle average", usage="AVEGAMMA <REAL>", &
    1643        22030 :                           type_of_var=real_t, n_var=1)
    1644        22030 :       CALL section_add_keyword(section, keyword)
    1645        22030 :       CALL keyword_release(keyword)
    1646              : 
    1647              :       CALL keyword_create(keyword, __LOCATION__, name="AVE_ECONS", &
    1648              :                           description="CONSTANT ENERGY average", usage="AVE_ECONS <REAL>", &
    1649        22030 :                           type_of_var=real_t, n_var=1)
    1650        22030 :       CALL section_add_keyword(section, keyword)
    1651        22030 :       CALL keyword_release(keyword)
    1652              : 
    1653              :       CALL keyword_create(keyword, __LOCATION__, name="AVE_PRESS", &
    1654              :                           description="PRESSURE average", usage="AVE_PRESS <REAL>", &
    1655        22030 :                           type_of_var=real_t, n_var=1)
    1656        22030 :       CALL section_add_keyword(section, keyword)
    1657        22030 :       CALL keyword_release(keyword)
    1658              : 
    1659              :       CALL keyword_create(keyword, __LOCATION__, name="AVE_PXX", &
    1660              :                           description="P_{XX} average", usage="AVE_PXX <REAL>", &
    1661        22030 :                           type_of_var=real_t, n_var=1)
    1662        22030 :       CALL section_add_keyword(section, keyword)
    1663        22030 :       CALL keyword_release(keyword)
    1664              : 
    1665              :       CALL keyword_create(keyword, __LOCATION__, name="AVE_PV_VIR", &
    1666              :                           description="PV VIRIAL average", usage="AVE_PV_VIR <REAL> .. <REAL>", &
    1667        22030 :                           type_of_var=real_t, n_var=9)
    1668        22030 :       CALL section_add_keyword(section, keyword)
    1669        22030 :       CALL keyword_release(keyword)
    1670              : 
    1671              :       CALL keyword_create(keyword, __LOCATION__, name="AVE_PV_TOT", &
    1672              :                           description="PV TOTAL average", usage="AVE_PV_TOT <REAL> .. <REAL>", &
    1673        22030 :                           type_of_var=real_t, n_var=9)
    1674        22030 :       CALL section_add_keyword(section, keyword)
    1675        22030 :       CALL keyword_release(keyword)
    1676              : 
    1677              :       CALL keyword_create(keyword, __LOCATION__, name="AVE_PV_KIN", &
    1678              :                           description="PV KINETIC average", usage="AVE_PV_KIN <REAL> .. <REAL>", &
    1679        22030 :                           type_of_var=real_t, n_var=9)
    1680        22030 :       CALL section_add_keyword(section, keyword)
    1681        22030 :       CALL keyword_release(keyword)
    1682              : 
    1683              :       CALL keyword_create(keyword, __LOCATION__, name="AVE_PV_CNSTR", &
    1684              :                           description="PV CONSTRAINTS average", usage="AVE_PV_CNSTR <REAL> .. <REAL>", &
    1685        22030 :                           type_of_var=real_t, n_var=9)
    1686        22030 :       CALL section_add_keyword(section, keyword)
    1687        22030 :       CALL keyword_release(keyword)
    1688              : 
    1689              :       CALL keyword_create(keyword, __LOCATION__, name="AVE_PV_XC", &
    1690              :                           description="PV XC average", usage="AVE_PV_XC <REAL> .. <REAL>", &
    1691        22030 :                           type_of_var=real_t, n_var=9)
    1692        22030 :       CALL section_add_keyword(section, keyword)
    1693        22030 :       CALL keyword_release(keyword)
    1694              : 
    1695              :       CALL keyword_create(keyword, __LOCATION__, name="AVE_PV_FOCK_4C", &
    1696              :                           description="PV XC average", usage="AVE_PV_FOCK_4C <REAL> .. <REAL>", &
    1697        22030 :                           type_of_var=real_t, n_var=9)
    1698        22030 :       CALL section_add_keyword(section, keyword)
    1699        22030 :       CALL keyword_release(keyword)
    1700              : 
    1701              :       CALL keyword_create(keyword, __LOCATION__, name="AVE_COLVARS", &
    1702              :                           description="COLVARS averages", usage="AVE_COLVARS <REAL> .. <REAL>", &
    1703        22030 :                           type_of_var=real_t, n_var=-1)
    1704        22030 :       CALL section_add_keyword(section, keyword)
    1705        22030 :       CALL keyword_release(keyword)
    1706              : 
    1707              :       CALL keyword_create(keyword, __LOCATION__, name="AVE_MMATRIX", &
    1708              :                           description="METRIC TENSOR averages", usage="AVE_MMATRIX <REAL> .. <REAL>", &
    1709        22030 :                           type_of_var=real_t, n_var=-1)
    1710        22030 :       CALL section_add_keyword(section, keyword)
    1711        22030 :       CALL keyword_release(keyword)
    1712        22030 :    END SUBROUTINE create_avgs_restart_section
    1713              : 
    1714              : ! **************************************************************************************************
    1715              : !> \brief Defines the INITIAL_VIBRATION section
    1716              : !> \param section ...
    1717              : !> \author Lianheng Tong
    1718              : ! **************************************************************************************************
    1719        22030 :    SUBROUTINE create_vib_init_section(section)
    1720              :       TYPE(section_type), POINTER                        :: section
    1721              : 
    1722              :       TYPE(keyword_type), POINTER                        :: keyword
    1723              : 
    1724        22030 :       CPASSERT(.NOT. ASSOCIATED(section))
    1725              :       CALL section_create(section, __LOCATION__, name="INITIAL_VIBRATION", &
    1726              :                           description="Controls the set of parameters for MD initialisation "// &
    1727              :                           "based on vibration analysis data. The starting atomic coordinates "// &
    1728              :                           "should be based on the relaxed positions obtained from a previous "// &
    1729              :                           "geometry/cell optimisation calculation, and the vibrational "// &
    1730              :                           "frequencies and displacements data should be obtained from a "// &
    1731              :                           "vibrational analysis calculation done based on the relaxed "// &
    1732              :                           "coordinates. The MD initialisation process expects the user has "// &
    1733              :                           "performed both geometry optimisation and vibrational analysis "// &
    1734              :                           "before hand, and won't perform those calculations automatically ", &
    1735              :                           citations=[West2006], &
    1736        44060 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    1737        22030 :       NULLIFY (keyword)
    1738              :       CALL keyword_create(keyword, __LOCATION__, name="VIB_EIGS_FILE_NAME", &
    1739              :                           description="The file name of vibrational frequency (eigenvalue) "// &
    1740              :                           "and displacement (eigenvector) data calculated from the a "// &
    1741              :                           "vibrational analysis calculation done previously. This file must "// &
    1742              :                           "be the same unformatted binary file as referred to by "// &
    1743              :                           "VIBRATIONAL_ANALYSIS%PRINT%CARTESIAN_EIGS keyword. If this keyword "// &
    1744              :                           "is not explicitly defined by the user, then the default file "// &
    1745              :                           "name of: <project_name>-<CARTESIAN_EIGS_FILENAME>.eig will be used", &
    1746              :                           usage="VIB_EIGS_FILE_NAME <FILENAME>", &
    1747        22030 :                           type_of_var=lchar_t)
    1748        22030 :       CALL section_add_keyword(section, keyword)
    1749        22030 :       CALL keyword_release(keyword)
    1750        22030 :       NULLIFY (keyword)
    1751              :       CALL keyword_create(keyword, __LOCATION__, name="PHASE", &
    1752              :                           description="Controls the initial ratio of potential and kinetic "// &
    1753              :                           "contribution to the total energy. Denote the input value as $p$; "// &
    1754              :                           "the contribution is determined by $\cos^2(2\pi p)$ for potential "// &
    1755              :                           "energy and $\sin^2(2\pi p)$ for kinetic energy. A negative $p$ "// &
    1756              :                           "means that for each vibration mode the phase is determined randomly. "// &
    1757              :                           "A value of $0.0 \lt p \lt 1.0$ will be the same for all vibration "// &
    1758              :                           "modes; a value of $p \gt 1.0$ will just be treated as 1.0. "// &
    1759              :                           "For example, setting $p = 0.25$ would set all modes to "// &
    1760              :                           "begin with entirely kinetic energy --- in other words, the initial "// &
    1761              :                           "atomic positions will remain at their optimised location", &
    1762              :                           default_r_val=-1.0_dp, &
    1763        22030 :                           usage="PHASE <REAL>")
    1764        22030 :       CALL section_add_keyword(section, keyword)
    1765        22030 :       CALL keyword_release(keyword)
    1766        22030 :    END SUBROUTINE create_vib_init_section
    1767              : 
    1768              : END MODULE input_cp2k_md
        

Generated by: LCOV version 2.0-1