LCOV - code coverage report
Current view: top level - src/motion - input_cp2k_md.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:3db43b4) Lines: 100.0 % 513 513
Test Date: 2026-04-03 06:55:30 Functions: 100.0 % 15 15

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

Generated by: LCOV version 2.0-1