LCOV - code coverage report
Current view: top level - src/start - input_cp2k_motion.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:9ccafda) Lines: 100.0 % 1168 1168
Test Date: 2026-10-15 00:55:44 Functions: 100.0 % 21 21

            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              : !>      10.2005 split input_cp2k into smaller modules [fawzi]
      11              : !>      01.2020 add keywords related to Space Groups [pcazade]
      12              : !> \author teo & fawzi
      13              : ! **************************************************************************************************
      14              : MODULE input_cp2k_motion
      15              :    USE bibliography, ONLY: Brieuc2016, &
      16              :                            Byrd1995, &
      17              :                            Ceriotti2010, &
      18              :                            Ceriotti2012, &
      19              :                            Ceriotti2014, &
      20              :                            Henkelman1999, &
      21              :                            Henkelman2014, &
      22              :                            Kapil2016, &
      23              :                            Lindh1995
      24              :    USE cp_output_handling, ONLY: add_last_numeric, &
      25              :                                  cp_print_key_section_create, &
      26              :                                  debug_print_level, &
      27              :                                  high_print_level, &
      28              :                                  low_print_level, &
      29              :                                  medium_print_level
      30              :    USE cp_units, ONLY: cp_unit_to_cp2k
      31              :    USE input_constants, ONLY: &
      32              :       bfgs_direct, bfgs_inverse, debug_lbfgs, default_bfgs_method_id, default_cg_method_id, default_dimer_method_id, &
      33              :       default_lbfgs_method_id, default_minimization_method_id, default_ts_method_id, &
      34              :       dimer_init_molden, dimer_init_random, &
      35              :       do_mc_gemc_npt, do_mc_gemc_nvt, do_mc_traditional, do_mc_virial, fmt_id_pdb, fmt_id_xyz, &
      36              :       gaussian, helium_cell_shape_cube, &
      37              :       helium_cell_shape_octahedron, helium_forces_average, helium_forces_last, &
      38              :       helium_mdist_exponential, helium_mdist_gaussian, helium_mdist_linear, &
      39              :       helium_mdist_quadratic, helium_mdist_singlev, helium_mdist_uniform, &
      40              :       helium_sampling_ceperley, helium_sampling_worm, helium_solute_intpot_mwater, helium_solute_intpot_nnp, &
      41              :       helium_solute_intpot_none, high_lbfgs, integrate_exact, integrate_numeric, low_lbfgs, ls_2pnt, ls_3pnt, ls_fit, &
      42              :       ls_gold, ls_none, matrix_init_cholesky, matrix_init_diagonal, medium_lbfgs, numerical, perm_cycle, &
      43              :       perm_plain, propagator_pimd, propagator_rpmd, propagator_cmd, propagator_bcmd, silent_lbfgs, &
      44              :       transformation_normal, transformation_stage
      45              :    USE input_cp2k_constraints, ONLY: create_constraint_section
      46              :    USE input_cp2k_free_energy, ONLY: create_fe_section
      47              :    USE input_cp2k_md, ONLY: create_md_section
      48              :    USE input_cp2k_motion_print, ONLY: add_format_keyword, &
      49              :                                       create_motion_print_section
      50              :    USE input_cp2k_neb, ONLY: create_band_section
      51              :    USE input_cp2k_subsys, ONLY: create_rng_section
      52              :    USE input_cp2k_thermostats, ONLY: create_coord_section, &
      53              :                                      create_gle_section, &
      54              :                                      create_velocity_section
      55              :    USE input_cp2k_tmc, ONLY: create_TMC_section
      56              :    USE input_keyword_types, ONLY: keyword_create, &
      57              :                                   keyword_release, &
      58              :                                   keyword_type
      59              :    USE input_section_types, ONLY: section_add_keyword, &
      60              :                                   section_add_subsection, &
      61              :                                   section_create, &
      62              :                                   section_release, &
      63              :                                   section_type
      64              :    USE input_val_types, ONLY: integer_t, &
      65              :                               lchar_t, &
      66              :                               logical_t, &
      67              :                               real_t, &
      68              :                               char_t
      69              :    USE kinds, ONLY: dp
      70              :    USE string_utilities, ONLY: newline, &
      71              :                                s2a
      72              : #include "../base/base_uses.f90"
      73              : 
      74              :    IMPLICIT NONE
      75              :    PRIVATE
      76              : 
      77              :    LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .TRUE.
      78              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_motion'
      79              : 
      80              :    PUBLIC :: create_motion_section
      81              : 
      82              : CONTAINS
      83              : 
      84              : ! **************************************************************************************************
      85              : !> \brief creates the motion section
      86              : !> \param section the section to be created
      87              : !> \author teo
      88              : ! **************************************************************************************************
      89         1455 :    SUBROUTINE create_motion_section(section)
      90              :       TYPE(section_type), POINTER                        :: section
      91              : 
      92              :       TYPE(section_type), POINTER                        :: subsection
      93              : 
      94         1455 :       CPASSERT(.NOT. ASSOCIATED(section))
      95              :       CALL section_create(section, __LOCATION__, name="motion", &
      96              :                           description="This section defines a set of tool connected with the motion of the nuclei.", &
      97         1455 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
      98              : 
      99         1455 :       NULLIFY (subsection)
     100              : 
     101              :       CALL create_geoopt_section(subsection, __LOCATION__, label="GEO_OPT", &
     102              :                                  description="This section sets the environment of the geometry optimizer.", &
     103              :                                  just_optimizers=.FALSE., &
     104         1455 :                                  use_model_hessian=.TRUE.)
     105         1455 :       CALL section_add_subsection(section, subsection)
     106         1455 :       CALL section_release(subsection)
     107              : 
     108         1455 :       CALL create_cell_opt_section(subsection)
     109         1455 :       CALL section_add_subsection(section, subsection)
     110         1455 :       CALL section_release(subsection)
     111              : 
     112         1455 :       CALL create_shellcore_opt_section(subsection)
     113         1455 :       CALL section_add_subsection(section, subsection)
     114         1455 :       CALL section_release(subsection)
     115              : 
     116         1455 :       CALL create_md_section(subsection)
     117         1455 :       CALL section_add_subsection(section, subsection)
     118         1455 :       CALL section_release(subsection)
     119              : 
     120         1455 :       CALL create_driver_section(subsection)
     121         1455 :       CALL section_add_subsection(section, subsection)
     122         1455 :       CALL section_release(subsection)
     123              : 
     124         1455 :       CALL create_fe_section(subsection)
     125         1455 :       CALL section_add_subsection(section, subsection)
     126         1455 :       CALL section_release(subsection)
     127              : 
     128         1455 :       CALL create_constraint_section(subsection)
     129         1455 :       CALL section_add_subsection(section, subsection)
     130         1455 :       CALL section_release(subsection)
     131              : 
     132         1455 :       CALL create_fp_section(subsection)
     133         1455 :       CALL section_add_subsection(section, subsection)
     134         1455 :       CALL section_release(subsection)
     135              : 
     136         1455 :       CALL create_mc_section(subsection)
     137         1455 :       CALL section_add_subsection(section, subsection)
     138         1455 :       CALL section_release(subsection)
     139              : 
     140         1455 :       CALL create_TMC_section(subsection)
     141         1455 :       CALL section_add_subsection(section, subsection)
     142         1455 :       CALL section_release(subsection)
     143              : 
     144         1455 :       CALL create_pint_section(subsection)
     145         1455 :       CALL section_add_subsection(section, subsection)
     146         1455 :       CALL section_release(subsection)
     147              : 
     148         1455 :       CALL create_band_section(subsection)
     149         1455 :       CALL section_add_subsection(section, subsection)
     150         1455 :       CALL section_release(subsection)
     151              : 
     152         1455 :       CALL create_motion_print_section(subsection)
     153         1455 :       CALL section_add_subsection(section, subsection)
     154         1455 :       CALL section_release(subsection)
     155              : 
     156         1455 :    END SUBROUTINE create_motion_section
     157              : 
     158              : ! **************************************************************************************************
     159              : !> \brief creates the Monte Carlo section
     160              : !> \param section the section to be created
     161              : !> \author matt
     162              : ! **************************************************************************************************
     163         1455 :    SUBROUTINE create_mc_section(section)
     164              :       TYPE(section_type), POINTER                        :: section
     165              : 
     166              :       TYPE(keyword_type), POINTER                        :: keyword
     167              :       TYPE(section_type), POINTER                        :: subsection
     168              : 
     169         1455 :       CPASSERT(.NOT. ASSOCIATED(section))
     170              :       CALL section_create(section, __LOCATION__, name="mc", &
     171              :                           description="This section sets parameters to set up a MonteCarlo calculation.", &
     172         1455 :                           n_keywords=10, n_subsections=2, repeats=.FALSE.)
     173              : 
     174         1455 :       NULLIFY (keyword, subsection)
     175              : 
     176              :       CALL keyword_create(keyword, __LOCATION__, name="NSTEP", &
     177              :                           description="Specifies the number of MC cycles.", &
     178              :                           usage="NSTEP {integer}", &
     179         1455 :                           default_i_val=100)
     180         1455 :       CALL section_add_keyword(section, keyword)
     181         1455 :       CALL keyword_release(keyword)
     182              : 
     183              :       CALL keyword_create(keyword, __LOCATION__, name="IPRINT", &
     184              :                           description="Prints coordinate/cell/etc information every IPRINT steps.", &
     185              :                           usage="IPRINT {integer}", &
     186         1455 :                           default_i_val=1)
     187         1455 :       CALL section_add_keyword(section, keyword)
     188         1455 :       CALL keyword_release(keyword)
     189              : 
     190              :       CALL keyword_create(keyword, __LOCATION__, name="NMOVES", &
     191              :                           description="Specifies the number of classical moves between energy evaluations. ", &
     192              :                           usage="NMOVES {integer}", &
     193         1455 :                           default_i_val=4)
     194         1455 :       CALL section_add_keyword(section, keyword)
     195         1455 :       CALL keyword_release(keyword)
     196              : 
     197              :       CALL keyword_create(keyword, __LOCATION__, name="NSWAPMOVES", &
     198              :                           description="How many insertions to try per swap move.", &
     199              :                           usage="NSWAPMOVES {integer}", &
     200         1455 :                           default_i_val=16)
     201         1455 :       CALL section_add_keyword(section, keyword)
     202         1455 :       CALL keyword_release(keyword)
     203              : 
     204              :       CALL keyword_create(keyword, __LOCATION__, name="LBIAS", &
     205              :                           description="Dictates if we presample moves with a different potential.", &
     206              :                           usage="LBIAS {logical}", &
     207         1455 :                           default_l_val=.FALSE.)
     208         1455 :       CALL section_add_keyword(section, keyword)
     209         1455 :       CALL keyword_release(keyword)
     210              : 
     211              :       CALL keyword_create(keyword, __LOCATION__, name="LSTOP", &
     212              :                           description="Makes nstep in terms of steps, instead of cycles.", &
     213              :                           usage="LSTOP {logical}", &
     214         1455 :                           default_l_val=.FALSE.)
     215         1455 :       CALL section_add_keyword(section, keyword)
     216         1455 :       CALL keyword_release(keyword)
     217              : 
     218              :       CALL keyword_create(keyword, __LOCATION__, name="LDISCRETE", &
     219              :                           description="Changes the volume of the box in discrete steps, one side at a time.", &
     220              :                           usage="LDISCRETE {logical}", &
     221         1455 :                           default_l_val=.FALSE.)
     222         1455 :       CALL section_add_keyword(section, keyword)
     223         1455 :       CALL keyword_release(keyword)
     224              : 
     225              :       CALL keyword_create(keyword, __LOCATION__, name="RCLUS", &
     226              :                           description="The cluster cut off radius in angstroms.", &
     227              :                           usage="RCLUS {real}", &
     228         1455 :                           default_r_val=1.0E0_dp)
     229         1455 :       CALL section_add_keyword(section, keyword)
     230         1455 :       CALL keyword_release(keyword)
     231              : 
     232              :       CALL keyword_create(keyword, __LOCATION__, name="RESTART", &
     233              :                           description="Read initial configuration from restart file.", &
     234              :                           usage="RESTART {logical}", &
     235         1455 :                           default_l_val=.FALSE.)
     236         1455 :       CALL section_add_keyword(section, keyword)
     237         1455 :       CALL keyword_release(keyword)
     238              : 
     239              :       CALL keyword_create( &
     240              :          keyword, __LOCATION__, name="NVIRIAL", &
     241              :          description="Use this many random orientations to compute the second virial coefficient (ENSEMBLE=VIRIAL)", &
     242              :          usage="NVIRIAL {integer}", &
     243         1455 :          default_i_val=1000)
     244         1455 :       CALL section_add_keyword(section, keyword)
     245         1455 :       CALL keyword_release(keyword)
     246              : 
     247              :       CALL keyword_create(keyword, __LOCATION__, name="ENSEMBLE", &
     248              :                           description="Specify the type of simulation", &
     249              :                           usage="ENSEMBLE (TRADITIONAL|GEMC_NVT|GEMC_NPT|VIRIAL)", &
     250              :                           enum_c_vals=s2a("TRADITIONAL", "GEMC_NVT", "GEMC_NPT", "VIRIAL"), &
     251              :                           enum_i_vals=[do_mc_traditional, do_mc_gemc_nvt, do_mc_gemc_npt, do_mc_virial], &
     252         1455 :                           default_i_val=do_mc_traditional)
     253         1455 :       CALL section_add_keyword(section, keyword)
     254         1455 :       CALL keyword_release(keyword)
     255              : 
     256              :       CALL keyword_create(keyword, __LOCATION__, name="RESTART_FILE_NAME", &
     257              :                           description="Name of the restart file for MC information.", &
     258              :                           usage="RESTART_FILE_NAME {filename}", &
     259         1455 :                           default_lc_val="")
     260         1455 :       CALL section_add_keyword(section, keyword)
     261         1455 :       CALL keyword_release(keyword)
     262              : 
     263              :       CALL keyword_create(keyword, __LOCATION__, name="MOVES_FILE_NAME", &
     264              :                           description="The file to print the move statistics to.", &
     265              :                           usage="MOVES_FILE_NAME {filename}", &
     266         1455 :                           default_lc_val="")
     267         1455 :       CALL section_add_keyword(section, keyword)
     268         1455 :       CALL keyword_release(keyword)
     269              : 
     270              :       CALL keyword_create(keyword, __LOCATION__, name="MOLECULES_FILE_NAME", &
     271              :                           description="The file to print the number of molecules to.", &
     272              :                           usage="MOLECULES_FILE_NAME {filename}", &
     273         1455 :                           default_lc_val="")
     274         1455 :       CALL section_add_keyword(section, keyword)
     275         1455 :       CALL keyword_release(keyword)
     276              : 
     277              :       CALL keyword_create(keyword, __LOCATION__, name="COORDINATE_FILE_NAME", &
     278              :                           description="The file to print the current coordinates to.", &
     279              :                           usage="COORDINATE_FILE_NAME {filename}", &
     280         1455 :                           default_lc_val="")
     281         1455 :       CALL section_add_keyword(section, keyword)
     282         1455 :       CALL keyword_release(keyword)
     283              : 
     284              :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY_FILE_NAME", &
     285              :                           description="The file to print current energies to.", &
     286              :                           usage="ENERGY_FILE_NAME {filename}", &
     287         1455 :                           default_lc_val="")
     288         1455 :       CALL section_add_keyword(section, keyword)
     289         1455 :       CALL keyword_release(keyword)
     290              : 
     291              :       CALL keyword_create(keyword, __LOCATION__, name="DATA_FILE_NAME", &
     292              :                           description="The file to print current configurational info to.", &
     293              :                           usage="DATA_FILE_NAME {filename}", &
     294         1455 :                           default_lc_val="")
     295         1455 :       CALL section_add_keyword(section, keyword)
     296         1455 :       CALL keyword_release(keyword)
     297              : 
     298              :       CALL keyword_create(keyword, __LOCATION__, name="CELL_FILE_NAME", &
     299              :                           description="The file to print current cell length info to.", &
     300              :                           usage="CELL_FILE_NAME {filename}", &
     301         1455 :                           default_lc_val="")
     302         1455 :       CALL section_add_keyword(section, keyword)
     303         1455 :       CALL keyword_release(keyword)
     304              : 
     305              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_DISP_FILE_NAME", &
     306              :                           description="The file to print current maximum displacement info to.", &
     307              :                           usage="MAX_DISP_FILE_NAME {filename}", &
     308         1455 :                           default_lc_val="")
     309         1455 :       CALL section_add_keyword(section, keyword)
     310         1455 :       CALL keyword_release(keyword)
     311              : 
     312              :       CALL keyword_create(keyword, __LOCATION__, name="BOX2_FILE_NAME", &
     313              :                           description="For GEMC, the name of the input file for the other box.", &
     314              :                           usage="BOX2_FILE_NAME {filename}", &
     315         1455 :                           default_lc_val="")
     316         1455 :       CALL section_add_keyword(section, keyword)
     317         1455 :       CALL keyword_release(keyword)
     318              : 
     319              :       CALL keyword_create(keyword, __LOCATION__, name="PRESSURE", &
     320              :                           description="The pressure for NpT simulations, in bar.", &
     321              :                           usage="PRESSURE {real}", &
     322         1455 :                           type_of_var=real_t)
     323         1455 :       CALL section_add_keyword(section, keyword)
     324         1455 :       CALL keyword_release(keyword)
     325              : 
     326              :       CALL keyword_create(keyword, __LOCATION__, name="TEMPERATURE", &
     327              :                           description="The temperature of the simulation, in Kelvin.", &
     328              :                           usage="TEMPERATURE {real}", &
     329         1455 :                           type_of_var=real_t)
     330         1455 :       CALL section_add_keyword(section, keyword)
     331         1455 :       CALL keyword_release(keyword)
     332              : 
     333              :       CALL keyword_create( &
     334              :          keyword, __LOCATION__, name="VIRIAL_TEMPS", &
     335              :          description="The temperatures you wish to compute the virial coefficient for.  Only used if ensemble=VIRIAL.", &
     336              :          usage="VIRIAL_TEMPS {real} {real} ... ", &
     337         1455 :          n_var=-1, type_of_var=real_t)
     338         1455 :       CALL section_add_keyword(section, keyword)
     339         1455 :       CALL keyword_release(keyword)
     340              : 
     341              :       CALL keyword_create(keyword, __LOCATION__, name="DISCRETE_STEP", &
     342              :                           description="The size of the discrete volume move step, in angstroms.", &
     343              :                           usage="DISCRETE_STEP {real}", &
     344         1455 :                           default_r_val=1.0E0_dp)
     345         1455 :       CALL section_add_keyword(section, keyword)
     346         1455 :       CALL keyword_release(keyword)
     347              : 
     348              :       CALL keyword_create(keyword, __LOCATION__, name="ETA", &
     349              :                           description="The free energy bias (in Kelvin) for swapping a molecule of each type into this box.", &
     350              :                           usage="ETA {real} {real} ... ", &
     351         1455 :                           n_var=-1, type_of_var=real_t)
     352         1455 :       CALL section_add_keyword(section, keyword)
     353         1455 :       CALL keyword_release(keyword)
     354              : 
     355              :       CALL keyword_create(keyword, __LOCATION__, name="RANDOMTOSKIP", &
     356              :                           description="Number of random numbers from the acceptance/rejection stream to skip", &
     357              :                           usage="RANDOMTOSKIP {integer}", &
     358         1455 :                           default_i_val=0)
     359         1455 :       CALL section_add_keyword(section, keyword)
     360         1455 :       CALL keyword_release(keyword)
     361              : 
     362         1455 :       CALL create_avbmc_section(subsection)
     363         1455 :       CALL section_add_subsection(section, subsection)
     364         1455 :       CALL section_release(subsection)
     365              : 
     366         1455 :       CALL create_move_prob_section(subsection)
     367         1455 :       CALL section_add_subsection(section, subsection)
     368         1455 :       CALL section_release(subsection)
     369              : 
     370         1455 :       CALL create_update_section(subsection)
     371         1455 :       CALL section_add_subsection(section, subsection)
     372         1455 :       CALL section_release(subsection)
     373              : 
     374         1455 :       CALL create_max_disp_section(subsection)
     375         1455 :       CALL section_add_subsection(section, subsection)
     376         1455 :       CALL section_release(subsection)
     377              : 
     378         1455 :    END SUBROUTINE create_mc_section
     379              : 
     380              : ! **************************************************************************************************
     381              : !> \brief ...
     382              : !> \param section will contain the AVBMC parameters for MC
     383              : !> \author matt
     384              : ! **************************************************************************************************
     385         1455 :    SUBROUTINE create_avbmc_section(section)
     386              :       TYPE(section_type), POINTER                        :: section
     387              : 
     388              :       TYPE(keyword_type), POINTER                        :: keyword
     389              : 
     390         1455 :       CPASSERT(.NOT. ASSOCIATED(section))
     391              : 
     392              :       CALL section_create(section, __LOCATION__, name="avbmc", &
     393              :                           description="Parameters for Aggregation Volume Bias Monte Carlo (AVBMC) "// &
     394              :                           "which explores cluster formation and destruction. "// &
     395              :                           "Chen and Siepmann, J. Phys. Chem. B 105, 11275-11282 (2001).", &
     396         1455 :                           n_keywords=5, n_subsections=0, repeats=.FALSE.)
     397              : 
     398         1455 :       NULLIFY (keyword)
     399              : 
     400              :       CALL keyword_create( &
     401              :          keyword, __LOCATION__, name="PBIAS", &
     402              :          description="The probability of swapping to an inner region in an AVBMC swap move for each molecule type.", &
     403              :          usage="PBIAS {real} {real} ... ", &
     404         1455 :          n_var=-1, type_of_var=real_t)
     405         1455 :       CALL section_add_keyword(section, keyword)
     406         1455 :       CALL keyword_release(keyword)
     407              : 
     408              :       CALL keyword_create(keyword, __LOCATION__, name="AVBMC_ATOM", &
     409              :                           description="The target atom for an AVBMC swap move for each molecule type.", &
     410              :                           usage="AVBMC_ATOM {integer} {integer} ... ", &
     411         1455 :                           n_var=-1, type_of_var=integer_t)
     412         1455 :       CALL section_add_keyword(section, keyword)
     413         1455 :       CALL keyword_release(keyword)
     414              : 
     415              :       CALL keyword_create(keyword, __LOCATION__, name="AVBMC_RMIN", &
     416              :                           description="The inner radius for an AVBMC swap move, in angstroms for every molecule type.", &
     417              :                           usage="AVBMC_RMIN {real} {real} ... ", &
     418         1455 :                           n_var=-1, type_of_var=real_t)
     419         1455 :       CALL section_add_keyword(section, keyword)
     420         1455 :       CALL keyword_release(keyword)
     421              : 
     422              :       CALL keyword_create(keyword, __LOCATION__, name="AVBMC_RMAX", &
     423              :                           description="The outer radius for an AVBMC swap move, in angstroms, for every molecule type.", &
     424              :                           usage="AVBMC_RMAX {real} {real} ... ", &
     425         1455 :                           n_var=-1, type_of_var=real_t)
     426         1455 :       CALL section_add_keyword(section, keyword)
     427         1455 :       CALL keyword_release(keyword)
     428              : 
     429         1455 :    END SUBROUTINE create_avbmc_section
     430              : 
     431              : ! **************************************************************************************************
     432              : !> \brief ...
     433              : !> \param section will contain the probabilities for attempting each move
     434              : !>        type in Monte Carlo
     435              : !> \author matt
     436              : ! **************************************************************************************************
     437         1455 :    SUBROUTINE create_move_prob_section(section)
     438              :       TYPE(section_type), POINTER                        :: section
     439              : 
     440              :       TYPE(keyword_type), POINTER                        :: keyword
     441              :       TYPE(section_type), POINTER                        :: subsection
     442              : 
     443         1455 :       CPASSERT(.NOT. ASSOCIATED(section))
     444              : 
     445              :       CALL section_create(section, __LOCATION__, name="move_probabilities", &
     446              :                           description="Parameters for fraction of moves performed for each move type.", &
     447         1455 :                           n_keywords=5, n_subsections=2, repeats=.FALSE.)
     448              : 
     449         1455 :       NULLIFY (keyword, subsection)
     450              : 
     451              :       CALL keyword_create(keyword, __LOCATION__, name="PMHMC", &
     452              :                           description="The probability of attempting a hybrid MC move.", &
     453              :                           usage="PMHMC {real}", &
     454         1455 :                           type_of_var=real_t, default_r_val=0.0E0_dp)
     455         1455 :       CALL section_add_keyword(section, keyword)
     456         1455 :       CALL keyword_release(keyword)
     457              : 
     458              :       CALL keyword_create(keyword, __LOCATION__, name="PMTRANS", &
     459              :                           description="The probability of attempting a molecule translation.", &
     460              :                           usage="PMTRANS {real}", &
     461         1455 :                           type_of_var=real_t)
     462         1455 :       CALL section_add_keyword(section, keyword)
     463         1455 :       CALL keyword_release(keyword)
     464              : 
     465              :       CALL keyword_create(keyword, __LOCATION__, name="PMCLTRANS", &
     466              :                           description="The probability of attempting a cluster translation.", &
     467              :                           usage="PMCLTRANS {real}", &
     468         1455 :                           type_of_var=real_t, default_r_val=0.0E0_dp)
     469         1455 :       CALL section_add_keyword(section, keyword)
     470         1455 :       CALL keyword_release(keyword)
     471              : 
     472              :       CALL keyword_create(keyword, __LOCATION__, name="PMAVBMC", &
     473              :                           description="The probability of attempting an AVBMC swap move.", &
     474              :                           usage="PMAVBMC {real}", &
     475         1455 :                           default_r_val=0.0E0_dp)
     476         1455 :       CALL section_add_keyword(section, keyword)
     477         1455 :       CALL keyword_release(keyword)
     478              : 
     479              :       CALL keyword_create(keyword, __LOCATION__, name="PMTRAION", &
     480              :                           description="The probability of attempting a conformational change.", &
     481              :                           usage="PMTRAION {real}", &
     482         1455 :                           type_of_var=real_t)
     483         1455 :       CALL section_add_keyword(section, keyword)
     484         1455 :       CALL keyword_release(keyword)
     485              : 
     486              :       CALL keyword_create(keyword, __LOCATION__, name="PMSWAP", &
     487              :                           description="The probability of attempting a swap move.", &
     488              :                           usage="PMSWAP {real}", &
     489         1455 :                           type_of_var=real_t, default_r_val=0.0E0_dp)
     490         1455 :       CALL section_add_keyword(section, keyword)
     491         1455 :       CALL keyword_release(keyword)
     492              : 
     493              :       CALL keyword_create(keyword, __LOCATION__, name="PMVOLUME", &
     494              :                           description="The probability of attempting a volume move.", &
     495              :                           usage="PMVOLUME {real}", &
     496         1455 :                           type_of_var=real_t, default_r_val=0.0E0_dp)
     497         1455 :       CALL section_add_keyword(section, keyword)
     498         1455 :       CALL keyword_release(keyword)
     499              : 
     500         1455 :       CALL create_mol_prob_section(subsection)
     501         1455 :       CALL section_add_subsection(section, subsection)
     502         1455 :       CALL section_release(subsection)
     503              : 
     504         1455 :       CALL create_box_prob_section(subsection)
     505         1455 :       CALL section_add_subsection(section, subsection)
     506         1455 :       CALL section_release(subsection)
     507              : 
     508         1455 :    END SUBROUTINE create_move_prob_section
     509              : 
     510              : ! **************************************************************************************************
     511              : !> \brief ...
     512              : !> \param section will contain the probabilities for attempting various moves
     513              : !>        on the various molecule types present in the system
     514              : !> \author matt
     515              : ! **************************************************************************************************
     516         1455 :    SUBROUTINE create_mol_prob_section(section)
     517              :       TYPE(section_type), POINTER                        :: section
     518              : 
     519              :       TYPE(keyword_type), POINTER                        :: keyword
     520              : 
     521         1455 :       CPASSERT(.NOT. ASSOCIATED(section))
     522              : 
     523              :       CALL section_create(section, __LOCATION__, name="mol_probabilities", &
     524              :                           description="Probabilities of attempting various moves types on "// &
     525              :                           "the various molecular types present in the simulation.", &
     526         1455 :                           n_keywords=5, n_subsections=0, repeats=.FALSE.)
     527              : 
     528         1455 :       NULLIFY (keyword)
     529              : 
     530              :       CALL keyword_create(keyword, __LOCATION__, name="PMAVBMC_MOL", &
     531              :                           description="The probability of attempting an AVBMC swap move on each molecule type.", &
     532              :                           usage="PMAVBMC_MOL {real} {real} ... ", &
     533         1455 :                           n_var=-1, type_of_var=real_t)
     534         1455 :       CALL section_add_keyword(section, keyword)
     535         1455 :       CALL keyword_release(keyword)
     536              : 
     537              :       CALL keyword_create(keyword, __LOCATION__, name="PMSWAP_MOL", &
     538              :                           description="The probability of attempting a molecule swap of a given molecule type.", &
     539              :                           usage="PMSWAP_MOL {real} {real} ... ", &
     540         1455 :                           n_var=-1, type_of_var=real_t)
     541         1455 :       CALL section_add_keyword(section, keyword)
     542         1455 :       CALL keyword_release(keyword)
     543              : 
     544              :       CALL keyword_create(keyword, __LOCATION__, name="PMROT_MOL", &
     545              :                           description="The probability of attempting a molecule rotation of a given molecule type.", &
     546              :                           usage="PMROT_MOL {real} {real} ... ", &
     547         1455 :                           n_var=-1, type_of_var=real_t)
     548         1455 :       CALL section_add_keyword(section, keyword)
     549         1455 :       CALL keyword_release(keyword)
     550              : 
     551              :       CALL keyword_create(keyword, __LOCATION__, name="PMTRAION_MOL", &
     552              :                           description="The probability of attempting a conformational change of a given molecule type.", &
     553              :                           usage="PMTRAION_MOL {real} {real} ... ", &
     554         1455 :                           n_var=-1, type_of_var=real_t)
     555         1455 :       CALL section_add_keyword(section, keyword)
     556         1455 :       CALL keyword_release(keyword)
     557              : 
     558              :       CALL keyword_create(keyword, __LOCATION__, name="PMTRANS_MOL", &
     559              :                           description="The probability of attempting a molecule translation of a given molecule type.", &
     560              :                           usage="PMTRANS_MOL {real} {real} ... ", &
     561         1455 :                           n_var=-1, type_of_var=real_t)
     562         1455 :       CALL section_add_keyword(section, keyword)
     563         1455 :       CALL keyword_release(keyword)
     564              : 
     565         1455 :    END SUBROUTINE create_mol_prob_section
     566              : 
     567              : ! **************************************************************************************************
     568              : !> \brief ...
     569              : !> \param section will contain the probabilities for attempting various moves
     570              : !>        on the box where the variable is present
     571              : !> \author matt
     572              : ! **************************************************************************************************
     573         1455 :    SUBROUTINE create_box_prob_section(section)
     574              :       TYPE(section_type), POINTER                        :: section
     575              : 
     576              :       TYPE(keyword_type), POINTER                        :: keyword
     577              : 
     578         1455 :       CPASSERT(.NOT. ASSOCIATED(section))
     579              : 
     580              :       CALL section_create(section, __LOCATION__, name="BOX_PROBABILITIES", &
     581              :                           description="Probabilities of attempting various moves types on "// &
     582              :                           "the box.", &
     583         1455 :                           n_keywords=2, n_subsections=0, repeats=.FALSE.)
     584              : 
     585         1455 :       NULLIFY (keyword)
     586              : 
     587              :       CALL keyword_create(keyword, __LOCATION__, name="PMHMC_BOX", &
     588              :                           description="The probability of attempting a HMC move on this box.", &
     589              :                           usage="PMHMC_BOX {real}", &
     590         1455 :                           type_of_var=real_t, default_r_val=1.0E0_dp)
     591         1455 :       CALL section_add_keyword(section, keyword)
     592         1455 :       CALL keyword_release(keyword)
     593              : 
     594              :       CALL keyword_create(keyword, __LOCATION__, name="PMVOL_BOX", &
     595              :                           description="The probability of attempting a volume move on this box (GEMC_NpT).", &
     596              :                           usage="PMVOL_BOX {real}", &
     597         1455 :                           type_of_var=real_t, default_r_val=1.0E0_dp)
     598         1455 :       CALL section_add_keyword(section, keyword)
     599         1455 :       CALL keyword_release(keyword)
     600              : 
     601              :       CALL keyword_create(keyword, __LOCATION__, name="PMCLUS_BOX", &
     602              :                           description="The probability of attempting a cluster move in this box", &
     603              :                           usage="PMCLUS_BOX {real}", &
     604         1455 :                           type_of_var=real_t, default_r_val=1.0E0_dp)
     605         1455 :       CALL section_add_keyword(section, keyword)
     606         1455 :       CALL keyword_release(keyword)
     607              : 
     608         1455 :    END SUBROUTINE create_box_prob_section
     609              : 
     610              : ! **************************************************************************************************
     611              : !> \brief ...
     612              : !> \param section will contain the frequency for updating maximum
     613              : !>        displacements for various moves
     614              : !> \author matt
     615              : ! **************************************************************************************************
     616         1455 :    SUBROUTINE create_update_section(section)
     617              :       TYPE(section_type), POINTER                        :: section
     618              : 
     619              :       TYPE(keyword_type), POINTER                        :: keyword
     620              : 
     621         1455 :       CPASSERT(.NOT. ASSOCIATED(section))
     622              : 
     623              :       CALL section_create(section, __LOCATION__, name="MOVE_UPDATES", &
     624              :                           description="Frequency for updating move maximum displacements.", &
     625         1455 :                           n_keywords=2, n_subsections=0, repeats=.FALSE.)
     626              : 
     627         1455 :       NULLIFY (keyword)
     628              : 
     629              :       CALL keyword_create(keyword, __LOCATION__, name="IUPVOLUME", &
     630              :                           description="Every iupvolume steps update maximum volume displacement.", &
     631              :                           usage="IUPVOLUME {integer}", &
     632         1455 :                           default_i_val=10000)
     633         1455 :       CALL section_add_keyword(section, keyword)
     634         1455 :       CALL keyword_release(keyword)
     635              : 
     636              :       CALL keyword_create(keyword, __LOCATION__, name="IUPTRANS", &
     637              :                           description="Every iuptrans steps update maximum "// &
     638              :                           "translation/rotation/configurational changes.", &
     639              :                           usage="IUPTRANS {integer}", &
     640         1455 :                           default_i_val=10000)
     641         1455 :       CALL section_add_keyword(section, keyword)
     642         1455 :       CALL keyword_release(keyword)
     643              : 
     644              :       CALL keyword_create(keyword, __LOCATION__, name="IUPCLTRANS", &
     645              :                           description="Every iupcltrans steps update maximum cluster translation.", &
     646              :                           usage="IUPCLTRANS {integer}", &
     647         1455 :                           default_i_val=10000)
     648         1455 :       CALL section_add_keyword(section, keyword)
     649         1455 :       CALL keyword_release(keyword)
     650              : 
     651         1455 :    END SUBROUTINE create_update_section
     652              : 
     653              : ! **************************************************************************************************
     654              : !> \brief ...
     655              : !> \param section will contain the maximum displacements for various moves
     656              : !> \author matt
     657              : ! **************************************************************************************************
     658         1455 :    SUBROUTINE create_max_disp_section(section)
     659              :       TYPE(section_type), POINTER                        :: section
     660              : 
     661              :       TYPE(section_type), POINTER                        :: subsection
     662              : 
     663         1455 :       CPASSERT(.NOT. ASSOCIATED(section))
     664              : 
     665              :       CALL section_create(section, __LOCATION__, name="max_displacements", &
     666              :                           description="The maximum displacements for all attempted moves.", &
     667         1455 :                           n_keywords=1, n_subsections=2, repeats=.FALSE.)
     668              : 
     669         1455 :       NULLIFY (subsection)
     670              : 
     671         1455 :       CALL create_mol_disp_section(subsection)
     672         1455 :       CALL section_add_subsection(section, subsection)
     673         1455 :       CALL section_release(subsection)
     674              : 
     675         1455 :       CALL create_box_disp_section(subsection)
     676         1455 :       CALL section_add_subsection(section, subsection)
     677         1455 :       CALL section_release(subsection)
     678              : 
     679         1455 :    END SUBROUTINE create_max_disp_section
     680              : 
     681              : ! **************************************************************************************************
     682              : !> \brief ...
     683              : !> \param section will contain the maximum displacements for all moves which
     684              : !>        require a value for each molecule type
     685              : !> \author matt
     686              : ! **************************************************************************************************
     687         1455 :    SUBROUTINE create_mol_disp_section(section)
     688              :       TYPE(section_type), POINTER                        :: section
     689              : 
     690              :       TYPE(keyword_type), POINTER                        :: keyword
     691              : 
     692         1455 :       CPASSERT(.NOT. ASSOCIATED(section))
     693              : 
     694              :       CALL section_create(section, __LOCATION__, name="mol_displacements", &
     695              :                           description="Maximum displacements for every move type that requires "// &
     696              :                           "a value for each molecular type in the simulation.", &
     697         1455 :                           n_keywords=5, n_subsections=0, repeats=.FALSE.)
     698              : 
     699         1455 :       NULLIFY (keyword)
     700              : 
     701              :       CALL keyword_create(keyword, __LOCATION__, name="RMBOND", &
     702              :                           description="Maximum bond length displacement, in angstroms, for each molecule type.", &
     703              :                           usage="RMBOND {real} {real} ... ", &
     704         1455 :                           n_var=-1, type_of_var=real_t)
     705         1455 :       CALL section_add_keyword(section, keyword)
     706         1455 :       CALL keyword_release(keyword)
     707              : 
     708              :       CALL keyword_create(keyword, __LOCATION__, name="RMANGLE", &
     709              :                           description="Maximum bond angle displacement, in degrees, for each molecule type.", &
     710              :                           usage="RMANGLE {real} {real} ...", &
     711         1455 :                           n_var=-1, type_of_var=real_t)
     712         1455 :       CALL section_add_keyword(section, keyword)
     713         1455 :       CALL keyword_release(keyword)
     714              : 
     715              :       CALL keyword_create(keyword, __LOCATION__, name="RMDIHEDRAL", &
     716              :                           description="Maximum dihedral angle distplacement, in degrees, for each molecule type.", &
     717              :                           usage="RMDIHEDRAL {real} {real} ... ", &
     718         1455 :                           n_var=-1, type_of_var=real_t)
     719         1455 :       CALL section_add_keyword(section, keyword)
     720         1455 :       CALL keyword_release(keyword)
     721              : 
     722              :       CALL keyword_create(keyword, __LOCATION__, name="RMROT", &
     723              :                           description="Maximum rotational displacement, in degrees, for each molecule type.", &
     724              :                           usage="RMROT {real} {real} ... ", &
     725         1455 :                           n_var=-1, type_of_var=real_t)
     726         1455 :       CALL section_add_keyword(section, keyword)
     727         1455 :       CALL keyword_release(keyword)
     728              : 
     729              :       CALL keyword_create(keyword, __LOCATION__, name="RMTRANS", &
     730              :                           description="Maximum translational displacement, in angstroms, for each molecule type.", &
     731              :                           usage="RMTRANS {real} {real} ...", &
     732         1455 :                           n_var=-1, type_of_var=real_t)
     733         1455 :       CALL section_add_keyword(section, keyword)
     734         1455 :       CALL keyword_release(keyword)
     735              : 
     736         1455 :    END SUBROUTINE create_mol_disp_section
     737              : 
     738              : ! **************************************************************************************************
     739              : !> \brief ...
     740              : !> \param section will contain the maximum displacements for any move that
     741              : !>        is done on each simulation box
     742              : !> \author matt
     743              : ! **************************************************************************************************
     744         1455 :    SUBROUTINE create_box_disp_section(section)
     745              :       TYPE(section_type), POINTER                        :: section
     746              : 
     747              :       TYPE(keyword_type), POINTER                        :: keyword
     748              : 
     749         1455 :       CPASSERT(.NOT. ASSOCIATED(section))
     750              : 
     751              :       CALL section_create(section, __LOCATION__, name="BOX_DISPLACEMENTS", &
     752              :                           description="Maximum displacements for any move that is performed on each"// &
     753              :                           " simulation box.", &
     754         1455 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     755              : 
     756         1455 :       NULLIFY (keyword)
     757              : 
     758              :       CALL keyword_create(keyword, __LOCATION__, name="RMVOLUME", &
     759              :                           description="Maximum volume displacement, in angstrom**3.", &
     760              :                           usage="RMVOLUME {real}", &
     761         1455 :                           type_of_var=real_t)
     762         1455 :       CALL section_add_keyword(section, keyword)
     763         1455 :       CALL keyword_release(keyword)
     764              : 
     765              :       CALL keyword_create(keyword, __LOCATION__, name="RMCLTRANS", &
     766              :                           description="Maximum translational displacement, in angstroms, for each cluster.", &
     767              :                           usage="RMCLTRANS {real}", &
     768         1455 :                           default_r_val=1.0E0_dp)
     769         1455 :       CALL section_add_keyword(section, keyword)
     770         1455 :       CALL keyword_release(keyword)
     771              : 
     772         1455 :    END SUBROUTINE create_box_disp_section
     773              : 
     774              : ! **************************************************************************************************
     775              : !> \brief creates the geometry optimization section
     776              : !> \param section the section to be created
     777              : !> \param location ...
     778              : !> \param label ...
     779              : !> \param description ...
     780              : !> \param just_optimizers ...
     781              : !> \param use_model_hessian ...
     782              : !> \par History
     783              : !>      01.2020 keywords related to Space Group Symmetry added [pcazade]
     784              : !> \author teo
     785              : ! **************************************************************************************************
     786         5820 :    RECURSIVE SUBROUTINE create_geoopt_section(section, location, label, description, just_optimizers, use_model_hessian)
     787              :       TYPE(section_type), POINTER                        :: section
     788              :       CHARACTER(LEN=*), INTENT(IN)                       :: location, label, description
     789              :       LOGICAL, INTENT(IN)                                :: just_optimizers, use_model_hessian
     790              : 
     791              :       TYPE(keyword_type), POINTER                        :: keyword
     792              :       TYPE(section_type), POINTER                        :: print_key, subsection
     793              : 
     794         5820 :       CPASSERT(.NOT. ASSOCIATED(section))
     795              :       CALL section_create(section, location=location, name=label, description=description, &
     796         5820 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
     797              : 
     798         5820 :       NULLIFY (keyword)
     799         5820 :       IF (.NOT. just_optimizers) THEN
     800              :          CALL keyword_create(keyword, __LOCATION__, name="TYPE", &
     801              :                              description="Specify which kind of geometry optimization to perform", &
     802              :                              usage="TYPE (MINIMIZATION|TRANSITION_STATE)", &
     803              :                              enum_c_vals=s2a("MINIMIZATION", "TRANSITION_STATE"), &
     804              :                              enum_desc=s2a("Performs a geometry minimization.", &
     805              :                                            "Performs a transition state optimization."), &
     806              :                              enum_i_vals=[default_minimization_method_id, default_ts_method_id], &
     807         1455 :                              default_i_val=default_minimization_method_id)
     808         1455 :          CALL section_add_keyword(section, keyword)
     809         1455 :          CALL keyword_release(keyword)
     810              :       END IF
     811              : 
     812              :       CALL keyword_create( &
     813              :          keyword, __LOCATION__, name="OPTIMIZER", &
     814              :          variants=["MINIMIZER"], &
     815              :          citations=[Byrd1995], &
     816              :          description="Specify which method to use to perform a geometry optimization.", &
     817              :          usage="OPTIMIZER {BFGS|LBFGS|CG}", &
     818              :          enum_c_vals=s2a("BFGS", "LBFGS", "CG"), &
     819              :          enum_desc=s2a("Most efficient minimizer, but only for 'small' systems, "// &
     820              :                        "as it relies on diagonalization of a full Hessian matrix", &
     821              :                        "Limited-memory variant of BFGS suitable for large systems. "// &
     822              :                        "Not as well fine-tuned but can be more robust.", &
     823              :                        "conjugate gradients, robust minimizer (depending on the line search) also OK for large systems"), &
     824              :          enum_i_vals=[default_bfgs_method_id, default_lbfgs_method_id, default_cg_method_id], &
     825        17460 :          default_i_val=default_bfgs_method_id)
     826         5820 :       CALL section_add_keyword(section, keyword)
     827         5820 :       CALL keyword_release(keyword)
     828              : 
     829              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_ITER", &
     830              :                           description="Specifies the maximum number of geometry optimization steps. "// &
     831              :                           "One step might imply several force evaluations for the CG and LBFGS optimizers.", &
     832              :                           usage="MAX_ITER {integer}", &
     833         5820 :                           default_i_val=200)
     834         5820 :       CALL section_add_keyword(section, keyword)
     835         5820 :       CALL keyword_release(keyword)
     836              : 
     837              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_DR", &
     838              :                           description="Convergence criterion for the maximum geometry change "// &
     839              :                           "between the current and the last optimizer iteration.", &
     840              :                           usage="MAX_DR {real}", &
     841         5820 :                           default_r_val=0.0030_dp, unit_str="bohr")
     842         5820 :       CALL section_add_keyword(section, keyword)
     843         5820 :       CALL keyword_release(keyword)
     844              : 
     845              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_FORCE", &
     846              :                           description="Convergence criterion for the maximum force component of the current configuration.", &
     847              :                           usage="MAX_FORCE {real}", &
     848         5820 :                           default_r_val=0.00045_dp, unit_str="hartree/bohr")
     849         5820 :       CALL section_add_keyword(section, keyword)
     850         5820 :       CALL keyword_release(keyword)
     851              : 
     852              :       CALL keyword_create(keyword, __LOCATION__, name="RMS_DR", &
     853              :                           description="Convergence criterion for the root mean square (RMS) geometry"// &
     854              :                           " change between the current and the last optimizer iteration.", &
     855              :                           usage="RMS_DR {real}", unit_str="bohr", &
     856         5820 :                           default_r_val=0.0015_dp)
     857         5820 :       CALL section_add_keyword(section, keyword)
     858         5820 :       CALL keyword_release(keyword)
     859              : 
     860              :       CALL keyword_create(keyword, __LOCATION__, name="RMS_FORCE", &
     861              :                           description="Convergence criterion for the root mean square (RMS) force of the current configuration.", &
     862              :                           usage="RMS_FORCE {real}", unit_str="hartree/bohr", &
     863         5820 :                           default_r_val=0.00030_dp)
     864         5820 :       CALL section_add_keyword(section, keyword)
     865         5820 :       CALL keyword_release(keyword)
     866              : 
     867              :       CALL keyword_create(keyword, __LOCATION__, name="step_start_val", &
     868              :                           description="The starting step value for the "//TRIM(label)//" module.", &
     869         5820 :                           usage="step_start_val <integer>", default_i_val=0)
     870         5820 :       CALL section_add_keyword(section, keyword)
     871         5820 :       CALL keyword_release(keyword)
     872              : 
     873              :       ! collects keywords related to Space Group Symmetry
     874              :       CALL keyword_create( &
     875              :          keyword, __LOCATION__, name="KEEP_SPACE_GROUP", &
     876              :          description="Detect space group of the system and preserve it during optimization. "// &
     877              :          "The space group symmetry is applied to coordinates, forces, the stress tensor, and "// &
     878              :          "the CELL_OPT cell metric. "// &
     879              :          "It works for supercell. It does not affect/reduce computational cost. "// &
     880              :          "Use EPS_SYMMETRY to adjust the detection threshold.", &
     881              :          usage="KEEP_SPACE_GROUP .TRUE.", &
     882         5820 :          default_l_val=.FALSE., lone_keyword_l_val=.TRUE., repeats=.FALSE.)
     883         5820 :       CALL section_add_keyword(section, keyword)
     884         5820 :       CALL keyword_release(keyword)
     885              : 
     886              :       ! collects keywords related to Space Group Symmetry analysis
     887              :       CALL keyword_create( &
     888              :          keyword, __LOCATION__, name="SHOW_SPACE_GROUP", &
     889              :          description="Detect and show space group of the system after optimization. "// &
     890              :          "It works for supercell. It does not affect/reduce computational cost. "// &
     891              :          "Use EPS_SYMMETRY to adjust the detection threshold.", &
     892              :          usage="SHOW_SPACE_GROUP .TRUE.", &
     893         5820 :          default_l_val=.FALSE., lone_keyword_l_val=.TRUE., repeats=.FALSE.)
     894         5820 :       CALL section_add_keyword(section, keyword)
     895         5820 :       CALL keyword_release(keyword)
     896              : 
     897              :       ! collects keywords related to precision for finding the space group
     898              :       CALL keyword_create( &
     899              :          keyword, __LOCATION__, name="EPS_SYMMETRY", &
     900              :          description="Accuracy for space group determination. EPS_SYMMETRY is dimensionless. "// &
     901              :        "Roughly speaking, two scaled (fractional) atomic positions v1, v2 are considered identical if |v1 - v2| < EPS_SYMMETRY. ", &
     902              :          usage="EPS_SYMMETRY {REAL}", &
     903         5820 :          default_r_val=1.e-4_dp, repeats=.FALSE.)
     904         5820 :       CALL section_add_keyword(section, keyword)
     905         5820 :       CALL keyword_release(keyword)
     906              : 
     907              :       ! collects keywords related to reduction of symmetry due to an external field
     908              :       CALL keyword_create( &
     909              :          keyword, __LOCATION__, name="SYMM_REDUCTION", &
     910              :          description="Direction of the external static electric field. "// &
     911              :          "Some symmetry operations are not compatible with the direction of an electric field. "// &
     912              :          "These operations are used when enforcing the space group.", &
     913              :          usage="SYMM_REDUCTION  0.0 0.0 0.0", &
     914              :          repeats=.FALSE., n_var=3, &
     915         5820 :          type_of_var=real_t, default_r_vals=[0.0_dp, 0.0_dp, 0.0_dp])
     916         5820 :       CALL section_add_keyword(section, keyword)
     917         5820 :       CALL keyword_release(keyword)
     918              : 
     919              :       ! collects keywords related to ranges of atoms to symmetrize
     920              :       CALL keyword_create( &
     921              :          keyword, __LOCATION__, name="SYMM_EXCLUDE_RANGE", &
     922              :          description="Range of atoms to exclude from space group symmetry. "// &
     923              :          "These atoms are excluded from both identification and enforcement. "// &
     924              :          "This keyword can be repeated.", &
     925         5820 :          repeats=.TRUE., usage="SYMM_EXCLUDE_RANGE {Int} {Int}", type_of_var=integer_t, n_var=2)
     926         5820 :       CALL section_add_keyword(section, keyword)
     927         5820 :       CALL keyword_release(keyword)
     928              : 
     929              :       CALL keyword_create( &
     930              :          keyword, __LOCATION__, name="SPGR_PRINT_ATOMS", &
     931              :          description="Print equivalent atoms list for each space group symmetry operation.", &
     932         5820 :          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     933         5820 :       CALL section_add_keyword(section, keyword)
     934         5820 :       CALL keyword_release(keyword)
     935              : 
     936         5820 :       CALL create_lbfgs_section(subsection)
     937         5820 :       CALL section_add_subsection(section, subsection)
     938         5820 :       CALL section_release(subsection)
     939              : 
     940         5820 :       CALL create_cg_section(subsection)
     941         5820 :       CALL section_add_subsection(section, subsection)
     942         5820 :       CALL section_release(subsection)
     943              : 
     944         5820 :       CALL create_bfgs_section(subsection, use_model_hessian)
     945         5820 :       CALL section_add_subsection(section, subsection)
     946         5820 :       CALL section_release(subsection)
     947              : 
     948         5820 :       IF (.NOT. just_optimizers) THEN
     949              :          ! Transition states section
     950         1455 :          CALL create_ts_section(subsection)
     951         1455 :          CALL section_add_subsection(section, subsection)
     952         1455 :          CALL section_release(subsection)
     953              : 
     954              :          ! Create the PRINT subsection
     955         1455 :          NULLIFY (subsection)
     956              :          CALL section_create(subsection, __LOCATION__, name="PRINT", &
     957              :                              description="Controls the printing properties during a geometry optimization run", &
     958         1455 :                              n_keywords=0, n_subsections=1, repeats=.TRUE.)
     959         1455 :          NULLIFY (print_key)
     960              :          CALL cp_print_key_section_create( &
     961              :             print_key, __LOCATION__, "program_run_info", &
     962              :             description="Controls the printing of basic information during the Geometry Optimization", &
     963         1455 :             print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
     964         1455 :          CALL section_add_subsection(subsection, print_key)
     965         1455 :          CALL section_release(print_key)
     966         1455 :          CALL section_add_subsection(section, subsection)
     967         1455 :          CALL section_release(subsection)
     968              :       END IF
     969              : 
     970         5820 :    END SUBROUTINE create_geoopt_section
     971              : 
     972              : ! **************************************************************************************************
     973              : !> \brief creates the section for the shell-core optimization
     974              : !> \param section the section to be created
     975              : !> \author Caino
     976              : ! **************************************************************************************************
     977         1455 :    SUBROUTINE create_shellcore_opt_section(section)
     978              :       TYPE(section_type), POINTER                        :: section
     979              : 
     980              :       TYPE(section_type), POINTER                        :: print_key, subsection
     981              : 
     982              :       CALL create_geoopt_section( &
     983              :          section, __LOCATION__, label="SHELL_OPT", &
     984              :          description="This section sets the environment for the optimization of the shell-core distances"// &
     985              :          " that might turn to be necessary along a MD run using a shell-model potential."// &
     986              :          " The optimization procedure is activated when at least one of the shell-core"// &
     987              :          " pairs becomes too elongated, i.e. when the assumption of point dipole is not longer valid.", &
     988              :          just_optimizers=.TRUE., &
     989         1455 :          use_model_hessian=.FALSE.)
     990              : 
     991         1455 :       NULLIFY (print_key, subsection)
     992              : 
     993              :       ! Create the PRINT subsection
     994              :       NULLIFY (subsection)
     995              :       CALL section_create(subsection, __LOCATION__, name="PRINT", &
     996              :                           description="Controls the printing properties during a shell-core optimization procedure", &
     997         1455 :                           n_keywords=0, n_subsections=1, repeats=.TRUE.)
     998         1455 :       NULLIFY (print_key)
     999              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "program_run_info", &
    1000              :                                        description="Controls the printing of basic information during the Optimization", &
    1001         1455 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
    1002         1455 :       CALL section_add_subsection(subsection, print_key)
    1003         1455 :       CALL section_release(print_key)
    1004         1455 :       CALL section_add_subsection(section, subsection)
    1005         1455 :       CALL section_release(subsection)
    1006              : 
    1007         1455 :    END SUBROUTINE create_shellcore_opt_section
    1008              : 
    1009              : ! **************************************************************************************************
    1010              : !> \brief creates the section for the cell optimization
    1011              : !> \param section the section to be created
    1012              : !> \author Teodoro Laino [tlaino] - University of Zurich - 03.2008
    1013              : ! **************************************************************************************************
    1014         1455 :    SUBROUTINE create_cell_opt_section(section)
    1015              :       TYPE(section_type), POINTER                        :: section
    1016              : 
    1017              :       TYPE(keyword_type), POINTER                        :: keyword
    1018              :       TYPE(section_type), POINTER                        :: print_key, subsection
    1019              : 
    1020              :       CALL create_geoopt_section(section, __LOCATION__, label="CELL_OPT", &
    1021              :                                  description="This section sets the environment for the optimization "// &
    1022              :                                  "of the simulation cell. As is noted in FORCE_EVAL/SUBSYS/CELL, the "// &
    1023              :                                  "program convention is that the first cell vector A lies along the "// &
    1024              :                                  "X-axis and the second cell vector B is in the XY plane, such that "// &
    1025              :                                  "the cell vector matrix is a lower triangle. There is no complete, "// &
    1026              :                                  "official algorithm support and/or tests for updating the three "// &
    1027              :                                  "upper triangular components during a cell optimization; please "// &
    1028              :                                  "prepare input accordingly with these three components precisely 0 "// &
    1029              :                                  "even for cases like the primitive rhombohedral cell of the FCC lattice.", &
    1030         1455 :                                  just_optimizers=.TRUE., use_model_hessian=.FALSE.)
    1031              : 
    1032         1455 :       NULLIFY (keyword, print_key, subsection)
    1033              :       CALL keyword_create( &
    1034              :          keyword, __LOCATION__, name="TYPE", removed=.TRUE., description="", &
    1035              :          deprecation_notice="The keyword MOTION/CELL_OPT/TYPE has been removed because "// &
    1036              :          "cell optimizations now always use DIRECT_CELL_OPT.", &
    1037              :          enum_c_vals=s2a("DIRECT_CELL_OPT", "GEO_OPT", "MD"), &
    1038         1455 :          enum_i_vals=[1, 2, 3], default_i_val=1)
    1039         1455 :       CALL section_add_keyword(section, keyword)
    1040         1455 :       CALL keyword_release(keyword)
    1041              : 
    1042              :       CALL keyword_create( &
    1043              :          keyword, __LOCATION__, name="EXTERNAL_PRESSURE", &
    1044              :          description="Specifies the external pressure (1 value or the full 9 components of the pressure tensor) "// &
    1045              :          "applied during the cell optimization.", &
    1046              :          usage="EXTERNAL_PRESSURE {REAL} .. {REAL}", unit_str="bar", &
    1047              :          default_r_vals=[cp_unit_to_cp2k(100.0_dp, "bar"), 0.0_dp, 0.0_dp, &
    1048              :                          0.0_dp, cp_unit_to_cp2k(100.0_dp, "bar"), 0.0_dp, &
    1049        14550 :                          0.0_dp, 0.0_dp, cp_unit_to_cp2k(100.0_dp, "bar")], n_var=-1)
    1050         1455 :       CALL section_add_keyword(section, keyword)
    1051         1455 :       CALL keyword_release(keyword)
    1052              : 
    1053              :       CALL keyword_create(keyword, __LOCATION__, name="KEEP_VOLUME", &
    1054              :                           description="Keep the volume of the cell constant during cell optimization. "// &
    1055              :                           "This is implemented by comparing the cell volumes and scaling the new "// &
    1056              :                           "cell vectors just before updating the cell information, and can be "// &
    1057              :                           "used together with KEEP_ANGLES or KEEP_SYMMETRY.", &
    1058         1455 :                           usage="KEEP_VOLUME TRUE", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1059         1455 :       CALL section_add_keyword(section, keyword)
    1060         1455 :       CALL keyword_release(keyword)
    1061              : 
    1062              :       CALL keyword_create(keyword, __LOCATION__, name="KEEP_ANGLES", &
    1063              :                           description="Keep angles between the cell vectors constant, but "// &
    1064              :                           "allow the lengths of the cell vectors to change independently "// &
    1065              :                           "during cell optimization. This is implemented by projecting out "// &
    1066              :                           "the components of angles in the cell gradient before the cell "// &
    1067              :                           "is updated. Albeit general, this is most useful for triclinic "// &
    1068              :                           "cells; to enforce higher symmetry, see KEEP_SYMMETRY.", &
    1069         1455 :                           usage="KEEP_ANGLES TRUE", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1070         1455 :       CALL section_add_keyword(section, keyword)
    1071         1455 :       CALL keyword_release(keyword)
    1072              : 
    1073              :       CALL keyword_create(keyword, __LOCATION__, name="KEEP_SYMMETRY", &
    1074              :                           description="Keep the requested initial cell symmetry as specified "// &
    1075              :                           "in the FORCE_EVAL/SUBSYS/CELL section during cell optimization. "// &
    1076              :                           "This is implemented by removing symmetry-breaking components and "// &
    1077              :                           "taking averages of components if necessary in the cell gradient "// &
    1078              :                           "before the cell is updated. To enforce the space group (which "// &
    1079              :                           "requires spglib package), see KEEP_SPACE_GROUP.", &
    1080         1455 :                           usage="KEEP_SYMMETRY TRUE", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1081         1455 :       CALL section_add_keyword(section, keyword)
    1082         1455 :       CALL keyword_release(keyword)
    1083              : 
    1084              :       CALL keyword_create( &
    1085              :          keyword, __LOCATION__, name="CONSTRAINT", &
    1086              :          description="Imposes a constraint on the pressure tensor by fixing the specified cell components. "// &
    1087              :          "Cell convention: a lies along x, b lies in the xy plane. The six independent components "// &
    1088              :          "are AX, BX, BY, CX, CY, CZ. A, B and C fix a complete cell vector: A = AX, B = BX and BY, "// &
    1089              :          "C = CX, CY and CZ. X, Y and Z follow the legacy direction tokens. X fixes every x "// &
    1090              :          "component: AX, BX and CX. Y fixes the complete b vector and the y component of c: "// &
    1091              :          "BX, BY and CY. Z fixes the complete c vector, because only c has a z component: Z equals C. "// &
    1092              :          "Accepted tokens: NONE, A, B, C, X, Y, Z, XY, XZ, YZ, AX, BX, BY, CX, CY, CZ. "// &
    1093              :          "Several tokens may be given on one line, the union of the fixed components is used. "// &
    1094              :          "NONE must stand alone, redundant tokens give a warning, and angle constraints "// &
    1095              :          "(ALPHA, BETA, GAMMA) are not supported yet. On a non-orthorhombic cell a constraint "// &
    1096              :          "that pins a shear component (BX, CX, CY), or a fixed diagonal component together "// &
    1097              :          "with KEEP_ANGLES, draws a warning: the pressure criterion is then met only when "// &
    1098              :          "the pinned values match the stress-free cell; otherwise it can stay off the "// &
    1099              :          "external pressure at the constrained minimum. Check the per-step pressure "// &
    1100              :          "convergence report.", &
    1101              :          usage="CONSTRAINT {NONE} | ({A|B|C|X|Y|Z|XY|XZ|YZ|AX|BX|BY|CX|CY|CZ} ...)", &
    1102         2910 :          type_of_var=char_t, n_var=-1, default_c_vals=["NONE"])
    1103         1455 :       CALL section_add_keyword(section, keyword)
    1104         1455 :       CALL keyword_release(keyword)
    1105              : 
    1106              :       CALL keyword_create(keyword, __LOCATION__, name="PRESSURE_TOLERANCE", &
    1107              :                           description="Specifies the Pressure tolerance (compared to the external pressure) to achieve "// &
    1108              :                           "during the cell optimization.", &
    1109              :                           usage="PRESSURE_TOLERANCE {REAL}", unit_str="bar", &
    1110         1455 :                           default_r_val=cp_unit_to_cp2k(100.0_dp, "bar"))
    1111         1455 :       CALL section_add_keyword(section, keyword)
    1112         1455 :       CALL keyword_release(keyword)
    1113              : 
    1114              :       ! Create the PRINT subsection
    1115         1455 :       NULLIFY (subsection)
    1116              :       CALL section_create(subsection, __LOCATION__, name="PRINT", &
    1117              :                           description="Controls the printing properties during a geometry optimization run", &
    1118         1455 :                           n_keywords=0, n_subsections=1, repeats=.TRUE.)
    1119         1455 :       NULLIFY (print_key)
    1120              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "program_run_info", &
    1121              :                                        description="Controls the printing of basic information during the Geometry Optimization", &
    1122         1455 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
    1123         1455 :       CALL section_add_subsection(subsection, print_key)
    1124         1455 :       CALL section_release(print_key)
    1125              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "cell", &
    1126              :                               description="Controls the printing of the cell eveytime a calculation using a new cell is started.", &
    1127              :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__", &
    1128         1455 :                                        unit_str="angstrom")
    1129         1455 :       CALL section_add_subsection(subsection, print_key)
    1130         1455 :       CALL section_release(print_key)
    1131         1455 :       CALL section_add_subsection(section, subsection)
    1132         1455 :       CALL section_release(subsection)
    1133              : 
    1134         1455 :    END SUBROUTINE create_cell_opt_section
    1135              : 
    1136              : ! **************************************************************************************************
    1137              : !> \brief creates the section for tuning transition states search
    1138              : !> \param section the section to be created
    1139              : !> \author Teodoro Laino [tlaino] - University of Zurich - 01.2008
    1140              : ! **************************************************************************************************
    1141         1455 :    SUBROUTINE create_ts_section(section)
    1142              :       TYPE(section_type), POINTER                        :: section
    1143              : 
    1144              :       TYPE(keyword_type), POINTER                        :: keyword
    1145              :       TYPE(section_type), POINTER                        :: print_key, subsection, subsection2, &
    1146              :                                                             subsection3
    1147              : 
    1148              : ! Create the Transition State subsection
    1149              : 
    1150         1455 :       NULLIFY (section, keyword, subsection, subsection2)
    1151              :       CALL section_create(section, __LOCATION__, name="TRANSITION_STATE", &
    1152              :                           description="Specifies parameters to perform a transition state search", &
    1153         1455 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    1154              : 
    1155              :       CALL keyword_create(keyword, __LOCATION__, name="METHOD", &
    1156              :                           description="Specify which kind of method to use for locating transition states", &
    1157              :                           citations=[Henkelman1999], &
    1158              :                           usage="METHOD (DIMER)", &
    1159              :                           enum_c_vals=s2a("DIMER"), &
    1160              :                           enum_desc=s2a("Uses the dimer method to optimize transition states."), &
    1161              :                           enum_i_vals=[default_dimer_method_id], &
    1162         2910 :                           default_i_val=default_dimer_method_id)
    1163         1455 :       CALL section_add_keyword(section, keyword)
    1164         1455 :       CALL keyword_release(keyword)
    1165              : 
    1166              :       CALL section_create(subsection, __LOCATION__, name="DIMER", &
    1167              :                           description="Specifies parameters for Dimer Method", &
    1168         1455 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    1169              : 
    1170              :       CALL keyword_create(keyword, __LOCATION__, name="DR", &
    1171              :                           description="This keyword sets the value for the DR parameter.", &
    1172              :                           usage="DR {real}", unit_str='angstrom', &
    1173         1455 :                           default_r_val=cp_unit_to_cp2k(0.01_dp, "angstrom"))
    1174         1455 :       CALL section_add_keyword(subsection, keyword)
    1175         1455 :       CALL keyword_release(keyword)
    1176              : 
    1177              :       CALL keyword_create(keyword, __LOCATION__, name="INITIALIZATION_METHOD", &
    1178              :                           description="Specify the initialization method of the dimer vector, "// &
    1179              :                           "which is crucial for converging to the desired transition state. "// &
    1180              :                           "If the DIMER_VECTOR section is defined explicitly, it will always "// &
    1181              :                           "be parsed directly (e.g. in restart files); INITIALIZATION_METHOD "// &
    1182              :                           "is only effective if the DIMER_VECTOR section is not explicit.", &
    1183              :                           usage="INITIALIZATION_METHOD (RANDOM|MOLDEN)", &
    1184              :                           enum_desc=s2a("Generate the initial dimer vector randomly. This is "// &
    1185              :                                         "the default for backwards compatibility; in practice "// &
    1186              :                                         "it may distort the structure and slow down convergence.", &
    1187              :                                         "Generate the initial dimer vector from one or more "// &
    1188              :                                         "vibrational normal modes as read from a MOLDEN file "// &
    1189              :                                         "produced by `VIBRATIONAL_ANALYSIS%PRINT%MOLDEN_VIB` "// &
    1190              :                                         "in a vibrational analysis task. Requires setting up "// &
    1191              :                                         "keywords `VIB_MOLDEN_NAME`, `VIB_INDEX` and `VIB_WEIGHT`."), &
    1192              :                           enum_c_vals=s2a("RANDOM", "MOLDEN"), &
    1193              :                           enum_i_vals=[dimer_init_random, dimer_init_molden], &
    1194         1455 :                           default_i_val=dimer_init_random)
    1195         1455 :       CALL section_add_keyword(subsection, keyword)
    1196         1455 :       CALL keyword_release(keyword)
    1197              : 
    1198              :       CALL keyword_create(keyword, __LOCATION__, name="VIB_MOLDEN_NAME", &
    1199              :                           description="The external molden file containing vibrational "// &
    1200              :                           "normal modes for `INITIALIZATION_METHOD MOLDEN`.", &
    1201         1455 :                           usage="VIB_MOLDEN_NAME <CHARACTER>", type_of_var=lchar_t)
    1202         1455 :       CALL section_add_keyword(subsection, keyword)
    1203         1455 :       CALL keyword_release(keyword)
    1204              : 
    1205              :       CALL keyword_create(keyword, __LOCATION__, name="VIB_INDEX", &
    1206              :                           description="The index of one or more vibrational normal modes "// &
    1207              :                           "from the file whose linear combination will form the initial "// &
    1208              :                           "dimer vector.", &
    1209              :                           usage="VIB_INDEX {integer} {integer} .. {integer}", repeats=.TRUE., &
    1210         1455 :                           n_var=-1, default_i_vals=[1], type_of_var=integer_t)
    1211         1455 :       CALL section_add_keyword(subsection, keyword)
    1212         1455 :       CALL keyword_release(keyword)
    1213              : 
    1214              :       CALL keyword_create(keyword, __LOCATION__, name="VIB_WEIGHT", &
    1215              :                           description="The weight of one or more vibrational normal modes "// &
    1216              :                           "from the file whose linear combination will form the initial "// &
    1217              :                           "dimer vector.", &
    1218              :                           usage="VIB_WEIGHT {real} {real} .. {real}", repeats=.TRUE., &
    1219         1455 :                           n_var=-1, default_r_vals=[1.0_dp], type_of_var=real_t)
    1220         1455 :       CALL section_add_keyword(subsection, keyword)
    1221         1455 :       CALL keyword_release(keyword)
    1222              : 
    1223              :       CALL keyword_create(keyword, __LOCATION__, name="INTERPOLATE_GRADIENT", &
    1224              :                           description="This keyword controls the interpolation of the gradient whenever possible"// &
    1225              :                           " during the optimization of the Dimer. The use of this keywords saves 1 evaluation"// &
    1226              :                           " of energy/forces.", usage="INTERPOLATE_GRADIENT {logical}", default_l_val=.TRUE., &
    1227         1455 :                           lone_keyword_l_val=.TRUE.)
    1228         1455 :       CALL section_add_keyword(subsection, keyword)
    1229         1455 :       CALL keyword_release(keyword)
    1230              : 
    1231              :       CALL keyword_create(keyword, __LOCATION__, name="ANGLE_TOLERANCE", &
    1232              :                           description="This keyword sets the value of the tolerance angle for the line search"// &
    1233              :                           " performed to optimize the orientation of the dimer.", &
    1234              :                           usage="ANGLE_TOLERANCE {real}", unit_str='rad', &
    1235         1455 :                           default_r_val=cp_unit_to_cp2k(5.0_dp, "deg"))
    1236         1455 :       CALL section_add_keyword(subsection, keyword)
    1237         1455 :       CALL keyword_release(keyword)
    1238              : 
    1239              :       CALL keyword_create(keyword, __LOCATION__, name="K-DIMER", &
    1240              :                           description="This keyword activates the constrained k-dimer translation"// &
    1241              :                           " J. Chem. Phys. 141, 164111 (2014).", &
    1242              :                           citations=[Henkelman2014], &
    1243              :                           usage="K-DIMER {logica}", &
    1244              :                           default_l_val=.FALSE., &
    1245         2910 :                           lone_keyword_l_val=.FALSE.)
    1246         1455 :       CALL section_add_keyword(subsection, keyword)
    1247         1455 :       CALL keyword_release(keyword)
    1248              : 
    1249              :       CALL keyword_create(keyword, __LOCATION__, name="BETA", &
    1250              :                           description="Exponential factor for the switching function used in K-DIMER", &
    1251              :                           usage="BETA {real}", &
    1252              :                           default_r_val=5.0_dp, &
    1253         1455 :                           lone_keyword_r_val=5.0_dp)
    1254         1455 :       CALL section_add_keyword(subsection, keyword)
    1255         1455 :       CALL keyword_release(keyword)
    1256              : 
    1257              :       CALL create_geoopt_section( &
    1258              :          subsection2, __LOCATION__, label="ROT_OPT", &
    1259              :          description="This section sets the environment for the optimization of the rotation of the Dimer.", &
    1260              :          just_optimizers=.TRUE., &
    1261         1455 :          use_model_hessian=.FALSE.)
    1262         1455 :       NULLIFY (subsection3)
    1263              :       CALL section_create(subsection3, __LOCATION__, name="PRINT", &
    1264              :                           description="Controls the printing properties during the dimer rotation optimization run", &
    1265         1455 :                           n_keywords=0, n_subsections=1, repeats=.TRUE.)
    1266         1455 :       NULLIFY (print_key)
    1267              : 
    1268              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PROGRAM_RUN_INFO", &
    1269              :                                        description="Controls the printing of basic information during the Geometry Optimization", &
    1270         1455 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
    1271         1455 :       CALL section_add_subsection(subsection3, print_key)
    1272         1455 :       CALL section_release(print_key)
    1273              : 
    1274              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "ROTATIONAL_INFO", &
    1275              :                                        description="Controls the printing basic info during the cleaning of the "// &
    1276              :                                        "rotational degrees of freedom.", print_level=low_print_level, &
    1277         1455 :                                        add_last=add_last_numeric, filename="__STD_OUT__")
    1278              :       CALL keyword_create(keyword, __LOCATION__, name="COORDINATES", &
    1279              :                           description="Prints atomic coordinates after rotation", &
    1280         1455 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1281         1455 :       CALL section_add_keyword(print_key, keyword)
    1282         1455 :       CALL keyword_release(keyword)
    1283         1455 :       CALL section_add_subsection(subsection3, print_key)
    1284         1455 :       CALL section_release(print_key)
    1285              : 
    1286         1455 :       CALL section_add_subsection(subsection2, subsection3)
    1287         1455 :       CALL section_release(subsection3)
    1288         1455 :       CALL section_add_subsection(subsection, subsection2)
    1289         1455 :       CALL section_release(subsection2)
    1290              : 
    1291              :       CALL section_create(subsection2, __LOCATION__, name="DIMER_VECTOR", &
    1292              :                           description="Specifies the initial dimer vector. This "// &
    1293              :                           "section overrides INITIALIZATION_METHOD, and will be "// &
    1294              :                           "updated on each step for producing the restart files.", &
    1295         1455 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    1296              :       CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
    1297              :                           description="Specify on each line the components of the dimer vector.", repeats=.TRUE., &
    1298         1455 :                           usage="{Real} {Real} {Real}", type_of_var=real_t, n_var=-1)
    1299         1455 :       CALL section_add_keyword(subsection2, keyword)
    1300         1455 :       CALL keyword_release(keyword)
    1301         1455 :       CALL section_add_subsection(subsection, subsection2)
    1302         1455 :       CALL section_release(subsection2)
    1303              : 
    1304         1455 :       CALL section_add_subsection(section, subsection)
    1305         1455 :       CALL section_release(subsection)
    1306              : 
    1307         1455 :    END SUBROUTINE create_ts_section
    1308              : 
    1309              : ! **************************************************************************************************
    1310              : !> \brief creates the BFGS section
    1311              : !> \param section the section to be created
    1312              : !> \param use_model_hessian ...
    1313              : !> \author Teodoro Laino [tlaino] - University of Zurich - 01.2008
    1314              : ! **************************************************************************************************
    1315         5820 :    SUBROUTINE create_bfgs_section(section, use_model_hessian)
    1316              :       TYPE(section_type), POINTER                        :: section
    1317              :       LOGICAL, INTENT(IN)                                :: use_model_hessian
    1318              : 
    1319              :       TYPE(keyword_type), POINTER                        :: keyword
    1320              :       TYPE(section_type), POINTER                        :: print_key
    1321              : 
    1322              : ! create the BFGS subsection
    1323              : 
    1324         5820 :       NULLIFY (section, keyword, print_key)
    1325              :       CALL section_create(section, __LOCATION__, name="BFGS", &
    1326              :                           description="Provides parameters to tune the BFGS optimization", &
    1327         5820 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    1328              : 
    1329              :       CALL keyword_create(keyword, __LOCATION__, name="METHOD", &
    1330              :                           description="Matrix updated by full-memory BFGS. DIRECT updates the Hessian; "// &
    1331              :                           "INVERSE updates its inverse without a full diagonalization at each step.", &
    1332              :                           usage="METHOD INVERSE", &
    1333              :                           enum_c_vals=s2a("DIRECT", "INVERSE"), &
    1334         5820 :                           enum_i_vals=[bfgs_direct, bfgs_inverse], default_i_val=bfgs_direct)
    1335         5820 :       CALL section_add_keyword(section, keyword)
    1336         5820 :       CALL keyword_release(keyword)
    1337              : 
    1338              :       CALL keyword_create(keyword, __LOCATION__, name="TRUST_RADIUS", &
    1339              :                           description="Trust radius used in BFGS. Previously set to 0.1. "// &
    1340              :                           "Large values can lead to instabilities", &
    1341              :                           usage="TRUST_RADIUS {real}", unit_str='angstrom', &
    1342         5820 :                           default_r_val=cp_unit_to_cp2k(0.25_dp, "angstrom"))
    1343         5820 :       CALL section_add_keyword(section, keyword)
    1344         5820 :       CALL keyword_release(keyword)
    1345              : 
    1346              :       CALL keyword_create(keyword, __LOCATION__, name="USE_MODEL_HESSIAN", &
    1347              :                           description="Uses a model Hessian as initial guess instead of a unit matrix."// &
    1348              :                           " Should lead in general to improved convergence might be switched off for exotic cases", &
    1349              :                           usage="USE_MODEL_HESSIAN", &
    1350              :                           citations=[Lindh1995], &
    1351        11640 :                           default_l_val=use_model_hessian, lone_keyword_l_val=.TRUE.)
    1352         5820 :       CALL section_add_keyword(section, keyword)
    1353         5820 :       CALL keyword_release(keyword)
    1354              : 
    1355              :       CALL keyword_create(keyword, __LOCATION__, name="USE_RAT_FUN_OPT", &
    1356              :                           description="Includes a rational function optimization to determine the step. "// &
    1357              :                           "Previously default but did not improve convergence in many cases. "// &
    1358              :                           "Not supported by inverse-Hessian update method.", &
    1359              :                           usage="USE_RAT_FUN_OPT", &
    1360         5820 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1361         5820 :       CALL section_add_keyword(section, keyword)
    1362         5820 :       CALL keyword_release(keyword)
    1363              : 
    1364              :       CALL keyword_create(keyword, __LOCATION__, name="RESTART_HESSIAN", &
    1365              :                           description="Reads the initial BFGS matrix from file. Hessian and inverse-Hessian "// &
    1366              :                           "restarts are converted to the selected METHOD when necessary.", &
    1367              :                           usage="RESTART_HESSIAN", &
    1368         5820 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1369         5820 :       CALL section_add_keyword(section, keyword)
    1370         5820 :       CALL keyword_release(keyword)
    1371              : 
    1372              :       CALL keyword_create(keyword, __LOCATION__, name="RESTART_FILE_NAME", &
    1373              :                           description="Specifies the name of the file used to read the initial Hessian.", &
    1374              :                           usage="RESTART_FILE_NAME {filename}", &
    1375         5820 :                           default_lc_val="")
    1376         5820 :       CALL section_add_keyword(section, keyword)
    1377         5820 :       CALL keyword_release(keyword)
    1378              : 
    1379              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RESTART", &
    1380              :                                        description="Controls the printing of Hessian Restart file", &
    1381              :                                        print_level=low_print_level, add_last=add_last_numeric, filename="BFGS", &
    1382         5820 :                                        common_iter_levels=2)
    1383         5820 :       CALL section_add_subsection(section, print_key)
    1384         5820 :       CALL section_release(print_key)
    1385              : 
    1386         5820 :    END SUBROUTINE create_bfgs_section
    1387              : 
    1388              : ! **************************************************************************************************
    1389              : !> \brief creates the CG section
    1390              : !> \param section the section to be created
    1391              : !> \author Teodoro Laino [tlaino] - University of Zurich - 01.2008
    1392              : ! **************************************************************************************************
    1393         5820 :    SUBROUTINE create_cg_section(section)
    1394              :       TYPE(section_type), POINTER                        :: section
    1395              : 
    1396              :       TYPE(keyword_type), POINTER                        :: keyword
    1397              :       TYPE(section_type), POINTER                        :: subsection, subsubsection
    1398              : 
    1399              : ! create the CG subsection
    1400              : 
    1401         5820 :       NULLIFY (section, subsection, subsubsection, keyword)
    1402              :       CALL section_create(section, __LOCATION__, name="CG", &
    1403              :                           description="Provides parameters to tune the conjugate gradient optimization", &
    1404         5820 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    1405              : 
    1406              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_STEEP_STEPS", &
    1407              :                           description="Maximum number of steepest descent steps before starting the"// &
    1408              :                           " conjugate gradients optimization.", &
    1409              :                           usage="MAX_STEEP_STEPS {integer}", &
    1410         5820 :                           default_i_val=0)
    1411         5820 :       CALL section_add_keyword(section, keyword)
    1412         5820 :       CALL keyword_release(keyword)
    1413              : 
    1414              :       CALL keyword_create(keyword, __LOCATION__, name="RESTART_LIMIT", &
    1415              :                           description="Cosine of the angle between two consecutive searching directions."// &
    1416              :                           " If the angle during a CG optimization is less than the one corresponding to"// &
    1417              :                           " to the RESTART_LIMIT the CG is reset and one step of steepest descent is"// &
    1418              :                           " performed.", &
    1419              :                           usage="RESTART_LIMIT {real}", &
    1420         5820 :                           default_r_val=0.9_dp)
    1421         5820 :       CALL section_add_keyword(section, keyword)
    1422         5820 :       CALL keyword_release(keyword)
    1423              : 
    1424              :       CALL keyword_create(keyword, __LOCATION__, name="FLETCHER_REEVES", &
    1425              :                           description="Uses FLETCHER-REEVES instead of POLAK-RIBIERE when using Conjugate Gradients", &
    1426              :                           usage="FLETCHER_REEVES", &
    1427         5820 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1428         5820 :       CALL section_add_keyword(section, keyword)
    1429         5820 :       CALL keyword_release(keyword)
    1430              : 
    1431              :       ! Line Search section
    1432              :       CALL section_create(subsection, __LOCATION__, name="LINE_SEARCH", &
    1433              :                           description="Provides parameters to tune the line search during the conjugate gradient optimization", &
    1434         5820 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    1435              : 
    1436              :       CALL keyword_create(keyword, __LOCATION__, name="TYPE", &
    1437              :                           description="1D line search algorithm to be used with the CG optimizer,"// &
    1438              :                           " in increasing order of robustness and cost. ", &
    1439              :                           usage="TYPE GOLD", &
    1440              :                           default_i_val=ls_gold, &
    1441              :                           enum_c_vals=s2a("2PNT", "GOLD", "FIT"), &
    1442              :                           enum_desc=s2a("extrapolate based on 2 points", &
    1443              :                                         "perform 1D golden section search of the minimum (very expensive)", &
    1444              :                                         "perform 1D fit of a parabola on several evaluation of energy "// &
    1445              :                                         "(very expensive and more robust vs numerical noise)"), &
    1446         5820 :                           enum_i_vals=[ls_2pnt, ls_gold, ls_fit])
    1447         5820 :       CALL section_add_keyword(subsection, keyword)
    1448         5820 :       CALL keyword_release(keyword)
    1449              : 
    1450              :       ! 2PNT
    1451         5820 :       NULLIFY (subsubsection)
    1452              :       CALL section_create(subsubsection, __LOCATION__, name="2PNT", &
    1453              :                           description="Provides parameters to tune the line search for the two point based line search.", &
    1454         5820 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    1455              : 
    1456              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_ALLOWED_STEP", &
    1457              :                           description="Max allowed value for the line search step.", &
    1458              :                           usage="MAX_ALLOWED_STEP {real}", unit_str="internal_cp2k", &
    1459         5820 :                           default_r_val=0.25_dp)
    1460         5820 :       CALL section_add_keyword(subsubsection, keyword)
    1461         5820 :       CALL keyword_release(keyword)
    1462              : 
    1463              :       CALL keyword_create( &
    1464              :          keyword, __LOCATION__, name="LINMIN_GRAD_ONLY", &
    1465              :          description="Use only the gradient, not the energy for line minimizations (e.g. in conjugate gradients).", &
    1466              :          usage="LINMIN_GRAD_ONLY T", &
    1467         5820 :          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1468         5820 :       CALL section_add_keyword(subsubsection, keyword)
    1469         5820 :       CALL keyword_release(keyword)
    1470              : 
    1471         5820 :       CALL section_add_subsection(subsection, subsubsection)
    1472         5820 :       CALL section_release(subsubsection)
    1473              : 
    1474              :       ! GOLD
    1475         5820 :       NULLIFY (subsubsection)
    1476              :       CALL section_create(subsubsection, __LOCATION__, name="GOLD", &
    1477              :                           description="Provides parameters to tune the line search for the gold search.", &
    1478         5820 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    1479              : 
    1480              :       CALL keyword_create(keyword, __LOCATION__, name="INITIAL_STEP", &
    1481              :                           description="Initial step size used, e.g. for bracketing or minimizers. "// &
    1482              :                           "Might need to be reduced for systems with close contacts", &
    1483              :                           usage="INITIAL_STEP {real}", unit_str="internal_cp2k", &
    1484         5820 :                           default_r_val=0.2_dp)
    1485         5820 :       CALL section_add_keyword(subsubsection, keyword)
    1486         5820 :       CALL keyword_release(keyword)
    1487              : 
    1488              :       CALL keyword_create(keyword, __LOCATION__, name="BRACK_LIMIT", &
    1489              :                           description="Limit in 1D bracketing during line search in Conjugate Gradients Optimization.", &
    1490              :                           usage="BRACK_LIMIT {real}", unit_str="internal_cp2k", &
    1491         5820 :                           default_r_val=100.0_dp)
    1492         5820 :       CALL section_add_keyword(subsubsection, keyword)
    1493         5820 :       CALL keyword_release(keyword)
    1494              : 
    1495              :       CALL keyword_create(keyword, __LOCATION__, name="BRENT_TOL", &
    1496              :                           description="Tolerance requested during Brent line search in Conjugate Gradients Optimization.", &
    1497              :                           usage="BRENT_TOL {real}", unit_str="internal_cp2k", &
    1498         5820 :                           default_r_val=0.01_dp)
    1499         5820 :       CALL section_add_keyword(subsubsection, keyword)
    1500         5820 :       CALL keyword_release(keyword)
    1501              : 
    1502              :       CALL keyword_create(keyword, __LOCATION__, name="BRENT_MAX_ITER", &
    1503              :                           description="Maximum number of iterations in brent algorithm "// &
    1504              :                           "(used for the line search in Conjugated Gradients Optimization)", &
    1505              :                           usage="BRENT_MAX_ITER {integer}", &
    1506         5820 :                           default_i_val=100)
    1507         5820 :       CALL section_add_keyword(subsubsection, keyword)
    1508         5820 :       CALL keyword_release(keyword)
    1509         5820 :       CALL section_add_subsection(subsection, subsubsection)
    1510         5820 :       CALL section_release(subsubsection)
    1511              : 
    1512         5820 :       CALL section_add_subsection(section, subsection)
    1513         5820 :       CALL section_release(subsection)
    1514         5820 :    END SUBROUTINE create_cg_section
    1515              : 
    1516              : ! **************************************************************************************************
    1517              : !> \brief creates the LBFGS section
    1518              : !> \param section the section to be created
    1519              : !> \author Teodoro Laino [tlaino] - University of Zurich - 01.2008
    1520              : ! **************************************************************************************************
    1521         5820 :    SUBROUTINE create_lbfgs_section(section)
    1522              :       TYPE(section_type), POINTER                        :: section
    1523              : 
    1524              :       TYPE(keyword_type), POINTER                        :: keyword
    1525              : 
    1526              : ! create the LBFGS section
    1527              : 
    1528         5820 :       NULLIFY (section, keyword)
    1529              :       CALL section_create(section, __LOCATION__, name="LBFGS", &
    1530              :                           description="Provides parameters to tune the limited memory BFGS (LBFGS) optimization", &
    1531              :                           n_keywords=0, n_subsections=1, repeats=.FALSE., &
    1532        11640 :                           citations=[Byrd1995])
    1533              : 
    1534              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_H_RANK", &
    1535              :                           description="Maximum rank (and consequently size) of the "// &
    1536              :                           "approximate Hessian matrix used by the LBFGS optimizer. "// &
    1537              :                           "Larger values (e.g. 30) will accelerate the convergence behaviour "// &
    1538              :                           "at the cost of a larger memory consumption.", &
    1539              :                           usage="MAX_H_RANK {integer}", &
    1540         5820 :                           default_i_val=5)
    1541         5820 :       CALL section_add_keyword(section, keyword)
    1542         5820 :       CALL keyword_release(keyword)
    1543              : 
    1544              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_F_PER_ITER", &
    1545              :                           description="Maximum number of force evaluations per iteration"// &
    1546              :                           " (used for the line search)", &
    1547              :                           usage="MAX_F_PER_ITER {integer}", &
    1548         5820 :                           default_i_val=20)
    1549         5820 :       CALL section_add_keyword(section, keyword)
    1550         5820 :       CALL keyword_release(keyword)
    1551              : 
    1552              :       CALL keyword_create(keyword, __LOCATION__, name="PRINT_LEVEL", &
    1553              :                           description="How much output is written out by the LBFGS algorithm. "// &
    1554              :                           "Currently this is independent of the &GLOBAL/PRINT_LEVEL setting.", &
    1555              :                           usage="PRINT_LEVEL MEDIUM", &
    1556              :                           enum_c_vals=s2a("SILENT", "LOW", "MEDIUM", "HIGH", "DEBUG"), &
    1557              :                           enum_desc=s2a("Almost no output", &
    1558              :                                         "Little output about f and |proj g| every iteration", &
    1559              :                                         "Quite some output about details every iteration", &
    1560              :                                         "Lots of output about changes of active set and final x", &
    1561              :                                         "Everything is written out, useful for debugging purposes only"), &
    1562              :                           enum_i_vals=[silent_lbfgs, low_lbfgs, medium_lbfgs, &
    1563              :                                        high_lbfgs, debug_lbfgs], &
    1564         5820 :                           default_i_val=low_print_level)
    1565         5820 :       CALL section_add_keyword(section, keyword)
    1566         5820 :       CALL keyword_release(keyword)
    1567              : 
    1568              :       CALL keyword_create(keyword, __LOCATION__, name="WANTED_PROJ_GRADIENT", &
    1569              :                           description="Convergence criterion (overrides the general ones):"// &
    1570              :                           " Requested norm threshold of the gradient multiplied"// &
    1571              :                           " by the approximate Hessian.", &
    1572              :                           usage="WANTED_PROJ_GRADIENT {real}", unit_str="internal_cp2k", &
    1573         5820 :                           default_r_val=1.0E-16_dp)
    1574         5820 :       CALL section_add_keyword(section, keyword)
    1575         5820 :       CALL keyword_release(keyword)
    1576              : 
    1577              :       CALL keyword_create(keyword, __LOCATION__, name="WANTED_REL_F_ERROR", &
    1578              :                           description="Convergence criterion (overrides the general ones):"// &
    1579              :                           " Requested relative error on the objective function"// &
    1580              :                           " of the optimizer (the energy)", &
    1581              :                           usage="WANTED_REL_F_ERROR {real}", unit_str="internal_cp2k", &
    1582         5820 :                           default_r_val=1.0E-16_dp)
    1583         5820 :       CALL section_add_keyword(section, keyword)
    1584         5820 :       CALL keyword_release(keyword)
    1585              : 
    1586              :       CALL keyword_create( &
    1587              :          keyword, __LOCATION__, name="TRUST_RADIUS", &
    1588              :          description="Trust radius used in LBFGS. Not completely in depth tested. Negativ values means no trust radius is used.", &
    1589              :          usage="TRUST_RADIUS {real}", unit_str='angstrom', &
    1590         5820 :          default_r_val=-1.0_dp)
    1591         5820 :       CALL section_add_keyword(section, keyword)
    1592         5820 :       CALL keyword_release(keyword)
    1593              : 
    1594              :       CALL keyword_create(keyword, __LOCATION__, name="__CONTROL_VAL", &
    1595              :                           description="Hidden parameter that controls the printing behavior "// &
    1596              :                           "of the LBFGS optimizer for advanced debug purposes. This option "// &
    1597              :                           "overrides PRINT_LEVEL setting if explicit.", &
    1598         5820 :                           default_i_val=-1)
    1599         5820 :       CALL section_add_keyword(section, keyword)
    1600         5820 :       CALL keyword_release(keyword)
    1601              : 
    1602         5820 :    END SUBROUTINE create_lbfgs_section
    1603              : 
    1604              : ! **************************************************************************************************
    1605              : !> \brief creates the flexible_partitioning section
    1606              : !> \param section the section to be created
    1607              : !> \author Joost VandeVondele [04.2006]
    1608              : ! **************************************************************************************************
    1609         1455 :    SUBROUTINE create_fp_section(section)
    1610              :       TYPE(section_type), POINTER                        :: section
    1611              : 
    1612              :       TYPE(keyword_type), POINTER                        :: keyword
    1613              :       TYPE(section_type), POINTER                        :: print_key
    1614              : 
    1615         1455 :       CPASSERT(.NOT. ASSOCIATED(section))
    1616              :       CALL section_create(section, __LOCATION__, name="FLEXIBLE_PARTITIONING", &
    1617              :                           description="This section sets up flexible_partitioning", &
    1618         1455 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
    1619              : 
    1620         1455 :       NULLIFY (keyword, print_key)
    1621              : 
    1622              :       CALL keyword_create(keyword, __LOCATION__, name="CENTRAL_ATOM", &
    1623              :                           description="Specifies the central atom.", &
    1624              :                           usage="CENTRAL_ATOM {integer}", &
    1625         1455 :                           n_var=1, type_of_var=integer_t)
    1626         1455 :       CALL section_add_keyword(section, keyword)
    1627         1455 :       CALL keyword_release(keyword)
    1628              : 
    1629              :       CALL keyword_create(keyword, __LOCATION__, name="INNER_ATOMS", &
    1630              :                           description="Specifies the list of atoms that should remain close to the central atom.", &
    1631              :                           usage="INNER_ATOMS {integer} {integer} .. {integer}", &
    1632         1455 :                           n_var=-1, type_of_var=integer_t)
    1633         1455 :       CALL section_add_keyword(section, keyword)
    1634         1455 :       CALL keyword_release(keyword)
    1635              : 
    1636              :       CALL keyword_create(keyword, __LOCATION__, name="OUTER_ATOMS", &
    1637              :                           description="Specifies the list of atoms that should remain far from the central atom.", &
    1638              :                           usage="OUTER_ATOMS {integer} {integer} .. {integer}", &
    1639         1455 :                           n_var=-1, type_of_var=integer_t)
    1640         1455 :       CALL section_add_keyword(section, keyword)
    1641         1455 :       CALL keyword_release(keyword)
    1642              : 
    1643              :       CALL keyword_create(keyword, __LOCATION__, name="INNER_RADIUS", &
    1644              :                           description="radius of the inner wall", &
    1645              :                           usage="INNER_RADIUS {real} ", type_of_var=real_t, &
    1646         1455 :                           n_var=1, unit_str="angstrom")
    1647         1455 :       CALL section_add_keyword(section, keyword)
    1648         1455 :       CALL keyword_release(keyword)
    1649              : 
    1650              :       CALL keyword_create(keyword, __LOCATION__, name="OUTER_RADIUS", &
    1651              :                           description="radius of the outer wall", &
    1652              :                           usage="OUTER_RADIUS {real} ", type_of_var=real_t, &
    1653         1455 :                           n_var=1, unit_str="angstrom")
    1654         1455 :       CALL section_add_keyword(section, keyword)
    1655         1455 :       CALL keyword_release(keyword)
    1656              : 
    1657              :       CALL keyword_create(keyword, __LOCATION__, name="STRENGTH", &
    1658              :                           description="Sets the force constant of the repulsive harmonic potential", &
    1659         1455 :                           usage="STRENGTH 1.0", default_r_val=1.0_dp)
    1660         1455 :       CALL section_add_keyword(section, keyword)
    1661         1455 :       CALL keyword_release(keyword)
    1662              : 
    1663              :       CALL keyword_create(keyword, __LOCATION__, name="BIAS", &
    1664              :                           description="If a bias potential counter-acting the weight term should be applied (recommended).", &
    1665         1455 :                           usage="BIAS F", default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    1666         1455 :       CALL section_add_keyword(section, keyword)
    1667         1455 :       CALL keyword_release(keyword)
    1668              : 
    1669              :       CALL keyword_create(keyword, __LOCATION__, name="TEMPERATURE", &
    1670              :                           description="Sets the temperature parameter that is used in the baising potential."// &
    1671              :                           " It is recommended to use the actual simulation temperature", &
    1672         1455 :                           usage="TEMPERATURE 300", default_r_val=300.0_dp, unit_str='K')
    1673         1455 :       CALL section_add_keyword(section, keyword)
    1674         1455 :       CALL keyword_release(keyword)
    1675              : 
    1676              :       CALL keyword_create(keyword, __LOCATION__, name="SMOOTH_WIDTH", &
    1677              :                           description="Sets the width of the smooth counting function.", &
    1678         1455 :                           usage="SMOOTH_WIDTH 0.2", default_r_val=0.02_dp, unit_str='angstrom')
    1679         1455 :       CALL section_add_keyword(section, keyword)
    1680         1455 :       CALL keyword_release(keyword)
    1681              : 
    1682              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "WEIGHTS", &
    1683              :                                        description="Controls the printing of FP info during flexible partitioning simulations.", &
    1684              :                                        print_level=low_print_level, common_iter_levels=1, &
    1685         1455 :                                        filename="FLEXIBLE_PARTIONING")
    1686         1455 :       CALL section_add_subsection(section, print_key)
    1687         1455 :       CALL section_release(print_key)
    1688              : 
    1689              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "CONTROL", &
    1690              :                                        description="Controls the printing of FP info at startup", &
    1691              :                                        print_level=low_print_level, common_iter_levels=1, &
    1692         1455 :                                        filename="__STD_OUT__")
    1693         1455 :       CALL section_add_subsection(section, print_key)
    1694         1455 :       CALL section_release(print_key)
    1695              : 
    1696         1455 :    END SUBROUTINE create_fp_section
    1697              : 
    1698              : ! **************************************************************************************************
    1699              : !> \brief ...
    1700              : !> \param section will contain the driver section
    1701              : !> \author mceriotti
    1702              : ! **************************************************************************************************
    1703         1455 :    SUBROUTINE create_driver_section(section)
    1704              :       TYPE(section_type), POINTER                        :: section
    1705              : 
    1706              :       TYPE(keyword_type), POINTER                        :: keyword
    1707              : 
    1708         1455 :       CPASSERT(.NOT. ASSOCIATED(section))
    1709              :       CALL section_create(section, __LOCATION__, name="DRIVER", &
    1710              :                           description="This section defines the parameters needed to run in i-PI driver mode.", &
    1711              :                           citations=[Ceriotti2014, Kapil2016], &
    1712         4365 :                           n_keywords=4, n_subsections=0, repeats=.FALSE.)
    1713              : 
    1714         1455 :       NULLIFY (keyword)
    1715              :       CALL keyword_create(keyword, __LOCATION__, name="unix", &
    1716              :                           description="Use a UNIX socket rather than an INET socket.", &
    1717              :                           usage="unix LOGICAL", &
    1718         1455 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1719         1455 :       CALL section_add_keyword(section, keyword)
    1720         1455 :       CALL keyword_release(keyword)
    1721              : 
    1722              :       CALL keyword_create(keyword, __LOCATION__, name="port", &
    1723              :                           description="Port number for the i-PI server.", &
    1724              :                           usage="port <INTEGER>", &
    1725         1455 :                           default_i_val=12345)
    1726         1455 :       CALL section_add_keyword(section, keyword)
    1727         1455 :       CALL keyword_release(keyword)
    1728              : 
    1729              :       CALL keyword_create(keyword, __LOCATION__, name="host", &
    1730              :                           description="Host name for the i-PI server.", &
    1731              :                           usage="host <HOSTNAME>", &
    1732         1455 :                           default_c_val="localhost")
    1733         1455 :       CALL section_add_keyword(section, keyword)
    1734         1455 :       CALL keyword_release(keyword)
    1735              : 
    1736              :       CALL keyword_create(keyword, __LOCATION__, name="PREFIX", &
    1737              :                           description="Prefix used to build the path of the UNIX socket file, "// &
    1738              :                           "as /tmp/<PREFIX>_<HOST>. Only relevant if UNIX is set to true.", &
    1739              :                           usage="PREFIX ipi", &
    1740         1455 :                           default_c_val="ipi")
    1741         1455 :       CALL section_add_keyword(section, keyword)
    1742         1455 :       CALL keyword_release(keyword)
    1743              : 
    1744              :       CALL keyword_create(keyword, __LOCATION__, name="SLEEP_TIME", &
    1745              :                           description="Sleeping time while waiting for for driver commands [s].", &
    1746              :                           usage="SLEEP_TIME 0.1", &
    1747         1455 :                           default_r_val=0.01_dp)
    1748         1455 :       CALL section_add_keyword(section, keyword)
    1749         1455 :       CALL keyword_release(keyword)
    1750              : 
    1751         1455 :    END SUBROUTINE create_driver_section
    1752              : 
    1753              : ! **************************************************************************************************
    1754              : !> \brief creates the section for a path integral run
    1755              : !> \param section will contain the pint section
    1756              : !> \author fawzi
    1757              : ! **************************************************************************************************
    1758         1455 :    SUBROUTINE create_pint_section(section)
    1759              :       TYPE(section_type), POINTER                        :: section
    1760              : 
    1761              :       TYPE(keyword_type), POINTER                        :: keyword
    1762              :       TYPE(section_type), POINTER                        :: print_key, subsection, subsubsection
    1763              : 
    1764         1455 :       CPASSERT(.NOT. ASSOCIATED(section))
    1765              :       CALL section_create(section, __LOCATION__, name="PINT", &
    1766              :                           description="The section that controls a path integral run", &
    1767         1455 :                           n_keywords=13, n_subsections=9, repeats=.FALSE.)
    1768         1455 :       NULLIFY (keyword)
    1769              : 
    1770              :       CALL keyword_create(keyword, __LOCATION__, name="p", &
    1771              :                           description="Specify number beads to use", repeats=.FALSE., &
    1772         1455 :                           default_i_val=3)
    1773         1455 :       CALL section_add_keyword(section, keyword)
    1774         1455 :       CALL keyword_release(keyword)
    1775              :       CALL keyword_create(keyword, __LOCATION__, name="proc_per_replica", &
    1776              :                           description="Specify number of processors to use for each replica", &
    1777         1455 :                           repeats=.FALSE., default_i_val=0)
    1778         1455 :       CALL section_add_keyword(section, keyword)
    1779         1455 :       CALL keyword_release(keyword)
    1780              :       CALL keyword_create(keyword, __LOCATION__, name="num_steps", &
    1781              :                           description="Number of steps (if MAX_STEP is not explicitly given"// &
    1782              :                           " the program will perform this number of steps)", repeats=.FALSE., &
    1783         1455 :                           default_i_val=3)
    1784         1455 :       CALL section_add_keyword(section, keyword)
    1785         1455 :       CALL keyword_release(keyword)
    1786              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_STEP", &
    1787              :                           description="Maximum step number (the program will stop if"// &
    1788              :                           " ITERATION >= MAX_STEP even if NUM_STEPS has not been reached)", &
    1789         1455 :                           repeats=.FALSE., default_i_val=10)
    1790         1455 :       CALL section_add_keyword(section, keyword)
    1791         1455 :       CALL keyword_release(keyword)
    1792              :       CALL keyword_create(keyword, __LOCATION__, name="iteration", &
    1793              :                           description="Specify the iteration number from which it should be "// &
    1794         1455 :                           "counted", default_i_val=0)
    1795         1455 :       CALL section_add_keyword(section, keyword)
    1796         1455 :       CALL keyword_release(keyword)
    1797              :       CALL keyword_create(keyword, __LOCATION__, name="Temp", &
    1798              :                           description="The temperature you want to simulate", &
    1799              :                           default_r_val=cp_unit_to_cp2k(300._dp, "K"), &
    1800         1455 :                           unit_str="K")
    1801         1455 :       CALL section_add_keyword(section, keyword)
    1802         1455 :       CALL keyword_release(keyword)
    1803              :       CALL keyword_create(keyword, __LOCATION__, name="kT_CORRECTION", &
    1804              :                           description="Corrects for the loss of temperature due to constrained "// &
    1805              :                           "degrees of freedom for Nose-Hover chains and numeric integration", &
    1806         1455 :                           repeats=.FALSE., default_l_val=.FALSE.)
    1807         1455 :       CALL section_add_keyword(section, keyword)
    1808         1455 :       CALL keyword_release(keyword)
    1809              :       CALL keyword_create(keyword, __LOCATION__, name="T_tol", variants=["temp_to"], &
    1810              :                           description="threshold for the oscillations of the temperature "// &
    1811              :                           "excedeed which the temperature is rescaled. 0 means no rescaling.", &
    1812         2910 :                           default_r_val=0._dp, unit_str="K")
    1813         1455 :       CALL section_add_keyword(section, keyword)
    1814         1455 :       CALL keyword_release(keyword)
    1815              :       CALL keyword_create(keyword, __LOCATION__, name="dt", &
    1816              :                           description="timestep (might be subdivised in nrespa subtimesteps", &
    1817              :                           repeats=.FALSE., &
    1818              :                           default_r_val=cp_unit_to_cp2k(1.0_dp, "fs"), &
    1819         1455 :                           usage="dt 1.0", unit_str="fs")
    1820         1455 :       CALL section_add_keyword(section, keyword)
    1821         1455 :       CALL keyword_release(keyword)
    1822              :       CALL keyword_create(keyword, __LOCATION__, name="HARM_INT", &
    1823              :                           description="integrator scheme for integrating the harmonic bead springs.", &
    1824              :                           usage="HARM_INT (NUMERIC|EXACT)", &
    1825              :                           default_i_val=integrate_numeric, &
    1826              :                           enum_c_vals=s2a("NUMERIC", "EXACT"), &
    1827         1455 :                           enum_i_vals=[integrate_numeric, integrate_exact])
    1828         1455 :       CALL section_add_keyword(section, keyword)
    1829         1455 :       CALL keyword_release(keyword)
    1830              :       CALL keyword_create(keyword, __LOCATION__, name="nrespa", &
    1831              :                           description="number of respa steps for the bead for each md step", &
    1832         1455 :                           repeats=.FALSE., default_i_val=5)
    1833         1455 :       CALL section_add_keyword(section, keyword)
    1834         1455 :       CALL keyword_release(keyword)
    1835              : 
    1836              :       CALL keyword_create(keyword, __LOCATION__, name="transformation", &
    1837              :                           description="Specifies the coordinate transformation to use", &
    1838              :                           usage="TRANSFORMATION (NORMAL|STAGE)", &
    1839              :                           default_i_val=transformation_normal, &
    1840              :                           enum_c_vals=s2a("NORMAL", "STAGE"), &
    1841         1455 :                           enum_i_vals=[transformation_normal, transformation_stage])
    1842              : 
    1843         1455 :       CALL section_add_keyword(section, keyword)
    1844         1455 :       CALL keyword_release(keyword)
    1845              :       CALL keyword_create(keyword, __LOCATION__, name="propagator", &
    1846              :                           description="Specifies the real time propagator to use", &
    1847              :                           usage="PROPAGATOR (PIMD|RPMD|CMD|BCMD)", &
    1848              :                           default_i_val=propagator_pimd, &
    1849              :                           enum_c_vals=s2a("PIMD", "RPMD", "CMD", "BCMD"), &
    1850         1455 :                           enum_i_vals=[propagator_pimd, propagator_rpmd, propagator_cmd, propagator_bcmd])
    1851         1455 :       CALL section_add_keyword(section, keyword)
    1852         1455 :       CALL keyword_release(keyword)
    1853              :       CALL keyword_create(keyword, __LOCATION__, name="FIX_CENTROID_POS", &
    1854              :                           description="Propagate all DOF but the centroid - "// &
    1855              :                           "useful for equilibration of the non-centroid modes "// &
    1856              :                           "(activated only if TRANSFORMATION==NORMAL)", &
    1857              :                           repeats=.FALSE., default_l_val=.FALSE., &
    1858         1455 :                           lone_keyword_l_val=.TRUE.)
    1859         1455 :       CALL section_add_keyword(section, keyword)
    1860         1455 :       CALL keyword_release(keyword)
    1861              : 
    1862         1455 :       NULLIFY (subsection, subsubsection)
    1863              :       CALL section_create(subsection, __LOCATION__, name="NORMALMODE", &
    1864              :                           description="Controls the normal mode transformation", &
    1865         1455 :                           n_keywords=3, n_subsections=0, repeats=.FALSE.)
    1866              :       CALL keyword_create(keyword, __LOCATION__, name="Q_CENTROID", &
    1867              :                           description="Value of the thermostat mass of centroid degree of freedom", &
    1868         1455 :                           repeats=.FALSE., default_r_val=-1.0_dp)
    1869         1455 :       CALL section_add_keyword(subsection, keyword)
    1870         1455 :       CALL keyword_release(keyword)
    1871              :       CALL keyword_create(keyword, __LOCATION__, name="Q_BEAD", &
    1872              :                           description="Value of the thermostat mass of non-centroid degrees of freedom", &
    1873         1455 :                           repeats=.FALSE., default_r_val=-1.0_dp)
    1874         1455 :       CALL section_add_keyword(subsection, keyword)
    1875         1455 :       CALL keyword_release(keyword)
    1876              :       CALL keyword_create(keyword, __LOCATION__, name="MODEFACTOR", &
    1877              :                           description="mass scale factor for non-centroid degrees of freedom", &
    1878         1455 :                           repeats=.FALSE., default_r_val=1.0_dp)
    1879         1455 :       CALL section_add_keyword(subsection, keyword)
    1880         1455 :       CALL keyword_release(keyword)
    1881              :       CALL keyword_create(keyword, __LOCATION__, name="GAMMA", &
    1882              :                           description="mass scale factor for non-centroid degrees of freedom, &
    1883              : &                                       naming convention according to Witt, 2008, <https://doi.org/10.1063/1.3125009>.", &
    1884         1455 :                           repeats=.FALSE., default_r_val=8.0_dp)
    1885         1455 :       CALL section_add_keyword(subsection, keyword)
    1886         1455 :       CALL keyword_release(keyword)
    1887              : 
    1888         1455 :       CALL section_add_subsection(section, subsection)
    1889         1455 :       CALL section_release(subsection)
    1890              : 
    1891              :       CALL section_create(subsection, __LOCATION__, name="staging", &
    1892              :                           description="The section that controls the staging transformation", &
    1893         1455 :                           n_keywords=2, n_subsections=0, repeats=.FALSE.)
    1894              :       CALL keyword_create(keyword, __LOCATION__, name="j", &
    1895              :                           description="Value of the j parameter for the staging transformation", &
    1896         1455 :                           repeats=.FALSE., default_i_val=2)
    1897         1455 :       CALL section_add_keyword(subsection, keyword)
    1898         1455 :       CALL keyword_release(keyword)
    1899              :       CALL keyword_create(keyword, __LOCATION__, name="Q_END", &
    1900              :                           description="Value of the nose-hoover mass for the endbead (Q_end)", &
    1901         1455 :                           repeats=.FALSE., default_i_val=2)
    1902         1455 :       CALL section_add_keyword(subsection, keyword)
    1903         1455 :       CALL keyword_release(keyword)
    1904         1455 :       CALL section_add_subsection(section, subsection)
    1905         1455 :       CALL section_release(subsection)
    1906              : 
    1907              :       CALL section_create(subsection, __LOCATION__, name="BEADS", &
    1908              :                           description="Sets positions and velocities of the beads", &
    1909              :                           n_keywords=0, n_subsections=2, &
    1910         1455 :                           repeats=.FALSE.)
    1911         1455 :       CALL create_coord_section(subsubsection, "BEADS")
    1912         1455 :       CALL section_add_subsection(subsection, subsubsection)
    1913         1455 :       CALL section_release(subsubsection)
    1914         1455 :       CALL create_velocity_section(subsubsection, "BEADS")
    1915         1455 :       CALL section_add_subsection(subsection, subsubsection)
    1916         1455 :       CALL section_release(subsubsection)
    1917         1455 :       CALL section_add_subsection(section, subsection)
    1918         1455 :       CALL section_release(subsection)
    1919              : 
    1920              :       CALL section_create(subsection, __LOCATION__, name="NOSE", &
    1921              :                           description="Controls the Nose-Hoover thermostats", &
    1922              :                           n_keywords=1, n_subsections=2, &
    1923         1455 :                           repeats=.FALSE.)
    1924              :       CALL keyword_create(keyword, __LOCATION__, name="nnos", &
    1925              :                           description="length of nose-hoover chain. 0 means no thermostat", &
    1926         1455 :                           repeats=.FALSE., default_i_val=2)
    1927         1455 :       CALL section_add_keyword(subsection, keyword)
    1928         1455 :       CALL keyword_release(keyword)
    1929         1455 :       CALL create_coord_section(subsubsection, "NOSE")
    1930         1455 :       CALL section_add_subsection(subsection, subsubsection)
    1931         1455 :       CALL section_release(subsubsection)
    1932         1455 :       CALL create_velocity_section(subsubsection, "NOSE")
    1933         1455 :       CALL section_add_subsection(subsection, subsubsection)
    1934         1455 :       CALL section_release(subsubsection)
    1935         1455 :       CALL section_add_subsection(section, subsection)
    1936         1455 :       CALL section_release(subsection)
    1937              : 
    1938         1455 :       CALL create_gle_section(subsection)
    1939         1455 :       CALL section_add_subsection(section, subsection)
    1940         1455 :       CALL section_release(subsection)
    1941              : 
    1942              :       CALL section_create(subsection, __LOCATION__, name="PILE", &
    1943              :                           description="Controls the PI Langevin Equation thermostat."// &
    1944              :                           " Needs the exact harmonic integrator."// &
    1945              :                           " May lead to unphysical motions if constraint e.g. FIXED_ATOMS, is applied."// &
    1946              :                           " RESTART_HELIUM section has to be .FALSE. when restarting the PIGLET job.", &
    1947              :                           citations=[Ceriotti2010], &
    1948              :                           n_keywords=3, n_subsections=1, &
    1949         2910 :                           repeats=.FALSE.)
    1950         1455 :       CALL create_rng_section(subsubsection)
    1951         1455 :       CALL section_add_subsection(subsection, subsubsection)
    1952         1455 :       CALL section_release(subsubsection)
    1953              :       CALL keyword_create(keyword, __LOCATION__, name="TAU", &
    1954              :                           description="Time constant for centroid motion. "// &
    1955              :                           "If zero or negative the centroid is not thermostated.", &
    1956              :                           usage="TAU {real}", type_of_var=real_t, &
    1957         1455 :                           unit_str="fs", n_var=1, default_r_val=1000.0_dp)
    1958         1455 :       CALL section_add_keyword(subsection, keyword)
    1959         1455 :       CALL keyword_release(keyword)
    1960              :       CALL keyword_create(keyword, __LOCATION__, name="LAMBDA", &
    1961              :                           description="Scaling of friction to mode coupling", &
    1962              :                           usage="LAMBDA {real}", type_of_var=real_t, &
    1963         1455 :                           n_var=1, default_r_val=0.5_dp)
    1964         1455 :       CALL section_add_keyword(subsection, keyword)
    1965         1455 :       CALL keyword_release(keyword)
    1966              :       CALL keyword_create(keyword, __LOCATION__, name="THERMOSTAT_ENERGY", &
    1967              :                           description="Thermostat energy for conserved quantity. "// &
    1968              :                           "Only useful in restart files.", &
    1969              :                           usage="THERMOSTAT_ENERGY {real}", type_of_var=real_t, &
    1970         1455 :                           n_var=1, default_r_val=0.0_dp)
    1971         1455 :       CALL section_add_keyword(subsection, keyword)
    1972         1455 :       CALL keyword_release(keyword)
    1973         1455 :       CALL section_add_subsection(section, subsection)
    1974         1455 :       CALL section_release(subsection)
    1975              : 
    1976              :       CALL section_create(subsection, __LOCATION__, name="PIGLET", &
    1977              :                           description="Controls the PI Generalized Langevin Equation thermostat."// &
    1978              :                           " Needs the exact harmonic integrator", &
    1979              :                           citations=[Ceriotti2012], &
    1980              :                           n_keywords=4, n_subsections=2, &
    1981         2910 :                           repeats=.FALSE.)
    1982         1455 :       CALL create_rng_section(subsubsection)
    1983         1455 :       CALL section_add_subsection(subsection, subsubsection)
    1984         1455 :       CALL section_release(subsubsection)
    1985              :       CALL section_create(subsubsection, __LOCATION__, name="EXTRA_DOF", &
    1986              :                           description="Additional degrees of freedom to ensure Markovian Dynamics.", &
    1987         1455 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
    1988              :       CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
    1989              :                           description="Restart values for additional degrees of freedom" &
    1990              :                           //" (only for restarts, do not set explicitly)", &
    1991              :                           repeats=.FALSE., &
    1992         1455 :                           type_of_var=real_t, n_var=-1)
    1993         1455 :       CALL section_add_keyword(subsubsection, keyword)
    1994         1455 :       CALL keyword_release(keyword)
    1995         1455 :       CALL section_add_subsection(subsection, subsubsection)
    1996         1455 :       CALL section_release(subsubsection)
    1997              :       CALL keyword_create(keyword, __LOCATION__, name="NEXTRA_DOF", &
    1998              :                           description="Number of extra degrees of freedom to ensure markovian dynamics", &
    1999         1455 :                           repeats=.FALSE., default_i_val=8)
    2000         1455 :       CALL section_add_keyword(subsection, keyword)
    2001         1455 :       CALL keyword_release(keyword)
    2002              :       CALL keyword_create(keyword, __LOCATION__, name="MATRICES_FILE_NAME", &
    2003              :                           description="Filename containig the raw matrices from "// &
    2004              :                           "<https://gle4md.org/index.html?page=matrix>.", &
    2005         1455 :                           repeats=.FALSE., default_lc_val="PIGLET.MAT")
    2006         1455 :       CALL section_add_keyword(subsection, keyword)
    2007         1455 :       CALL keyword_release(keyword)
    2008              :       CALL keyword_create(keyword, __LOCATION__, name="SMATRIX_INIT", &
    2009              :                           description="Select algorithm to initialize piglet S-matrices", &
    2010              :                           usage="SMATRIX_INIT (CHOLESKY|DIAGONAL)", &
    2011              :                           default_i_val=matrix_init_cholesky, &
    2012              :                           enum_c_vals=s2a("CHOLESKY", "DIAGONAL"), &
    2013         1455 :                           enum_i_vals=[matrix_init_cholesky, matrix_init_diagonal])
    2014         1455 :       CALL section_add_keyword(subsection, keyword)
    2015         1455 :       CALL keyword_release(keyword)
    2016              :       CALL keyword_create(keyword, __LOCATION__, name="THERMOSTAT_ENERGY", &
    2017              :                           description="Thermostat energy for conserved quantity. "// &
    2018              :                           "Only useful in restart files.", &
    2019              :                           usage="THERMOSTAT_ENERGY {real}", type_of_var=real_t, &
    2020         1455 :                           n_var=1, default_r_val=0.0_dp)
    2021         1455 :       CALL section_add_keyword(subsection, keyword)
    2022         1455 :       CALL keyword_release(keyword)
    2023         1455 :       CALL section_add_subsection(section, subsection)
    2024         1455 :       CALL section_release(subsection)
    2025              : 
    2026              :       CALL section_create(subsection, __LOCATION__, name="QTB", &
    2027              :                           description="Controls the QTB-PILE thermostat."// &
    2028              :                           " Needs the exact harmonic integrator", &
    2029              :                           citations=[Brieuc2016], &
    2030              :                           n_keywords=7, n_subsections=1, &
    2031         2910 :                           repeats=.FALSE.)
    2032         1455 :       CALL create_rng_section(subsubsection)
    2033         1455 :       CALL section_add_subsection(subsection, subsubsection)
    2034         1455 :       CALL section_release(subsubsection)
    2035              :       CALL keyword_create(keyword, __LOCATION__, name="TAU", &
    2036              :                           description="Time constant for centroid motion. ", &
    2037              :                           usage="TAU {real}", type_of_var=real_t, &
    2038         1455 :                           unit_str="fs", n_var=1, default_r_val=1000.0_dp)
    2039         1455 :       CALL section_add_keyword(subsection, keyword)
    2040         1455 :       CALL keyword_release(keyword)
    2041              :       CALL keyword_create(keyword, __LOCATION__, name="LAMBDA", &
    2042              :                           description="Scaling of friction to ring polymer NM freq.", &
    2043              :                           usage="LAMBDA {real}", type_of_var=real_t, &
    2044         1455 :                           n_var=1, default_r_val=0.5_dp)
    2045         1455 :       CALL section_add_keyword(subsection, keyword)
    2046         1455 :       CALL keyword_release(keyword)
    2047              :       CALL keyword_create(keyword, __LOCATION__, name="FP", &
    2048              :                           description="Defines which version to use "// &
    2049              :                           "0: f_P^(0), 1: f_P^(1)", &
    2050              :                           usage="FP {integer}", type_of_var=integer_t, &
    2051         1455 :                           n_var=1, default_i_val=1)
    2052         1455 :       CALL section_add_keyword(subsection, keyword)
    2053         1455 :       CALL keyword_release(keyword)
    2054              :       CALL keyword_create(keyword, __LOCATION__, name="TAUCUT", &
    2055              :                           description="Inverse of cutoff freq. for the centroid mode", &
    2056              :                           usage="TAUCUT {real}", type_of_var=real_t, &
    2057         1455 :                           unit_str="fs", n_var=1, default_r_val=0.5_dp)
    2058         1455 :       CALL section_add_keyword(subsection, keyword)
    2059         1455 :       CALL keyword_release(keyword)
    2060              :       CALL keyword_create(keyword, __LOCATION__, name="LAMBCUT", &
    2061              :                           description="Scaling of cutoff freq. to ring polymer NM freq.", &
    2062              :                           usage="LAMBCUT {real}", type_of_var=real_t, &
    2063         1455 :                           n_var=1, default_r_val=2.0_dp)
    2064         1455 :       CALL section_add_keyword(subsection, keyword)
    2065         1455 :       CALL keyword_release(keyword)
    2066              :       CALL keyword_create(keyword, __LOCATION__, name="NF", &
    2067              :                           description="Number of points used for the convolution product.", &
    2068              :                           usage="NF {integer}", type_of_var=integer_t, &
    2069         1455 :                           n_var=1, default_i_val=128)
    2070         1455 :       CALL section_add_keyword(subsection, keyword)
    2071         1455 :       CALL keyword_release(keyword)
    2072              :       CALL keyword_create(keyword, __LOCATION__, name="THERMOSTAT_ENERGY", &
    2073              :                           description="Thermostat energy for conserved quantity. "// &
    2074              :                           "Only useful in restart files.", &
    2075              :                           usage="THERMOSTAT_ENERGY {real}", type_of_var=real_t, &
    2076         1455 :                           n_var=1, default_r_val=0.0_dp)
    2077         1455 :       CALL section_add_keyword(subsection, keyword)
    2078         1455 :       CALL keyword_release(keyword)
    2079         1455 :       CALL section_add_subsection(section, subsection)
    2080         1455 :       CALL section_release(subsection)
    2081              : 
    2082              :       CALL section_create(subsection, __LOCATION__, name="INIT", &
    2083              :                           description="Controls the initialization if the beads are not present", &
    2084         1455 :                           repeats=.FALSE.)
    2085              : 
    2086              :       CALL keyword_create(keyword, __LOCATION__, name="LEVY_POS_SAMPLE", &
    2087              :                           description="Sample bead positions assuming free particle "// &
    2088              :                           "behavior (performs a Levy random walk of length P around "// &
    2089              :                           "the classical position of each atom at the physical "// &
    2090              :                           "temperature defined in PINT%TEMP)", &
    2091              :                           repeats=.FALSE., default_l_val=.FALSE., &
    2092         1455 :                           lone_keyword_l_val=.TRUE.)
    2093         1455 :       CALL section_add_keyword(subsection, keyword)
    2094         1455 :       CALL keyword_release(keyword)
    2095              :       CALL keyword_create(keyword, __LOCATION__, name="LEVY_CORRELATED", &
    2096              :                           description="Use the same Levy path for all atoms, though "// &
    2097              :                           "with mass-dependent variances (might help at very low T)", &
    2098              :                           repeats=.FALSE., default_l_val=.FALSE., &
    2099         1455 :                           lone_keyword_l_val=.TRUE.)
    2100         1455 :       CALL section_add_keyword(subsection, keyword)
    2101         1455 :       CALL keyword_release(keyword)
    2102              :       CALL keyword_create(keyword, __LOCATION__, name="LEVY_TEMP_FACTOR", &
    2103              :                           description="Multiplicative correction factor for the "// &
    2104              :                           "temperature at which the Levy walk is performed "// &
    2105              :                           "(correction is due to the interactions that modify "// &
    2106              :                           "the spread of a free particle)", &
    2107         1455 :                           repeats=.FALSE., default_r_val=1.0_dp)
    2108         1455 :       CALL section_add_keyword(subsection, keyword)
    2109         1455 :       CALL keyword_release(keyword)
    2110              :       CALL keyword_create(keyword, __LOCATION__, name="LEVY_SEED", &
    2111              :                           description="Initial seed for the (pseudo)random number "// &
    2112              :                           "generator that controls Levy walk for bead positions.", &
    2113              :                           usage="LEVY_SEED <INTEGER>", default_i_val=1234, &
    2114         1455 :                           repeats=.FALSE.)
    2115         1455 :       CALL section_add_keyword(subsection, keyword)
    2116         1455 :       CALL keyword_release(keyword)
    2117              :       CALL keyword_create(keyword, __LOCATION__, name="THERMOSTAT_SEED", &
    2118              :                           description="Initial seed for the (pseudo)random number "// &
    2119              :                           "generator that controls the PILE and PIGLET thermostats.", &
    2120              :                           usage="THERMOSTAT_SEED <INTEGER>", default_i_val=12345, &
    2121         1455 :                           repeats=.FALSE.)
    2122         1455 :       CALL section_add_keyword(subsection, keyword)
    2123         1455 :       CALL keyword_release(keyword)
    2124              :       CALL keyword_create(keyword, __LOCATION__, name="RANDOMIZE_POS", &
    2125              :                           description="add gaussian noise to the positions of the beads", &
    2126         1455 :                           repeats=.FALSE., default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2127         1455 :       CALL section_add_keyword(subsection, keyword)
    2128         1455 :       CALL keyword_release(keyword)
    2129              : 
    2130              :       CALL keyword_create(keyword, __LOCATION__, name="CENTROID_SPEED", &
    2131              :                           description="adds random velocity component to the centroid modes "// &
    2132              :                           "(useful to correct for the averaging out of the speed of various beads)", &
    2133         1455 :                           repeats=.FALSE., default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2134         1455 :       CALL section_add_keyword(subsection, keyword)
    2135         1455 :       CALL keyword_release(keyword)
    2136              : 
    2137              :       CALL keyword_create(keyword, __LOCATION__, name="VELOCITY_QUENCH", &
    2138              :                           description="set the initial velocities to zero", &
    2139         1455 :                           repeats=.FALSE., default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2140         1455 :       CALL section_add_keyword(subsection, keyword)
    2141         1455 :       CALL keyword_release(keyword)
    2142              :       CALL keyword_create(keyword, __LOCATION__, name="VELOCITY_SCALE", &
    2143              :                           description="scale initial velocities to the temperature given in MOTION%PINT%TEMP", &
    2144         1455 :                           repeats=.FALSE., default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2145         1455 :       CALL section_add_keyword(subsection, keyword)
    2146         1455 :       CALL keyword_release(keyword)
    2147              : 
    2148         1455 :       CALL section_add_subsection(section, subsection)
    2149         1455 :       CALL section_release(subsection)
    2150              : 
    2151         1455 :       CALL create_helium_section(subsection)
    2152         1455 :       CALL section_add_subsection(section, subsection)
    2153         1455 :       CALL section_release(subsection)
    2154              : 
    2155              :       CALL section_create(subsection, __LOCATION__, name="PRINT", &
    2156              :                           description="Controls the path integral-specific output", &
    2157         1455 :                           n_keywords=2, n_subsections=0, repeats=.FALSE.)
    2158              : 
    2159         1455 :       NULLIFY (print_key)
    2160              : 
    2161              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "ENERGY", &
    2162              :                                        description="Controls the output of the path integral energies", &
    2163         1455 :                                        print_level=low_print_level, common_iter_levels=1)
    2164         1455 :       CALL section_add_subsection(subsection, print_key)
    2165         1455 :       CALL section_release(print_key)
    2166              : 
    2167              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "ACTION", &
    2168              :                                        description="Controls the output of the path integral action", &
    2169         1455 :                                        print_level=medium_print_level, common_iter_levels=1)
    2170         1455 :       CALL section_add_subsection(subsection, print_key)
    2171         1455 :       CALL section_release(print_key)
    2172              : 
    2173              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "CENTROID_POS", &
    2174              :                                        description="Controls the output of the centroid's position", &
    2175              :                                        unit_str="angstrom", &
    2176         1455 :                                        print_level=low_print_level, common_iter_levels=1)
    2177              :       CALL add_format_keyword(keyword, print_key, pos=.TRUE., &
    2178         1455 :                               description="Output file format for the positions of centroid")
    2179         1455 :       CALL section_add_subsection(subsection, print_key)
    2180         1455 :       CALL section_release(print_key)
    2181              : 
    2182              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "CENTROID_VEL", &
    2183              :                                        description="Controls the output of the centroid's velocity", &
    2184              :                                        unit_str="bohr*au_t^-1", &
    2185         1455 :                                        print_level=low_print_level, common_iter_levels=1)
    2186              :       CALL add_format_keyword(keyword, print_key, pos=.FALSE., &
    2187         1455 :                               description="Output file format for the velocity of centroid")
    2188         1455 :       CALL section_add_subsection(subsection, print_key)
    2189         1455 :       CALL section_release(print_key)
    2190              : 
    2191              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "CENTROID_GYR", &
    2192              :                                        description="Controls the output of the centroid's radii of gyration", &
    2193              :                                        unit_str="angstrom", &
    2194         1455 :                                        print_level=low_print_level, common_iter_levels=1)
    2195         1455 :       CALL section_add_subsection(subsection, print_key)
    2196         1455 :       CALL section_release(print_key)
    2197              : 
    2198              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "COM", &
    2199              :                                        description="Controls the output of the center of mass", &
    2200         1455 :                                        print_level=high_print_level, common_iter_levels=1)
    2201         1455 :       CALL section_add_subsection(subsection, print_key)
    2202         1455 :       CALL section_release(print_key)
    2203              : 
    2204              :       CALL keyword_create(keyword, __LOCATION__, name="IMAGINARY_TIME_STRIDE", &
    2205              :                           description="Prints only every nth bead trajectory", &
    2206         1455 :                           repeats=.FALSE., default_i_val=1)
    2207         1455 :       CALL section_add_keyword(subsection, keyword)
    2208         1455 :       CALL keyword_release(keyword)
    2209              : 
    2210         1455 :       CALL section_add_subsection(section, subsection)
    2211         1455 :       CALL section_release(subsection)
    2212              : 
    2213         1455 :    END SUBROUTINE create_pint_section
    2214              : 
    2215              :    ! ***************************************************************************
    2216              :    !> \brief  Create the input section for superfluid helium solvent.
    2217              :    !> \author Lukasz Walewski
    2218              :    ! ***************************************************************************
    2219              : ! **************************************************************************************************
    2220              : !> \brief ...
    2221              : !> \param section ...
    2222              : ! **************************************************************************************************
    2223         1455 :    SUBROUTINE create_helium_section(section)
    2224              :       TYPE(section_type), POINTER                        :: section
    2225              : 
    2226              :       TYPE(keyword_type), POINTER                        :: keyword
    2227              :       TYPE(section_type), POINTER                        :: print_key, subsection, subsubsection
    2228              : 
    2229         1455 :       CPASSERT(.NOT. ASSOCIATED(section))
    2230              : 
    2231              :       CALL section_create(section, __LOCATION__, name="HELIUM", &
    2232              :                           description="The section that controls optional helium solvent"// &
    2233              :                           " environment (highly experimental, not for general use yet)", &
    2234         1455 :                           n_keywords=31, n_subsections=11, repeats=.FALSE.)
    2235              : 
    2236         1455 :       NULLIFY (keyword)
    2237              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
    2238              :                           description="Whether or not to actually use this section", &
    2239         1455 :                           usage="silent", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2240         1455 :       CALL section_add_keyword(section, keyword)
    2241         1455 :       CALL keyword_release(keyword)
    2242              : 
    2243              :       CALL keyword_create(keyword, __LOCATION__, name="HELIUM_ONLY", &
    2244              :                           description="Simulate helium solvent only, "// &
    2245              :                           "disregard solute entirely", &
    2246              :                           repeats=.FALSE., default_l_val=.FALSE., &
    2247         1455 :                           lone_keyword_l_val=.TRUE.)
    2248         1455 :       CALL section_add_keyword(section, keyword)
    2249         1455 :       CALL keyword_release(keyword)
    2250              : 
    2251              :       CALL keyword_create(keyword, __LOCATION__, name="INTERACTION_POT_SCAN", &
    2252              :                           description="Scan solute-helium interaction potential, "// &
    2253              :                           "cubefile parameters set in subsection RHO", &
    2254              :                           repeats=.FALSE., default_l_val=.FALSE., &
    2255         1455 :                           lone_keyword_l_val=.TRUE.)
    2256         1455 :       CALL section_add_keyword(section, keyword)
    2257         1455 :       CALL keyword_release(keyword)
    2258              : 
    2259              :       CALL keyword_create(keyword, __LOCATION__, name="NUM_ENV", &
    2260              :                           description="Number of independent helium environments", &
    2261         1455 :                           repeats=.FALSE., default_i_val=1)
    2262         1455 :       CALL section_add_keyword(section, keyword)
    2263         1455 :       CALL keyword_release(keyword)
    2264              : 
    2265              :       CALL keyword_create(keyword, __LOCATION__, name="POTENTIAL_FILE_NAME", &
    2266              :                           description="Name of the Helium interaction potential file", &
    2267         1455 :                           repeats=.FALSE., default_lc_val="HELIUM.POT")
    2268         1455 :       CALL section_add_keyword(section, keyword)
    2269         1455 :       CALL keyword_release(keyword)
    2270              : 
    2271              :       CALL keyword_create(keyword, __LOCATION__, name="GET_FORCES", &
    2272              :                           description="Get average MC forces or last MC forces to propagate MD", &
    2273              :                           usage="GET_FORCES (AVERAGE|LAST)", &
    2274              :                           default_i_val=helium_forces_average, &
    2275              :                           enum_c_vals=s2a("AVERAGE", "LAST"), &
    2276         1455 :                           enum_i_vals=[helium_forces_average, helium_forces_last])
    2277         1455 :       CALL section_add_keyword(section, keyword)
    2278         1455 :       CALL keyword_release(keyword)
    2279              : 
    2280              :       CALL keyword_create(keyword, __LOCATION__, name="SOLUTE_INTERACTION", &
    2281              :                           description="Interaction potential between helium and the solute", &
    2282              :                           usage="SOLUTE_INTERACTION (NONE | MWATER | NNP)", &
    2283              :                           default_i_val=helium_solute_intpot_none, &
    2284              :                           enum_c_vals=s2a("NONE", "MWATER", "NNP"), &
    2285              :                           enum_i_vals=[ &
    2286              :                           helium_solute_intpot_none, &
    2287              :                           helium_solute_intpot_mwater, &
    2288              :                           helium_solute_intpot_nnp], &
    2289              :                           enum_desc=s2a( &
    2290              :                           "No interaction with solute", &
    2291              :                           "Test interaction with wrong Water", &
    2292         1455 :                           "Interaction with NNP"))
    2293         1455 :       CALL section_add_keyword(section, keyword)
    2294         1455 :       CALL keyword_release(keyword)
    2295              : 
    2296              :       CALL keyword_create(keyword, __LOCATION__, name="NATOMS", &
    2297              :                           description="Number of helium atoms", &
    2298         1455 :                           repeats=.FALSE., default_i_val=64)
    2299         1455 :       CALL section_add_keyword(section, keyword)
    2300         1455 :       CALL keyword_release(keyword)
    2301              : 
    2302              :       CALL keyword_create(keyword, __LOCATION__, name="NBEADS", &
    2303              :                           description="Number of helium path integral beads", &
    2304         1455 :                           repeats=.FALSE., default_i_val=25)
    2305         1455 :       CALL section_add_keyword(section, keyword)
    2306         1455 :       CALL keyword_release(keyword)
    2307              : 
    2308              :       CALL keyword_create(keyword, __LOCATION__, name="RNG_SEED", &
    2309              :                           description="Initial seed for the (pseudo)random number "// &
    2310              :                           "generator that controls helium coordinate generation and propagation.", &
    2311              :                           usage="RNG_SEED <INTEGER>", default_i_val=12345, &
    2312         1455 :                           repeats=.FALSE.)
    2313         1455 :       CALL section_add_keyword(section, keyword)
    2314         1455 :       CALL keyword_release(keyword)
    2315              : 
    2316              :       CALL keyword_create(keyword, __LOCATION__, name="N_INNER", &
    2317              :                           variants=s2a("INOROT"), &
    2318              :                           description="Number of MC iterations at the same time slice(s) "// &
    2319              :                           "(number of inner MC loop iterations)", &
    2320         1455 :                           repeats=.FALSE., default_i_val=6600)
    2321         1455 :       CALL section_add_keyword(section, keyword)
    2322         1455 :       CALL keyword_release(keyword)
    2323              : 
    2324              :       CALL keyword_create(keyword, __LOCATION__, name="N_OUTER", &
    2325              :                           variants=s2a("IROT"), &
    2326              :                           description="how often to reselect the time slice(s) to work on "// &
    2327              :                           "(number of outer MC loop iterations)", &
    2328         1455 :                           repeats=.FALSE., default_i_val=300)
    2329         1455 :       CALL section_add_keyword(section, keyword)
    2330         1455 :       CALL keyword_release(keyword)
    2331              : 
    2332              :       CALL keyword_create(keyword, __LOCATION__, name="SAMPLING_METHOD", &
    2333              :                           description="Choose between Ceperley or the worm algorithm", &
    2334              :                           usage="SAMPLING_METHOD (CEPERLEY|WORM)", &
    2335              :                           default_i_val=helium_sampling_ceperley, &
    2336              :                           enum_c_vals=s2a("CEPERLEY", "WORM"), &
    2337         1455 :                           enum_i_vals=[helium_sampling_ceperley, helium_sampling_worm])
    2338         1455 :       CALL section_add_keyword(section, keyword)
    2339         1455 :       CALL keyword_release(keyword)
    2340              : 
    2341              :       CALL keyword_create(keyword, __LOCATION__, name="COORD_INIT_TEMP", &
    2342              :                           description="Temperature for thermal gaussian initialization of the helium."// &
    2343              :                           " Negative values correspond to a hot start.", &
    2344              :                           default_r_val=cp_unit_to_cp2k(300._dp, "K"), &
    2345         1455 :                           unit_str="K")
    2346         1455 :       CALL section_add_keyword(section, keyword)
    2347         1455 :       CALL keyword_release(keyword)
    2348              : 
    2349              :       CALL keyword_create(keyword, __LOCATION__, name="SOLUTE_RADIUS", &
    2350              :                           description="Radius of the solute molecule for prevention of"// &
    2351              :                           " coordinate collision during initialization", &
    2352              :                           default_r_val=cp_unit_to_cp2k(0.0_dp, "angstrom"), &
    2353         1455 :                           repeats=.FALSE., type_of_var=real_t, unit_str="angstrom")
    2354         1455 :       CALL section_add_keyword(section, keyword)
    2355         1455 :       CALL keyword_release(keyword)
    2356              : 
    2357              :       ! Helium-solute interaction NNP
    2358         1455 :       NULLIFY (subsection)
    2359              :       CALL section_create(subsection, __LOCATION__, name="NNP", &
    2360              :                           description="This section contains all information to run an helium-solute "// &
    2361              :                           "interaction Neural Network Potential (NNP) calculation.", &
    2362         1455 :                           n_keywords=4, n_subsections=3, repeats=.FALSE.)
    2363              : 
    2364              :       CALL keyword_create(keyword, __LOCATION__, name="NNP_INPUT_FILE_NAME", &
    2365              :                           description="File containing the input information for the setup "// &
    2366              :                           "of the NNP (n2p2/RuNNer format). ", &
    2367         1455 :                           repeats=.FALSE., default_lc_val="input.nn")
    2368         1455 :       CALL section_add_keyword(subsection, keyword)
    2369         1455 :       CALL keyword_release(keyword)
    2370              : 
    2371              :       CALL keyword_create(keyword, __LOCATION__, name="SCALE_FILE_NAME", &
    2372              :                           description="File containing the scaling information for the symmetry "// &
    2373              :                           "functions of the NNP. ", &
    2374         1455 :                           repeats=.FALSE., default_lc_val="scaling.data")
    2375         1455 :       CALL section_add_keyword(subsection, keyword)
    2376         1455 :       CALL keyword_release(keyword)
    2377              : 
    2378              :       CALL keyword_create(keyword, __LOCATION__, name="RAD_SPLINE_N", &
    2379              :                           description="Number of knots per radial group in the cubic-Hermite "// &
    2380              :                           "spline tables that tabulate the radial symmetry-function product "// &
    2381              :                           "y(r) = exp(-eta*(r-rs)^2) * fcut(r). Cubic-Hermite per-evaluation "// &
    2382              :                           "error scales as O(1/n^4); the default keeps the spline residual "// &
    2383              :                           "inside the NNP regression tolerance for a radial cutoff of "// &
    2384              :                           "~12 bohr. Models with larger cutoffs or stricter tolerances may "// &
    2385              :                           "need a larger n. Memory cost scales linearly in n per radial group.", &
    2386              :                           repeats=.FALSE., &
    2387              :                           n_var=1, &
    2388              :                           type_of_var=integer_t, &
    2389              :                           default_i_val=8192, &
    2390         1455 :                           usage="RAD_SPLINE_N 8192")
    2391         1455 :       CALL section_add_keyword(subsection, keyword)
    2392         1455 :       CALL keyword_release(keyword)
    2393              : 
    2394              :       CALL keyword_create(keyword, __LOCATION__, name="VERLET_SKIN", &
    2395              :                           description="Verlet skin distance for the NNP descriptor neighbour "// &
    2396              :                           "cell-list. The neighbour-list cutoff is (symmetry-function cutoff "// &
    2397              :                           "+ skin); the cell-list chain is rebuilt only when an atom drifts "// &
    2398              :                           "more than skin/2 from its rebuild-time position, analogous to the "// &
    2399              :                           "LAMMPS 'neighbor <skin> bin' command. Larger skin reduces the "// &
    2400              :                           "rebuild rate but enlarges the per-atom neighbour list. A negative "// &
    2401              :                           "value (default) selects the automatic heuristic "// &
    2402              :                           "MIN(0.5 bohr, 0.1*cutoff). Useful upper bound is half the smallest "// &
    2403              :                           "perpendicular cell width.", &
    2404              :                           repeats=.FALSE., &
    2405              :                           n_var=1, &
    2406              :                           type_of_var=real_t, &
    2407              :                           default_r_val=-1.0_dp, &
    2408              :                           unit_str="bohr", &
    2409         1455 :                           usage="VERLET_SKIN [bohr] 0.5")
    2410         1455 :       CALL section_add_keyword(subsection, keyword)
    2411         1455 :       CALL keyword_release(keyword)
    2412              : 
    2413         1455 :       NULLIFY (subsubsection)
    2414              :       CALL section_create(subsubsection, __LOCATION__, name="SR_CUTOFF", &
    2415              :                           description="Section for failsafe short range cutoffs for the NNPs, "// &
    2416              :                           "if the distance between solvent and specified solute element becomes "// &
    2417              :                           "smaller than the given cutoff, an artifical repulsive potential is "// &
    2418              :                           "introduced. Note this is only meant to prevent such configurations, "// &
    2419              :                           "not to physically sample them.", &
    2420         1455 :                           n_keywords=2, n_subsections=0, repeats=.TRUE.)
    2421              : 
    2422              :       CALL keyword_create(keyword, __LOCATION__, name="ELEMENT", &
    2423              :                           description="Solute element for which the short range cutoff is in effect", &
    2424         1455 :                           repeats=.FALSE., default_c_val="none")
    2425         1455 :       CALL section_add_keyword(subsubsection, keyword)
    2426         1455 :       CALL keyword_release(keyword)
    2427              : 
    2428              :       CALL keyword_create(keyword, __LOCATION__, name="RADIUS", &
    2429              :                           description="Short range cutoff in Angstrom, below this cutoff, the energy "// &
    2430              :                           "is replaced by a sizable positive value plus a 1/r**2 term to guide particles "// &
    2431              :                           "away from each other.", &
    2432              :                           default_r_val=cp_unit_to_cp2k(0.0_dp, "angstrom"), &
    2433         1455 :                           repeats=.FALSE., type_of_var=real_t, unit_str="angstrom")
    2434         1455 :       CALL section_add_keyword(subsubsection, keyword)
    2435         1455 :       CALL keyword_release(keyword)
    2436         1455 :       CALL section_add_subsection(subsection, subsubsection)
    2437         1455 :       CALL section_release(subsubsection)
    2438              : 
    2439         1455 :       NULLIFY (subsubsection)
    2440              :       CALL section_create(subsubsection, __LOCATION__, name="MODEL", &
    2441              :                           description="Section for a single NNP model. If this section is repeated, "// &
    2442              :                           "a committee model (C-NNP)is used where the NNP members share the same "// &
    2443              :                           "symmetry functions. ", &
    2444         1455 :                           n_keywords=1, n_subsections=0, repeats=.TRUE.)
    2445              : 
    2446              :       CALL keyword_create(keyword, __LOCATION__, name="WEIGHTS", &
    2447              :                           description="File containing the weights for the artificial neural "// &
    2448              :                           "networks of the NNP. The specified name is extended by .XXX.data ", &
    2449         1455 :                           repeats=.FALSE., default_lc_val="weights")
    2450         1455 :       CALL section_add_keyword(subsubsection, keyword)
    2451         1455 :       CALL keyword_release(keyword)
    2452         1455 :       CALL section_add_subsection(subsection, subsubsection)
    2453         1455 :       CALL section_release(subsubsection)
    2454              : 
    2455              :       ! Create the PRINT subsection
    2456         1455 :       NULLIFY (subsubsection)
    2457              :       CALL section_create(subsubsection, __LOCATION__, name="PRINT", &
    2458              :                           description="Section of possible print options in NNP code.", &
    2459         1455 :                           n_keywords=0, n_subsections=3, repeats=.FALSE.)
    2460         1455 :       NULLIFY (print_key, keyword)
    2461              : 
    2462              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "ENERGIES", &
    2463              :                                        description="Controls the printing of the NNP energies.", &
    2464         1455 :                                        print_level=medium_print_level, common_iter_levels=1)
    2465         1455 :       CALL section_add_subsection(subsubsection, print_key)
    2466         1455 :       CALL section_release(print_key)
    2467              : 
    2468              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "FORCES_SIGMA", &
    2469              :                                        description="Controls the printing of the STD per atom of the NNP forces.", &
    2470         1455 :                                        print_level=medium_print_level, common_iter_levels=1)
    2471         1455 :       CALL section_add_subsection(subsubsection, print_key)
    2472         1455 :       CALL section_release(print_key)
    2473              : 
    2474              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "EXTRAPOLATION", &
    2475              :                                        description="If activated, output structures with extrapolation "// &
    2476              :                                        "warning in xyz-format", &
    2477         1455 :                                        print_level=medium_print_level, common_iter_levels=1)
    2478         1455 :       CALL section_add_subsection(subsubsection, print_key)
    2479         1455 :       CALL section_release(print_key)
    2480         1455 :       CALL section_add_subsection(subsection, subsubsection)
    2481         1455 :       CALL section_release(subsubsection)
    2482              : 
    2483         1455 :       CALL section_add_subsection(section, subsection)
    2484         1455 :       CALL section_release(subsection) ! release NNP subsection
    2485              : 
    2486              :       ! Ceperley's sampling algorithm
    2487         1455 :       NULLIFY (subsection)
    2488              :       CALL section_create(subsection, __LOCATION__, name="CEPERLEY", &
    2489              :                           description="Enables sampling with Ceperley's algorithm", &
    2490         1455 :                           n_keywords=2, n_subsections=1, repeats=.FALSE.)
    2491              : 
    2492              :       CALL keyword_create(keyword, __LOCATION__, name="BISECTION", &
    2493              :                           description="how many time slices to change at once (+1). "// &
    2494              :                           "Must be a power of 2 currently", &
    2495         1455 :                           repeats=.FALSE., default_i_val=8)
    2496         1455 :       CALL section_add_keyword(subsection, keyword)
    2497         1455 :       CALL keyword_release(keyword)
    2498              : 
    2499              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_PERM_CYCLE", &
    2500              :                           description="how large cyclic permutations to try", &
    2501         1455 :                           repeats=.FALSE., default_i_val=6)
    2502         1455 :       CALL section_add_keyword(subsection, keyword)
    2503         1455 :       CALL keyword_release(keyword)
    2504              : 
    2505         1455 :       NULLIFY (subsubsection)
    2506              :       CALL section_create(subsubsection, __LOCATION__, name="M-SAMPLING", &
    2507              :                           description="Permutation cycle length sampling settings", &
    2508         1455 :                           n_keywords=3, n_subsections=0, repeats=.FALSE.)
    2509              :       CALL keyword_create(keyword, __LOCATION__, name="DISTRIBUTION-TYPE", &
    2510              :                           description="Distribution from which the cycle length m is sampled", &
    2511              :                           usage="DISTRIBUTION-TYPE (SINGLEV|UNIFORM|LINEAR|QUADRATIC|EXPONENTIAL|GAUSSIAN)", &
    2512              :                           default_i_val=helium_mdist_uniform, &
    2513              :                           enum_c_vals=s2a( &
    2514              :                           "SINGLEV", &
    2515              :                           "UNIFORM", &
    2516              :                           "LINEAR", &
    2517              :                           "QUADRATIC", &
    2518              :                           "EXPONENTIAL", &
    2519              :                           "GAUSSIAN"), &
    2520              :                           enum_i_vals=[ &
    2521              :                           helium_mdist_singlev, &
    2522              :                           helium_mdist_uniform, &
    2523              :                           helium_mdist_linear, &
    2524              :                           helium_mdist_quadratic, &
    2525              :                           helium_mdist_exponential, &
    2526         1455 :                           helium_mdist_gaussian])
    2527         1455 :       CALL section_add_keyword(subsubsection, keyword)
    2528         1455 :       CALL keyword_release(keyword)
    2529              :       CALL keyword_create(keyword, __LOCATION__, name="M-VALUE", &
    2530              :                           description="Value of m treated in a special way "// &
    2531              :                           "(specific behavior depends on the distribution type chosen)", &
    2532              :                           repeats=.FALSE., &
    2533         1455 :                           default_i_val=1)
    2534         1455 :       CALL section_add_keyword(subsubsection, keyword)
    2535         1455 :       CALL keyword_release(keyword)
    2536              :       CALL keyword_create(keyword, __LOCATION__, name="M-RATIO", &
    2537              :                           description="Probability ratio betw M-VALUE and other cycle lengths", &
    2538              :                           repeats=.FALSE., &
    2539         1455 :                           default_r_val=1.0_dp)
    2540         1455 :       CALL section_add_keyword(subsubsection, keyword)
    2541         1455 :       CALL keyword_release(keyword)
    2542         1455 :       CALL section_add_subsection(subsection, subsubsection)
    2543         1455 :       CALL section_release(subsubsection)
    2544         1455 :       CALL section_add_subsection(section, subsection)
    2545         1455 :       CALL section_release(subsection) ! release CEPERLEY subsection
    2546              : 
    2547              : ! worm algorithm parameters:
    2548         1455 :       NULLIFY (subsection)
    2549              :       CALL section_create(subsection, __LOCATION__, name="WORM", &
    2550              :                           description="Enables sampling via the canonical worm algorithm adapted from Bonisegni", &
    2551         1455 :                           n_keywords=12, n_subsections=0, repeats=.FALSE.)
    2552              : 
    2553              :       CALL keyword_create(keyword, __LOCATION__, name="CENTROID_DRMAX", &
    2554              :                           description="Maximum displacement allowed for the centroid moves", &
    2555         1455 :                           repeats=.FALSE., default_r_val=0.5_dp)
    2556         1455 :       CALL section_add_keyword(subsection, keyword)
    2557         1455 :       CALL keyword_release(keyword)
    2558              : 
    2559              :       CALL keyword_create(keyword, __LOCATION__, name="STAGING_L", &
    2560              :                           description="From 2 up to max. L-1 beads will be moved", &
    2561         1455 :                           repeats=.FALSE., default_i_val=5)
    2562         1455 :       CALL section_add_keyword(subsection, keyword)
    2563         1455 :       CALL keyword_release(keyword)
    2564              : 
    2565              :       CALL keyword_create(keyword, __LOCATION__, name="OPEN_CLOSE_SCALE", &
    2566              :                           description="Open/Close acceptance adjustment parameter", &
    2567         1455 :                           repeats=.FALSE., default_r_val=0.01_dp)
    2568         1455 :       CALL section_add_keyword(subsection, keyword)
    2569         1455 :       CALL keyword_release(keyword)
    2570              : 
    2571              :       CALL keyword_create(keyword, __LOCATION__, name="ALLOW_OPEN", &
    2572              :                           description="Enable bosonic exchange sampling", &
    2573         1455 :                           repeats=.FALSE., default_l_val=.TRUE.)
    2574         1455 :       CALL section_add_keyword(subsection, keyword)
    2575         1455 :       CALL keyword_release(keyword)
    2576              : 
    2577              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_OPEN_CYCLES", &
    2578              :                          description="If > 0 then reset positions and permutations to the previous closed &
    2579              :                          & state if staying more than this amount of MC cycles in open state to avoid staying &
    2580              :                          & trapped in open state for too long. Use with caution as it can potentially introduce &
    2581              :                          & a bias in the sampling.", &
    2582         1455 :                           repeats=.FALSE., default_i_val=0)
    2583         1455 :       CALL section_add_keyword(subsection, keyword)
    2584         1455 :       CALL keyword_release(keyword)
    2585              : 
    2586              :       CALL keyword_create(keyword, __LOCATION__, name="SHOW_STATISTICS", &
    2587              :                           description="Show sampling statistics in output", &
    2588         1455 :                           repeats=.FALSE., default_l_val=.TRUE.)
    2589         1455 :       CALL section_add_keyword(subsection, keyword)
    2590         1455 :       CALL keyword_release(keyword)
    2591              : 
    2592              :       CALL keyword_create(keyword, __LOCATION__, name="CENTROID_WEIGHT", &
    2593              :                           description="Absolute weight of the centroid move", &
    2594         1455 :                           repeats=.FALSE., default_i_val=10)
    2595         1455 :       CALL section_add_keyword(subsection, keyword)
    2596         1455 :       CALL keyword_release(keyword)
    2597              : 
    2598              :       CALL keyword_create(keyword, __LOCATION__, name="STAGING_WEIGHT", &
    2599              :                           description="Absolute weight of the staging move", &
    2600         1455 :                           repeats=.FALSE., default_i_val=30)
    2601         1455 :       CALL section_add_keyword(subsection, keyword)
    2602         1455 :       CALL keyword_release(keyword)
    2603              : 
    2604              :       CALL keyword_create(keyword, __LOCATION__, name="OPEN_CLOSE_WEIGHT", &
    2605              :                           description="Absolute weight of the open/close move", &
    2606         1455 :                           repeats=.FALSE., default_i_val=10)
    2607         1455 :       CALL section_add_keyword(subsection, keyword)
    2608         1455 :       CALL keyword_release(keyword)
    2609              : 
    2610              :       CALL keyword_create(keyword, __LOCATION__, name="HEAD_TAIL_WEIGHT", &
    2611              :                           description="Absolute weight of the head/tail moves (both)", &
    2612         1455 :                           repeats=.FALSE., default_i_val=10)
    2613         1455 :       CALL section_add_keyword(subsection, keyword)
    2614         1455 :       CALL keyword_release(keyword)
    2615              : 
    2616              :       CALL keyword_create(keyword, __LOCATION__, name="CRAWL_WEIGHT", &
    2617              :                           description="Absolute weight of the crawl bwd/fwd moves (both)", &
    2618         1455 :                           repeats=.FALSE., default_i_val=10)
    2619         1455 :       CALL section_add_keyword(subsection, keyword)
    2620         1455 :       CALL keyword_release(keyword)
    2621              : 
    2622              :       CALL keyword_create(keyword, __LOCATION__, name="CRAWL_REPETITION", &
    2623              :                           description="Number of repeated crawl moves", &
    2624         1455 :                           repeats=.FALSE., default_i_val=4)
    2625         1455 :       CALL section_add_keyword(subsection, keyword)
    2626         1455 :       CALL keyword_release(keyword)
    2627              : 
    2628              :       CALL keyword_create(keyword, __LOCATION__, name="SWAP_WEIGHT", &
    2629              :                           description="Absolute weight of the crawl move", &
    2630         1455 :                           repeats=.FALSE., default_i_val=10)
    2631         1455 :       CALL section_add_keyword(subsection, keyword)
    2632         1455 :       CALL keyword_release(keyword)
    2633              : 
    2634         1455 :       CALL section_add_subsection(section, subsection)
    2635         1455 :       CALL section_release(subsection) ! release WORM subsection
    2636              : 
    2637              : ! end of worm parameters
    2638              : 
    2639              :       CALL keyword_create(keyword, __LOCATION__, name="PERIODIC", &
    2640              :                           description="Use periodic boundary conditions for helium", &
    2641         1455 :                           repeats=.FALSE., default_l_val=.FALSE.)
    2642         1455 :       CALL section_add_keyword(section, keyword)
    2643         1455 :       CALL keyword_release(keyword)
    2644              : 
    2645              :       CALL keyword_create(keyword, __LOCATION__, name="CELL_SIZE", &
    2646              :                           description="PBC unit cell size (NOTE 1: density, number of atoms"// &
    2647              :                           " and volume are interdependent - give only two of them; "// &
    2648              :                           "NOTE 2: for small cell sizes specify NATOMS instead)", &
    2649         1455 :                           repeats=.FALSE., type_of_var=real_t, unit_str="angstrom")
    2650         1455 :       CALL section_add_keyword(section, keyword)
    2651         1455 :       CALL keyword_release(keyword)
    2652              : 
    2653              :       CALL keyword_create(keyword, __LOCATION__, name="CELL_SHAPE", &
    2654              :                           description="PBC unit cell shape for helium", &
    2655              :                           usage="CELL_SHAPE (CUBE|OCTAHEDRON)", &
    2656              :                           default_i_val=helium_cell_shape_cube, &
    2657              :                           enum_c_vals=s2a("CUBE", "OCTAHEDRON"), &
    2658         1455 :                           enum_i_vals=[helium_cell_shape_cube, helium_cell_shape_octahedron])
    2659         1455 :       CALL section_add_keyword(section, keyword)
    2660         1455 :       CALL keyword_release(keyword)
    2661              : 
    2662              :       CALL keyword_create(keyword, __LOCATION__, name="DROPLET_RADIUS", &
    2663              :                           description="Reject a move if any of the new positions does not lie within"// &
    2664              :                           "  this range from the center of gravity", &
    2665              :                           repeats=.FALSE., type_of_var=real_t, default_r_val=HUGE(1.0_dp), &
    2666         1455 :                           unit_str="angstrom")
    2667         1455 :       CALL section_add_keyword(section, keyword)
    2668         1455 :       CALL keyword_release(keyword)
    2669              : 
    2670              :       CALL keyword_create(keyword, __LOCATION__, name="DENSITY", &
    2671              :                           description="trial density of helium for determining the helium "// &
    2672              :                           "box size", &
    2673              :                           repeats=.FALSE., &
    2674              :                           default_r_val=cp_unit_to_cp2k(0.02186_dp, "angstrom^-3"), &
    2675         1455 :                           unit_str="angstrom^-3")
    2676         1455 :       CALL section_add_keyword(section, keyword)
    2677         1455 :       CALL keyword_release(keyword)
    2678              : 
    2679              :       CALL keyword_create(keyword, __LOCATION__, name="PRESAMPLE", &
    2680              :                           description="Presample He coordinates before first PIMD step", &
    2681         1455 :                           repeats=.FALSE., default_l_val=.FALSE.)
    2682         1455 :       CALL section_add_keyword(section, keyword)
    2683         1455 :       CALL keyword_release(keyword)
    2684              : 
    2685              :       CALL section_create(subsection, __LOCATION__, name="RDF", &
    2686              :                           description="Radial distribution settings", &
    2687         1455 :                           n_keywords=5, n_subsections=0, repeats=.FALSE.)
    2688              : 
    2689              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
    2690              :                           description="Whether or not to actually calculate this property", &
    2691         1455 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2692         1455 :       CALL section_add_keyword(subsection, keyword)
    2693         1455 :       CALL keyword_release(keyword)
    2694              : 
    2695              :       CALL keyword_create(keyword, __LOCATION__, name="MAXR", &
    2696              :                           description="Maximum RDF range, defaults to unit cell size", &
    2697              :                           repeats=.FALSE., type_of_var=real_t, &
    2698         1455 :                           unit_str="angstrom")
    2699         1455 :       CALL section_add_keyword(subsection, keyword)
    2700         1455 :       CALL keyword_release(keyword)
    2701              : 
    2702              :       CALL keyword_create(keyword, __LOCATION__, name="NBIN", &
    2703              :                           description="Number of bins", &
    2704              :                           repeats=.FALSE., &
    2705         1455 :                           default_i_val=250)
    2706         1455 :       CALL section_add_keyword(subsection, keyword)
    2707         1455 :       CALL keyword_release(keyword)
    2708              : 
    2709              :       CALL keyword_create(keyword, __LOCATION__, name="SOLUTE_HE", &
    2710              :                           description="Whether or not to calculate solute-He RDFs (if solute is present)", &
    2711         1455 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    2712         1455 :       CALL section_add_keyword(subsection, keyword)
    2713         1455 :       CALL keyword_release(keyword)
    2714              : 
    2715              :       CALL keyword_create(keyword, __LOCATION__, name="HE_HE", &
    2716              :                           description="Whether or not to calculate He-He RDFs", &
    2717         1455 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2718         1455 :       CALL section_add_keyword(subsection, keyword)
    2719         1455 :       CALL keyword_release(keyword)
    2720              : 
    2721         1455 :       CALL section_add_subsection(section, subsection)
    2722         1455 :       CALL section_release(subsection)
    2723              : 
    2724         1455 :       NULLIFY (subsection)
    2725              :       CALL section_create(subsection, __LOCATION__, name="RHO", &
    2726              :                           description="Spatial distribution settings", &
    2727         1455 :                           n_keywords=10, n_subsections=0, repeats=.FALSE.)
    2728              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
    2729              :                           description="Whether or not to actually calculate densities "// &
    2730              :                           "(requires significant amount of memory, depending on the value of NBIN)", &
    2731         1455 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2732         1455 :       CALL section_add_keyword(subsection, keyword)
    2733         1455 :       CALL keyword_release(keyword)
    2734              :       CALL keyword_create(keyword, __LOCATION__, name="NBIN", &
    2735              :                           description="Number of grid points in each direction for density binning", &
    2736              :                           repeats=.FALSE., &
    2737         1455 :                           default_i_val=100)
    2738         1455 :       CALL section_add_keyword(subsection, keyword)
    2739         1455 :       CALL keyword_release(keyword)
    2740              :       !
    2741              :       CALL keyword_create(keyword, __LOCATION__, name="MIN_CYCLE_LENGTHS_WDG", &
    2742              :                           description="Density of winding paths "// &
    2743              :                           "not shorter than the given length", &
    2744              :                           repeats=.FALSE., usage="MIN_CYCLE_LENGTHS_WDG <INT> <INT> .. <INT>", &
    2745         1455 :                           type_of_var=integer_t, n_var=-1)
    2746         1455 :       CALL section_add_keyword(subsection, keyword)
    2747         1455 :       CALL keyword_release(keyword)
    2748              :       !
    2749              :       CALL keyword_create(keyword, __LOCATION__, name="MIN_CYCLE_LENGTHS_NON", &
    2750              :                           description="Density of non-winding paths "// &
    2751              :                           "not shorter than the given length", &
    2752              :                           repeats=.FALSE., usage="MIN_CYCLE_LENGTHS_NON <INT> <INT> .. <INT>", &
    2753         1455 :                           type_of_var=integer_t, n_var=-1)
    2754         1455 :       CALL section_add_keyword(subsection, keyword)
    2755         1455 :       CALL keyword_release(keyword)
    2756              :       !
    2757              :       CALL keyword_create(keyword, __LOCATION__, name="MIN_CYCLE_LENGTHS_ALL", &
    2758              :                           description="Density of all paths "// &
    2759              :                           "not shorter than the given length", &
    2760              :                           repeats=.FALSE., usage="MIN_CYCLE_LENGTHS_ALL <INT> <INT> .. <INT>", &
    2761         1455 :                           type_of_var=integer_t, n_var=-1)
    2762         1455 :       CALL section_add_keyword(subsection, keyword)
    2763         1455 :       CALL keyword_release(keyword)
    2764              :       !
    2765              :       CALL keyword_create(keyword, __LOCATION__, name="ATOM_NUMBER", &
    2766              :                           description="Atom number density", &
    2767              :                           repeats=.FALSE., &
    2768              :                           type_of_var=logical_t, &
    2769              :                           default_l_val=.TRUE., &
    2770         1455 :                           lone_keyword_l_val=.TRUE.)
    2771         1455 :       CALL section_add_keyword(subsection, keyword)
    2772         1455 :       CALL keyword_release(keyword)
    2773              :       !
    2774              :       CALL keyword_create(keyword, __LOCATION__, name="PROJECTED_AREA_2", &
    2775              :                           description="Projected area squared density, A*A(r)", &
    2776              :                           repeats=.FALSE., &
    2777              :                           type_of_var=logical_t, &
    2778              :                           default_l_val=.FALSE., &
    2779         1455 :                           lone_keyword_l_val=.TRUE.)
    2780         1455 :       CALL section_add_keyword(subsection, keyword)
    2781         1455 :       CALL keyword_release(keyword)
    2782              :       !
    2783              :       CALL keyword_create(keyword, __LOCATION__, name="WINDING_NUMBER_2", &
    2784              :                           description="Winding number squared density, W*W(r)", &
    2785              :                           repeats=.FALSE., &
    2786              :                           type_of_var=logical_t, &
    2787              :                           default_l_val=.FALSE., &
    2788         1455 :                           lone_keyword_l_val=.TRUE.)
    2789         1455 :       CALL section_add_keyword(subsection, keyword)
    2790         1455 :       CALL keyword_release(keyword)
    2791              :       !
    2792              :       CALL keyword_create(keyword, __LOCATION__, name="WINDING_CYCLE_2", &
    2793              :                           description="Winding number squared density, W^2(r)", &
    2794              :                           repeats=.FALSE., &
    2795              :                           type_of_var=logical_t, &
    2796              :                           default_l_val=.FALSE., &
    2797         1455 :                           lone_keyword_l_val=.TRUE.)
    2798         1455 :       CALL section_add_keyword(subsection, keyword)
    2799         1455 :       CALL keyword_release(keyword)
    2800              :       !
    2801              :       CALL keyword_create(keyword, __LOCATION__, name="MOMENT_OF_INERTIA", &
    2802              :                           description="Moment of inertia density", &
    2803              :                           repeats=.FALSE., &
    2804              :                           type_of_var=logical_t, &
    2805              :                           default_l_val=.FALSE., &
    2806         1455 :                           lone_keyword_l_val=.TRUE.)
    2807         1455 :       CALL section_add_keyword(subsection, keyword)
    2808         1455 :       CALL keyword_release(keyword)
    2809              : 
    2810         1455 :       CALL section_add_subsection(section, subsection)
    2811         1455 :       CALL section_release(subsection)
    2812              :       ! end of subsection RHO
    2813              : 
    2814         1455 :       CALL create_coord_section(subsection, "HELIUM")
    2815         1455 :       CALL section_add_subsection(section, subsection)
    2816         1455 :       CALL section_release(subsection)
    2817              : 
    2818              :       CALL section_create(subsection, __LOCATION__, name="PERM", &
    2819              :                           description="Permutation state used for restart", &
    2820         1455 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
    2821              :       CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
    2822              :                           description="Specify particle index permutation for every "// &
    2823              :                           "helium atom", repeats=.TRUE., usage="<INT> <INT> .. <INT>", &
    2824         1455 :                           type_of_var=integer_t, n_var=-1)
    2825         1455 :       CALL section_add_keyword(subsection, keyword)
    2826         1455 :       CALL keyword_release(keyword)
    2827         1455 :       CALL section_add_subsection(section, subsection)
    2828         1455 :       CALL section_release(subsection)
    2829              : 
    2830              :       CALL section_create(subsection, __LOCATION__, name="AVERAGES", &
    2831              :                           description="Average properties (used for restarts)", &
    2832         1455 :                           n_keywords=7, n_subsections=0, repeats=.FALSE.)
    2833              :       CALL keyword_create(keyword, __LOCATION__, name="PROJECTED_AREA", &
    2834              :                           description="Projected area vector for all environments", &
    2835              :                           repeats=.TRUE., usage="PROJECTED_AREA <REAL> <REAL> .. <REAL>", &
    2836         1455 :                           type_of_var=real_t, n_var=-1)
    2837         1455 :       CALL section_add_keyword(subsection, keyword)
    2838         1455 :       CALL keyword_release(keyword)
    2839              :       CALL keyword_create(keyword, __LOCATION__, name="PROJECTED_AREA_2", &
    2840              :                           description="Projected area vector squared for all environments", &
    2841              :                           repeats=.TRUE., usage="PROJECTED_AREA_2 <REAL> <REAL> .. <REAL>", &
    2842         1455 :                           type_of_var=real_t, n_var=-1)
    2843         1455 :       CALL section_add_keyword(subsection, keyword)
    2844         1455 :       CALL keyword_release(keyword)
    2845              :       CALL keyword_create(keyword, __LOCATION__, name="WINDING_NUMBER_2", &
    2846              :                           description="Winding number vector squared for all environments", &
    2847              :                           repeats=.TRUE., usage="WINDING_NUMBER_2 <REAL> <REAL> .. <REAL>", &
    2848         1455 :                           type_of_var=real_t, n_var=-1)
    2849         1455 :       CALL section_add_keyword(subsection, keyword)
    2850         1455 :       CALL keyword_release(keyword)
    2851              :       CALL keyword_create(keyword, __LOCATION__, name="MOMENT_OF_INERTIA", &
    2852              :                           description="Moment of inertia vector for all environments", &
    2853              :                           repeats=.TRUE., usage="MOMENT_OF_INERTIA <REAL> <REAL> .. <REAL>", &
    2854         1455 :                           type_of_var=real_t, n_var=-1)
    2855         1455 :       CALL section_add_keyword(subsection, keyword)
    2856         1455 :       CALL keyword_release(keyword)
    2857              :       CALL keyword_create(keyword, __LOCATION__, name="RDF", &
    2858              :                           description="Radial distributions averaged over all environments", &
    2859              :                           repeats=.TRUE., usage="RDF <REAL> <REAL> .. <REAL>", &
    2860         1455 :                           type_of_var=real_t, n_var=-1)
    2861         1455 :       CALL section_add_keyword(subsection, keyword)
    2862         1455 :       CALL keyword_release(keyword)
    2863              :       CALL keyword_create(keyword, __LOCATION__, name="RHO", &
    2864              :                           description="Spatial distributions averaged over all environments", &
    2865              :                           repeats=.TRUE., usage="RHO <REAL> <REAL> .. <REAL>", &
    2866         1455 :                           type_of_var=real_t, n_var=-1)
    2867         1455 :       CALL section_add_keyword(subsection, keyword)
    2868         1455 :       CALL keyword_release(keyword)
    2869              :       CALL keyword_create(keyword, __LOCATION__, name="IWEIGHT", &
    2870              :                           description="Weight for the restarted quantities "// &
    2871              :                           "(number of MC steps used to calculate the accumulated averages)", &
    2872              :                           repeats=.FALSE., &
    2873         1455 :                           default_i_val=0)
    2874         1455 :       CALL section_add_keyword(subsection, keyword)
    2875         1455 :       CALL keyword_release(keyword)
    2876         1455 :       CALL section_add_subsection(section, subsection)
    2877         1455 :       CALL section_release(subsection)
    2878              : 
    2879              :       CALL section_create(subsection, __LOCATION__, name="FORCE", &
    2880              :                           description="Forces exerted by the helium on the solute system"// &
    2881              :                           " (used for restarts)", &
    2882         1455 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
    2883              :       CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
    2884              :                           description="Number of real values should be 3 * "// &
    2885              :                           "<num_solute_atoms> * <num_solute_beads>", repeats=.TRUE., &
    2886              :                           usage="<REAL> <REAL> .. <REAL>", type_of_var=real_t, &
    2887         1455 :                           n_var=-1)
    2888         1455 :       CALL section_add_keyword(subsection, keyword)
    2889         1455 :       CALL keyword_release(keyword)
    2890         1455 :       CALL section_add_subsection(section, subsection)
    2891         1455 :       CALL section_release(subsection)
    2892              : 
    2893              :       CALL section_create(subsection, __LOCATION__, name="RNG_STATE", &
    2894              :                           description="Random number generator state for all processors", &
    2895         1455 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
    2896              :       CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
    2897              :                           description="Three real arrays of DIMENSION(3,2) times two RNG "// &
    2898              :                           "streams - 36 real values per processor", &
    2899              :                           repeats=.TRUE., usage="automatically filled, do not edit by hand", &
    2900         1455 :                           type_of_var=real_t, n_var=-1)
    2901         1455 :       CALL section_add_keyword(subsection, keyword)
    2902         1455 :       CALL keyword_release(keyword)
    2903         1455 :       CALL section_add_subsection(section, subsection)
    2904         1455 :       CALL section_release(subsection)
    2905              : 
    2906              :       CALL section_create(subsection, __LOCATION__, name="PRINT", &
    2907              :                           description="The section that controls the output of the helium code", &
    2908         1455 :                           n_keywords=16, n_subsections=0, repeats=.FALSE.)
    2909              : 
    2910              :       ! *************************************************************************
    2911              :       !> Printkeys for properties output
    2912              :       ! *************************************************************************
    2913         1455 :       NULLIFY (print_key)
    2914              : 
    2915              :       ! Properties printed at SILENT print level
    2916              :       !
    2917              : 
    2918              :       ! Properties printed at LOW print level
    2919              :       !
    2920              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "ENERGY", &
    2921              :                                        description="Controls the output of helium energies"// &
    2922              :                                        " (averaged over MC step)", &
    2923         1455 :                                        print_level=low_print_level, common_iter_levels=1)
    2924         1455 :       CALL section_add_subsection(subsection, print_key)
    2925         1455 :       CALL section_release(print_key)
    2926              :       !
    2927              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PROJECTED_AREA_2_AVG", &
    2928              :                                        description="Controls the output of the average projected area squared vector", &
    2929         1455 :                                        print_level=low_print_level, common_iter_levels=1)
    2930         1455 :       CALL section_add_subsection(subsection, print_key)
    2931         1455 :       CALL section_release(print_key)
    2932              :       !
    2933              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "WINDING_NUMBER_2_AVG", &
    2934              :                                        description="Controls the output of the average winding number vector squared", &
    2935         1455 :                                        print_level=low_print_level, common_iter_levels=1)
    2936         1455 :       CALL section_add_subsection(subsection, print_key)
    2937         1455 :       CALL section_release(print_key)
    2938              :       !
    2939              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "MOMENT_OF_INERTIA_AVG", &
    2940              :                                        description="Controls the output of the average moment of inertia vector", &
    2941         1455 :                                        print_level=low_print_level, common_iter_levels=1)
    2942         1455 :       CALL section_add_subsection(subsection, print_key)
    2943         1455 :       CALL section_release(print_key)
    2944              : 
    2945              :       ! Properties printed at MEDIUM print level
    2946              :       !
    2947              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RDF", &
    2948              :                                        description="Controls the output of helium radial distribution functions", &
    2949         1455 :                                        print_level=medium_print_level, common_iter_levels=1)
    2950         1455 :       CALL section_add_subsection(subsection, print_key)
    2951         1455 :       CALL section_release(print_key)
    2952              : 
    2953              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RHO", &
    2954              :                                        description="Controls the output of the helium density "// &
    2955              :                                        "(Gaussian cube file format)", &
    2956              :                                        each_iter_names=s2a("PINT"), each_iter_values=[100], &
    2957              :                                        print_level=medium_print_level, common_iter_levels=1, &
    2958         1455 :                                        add_last=add_last_numeric)
    2959              :       CALL keyword_create(keyword, __LOCATION__, name="BACKUP_COPIES", &
    2960              :                           description="Specifies the maximum number of backup copies.", &
    2961              :                           usage="BACKUP_COPIES {int}", &
    2962         1455 :                           default_i_val=1)
    2963         1455 :       CALL section_add_keyword(print_key, keyword)
    2964         1455 :       CALL keyword_release(keyword)
    2965         1455 :       CALL section_add_subsection(subsection, print_key)
    2966         1455 :       CALL section_release(print_key)
    2967              :       !
    2968              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PROJECTED_AREA", &
    2969              :                                        description="Controls the output of the projected area vector", &
    2970         1455 :                                        print_level=medium_print_level, common_iter_levels=1)
    2971         1455 :       CALL section_add_subsection(subsection, print_key)
    2972         1455 :       CALL section_release(print_key)
    2973              :       !
    2974              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "WINDING_NUMBER", &
    2975              :                                        description="Controls the output of the winding number vector", &
    2976         1455 :                                        print_level=medium_print_level, common_iter_levels=1)
    2977         1455 :       CALL section_add_subsection(subsection, print_key)
    2978         1455 :       CALL section_release(print_key)
    2979              :       !
    2980              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "MOMENT_OF_INERTIA", &
    2981              :                                        description="Controls the output of the moment of inertia vector", &
    2982         1455 :                                        print_level=medium_print_level, common_iter_levels=1)
    2983         1455 :       CALL section_add_subsection(subsection, print_key)
    2984         1455 :       CALL section_release(print_key)
    2985              :       !
    2986              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PLENGTH", &
    2987              :                                        description="Controls the output of the helium permutation length", &
    2988         1455 :                                        print_level=medium_print_level, common_iter_levels=1)
    2989         1455 :       CALL section_add_subsection(subsection, print_key)
    2990         1455 :       CALL section_release(print_key)
    2991              : 
    2992              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "ACTION", &
    2993              :                                        description="Controls the output of the total helium action", &
    2994         1455 :                                        print_level=medium_print_level, common_iter_levels=1)
    2995         1455 :       CALL section_add_subsection(subsection, print_key)
    2996         1455 :       CALL section_release(print_key)
    2997              : 
    2998              :       ! Properties printed at HIGH print level
    2999              :       !
    3000              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "COORDINATES", &
    3001              :                                        description="Controls the output of helium coordinates", &
    3002         1455 :                                        print_level=high_print_level, common_iter_levels=1)
    3003              :       CALL keyword_create(keyword, __LOCATION__, name="FORMAT", &
    3004              :                           description="Output file format for the coordinates", &
    3005              :                           usage="FORMAT (PDB|XYZ)", &
    3006              :                           default_i_val=fmt_id_pdb, &
    3007              :                           enum_c_vals=s2a("PDB", "XYZ"), &
    3008              :                           enum_i_vals=[fmt_id_pdb, fmt_id_xyz], &
    3009              :                           enum_desc=s2a("Bead coordinates and connectivity is written in PDB format", &
    3010         1455 :                                         "Only bead coordinates are written in XYZ format"))
    3011         1455 :       CALL section_add_keyword(print_key, keyword)
    3012         1455 :       CALL keyword_release(keyword)
    3013         1455 :       CALL section_add_subsection(subsection, print_key)
    3014         1455 :       CALL section_release(print_key)
    3015              :       !
    3016              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PERM", &
    3017              :                                        description="Controls the output of the helium permutation state", &
    3018         1455 :                                        print_level=high_print_level, common_iter_levels=1)
    3019              :       CALL keyword_create(keyword, __LOCATION__, name="FORMAT", &
    3020              :                           description="Output format for the permutation", &
    3021              :                           usage="FORMAT (CYCLE|PLAIN)", &
    3022              :                           default_i_val=perm_cycle, &
    3023              :                           enum_c_vals=s2a("CYCLE", "PLAIN"), &
    3024              :                           enum_i_vals=[perm_cycle, perm_plain], &
    3025              :                           enum_desc=s2a( &
    3026              :                           "Cycle notation with winding cycles enclosed"// &
    3027              :                           " in '[...]' and non-winding ones enclosed in '(...)'", &
    3028         1455 :                           "Plain permutation output, i.e. P(1) ... P(N)"))
    3029         1455 :       CALL section_add_keyword(print_key, keyword)
    3030         1455 :       CALL keyword_release(keyword)
    3031         1455 :       CALL section_add_subsection(subsection, print_key)
    3032         1455 :       CALL section_release(print_key)
    3033              : 
    3034              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "FORCES", &
    3035              :                                        description="Controls the output of the helium forces on the solute", &
    3036         1455 :                                        print_level=high_print_level, common_iter_levels=1)
    3037         1455 :       CALL section_add_subsection(subsection, print_key)
    3038         1455 :       CALL section_release(print_key)
    3039              : 
    3040              :       ! Properties printed at DEBUG print level
    3041              :       !
    3042              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "ACCEPTS", &
    3043              :                                        description="Controls the output of the helium acceptance data", &
    3044         1455 :                                        print_level=debug_print_level, common_iter_levels=1)
    3045         1455 :       CALL section_add_subsection(subsection, print_key)
    3046         1455 :       CALL section_release(print_key)
    3047              :       !
    3048              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "FORCES_INST", &
    3049              :                                        description="Controls the output of the instantaneous helium forces on the solute", &
    3050         1455 :                                        print_level=debug_print_level, common_iter_levels=1)
    3051         1455 :       CALL section_add_subsection(subsection, print_key)
    3052         1455 :       CALL section_release(print_key)
    3053              : 
    3054         1455 :       CALL section_add_subsection(section, subsection)
    3055         1455 :       CALL section_release(subsection)
    3056              : 
    3057         1455 :       RETURN
    3058              :    END SUBROUTINE create_helium_section
    3059              : 
    3060              : END MODULE input_cp2k_motion
        

Generated by: LCOV version 2.0-1