LCOV - code coverage report
Current view: top level - src - input_cp2k_free_energy.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:123285f) Lines: 100.0 % 333 333
Test Date: 2026-11-04 00:58:17 Functions: 100.0 % 9 9

            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              : !> \author teo & fawzi
      12              : ! **************************************************************************************************
      13              : MODULE input_cp2k_free_energy
      14              :    USE bibliography, ONLY: BarducBus2008, &
      15              :                            VandenCic2006
      16              :    USE cp_output_handling, ONLY: add_last_numeric, &
      17              :                                  cp_print_key_section_create, &
      18              :                                  high_print_level, &
      19              :                                  low_print_level
      20              :    USE cp_units, ONLY: cp_unit_to_cp2k
      21              :    USE input_constants, ONLY: &
      22              :       do_fe_ac, do_fe_meta, do_fe_ui, do_wall_gaussian, do_wall_m, do_wall_none, do_wall_p, &
      23              :       do_wall_quadratic, do_wall_quartic, do_wall_reflective, gaussian
      24              :    USE input_keyword_types, ONLY: keyword_create, &
      25              :                                   keyword_release, &
      26              :                                   keyword_type
      27              :    USE input_section_types, ONLY: section_add_keyword, &
      28              :                                   section_add_subsection, &
      29              :                                   section_create, &
      30              :                                   section_release, &
      31              :                                   section_type
      32              :    USE input_val_types, ONLY: char_t, &
      33              :                               integer_t, &
      34              :                               lchar_t, &
      35              :                               real_t
      36              :    USE kinds, ONLY: dp
      37              :    USE string_utilities, ONLY: s2a
      38              : #include "./base/base_uses.f90"
      39              : 
      40              :    IMPLICIT NONE
      41              :    PRIVATE
      42              : 
      43              :    LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .TRUE.
      44              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_free_energy'
      45              : 
      46              :    PUBLIC :: create_metavar_section, &
      47              :              create_fe_section
      48              : 
      49              : !***
      50              : CONTAINS
      51              : 
      52              : ! **************************************************************************************************
      53              : !> \brief creates the free energy section
      54              : !> \param section the section to be created
      55              : !> \author teo
      56              : ! **************************************************************************************************
      57         1462 :    SUBROUTINE create_fe_section(section)
      58              :       TYPE(section_type), POINTER                        :: section
      59              : 
      60              :       TYPE(keyword_type), POINTER                        :: keyword
      61              :       TYPE(section_type), POINTER                        :: print_key, subsection
      62              : 
      63         1462 :       NULLIFY (subsection, keyword, print_key)
      64         1462 :       CPASSERT(.NOT. ASSOCIATED(section))
      65              :       CALL section_create(section, __LOCATION__, name="free_energy", &
      66              :                           description="Controls the calculation of free energy and free energy derivatives"// &
      67              :                           " with different possible methods", &
      68         1462 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
      69              : 
      70              :       CALL keyword_create(keyword, __LOCATION__, name="METHOD", &
      71              :                           description="Defines the method to use to compute free energy.", &
      72              :                           usage="METHOD (METADYN|UI|AC)", &
      73              :                           enum_c_vals=s2a("METADYN", "UI", "AC"), &
      74              :                           enum_i_vals=[do_fe_meta, do_fe_ui, do_fe_ac], &
      75              :                           enum_desc=s2a("Metadynamics", &
      76              :                                         "Umbrella Integration", &
      77              :                                         "Alchemical Change"), &
      78         1462 :                           default_i_val=do_fe_meta, repeats=.FALSE.)
      79         1462 :       CALL section_add_keyword(section, keyword)
      80         1462 :       CALL keyword_release(keyword)
      81              : 
      82         1462 :       CALL create_metadyn_section(subsection)
      83         1462 :       CALL section_add_subsection(section, subsection)
      84         1462 :       CALL section_release(subsection)
      85              : 
      86         1462 :       CALL create_ui_section(subsection)
      87         1462 :       CALL section_add_subsection(section, subsection)
      88         1462 :       CALL section_release(subsection)
      89              : 
      90         1462 :       CALL create_ac_section(subsection)
      91         1462 :       CALL section_add_subsection(section, subsection)
      92         1462 :       CALL section_release(subsection)
      93              : 
      94              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "free_energy_info", &
      95              :                                        description="Controls the printing of basic and summary information during the"// &
      96              :                                        " Free Energy calculation", &
      97              :                                        print_level=low_print_level, each_iter_names=s2a("MD"), &
      98         1462 :                                        each_iter_values=[1], add_last=add_last_numeric, filename="__STD_OUT__")
      99         1462 :       CALL section_add_subsection(section, print_key)
     100         1462 :       CALL section_release(print_key)
     101              : 
     102         1462 :    END SUBROUTINE create_fe_section
     103              : 
     104              : ! **************************************************************************************************
     105              : !> \brief creates the metadynamics section
     106              : !> \param section the section to be created
     107              : !> \author teo
     108              : ! **************************************************************************************************
     109         1462 :    SUBROUTINE create_metadyn_section(section)
     110              :       TYPE(section_type), POINTER                        :: section
     111              : 
     112              :       TYPE(keyword_type), POINTER                        :: keyword
     113              :       TYPE(section_type), POINTER                        :: print_key, subsection
     114              : 
     115         1462 :       CPASSERT(.NOT. ASSOCIATED(section))
     116              :       CALL section_create(section, __LOCATION__, name="metadyn", &
     117              :                           description="This section sets parameters to set up a calculation of metadynamics.", &
     118              :                           n_keywords=1, n_subsections=1, repeats=.FALSE., &
     119         2924 :                           citations=[VandenCic2006])
     120              : 
     121         1462 :       NULLIFY (subsection, keyword, print_key)
     122              : 
     123              :       CALL keyword_create(keyword, __LOCATION__, name="USE_PLUMED", &
     124              :                           description="Specify whether to use plumed as an external metadynamics driver.", &
     125              :                           usage="USE_PLUMED .FALSE./.TRUE.", &
     126         1462 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     127         1462 :       CALL section_add_keyword(section, keyword)
     128         1462 :       CALL keyword_release(keyword)
     129              : 
     130              :       CALL keyword_create(keyword, __LOCATION__, name="PLUMED_INPUT_FILE", &
     131              :                           description="Specify the file name of the external plumed input file", &
     132              :                           usage="PLUMED_INPUT_FILE ./FILENAME", &
     133         1462 :                           default_c_val="./plumed.dat")
     134         1462 :       CALL section_add_keyword(section, keyword)
     135         1462 :       CALL keyword_release(keyword)
     136              : 
     137              :       CALL keyword_create(keyword, __LOCATION__, name="MIN_NT_HILLS", &
     138              :                           description="Specify the minimum MD step interval between spawning "// &
     139              :                           "two hills. If specified, it must be >= than NT_HILLS. In case MIN_DISP "// &
     140              :                           "is used, if MIN_DISP is satisfied before MIN_NT_HILLS MD steps have been "// &
     141              :                           "performed, the MD will continue without any spawning until MIN_NT_HILLS is "// &
     142              :                           "reached. The default value has the net effect of skipping this check.", &
     143         1462 :                           usage="MIN_NT_HILLS {integer}", default_i_val=1)
     144         1462 :       CALL section_add_keyword(section, keyword)
     145         1462 :       CALL keyword_release(keyword)
     146              : 
     147              :       CALL keyword_create(keyword, __LOCATION__, name="NT_HILLS", &
     148              :                           description="Specify the maximum MD step interval between spawning "// &
     149              :                           "two hills. When negative, no new hills are spawned and only "// &
     150              :                           "the hills read from SPAWNED_HILLS_* are in effect. The latter "// &
     151              :                           "is useful when one wants to add a custom constant bias potential.", &
     152         1462 :                           usage="NT_HILLS {integer}", default_i_val=30)
     153         1462 :       CALL section_add_keyword(section, keyword)
     154         1462 :       CALL keyword_release(keyword)
     155              : 
     156              :       CALL keyword_create(keyword, __LOCATION__, name="TEMPERATURE", &
     157              :                           description="If a Lagrangian scheme is used the temperature for the collective "// &
     158              :                           "variables is specified. ", usage="TEMPERATURE <REAL>", &
     159         1462 :                           default_r_val=0.0_dp, unit_str='K')
     160         1462 :       CALL section_add_keyword(section, keyword)
     161         1462 :       CALL keyword_release(keyword)
     162              : 
     163              :       !RG Adaptive hills
     164              :       CALL keyword_create(keyword, __LOCATION__, name="MIN_DISP", &
     165              :                           description="Minimum displacement between hills before placing a new hill.", &
     166              :                           usage="MIN_DISP <REAL>", &
     167         1462 :                           default_r_val=-1.0_dp)
     168         1462 :       CALL section_add_keyword(section, keyword)
     169         1462 :       CALL keyword_release(keyword)
     170              : 
     171              :       CALL keyword_create(keyword, __LOCATION__, name="OLD_HILL_NUMBER", &
     172              :                           description="Index of the last hill spawned for this walker.Needed to calculate MIN_DISP", &
     173              :                           usage="OLD_HILL_NUMBER <INT>", &
     174         1462 :                           default_i_val=0)
     175         1462 :       CALL section_add_keyword(section, keyword)
     176         1462 :       CALL keyword_release(keyword)
     177              :       CALL keyword_create(keyword, __LOCATION__, name="OLD_HILL_STEP", &
     178              :                           description="Timestep of the last hill spawned for this walker.Needed to calculate MIN_DISP", &
     179              :                           usage="OLD_HILL_STEP <INT>", &
     180         1462 :                           default_i_val=0)
     181         1462 :       CALL section_add_keyword(section, keyword)
     182         1462 :       CALL keyword_release(keyword)
     183              :       !RG Adaptive hills
     184              : 
     185              :       !Hills tail damping
     186              :       CALL keyword_create(keyword, __LOCATION__, name="HILL_TAIL_CUTOFF", &
     187              :                           description="By setting this variable larger than 0 the tail of the Gaussian hill "// &
     188              :                           "is damped to zero faster. Let $X_0$ be the location of the Gaussian and $\mathrm{SCALE}$ "// &
     189              :                           "be the width of the Gaussian (for more than one METAVAR, $X_0$ and $\mathrm{SCALE}$ are "// &
     190              :                           "METAVAR-dependent), and denote $S=\mathrm{HILL\_TAIL\_CUTOFF} \cdot \mathrm{SCALE}$. "// &
     191              :                           "The Gaussian function is multiplied by a cutoff function that becomes active at "// &
     192              :                           "$|x-X_0| \gt S$, namely $\dfrac{1-(|x-X_0|/S)^{P}}{1-(|x-X_0|/S)^{Q}}$", &
     193              :                           usage="HILL_TAIL_CUTOFF <REAL>", &
     194         1462 :                           default_r_val=-1.0_dp)
     195         1462 :       CALL section_add_keyword(section, keyword)
     196         1462 :       CALL keyword_release(keyword)
     197              :       CALL keyword_create(keyword, __LOCATION__, name="P_EXPONENT", &
     198              :                           description="Exponent $P$ at the numerator of the cutoff function "// &
     199              :                           "to damp the tail of the Gaussian.", &
     200              :                           usage="P_EXPONENT <INT>", &
     201         1462 :                           default_i_val=8)
     202         1462 :       CALL section_add_keyword(section, keyword)
     203         1462 :       CALL keyword_release(keyword)
     204              :       CALL keyword_create(keyword, __LOCATION__, name="Q_EXPONENT", &
     205              :                           description="Exponent $Q$ at the denominator of the cutoff function "// &
     206              :                           "to damp the tail of the Gaussian.", &
     207              :                           usage="Q_EXPONENT <INT>", &
     208         1462 :                           default_i_val=20)
     209         1462 :       CALL section_add_keyword(section, keyword)
     210         1462 :       CALL keyword_release(keyword)
     211              : 
     212              :       CALL keyword_create(keyword, __LOCATION__, name="SLOW_GROWTH", &
     213              :                           description="Let the last hill grow slowly over NT_HILLS. ", &
     214              :                           usage="SLOW_GROWTH {logical}", &
     215         1462 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     216         1462 :       CALL section_add_keyword(section, keyword)
     217         1462 :       CALL keyword_release(keyword)
     218              : 
     219              :       CALL keyword_create(keyword, __LOCATION__, name="TEMP_TOL", &
     220              :                           description="If a Lagrangian scheme is used the temperature tolerance for the collective "// &
     221              :                           "variables is specified.", usage="TEMP_TOL <REAL>", &
     222         1462 :                           unit_str='K', default_r_val=0.0_dp)
     223         1462 :       CALL section_add_keyword(section, keyword)
     224         1462 :       CALL keyword_release(keyword)
     225              : 
     226              :       CALL keyword_create(keyword, __LOCATION__, name="LANGEVIN", &
     227              :                           description="If a Lagrangian scheme is used the eq. motion of the COLVARS are integrated "// &
     228              :                           "with a LANGEVIN scheme.", &
     229              :                           usage="LANGEVIN {logical}", &
     230              :                           citations=[VandenCic2006], &
     231         2924 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     232         1462 :       CALL section_add_keyword(section, keyword)
     233         1462 :       CALL keyword_release(keyword)
     234              : 
     235              :       CALL keyword_create(keyword, __LOCATION__, name="WW", &
     236              :                           description="Specifies the height of the gaussian to spawn. Default 0.1 .", &
     237         1462 :                           usage="WW <REAL>", unit_str='hartree', default_r_val=0.1_dp)
     238         1462 :       CALL section_add_keyword(section, keyword)
     239         1462 :       CALL keyword_release(keyword)
     240              : 
     241              :       CALL keyword_create(keyword, __LOCATION__, name="DO_HILLS", &
     242              :                           description="This keyword enables the spawning of the hills. Default .FALSE.", &
     243         1462 :                           usage="DO_HILLS", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     244         1462 :       CALL section_add_keyword(section, keyword)
     245         1462 :       CALL keyword_release(keyword)
     246              : 
     247              :       CALL keyword_create(keyword, __LOCATION__, name="WELL_TEMPERED", &
     248              :                           description="This keyword enables Well-tempered metadynamics. Default .FALSE.", &
     249              :                           usage="WELL_TEMPERED", citations=[BarducBus2008], &
     250         2924 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     251         1462 :       CALL section_add_keyword(section, keyword)
     252         1462 :       CALL keyword_release(keyword)
     253              : 
     254              :       CALL keyword_create(keyword, __LOCATION__, name="DELTA_T", &
     255              :                           description="If Well-tempered metaD is used, the temperature parameter "// &
     256              :                           "must be specified.", usage="DELTA_T <REAL>", &
     257         1462 :                           unit_str='K', default_r_val=0.0_dp)
     258         1462 :       CALL section_add_keyword(section, keyword)
     259         1462 :       CALL keyword_release(keyword)
     260              : 
     261              :       CALL keyword_create(keyword, __LOCATION__, name="WTGAMMA", &
     262              :                           description="If Well-tempered metaD is used, the gamma parameter "// &
     263              :                           "must be specified if not DELTA_T.", usage="WTGAMMA <REAL>", &
     264         1462 :                           default_r_val=0.0_dp)
     265         1462 :       CALL section_add_keyword(section, keyword)
     266         1462 :       CALL keyword_release(keyword)
     267              : 
     268              :       CALL keyword_create(keyword, __LOCATION__, name="LAGRANGE", &
     269              :                           description="Specifies whether an extended-lagrangian should be used. Default .FALSE.", &
     270         1462 :                           usage="LAGRANGE", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     271         1462 :       CALL section_add_keyword(section, keyword)
     272         1462 :       CALL keyword_release(keyword)
     273              : 
     274              :       CALL keyword_create(keyword, __LOCATION__, name="step_start_val", &
     275              :                           description="The starting step value for metadynamics", &
     276         1462 :                           usage="step_start_val <integer>", default_i_val=0)
     277         1462 :       CALL section_add_keyword(section, keyword)
     278         1462 :       CALL keyword_release(keyword)
     279              : 
     280              :       CALL keyword_create(keyword, __LOCATION__, name="nhills_start_val", &
     281              :                           description="The starting value of previously spawned hills", &
     282         1462 :                           usage="nhills_start_val <integer>", default_i_val=0)
     283         1462 :       CALL section_add_keyword(section, keyword)
     284         1462 :       CALL keyword_release(keyword)
     285              : 
     286              :       CALL keyword_create(keyword, __LOCATION__, name="COLVAR_AVG_TEMPERATURE_RESTART", &
     287              :                           description="COLVAR average temperature. Only for restarting purposes.", &
     288         1462 :                           usage="COLVAR_AVG_TEMPERATURE_RESTART 0.0", default_r_val=0.0_dp)
     289         1462 :       CALL section_add_keyword(section, keyword)
     290         1462 :       CALL keyword_release(keyword)
     291              : 
     292              :       CALL keyword_create(keyword, __LOCATION__, name="TAMCSteps", &
     293              :                           description="Number of sampling points for z", &
     294         1462 :                           usage="TAMCSteps <integer>", default_i_val=1)
     295         1462 :       CALL section_add_keyword(section, keyword)
     296         1462 :       CALL keyword_release(keyword)
     297              : 
     298              :       CALL keyword_create(keyword, __LOCATION__, name="timestep", &
     299              :                           description="The length of an integration step for colvars (TAMC only)", &
     300              :                           usage="timestep <real>", default_r_val=cp_unit_to_cp2k(value=0.5_dp, unit_str="fs"), &
     301         1462 :                           unit_str="fs")
     302              : 
     303         1462 :       CALL section_add_keyword(section, keyword)
     304         1462 :       CALL keyword_release(keyword)
     305              : 
     306         1462 :       CALL create_metavar_section(subsection)
     307         1462 :       CALL section_add_subsection(section, subsection)
     308         1462 :       CALL section_release(subsection)
     309              : 
     310         1462 :       CALL create_multiple_walkers_section(subsection)
     311         1462 :       CALL section_add_subsection(section, subsection)
     312         1462 :       CALL section_release(subsection)
     313              : 
     314              :       CALL section_create(subsection, __LOCATION__, name="print", &
     315              :                           description="Controls the printing properties during an metadynamics run", &
     316         1462 :                           n_keywords=0, n_subsections=1, repeats=.TRUE.)
     317         1462 :       NULLIFY (print_key)
     318              : 
     319              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "program_run_info", &
     320              :                                        description="Controls the printing of basic and summary information during"// &
     321              :                                        " metadynamics.", &
     322              :                                        print_level=low_print_level, each_iter_names=s2a("MD", "METADYNAMICS"), &
     323         1462 :                                        each_iter_values=[1, 1], add_last=add_last_numeric, filename="__STD_OUT__")
     324         1462 :       CALL section_add_subsection(subsection, print_key)
     325         1462 :       CALL section_release(print_key)
     326              : 
     327              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "temperature_colvar", &
     328              :                                        description="Controls the printing of the temperature of COLVARS in an "// &
     329              :                                        "extended lagrangian scheme.", &
     330              :                                        print_level=low_print_level, each_iter_names=s2a("MD", "METADYNAMICS"), &
     331         1462 :                                        each_iter_values=[1, 1], add_last=add_last_numeric, filename="__STD_OUT__")
     332         1462 :       CALL section_add_subsection(subsection, print_key)
     333         1462 :       CALL section_release(print_key)
     334              : 
     335              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "COLVAR", &
     336              :                                        description="Controls the printing of COLVAR summary information during"// &
     337              :                                        " metadynamics. When an extended Lagrangian use used, the files"// &
     338              :                                        " contain (in order): colvar value of the extended Lagrangian,"// &
     339              :                                        " instantaneous colvar value, force due to the harmonic term of the extended"// &
     340              :                                        " Lagrangian and the force due to the previously spawned hills,"// &
     341              :                                        " the force due to the walls, the velocities in the extended"// &
     342              :                                        " Lagrangian, the potential of the harmonic term of the"// &
     343              :                                        " Lagrangian, the potential energy of the hills, the potential"// &
     344              :                                        " energy of the walls and the temperature of the extended"// &
     345              :                                        " Lagrangian. When the extended Lagrangian is not used, all"// &
     346              :                                        " related fields are omitted.", &
     347              :                                        print_level=low_print_level, each_iter_names=s2a("MD", "METADYNAMICS"), &
     348         1462 :                                        each_iter_values=[1, 1], add_last=add_last_numeric, filename="COLVAR")
     349         1462 :       CALL section_add_subsection(subsection, print_key)
     350         1462 :       CALL section_release(print_key)
     351              : 
     352              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "HILLS", &
     353              :                                        description="Controls the printing of HILLS summary information during"// &
     354              :                                        " metadynamics. The file contains: instantaneous colvar value, width of"// &
     355              :                                        " the spawned gaussian and height of the gaussian. According the value of"// &
     356              :                                        " the EACH keyword this file may not be synchronized with the COLVAR file.", &
     357              :                                        print_level=high_print_level, each_iter_names=s2a("MD", "METADYNAMICS"), &
     358         1462 :                                        each_iter_values=[1, 1], add_last=add_last_numeric, filename="HILLS")
     359         1462 :       CALL section_add_subsection(subsection, print_key)
     360         1462 :       CALL section_release(print_key)
     361              : 
     362         1462 :       CALL section_add_subsection(section, subsection)
     363         1462 :       CALL section_release(subsection)
     364              : 
     365         1462 :       CALL create_metadyn_history(subsection, section)
     366         1462 :    END SUBROUTINE create_metadyn_section
     367              : 
     368              : ! **************************************************************************************************
     369              : !> \brief creates the multiple walker section
     370              : !> \param section the section to be created
     371              : !> \author teodoro laino [tlaino] 10.2008
     372              : ! **************************************************************************************************
     373         1462 :    SUBROUTINE create_multiple_walkers_section(section)
     374              :       TYPE(section_type), POINTER                        :: section
     375              : 
     376              :       TYPE(keyword_type), POINTER                        :: keyword
     377              :       TYPE(section_type), POINTER                        :: subsection
     378              : 
     379         1462 :       CPASSERT(.NOT. ASSOCIATED(section))
     380              :       CALL section_create(section, __LOCATION__, name="MULTIPLE_WALKERS", &
     381              :                           description="Enables and configures the metadynamics using multiple walkers.", &
     382         1462 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     383              : 
     384         1462 :       NULLIFY (subsection, keyword)
     385              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     386              :                           description="Controls the usage of the multiple walkers in a metadynamics run.", &
     387         1462 :                           usage="&MULTIPLE_WALKERS T", default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     388         1462 :       CALL section_add_keyword(section, keyword)
     389         1462 :       CALL keyword_release(keyword)
     390              : 
     391              :       CALL keyword_create(keyword, __LOCATION__, name="WALKER_ID", &
     392              :                           description="Sets the walker ID for the local metadynamics run.", &
     393         1462 :                           usage="WALKER_ID <INTEGER>", type_of_var=integer_t)
     394         1462 :       CALL section_add_keyword(section, keyword)
     395         1462 :       CALL keyword_release(keyword)
     396              : 
     397              :       CALL keyword_create(keyword, __LOCATION__, name="NUMBER_OF_WALKERS", &
     398              :                           description="Sets the total number of walkers in the metadynamic run.", &
     399         1462 :                           usage="NUMBER_OF_WALKERS <INTEGER>", type_of_var=integer_t)
     400         1462 :       CALL section_add_keyword(section, keyword)
     401         1462 :       CALL keyword_release(keyword)
     402              : 
     403              :       CALL keyword_create(keyword, __LOCATION__, name="WALKER_COMM_FREQUENCY", &
     404              :                           description="Sets the frequency (in unit of spawned hills) for the "// &
     405              :                           "communication between the several walkers, in order to update the "// &
     406              :                           "local list of hills with the ones coming from the other walkers", &
     407         1462 :                           usage="WALKER_COMM_FREQUENCY <INTEGER>", default_i_val=1)
     408         1462 :       CALL section_add_keyword(section, keyword)
     409         1462 :       CALL keyword_release(keyword)
     410              : 
     411              :       CALL keyword_create(keyword, __LOCATION__, name="WALKERS_STATUS", &
     412              :                           description="Stores the status of the several walkers in the local run.", &
     413         1462 :                           usage="WALKERS_STATUS <INTEGER> .. <INTEGER>", type_of_var=integer_t, n_var=-1)
     414         1462 :       CALL section_add_keyword(section, keyword)
     415         1462 :       CALL keyword_release(keyword)
     416              : 
     417              :       CALL section_create(subsection, __LOCATION__, name="WALKERS_FILE_NAME", &
     418              :                           description="Specify the basename for the NUMBER_OF_WALKERS files used to "// &
     419              :                           "communicate between the walkers. Absolute path can be input as well "// &
     420              :                           "together with the filename. One file will be created for each spawned hill.", &
     421         1462 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     422              :       CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
     423              :                           description="Specified the communication filename for each walker.", repeats=.TRUE., &
     424         1462 :                           usage="{String}", type_of_var=lchar_t, n_var=1)
     425         1462 :       CALL section_add_keyword(subsection, keyword)
     426         1462 :       CALL keyword_release(keyword)
     427         1462 :       CALL section_add_subsection(section, subsection)
     428         1462 :       CALL section_release(subsection)
     429         1462 :    END SUBROUTINE create_multiple_walkers_section
     430              : 
     431              : ! **************************************************************************************************
     432              : !> \brief creates the alchemical section for free energy evaluation
     433              : !> \param section the section to be created
     434              : !> \author teodoro laino [tlaino] 04.2007
     435              : ! **************************************************************************************************
     436         1462 :    SUBROUTINE create_ac_section(section)
     437              :       TYPE(section_type), POINTER                        :: section
     438              : 
     439              :       TYPE(keyword_type), POINTER                        :: keyword
     440              : 
     441         1462 :       NULLIFY (keyword)
     442         1462 :       CPASSERT(.NOT. ASSOCIATED(section))
     443              :       CALL section_create(section, __LOCATION__, name="ALCHEMICAL_CHANGE", &
     444              :                           description="Controls the calculation of delta free energies with the "// &
     445              :                           "alchemical change method. This requires setting up a generic mixed "// &
     446              :                           "force env with the FORCE_EVAL/MIXED/MIXING_TYPE keyword set as GENMIX "// &
     447              :                           "and the coupling function defined in the FORCE_EVAL/MIXED/GENERIC section.", &
     448         1462 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     449              : 
     450              :       CALL keyword_create(keyword, __LOCATION__, name="PARAMETER", &
     451              :                           description="Defines the symbol for the perturbing parameter of the "// &
     452              :                           "alchemical change transformation. This must be one of the symbols "// &
     453              :                           "for the corresponding FORCE_EVAL/MIXED/GENERIC/PARAMETERS keyword.", &
     454              :                           usage="PARAMETER k", type_of_var=char_t, &
     455         1462 :                           n_var=1)
     456         1462 :       CALL section_add_keyword(section, keyword)
     457         1462 :       CALL keyword_release(keyword)
     458              : 
     459              :       CALL keyword_create(keyword, __LOCATION__, name="WEIGHTING_FUNCTION", &
     460              :                           description="Specifies the weighting function (umbrella potential, "// &
     461              :                           "part of the mixing function) using the identical symbols for the "// &
     462              :                           "parameters and variables in FORCE_EVAL/MIXED/GENERIC.", &
     463              :                           usage="WEIGHTING_FUNCTION (E1+E2-LOG(E1/E2))", type_of_var=lchar_t, &
     464         1462 :                           n_var=1, default_lc_val="0")
     465         1462 :       CALL section_add_keyword(section, keyword)
     466         1462 :       CALL keyword_release(keyword)
     467              : 
     468              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_CONV", &
     469              :                           description="Set the relative tolerance for the convergence of the free energy derivative", &
     470              :                           usage="EPS_CONV <REAL>", &
     471         1462 :                           default_r_val=1.0E-2_dp)
     472         1462 :       CALL section_add_keyword(section, keyword)
     473         1462 :       CALL keyword_release(keyword)
     474              : 
     475              :       CALL keyword_create(keyword, __LOCATION__, name="NEQUIL_STEPS", &
     476              :                           description="Set the number of equilibration steps, skipped to compute averages", &
     477              :                           usage="NEQUIL_STEPS <INTEGER>", &
     478         1462 :                           default_i_val=0)
     479         1462 :       CALL section_add_keyword(section, keyword)
     480         1462 :       CALL keyword_release(keyword)
     481              : 
     482         1462 :    END SUBROUTINE create_ac_section
     483              : 
     484              : ! **************************************************************************************************
     485              : !> \brief creates the umbrella integration section
     486              : !> \param section the section to be created
     487              : !> \author teodoro laino [tlaino] 01.2007
     488              : ! **************************************************************************************************
     489         1462 :    SUBROUTINE create_ui_section(section)
     490              :       TYPE(section_type), POINTER                        :: section
     491              : 
     492              :       TYPE(section_type), POINTER                        :: subsection
     493              : 
     494         1462 :       CPASSERT(.NOT. ASSOCIATED(section))
     495              :       CALL section_create(section, __LOCATION__, name="umbrella_integration", &
     496              :                           description="Controls the calculation of free energy derivatives"// &
     497              :                           " with the umbrella integration method.", &
     498         1462 :                           n_keywords=0, n_subsections=0, repeats=.FALSE.)
     499              : 
     500         1462 :       NULLIFY (subsection)
     501         1462 :       CALL create_uvar_conv_section(subsection)
     502         1462 :       CALL section_add_subsection(section, subsection)
     503         1462 :       CALL section_release(subsection)
     504              : 
     505         1462 :       CALL create_uvar_section(subsection)
     506         1462 :       CALL section_add_subsection(section, subsection)
     507         1462 :       CALL section_release(subsection)
     508              : 
     509         1462 :    END SUBROUTINE create_ui_section
     510              : 
     511              : ! **************************************************************************************************
     512              : !> \brief Creates the velocity section
     513              : !> \param section the section to create
     514              : !> \param metadyn_section ...
     515              : !> \author teo
     516              : ! **************************************************************************************************
     517         1462 :    SUBROUTINE create_metadyn_history(section, metadyn_section)
     518              :       TYPE(section_type), POINTER                        :: section, metadyn_section
     519              : 
     520              :       TYPE(keyword_type), POINTER                        :: keyword
     521              : 
     522         1462 :       CPASSERT(.NOT. ASSOCIATED(section))
     523              :       CALL section_create(section, __LOCATION__, name="SPAWNED_HILLS_POS", &
     524              :                           description="The position of the spawned hills during metadynamics. "// &
     525              :                           "Used for RESTART.", &
     526         1462 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     527         1462 :       NULLIFY (keyword)
     528              :       CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
     529              :                           description="Specify the spawned hills", repeats=.TRUE., &
     530         1462 :                           usage="{Real} ...", type_of_var=real_t, n_var=-1)
     531         1462 :       CALL section_add_keyword(section, keyword)
     532         1462 :       CALL keyword_release(keyword)
     533         1462 :       CALL section_add_subsection(metadyn_section, section)
     534         1462 :       CALL section_release(section)
     535              : 
     536              :       CALL section_create(section, __LOCATION__, name="SPAWNED_HILLS_SCALE", &
     537              :                           description="The scales of the spawned hills during metadynamics. "// &
     538              :                           "Used for RESTART. When a scale is zero in one or more "// &
     539              :                           "directions, the Gaussian hill is assumed to be infinitely wide "// &
     540              :                           "in those directions. The latter can be used to combine spawned "// &
     541              :                           "hills from multiple 1D metadynamics runs in one multidimensional "// &
     542              :                           "metadynamics run.", &
     543         1462 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     544         1462 :       NULLIFY (keyword)
     545              :       CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
     546              :                           description="Specify the spawned hills", repeats=.TRUE., &
     547         1462 :                           usage="{Real} ...", type_of_var=real_t, n_var=-1)
     548         1462 :       CALL section_add_keyword(section, keyword)
     549         1462 :       CALL keyword_release(keyword)
     550         1462 :       CALL section_add_subsection(metadyn_section, section)
     551         1462 :       CALL section_release(section)
     552              : 
     553              :       CALL section_create(section, __LOCATION__, name="SPAWNED_HILLS_HEIGHT", &
     554              :                           description="The height of the spawned hills during metadynamics. "// &
     555              :                           "Used for RESTART.", &
     556         1462 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     557         1462 :       NULLIFY (keyword)
     558              :       CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
     559              :                           description="Specify the spawned hills", repeats=.TRUE., &
     560         1462 :                           usage="{Real}", type_of_var=real_t, n_var=1)
     561         1462 :       CALL section_add_keyword(section, keyword)
     562         1462 :       CALL keyword_release(keyword)
     563         1462 :       CALL section_add_subsection(metadyn_section, section)
     564         1462 :       CALL section_release(section)
     565              : 
     566              :       CALL section_create(section, __LOCATION__, name="SPAWNED_HILLS_INVDT", &
     567              :                           description="The inverse of the DELTA_T parameter used for Well-Tempered metadynamics. "// &
     568              :                           "Used for RESTART.", &
     569         1462 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     570         1462 :       NULLIFY (keyword)
     571              :       CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
     572              :                           description="Specify the spawned hills", repeats=.TRUE., &
     573         1462 :                           usage="{Real}", type_of_var=real_t, n_var=1)
     574         1462 :       CALL section_add_keyword(section, keyword)
     575         1462 :       CALL keyword_release(keyword)
     576         1462 :       CALL section_add_subsection(metadyn_section, section)
     577         1462 :       CALL section_release(section)
     578              :       !
     579              :       ! Extended Lagrangian
     580              :       !
     581              :       CALL section_create(section, __LOCATION__, name="EXT_LAGRANGE_SS0", &
     582              :                           description="Colvar position within an extended Lagrangian formalism. "// &
     583              :                           "Used for RESTART.", &
     584         1462 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     585         1462 :       NULLIFY (keyword)
     586              :       CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
     587              :                           description="Specified the positions", repeats=.TRUE., &
     588         1462 :                           usage="{Real}", type_of_var=real_t, n_var=1)
     589         1462 :       CALL section_add_keyword(section, keyword)
     590         1462 :       CALL keyword_release(keyword)
     591         1462 :       CALL section_add_subsection(metadyn_section, section)
     592         1462 :       CALL section_release(section)
     593              : 
     594              :       CALL section_create(section, __LOCATION__, name="EXT_LAGRANGE_VVP", &
     595              :                           description="Colvar velocities within an extended Lagrangian formalism. "// &
     596              :                           "Used for RESTART.", &
     597         1462 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     598         1462 :       NULLIFY (keyword)
     599              :       CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
     600              :                           description="Specified the velocities", repeats=.TRUE., &
     601         1462 :                           usage="{Real}", type_of_var=real_t, n_var=1)
     602         1462 :       CALL section_add_keyword(section, keyword)
     603         1462 :       CALL keyword_release(keyword)
     604         1462 :       CALL section_add_subsection(metadyn_section, section)
     605         1462 :       CALL section_release(section)
     606              : 
     607              :       CALL section_create(section, __LOCATION__, name="EXT_LAGRANGE_SS", &
     608              :                           description="Colvar Theta within an extended Lagrangian formalism. "// &
     609              :                           "Used for RESTART.", &
     610         1462 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     611         1462 :       NULLIFY (keyword)
     612              :       CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
     613              :                           description="Specified the theta", repeats=.TRUE., &
     614         1462 :                           usage="{Real}", type_of_var=real_t, n_var=1)
     615         1462 :       CALL section_add_keyword(section, keyword)
     616         1462 :       CALL keyword_release(keyword)
     617         1462 :       CALL section_add_subsection(metadyn_section, section)
     618         1462 :       CALL section_release(section)
     619              : 
     620              :       CALL section_create(section, __LOCATION__, name="EXT_LAGRANGE_FS", &
     621              :                           description="Colvar force within an extended Lagrangian formalism. "// &
     622              :                           "Used for RESTART.", &
     623         1462 :                           n_keywords=1, n_subsections=0, repeats=.FALSE.)
     624         1462 :       NULLIFY (keyword)
     625              :       CALL keyword_create(keyword, __LOCATION__, name="_DEFAULT_KEYWORD_", &
     626              :                           description="Specified the theta", repeats=.TRUE., &
     627         1462 :                           usage="{Real}", type_of_var=real_t, n_var=1)
     628         1462 :       CALL section_add_keyword(section, keyword)
     629         1462 :       CALL keyword_release(keyword)
     630         1462 :       CALL section_add_subsection(metadyn_section, section)
     631         1462 :       CALL section_release(section)
     632              : 
     633         1462 :    END SUBROUTINE create_metadyn_history
     634              : 
     635              : ! **************************************************************************************************
     636              : !> \brief creates the metavar section
     637              : !> \param section the section to be created
     638              : !> \author teo
     639              : ! **************************************************************************************************
     640         1618 :    SUBROUTINE create_metavar_section(section)
     641              :       TYPE(section_type), POINTER                        :: section
     642              : 
     643              :       TYPE(keyword_type), POINTER                        :: keyword
     644              :       TYPE(section_type), POINTER                        :: subsection, wall_section
     645              : 
     646         1618 :       CPASSERT(.NOT. ASSOCIATED(section))
     647              :       CALL section_create(section, __LOCATION__, name="METAVAR", &
     648              :                           description="This section specify the nature of the collective variables.", &
     649         1618 :                           n_keywords=1, n_subsections=1, repeats=.TRUE.)
     650              : 
     651         1618 :       NULLIFY (keyword)
     652              :       CALL keyword_create(keyword, __LOCATION__, name="LAMBDA", &
     653              :      description="Specifies the lambda parameter for the coupling of the collective variable with the system coordinates in the"// &
     654              :                           " extended lagrangian scheme.", &
     655         1618 :                           usage="LAMBDA <REAL>", unit_str='internal_cp2k', type_of_var=real_t)
     656         1618 :       CALL section_add_keyword(section, keyword)
     657         1618 :       CALL keyword_release(keyword)
     658              : 
     659              :       CALL keyword_create(keyword, __LOCATION__, name="MASS", &
     660              :                           description="Specifies the mass parameter of the collective variable in the"// &
     661         1618 :                           " extended lagrangian scheme.", usage="MASS <REAL>", unit_str='amu', type_of_var=real_t)
     662         1618 :       CALL section_add_keyword(section, keyword)
     663         1618 :       CALL keyword_release(keyword)
     664              : 
     665              :       CALL keyword_create(keyword, __LOCATION__, name="GAMMA", &
     666              :                           description="Specifies the friction term in Langevin integration of the collective variable in the"// &
     667              :                           " extended lagrangian scheme.", &
     668              :                           citations=[VandenCic2006], &
     669         3236 :                           usage="GAMMA {real}", type_of_var=real_t, unit_str="fs^-1")
     670         1618 :       CALL section_add_keyword(section, keyword)
     671         1618 :       CALL keyword_release(keyword)
     672              : 
     673              :       CALL keyword_create(keyword, __LOCATION__, name="SCALE", &
     674              :                           variants=["WIDTH"], &
     675              :                           description="Specifies the scale factor for the following collective variable. The history "// &
     676              :                           "dependent term has the expression: $\mathrm{WW} \sum_{j=1}^{n_{hills}} \prod_{k=1}^{n_{colvar}} "// &
     677              :                           "\exp{[-0.5(\frac{\mathrm{ss}-\mathrm{ss0}(k,j)}{\mathrm{SCALE}(k)})^2]}$, "// &
     678              :                           "where $n_{colvar}$ is the number of defined METAVAR and $n_{hills}$ is the number of spawned hills. ", &
     679         3236 :                           usage="SCALE <REAL>", type_of_var=real_t, unit_str='internal_cp2k')
     680         1618 :       CALL section_add_keyword(section, keyword)
     681         1618 :       CALL keyword_release(keyword)
     682              : 
     683              :       CALL keyword_create(keyword, __LOCATION__, name="COLVAR", &
     684              :                           description="Specifies the colvar on which to apply metadynamics.", &
     685         1618 :                           usage="COLVAR {integer}", type_of_var=integer_t)
     686         1618 :       CALL section_add_keyword(section, keyword)
     687         1618 :       CALL keyword_release(keyword)
     688              : 
     689              :       ! Wall section
     690         1618 :       NULLIFY (wall_section, subsection)
     691              :       CALL section_create(wall_section, __LOCATION__, name="WALL", &
     692              :                           description="Controls the activation of walls on COLVAR during a metadynamic run.", &
     693         1618 :                           n_keywords=0, n_subsections=1, repeats=.TRUE.)
     694              : 
     695              :       CALL keyword_create( &
     696              :          keyword, __LOCATION__, name="TYPE", &
     697              :          description="Specify the type of wall", &
     698              :          usage="TYPE (REFLECTIVE|QUADRATIC|QUARTIC|GAUSSIAN|NONE)", &
     699              :          enum_c_vals=s2a("REFLECTIVE", "QUADRATIC", "QUARTIC", "GAUSSIAN", "NONE"), &
     700              :          enum_desc=s2a("Reflective wall. Colvar velocity is inverted when the colvar is beyond the wall position.", &
     701              :                        "Applies a quadratic potential at the wall position.", &
     702              :                        "Applies a quartic potential at the wall position.", &
     703              :                        "Applies a gaussian potential at the wall position.", &
     704              :                        "No walls are applied."), &
     705              :          enum_i_vals=[do_wall_reflective, do_wall_quadratic, do_wall_quartic, do_wall_gaussian, do_wall_none], &
     706         1618 :          default_i_val=do_wall_none)
     707         1618 :       CALL section_add_keyword(wall_section, keyword)
     708         1618 :       CALL keyword_release(keyword)
     709              : 
     710              :       CALL keyword_create(keyword, __LOCATION__, name="POSITION", &
     711              :                           description="Specify the value of the colvar for the wall position", &
     712              :                           usage="POSITION <REAL>", unit_str='internal_cp2k', &
     713         1618 :                           type_of_var=real_t)
     714         1618 :       CALL section_add_keyword(wall_section, keyword)
     715         1618 :       CALL keyword_release(keyword)
     716              : 
     717              :       ! Reflective wall
     718              :       CALL section_create(subsection, __LOCATION__, name="REFLECTIVE", &
     719              :                           description="Parameters controlling the reflective wall", &
     720         1618 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
     721              : 
     722              :       CALL keyword_create(keyword, __LOCATION__, name="DIRECTION", &
     723              :                           description="Specify the direction of the wall.", &
     724              :                           usage="DIRECTION (WALL_PLUS|WALL_MINUS)", &
     725              :                           enum_c_vals=s2a("WALL_PLUS", "WALL_MINUS"), &
     726              :                           enum_desc=s2a("Wall extends from the position towards larger values of COLVAR", &
     727              :                                         "Wall extends from the position towards smaller values of COLVAR"), &
     728         1618 :                           enum_i_vals=[do_wall_p, do_wall_m], default_i_val=do_wall_p)
     729         1618 :       CALL section_add_keyword(subsection, keyword)
     730         1618 :       CALL keyword_release(keyword)
     731         1618 :       CALL section_add_subsection(wall_section, subsection)
     732         1618 :       CALL section_release(subsection)
     733              : 
     734              :       ! Quadratic wall
     735              :       CALL section_create(subsection, __LOCATION__, name="QUADRATIC", &
     736              :                           description="Parameters controlling the quadratic wall "// &
     737              :                           "$K (\mathrm{CV}-\mathrm{POS})^2$", &
     738         1618 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
     739              : 
     740              :       CALL keyword_create(keyword, __LOCATION__, name="DIRECTION", &
     741              :                           description="Specify the direction of the wall.", &
     742              :                           usage="DIRECTION (WALL_PLUS|WALL_MINUS)", &
     743              :                           enum_c_vals=s2a("WALL_PLUS", "WALL_MINUS"), &
     744              :                           enum_desc=s2a("Wall extends from the position towards larger values of COLVAR", &
     745              :                                         "Wall extends from the position towards smaller values of COLVAR"), &
     746         1618 :                           enum_i_vals=[do_wall_p, do_wall_m], default_i_val=do_wall_p)
     747         1618 :       CALL section_add_keyword(subsection, keyword)
     748         1618 :       CALL keyword_release(keyword)
     749              : 
     750              :       CALL keyword_create(keyword, __LOCATION__, name="K", &
     751              :                           description="Specify the value of the quadratic potential constant $K$.", &
     752         1618 :                           usage="K <REAL>", unit_str='hartree', type_of_var=real_t)
     753         1618 :       CALL section_add_keyword(subsection, keyword)
     754         1618 :       CALL keyword_release(keyword)
     755              : 
     756         1618 :       CALL section_add_subsection(wall_section, subsection)
     757         1618 :       CALL section_release(subsection)
     758              : 
     759              :       ! Quartic wall
     760              :       CALL section_create(subsection, __LOCATION__, name="QUARTIC", &
     761              :                           description="Parameters controlling the quartic wall "// &
     762              :                           "$K (\mathrm{CV}-(\mathrm{POS}\pm\frac{0.05}{K^{1/4}}))^4$", &
     763         1618 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
     764              : 
     765              :       CALL keyword_create(keyword, __LOCATION__, name="DIRECTION", &
     766              :                           description="Specify the direction of the wall.", &
     767              :                           usage="DIRECTION (WALL_PLUS|WALL_MINUS)", &
     768              :                           enum_c_vals=s2a("WALL_PLUS", "WALL_MINUS"), &
     769              :                           enum_desc=s2a("Wall extends from the position towards larger values of COLVAR", &
     770              :                                         "Wall extends from the position towards smaller values of COLVAR"), &
     771         1618 :                           enum_i_vals=[do_wall_p, do_wall_m], default_i_val=do_wall_p)
     772         1618 :       CALL section_add_keyword(subsection, keyword)
     773         1618 :       CALL keyword_release(keyword)
     774              : 
     775              :       CALL keyword_create(keyword, __LOCATION__, name="K", &
     776              :                           description="Specify the value of the quartic potential constant $K$.", &
     777              :                           usage="K <REAL>", unit_str='hartree', &
     778         1618 :                           type_of_var=real_t)
     779         1618 :       CALL section_add_keyword(subsection, keyword)
     780         1618 :       CALL keyword_release(keyword)
     781              : 
     782         1618 :       CALL section_add_subsection(wall_section, subsection)
     783         1618 :       CALL section_release(subsection)
     784              : 
     785              :       ! Gaussian wall
     786              :       CALL section_create(subsection, __LOCATION__, name="GAUSSIAN", &
     787              :                           description="Parameters controlling the gaussian wall "// &
     788              :                           "$\mathrm{WW} \exp{(-(\frac{\mathrm{CV}-\mathrm{POS}}{\sigma})^2)}$.", &
     789         1618 :                           n_keywords=0, n_subsections=1, repeats=.FALSE.)
     790              : 
     791              :       CALL keyword_create(keyword, __LOCATION__, name="WW", &
     792              :                           description="Specify the height $\mathrm{WW}$ of the gaussian.", &
     793              :                           usage="WW <REAL>", unit_str='hartree', &
     794         1618 :                           type_of_var=real_t)
     795         1618 :       CALL section_add_keyword(subsection, keyword)
     796         1618 :       CALL keyword_release(keyword)
     797              : 
     798              :       CALL keyword_create(keyword, __LOCATION__, name="SIGMA", &
     799              :                           description="Specify the width $\sigma$ of the gaussian.", &
     800              :                           usage="SIGMA <REAL>", unit_str='internal_cp2k', &
     801         1618 :                           type_of_var=real_t)
     802         1618 :       CALL section_add_keyword(subsection, keyword)
     803         1618 :       CALL keyword_release(keyword)
     804              : 
     805         1618 :       CALL section_add_subsection(wall_section, subsection)
     806         1618 :       CALL section_release(subsection)
     807              : 
     808         1618 :       CALL section_add_subsection(section, wall_section)
     809         1618 :       CALL section_release(wall_section)
     810              : 
     811         1618 :    END SUBROUTINE create_metavar_section
     812              : 
     813              : ! **************************************************************************************************
     814              : !> \brief creates the uvar section
     815              : !> \param section the section to be created
     816              : !> \author teo
     817              : ! **************************************************************************************************
     818         1462 :    SUBROUTINE create_uvar_section(section)
     819              :       TYPE(section_type), POINTER                        :: section
     820              : 
     821              :       TYPE(keyword_type), POINTER                        :: keyword
     822              : 
     823         1462 :       CPASSERT(.NOT. ASSOCIATED(section))
     824              :       CALL section_create(section, __LOCATION__, name="UVAR", &
     825              :                           description="This section specify the nature of the collective variables"// &
     826              :                           " used in computing the free energy.", &
     827         1462 :                           n_keywords=1, n_subsections=1, repeats=.TRUE.)
     828              : 
     829         1462 :       NULLIFY (keyword)
     830              : 
     831              :       CALL keyword_create(keyword, __LOCATION__, name="COLVAR", &
     832              :                           description="Specifies the colvar used to compute free energy", &
     833         1462 :                           usage="COLVAR {integer}", type_of_var=integer_t)
     834         1462 :       CALL section_add_keyword(section, keyword)
     835         1462 :       CALL keyword_release(keyword)
     836         1462 :    END SUBROUTINE create_uvar_section
     837              : 
     838              : ! **************************************************************************************************
     839              : !> \brief  creates the section specifying parameters to control the convergence
     840              : !>         of the free energy
     841              : !> \param section the section to be created
     842              : !> \author teodoro laino [tlaino] 01.2007
     843              : ! **************************************************************************************************
     844         1462 :    SUBROUTINE create_uvar_conv_section(section)
     845              :       TYPE(section_type), POINTER                        :: section
     846              : 
     847              :       TYPE(keyword_type), POINTER                        :: keyword
     848              : 
     849         1462 :       CPASSERT(.NOT. ASSOCIATED(section))
     850              :       CALL section_create(section, __LOCATION__, name="CONVERGENCE_CONTROL", &
     851              :                           description="This section specify parameters controlling the convergence"// &
     852              :                           " of the free energy.", &
     853         1462 :                           n_keywords=1, n_subsections=1, repeats=.TRUE.)
     854              : 
     855         1462 :       NULLIFY (keyword)
     856              :       CALL keyword_create(keyword, __LOCATION__, name="COARSE_GRAINED_WIDTH", &
     857              :                           variants=["CG_WIDTH"], &
     858              :                           description="Width of segments in MD steps to generate the set of"// &
     859              :                           " coarse grained data, providing a correlation independent data set.", &
     860         2924 :                           usage="COARSE_GRAINED_WIDTH <INTEGER>", default_i_val=50)
     861         1462 :       CALL section_add_keyword(section, keyword)
     862         1462 :       CALL keyword_release(keyword)
     863              : 
     864              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_COARSE_GRAINED_WIDTH", &
     865              :                           variants=["MAX_CG_WIDTH"], &
     866              :                           description="Max Width of segments in MD steps to generate the set of"// &
     867              :                           " coarse grained data.", &
     868         2924 :                           usage="MAX_COARSE_GRAINED_WIDTH <INTEGER>", default_i_val=200)
     869         1462 :       CALL section_add_keyword(section, keyword)
     870         1462 :       CALL keyword_release(keyword)
     871              : 
     872              :       CALL keyword_create(keyword, __LOCATION__, name="COARSE_GRAINED_POINTS", &
     873              :                           variants=["CG_POINTS"], &
     874              :                           description="Set the minimum amount of coarse grained points to collect"// &
     875              :                           " before starting the statistical analysis", &
     876         2924 :                           usage="COARSE_GRAINED_POINTS <INTEGER>", default_i_val=30)
     877         1462 :       CALL section_add_keyword(section, keyword)
     878         1462 :       CALL keyword_release(keyword)
     879              : 
     880              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_CONV", &
     881              :                           description="Set the relative tolerance for the convergence of the collective"// &
     882              :                           " variable averages used to compute the free energy.", &
     883              :                           usage="EPS_CONV <REAL>", &
     884         1462 :                           default_r_val=1.0E-2_dp)
     885         1462 :       CALL section_add_keyword(section, keyword)
     886         1462 :       CALL keyword_release(keyword)
     887              : 
     888              :       CALL keyword_create(keyword, __LOCATION__, name="K_CONFIDENCE_LIMIT", &
     889              :                           description="Set the confidence limit for the Mann-Kendall trend test.", &
     890              :                           usage="K_CONFIDENCE_LIMIT <REAL>", &
     891         1462 :                           default_r_val=0.90_dp)
     892         1462 :       CALL section_add_keyword(section, keyword)
     893         1462 :       CALL keyword_release(keyword)
     894              : 
     895              :       CALL keyword_create(keyword, __LOCATION__, name="SW_CONFIDENCE_LIMIT", &
     896              :                           description="Set the confidence limit for the Shapiro-Wilks normality test.", &
     897              :                           usage="SW_CONFIDENCE_LIMIT <REAL>", &
     898         1462 :                           default_r_val=0.90_dp)
     899         1462 :       CALL section_add_keyword(section, keyword)
     900         1462 :       CALL keyword_release(keyword)
     901              : 
     902              :       CALL keyword_create(keyword, __LOCATION__, name="VN_CONFIDENCE_LIMIT", &
     903              :                           description="Set the confidence limit for the Von Neumann serial correlation test.", &
     904              :                           usage="VN_CONFIDENCE_LIMIT <REAL>", &
     905         1462 :                           default_r_val=0.90_dp)
     906         1462 :       CALL section_add_keyword(section, keyword)
     907         1462 :       CALL keyword_release(keyword)
     908         1462 :    END SUBROUTINE create_uvar_conv_section
     909              : 
     910              : END MODULE input_cp2k_free_energy
        

Generated by: LCOV version 2.0-1