LCOV - code coverage report
Current view: top level - src/start - input_cp2k_motion.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:21ef868) Lines: 100.0 % 1165 1165
Test Date: 2026-08-14 07:04:57 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              :       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, fix_none, fix_x, fix_xy, &
      36              :       fix_xz, fix_y, fix_yz, fix_z, fmt_id_pdb, fmt_id_xyz, 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        10624 :    SUBROUTINE create_motion_section(section)
      90              :       TYPE(section_type), POINTER                        :: section
      91              : 
      92              :       TYPE(section_type), POINTER                        :: subsection
      93              : 
      94        10624 :       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        10624 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
      98              : 
      99        10624 :       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        10624 :                                  use_model_hessian=.TRUE.)
     105        10624 :       CALL section_add_subsection(section, subsection)
     106        10624 :       CALL section_release(subsection)
     107              : 
     108        10624 :       CALL create_cell_opt_section(subsection)
     109        10624 :       CALL section_add_subsection(section, subsection)
     110        10624 :       CALL section_release(subsection)
     111              : 
     112        10624 :       CALL create_shellcore_opt_section(subsection)
     113        10624 :       CALL section_add_subsection(section, subsection)
     114        10624 :       CALL section_release(subsection)
     115              : 
     116        10624 :       CALL create_md_section(subsection)
     117        10624 :       CALL section_add_subsection(section, subsection)
     118        10624 :       CALL section_release(subsection)
     119              : 
     120        10624 :       CALL create_driver_section(subsection)
     121        10624 :       CALL section_add_subsection(section, subsection)
     122        10624 :       CALL section_release(subsection)
     123              : 
     124        10624 :       CALL create_fe_section(subsection)
     125        10624 :       CALL section_add_subsection(section, subsection)
     126        10624 :       CALL section_release(subsection)
     127              : 
     128        10624 :       CALL create_constraint_section(subsection)
     129        10624 :       CALL section_add_subsection(section, subsection)
     130        10624 :       CALL section_release(subsection)
     131              : 
     132        10624 :       CALL create_fp_section(subsection)
     133        10624 :       CALL section_add_subsection(section, subsection)
     134        10624 :       CALL section_release(subsection)
     135              : 
     136        10624 :       CALL create_mc_section(subsection)
     137        10624 :       CALL section_add_subsection(section, subsection)
     138        10624 :       CALL section_release(subsection)
     139              : 
     140        10624 :       CALL create_TMC_section(subsection)
     141        10624 :       CALL section_add_subsection(section, subsection)
     142        10624 :       CALL section_release(subsection)
     143              : 
     144        10624 :       CALL create_pint_section(subsection)
     145        10624 :       CALL section_add_subsection(section, subsection)
     146        10624 :       CALL section_release(subsection)
     147              : 
     148        10624 :       CALL create_band_section(subsection)
     149        10624 :       CALL section_add_subsection(section, subsection)
     150        10624 :       CALL section_release(subsection)
     151              : 
     152        10624 :       CALL create_motion_print_section(subsection)
     153        10624 :       CALL section_add_subsection(section, subsection)
     154        10624 :       CALL section_release(subsection)
     155              : 
     156        10624 :    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        10624 :    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        10624 :       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        10624 :                           n_keywords=10, n_subsections=2, repeats=.FALSE.)
     173              : 
     174        10624 :       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        10624 :                           default_i_val=100)
     180        10624 :       CALL section_add_keyword(section, keyword)
     181        10624 :       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        10624 :                           default_i_val=1)
     187        10624 :       CALL section_add_keyword(section, keyword)
     188        10624 :       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        10624 :                           default_i_val=4)
     194        10624 :       CALL section_add_keyword(section, keyword)
     195        10624 :       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        10624 :                           default_i_val=16)
     201        10624 :       CALL section_add_keyword(section, keyword)
     202        10624 :       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        10624 :                           default_l_val=.FALSE.)
     208        10624 :       CALL section_add_keyword(section, keyword)
     209        10624 :       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        10624 :                           default_l_val=.FALSE.)
     215        10624 :       CALL section_add_keyword(section, keyword)
     216        10624 :       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        10624 :                           default_l_val=.FALSE.)
     222        10624 :       CALL section_add_keyword(section, keyword)
     223        10624 :       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        10624 :                           default_r_val=1.0E0_dp)
     229        10624 :       CALL section_add_keyword(section, keyword)
     230        10624 :       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        10624 :                           default_l_val=.FALSE.)
     236        10624 :       CALL section_add_keyword(section, keyword)
     237        10624 :       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        10624 :          default_i_val=1000)
     244        10624 :       CALL section_add_keyword(section, keyword)
     245        10624 :       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        10624 :                           default_i_val=do_mc_traditional)
     253        10624 :       CALL section_add_keyword(section, keyword)
     254        10624 :       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        10624 :                           default_lc_val="")
     260        10624 :       CALL section_add_keyword(section, keyword)
     261        10624 :       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        10624 :                           default_lc_val="")
     267        10624 :       CALL section_add_keyword(section, keyword)
     268        10624 :       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        10624 :                           default_lc_val="")
     274        10624 :       CALL section_add_keyword(section, keyword)
     275        10624 :       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        10624 :                           default_lc_val="")
     281        10624 :       CALL section_add_keyword(section, keyword)
     282        10624 :       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        10624 :                           default_lc_val="")
     288        10624 :       CALL section_add_keyword(section, keyword)
     289        10624 :       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        10624 :                           default_lc_val="")
     295        10624 :       CALL section_add_keyword(section, keyword)
     296        10624 :       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        10624 :                           default_lc_val="")
     302        10624 :       CALL section_add_keyword(section, keyword)
     303        10624 :       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        10624 :                           default_lc_val="")
     309        10624 :       CALL section_add_keyword(section, keyword)
     310        10624 :       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        10624 :                           default_lc_val="")
     316        10624 :       CALL section_add_keyword(section, keyword)
     317        10624 :       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        10624 :                           type_of_var=real_t)
     323        10624 :       CALL section_add_keyword(section, keyword)
     324        10624 :       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        10624 :                           type_of_var=real_t)
     330        10624 :       CALL section_add_keyword(section, keyword)
     331        10624 :       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        10624 :          n_var=-1, type_of_var=real_t)
     338        10624 :       CALL section_add_keyword(section, keyword)
     339        10624 :       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        10624 :                           default_r_val=1.0E0_dp)
     345        10624 :       CALL section_add_keyword(section, keyword)
     346        10624 :       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        10624 :                           n_var=-1, type_of_var=real_t)
     352        10624 :       CALL section_add_keyword(section, keyword)
     353        10624 :       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        10624 :                           default_i_val=0)
     359        10624 :       CALL section_add_keyword(section, keyword)
     360        10624 :       CALL keyword_release(keyword)
     361              : 
     362        10624 :       CALL create_avbmc_section(subsection)
     363        10624 :       CALL section_add_subsection(section, subsection)
     364        10624 :       CALL section_release(subsection)
     365              : 
     366        10624 :       CALL create_move_prob_section(subsection)
     367        10624 :       CALL section_add_subsection(section, subsection)
     368        10624 :       CALL section_release(subsection)
     369              : 
     370        10624 :       CALL create_update_section(subsection)
     371        10624 :       CALL section_add_subsection(section, subsection)
     372        10624 :       CALL section_release(subsection)
     373              : 
     374        10624 :       CALL create_max_disp_section(subsection)
     375        10624 :       CALL section_add_subsection(section, subsection)
     376        10624 :       CALL section_release(subsection)
     377              : 
     378        10624 :    END SUBROUTINE create_mc_section
     379              : 
     380              : ! **************************************************************************************************
     381              : !> \brief ...
     382              : !> \param section will contain the AVBMC parameters for MC
     383              : !> \author matt
     384              : ! **************************************************************************************************
     385        10624 :    SUBROUTINE create_avbmc_section(section)
     386              :       TYPE(section_type), POINTER                        :: section
     387              : 
     388              :       TYPE(keyword_type), POINTER                        :: keyword
     389              : 
     390        10624 :       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        10624 :                           n_keywords=5, n_subsections=0, repeats=.FALSE.)
     397              : 
     398        10624 :       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        10624 :          n_var=-1, type_of_var=real_t)
     405        10624 :       CALL section_add_keyword(section, keyword)
     406        10624 :       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        10624 :                           n_var=-1, type_of_var=integer_t)
     412        10624 :       CALL section_add_keyword(section, keyword)
     413        10624 :       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        10624 :                           n_var=-1, type_of_var=real_t)
     419        10624 :       CALL section_add_keyword(section, keyword)
     420        10624 :       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        10624 :                           n_var=-1, type_of_var=real_t)
     426        10624 :       CALL section_add_keyword(section, keyword)
     427        10624 :       CALL keyword_release(keyword)
     428              : 
     429        10624 :    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        10624 :    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        10624 :       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        10624 :                           n_keywords=5, n_subsections=2, repeats=.FALSE.)
     448              : 
     449        10624 :       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        10624 :                           type_of_var=real_t, default_r_val=0.0E0_dp)
     455        10624 :       CALL section_add_keyword(section, keyword)
     456        10624 :       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        10624 :                           type_of_var=real_t)
     462        10624 :       CALL section_add_keyword(section, keyword)
     463        10624 :       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        10624 :                           type_of_var=real_t, default_r_val=0.0E0_dp)
     469        10624 :       CALL section_add_keyword(section, keyword)
     470        10624 :       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        10624 :                           default_r_val=0.0E0_dp)
     476        10624 :       CALL section_add_keyword(section, keyword)
     477        10624 :       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        10624 :                           type_of_var=real_t)
     483        10624 :       CALL section_add_keyword(section, keyword)
     484        10624 :       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        10624 :                           type_of_var=real_t, default_r_val=0.0E0_dp)
     490        10624 :       CALL section_add_keyword(section, keyword)
     491        10624 :       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        10624 :                           type_of_var=real_t, default_r_val=0.0E0_dp)
     497        10624 :       CALL section_add_keyword(section, keyword)
     498        10624 :       CALL keyword_release(keyword)
     499              : 
     500        10624 :       CALL create_mol_prob_section(subsection)
     501        10624 :       CALL section_add_subsection(section, subsection)
     502        10624 :       CALL section_release(subsection)
     503              : 
     504        10624 :       CALL create_box_prob_section(subsection)
     505        10624 :       CALL section_add_subsection(section, subsection)
     506        10624 :       CALL section_release(subsection)
     507              : 
     508        10624 :    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        10624 :    SUBROUTINE create_mol_prob_section(section)
     517              :       TYPE(section_type), POINTER                        :: section
     518              : 
     519              :       TYPE(keyword_type), POINTER                        :: keyword
     520              : 
     521        10624 :       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        10624 :                           n_keywords=5, n_subsections=0, repeats=.FALSE.)
     527              : 
     528        10624 :       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        10624 :                           n_var=-1, type_of_var=real_t)
     534        10624 :       CALL section_add_keyword(section, keyword)
     535        10624 :       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        10624 :                           n_var=-1, type_of_var=real_t)
     541        10624 :       CALL section_add_keyword(section, keyword)
     542        10624 :       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        10624 :                           n_var=-1, type_of_var=real_t)
     548        10624 :       CALL section_add_keyword(section, keyword)
     549        10624 :       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        10624 :                           n_var=-1, type_of_var=real_t)
     555        10624 :       CALL section_add_keyword(section, keyword)
     556        10624 :       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        10624 :                           n_var=-1, type_of_var=real_t)
     562        10624 :       CALL section_add_keyword(section, keyword)
     563        10624 :       CALL keyword_release(keyword)
     564              : 
     565        10624 :    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        10624 :    SUBROUTINE create_box_prob_section(section)
     574              :       TYPE(section_type), POINTER                        :: section
     575              : 
     576              :       TYPE(keyword_type), POINTER                        :: keyword
     577              : 
     578        10624 :       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        10624 :                           n_keywords=2, n_subsections=0, repeats=.FALSE.)
     584              : 
     585        10624 :       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        10624 :                           type_of_var=real_t, default_r_val=1.0E0_dp)
     591        10624 :       CALL section_add_keyword(section, keyword)
     592        10624 :       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        10624 :                           type_of_var=real_t, default_r_val=1.0E0_dp)
     598        10624 :       CALL section_add_keyword(section, keyword)
     599        10624 :       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        10624 :                           type_of_var=real_t, default_r_val=1.0E0_dp)
     605        10624 :       CALL section_add_keyword(section, keyword)
     606        10624 :       CALL keyword_release(keyword)
     607              : 
     608        10624 :    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        10624 :    SUBROUTINE create_update_section(section)
     617              :       TYPE(section_type), POINTER                        :: section
     618              : 
     619              :       TYPE(keyword_type), POINTER                        :: keyword
     620              : 
     621        10624 :       CPASSERT(.NOT. ASSOCIATED(section))
     622              : 
     623              :       CALL section_create(section, __LOCATION__, name="MOVE_UPDATES", &
     624              :                           description="Frequency for updating move maximum displacements.", &
     625        10624 :                           n_keywords=2, n_subsections=0, repeats=.FALSE.)
     626              : 
     627        10624 :       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        10624 :                           default_i_val=10000)
     633        10624 :       CALL section_add_keyword(section, keyword)
     634        10624 :       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        10624 :                           default_i_val=10000)
     641        10624 :       CALL section_add_keyword(section, keyword)
     642        10624 :       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        10624 :                           default_i_val=10000)
     648        10624 :       CALL section_add_keyword(section, keyword)
     649        10624 :       CALL keyword_release(keyword)
     650              : 
     651        10624 :    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        10624 :    SUBROUTINE create_max_disp_section(section)
     659              :       TYPE(section_type), POINTER                        :: section
     660              : 
     661              :       TYPE(section_type), POINTER                        :: subsection
     662              : 
     663        10624 :       CPASSERT(.NOT. ASSOCIATED(section))
     664              : 
     665              :       CALL section_create(section, __LOCATION__, name="max_displacements", &
     666              :                           description="The maximum displacements for all attempted moves.", &
     667        10624 :                           n_keywords=1, n_subsections=2, repeats=.FALSE.)
     668              : 
     669        10624 :       NULLIFY (subsection)
     670              : 
     671        10624 :       CALL create_mol_disp_section(subsection)
     672        10624 :       CALL section_add_subsection(section, subsection)
     673        10624 :       CALL section_release(subsection)
     674              : 
     675        10624 :       CALL create_box_disp_section(subsection)
     676        10624 :       CALL section_add_subsection(section, subsection)
     677        10624 :       CALL section_release(subsection)
     678              : 
     679        10624 :    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        10624 :    SUBROUTINE create_mol_disp_section(section)
     688              :       TYPE(section_type), POINTER                        :: section
     689              : 
     690              :       TYPE(keyword_type), POINTER                        :: keyword
     691              : 
     692        10624 :       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        10624 :                           n_keywords=5, n_subsections=0, repeats=.FALSE.)
     698              : 
     699        10624 :       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        10624 :                           n_var=-1, type_of_var=real_t)
     705        10624 :       CALL section_add_keyword(section, keyword)
     706        10624 :       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        10624 :                           n_var=-1, type_of_var=real_t)
     712        10624 :       CALL section_add_keyword(section, keyword)
     713        10624 :       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        10624 :                           n_var=-1, type_of_var=real_t)
     719        10624 :       CALL section_add_keyword(section, keyword)
     720        10624 :       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        10624 :                           n_var=-1, type_of_var=real_t)
     726        10624 :       CALL section_add_keyword(section, keyword)
     727        10624 :       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        10624 :                           n_var=-1, type_of_var=real_t)
     733        10624 :       CALL section_add_keyword(section, keyword)
     734        10624 :       CALL keyword_release(keyword)
     735              : 
     736        10624 :    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        10624 :    SUBROUTINE create_box_disp_section(section)
     745              :       TYPE(section_type), POINTER                        :: section
     746              : 
     747              :       TYPE(keyword_type), POINTER                        :: keyword
     748              : 
     749        10624 :       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        10624 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     755              : 
     756        10624 :       NULLIFY (keyword)
     757              : 
     758              :       CALL keyword_create(keyword, __LOCATION__, name="RMVOLUME", &
     759              :                           description="Maximum volume displacement, in angstrom**3.", &
     760              :                           usage="RMVOLUME {real}", &
     761        10624 :                           type_of_var=real_t)
     762        10624 :       CALL section_add_keyword(section, keyword)
     763        10624 :       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        10624 :                           default_r_val=1.0E0_dp)
     769        10624 :       CALL section_add_keyword(section, keyword)
     770        10624 :       CALL keyword_release(keyword)
     771              : 
     772        10624 :    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        42496 :    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        42496 :       CPASSERT(.NOT. ASSOCIATED(section))
     795              :       CALL section_create(section, location=location, name=label, description=description, &
     796        42496 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
     797              : 
     798        42496 :       NULLIFY (keyword)
     799        42496 :       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        10624 :                              default_i_val=default_minimization_method_id)
     808        10624 :          CALL section_add_keyword(section, keyword)
     809        10624 :          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       127488 :          default_i_val=default_bfgs_method_id)
     826        42496 :       CALL section_add_keyword(section, keyword)
     827        42496 :       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        42496 :                           default_i_val=200)
     834        42496 :       CALL section_add_keyword(section, keyword)
     835        42496 :       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        42496 :                           default_r_val=0.0030_dp, unit_str="bohr")
     842        42496 :       CALL section_add_keyword(section, keyword)
     843        42496 :       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        42496 :                           default_r_val=0.00045_dp, unit_str="hartree/bohr")
     849        42496 :       CALL section_add_keyword(section, keyword)
     850        42496 :       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        42496 :                           default_r_val=0.0015_dp)
     857        42496 :       CALL section_add_keyword(section, keyword)
     858        42496 :       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        42496 :                           default_r_val=0.00030_dp)
     864        42496 :       CALL section_add_keyword(section, keyword)
     865        42496 :       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        42496 :                           usage="step_start_val <integer>", default_i_val=0)
     870        42496 :       CALL section_add_keyword(section, keyword)
     871        42496 :       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        42496 :          default_l_val=.FALSE., lone_keyword_l_val=.TRUE., repeats=.FALSE.)
     883        42496 :       CALL section_add_keyword(section, keyword)
     884        42496 :       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        42496 :          default_l_val=.FALSE., lone_keyword_l_val=.TRUE., repeats=.FALSE.)
     894        42496 :       CALL section_add_keyword(section, keyword)
     895        42496 :       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        42496 :          default_r_val=1.e-4_dp, repeats=.FALSE.)
     904        42496 :       CALL section_add_keyword(section, keyword)
     905        42496 :       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        42496 :          type_of_var=real_t, default_r_vals=[0.0_dp, 0.0_dp, 0.0_dp])
     916        42496 :       CALL section_add_keyword(section, keyword)
     917        42496 :       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        42496 :          repeats=.TRUE., usage="SYMM_EXCLUDE_RANGE {Int} {Int}", type_of_var=integer_t, n_var=2)
     926        42496 :       CALL section_add_keyword(section, keyword)
     927        42496 :       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        42496 :          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     933        42496 :       CALL section_add_keyword(section, keyword)
     934        42496 :       CALL keyword_release(keyword)
     935              : 
     936        42496 :       CALL create_lbfgs_section(subsection)
     937        42496 :       CALL section_add_subsection(section, subsection)
     938        42496 :       CALL section_release(subsection)
     939              : 
     940        42496 :       CALL create_cg_section(subsection)
     941        42496 :       CALL section_add_subsection(section, subsection)
     942        42496 :       CALL section_release(subsection)
     943              : 
     944        42496 :       CALL create_bfgs_section(subsection, use_model_hessian)
     945        42496 :       CALL section_add_subsection(section, subsection)
     946        42496 :       CALL section_release(subsection)
     947              : 
     948        42496 :       IF (.NOT. just_optimizers) THEN
     949              :          ! Transition states section
     950        10624 :          CALL create_ts_section(subsection)
     951        10624 :          CALL section_add_subsection(section, subsection)
     952        10624 :          CALL section_release(subsection)
     953              : 
     954              :          ! Create the PRINT subsection
     955        10624 :          NULLIFY (subsection)
     956              :          CALL section_create(subsection, __LOCATION__, name="PRINT", &
     957              :                              description="Controls the printing properties during a geometry optimization run", &
     958        10624 :                              n_keywords=0, n_subsections=1, repeats=.TRUE.)
     959        10624 :          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        10624 :             print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
     964        10624 :          CALL section_add_subsection(subsection, print_key)
     965        10624 :          CALL section_release(print_key)
     966        10624 :          CALL section_add_subsection(section, subsection)
     967        10624 :          CALL section_release(subsection)
     968              :       END IF
     969              : 
     970        42496 :    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        10624 :    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        10624 :          use_model_hessian=.FALSE.)
     990              : 
     991        10624 :       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        10624 :                           n_keywords=0, n_subsections=1, repeats=.TRUE.)
     998        10624 :       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        10624 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
    1002        10624 :       CALL section_add_subsection(subsection, print_key)
    1003        10624 :       CALL section_release(print_key)
    1004        10624 :       CALL section_add_subsection(section, subsection)
    1005        10624 :       CALL section_release(subsection)
    1006              : 
    1007        10624 :    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        10624 :    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        10624 :                                  just_optimizers=.TRUE., use_model_hessian=.FALSE.)
    1031              : 
    1032        10624 :       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        10624 :          enum_i_vals=[1, 2, 3], default_i_val=1)
    1039        10624 :       CALL section_add_keyword(section, keyword)
    1040        10624 :       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       106240 :                          0.0_dp, 0.0_dp, cp_unit_to_cp2k(100.0_dp, "bar")], n_var=-1)
    1050        10624 :       CALL section_add_keyword(section, keyword)
    1051        10624 :       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        10624 :                           usage="KEEP_VOLUME TRUE", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1059        10624 :       CALL section_add_keyword(section, keyword)
    1060        10624 :       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        10624 :                           usage="KEEP_ANGLES TRUE", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1070        10624 :       CALL section_add_keyword(section, keyword)
    1071        10624 :       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        10624 :                           usage="KEEP_SYMMETRY TRUE", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1081        10624 :       CALL section_add_keyword(section, keyword)
    1082        10624 :       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              :          usage="CONSTRAINT (none|x|y|z|xy|xz|yz)", &
    1088              :          enum_desc=s2a("Fix nothing", &
    1089              :                        "Fix only x component", &
    1090              :                        "Fix only y component", &
    1091              :                        "Fix only z component", &
    1092              :                        "Fix x and y component", &
    1093              :                        "Fix x and z component", &
    1094              :                        "Fix y and z component"), &
    1095              :          enum_c_vals=s2a("NONE", "X", "Y", "Z", "XY", "XZ", "YZ"), &
    1096              :          enum_i_vals=[fix_none, fix_x, fix_y, fix_z, fix_xy, fix_xz, fix_yz], &
    1097        10624 :          default_i_val=fix_none)
    1098        10624 :       CALL section_add_keyword(section, keyword)
    1099        10624 :       CALL keyword_release(keyword)
    1100              : 
    1101              :       CALL keyword_create(keyword, __LOCATION__, name="PRESSURE_TOLERANCE", &
    1102              :                           description="Specifies the Pressure tolerance (compared to the external pressure) to achieve "// &
    1103              :                           "during the cell optimization.", &
    1104              :                           usage="PRESSURE_TOLERANCE {REAL}", unit_str="bar", &
    1105        10624 :                           default_r_val=cp_unit_to_cp2k(100.0_dp, "bar"))
    1106        10624 :       CALL section_add_keyword(section, keyword)
    1107        10624 :       CALL keyword_release(keyword)
    1108              : 
    1109              :       ! Create the PRINT subsection
    1110        10624 :       NULLIFY (subsection)
    1111              :       CALL section_create(subsection, __LOCATION__, name="PRINT", &
    1112              :                           description="Controls the printing properties during a geometry optimization run", &
    1113        10624 :                           n_keywords=0, n_subsections=1, repeats=.TRUE.)
    1114        10624 :       NULLIFY (print_key)
    1115              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "program_run_info", &
    1116              :                                        description="Controls the printing of basic information during the Geometry Optimization", &
    1117        10624 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
    1118        10624 :       CALL section_add_subsection(subsection, print_key)
    1119        10624 :       CALL section_release(print_key)
    1120              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "cell", &
    1121              :                               description="Controls the printing of the cell eveytime a calculation using a new cell is started.", &
    1122              :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__", &
    1123        10624 :                                        unit_str="angstrom")
    1124        10624 :       CALL section_add_subsection(subsection, print_key)
    1125        10624 :       CALL section_release(print_key)
    1126        10624 :       CALL section_add_subsection(section, subsection)
    1127        10624 :       CALL section_release(subsection)
    1128              : 
    1129        10624 :    END SUBROUTINE create_cell_opt_section
    1130              : 
    1131              : ! **************************************************************************************************
    1132              : !> \brief creates the section for tuning transition states search
    1133              : !> \param section the section to be created
    1134              : !> \author Teodoro Laino [tlaino] - University of Zurich - 01.2008
    1135              : ! **************************************************************************************************
    1136        10624 :    SUBROUTINE create_ts_section(section)
    1137              :       TYPE(section_type), POINTER                        :: section
    1138              : 
    1139              :       TYPE(keyword_type), POINTER                        :: keyword
    1140              :       TYPE(section_type), POINTER                        :: print_key, subsection, subsection2, &
    1141              :                                                             subsection3
    1142              : 
    1143              : ! Create the Transition State subsection
    1144              : 
    1145        10624 :       NULLIFY (section, keyword, subsection, subsection2)
    1146              :       CALL section_create(section, __LOCATION__, name="TRANSITION_STATE", &
    1147              :                           description="Specifies parameters to perform a transition state search", &
    1148        10624 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    1149              : 
    1150              :       CALL keyword_create(keyword, __LOCATION__, name="METHOD", &
    1151              :                           description="Specify which kind of method to use for locating transition states", &
    1152              :                           citations=[Henkelman1999], &
    1153              :                           usage="METHOD (DIMER)", &
    1154              :                           enum_c_vals=s2a("DIMER"), &
    1155              :                           enum_desc=s2a("Uses the dimer method to optimize transition states."), &
    1156              :                           enum_i_vals=[default_dimer_method_id], &
    1157        21248 :                           default_i_val=default_dimer_method_id)
    1158        10624 :       CALL section_add_keyword(section, keyword)
    1159        10624 :       CALL keyword_release(keyword)
    1160              : 
    1161              :       CALL section_create(subsection, __LOCATION__, name="DIMER", &
    1162              :                           description="Specifies parameters for Dimer Method", &
    1163        10624 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    1164              : 
    1165              :       CALL keyword_create(keyword, __LOCATION__, name="DR", &
    1166              :                           description="This keyword sets the value for the DR parameter.", &
    1167              :                           usage="DR {real}", unit_str='angstrom', &
    1168        10624 :                           default_r_val=cp_unit_to_cp2k(0.01_dp, "angstrom"))
    1169        10624 :       CALL section_add_keyword(subsection, keyword)
    1170        10624 :       CALL keyword_release(keyword)
    1171              : 
    1172              :       CALL keyword_create(keyword, __LOCATION__, name="INITIALIZATION_METHOD", &
    1173              :                           description="Specify the initialization method of the dimer vector, "// &
    1174              :                           "which is crucial for converging to the desired transition state. "// &
    1175              :                           "If the DIMER_VECTOR section is defined explicitly, it will always "// &
    1176              :                           "be parsed directly (e.g. in restart files); INITIALIZATION_METHOD "// &
    1177              :                           "is only effective if the DIMER_VECTOR section is not explicit.", &
    1178              :                           usage="INITIALIZATION_METHOD (RANDOM|MOLDEN)", &
    1179              :                           enum_desc=s2a("Generate the initial dimer vector randomly. This is "// &
    1180              :                                         "the default for backwards compatibility; in practice "// &
    1181              :                                         "it may distort the structure and slow down convergence.", &
    1182              :                                         "Generate the initial dimer vector from one or more "// &
    1183              :                                         "vibrational normal modes as read from a MOLDEN file "// &
    1184              :                                         "produced by `VIBRATIONAL_ANALYSIS%PRINT%MOLDEN_VIB` "// &
    1185              :                                         "in a vibrational analysis task. Requires setting up "// &
    1186              :                                         "keywords `VIB_MOLDEN_NAME`, `VIB_INDEX` and `VIB_WEIGHT`."), &
    1187              :                           enum_c_vals=s2a("RANDOM", "MOLDEN"), &
    1188              :                           enum_i_vals=[dimer_init_random, dimer_init_molden], &
    1189        10624 :                           default_i_val=dimer_init_random)
    1190        10624 :       CALL section_add_keyword(subsection, keyword)
    1191        10624 :       CALL keyword_release(keyword)
    1192              : 
    1193              :       CALL keyword_create(keyword, __LOCATION__, name="VIB_MOLDEN_NAME", &
    1194              :                           description="The external molden file containing vibrational "// &
    1195              :                           "normal modes for `INITIALIZATION_METHOD MOLDEN`.", &
    1196        10624 :                           usage="VIB_MOLDEN_NAME <CHARACTER>", type_of_var=lchar_t)
    1197        10624 :       CALL section_add_keyword(subsection, keyword)
    1198        10624 :       CALL keyword_release(keyword)
    1199              : 
    1200              :       CALL keyword_create(keyword, __LOCATION__, name="VIB_INDEX", &
    1201              :                           description="The index of one or more vibrational normal modes "// &
    1202              :                           "from the file whose linear combination will form the initial "// &
    1203              :                           "dimer vector.", &
    1204              :                           usage="VIB_INDEX {integer} {integer} .. {integer}", repeats=.TRUE., &
    1205        10624 :                           n_var=-1, default_i_vals=[1], type_of_var=integer_t)
    1206        10624 :       CALL section_add_keyword(subsection, keyword)
    1207        10624 :       CALL keyword_release(keyword)
    1208              : 
    1209              :       CALL keyword_create(keyword, __LOCATION__, name="VIB_WEIGHT", &
    1210              :                           description="The weight of one or more vibrational normal modes "// &
    1211              :                           "from the file whose linear combination will form the initial "// &
    1212              :                           "dimer vector.", &
    1213              :                           usage="VIB_WEIGHT {real} {real} .. {real}", repeats=.TRUE., &
    1214        10624 :                           n_var=-1, default_r_vals=[1.0_dp], type_of_var=real_t)
    1215        10624 :       CALL section_add_keyword(subsection, keyword)
    1216        10624 :       CALL keyword_release(keyword)
    1217              : 
    1218              :       CALL keyword_create(keyword, __LOCATION__, name="INTERPOLATE_GRADIENT", &
    1219              :                           description="This keyword controls the interpolation of the gradient whenever possible"// &
    1220              :                           " during the optimization of the Dimer. The use of this keywords saves 1 evaluation"// &
    1221              :                           " of energy/forces.", usage="INTERPOLATE_GRADIENT {logical}", default_l_val=.TRUE., &
    1222        10624 :                           lone_keyword_l_val=.TRUE.)
    1223        10624 :       CALL section_add_keyword(subsection, keyword)
    1224        10624 :       CALL keyword_release(keyword)
    1225              : 
    1226              :       CALL keyword_create(keyword, __LOCATION__, name="ANGLE_TOLERANCE", &
    1227              :                           description="This keyword sets the value of the tolerance angle for the line search"// &
    1228              :                           " performed to optimize the orientation of the dimer.", &
    1229              :                           usage="ANGLE_TOLERANCE {real}", unit_str='rad', &
    1230        10624 :                           default_r_val=cp_unit_to_cp2k(5.0_dp, "deg"))
    1231        10624 :       CALL section_add_keyword(subsection, keyword)
    1232        10624 :       CALL keyword_release(keyword)
    1233              : 
    1234              :       CALL keyword_create(keyword, __LOCATION__, name="K-DIMER", &
    1235              :                           description="This keyword activates the constrained k-dimer translation"// &
    1236              :                           " J. Chem. Phys. 141, 164111 (2014).", &
    1237              :                           citations=[Henkelman2014], &
    1238              :                           usage="K-DIMER {logica}", &
    1239              :                           default_l_val=.FALSE., &
    1240        21248 :                           lone_keyword_l_val=.FALSE.)
    1241        10624 :       CALL section_add_keyword(subsection, keyword)
    1242        10624 :       CALL keyword_release(keyword)
    1243              : 
    1244              :       CALL keyword_create(keyword, __LOCATION__, name="BETA", &
    1245              :                           description="Exponential factor for the switching function used in K-DIMER", &
    1246              :                           usage="BETA {real}", &
    1247              :                           default_r_val=5.0_dp, &
    1248        10624 :                           lone_keyword_r_val=5.0_dp)
    1249        10624 :       CALL section_add_keyword(subsection, keyword)
    1250        10624 :       CALL keyword_release(keyword)
    1251              : 
    1252              :       CALL create_geoopt_section( &
    1253              :          subsection2, __LOCATION__, label="ROT_OPT", &
    1254              :          description="This section sets the environment for the optimization of the rotation of the Dimer.", &
    1255              :          just_optimizers=.TRUE., &
    1256        10624 :          use_model_hessian=.FALSE.)
    1257        10624 :       NULLIFY (subsection3)
    1258              :       CALL section_create(subsection3, __LOCATION__, name="PRINT", &
    1259              :                           description="Controls the printing properties during the dimer rotation optimization run", &
    1260        10624 :                           n_keywords=0, n_subsections=1, repeats=.TRUE.)
    1261        10624 :       NULLIFY (print_key)
    1262              : 
    1263              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PROGRAM_RUN_INFO", &
    1264              :                                        description="Controls the printing of basic information during the Geometry Optimization", &
    1265        10624 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
    1266        10624 :       CALL section_add_subsection(subsection3, print_key)
    1267        10624 :       CALL section_release(print_key)
    1268              : 
    1269              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "ROTATIONAL_INFO", &
    1270              :                                        description="Controls the printing basic info during the cleaning of the "// &
    1271              :                                        "rotational degrees of freedom.", print_level=low_print_level, &
    1272        10624 :                                        add_last=add_last_numeric, filename="__STD_OUT__")
    1273              :       CALL keyword_create(keyword, __LOCATION__, name="COORDINATES", &
    1274              :                           description="Prints atomic coordinates after rotation", &
    1275        10624 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1276        10624 :       CALL section_add_keyword(print_key, keyword)
    1277        10624 :       CALL keyword_release(keyword)
    1278        10624 :       CALL section_add_subsection(subsection3, print_key)
    1279        10624 :       CALL section_release(print_key)
    1280              : 
    1281        10624 :       CALL section_add_subsection(subsection2, subsection3)
    1282        10624 :       CALL section_release(subsection3)
    1283        10624 :       CALL section_add_subsection(subsection, subsection2)
    1284        10624 :       CALL section_release(subsection2)
    1285              : 
    1286              :       CALL section_create(subsection2, __LOCATION__, name="DIMER_VECTOR", &
    1287              :                           description="Specifies the initial dimer vector. This "// &
    1288              :                           "section overrides INITIALIZATION_METHOD, and will be "// &
    1289              :                           "updated on each step for producing the restart files.", &
    1290        10624 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    1291              :       CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
    1292              :                           description="Specify on each line the components of the dimer vector.", repeats=.TRUE., &
    1293        10624 :                           usage="{Real} {Real} {Real}", type_of_var=real_t, n_var=-1)
    1294        10624 :       CALL section_add_keyword(subsection2, keyword)
    1295        10624 :       CALL keyword_release(keyword)
    1296        10624 :       CALL section_add_subsection(subsection, subsection2)
    1297        10624 :       CALL section_release(subsection2)
    1298              : 
    1299        10624 :       CALL section_add_subsection(section, subsection)
    1300        10624 :       CALL section_release(subsection)
    1301              : 
    1302        10624 :    END SUBROUTINE create_ts_section
    1303              : 
    1304              : ! **************************************************************************************************
    1305              : !> \brief creates the BFGS section
    1306              : !> \param section the section to be created
    1307              : !> \param use_model_hessian ...
    1308              : !> \author Teodoro Laino [tlaino] - University of Zurich - 01.2008
    1309              : ! **************************************************************************************************
    1310        42496 :    SUBROUTINE create_bfgs_section(section, use_model_hessian)
    1311              :       TYPE(section_type), POINTER                        :: section
    1312              :       LOGICAL, INTENT(IN)                                :: use_model_hessian
    1313              : 
    1314              :       TYPE(keyword_type), POINTER                        :: keyword
    1315              :       TYPE(section_type), POINTER                        :: print_key
    1316              : 
    1317              : ! create the BFGS subsection
    1318              : 
    1319        42496 :       NULLIFY (section, keyword, print_key)
    1320              :       CALL section_create(section, __LOCATION__, name="BFGS", &
    1321              :                           description="Provides parameters to tune the BFGS optimization", &
    1322        42496 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    1323              : 
    1324              :       CALL keyword_create(keyword, __LOCATION__, name="TRUST_RADIUS", &
    1325              :                           description="Trust radius used in BFGS. Previously set to 0.1. "// &
    1326              :                           "Large values can lead to instabilities", &
    1327              :                           usage="TRUST_RADIUS {real}", unit_str='angstrom', &
    1328        42496 :                           default_r_val=cp_unit_to_cp2k(0.25_dp, "angstrom"))
    1329        42496 :       CALL section_add_keyword(section, keyword)
    1330        42496 :       CALL keyword_release(keyword)
    1331              : 
    1332              :       CALL keyword_create(keyword, __LOCATION__, name="USE_MODEL_HESSIAN", &
    1333              :                           description="Uses a model Hessian as initial guess instead of a unit matrix."// &
    1334              :                           " Should lead in general to improved convergence might be switched off for exotic cases", &
    1335              :                           usage="USE_MODEL_HESSIAN", &
    1336              :                           citations=[Lindh1995], &
    1337        84992 :                           default_l_val=use_model_hessian, lone_keyword_l_val=.TRUE.)
    1338        42496 :       CALL section_add_keyword(section, keyword)
    1339        42496 :       CALL keyword_release(keyword)
    1340              : 
    1341              :       CALL keyword_create(keyword, __LOCATION__, name="USE_RAT_FUN_OPT", &
    1342              :                           description="Includes a rational function optimization to determine the step."// &
    1343              :                           " Previously default but did not improve convergence in many cases", &
    1344              :                           usage="USE_RAT_FUN_OPT", &
    1345        42496 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1346        42496 :       CALL section_add_keyword(section, keyword)
    1347        42496 :       CALL keyword_release(keyword)
    1348              : 
    1349              :       CALL keyword_create(keyword, __LOCATION__, name="RESTART_HESSIAN", &
    1350              :                           description="Controls the reading of the initial Hessian from file.", &
    1351              :                           usage="RESTART_HESSIAN", &
    1352        42496 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1353        42496 :       CALL section_add_keyword(section, keyword)
    1354        42496 :       CALL keyword_release(keyword)
    1355              : 
    1356              :       CALL keyword_create(keyword, __LOCATION__, name="RESTART_FILE_NAME", &
    1357              :                           description="Specifies the name of the file used to read the initial Hessian.", &
    1358              :                           usage="RESTART_FILE_NAME {filename}", &
    1359        42496 :                           default_lc_val="")
    1360        42496 :       CALL section_add_keyword(section, keyword)
    1361        42496 :       CALL keyword_release(keyword)
    1362              : 
    1363              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RESTART", &
    1364              :                                        description="Controls the printing of Hessian Restart file", &
    1365              :                                        print_level=low_print_level, add_last=add_last_numeric, filename="BFGS", &
    1366        42496 :                                        common_iter_levels=2)
    1367        42496 :       CALL section_add_subsection(section, print_key)
    1368        42496 :       CALL section_release(print_key)
    1369              : 
    1370        42496 :    END SUBROUTINE create_bfgs_section
    1371              : 
    1372              : ! **************************************************************************************************
    1373              : !> \brief creates the CG section
    1374              : !> \param section the section to be created
    1375              : !> \author Teodoro Laino [tlaino] - University of Zurich - 01.2008
    1376              : ! **************************************************************************************************
    1377        42496 :    SUBROUTINE create_cg_section(section)
    1378              :       TYPE(section_type), POINTER                        :: section
    1379              : 
    1380              :       TYPE(keyword_type), POINTER                        :: keyword
    1381              :       TYPE(section_type), POINTER                        :: subsection, subsubsection
    1382              : 
    1383              : ! create the CG subsection
    1384              : 
    1385        42496 :       NULLIFY (section, subsection, subsubsection, keyword)
    1386              :       CALL section_create(section, __LOCATION__, name="CG", &
    1387              :                           description="Provides parameters to tune the conjugate gradient optimization", &
    1388        42496 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    1389              : 
    1390              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_STEEP_STEPS", &
    1391              :                           description="Maximum number of steepest descent steps before starting the"// &
    1392              :                           " conjugate gradients optimization.", &
    1393              :                           usage="MAX_STEEP_STEPS {integer}", &
    1394        42496 :                           default_i_val=0)
    1395        42496 :       CALL section_add_keyword(section, keyword)
    1396        42496 :       CALL keyword_release(keyword)
    1397              : 
    1398              :       CALL keyword_create(keyword, __LOCATION__, name="RESTART_LIMIT", &
    1399              :                           description="Cosine of the angle between two consecutive searching directions."// &
    1400              :                           " If the angle during a CG optimization is less than the one corresponding to"// &
    1401              :                           " to the RESTART_LIMIT the CG is reset and one step of steepest descent is"// &
    1402              :                           " performed.", &
    1403              :                           usage="RESTART_LIMIT {real}", &
    1404        42496 :                           default_r_val=0.9_dp)
    1405        42496 :       CALL section_add_keyword(section, keyword)
    1406        42496 :       CALL keyword_release(keyword)
    1407              : 
    1408              :       CALL keyword_create(keyword, __LOCATION__, name="FLETCHER_REEVES", &
    1409              :                           description="Uses FLETCHER-REEVES instead of POLAK-RIBIERE when using Conjugate Gradients", &
    1410              :                           usage="FLETCHER_REEVES", &
    1411        42496 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1412        42496 :       CALL section_add_keyword(section, keyword)
    1413        42496 :       CALL keyword_release(keyword)
    1414              : 
    1415              :       ! Line Search section
    1416              :       CALL section_create(subsection, __LOCATION__, name="LINE_SEARCH", &
    1417              :                           description="Provides parameters to tune the line search during the conjugate gradient optimization", &
    1418        42496 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    1419              : 
    1420              :       CALL keyword_create(keyword, __LOCATION__, name="TYPE", &
    1421              :                           description="1D line search algorithm to be used with the CG optimizer,"// &
    1422              :                           " in increasing order of robustness and cost. ", &
    1423              :                           usage="TYPE GOLD", &
    1424              :                           default_i_val=ls_gold, &
    1425              :                           enum_c_vals=s2a("2PNT", "GOLD", "FIT"), &
    1426              :                           enum_desc=s2a("extrapolate based on 2 points", &
    1427              :                                         "perform 1D golden section search of the minimum (very expensive)", &
    1428              :                                         "perform 1D fit of a parabola on several evaluation of energy "// &
    1429              :                                         "(very expensive and more robust vs numerical noise)"), &
    1430        42496 :                           enum_i_vals=[ls_2pnt, ls_gold, ls_fit])
    1431        42496 :       CALL section_add_keyword(subsection, keyword)
    1432        42496 :       CALL keyword_release(keyword)
    1433              : 
    1434              :       ! 2PNT
    1435        42496 :       NULLIFY (subsubsection)
    1436              :       CALL section_create(subsubsection, __LOCATION__, name="2PNT", &
    1437              :                           description="Provides parameters to tune the line search for the two point based line search.", &
    1438        42496 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    1439              : 
    1440              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_ALLOWED_STEP", &
    1441              :                           description="Max allowed value for the line search step.", &
    1442              :                           usage="MAX_ALLOWED_STEP {real}", unit_str="internal_cp2k", &
    1443        42496 :                           default_r_val=0.25_dp)
    1444        42496 :       CALL section_add_keyword(subsubsection, keyword)
    1445        42496 :       CALL keyword_release(keyword)
    1446              : 
    1447              :       CALL keyword_create( &
    1448              :          keyword, __LOCATION__, name="LINMIN_GRAD_ONLY", &
    1449              :          description="Use only the gradient, not the energy for line minimizations (e.g. in conjugate gradients).", &
    1450              :          usage="LINMIN_GRAD_ONLY T", &
    1451        42496 :          default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1452        42496 :       CALL section_add_keyword(subsubsection, keyword)
    1453        42496 :       CALL keyword_release(keyword)
    1454              : 
    1455        42496 :       CALL section_add_subsection(subsection, subsubsection)
    1456        42496 :       CALL section_release(subsubsection)
    1457              : 
    1458              :       ! GOLD
    1459        42496 :       NULLIFY (subsubsection)
    1460              :       CALL section_create(subsubsection, __LOCATION__, name="GOLD", &
    1461              :                           description="Provides parameters to tune the line search for the gold search.", &
    1462        42496 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
    1463              : 
    1464              :       CALL keyword_create(keyword, __LOCATION__, name="INITIAL_STEP", &
    1465              :                           description="Initial step size used, e.g. for bracketing or minimizers. "// &
    1466              :                           "Might need to be reduced for systems with close contacts", &
    1467              :                           usage="INITIAL_STEP {real}", unit_str="internal_cp2k", &
    1468        42496 :                           default_r_val=0.2_dp)
    1469        42496 :       CALL section_add_keyword(subsubsection, keyword)
    1470        42496 :       CALL keyword_release(keyword)
    1471              : 
    1472              :       CALL keyword_create(keyword, __LOCATION__, name="BRACK_LIMIT", &
    1473              :                           description="Limit in 1D bracketing during line search in Conjugate Gradients Optimization.", &
    1474              :                           usage="BRACK_LIMIT {real}", unit_str="internal_cp2k", &
    1475        42496 :                           default_r_val=100.0_dp)
    1476        42496 :       CALL section_add_keyword(subsubsection, keyword)
    1477        42496 :       CALL keyword_release(keyword)
    1478              : 
    1479              :       CALL keyword_create(keyword, __LOCATION__, name="BRENT_TOL", &
    1480              :                           description="Tolerance requested during Brent line search in Conjugate Gradients Optimization.", &
    1481              :                           usage="BRENT_TOL {real}", unit_str="internal_cp2k", &
    1482        42496 :                           default_r_val=0.01_dp)
    1483        42496 :       CALL section_add_keyword(subsubsection, keyword)
    1484        42496 :       CALL keyword_release(keyword)
    1485              : 
    1486              :       CALL keyword_create(keyword, __LOCATION__, name="BRENT_MAX_ITER", &
    1487              :                           description="Maximum number of iterations in brent algorithm "// &
    1488              :                           "(used for the line search in Conjugated Gradients Optimization)", &
    1489              :                           usage="BRENT_MAX_ITER {integer}", &
    1490        42496 :                           default_i_val=100)
    1491        42496 :       CALL section_add_keyword(subsubsection, keyword)
    1492        42496 :       CALL keyword_release(keyword)
    1493        42496 :       CALL section_add_subsection(subsection, subsubsection)
    1494        42496 :       CALL section_release(subsubsection)
    1495              : 
    1496        42496 :       CALL section_add_subsection(section, subsection)
    1497        42496 :       CALL section_release(subsection)
    1498        42496 :    END SUBROUTINE create_cg_section
    1499              : 
    1500              : ! **************************************************************************************************
    1501              : !> \brief creates the LBFGS section
    1502              : !> \param section the section to be created
    1503              : !> \author Teodoro Laino [tlaino] - University of Zurich - 01.2008
    1504              : ! **************************************************************************************************
    1505        42496 :    SUBROUTINE create_lbfgs_section(section)
    1506              :       TYPE(section_type), POINTER                        :: section
    1507              : 
    1508              :       TYPE(keyword_type), POINTER                        :: keyword
    1509              : 
    1510              : ! create the LBFGS section
    1511              : 
    1512        42496 :       NULLIFY (section, keyword)
    1513              :       CALL section_create(section, __LOCATION__, name="LBFGS", &
    1514              :                           description="Provides parameters to tune the limited memory BFGS (LBFGS) optimization", &
    1515              :                           n_keywords=0, n_subsections=1, repeats=.FALSE., &
    1516        84992 :                           citations=[Byrd1995])
    1517              : 
    1518              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_H_RANK", &
    1519              :                           description="Maximum rank (and consequently size) of the "// &
    1520              :                           "approximate Hessian matrix used by the LBFGS optimizer. "// &
    1521              :                           "Larger values (e.g. 30) will accelerate the convergence behaviour "// &
    1522              :                           "at the cost of a larger memory consumption.", &
    1523              :                           usage="MAX_H_RANK {integer}", &
    1524        42496 :                           default_i_val=5)
    1525        42496 :       CALL section_add_keyword(section, keyword)
    1526        42496 :       CALL keyword_release(keyword)
    1527              : 
    1528              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_F_PER_ITER", &
    1529              :                           description="Maximum number of force evaluations per iteration"// &
    1530              :                           " (used for the line search)", &
    1531              :                           usage="MAX_F_PER_ITER {integer}", &
    1532        42496 :                           default_i_val=20)
    1533        42496 :       CALL section_add_keyword(section, keyword)
    1534        42496 :       CALL keyword_release(keyword)
    1535              : 
    1536              :       CALL keyword_create(keyword, __LOCATION__, name="PRINT_LEVEL", &
    1537              :                           description="How much output is written out by the LBFGS algorithm. "// &
    1538              :                           "Currently this is independent of the &GLOBAL/PRINT_LEVEL setting.", &
    1539              :                           usage="PRINT_LEVEL MEDIUM", &
    1540              :                           enum_c_vals=s2a("SILENT", "LOW", "MEDIUM", "HIGH", "DEBUG"), &
    1541              :                           enum_desc=s2a("Almost no output", &
    1542              :                                         "Little output about f and |proj g| every iteration", &
    1543              :                                         "Quite some output about details every iteration", &
    1544              :                                         "Lots of output about changes of active set and final x", &
    1545              :                                         "Everything is written out, useful for debugging purposes only"), &
    1546              :                           enum_i_vals=[silent_lbfgs, low_lbfgs, medium_lbfgs, &
    1547              :                                        high_lbfgs, debug_lbfgs], &
    1548        42496 :                           default_i_val=low_print_level)
    1549        42496 :       CALL section_add_keyword(section, keyword)
    1550        42496 :       CALL keyword_release(keyword)
    1551              : 
    1552              :       CALL keyword_create(keyword, __LOCATION__, name="WANTED_PROJ_GRADIENT", &
    1553              :                           description="Convergence criterion (overrides the general ones):"// &
    1554              :                           " Requested norm threshold of the gradient multiplied"// &
    1555              :                           " by the approximate Hessian.", &
    1556              :                           usage="WANTED_PROJ_GRADIENT {real}", unit_str="internal_cp2k", &
    1557        42496 :                           default_r_val=1.0E-16_dp)
    1558        42496 :       CALL section_add_keyword(section, keyword)
    1559        42496 :       CALL keyword_release(keyword)
    1560              : 
    1561              :       CALL keyword_create(keyword, __LOCATION__, name="WANTED_REL_F_ERROR", &
    1562              :                           description="Convergence criterion (overrides the general ones):"// &
    1563              :                           " Requested relative error on the objective function"// &
    1564              :                           " of the optimizer (the energy)", &
    1565              :                           usage="WANTED_REL_F_ERROR {real}", unit_str="internal_cp2k", &
    1566        42496 :                           default_r_val=1.0E-16_dp)
    1567        42496 :       CALL section_add_keyword(section, keyword)
    1568        42496 :       CALL keyword_release(keyword)
    1569              : 
    1570              :       CALL keyword_create( &
    1571              :          keyword, __LOCATION__, name="TRUST_RADIUS", &
    1572              :          description="Trust radius used in LBFGS. Not completely in depth tested. Negativ values means no trust radius is used.", &
    1573              :          usage="TRUST_RADIUS {real}", unit_str='angstrom', &
    1574        42496 :          default_r_val=-1.0_dp)
    1575        42496 :       CALL section_add_keyword(section, keyword)
    1576        42496 :       CALL keyword_release(keyword)
    1577              : 
    1578              :       CALL keyword_create(keyword, __LOCATION__, name="__CONTROL_VAL", &
    1579              :                           description="Hidden parameter that controls the printing behavior "// &
    1580              :                           "of the LBFGS optimizer for advanced debug purposes. This option "// &
    1581              :                           "overrides PRINT_LEVEL setting if explicit.", &
    1582        42496 :                           default_i_val=-1)
    1583        42496 :       CALL section_add_keyword(section, keyword)
    1584        42496 :       CALL keyword_release(keyword)
    1585              : 
    1586        42496 :    END SUBROUTINE create_lbfgs_section
    1587              : 
    1588              : ! **************************************************************************************************
    1589              : !> \brief creates the flexible_partitioning section
    1590              : !> \param section the section to be created
    1591              : !> \author Joost VandeVondele [04.2006]
    1592              : ! **************************************************************************************************
    1593        10624 :    SUBROUTINE create_fp_section(section)
    1594              :       TYPE(section_type), POINTER                        :: section
    1595              : 
    1596              :       TYPE(keyword_type), POINTER                        :: keyword
    1597              :       TYPE(section_type), POINTER                        :: print_key
    1598              : 
    1599        10624 :       CPASSERT(.NOT. ASSOCIATED(section))
    1600              :       CALL section_create(section, __LOCATION__, name="FLEXIBLE_PARTITIONING", &
    1601              :                           description="This section sets up flexible_partitioning", &
    1602        10624 :                           n_keywords=1, n_subsections=1, repeats=.FALSE.)
    1603              : 
    1604        10624 :       NULLIFY (keyword, print_key)
    1605              : 
    1606              :       CALL keyword_create(keyword, __LOCATION__, name="CENTRAL_ATOM", &
    1607              :                           description="Specifies the central atom.", &
    1608              :                           usage="CENTRAL_ATOM {integer}", &
    1609        10624 :                           n_var=1, type_of_var=integer_t)
    1610        10624 :       CALL section_add_keyword(section, keyword)
    1611        10624 :       CALL keyword_release(keyword)
    1612              : 
    1613              :       CALL keyword_create(keyword, __LOCATION__, name="INNER_ATOMS", &
    1614              :                           description="Specifies the list of atoms that should remain close to the central atom.", &
    1615              :                           usage="INNER_ATOMS {integer} {integer} .. {integer}", &
    1616        10624 :                           n_var=-1, type_of_var=integer_t)
    1617        10624 :       CALL section_add_keyword(section, keyword)
    1618        10624 :       CALL keyword_release(keyword)
    1619              : 
    1620              :       CALL keyword_create(keyword, __LOCATION__, name="OUTER_ATOMS", &
    1621              :                           description="Specifies the list of atoms that should remain far from the central atom.", &
    1622              :                           usage="OUTER_ATOMS {integer} {integer} .. {integer}", &
    1623        10624 :                           n_var=-1, type_of_var=integer_t)
    1624        10624 :       CALL section_add_keyword(section, keyword)
    1625        10624 :       CALL keyword_release(keyword)
    1626              : 
    1627              :       CALL keyword_create(keyword, __LOCATION__, name="INNER_RADIUS", &
    1628              :                           description="radius of the inner wall", &
    1629              :                           usage="INNER_RADIUS {real} ", type_of_var=real_t, &
    1630        10624 :                           n_var=1, unit_str="angstrom")
    1631        10624 :       CALL section_add_keyword(section, keyword)
    1632        10624 :       CALL keyword_release(keyword)
    1633              : 
    1634              :       CALL keyword_create(keyword, __LOCATION__, name="OUTER_RADIUS", &
    1635              :                           description="radius of the outer wall", &
    1636              :                           usage="OUTER_RADIUS {real} ", type_of_var=real_t, &
    1637        10624 :                           n_var=1, unit_str="angstrom")
    1638        10624 :       CALL section_add_keyword(section, keyword)
    1639        10624 :       CALL keyword_release(keyword)
    1640              : 
    1641              :       CALL keyword_create(keyword, __LOCATION__, name="STRENGTH", &
    1642              :                           description="Sets the force constant of the repulsive harmonic potential", &
    1643        10624 :                           usage="STRENGTH 1.0", default_r_val=1.0_dp)
    1644        10624 :       CALL section_add_keyword(section, keyword)
    1645        10624 :       CALL keyword_release(keyword)
    1646              : 
    1647              :       CALL keyword_create(keyword, __LOCATION__, name="BIAS", &
    1648              :                           description="If a bias potential counter-acting the weight term should be applied (recommended).", &
    1649        10624 :                           usage="BIAS F", default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    1650        10624 :       CALL section_add_keyword(section, keyword)
    1651        10624 :       CALL keyword_release(keyword)
    1652              : 
    1653              :       CALL keyword_create(keyword, __LOCATION__, name="TEMPERATURE", &
    1654              :                           description="Sets the temperature parameter that is used in the baising potential."// &
    1655              :                           " It is recommended to use the actual simulation temperature", &
    1656        10624 :                           usage="TEMPERATURE 300", default_r_val=300.0_dp, unit_str='K')
    1657        10624 :       CALL section_add_keyword(section, keyword)
    1658        10624 :       CALL keyword_release(keyword)
    1659              : 
    1660              :       CALL keyword_create(keyword, __LOCATION__, name="SMOOTH_WIDTH", &
    1661              :                           description="Sets the width of the smooth counting function.", &
    1662        10624 :                           usage="SMOOTH_WIDTH 0.2", default_r_val=0.02_dp, unit_str='angstrom')
    1663        10624 :       CALL section_add_keyword(section, keyword)
    1664        10624 :       CALL keyword_release(keyword)
    1665              : 
    1666              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "WEIGHTS", &
    1667              :                                        description="Controls the printing of FP info during flexible partitioning simulations.", &
    1668              :                                        print_level=low_print_level, common_iter_levels=1, &
    1669        10624 :                                        filename="FLEXIBLE_PARTIONING")
    1670        10624 :       CALL section_add_subsection(section, print_key)
    1671        10624 :       CALL section_release(print_key)
    1672              : 
    1673              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "CONTROL", &
    1674              :                                        description="Controls the printing of FP info at startup", &
    1675              :                                        print_level=low_print_level, common_iter_levels=1, &
    1676        10624 :                                        filename="__STD_OUT__")
    1677        10624 :       CALL section_add_subsection(section, print_key)
    1678        10624 :       CALL section_release(print_key)
    1679              : 
    1680        10624 :    END SUBROUTINE create_fp_section
    1681              : 
    1682              : ! **************************************************************************************************
    1683              : !> \brief ...
    1684              : !> \param section will contain the driver section
    1685              : !> \author mceriotti
    1686              : ! **************************************************************************************************
    1687        10624 :    SUBROUTINE create_driver_section(section)
    1688              :       TYPE(section_type), POINTER                        :: section
    1689              : 
    1690              :       TYPE(keyword_type), POINTER                        :: keyword
    1691              : 
    1692        10624 :       CPASSERT(.NOT. ASSOCIATED(section))
    1693              :       CALL section_create(section, __LOCATION__, name="DRIVER", &
    1694              :                           description="This section defines the parameters needed to run in i-PI driver mode.", &
    1695              :                           citations=[Ceriotti2014, Kapil2016], &
    1696        31872 :                           n_keywords=4, n_subsections=0, repeats=.FALSE.)
    1697              : 
    1698        10624 :       NULLIFY (keyword)
    1699              :       CALL keyword_create(keyword, __LOCATION__, name="unix", &
    1700              :                           description="Use a UNIX socket rather than an INET socket.", &
    1701              :                           usage="unix LOGICAL", &
    1702        10624 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    1703        10624 :       CALL section_add_keyword(section, keyword)
    1704        10624 :       CALL keyword_release(keyword)
    1705              : 
    1706              :       CALL keyword_create(keyword, __LOCATION__, name="port", &
    1707              :                           description="Port number for the i-PI server.", &
    1708              :                           usage="port <INTEGER>", &
    1709        10624 :                           default_i_val=12345)
    1710        10624 :       CALL section_add_keyword(section, keyword)
    1711        10624 :       CALL keyword_release(keyword)
    1712              : 
    1713              :       CALL keyword_create(keyword, __LOCATION__, name="host", &
    1714              :                           description="Host name for the i-PI server.", &
    1715              :                           usage="host <HOSTNAME>", &
    1716        10624 :                           default_c_val="localhost")
    1717        10624 :       CALL section_add_keyword(section, keyword)
    1718        10624 :       CALL keyword_release(keyword)
    1719              : 
    1720              :       CALL keyword_create(keyword, __LOCATION__, name="PREFIX", &
    1721              :                           description="Prefix used to build the path of the UNIX socket file, "// &
    1722              :                           "as /tmp/<PREFIX>_<HOST>. Only relevant if UNIX is set to true.", &
    1723              :                           usage="PREFIX ipi", &
    1724        10624 :                           default_c_val="ipi")
    1725        10624 :       CALL section_add_keyword(section, keyword)
    1726        10624 :       CALL keyword_release(keyword)
    1727              : 
    1728              :       CALL keyword_create(keyword, __LOCATION__, name="SLEEP_TIME", &
    1729              :                           description="Sleeping time while waiting for for driver commands [s].", &
    1730              :                           usage="SLEEP_TIME 0.1", &
    1731        10624 :                           default_r_val=0.01_dp)
    1732        10624 :       CALL section_add_keyword(section, keyword)
    1733        10624 :       CALL keyword_release(keyword)
    1734              : 
    1735        10624 :    END SUBROUTINE create_driver_section
    1736              : 
    1737              : ! **************************************************************************************************
    1738              : !> \brief creates the section for a path integral run
    1739              : !> \param section will contain the pint section
    1740              : !> \author fawzi
    1741              : ! **************************************************************************************************
    1742        10624 :    SUBROUTINE create_pint_section(section)
    1743              :       TYPE(section_type), POINTER                        :: section
    1744              : 
    1745              :       TYPE(keyword_type), POINTER                        :: keyword
    1746              :       TYPE(section_type), POINTER                        :: print_key, subsection, subsubsection
    1747              : 
    1748        10624 :       CPASSERT(.NOT. ASSOCIATED(section))
    1749              :       CALL section_create(section, __LOCATION__, name="PINT", &
    1750              :                           description="The section that controls a path integral run", &
    1751        10624 :                           n_keywords=13, n_subsections=9, repeats=.FALSE.)
    1752        10624 :       NULLIFY (keyword)
    1753              : 
    1754              :       CALL keyword_create(keyword, __LOCATION__, name="p", &
    1755              :                           description="Specify number beads to use", repeats=.FALSE., &
    1756        10624 :                           default_i_val=3)
    1757        10624 :       CALL section_add_keyword(section, keyword)
    1758        10624 :       CALL keyword_release(keyword)
    1759              :       CALL keyword_create(keyword, __LOCATION__, name="proc_per_replica", &
    1760              :                           description="Specify number of processors to use for each replica", &
    1761        10624 :                           repeats=.FALSE., default_i_val=0)
    1762        10624 :       CALL section_add_keyword(section, keyword)
    1763        10624 :       CALL keyword_release(keyword)
    1764              :       CALL keyword_create(keyword, __LOCATION__, name="num_steps", &
    1765              :                           description="Number of steps (if MAX_STEP is not explicitly given"// &
    1766              :                           " the program will perform this number of steps)", repeats=.FALSE., &
    1767        10624 :                           default_i_val=3)
    1768        10624 :       CALL section_add_keyword(section, keyword)
    1769        10624 :       CALL keyword_release(keyword)
    1770              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_STEP", &
    1771              :                           description="Maximum step number (the program will stop if"// &
    1772              :                           " ITERATION >= MAX_STEP even if NUM_STEPS has not been reached)", &
    1773        10624 :                           repeats=.FALSE., default_i_val=10)
    1774        10624 :       CALL section_add_keyword(section, keyword)
    1775        10624 :       CALL keyword_release(keyword)
    1776              :       CALL keyword_create(keyword, __LOCATION__, name="iteration", &
    1777              :                           description="Specify the iteration number from which it should be "// &
    1778        10624 :                           "counted", default_i_val=0)
    1779        10624 :       CALL section_add_keyword(section, keyword)
    1780        10624 :       CALL keyword_release(keyword)
    1781              :       CALL keyword_create(keyword, __LOCATION__, name="Temp", &
    1782              :                           description="The temperature you want to simulate", &
    1783              :                           default_r_val=cp_unit_to_cp2k(300._dp, "K"), &
    1784        10624 :                           unit_str="K")
    1785        10624 :       CALL section_add_keyword(section, keyword)
    1786        10624 :       CALL keyword_release(keyword)
    1787              :       CALL keyword_create(keyword, __LOCATION__, name="kT_CORRECTION", &
    1788              :                           description="Corrects for the loss of temperature due to constrained "// &
    1789              :                           "degrees of freedom for Nose-Hover chains and numeric integration", &
    1790        10624 :                           repeats=.FALSE., default_l_val=.FALSE.)
    1791        10624 :       CALL section_add_keyword(section, keyword)
    1792        10624 :       CALL keyword_release(keyword)
    1793              :       CALL keyword_create(keyword, __LOCATION__, name="T_tol", variants=["temp_to"], &
    1794              :                           description="threshold for the oscillations of the temperature "// &
    1795              :                           "excedeed which the temperature is rescaled. 0 means no rescaling.", &
    1796        21248 :                           default_r_val=0._dp, unit_str="K")
    1797        10624 :       CALL section_add_keyword(section, keyword)
    1798        10624 :       CALL keyword_release(keyword)
    1799              :       CALL keyword_create(keyword, __LOCATION__, name="dt", &
    1800              :                           description="timestep (might be subdivised in nrespa subtimesteps", &
    1801              :                           repeats=.FALSE., &
    1802              :                           default_r_val=cp_unit_to_cp2k(1.0_dp, "fs"), &
    1803        10624 :                           usage="dt 1.0", unit_str="fs")
    1804        10624 :       CALL section_add_keyword(section, keyword)
    1805        10624 :       CALL keyword_release(keyword)
    1806              :       CALL keyword_create(keyword, __LOCATION__, name="HARM_INT", &
    1807              :                           description="integrator scheme for integrating the harmonic bead springs.", &
    1808              :                           usage="HARM_INT (NUMERIC|EXACT)", &
    1809              :                           default_i_val=integrate_numeric, &
    1810              :                           enum_c_vals=s2a("NUMERIC", "EXACT"), &
    1811        10624 :                           enum_i_vals=[integrate_numeric, integrate_exact])
    1812        10624 :       CALL section_add_keyword(section, keyword)
    1813        10624 :       CALL keyword_release(keyword)
    1814              :       CALL keyword_create(keyword, __LOCATION__, name="nrespa", &
    1815              :                           description="number of respa steps for the bead for each md step", &
    1816        10624 :                           repeats=.FALSE., default_i_val=5)
    1817        10624 :       CALL section_add_keyword(section, keyword)
    1818        10624 :       CALL keyword_release(keyword)
    1819              : 
    1820              :       CALL keyword_create(keyword, __LOCATION__, name="transformation", &
    1821              :                           description="Specifies the coordinate transformation to use", &
    1822              :                           usage="TRANSFORMATION (NORMAL|STAGE)", &
    1823              :                           default_i_val=transformation_normal, &
    1824              :                           enum_c_vals=s2a("NORMAL", "STAGE"), &
    1825        10624 :                           enum_i_vals=[transformation_normal, transformation_stage])
    1826              : 
    1827        10624 :       CALL section_add_keyword(section, keyword)
    1828        10624 :       CALL keyword_release(keyword)
    1829              :       CALL keyword_create(keyword, __LOCATION__, name="propagator", &
    1830              :                           description="Specifies the real time propagator to use", &
    1831              :                           usage="PROPAGATOR (PIMD|RPMD|CMD|BCMD)", &
    1832              :                           default_i_val=propagator_pimd, &
    1833              :                           enum_c_vals=s2a("PIMD", "RPMD", "CMD", "BCMD"), &
    1834        10624 :                           enum_i_vals=[propagator_pimd, propagator_rpmd, propagator_cmd, propagator_bcmd])
    1835        10624 :       CALL section_add_keyword(section, keyword)
    1836        10624 :       CALL keyword_release(keyword)
    1837              :       CALL keyword_create(keyword, __LOCATION__, name="FIX_CENTROID_POS", &
    1838              :                           description="Propagate all DOF but the centroid - "// &
    1839              :                           "useful for equilibration of the non-centroid modes "// &
    1840              :                           "(activated only if TRANSFORMATION==NORMAL)", &
    1841              :                           repeats=.FALSE., default_l_val=.FALSE., &
    1842        10624 :                           lone_keyword_l_val=.TRUE.)
    1843        10624 :       CALL section_add_keyword(section, keyword)
    1844        10624 :       CALL keyword_release(keyword)
    1845              : 
    1846        10624 :       NULLIFY (subsection, subsubsection)
    1847              :       CALL section_create(subsection, __LOCATION__, name="NORMALMODE", &
    1848              :                           description="Controls the normal mode transformation", &
    1849        10624 :                           n_keywords=3, n_subsections=0, repeats=.FALSE.)
    1850              :       CALL keyword_create(keyword, __LOCATION__, name="Q_CENTROID", &
    1851              :                           description="Value of the thermostat mass of centroid degree of freedom", &
    1852        10624 :                           repeats=.FALSE., default_r_val=-1.0_dp)
    1853        10624 :       CALL section_add_keyword(subsection, keyword)
    1854        10624 :       CALL keyword_release(keyword)
    1855              :       CALL keyword_create(keyword, __LOCATION__, name="Q_BEAD", &
    1856              :                           description="Value of the thermostat mass of non-centroid degrees of freedom", &
    1857        10624 :                           repeats=.FALSE., default_r_val=-1.0_dp)
    1858        10624 :       CALL section_add_keyword(subsection, keyword)
    1859        10624 :       CALL keyword_release(keyword)
    1860              :       CALL keyword_create(keyword, __LOCATION__, name="MODEFACTOR", &
    1861              :                           description="mass scale factor for non-centroid degrees of freedom", &
    1862        10624 :                           repeats=.FALSE., default_r_val=1.0_dp)
    1863        10624 :       CALL section_add_keyword(subsection, keyword)
    1864        10624 :       CALL keyword_release(keyword)
    1865              :       CALL keyword_create(keyword, __LOCATION__, name="GAMMA", &
    1866              :                           description="mass scale factor for non-centroid degrees of freedom, &
    1867              : &                                       naming convention according to Witt, 2008, <https://doi.org/10.1063/1.3125009>.", &
    1868        10624 :                           repeats=.FALSE., default_r_val=8.0_dp)
    1869        10624 :       CALL section_add_keyword(subsection, keyword)
    1870        10624 :       CALL keyword_release(keyword)
    1871              : 
    1872        10624 :       CALL section_add_subsection(section, subsection)
    1873        10624 :       CALL section_release(subsection)
    1874              : 
    1875              :       CALL section_create(subsection, __LOCATION__, name="staging", &
    1876              :                           description="The section that controls the staging transformation", &
    1877        10624 :                           n_keywords=2, n_subsections=0, repeats=.FALSE.)
    1878              :       CALL keyword_create(keyword, __LOCATION__, name="j", &
    1879              :                           description="Value of the j parameter for the staging transformation", &
    1880        10624 :                           repeats=.FALSE., default_i_val=2)
    1881        10624 :       CALL section_add_keyword(subsection, keyword)
    1882        10624 :       CALL keyword_release(keyword)
    1883              :       CALL keyword_create(keyword, __LOCATION__, name="Q_END", &
    1884              :                           description="Value of the nose-hoover mass for the endbead (Q_end)", &
    1885        10624 :                           repeats=.FALSE., default_i_val=2)
    1886        10624 :       CALL section_add_keyword(subsection, keyword)
    1887        10624 :       CALL keyword_release(keyword)
    1888        10624 :       CALL section_add_subsection(section, subsection)
    1889        10624 :       CALL section_release(subsection)
    1890              : 
    1891              :       CALL section_create(subsection, __LOCATION__, name="BEADS", &
    1892              :                           description="Sets positions and velocities of the beads", &
    1893              :                           n_keywords=0, n_subsections=2, &
    1894        10624 :                           repeats=.FALSE.)
    1895        10624 :       CALL create_coord_section(subsubsection, "BEADS")
    1896        10624 :       CALL section_add_subsection(subsection, subsubsection)
    1897        10624 :       CALL section_release(subsubsection)
    1898        10624 :       CALL create_velocity_section(subsubsection, "BEADS")
    1899        10624 :       CALL section_add_subsection(subsection, subsubsection)
    1900        10624 :       CALL section_release(subsubsection)
    1901        10624 :       CALL section_add_subsection(section, subsection)
    1902        10624 :       CALL section_release(subsection)
    1903              : 
    1904              :       CALL section_create(subsection, __LOCATION__, name="NOSE", &
    1905              :                           description="Controls the Nose-Hoover thermostats", &
    1906              :                           n_keywords=1, n_subsections=2, &
    1907        10624 :                           repeats=.FALSE.)
    1908              :       CALL keyword_create(keyword, __LOCATION__, name="nnos", &
    1909              :                           description="length of nose-hoover chain. 0 means no thermostat", &
    1910        10624 :                           repeats=.FALSE., default_i_val=2)
    1911        10624 :       CALL section_add_keyword(subsection, keyword)
    1912        10624 :       CALL keyword_release(keyword)
    1913        10624 :       CALL create_coord_section(subsubsection, "NOSE")
    1914        10624 :       CALL section_add_subsection(subsection, subsubsection)
    1915        10624 :       CALL section_release(subsubsection)
    1916        10624 :       CALL create_velocity_section(subsubsection, "NOSE")
    1917        10624 :       CALL section_add_subsection(subsection, subsubsection)
    1918        10624 :       CALL section_release(subsubsection)
    1919        10624 :       CALL section_add_subsection(section, subsection)
    1920        10624 :       CALL section_release(subsection)
    1921              : 
    1922        10624 :       CALL create_gle_section(subsection)
    1923        10624 :       CALL section_add_subsection(section, subsection)
    1924        10624 :       CALL section_release(subsection)
    1925              : 
    1926              :       CALL section_create(subsection, __LOCATION__, name="PILE", &
    1927              :                           description="Controls the PI Langevin Equation thermostat."// &
    1928              :                           " Needs the exact harmonic integrator."// &
    1929              :                           " May lead to unphysical motions if constraint e.g. FIXED_ATOMS, is applied."// &
    1930              :                           " RESTART_HELIUM section has to be .FALSE. when restarting the PIGLET job.", &
    1931              :                           citations=[Ceriotti2010], &
    1932              :                           n_keywords=3, n_subsections=1, &
    1933        21248 :                           repeats=.FALSE.)
    1934        10624 :       CALL create_rng_section(subsubsection)
    1935        10624 :       CALL section_add_subsection(subsection, subsubsection)
    1936        10624 :       CALL section_release(subsubsection)
    1937              :       CALL keyword_create(keyword, __LOCATION__, name="TAU", &
    1938              :                           description="Time constant for centroid motion. "// &
    1939              :                           "If zero or negative the centroid is not thermostated.", &
    1940              :                           usage="TAU {real}", type_of_var=real_t, &
    1941        10624 :                           unit_str="fs", n_var=1, default_r_val=1000.0_dp)
    1942        10624 :       CALL section_add_keyword(subsection, keyword)
    1943        10624 :       CALL keyword_release(keyword)
    1944              :       CALL keyword_create(keyword, __LOCATION__, name="LAMBDA", &
    1945              :                           description="Scaling of friction to mode coupling", &
    1946              :                           usage="LAMBDA {real}", type_of_var=real_t, &
    1947        10624 :                           n_var=1, default_r_val=0.5_dp)
    1948        10624 :       CALL section_add_keyword(subsection, keyword)
    1949        10624 :       CALL keyword_release(keyword)
    1950              :       CALL keyword_create(keyword, __LOCATION__, name="THERMOSTAT_ENERGY", &
    1951              :                           description="Thermostat energy for conserved quantity. "// &
    1952              :                           "Only useful in restart files.", &
    1953              :                           usage="THERMOSTAT_ENERGY {real}", type_of_var=real_t, &
    1954        10624 :                           n_var=1, default_r_val=0.0_dp)
    1955        10624 :       CALL section_add_keyword(subsection, keyword)
    1956        10624 :       CALL keyword_release(keyword)
    1957        10624 :       CALL section_add_subsection(section, subsection)
    1958        10624 :       CALL section_release(subsection)
    1959              : 
    1960              :       CALL section_create(subsection, __LOCATION__, name="PIGLET", &
    1961              :                           description="Controls the PI Generalized Langevin Equation thermostat."// &
    1962              :                           " Needs the exact harmonic integrator", &
    1963              :                           citations=[Ceriotti2012], &
    1964              :                           n_keywords=4, n_subsections=2, &
    1965        21248 :                           repeats=.FALSE.)
    1966        10624 :       CALL create_rng_section(subsubsection)
    1967        10624 :       CALL section_add_subsection(subsection, subsubsection)
    1968        10624 :       CALL section_release(subsubsection)
    1969              :       CALL section_create(subsubsection, __LOCATION__, name="EXTRA_DOF", &
    1970              :                           description="Additional degrees of freedom to ensure Markovian Dynamics.", &
    1971        10624 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
    1972              :       CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
    1973              :                           description="Restart values for additional degrees of freedom" &
    1974              :                           //" (only for restarts, do not set explicitly)", &
    1975              :                           repeats=.FALSE., &
    1976        10624 :                           type_of_var=real_t, n_var=-1)
    1977        10624 :       CALL section_add_keyword(subsubsection, keyword)
    1978        10624 :       CALL keyword_release(keyword)
    1979        10624 :       CALL section_add_subsection(subsection, subsubsection)
    1980        10624 :       CALL section_release(subsubsection)
    1981              :       CALL keyword_create(keyword, __LOCATION__, name="NEXTRA_DOF", &
    1982              :                           description="Number of extra degrees of freedom to ensure markovian dynamics", &
    1983        10624 :                           repeats=.FALSE., default_i_val=8)
    1984        10624 :       CALL section_add_keyword(subsection, keyword)
    1985        10624 :       CALL keyword_release(keyword)
    1986              :       CALL keyword_create(keyword, __LOCATION__, name="MATRICES_FILE_NAME", &
    1987              :                           description="Filename containig the raw matrices from "// &
    1988              :                           "<https://gle4md.org/index.html?page=matrix>.", &
    1989        10624 :                           repeats=.FALSE., default_lc_val="PIGLET.MAT")
    1990        10624 :       CALL section_add_keyword(subsection, keyword)
    1991        10624 :       CALL keyword_release(keyword)
    1992              :       CALL keyword_create(keyword, __LOCATION__, name="SMATRIX_INIT", &
    1993              :                           description="Select algorithm to initialize piglet S-matrices", &
    1994              :                           usage="SMATRIX_INIT (CHOLESKY|DIAGONAL)", &
    1995              :                           default_i_val=matrix_init_cholesky, &
    1996              :                           enum_c_vals=s2a("CHOLESKY", "DIAGONAL"), &
    1997        10624 :                           enum_i_vals=[matrix_init_cholesky, matrix_init_diagonal])
    1998        10624 :       CALL section_add_keyword(subsection, keyword)
    1999        10624 :       CALL keyword_release(keyword)
    2000              :       CALL keyword_create(keyword, __LOCATION__, name="THERMOSTAT_ENERGY", &
    2001              :                           description="Thermostat energy for conserved quantity. "// &
    2002              :                           "Only useful in restart files.", &
    2003              :                           usage="THERMOSTAT_ENERGY {real}", type_of_var=real_t, &
    2004        10624 :                           n_var=1, default_r_val=0.0_dp)
    2005        10624 :       CALL section_add_keyword(subsection, keyword)
    2006        10624 :       CALL keyword_release(keyword)
    2007        10624 :       CALL section_add_subsection(section, subsection)
    2008        10624 :       CALL section_release(subsection)
    2009              : 
    2010              :       CALL section_create(subsection, __LOCATION__, name="QTB", &
    2011              :                           description="Controls the QTB-PILE thermostat."// &
    2012              :                           " Needs the exact harmonic integrator", &
    2013              :                           citations=[Brieuc2016], &
    2014              :                           n_keywords=7, n_subsections=1, &
    2015        21248 :                           repeats=.FALSE.)
    2016        10624 :       CALL create_rng_section(subsubsection)
    2017        10624 :       CALL section_add_subsection(subsection, subsubsection)
    2018        10624 :       CALL section_release(subsubsection)
    2019              :       CALL keyword_create(keyword, __LOCATION__, name="TAU", &
    2020              :                           description="Time constant for centroid motion. ", &
    2021              :                           usage="TAU {real}", type_of_var=real_t, &
    2022        10624 :                           unit_str="fs", n_var=1, default_r_val=1000.0_dp)
    2023        10624 :       CALL section_add_keyword(subsection, keyword)
    2024        10624 :       CALL keyword_release(keyword)
    2025              :       CALL keyword_create(keyword, __LOCATION__, name="LAMBDA", &
    2026              :                           description="Scaling of friction to ring polymer NM freq.", &
    2027              :                           usage="LAMBDA {real}", type_of_var=real_t, &
    2028        10624 :                           n_var=1, default_r_val=0.5_dp)
    2029        10624 :       CALL section_add_keyword(subsection, keyword)
    2030        10624 :       CALL keyword_release(keyword)
    2031              :       CALL keyword_create(keyword, __LOCATION__, name="FP", &
    2032              :                           description="Defines which version to use "// &
    2033              :                           "0: f_P^(0), 1: f_P^(1)", &
    2034              :                           usage="FP {integer}", type_of_var=integer_t, &
    2035        10624 :                           n_var=1, default_i_val=1)
    2036        10624 :       CALL section_add_keyword(subsection, keyword)
    2037        10624 :       CALL keyword_release(keyword)
    2038              :       CALL keyword_create(keyword, __LOCATION__, name="TAUCUT", &
    2039              :                           description="Inverse of cutoff freq. for the centroid mode", &
    2040              :                           usage="TAUCUT {real}", type_of_var=real_t, &
    2041        10624 :                           unit_str="fs", n_var=1, default_r_val=0.5_dp)
    2042        10624 :       CALL section_add_keyword(subsection, keyword)
    2043        10624 :       CALL keyword_release(keyword)
    2044              :       CALL keyword_create(keyword, __LOCATION__, name="LAMBCUT", &
    2045              :                           description="Scaling of cutoff freq. to ring polymer NM freq.", &
    2046              :                           usage="LAMBCUT {real}", type_of_var=real_t, &
    2047        10624 :                           n_var=1, default_r_val=2.0_dp)
    2048        10624 :       CALL section_add_keyword(subsection, keyword)
    2049        10624 :       CALL keyword_release(keyword)
    2050              :       CALL keyword_create(keyword, __LOCATION__, name="NF", &
    2051              :                           description="Number of points used for the convolution product.", &
    2052              :                           usage="NF {integer}", type_of_var=integer_t, &
    2053        10624 :                           n_var=1, default_i_val=128)
    2054        10624 :       CALL section_add_keyword(subsection, keyword)
    2055        10624 :       CALL keyword_release(keyword)
    2056              :       CALL keyword_create(keyword, __LOCATION__, name="THERMOSTAT_ENERGY", &
    2057              :                           description="Thermostat energy for conserved quantity. "// &
    2058              :                           "Only useful in restart files.", &
    2059              :                           usage="THERMOSTAT_ENERGY {real}", type_of_var=real_t, &
    2060        10624 :                           n_var=1, default_r_val=0.0_dp)
    2061        10624 :       CALL section_add_keyword(subsection, keyword)
    2062        10624 :       CALL keyword_release(keyword)
    2063        10624 :       CALL section_add_subsection(section, subsection)
    2064        10624 :       CALL section_release(subsection)
    2065              : 
    2066              :       CALL section_create(subsection, __LOCATION__, name="INIT", &
    2067              :                           description="Controls the initialization if the beads are not present", &
    2068        10624 :                           repeats=.FALSE.)
    2069              : 
    2070              :       CALL keyword_create(keyword, __LOCATION__, name="LEVY_POS_SAMPLE", &
    2071              :                           description="Sample bead positions assuming free particle "// &
    2072              :                           "behavior (performs a Levy random walk of length P around "// &
    2073              :                           "the classical position of each atom at the physical "// &
    2074              :                           "temperature defined in PINT%TEMP)", &
    2075              :                           repeats=.FALSE., default_l_val=.FALSE., &
    2076        10624 :                           lone_keyword_l_val=.TRUE.)
    2077        10624 :       CALL section_add_keyword(subsection, keyword)
    2078        10624 :       CALL keyword_release(keyword)
    2079              :       CALL keyword_create(keyword, __LOCATION__, name="LEVY_CORRELATED", &
    2080              :                           description="Use the same Levy path for all atoms, though "// &
    2081              :                           "with mass-dependent variances (might help at very low T)", &
    2082              :                           repeats=.FALSE., default_l_val=.FALSE., &
    2083        10624 :                           lone_keyword_l_val=.TRUE.)
    2084        10624 :       CALL section_add_keyword(subsection, keyword)
    2085        10624 :       CALL keyword_release(keyword)
    2086              :       CALL keyword_create(keyword, __LOCATION__, name="LEVY_TEMP_FACTOR", &
    2087              :                           description="Multiplicative correction factor for the "// &
    2088              :                           "temperature at which the Levy walk is performed "// &
    2089              :                           "(correction is due to the interactions that modify "// &
    2090              :                           "the spread of a free particle)", &
    2091        10624 :                           repeats=.FALSE., default_r_val=1.0_dp)
    2092        10624 :       CALL section_add_keyword(subsection, keyword)
    2093        10624 :       CALL keyword_release(keyword)
    2094              :       CALL keyword_create(keyword, __LOCATION__, name="LEVY_SEED", &
    2095              :                           description="Initial seed for the (pseudo)random number "// &
    2096              :                           "generator that controls Levy walk for bead positions.", &
    2097              :                           usage="LEVY_SEED <INTEGER>", default_i_val=1234, &
    2098        10624 :                           repeats=.FALSE.)
    2099        10624 :       CALL section_add_keyword(subsection, keyword)
    2100        10624 :       CALL keyword_release(keyword)
    2101              :       CALL keyword_create(keyword, __LOCATION__, name="THERMOSTAT_SEED", &
    2102              :                           description="Initial seed for the (pseudo)random number "// &
    2103              :                           "generator that controls the PILE and PIGLET thermostats.", &
    2104              :                           usage="THERMOSTAT_SEED <INTEGER>", default_i_val=12345, &
    2105        10624 :                           repeats=.FALSE.)
    2106        10624 :       CALL section_add_keyword(subsection, keyword)
    2107        10624 :       CALL keyword_release(keyword)
    2108              :       CALL keyword_create(keyword, __LOCATION__, name="RANDOMIZE_POS", &
    2109              :                           description="add gaussian noise to the positions of the beads", &
    2110        10624 :                           repeats=.FALSE., default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2111        10624 :       CALL section_add_keyword(subsection, keyword)
    2112        10624 :       CALL keyword_release(keyword)
    2113              : 
    2114              :       CALL keyword_create(keyword, __LOCATION__, name="CENTROID_SPEED", &
    2115              :                           description="adds random velocity component to the centroid modes "// &
    2116              :                           "(useful to correct for the averaging out of the speed of various beads)", &
    2117        10624 :                           repeats=.FALSE., default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2118        10624 :       CALL section_add_keyword(subsection, keyword)
    2119        10624 :       CALL keyword_release(keyword)
    2120              : 
    2121              :       CALL keyword_create(keyword, __LOCATION__, name="VELOCITY_QUENCH", &
    2122              :                           description="set the initial velocities to zero", &
    2123        10624 :                           repeats=.FALSE., default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2124        10624 :       CALL section_add_keyword(subsection, keyword)
    2125        10624 :       CALL keyword_release(keyword)
    2126              :       CALL keyword_create(keyword, __LOCATION__, name="VELOCITY_SCALE", &
    2127              :                           description="scale initial velocities to the temperature given in MOTION%PINT%TEMP", &
    2128        10624 :                           repeats=.FALSE., default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2129        10624 :       CALL section_add_keyword(subsection, keyword)
    2130        10624 :       CALL keyword_release(keyword)
    2131              : 
    2132        10624 :       CALL section_add_subsection(section, subsection)
    2133        10624 :       CALL section_release(subsection)
    2134              : 
    2135        10624 :       CALL create_helium_section(subsection)
    2136        10624 :       CALL section_add_subsection(section, subsection)
    2137        10624 :       CALL section_release(subsection)
    2138              : 
    2139              :       CALL section_create(subsection, __LOCATION__, name="PRINT", &
    2140              :                           description="Controls the path integral-specific output", &
    2141        10624 :                           n_keywords=2, n_subsections=0, repeats=.FALSE.)
    2142              : 
    2143        10624 :       NULLIFY (print_key)
    2144              : 
    2145              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "ENERGY", &
    2146              :                                        description="Controls the output of the path integral energies", &
    2147        10624 :                                        print_level=low_print_level, common_iter_levels=1)
    2148        10624 :       CALL section_add_subsection(subsection, print_key)
    2149        10624 :       CALL section_release(print_key)
    2150              : 
    2151              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "ACTION", &
    2152              :                                        description="Controls the output of the path integral action", &
    2153        10624 :                                        print_level=medium_print_level, common_iter_levels=1)
    2154        10624 :       CALL section_add_subsection(subsection, print_key)
    2155        10624 :       CALL section_release(print_key)
    2156              : 
    2157              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "CENTROID_POS", &
    2158              :                                        description="Controls the output of the centroid's position", &
    2159              :                                        unit_str="angstrom", &
    2160        10624 :                                        print_level=low_print_level, common_iter_levels=1)
    2161              :       CALL add_format_keyword(keyword, print_key, pos=.TRUE., &
    2162        10624 :                               description="Output file format for the positions of centroid")
    2163        10624 :       CALL section_add_subsection(subsection, print_key)
    2164        10624 :       CALL section_release(print_key)
    2165              : 
    2166              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "CENTROID_VEL", &
    2167              :                                        description="Controls the output of the centroid's velocity", &
    2168              :                                        unit_str="bohr*au_t^-1", &
    2169        10624 :                                        print_level=low_print_level, common_iter_levels=1)
    2170              :       CALL add_format_keyword(keyword, print_key, pos=.FALSE., &
    2171        10624 :                               description="Output file format for the velocity of centroid")
    2172        10624 :       CALL section_add_subsection(subsection, print_key)
    2173        10624 :       CALL section_release(print_key)
    2174              : 
    2175              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "CENTROID_GYR", &
    2176              :                                        description="Controls the output of the centroid's radii of gyration", &
    2177              :                                        unit_str="angstrom", &
    2178        10624 :                                        print_level=low_print_level, common_iter_levels=1)
    2179        10624 :       CALL section_add_subsection(subsection, print_key)
    2180        10624 :       CALL section_release(print_key)
    2181              : 
    2182              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "COM", &
    2183              :                                        description="Controls the output of the center of mass", &
    2184        10624 :                                        print_level=high_print_level, common_iter_levels=1)
    2185        10624 :       CALL section_add_subsection(subsection, print_key)
    2186        10624 :       CALL section_release(print_key)
    2187              : 
    2188              :       CALL keyword_create(keyword, __LOCATION__, name="IMAGINARY_TIME_STRIDE", &
    2189              :                           description="Prints only every nth bead trajectory", &
    2190        10624 :                           repeats=.FALSE., default_i_val=1)
    2191        10624 :       CALL section_add_keyword(subsection, keyword)
    2192        10624 :       CALL keyword_release(keyword)
    2193              : 
    2194        10624 :       CALL section_add_subsection(section, subsection)
    2195        10624 :       CALL section_release(subsection)
    2196              : 
    2197        10624 :    END SUBROUTINE create_pint_section
    2198              : 
    2199              :    ! ***************************************************************************
    2200              :    !> \brief  Create the input section for superfluid helium solvent.
    2201              :    !> \author Lukasz Walewski
    2202              :    ! ***************************************************************************
    2203              : ! **************************************************************************************************
    2204              : !> \brief ...
    2205              : !> \param section ...
    2206              : ! **************************************************************************************************
    2207        10624 :    SUBROUTINE create_helium_section(section)
    2208              :       TYPE(section_type), POINTER                        :: section
    2209              : 
    2210              :       TYPE(keyword_type), POINTER                        :: keyword
    2211              :       TYPE(section_type), POINTER                        :: print_key, subsection, subsubsection
    2212              : 
    2213        10624 :       CPASSERT(.NOT. ASSOCIATED(section))
    2214              : 
    2215              :       CALL section_create(section, __LOCATION__, name="HELIUM", &
    2216              :                           description="The section that controls optional helium solvent"// &
    2217              :                           " environment (highly experimental, not for general use yet)", &
    2218        10624 :                           n_keywords=31, n_subsections=11, repeats=.FALSE.)
    2219              : 
    2220        10624 :       NULLIFY (keyword)
    2221              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
    2222              :                           description="Whether or not to actually use this section", &
    2223        10624 :                           usage="silent", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2224        10624 :       CALL section_add_keyword(section, keyword)
    2225        10624 :       CALL keyword_release(keyword)
    2226              : 
    2227              :       CALL keyword_create(keyword, __LOCATION__, name="HELIUM_ONLY", &
    2228              :                           description="Simulate helium solvent only, "// &
    2229              :                           "disregard solute entirely", &
    2230              :                           repeats=.FALSE., default_l_val=.FALSE., &
    2231        10624 :                           lone_keyword_l_val=.TRUE.)
    2232        10624 :       CALL section_add_keyword(section, keyword)
    2233        10624 :       CALL keyword_release(keyword)
    2234              : 
    2235              :       CALL keyword_create(keyword, __LOCATION__, name="INTERACTION_POT_SCAN", &
    2236              :                           description="Scan solute-helium interaction potential, "// &
    2237              :                           "cubefile parameters set in subsection RHO", &
    2238              :                           repeats=.FALSE., default_l_val=.FALSE., &
    2239        10624 :                           lone_keyword_l_val=.TRUE.)
    2240        10624 :       CALL section_add_keyword(section, keyword)
    2241        10624 :       CALL keyword_release(keyword)
    2242              : 
    2243              :       CALL keyword_create(keyword, __LOCATION__, name="NUM_ENV", &
    2244              :                           description="Number of independent helium environments", &
    2245        10624 :                           repeats=.FALSE., default_i_val=1)
    2246        10624 :       CALL section_add_keyword(section, keyword)
    2247        10624 :       CALL keyword_release(keyword)
    2248              : 
    2249              :       CALL keyword_create(keyword, __LOCATION__, name="POTENTIAL_FILE_NAME", &
    2250              :                           description="Name of the Helium interaction potential file", &
    2251        10624 :                           repeats=.FALSE., default_lc_val="HELIUM.POT")
    2252        10624 :       CALL section_add_keyword(section, keyword)
    2253        10624 :       CALL keyword_release(keyword)
    2254              : 
    2255              :       CALL keyword_create(keyword, __LOCATION__, name="GET_FORCES", &
    2256              :                           description="Get average MC forces or last MC forces to propagate MD", &
    2257              :                           usage="GET_FORCES (AVERAGE|LAST)", &
    2258              :                           default_i_val=helium_forces_average, &
    2259              :                           enum_c_vals=s2a("AVERAGE", "LAST"), &
    2260        10624 :                           enum_i_vals=[helium_forces_average, helium_forces_last])
    2261        10624 :       CALL section_add_keyword(section, keyword)
    2262        10624 :       CALL keyword_release(keyword)
    2263              : 
    2264              :       CALL keyword_create(keyword, __LOCATION__, name="SOLUTE_INTERACTION", &
    2265              :                           description="Interaction potential between helium and the solute", &
    2266              :                           usage="SOLUTE_INTERACTION (NONE | MWATER | NNP)", &
    2267              :                           default_i_val=helium_solute_intpot_none, &
    2268              :                           enum_c_vals=s2a("NONE", "MWATER", "NNP"), &
    2269              :                           enum_i_vals=[ &
    2270              :                           helium_solute_intpot_none, &
    2271              :                           helium_solute_intpot_mwater, &
    2272              :                           helium_solute_intpot_nnp], &
    2273              :                           enum_desc=s2a( &
    2274              :                           "No interaction with solute", &
    2275              :                           "Test interaction with wrong Water", &
    2276        10624 :                           "Interaction with NNP"))
    2277        10624 :       CALL section_add_keyword(section, keyword)
    2278        10624 :       CALL keyword_release(keyword)
    2279              : 
    2280              :       CALL keyword_create(keyword, __LOCATION__, name="NATOMS", &
    2281              :                           description="Number of helium atoms", &
    2282        10624 :                           repeats=.FALSE., default_i_val=64)
    2283        10624 :       CALL section_add_keyword(section, keyword)
    2284        10624 :       CALL keyword_release(keyword)
    2285              : 
    2286              :       CALL keyword_create(keyword, __LOCATION__, name="NBEADS", &
    2287              :                           description="Number of helium path integral beads", &
    2288        10624 :                           repeats=.FALSE., default_i_val=25)
    2289        10624 :       CALL section_add_keyword(section, keyword)
    2290        10624 :       CALL keyword_release(keyword)
    2291              : 
    2292              :       CALL keyword_create(keyword, __LOCATION__, name="RNG_SEED", &
    2293              :                           description="Initial seed for the (pseudo)random number "// &
    2294              :                           "generator that controls helium coordinate generation and propagation.", &
    2295              :                           usage="RNG_SEED <INTEGER>", default_i_val=12345, &
    2296        10624 :                           repeats=.FALSE.)
    2297        10624 :       CALL section_add_keyword(section, keyword)
    2298        10624 :       CALL keyword_release(keyword)
    2299              : 
    2300              :       CALL keyword_create(keyword, __LOCATION__, name="N_INNER", &
    2301              :                           variants=s2a("INOROT"), &
    2302              :                           description="Number of MC iterations at the same time slice(s) "// &
    2303              :                           "(number of inner MC loop iterations)", &
    2304        10624 :                           repeats=.FALSE., default_i_val=6600)
    2305        10624 :       CALL section_add_keyword(section, keyword)
    2306        10624 :       CALL keyword_release(keyword)
    2307              : 
    2308              :       CALL keyword_create(keyword, __LOCATION__, name="N_OUTER", &
    2309              :                           variants=s2a("IROT"), &
    2310              :                           description="how often to reselect the time slice(s) to work on "// &
    2311              :                           "(number of outer MC loop iterations)", &
    2312        10624 :                           repeats=.FALSE., default_i_val=300)
    2313        10624 :       CALL section_add_keyword(section, keyword)
    2314        10624 :       CALL keyword_release(keyword)
    2315              : 
    2316              :       CALL keyword_create(keyword, __LOCATION__, name="SAMPLING_METHOD", &
    2317              :                           description="Choose between Ceperley or the worm algorithm", &
    2318              :                           usage="SAMPLING_METHOD (CEPERLEY|WORM)", &
    2319              :                           default_i_val=helium_sampling_ceperley, &
    2320              :                           enum_c_vals=s2a("CEPERLEY", "WORM"), &
    2321        10624 :                           enum_i_vals=[helium_sampling_ceperley, helium_sampling_worm])
    2322        10624 :       CALL section_add_keyword(section, keyword)
    2323        10624 :       CALL keyword_release(keyword)
    2324              : 
    2325              :       CALL keyword_create(keyword, __LOCATION__, name="COORD_INIT_TEMP", &
    2326              :                           description="Temperature for thermal gaussian initialization of the helium."// &
    2327              :                           " Negative values correspond to a hot start.", &
    2328              :                           default_r_val=cp_unit_to_cp2k(300._dp, "K"), &
    2329        10624 :                           unit_str="K")
    2330        10624 :       CALL section_add_keyword(section, keyword)
    2331        10624 :       CALL keyword_release(keyword)
    2332              : 
    2333              :       CALL keyword_create(keyword, __LOCATION__, name="SOLUTE_RADIUS", &
    2334              :                           description="Radius of the solute molecule for prevention of"// &
    2335              :                           " coordinate collision during initialization", &
    2336              :                           default_r_val=cp_unit_to_cp2k(0.0_dp, "angstrom"), &
    2337        10624 :                           repeats=.FALSE., type_of_var=real_t, unit_str="angstrom")
    2338        10624 :       CALL section_add_keyword(section, keyword)
    2339        10624 :       CALL keyword_release(keyword)
    2340              : 
    2341              :       ! Helium-solute interaction NNP
    2342        10624 :       NULLIFY (subsection)
    2343              :       CALL section_create(subsection, __LOCATION__, name="NNP", &
    2344              :                           description="This section contains all information to run an helium-solute "// &
    2345              :                           "interaction Neural Network Potential (NNP) calculation.", &
    2346        10624 :                           n_keywords=4, n_subsections=3, repeats=.FALSE.)
    2347              : 
    2348              :       CALL keyword_create(keyword, __LOCATION__, name="NNP_INPUT_FILE_NAME", &
    2349              :                           description="File containing the input information for the setup "// &
    2350              :                           "of the NNP (n2p2/RuNNer format). ", &
    2351        10624 :                           repeats=.FALSE., default_lc_val="input.nn")
    2352        10624 :       CALL section_add_keyword(subsection, keyword)
    2353        10624 :       CALL keyword_release(keyword)
    2354              : 
    2355              :       CALL keyword_create(keyword, __LOCATION__, name="SCALE_FILE_NAME", &
    2356              :                           description="File containing the scaling information for the symmetry "// &
    2357              :                           "functions of the NNP. ", &
    2358        10624 :                           repeats=.FALSE., default_lc_val="scaling.data")
    2359        10624 :       CALL section_add_keyword(subsection, keyword)
    2360        10624 :       CALL keyword_release(keyword)
    2361              : 
    2362              :       CALL keyword_create(keyword, __LOCATION__, name="RAD_SPLINE_N", &
    2363              :                           description="Number of knots per radial group in the cubic-Hermite "// &
    2364              :                           "spline tables that tabulate the radial symmetry-function product "// &
    2365              :                           "y(r) = exp(-eta*(r-rs)^2) * fcut(r). Cubic-Hermite per-evaluation "// &
    2366              :                           "error scales as O(1/n^4); the default keeps the spline residual "// &
    2367              :                           "inside the NNP regression tolerance for a radial cutoff of "// &
    2368              :                           "~12 bohr. Models with larger cutoffs or stricter tolerances may "// &
    2369              :                           "need a larger n. Memory cost scales linearly in n per radial group.", &
    2370              :                           repeats=.FALSE., &
    2371              :                           n_var=1, &
    2372              :                           type_of_var=integer_t, &
    2373              :                           default_i_val=8192, &
    2374        10624 :                           usage="RAD_SPLINE_N 8192")
    2375        10624 :       CALL section_add_keyword(subsection, keyword)
    2376        10624 :       CALL keyword_release(keyword)
    2377              : 
    2378              :       CALL keyword_create(keyword, __LOCATION__, name="VERLET_SKIN", &
    2379              :                           description="Verlet skin distance for the NNP descriptor neighbour "// &
    2380              :                           "cell-list. The neighbour-list cutoff is (symmetry-function cutoff "// &
    2381              :                           "+ skin); the cell-list chain is rebuilt only when an atom drifts "// &
    2382              :                           "more than skin/2 from its rebuild-time position, analogous to the "// &
    2383              :                           "LAMMPS 'neighbor <skin> bin' command. Larger skin reduces the "// &
    2384              :                           "rebuild rate but enlarges the per-atom neighbour list. A negative "// &
    2385              :                           "value (default) selects the automatic heuristic "// &
    2386              :                           "MIN(0.5 bohr, 0.1*cutoff). Useful upper bound is half the smallest "// &
    2387              :                           "perpendicular cell width.", &
    2388              :                           repeats=.FALSE., &
    2389              :                           n_var=1, &
    2390              :                           type_of_var=real_t, &
    2391              :                           default_r_val=-1.0_dp, &
    2392              :                           unit_str="bohr", &
    2393        10624 :                           usage="VERLET_SKIN [bohr] 0.5")
    2394        10624 :       CALL section_add_keyword(subsection, keyword)
    2395        10624 :       CALL keyword_release(keyword)
    2396              : 
    2397        10624 :       NULLIFY (subsubsection)
    2398              :       CALL section_create(subsubsection, __LOCATION__, name="SR_CUTOFF", &
    2399              :                           description="Section for failsafe short range cutoffs for the NNPs, "// &
    2400              :                           "if the distance between solvent and specified solute element becomes "// &
    2401              :                           "smaller than the given cutoff, an artifical repulsive potential is "// &
    2402              :                           "introduced. Note this is only meant to prevent such configurations, "// &
    2403              :                           "not to physically sample them.", &
    2404        10624 :                           n_keywords=2, n_subsections=0, repeats=.TRUE.)
    2405              : 
    2406              :       CALL keyword_create(keyword, __LOCATION__, name="ELEMENT", &
    2407              :                           description="Solute element for which the short range cutoff is in effect", &
    2408        10624 :                           repeats=.FALSE., default_c_val="none")
    2409        10624 :       CALL section_add_keyword(subsubsection, keyword)
    2410        10624 :       CALL keyword_release(keyword)
    2411              : 
    2412              :       CALL keyword_create(keyword, __LOCATION__, name="RADIUS", &
    2413              :                           description="Short range cutoff in Angstrom, below this cutoff, the energy "// &
    2414              :                           "is replaced by a sizable positive value plus a 1/r**2 term to guide particles "// &
    2415              :                           "away from each other.", &
    2416              :                           default_r_val=cp_unit_to_cp2k(0.0_dp, "angstrom"), &
    2417        10624 :                           repeats=.FALSE., type_of_var=real_t, unit_str="angstrom")
    2418        10624 :       CALL section_add_keyword(subsubsection, keyword)
    2419        10624 :       CALL keyword_release(keyword)
    2420        10624 :       CALL section_add_subsection(subsection, subsubsection)
    2421        10624 :       CALL section_release(subsubsection)
    2422              : 
    2423        10624 :       NULLIFY (subsubsection)
    2424              :       CALL section_create(subsubsection, __LOCATION__, name="MODEL", &
    2425              :                           description="Section for a single NNP model. If this section is repeated, "// &
    2426              :                           "a committee model (C-NNP)is used where the NNP members share the same "// &
    2427              :                           "symmetry functions. ", &
    2428        10624 :                           n_keywords=1, n_subsections=0, repeats=.TRUE.)
    2429              : 
    2430              :       CALL keyword_create(keyword, __LOCATION__, name="WEIGHTS", &
    2431              :                           description="File containing the weights for the artificial neural "// &
    2432              :                           "networks of the NNP. The specified name is extended by .XXX.data ", &
    2433        10624 :                           repeats=.FALSE., default_lc_val="weights")
    2434        10624 :       CALL section_add_keyword(subsubsection, keyword)
    2435        10624 :       CALL keyword_release(keyword)
    2436        10624 :       CALL section_add_subsection(subsection, subsubsection)
    2437        10624 :       CALL section_release(subsubsection)
    2438              : 
    2439              :       ! Create the PRINT subsection
    2440        10624 :       NULLIFY (subsubsection)
    2441              :       CALL section_create(subsubsection, __LOCATION__, name="PRINT", &
    2442              :                           description="Section of possible print options in NNP code.", &
    2443        10624 :                           n_keywords=0, n_subsections=3, repeats=.FALSE.)
    2444        10624 :       NULLIFY (print_key, keyword)
    2445              : 
    2446              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "ENERGIES", &
    2447              :                                        description="Controls the printing of the NNP energies.", &
    2448        10624 :                                        print_level=medium_print_level, common_iter_levels=1)
    2449        10624 :       CALL section_add_subsection(subsubsection, print_key)
    2450        10624 :       CALL section_release(print_key)
    2451              : 
    2452              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "FORCES_SIGMA", &
    2453              :                                        description="Controls the printing of the STD per atom of the NNP forces.", &
    2454        10624 :                                        print_level=medium_print_level, common_iter_levels=1)
    2455        10624 :       CALL section_add_subsection(subsubsection, print_key)
    2456        10624 :       CALL section_release(print_key)
    2457              : 
    2458              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "EXTRAPOLATION", &
    2459              :                                        description="If activated, output structures with extrapolation "// &
    2460              :                                        "warning in xyz-format", &
    2461        10624 :                                        print_level=medium_print_level, common_iter_levels=1)
    2462        10624 :       CALL section_add_subsection(subsubsection, print_key)
    2463        10624 :       CALL section_release(print_key)
    2464        10624 :       CALL section_add_subsection(subsection, subsubsection)
    2465        10624 :       CALL section_release(subsubsection)
    2466              : 
    2467        10624 :       CALL section_add_subsection(section, subsection)
    2468        10624 :       CALL section_release(subsection) ! release NNP subsection
    2469              : 
    2470              :       ! Ceperley's sampling algorithm
    2471        10624 :       NULLIFY (subsection)
    2472              :       CALL section_create(subsection, __LOCATION__, name="CEPERLEY", &
    2473              :                           description="Enables sampling with Ceperley's algorithm", &
    2474        10624 :                           n_keywords=2, n_subsections=1, repeats=.FALSE.)
    2475              : 
    2476              :       CALL keyword_create(keyword, __LOCATION__, name="BISECTION", &
    2477              :                           description="how many time slices to change at once (+1). "// &
    2478              :                           "Must be a power of 2 currently", &
    2479        10624 :                           repeats=.FALSE., default_i_val=8)
    2480        10624 :       CALL section_add_keyword(subsection, keyword)
    2481        10624 :       CALL keyword_release(keyword)
    2482              : 
    2483              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_PERM_CYCLE", &
    2484              :                           description="how large cyclic permutations to try", &
    2485        10624 :                           repeats=.FALSE., default_i_val=6)
    2486        10624 :       CALL section_add_keyword(subsection, keyword)
    2487        10624 :       CALL keyword_release(keyword)
    2488              : 
    2489        10624 :       NULLIFY (subsubsection)
    2490              :       CALL section_create(subsubsection, __LOCATION__, name="M-SAMPLING", &
    2491              :                           description="Permutation cycle length sampling settings", &
    2492        10624 :                           n_keywords=3, n_subsections=0, repeats=.FALSE.)
    2493              :       CALL keyword_create(keyword, __LOCATION__, name="DISTRIBUTION-TYPE", &
    2494              :                           description="Distribution from which the cycle length m is sampled", &
    2495              :                           usage="DISTRIBUTION-TYPE (SINGLEV|UNIFORM|LINEAR|QUADRATIC|EXPONENTIAL|GAUSSIAN)", &
    2496              :                           default_i_val=helium_mdist_uniform, &
    2497              :                           enum_c_vals=s2a( &
    2498              :                           "SINGLEV", &
    2499              :                           "UNIFORM", &
    2500              :                           "LINEAR", &
    2501              :                           "QUADRATIC", &
    2502              :                           "EXPONENTIAL", &
    2503              :                           "GAUSSIAN"), &
    2504              :                           enum_i_vals=[ &
    2505              :                           helium_mdist_singlev, &
    2506              :                           helium_mdist_uniform, &
    2507              :                           helium_mdist_linear, &
    2508              :                           helium_mdist_quadratic, &
    2509              :                           helium_mdist_exponential, &
    2510        10624 :                           helium_mdist_gaussian])
    2511        10624 :       CALL section_add_keyword(subsubsection, keyword)
    2512        10624 :       CALL keyword_release(keyword)
    2513              :       CALL keyword_create(keyword, __LOCATION__, name="M-VALUE", &
    2514              :                           description="Value of m treated in a special way "// &
    2515              :                           "(specific behavior depends on the distribution type chosen)", &
    2516              :                           repeats=.FALSE., &
    2517        10624 :                           default_i_val=1)
    2518        10624 :       CALL section_add_keyword(subsubsection, keyword)
    2519        10624 :       CALL keyword_release(keyword)
    2520              :       CALL keyword_create(keyword, __LOCATION__, name="M-RATIO", &
    2521              :                           description="Probability ratio betw M-VALUE and other cycle lengths", &
    2522              :                           repeats=.FALSE., &
    2523        10624 :                           default_r_val=1.0_dp)
    2524        10624 :       CALL section_add_keyword(subsubsection, keyword)
    2525        10624 :       CALL keyword_release(keyword)
    2526        10624 :       CALL section_add_subsection(subsection, subsubsection)
    2527        10624 :       CALL section_release(subsubsection)
    2528        10624 :       CALL section_add_subsection(section, subsection)
    2529        10624 :       CALL section_release(subsection) ! release CEPERLEY subsection
    2530              : 
    2531              : ! worm algorithm parameters:
    2532        10624 :       NULLIFY (subsection)
    2533              :       CALL section_create(subsection, __LOCATION__, name="WORM", &
    2534              :                           description="Enables sampling via the canonical worm algorithm adapted from Bonisegni", &
    2535        10624 :                           n_keywords=12, n_subsections=0, repeats=.FALSE.)
    2536              : 
    2537              :       CALL keyword_create(keyword, __LOCATION__, name="CENTROID_DRMAX", &
    2538              :                           description="Maximum displacement allowed for the centroid moves", &
    2539        10624 :                           repeats=.FALSE., default_r_val=0.5_dp)
    2540        10624 :       CALL section_add_keyword(subsection, keyword)
    2541        10624 :       CALL keyword_release(keyword)
    2542              : 
    2543              :       CALL keyword_create(keyword, __LOCATION__, name="STAGING_L", &
    2544              :                           description="From 2 up to max. L-1 beads will be moved", &
    2545        10624 :                           repeats=.FALSE., default_i_val=5)
    2546        10624 :       CALL section_add_keyword(subsection, keyword)
    2547        10624 :       CALL keyword_release(keyword)
    2548              : 
    2549              :       CALL keyword_create(keyword, __LOCATION__, name="OPEN_CLOSE_SCALE", &
    2550              :                           description="Open/Close acceptance adjustment parameter", &
    2551        10624 :                           repeats=.FALSE., default_r_val=0.01_dp)
    2552        10624 :       CALL section_add_keyword(subsection, keyword)
    2553        10624 :       CALL keyword_release(keyword)
    2554              : 
    2555              :       CALL keyword_create(keyword, __LOCATION__, name="ALLOW_OPEN", &
    2556              :                           description="Enable bosonic exchange sampling", &
    2557        10624 :                           repeats=.FALSE., default_l_val=.TRUE.)
    2558        10624 :       CALL section_add_keyword(subsection, keyword)
    2559        10624 :       CALL keyword_release(keyword)
    2560              : 
    2561              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_OPEN_CYCLES", &
    2562              :                          description="If > 0 then reset positions and permutations to the previous closed &
    2563              :                          & state if staying more than this amount of MC cycles in open state to avoid staying &
    2564              :                          & trapped in open state for too long. Use with caution as it can potentially introduce &
    2565              :                          & a bias in the sampling.", &
    2566        10624 :                           repeats=.FALSE., default_i_val=0)
    2567        10624 :       CALL section_add_keyword(subsection, keyword)
    2568        10624 :       CALL keyword_release(keyword)
    2569              : 
    2570              :       CALL keyword_create(keyword, __LOCATION__, name="SHOW_STATISTICS", &
    2571              :                           description="Show sampling statistics in output", &
    2572        10624 :                           repeats=.FALSE., default_l_val=.TRUE.)
    2573        10624 :       CALL section_add_keyword(subsection, keyword)
    2574        10624 :       CALL keyword_release(keyword)
    2575              : 
    2576              :       CALL keyword_create(keyword, __LOCATION__, name="CENTROID_WEIGHT", &
    2577              :                           description="Absolute weight of the centroid move", &
    2578        10624 :                           repeats=.FALSE., default_i_val=10)
    2579        10624 :       CALL section_add_keyword(subsection, keyword)
    2580        10624 :       CALL keyword_release(keyword)
    2581              : 
    2582              :       CALL keyword_create(keyword, __LOCATION__, name="STAGING_WEIGHT", &
    2583              :                           description="Absolute weight of the staging move", &
    2584        10624 :                           repeats=.FALSE., default_i_val=30)
    2585        10624 :       CALL section_add_keyword(subsection, keyword)
    2586        10624 :       CALL keyword_release(keyword)
    2587              : 
    2588              :       CALL keyword_create(keyword, __LOCATION__, name="OPEN_CLOSE_WEIGHT", &
    2589              :                           description="Absolute weight of the open/close move", &
    2590        10624 :                           repeats=.FALSE., default_i_val=10)
    2591        10624 :       CALL section_add_keyword(subsection, keyword)
    2592        10624 :       CALL keyword_release(keyword)
    2593              : 
    2594              :       CALL keyword_create(keyword, __LOCATION__, name="HEAD_TAIL_WEIGHT", &
    2595              :                           description="Absolute weight of the head/tail moves (both)", &
    2596        10624 :                           repeats=.FALSE., default_i_val=10)
    2597        10624 :       CALL section_add_keyword(subsection, keyword)
    2598        10624 :       CALL keyword_release(keyword)
    2599              : 
    2600              :       CALL keyword_create(keyword, __LOCATION__, name="CRAWL_WEIGHT", &
    2601              :                           description="Absolute weight of the crawl bwd/fwd moves (both)", &
    2602        10624 :                           repeats=.FALSE., default_i_val=10)
    2603        10624 :       CALL section_add_keyword(subsection, keyword)
    2604        10624 :       CALL keyword_release(keyword)
    2605              : 
    2606              :       CALL keyword_create(keyword, __LOCATION__, name="CRAWL_REPETITION", &
    2607              :                           description="Number of repeated crawl moves", &
    2608        10624 :                           repeats=.FALSE., default_i_val=4)
    2609        10624 :       CALL section_add_keyword(subsection, keyword)
    2610        10624 :       CALL keyword_release(keyword)
    2611              : 
    2612              :       CALL keyword_create(keyword, __LOCATION__, name="SWAP_WEIGHT", &
    2613              :                           description="Absolute weight of the crawl move", &
    2614        10624 :                           repeats=.FALSE., default_i_val=10)
    2615        10624 :       CALL section_add_keyword(subsection, keyword)
    2616        10624 :       CALL keyword_release(keyword)
    2617              : 
    2618        10624 :       CALL section_add_subsection(section, subsection)
    2619        10624 :       CALL section_release(subsection) ! release WORM subsection
    2620              : 
    2621              : ! end of worm parameters
    2622              : 
    2623              :       CALL keyword_create(keyword, __LOCATION__, name="PERIODIC", &
    2624              :                           description="Use periodic boundary conditions for helium", &
    2625        10624 :                           repeats=.FALSE., default_l_val=.FALSE.)
    2626        10624 :       CALL section_add_keyword(section, keyword)
    2627        10624 :       CALL keyword_release(keyword)
    2628              : 
    2629              :       CALL keyword_create(keyword, __LOCATION__, name="CELL_SIZE", &
    2630              :                           description="PBC unit cell size (NOTE 1: density, number of atoms"// &
    2631              :                           " and volume are interdependent - give only two of them; "// &
    2632              :                           "NOTE 2: for small cell sizes specify NATOMS instead)", &
    2633        10624 :                           repeats=.FALSE., type_of_var=real_t, unit_str="angstrom")
    2634        10624 :       CALL section_add_keyword(section, keyword)
    2635        10624 :       CALL keyword_release(keyword)
    2636              : 
    2637              :       CALL keyword_create(keyword, __LOCATION__, name="CELL_SHAPE", &
    2638              :                           description="PBC unit cell shape for helium", &
    2639              :                           usage="CELL_SHAPE (CUBE|OCTAHEDRON)", &
    2640              :                           default_i_val=helium_cell_shape_cube, &
    2641              :                           enum_c_vals=s2a("CUBE", "OCTAHEDRON"), &
    2642        10624 :                           enum_i_vals=[helium_cell_shape_cube, helium_cell_shape_octahedron])
    2643        10624 :       CALL section_add_keyword(section, keyword)
    2644        10624 :       CALL keyword_release(keyword)
    2645              : 
    2646              :       CALL keyword_create(keyword, __LOCATION__, name="DROPLET_RADIUS", &
    2647              :                           description="Reject a move if any of the new positions does not lie within"// &
    2648              :                           "  this range from the center of gravity", &
    2649              :                           repeats=.FALSE., type_of_var=real_t, default_r_val=HUGE(1.0_dp), &
    2650        10624 :                           unit_str="angstrom")
    2651        10624 :       CALL section_add_keyword(section, keyword)
    2652        10624 :       CALL keyword_release(keyword)
    2653              : 
    2654              :       CALL keyword_create(keyword, __LOCATION__, name="DENSITY", &
    2655              :                           description="trial density of helium for determining the helium "// &
    2656              :                           "box size", &
    2657              :                           repeats=.FALSE., &
    2658              :                           default_r_val=cp_unit_to_cp2k(0.02186_dp, "angstrom^-3"), &
    2659        10624 :                           unit_str="angstrom^-3")
    2660        10624 :       CALL section_add_keyword(section, keyword)
    2661        10624 :       CALL keyword_release(keyword)
    2662              : 
    2663              :       CALL keyword_create(keyword, __LOCATION__, name="PRESAMPLE", &
    2664              :                           description="Presample He coordinates before first PIMD step", &
    2665        10624 :                           repeats=.FALSE., default_l_val=.FALSE.)
    2666        10624 :       CALL section_add_keyword(section, keyword)
    2667        10624 :       CALL keyword_release(keyword)
    2668              : 
    2669              :       CALL section_create(subsection, __LOCATION__, name="RDF", &
    2670              :                           description="Radial distribution settings", &
    2671        10624 :                           n_keywords=5, n_subsections=0, repeats=.FALSE.)
    2672              : 
    2673              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
    2674              :                           description="Whether or not to actually calculate this property", &
    2675        10624 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2676        10624 :       CALL section_add_keyword(subsection, keyword)
    2677        10624 :       CALL keyword_release(keyword)
    2678              : 
    2679              :       CALL keyword_create(keyword, __LOCATION__, name="MAXR", &
    2680              :                           description="Maximum RDF range, defaults to unit cell size", &
    2681              :                           repeats=.FALSE., type_of_var=real_t, &
    2682        10624 :                           unit_str="angstrom")
    2683        10624 :       CALL section_add_keyword(subsection, keyword)
    2684        10624 :       CALL keyword_release(keyword)
    2685              : 
    2686              :       CALL keyword_create(keyword, __LOCATION__, name="NBIN", &
    2687              :                           description="Number of bins", &
    2688              :                           repeats=.FALSE., &
    2689        10624 :                           default_i_val=250)
    2690        10624 :       CALL section_add_keyword(subsection, keyword)
    2691        10624 :       CALL keyword_release(keyword)
    2692              : 
    2693              :       CALL keyword_create(keyword, __LOCATION__, name="SOLUTE_HE", &
    2694              :                           description="Whether or not to calculate solute-He RDFs (if solute is present)", &
    2695        10624 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
    2696        10624 :       CALL section_add_keyword(subsection, keyword)
    2697        10624 :       CALL keyword_release(keyword)
    2698              : 
    2699              :       CALL keyword_create(keyword, __LOCATION__, name="HE_HE", &
    2700              :                           description="Whether or not to calculate He-He RDFs", &
    2701        10624 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2702        10624 :       CALL section_add_keyword(subsection, keyword)
    2703        10624 :       CALL keyword_release(keyword)
    2704              : 
    2705        10624 :       CALL section_add_subsection(section, subsection)
    2706        10624 :       CALL section_release(subsection)
    2707              : 
    2708        10624 :       NULLIFY (subsection)
    2709              :       CALL section_create(subsection, __LOCATION__, name="RHO", &
    2710              :                           description="Spatial distribution settings", &
    2711        10624 :                           n_keywords=10, n_subsections=0, repeats=.FALSE.)
    2712              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
    2713              :                           description="Whether or not to actually calculate densities "// &
    2714              :                           "(requires significant amount of memory, depending on the value of NBIN)", &
    2715        10624 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
    2716        10624 :       CALL section_add_keyword(subsection, keyword)
    2717        10624 :       CALL keyword_release(keyword)
    2718              :       CALL keyword_create(keyword, __LOCATION__, name="NBIN", &
    2719              :                           description="Number of grid points in each direction for density binning", &
    2720              :                           repeats=.FALSE., &
    2721        10624 :                           default_i_val=100)
    2722        10624 :       CALL section_add_keyword(subsection, keyword)
    2723        10624 :       CALL keyword_release(keyword)
    2724              :       !
    2725              :       CALL keyword_create(keyword, __LOCATION__, name="MIN_CYCLE_LENGTHS_WDG", &
    2726              :                           description="Density of winding paths "// &
    2727              :                           "not shorter than the given length", &
    2728              :                           repeats=.FALSE., usage="MIN_CYCLE_LENGTHS_WDG <INT> <INT> .. <INT>", &
    2729        10624 :                           type_of_var=integer_t, n_var=-1)
    2730        10624 :       CALL section_add_keyword(subsection, keyword)
    2731        10624 :       CALL keyword_release(keyword)
    2732              :       !
    2733              :       CALL keyword_create(keyword, __LOCATION__, name="MIN_CYCLE_LENGTHS_NON", &
    2734              :                           description="Density of non-winding paths "// &
    2735              :                           "not shorter than the given length", &
    2736              :                           repeats=.FALSE., usage="MIN_CYCLE_LENGTHS_NON <INT> <INT> .. <INT>", &
    2737        10624 :                           type_of_var=integer_t, n_var=-1)
    2738        10624 :       CALL section_add_keyword(subsection, keyword)
    2739        10624 :       CALL keyword_release(keyword)
    2740              :       !
    2741              :       CALL keyword_create(keyword, __LOCATION__, name="MIN_CYCLE_LENGTHS_ALL", &
    2742              :                           description="Density of all paths "// &
    2743              :                           "not shorter than the given length", &
    2744              :                           repeats=.FALSE., usage="MIN_CYCLE_LENGTHS_ALL <INT> <INT> .. <INT>", &
    2745        10624 :                           type_of_var=integer_t, n_var=-1)
    2746        10624 :       CALL section_add_keyword(subsection, keyword)
    2747        10624 :       CALL keyword_release(keyword)
    2748              :       !
    2749              :       CALL keyword_create(keyword, __LOCATION__, name="ATOM_NUMBER", &
    2750              :                           description="Atom number density", &
    2751              :                           repeats=.FALSE., &
    2752              :                           type_of_var=logical_t, &
    2753              :                           default_l_val=.TRUE., &
    2754        10624 :                           lone_keyword_l_val=.TRUE.)
    2755        10624 :       CALL section_add_keyword(subsection, keyword)
    2756        10624 :       CALL keyword_release(keyword)
    2757              :       !
    2758              :       CALL keyword_create(keyword, __LOCATION__, name="PROJECTED_AREA_2", &
    2759              :                           description="Projected area squared density, A*A(r)", &
    2760              :                           repeats=.FALSE., &
    2761              :                           type_of_var=logical_t, &
    2762              :                           default_l_val=.FALSE., &
    2763        10624 :                           lone_keyword_l_val=.TRUE.)
    2764        10624 :       CALL section_add_keyword(subsection, keyword)
    2765        10624 :       CALL keyword_release(keyword)
    2766              :       !
    2767              :       CALL keyword_create(keyword, __LOCATION__, name="WINDING_NUMBER_2", &
    2768              :                           description="Winding number squared density, W*W(r)", &
    2769              :                           repeats=.FALSE., &
    2770              :                           type_of_var=logical_t, &
    2771              :                           default_l_val=.FALSE., &
    2772        10624 :                           lone_keyword_l_val=.TRUE.)
    2773        10624 :       CALL section_add_keyword(subsection, keyword)
    2774        10624 :       CALL keyword_release(keyword)
    2775              :       !
    2776              :       CALL keyword_create(keyword, __LOCATION__, name="WINDING_CYCLE_2", &
    2777              :                           description="Winding number squared density, W^2(r)", &
    2778              :                           repeats=.FALSE., &
    2779              :                           type_of_var=logical_t, &
    2780              :                           default_l_val=.FALSE., &
    2781        10624 :                           lone_keyword_l_val=.TRUE.)
    2782        10624 :       CALL section_add_keyword(subsection, keyword)
    2783        10624 :       CALL keyword_release(keyword)
    2784              :       !
    2785              :       CALL keyword_create(keyword, __LOCATION__, name="MOMENT_OF_INERTIA", &
    2786              :                           description="Moment of inertia density", &
    2787              :                           repeats=.FALSE., &
    2788              :                           type_of_var=logical_t, &
    2789              :                           default_l_val=.FALSE., &
    2790        10624 :                           lone_keyword_l_val=.TRUE.)
    2791        10624 :       CALL section_add_keyword(subsection, keyword)
    2792        10624 :       CALL keyword_release(keyword)
    2793              : 
    2794        10624 :       CALL section_add_subsection(section, subsection)
    2795        10624 :       CALL section_release(subsection)
    2796              :       ! end of subsection RHO
    2797              : 
    2798        10624 :       CALL create_coord_section(subsection, "HELIUM")
    2799        10624 :       CALL section_add_subsection(section, subsection)
    2800        10624 :       CALL section_release(subsection)
    2801              : 
    2802              :       CALL section_create(subsection, __LOCATION__, name="PERM", &
    2803              :                           description="Permutation state used for restart", &
    2804        10624 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
    2805              :       CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
    2806              :                           description="Specify particle index permutation for every "// &
    2807              :                           "helium atom", repeats=.TRUE., usage="<INT> <INT> .. <INT>", &
    2808        10624 :                           type_of_var=integer_t, n_var=-1)
    2809        10624 :       CALL section_add_keyword(subsection, keyword)
    2810        10624 :       CALL keyword_release(keyword)
    2811        10624 :       CALL section_add_subsection(section, subsection)
    2812        10624 :       CALL section_release(subsection)
    2813              : 
    2814              :       CALL section_create(subsection, __LOCATION__, name="AVERAGES", &
    2815              :                           description="Average properties (used for restarts)", &
    2816        10624 :                           n_keywords=7, n_subsections=0, repeats=.FALSE.)
    2817              :       CALL keyword_create(keyword, __LOCATION__, name="PROJECTED_AREA", &
    2818              :                           description="Projected area vector for all environments", &
    2819              :                           repeats=.TRUE., usage="PROJECTED_AREA <REAL> <REAL> .. <REAL>", &
    2820        10624 :                           type_of_var=real_t, n_var=-1)
    2821        10624 :       CALL section_add_keyword(subsection, keyword)
    2822        10624 :       CALL keyword_release(keyword)
    2823              :       CALL keyword_create(keyword, __LOCATION__, name="PROJECTED_AREA_2", &
    2824              :                           description="Projected area vector squared for all environments", &
    2825              :                           repeats=.TRUE., usage="PROJECTED_AREA_2 <REAL> <REAL> .. <REAL>", &
    2826        10624 :                           type_of_var=real_t, n_var=-1)
    2827        10624 :       CALL section_add_keyword(subsection, keyword)
    2828        10624 :       CALL keyword_release(keyword)
    2829              :       CALL keyword_create(keyword, __LOCATION__, name="WINDING_NUMBER_2", &
    2830              :                           description="Winding number vector squared for all environments", &
    2831              :                           repeats=.TRUE., usage="WINDING_NUMBER_2 <REAL> <REAL> .. <REAL>", &
    2832        10624 :                           type_of_var=real_t, n_var=-1)
    2833        10624 :       CALL section_add_keyword(subsection, keyword)
    2834        10624 :       CALL keyword_release(keyword)
    2835              :       CALL keyword_create(keyword, __LOCATION__, name="MOMENT_OF_INERTIA", &
    2836              :                           description="Moment of inertia vector for all environments", &
    2837              :                           repeats=.TRUE., usage="MOMENT_OF_INERTIA <REAL> <REAL> .. <REAL>", &
    2838        10624 :                           type_of_var=real_t, n_var=-1)
    2839        10624 :       CALL section_add_keyword(subsection, keyword)
    2840        10624 :       CALL keyword_release(keyword)
    2841              :       CALL keyword_create(keyword, __LOCATION__, name="RDF", &
    2842              :                           description="Radial distributions averaged over all environments", &
    2843              :                           repeats=.TRUE., usage="RDF <REAL> <REAL> .. <REAL>", &
    2844        10624 :                           type_of_var=real_t, n_var=-1)
    2845        10624 :       CALL section_add_keyword(subsection, keyword)
    2846        10624 :       CALL keyword_release(keyword)
    2847              :       CALL keyword_create(keyword, __LOCATION__, name="RHO", &
    2848              :                           description="Spatial distributions averaged over all environments", &
    2849              :                           repeats=.TRUE., usage="RHO <REAL> <REAL> .. <REAL>", &
    2850        10624 :                           type_of_var=real_t, n_var=-1)
    2851        10624 :       CALL section_add_keyword(subsection, keyword)
    2852        10624 :       CALL keyword_release(keyword)
    2853              :       CALL keyword_create(keyword, __LOCATION__, name="IWEIGHT", &
    2854              :                           description="Weight for the restarted quantities "// &
    2855              :                           "(number of MC steps used to calculate the accumulated averages)", &
    2856              :                           repeats=.FALSE., &
    2857        10624 :                           default_i_val=0)
    2858        10624 :       CALL section_add_keyword(subsection, keyword)
    2859        10624 :       CALL keyword_release(keyword)
    2860        10624 :       CALL section_add_subsection(section, subsection)
    2861        10624 :       CALL section_release(subsection)
    2862              : 
    2863              :       CALL section_create(subsection, __LOCATION__, name="FORCE", &
    2864              :                           description="Forces exerted by the helium on the solute system"// &
    2865              :                           " (used for restarts)", &
    2866        10624 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
    2867              :       CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
    2868              :                           description="Number of real values should be 3 * "// &
    2869              :                           "<num_solute_atoms> * <num_solute_beads>", repeats=.TRUE., &
    2870              :                           usage="<REAL> <REAL> .. <REAL>", type_of_var=real_t, &
    2871        10624 :                           n_var=-1)
    2872        10624 :       CALL section_add_keyword(subsection, keyword)
    2873        10624 :       CALL keyword_release(keyword)
    2874        10624 :       CALL section_add_subsection(section, subsection)
    2875        10624 :       CALL section_release(subsection)
    2876              : 
    2877              :       CALL section_create(subsection, __LOCATION__, name="RNG_STATE", &
    2878              :                           description="Random number generator state for all processors", &
    2879        10624 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
    2880              :       CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
    2881              :                           description="Three real arrays of DIMENSION(3,2) times two RNG "// &
    2882              :                           "streams - 36 real values per processor", &
    2883              :                           repeats=.TRUE., usage="automatically filled, do not edit by hand", &
    2884        10624 :                           type_of_var=real_t, n_var=-1)
    2885        10624 :       CALL section_add_keyword(subsection, keyword)
    2886        10624 :       CALL keyword_release(keyword)
    2887        10624 :       CALL section_add_subsection(section, subsection)
    2888        10624 :       CALL section_release(subsection)
    2889              : 
    2890              :       CALL section_create(subsection, __LOCATION__, name="PRINT", &
    2891              :                           description="The section that controls the output of the helium code", &
    2892        10624 :                           n_keywords=16, n_subsections=0, repeats=.FALSE.)
    2893              : 
    2894              :       ! *************************************************************************
    2895              :       !> Printkeys for properties output
    2896              :       ! *************************************************************************
    2897        10624 :       NULLIFY (print_key)
    2898              : 
    2899              :       ! Properties printed at SILENT print level
    2900              :       !
    2901              : 
    2902              :       ! Properties printed at LOW print level
    2903              :       !
    2904              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "ENERGY", &
    2905              :                                        description="Controls the output of helium energies"// &
    2906              :                                        " (averaged over MC step)", &
    2907        10624 :                                        print_level=low_print_level, common_iter_levels=1)
    2908        10624 :       CALL section_add_subsection(subsection, print_key)
    2909        10624 :       CALL section_release(print_key)
    2910              :       !
    2911              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PROJECTED_AREA_2_AVG", &
    2912              :                                        description="Controls the output of the average projected area squared vector", &
    2913        10624 :                                        print_level=low_print_level, common_iter_levels=1)
    2914        10624 :       CALL section_add_subsection(subsection, print_key)
    2915        10624 :       CALL section_release(print_key)
    2916              :       !
    2917              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "WINDING_NUMBER_2_AVG", &
    2918              :                                        description="Controls the output of the average winding number vector squared", &
    2919        10624 :                                        print_level=low_print_level, common_iter_levels=1)
    2920        10624 :       CALL section_add_subsection(subsection, print_key)
    2921        10624 :       CALL section_release(print_key)
    2922              :       !
    2923              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "MOMENT_OF_INERTIA_AVG", &
    2924              :                                        description="Controls the output of the average moment of inertia vector", &
    2925        10624 :                                        print_level=low_print_level, common_iter_levels=1)
    2926        10624 :       CALL section_add_subsection(subsection, print_key)
    2927        10624 :       CALL section_release(print_key)
    2928              : 
    2929              :       ! Properties printed at MEDIUM print level
    2930              :       !
    2931              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RDF", &
    2932              :                                        description="Controls the output of helium radial distribution functions", &
    2933        10624 :                                        print_level=medium_print_level, common_iter_levels=1)
    2934        10624 :       CALL section_add_subsection(subsection, print_key)
    2935        10624 :       CALL section_release(print_key)
    2936              : 
    2937              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RHO", &
    2938              :                                        description="Controls the output of the helium density "// &
    2939              :                                        "(Gaussian cube file format)", &
    2940              :                                        each_iter_names=s2a("PINT"), each_iter_values=[100], &
    2941              :                                        print_level=medium_print_level, common_iter_levels=1, &
    2942        10624 :                                        add_last=add_last_numeric)
    2943              :       CALL keyword_create(keyword, __LOCATION__, name="BACKUP_COPIES", &
    2944              :                           description="Specifies the maximum number of backup copies.", &
    2945              :                           usage="BACKUP_COPIES {int}", &
    2946        10624 :                           default_i_val=1)
    2947        10624 :       CALL section_add_keyword(print_key, keyword)
    2948        10624 :       CALL keyword_release(keyword)
    2949        10624 :       CALL section_add_subsection(subsection, print_key)
    2950        10624 :       CALL section_release(print_key)
    2951              :       !
    2952              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PROJECTED_AREA", &
    2953              :                                        description="Controls the output of the projected area vector", &
    2954        10624 :                                        print_level=medium_print_level, common_iter_levels=1)
    2955        10624 :       CALL section_add_subsection(subsection, print_key)
    2956        10624 :       CALL section_release(print_key)
    2957              :       !
    2958              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "WINDING_NUMBER", &
    2959              :                                        description="Controls the output of the winding number vector", &
    2960        10624 :                                        print_level=medium_print_level, common_iter_levels=1)
    2961        10624 :       CALL section_add_subsection(subsection, print_key)
    2962        10624 :       CALL section_release(print_key)
    2963              :       !
    2964              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "MOMENT_OF_INERTIA", &
    2965              :                                        description="Controls the output of the moment of inertia vector", &
    2966        10624 :                                        print_level=medium_print_level, common_iter_levels=1)
    2967        10624 :       CALL section_add_subsection(subsection, print_key)
    2968        10624 :       CALL section_release(print_key)
    2969              :       !
    2970              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PLENGTH", &
    2971              :                                        description="Controls the output of the helium permutation length", &
    2972        10624 :                                        print_level=medium_print_level, common_iter_levels=1)
    2973        10624 :       CALL section_add_subsection(subsection, print_key)
    2974        10624 :       CALL section_release(print_key)
    2975              : 
    2976              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "ACTION", &
    2977              :                                        description="Controls the output of the total helium action", &
    2978        10624 :                                        print_level=medium_print_level, common_iter_levels=1)
    2979        10624 :       CALL section_add_subsection(subsection, print_key)
    2980        10624 :       CALL section_release(print_key)
    2981              : 
    2982              :       ! Properties printed at HIGH print level
    2983              :       !
    2984              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "COORDINATES", &
    2985              :                                        description="Controls the output of helium coordinates", &
    2986        10624 :                                        print_level=high_print_level, common_iter_levels=1)
    2987              :       CALL keyword_create(keyword, __LOCATION__, name="FORMAT", &
    2988              :                           description="Output file format for the coordinates", &
    2989              :                           usage="FORMAT (PDB|XYZ)", &
    2990              :                           default_i_val=fmt_id_pdb, &
    2991              :                           enum_c_vals=s2a("PDB", "XYZ"), &
    2992              :                           enum_i_vals=[fmt_id_pdb, fmt_id_xyz], &
    2993              :                           enum_desc=s2a("Bead coordinates and connectivity is written in PDB format", &
    2994        10624 :                                         "Only bead coordinates are written in XYZ format"))
    2995        10624 :       CALL section_add_keyword(print_key, keyword)
    2996        10624 :       CALL keyword_release(keyword)
    2997        10624 :       CALL section_add_subsection(subsection, print_key)
    2998        10624 :       CALL section_release(print_key)
    2999              :       !
    3000              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PERM", &
    3001              :                                        description="Controls the output of the helium permutation state", &
    3002        10624 :                                        print_level=high_print_level, common_iter_levels=1)
    3003              :       CALL keyword_create(keyword, __LOCATION__, name="FORMAT", &
    3004              :                           description="Output format for the permutation", &
    3005              :                           usage="FORMAT (CYCLE|PLAIN)", &
    3006              :                           default_i_val=perm_cycle, &
    3007              :                           enum_c_vals=s2a("CYCLE", "PLAIN"), &
    3008              :                           enum_i_vals=[perm_cycle, perm_plain], &
    3009              :                           enum_desc=s2a( &
    3010              :                           "Cycle notation with winding cycles enclosed"// &
    3011              :                           " in '[...]' and non-winding ones enclosed in '(...)'", &
    3012        10624 :                           "Plain permutation output, i.e. P(1) ... P(N)"))
    3013        10624 :       CALL section_add_keyword(print_key, keyword)
    3014        10624 :       CALL keyword_release(keyword)
    3015        10624 :       CALL section_add_subsection(subsection, print_key)
    3016        10624 :       CALL section_release(print_key)
    3017              : 
    3018              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "FORCES", &
    3019              :                                        description="Controls the output of the helium forces on the solute", &
    3020        10624 :                                        print_level=high_print_level, common_iter_levels=1)
    3021        10624 :       CALL section_add_subsection(subsection, print_key)
    3022        10624 :       CALL section_release(print_key)
    3023              : 
    3024              :       ! Properties printed at DEBUG print level
    3025              :       !
    3026              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "ACCEPTS", &
    3027              :                                        description="Controls the output of the helium acceptance data", &
    3028        10624 :                                        print_level=debug_print_level, common_iter_levels=1)
    3029        10624 :       CALL section_add_subsection(subsection, print_key)
    3030        10624 :       CALL section_release(print_key)
    3031              :       !
    3032              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "FORCES_INST", &
    3033              :                                        description="Controls the output of the instantaneous helium forces on the solute", &
    3034        10624 :                                        print_level=debug_print_level, common_iter_levels=1)
    3035        10624 :       CALL section_add_subsection(subsection, print_key)
    3036        10624 :       CALL section_release(print_key)
    3037              : 
    3038        10624 :       CALL section_add_subsection(section, subsection)
    3039        10624 :       CALL section_release(subsection)
    3040              : 
    3041        10624 :       RETURN
    3042              :    END SUBROUTINE create_helium_section
    3043              : 
    3044              : END MODULE input_cp2k_motion
        

Generated by: LCOV version 2.0-1