LCOV - code coverage report
Current view: top level - src - input_cp2k_neb.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:c24029e) Lines: 100.0 % 185 185
Test Date: 2026-07-04 06:36:57 Functions: 100.0 % 2 2

            Line data    Source code
       1              : !--------------------------------------------------------------------------------------------------!
       2              : !   CP2K: A general program to perform molecular dynamics simulations                              !
       3              : !   Copyright 2000-2026 CP2K developers group <https://cp2k.org>                                   !
       4              : !                                                                                                  !
       5              : !   SPDX-License-Identifier: GPL-2.0-or-later                                                      !
       6              : !--------------------------------------------------------------------------------------------------!
       7              : 
       8              : ! **************************************************************************************************
       9              : !> \par History
      10              : !>      - taken out of input_cp2k_motion
      11              : !> \author Ole Schuett
      12              : ! **************************************************************************************************
      13              : 
      14              : MODULE input_cp2k_neb
      15              :    USE bibliography,                    ONLY: Elber1987,&
      16              :                                               Jonsson1998,&
      17              :                                               Jonsson2000_1,&
      18              :                                               Jonsson2000_2,&
      19              :                                               Wales2004
      20              :    USE cp_output_handling,              ONLY: add_last_numeric,&
      21              :                                               cp_print_key_section_create,&
      22              :                                               high_print_level,&
      23              :                                               low_print_level,&
      24              :                                               medium_print_level
      25              :    USE cp_units,                        ONLY: cp_unit_to_cp2k
      26              :    USE input_constants,                 ONLY: &
      27              :         band_diis_opt, band_md_opt, do_b_neb, do_ci_neb, do_d_neb, do_eb, do_it_neb, &
      28              :         do_rep_blocked, do_rep_interleaved, do_sm, pot_neb_fe, pot_neb_full, pot_neb_me
      29              :    USE input_cp2k_thermostats,          ONLY: create_coord_section,&
      30              :                                               create_velocity_section
      31              :    USE input_keyword_types,             ONLY: keyword_create,&
      32              :                                               keyword_release,&
      33              :                                               keyword_type
      34              :    USE input_section_types,             ONLY: section_add_keyword,&
      35              :                                               section_add_subsection,&
      36              :                                               section_create,&
      37              :                                               section_release,&
      38              :                                               section_type
      39              :    USE input_val_types,                 ONLY: real_t
      40              :    USE kinds,                           ONLY: dp
      41              :    USE string_utilities,                ONLY: s2a
      42              : #include "./base/base_uses.f90"
      43              : 
      44              :    IMPLICIT NONE
      45              :    PRIVATE
      46              : 
      47              :    LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .TRUE.
      48              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_neb'
      49              : 
      50              :    PUBLIC :: create_band_section
      51              : 
      52              : CONTAINS
      53              : 
      54              : ! **************************************************************************************************
      55              : !> \brief creates the section for a BAND run
      56              : !> \param section will contain the pint section
      57              : !> \author Teodoro Laino 09.2006 [tlaino]
      58              : ! **************************************************************************************************
      59        10679 :    SUBROUTINE create_band_section(section)
      60              :       TYPE(section_type), POINTER                        :: section
      61              : 
      62              :       TYPE(keyword_type), POINTER                        :: keyword
      63              :       TYPE(section_type), POINTER                        :: print_key, subsection, subsubsection
      64              : 
      65        10679 :       CPASSERT(.NOT. ASSOCIATED(section))
      66              :       CALL section_create(section, __LOCATION__, name="band", &
      67              :                           description="The section that controls a BAND run", &
      68              :                           n_keywords=1, n_subsections=0, repeats=.FALSE., &
      69        64074 :                           citations=[Elber1987, Jonsson1998, Jonsson2000_1, Jonsson2000_2, Wales2004])
      70        10679 :       NULLIFY (keyword, print_key, subsection, subsubsection)
      71              : 
      72              :       CALL keyword_create(keyword, __LOCATION__, name="NPROC_REP", &
      73              :                           description="Specify the number of processors to be used per replica "// &
      74              :                           "environment (for parallel runs)", &
      75        10679 :                           default_i_val=1)
      76        10679 :       CALL section_add_keyword(section, keyword)
      77        10679 :       CALL keyword_release(keyword)
      78              : 
      79              :       CALL keyword_create(keyword, __LOCATION__, name="PROC_DIST_TYPE", &
      80              :                           description="Specify the topology of the mapping of processors into replicas.", &
      81              :                           usage="PROC_DIST_TYPE (INTERLEAVED|BLOCKED)", &
      82              :                           enum_c_vals=s2a("INTERLEAVED", &
      83              :                                           "BLOCKED"), &
      84              :                           enum_desc=s2a("Interleaved distribution", &
      85              :                                         "Blocked distribution"), &
      86              :                           enum_i_vals=[do_rep_interleaved, do_rep_blocked], &
      87        10679 :                           default_i_val=do_rep_blocked)
      88        10679 :       CALL section_add_keyword(section, keyword)
      89        10679 :       CALL keyword_release(keyword)
      90              : 
      91              :       CALL keyword_create(keyword, __LOCATION__, name="BAND_TYPE", &
      92              :                           description="Specifies the type of BAND calculation", &
      93              :                           usage="BAND_TYPE (B-NEB|IT-NEB|CI-NEB|D-NEB|SM|EB)", &
      94              :                           default_i_val=do_it_neb, &
      95              :                           enum_c_vals=s2a("B-NEB", &
      96              :                                           "IT-NEB", &
      97              :                                           "CI-NEB", &
      98              :                                           "D-NEB", &
      99              :                                           "SM", &
     100              :                                           "EB"), &
     101              :                           enum_desc=s2a("Bisection nudged elastic band", &
     102              :                                         "Improved tangent nudged elastic band", &
     103              :                                         "Climbing image nudged elastic band", &
     104              :                                         "Doubly nudged elastic band", &
     105              :                                         "String Method", &
     106              :                                         "Elastic band (Hamiltonian formulation)"), &
     107        10679 :                           enum_i_vals=[do_b_neb, do_it_neb, do_ci_neb, do_d_neb, do_sm, do_eb])
     108        10679 :       CALL section_add_keyword(section, keyword)
     109        10679 :       CALL keyword_release(keyword)
     110              : 
     111              :       CALL keyword_create(keyword, __LOCATION__, name="NUMBER_OF_REPLICA", &
     112              :                           description="Specify the number of Replica to use in the BAND. This may "// &
     113              :                           "be equal to or larger than the number of defined &REPLICA sections. If "// &
     114              :                           "larger, the rest of missing replica will automatically be interpolated "// &
     115              :                           "in an iterative bisection procedure: on each step, the largest distance "// &
     116              :                           "between adjacent replica is found and a new replica is inserted there by "// &
     117              :                           "taking the average of adjacent replica; this is repeated until getting "// &
     118              :                           "requested number of replica. Please note that the number of replica is "// &
     119              :                           "always including both end points regardless of the setting of keyword "// &
     120              :                           "OPTIMIZE_END_POINTS, which should be taken into account when adjusting "// &
     121              :                           "the NPROC_REP value based on processors available on the machine.", &
     122        10679 :                           default_i_val=10)
     123        10679 :       CALL section_add_keyword(section, keyword)
     124        10679 :       CALL keyword_release(keyword)
     125              : 
     126              :       CALL keyword_create(keyword, __LOCATION__, name="USE_COLVARS", &
     127              :                           description="Uses a version of the band scheme projected in a subspace of colvars.", &
     128        10679 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     129        10679 :       CALL section_add_keyword(section, keyword)
     130        10679 :       CALL keyword_release(keyword)
     131              : 
     132              :       CALL keyword_create(keyword, __LOCATION__, name="POT_TYPE", &
     133              :                           description="Specifies the type of potential used in the BAND calculation", &
     134              :                           usage="POT_TYPE (FULL|FE|ME)", &
     135              :                           default_i_val=pot_neb_full, &
     136              :                           enum_c_vals=s2a("FULL", &
     137              :                                           "FE", &
     138              :                                           "ME"), &
     139              :                           enum_desc=s2a("Full potential (no projections in a subspace of colvars)", &
     140              :                                         "Free energy (requires a projections in a subspace of colvars)", &
     141              :                                         "Minimum energy (requires a projections in a subspace of colvars)"), &
     142        10679 :                           enum_i_vals=[pot_neb_full, pot_neb_fe, pot_neb_me])
     143        10679 :       CALL section_add_keyword(section, keyword)
     144        10679 :       CALL keyword_release(keyword)
     145              : 
     146              :       CALL keyword_create(keyword, __LOCATION__, name="ROTATE_FRAMES", &
     147              :                           description="Compute at each BAND step the RMSD and rotate the frames in order"// &
     148              :                           " to minimize it.", &
     149        10679 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     150        10679 :       CALL section_add_keyword(section, keyword)
     151        10679 :       CALL keyword_release(keyword)
     152              : 
     153              :       CALL keyword_create(keyword, __LOCATION__, name="ALIGN_FRAMES", &
     154              :                           description="Enables the alignment of the frames at the beginning of a BAND calculation. "// &
     155              :                           "This keyword does not affect the rotation of the replicas during a BAND calculation.", &
     156        10679 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     157        10679 :       CALL section_add_keyword(section, keyword)
     158        10679 :       CALL keyword_release(keyword)
     159              : 
     160              :       CALL keyword_create(keyword, __LOCATION__, name="K_SPRING", &
     161              :                           variants=["K"], &
     162              :                           description="Specify the value of the spring constant", &
     163        21358 :                           default_r_val=0.02_dp)
     164        10679 :       CALL section_add_keyword(section, keyword)
     165        10679 :       CALL keyword_release(keyword)
     166              : 
     167              :       ! Convergence_control
     168              :       CALL section_create(subsection, __LOCATION__, name="CONVERGENCE_CONTROL", &
     169              :                           description="Setup parameters to control the convergence criteria for BAND", &
     170        10679 :                           repeats=.FALSE.)
     171              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_DR", &
     172              :                           description="Tolerance on the maximum value of the displacement on the BAND.", &
     173              :                           usage="MAX_DR {real}", &
     174        10679 :                           default_r_val=0.0002_dp)
     175        10679 :       CALL section_add_keyword(subsection, keyword)
     176        10679 :       CALL keyword_release(keyword)
     177              : 
     178              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_FORCE", &
     179              :                           description="Tolerance on the maximum value of Forces on the BAND.", &
     180              :                           usage="MAX_FORCE {real}", &
     181        10679 :                           default_r_val=0.00045_dp)
     182        10679 :       CALL section_add_keyword(subsection, keyword)
     183        10679 :       CALL keyword_release(keyword)
     184              : 
     185              :       CALL keyword_create(keyword, __LOCATION__, name="RMS_DR", &
     186              :                           description="Tolerance on RMS displacements on the BAND.", &
     187              :                           usage="RMS_DR {real}", &
     188        10679 :                           default_r_val=0.0001_dp)
     189        10679 :       CALL section_add_keyword(subsection, keyword)
     190        10679 :       CALL keyword_release(keyword)
     191              : 
     192              :       CALL keyword_create(keyword, __LOCATION__, name="RMS_FORCE", &
     193              :                           description="Tolerance on RMS Forces on the BAND.", &
     194              :                           usage="RMS_FORCE {real}", &
     195        10679 :                           default_r_val=0.00030_dp)
     196        10679 :       CALL section_add_keyword(subsection, keyword)
     197        10679 :       CALL keyword_release(keyword)
     198        10679 :       CALL section_add_subsection(section, subsection)
     199        10679 :       CALL section_release(subsection)
     200              : 
     201        10679 :       NULLIFY (subsection, subsubsection)
     202              :       ! CI-NEB section
     203              :       CALL section_create(subsection, __LOCATION__, name="CI_NEB", &
     204              :                           description="Controls parameters for CI-NEB type calculation only.", &
     205        10679 :                           repeats=.FALSE.)
     206              :       CALL keyword_create(keyword, __LOCATION__, name="NSTEPS_IT", &
     207              :                           description="Specify the number of steps of IT-NEB to perform before "// &
     208              :                           "switching on the CI algorithm", &
     209        10679 :                           default_i_val=5)
     210        10679 :       CALL section_add_keyword(subsection, keyword)
     211        10679 :       CALL keyword_release(keyword)
     212        10679 :       CALL section_add_subsection(section, subsection)
     213        10679 :       CALL section_release(subsection)
     214              : 
     215              :       ! String Method section
     216              :       CALL section_create(subsection, __LOCATION__, name="STRING_METHOD", &
     217              :                           description="Controls parameters for String Method type calculation only.", &
     218        10679 :                           repeats=.FALSE.)
     219              : 
     220              :       CALL keyword_create(keyword, __LOCATION__, name="SPLINE_ORDER", &
     221              :                           description="Specify the oder of the spline used in the String Method.", &
     222        10679 :                           default_i_val=1)
     223        10679 :       CALL section_add_keyword(subsection, keyword)
     224        10679 :       CALL keyword_release(keyword)
     225              :       CALL keyword_create(keyword, __LOCATION__, name="SMOOTHING", &
     226              :                           description="Smoothing parameter for the reparametrization of the frames.", &
     227        10679 :                           default_r_val=0.2_dp)
     228        10679 :       CALL section_add_keyword(subsection, keyword)
     229        10679 :       CALL keyword_release(keyword)
     230              : 
     231        10679 :       CALL section_add_subsection(section, subsection)
     232        10679 :       CALL section_release(subsection)
     233              : 
     234              :       ! Optimization section
     235              :       CALL section_create(subsection, __LOCATION__, name="optimize_band", &
     236              :                           description="Specify the optimization method for the band", &
     237        10679 :                           repeats=.TRUE.)
     238        10679 :       CALL create_opt_band_section(subsection)
     239        10679 :       CALL section_add_subsection(section, subsection)
     240        10679 :       CALL section_release(subsection)
     241              : 
     242              :       ! replica section: to specify coordinates and velocities (possibly) of the
     243              :       ! different replica used in the BAND
     244              :       CALL section_create(subsection, __LOCATION__, name="replica", &
     245              :                           description="Specify coordinates and velocities (possibly) of the replica", &
     246        10679 :                           repeats=.TRUE.)
     247              :       ! Colvar
     248              :       CALL keyword_create(keyword, __LOCATION__, name="COLLECTIVE", &
     249              :                           description="Specifies the value of the collective variables used in the projected"// &
     250              :                           " BAND method. The order of the values is the order of the COLLECTIVE section in the"// &
     251              :                           " constraints/restraints section", &
     252              :                           usage="COLLECTIVE {real} .. {real}", &
     253        10679 :                           type_of_var=real_t, n_var=-1)
     254        10679 :       CALL section_add_keyword(subsection, keyword)
     255        10679 :       CALL keyword_release(keyword)
     256              :       ! Coordinates read through an external file
     257              :       CALL keyword_create(keyword, __LOCATION__, name="COORD_FILE_NAME", &
     258              :                           description="Name of the xyz file with coordinates (alternative to &COORD section)", &
     259              :                           usage="COORD_FILE_NAME <CHAR>", &
     260        10679 :                           default_lc_val="")
     261        10679 :       CALL section_add_keyword(subsection, keyword)
     262        10679 :       CALL keyword_release(keyword)
     263              :       ! Coordinates and velocities
     264        10679 :       CALL create_coord_section(subsubsection, "BAND")
     265        10679 :       CALL section_add_subsection(subsection, subsubsection)
     266        10679 :       CALL section_release(subsubsection)
     267        10679 :       CALL create_velocity_section(subsubsection, "BAND")
     268        10679 :       CALL section_add_subsection(subsection, subsubsection)
     269        10679 :       CALL section_release(subsubsection)
     270              : 
     271        10679 :       CALL section_add_subsection(section, subsection)
     272        10679 :       CALL section_release(subsection)
     273              : 
     274              :       ! Print key section
     275              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PROGRAM_RUN_INFO", &
     276              :                                        description="Controls the printing basic info about the BAND run", &
     277        10679 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
     278              : 
     279              :       CALL keyword_create(keyword, __LOCATION__, name="INITIAL_CONFIGURATION_INFO", &
     280              :                           description="Print information for the setup of the initial configuration.", &
     281              :                           usage="INITIAL_CONFIGURATION_INFO <LOGICAL>", &
     282        10679 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     283        10679 :       CALL section_add_keyword(print_key, keyword)
     284        10679 :       CALL keyword_release(keyword)
     285              : 
     286              :       CALL keyword_create(keyword, __LOCATION__, name="PLOT_REL_ENERGY", &
     287              :                           description="If a simple plot of relative energy of each replica is shown "// &
     288              :                           "alongside data vertically on each step. This makes the output format less "// &
     289              :                           "compact than default but creates a visual aid for ease of monitoring, with "// &
     290              :                           "some special marks for the local maxima `(X)` or minima `(x)` in the plot "// &
     291              :                           "and adjacent to the energy values in the form of `(++)` or `(--)`. Please "// &
     292              :                           "note that this plot does not represent optimization history where absolute "// &
     293              :                           "energy values vary between steps, because it shows *relative* energy that "// &
     294              :                           "is calculated by (E_rep-E_min)/(E_max-E_min) for each replica on one step.", &
     295              :                           usage="PLOT_REL_ENERGY <LOGICAL>", &
     296        10679 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     297        10679 :       CALL section_add_keyword(print_key, keyword)
     298        10679 :       CALL keyword_release(keyword)
     299              : 
     300        10679 :       CALL section_add_subsection(section, print_key)
     301        10679 :       CALL section_release(print_key)
     302              : 
     303              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "CONVERGENCE_INFO", &
     304              :                                        description="Controls the printing of the convergence criteria during a BAND run", &
     305        10679 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
     306        10679 :       CALL section_add_subsection(section, print_key)
     307        10679 :       CALL section_release(print_key)
     308              : 
     309              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "REPLICA_INFO", &
     310              :                                        description="Controls the printing of each replica info during a BAND run", &
     311        10679 :                                        print_level=medium_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
     312        10679 :       CALL section_add_subsection(section, print_key)
     313        10679 :       CALL section_release(print_key)
     314              : 
     315              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "ENERGY", &
     316              :                                        description="Controls the printing of the ENER file in a BAND run", &
     317              :                                        print_level=low_print_level, common_iter_levels=1, &
     318        10679 :                                        filename="")
     319        10679 :       CALL section_add_subsection(section, print_key)
     320        10679 :       CALL section_release(print_key)
     321              : 
     322              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "FINAL_BAND", &
     323              :                                        description="Controls the printing of the final structures as an "// &
     324              :                                        "XYZ trajectory file after a BAND run, regardless of convergence "// &
     325              :                                        "status. The unit is angstrom for coordinates and cell vectors.", &
     326              :                                        print_level=low_print_level, common_iter_levels=1, &
     327        10679 :                                        filename="FINAL")
     328              : 
     329              :       CALL keyword_create(keyword, __LOCATION__, name="PRINT_ATOM_KIND", &
     330              :                           description="Write the atom kind given in the subsys section instead "// &
     331              :                           "of the element symbol in the XYZ trajectory file.", &
     332              :                           usage="PRINT_ATOM_KIND {LOGICAL}", &
     333        10679 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     334        10679 :       CALL section_add_keyword(print_key, keyword)
     335        10679 :       CALL keyword_release(keyword)
     336              : 
     337        10679 :       CALL section_add_subsection(section, print_key)
     338        10679 :       CALL section_release(print_key)
     339              : 
     340              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "BANNER", &
     341              :                                        description="Controls the printing of the BAND banner", &
     342              :                                        print_level=low_print_level, common_iter_levels=1, &
     343        10679 :                                        filename="__STD_OUT__")
     344        10679 :       CALL section_add_subsection(section, print_key)
     345        10679 :       CALL section_release(print_key)
     346        10679 :    END SUBROUTINE create_band_section
     347              : 
     348              : ! **************************************************************************************************
     349              : !> \brief creates the optimization section for a BAND run
     350              : !> \param section will contain the pint section
     351              : !> \author Teodoro Laino 02.2007 [tlaino]
     352              : ! **************************************************************************************************
     353        10679 :    SUBROUTINE create_opt_band_section(section)
     354              :       TYPE(section_type), POINTER                        :: section
     355              : 
     356              :       TYPE(keyword_type), POINTER                        :: keyword
     357              :       TYPE(section_type), POINTER                        :: print_key, subsection, subsubsection
     358              : 
     359        10679 :       CPASSERT(ASSOCIATED(section))
     360        10679 :       NULLIFY (keyword, print_key, subsection, subsubsection)
     361              : 
     362              :       CALL keyword_create(keyword, __LOCATION__, name="OPT_TYPE", &
     363              :                           description="Specifies the type optimizer used for the band", &
     364              :                           usage="OPT_TYPE (MD|DIIS)", &
     365              :                           default_i_val=band_diis_opt, &
     366              :                           enum_c_vals=s2a("MD", &
     367              :                                           "DIIS"), &
     368              :                           enum_desc=s2a("Molecular dynamics-based optimizer", &
     369              :                                         "Coupled steepest descent / direct inversion in the iterative subspace"), &
     370        10679 :                           enum_i_vals=[band_md_opt, band_diis_opt])
     371        10679 :       CALL section_add_keyword(section, keyword)
     372        10679 :       CALL keyword_release(keyword)
     373              : 
     374              :       CALL keyword_create(keyword, __LOCATION__, name="OPTIMIZE_END_POINTS", &
     375              :                           description="If both end points of the band are also optimized alongside "// &
     376              :                           "the rest of replica. This may be set to .TRUE. if both end points have "// &
     377              :                           "already been optimized with the same FORCE_EVAL, in which case the force "// &
     378              :                           "on both end points will be reset to 0 on each step. Please note that both "// &
     379              :                           "end points will always be included in NUMBER_OF_REPLICA and get NPROC_REP "// &
     380              :                           "processors allocated each for calculation in the same way as the rest of "// &
     381              :                           "replica, regardless of this setting.", &
     382        10679 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     383        10679 :       CALL section_add_keyword(section, keyword)
     384        10679 :       CALL keyword_release(keyword)
     385              : 
     386              :       ! MD optimization section
     387              :       CALL section_create(subsection, __LOCATION__, name="MD", &
     388              :                           description="Activate the MD based optimization procedure for BAND", &
     389        10679 :                           repeats=.FALSE.)
     390              : 
     391              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_STEPS", &
     392              :                           description="Specify the maximum number of MD steps", &
     393        10679 :                           default_i_val=100)
     394        10679 :       CALL section_add_keyword(subsection, keyword)
     395        10679 :       CALL keyword_release(keyword)
     396              : 
     397              :       CALL keyword_create( &
     398              :          keyword, __LOCATION__, &
     399              :          name="timestep", &
     400              :          description="The length of an integration step", &
     401              :          usage="timestep 1.0", &
     402              :          default_r_val=cp_unit_to_cp2k(value=0.5_dp, &
     403              :                                        unit_str="fs"), &
     404        10679 :          unit_str="fs")
     405        10679 :       CALL section_add_keyword(subsection, keyword)
     406        10679 :       CALL keyword_release(keyword)
     407              : 
     408              :       CALL keyword_create(keyword, __LOCATION__, name="TEMPERATURE", &
     409              :                           description="Specify the initial temperature", &
     410              :                           default_r_val=cp_unit_to_cp2k(value=0.0_dp, &
     411              :                                                         unit_str="K"), &
     412        10679 :                           unit_str="K")
     413        10679 :       CALL section_add_keyword(subsection, keyword)
     414        10679 :       CALL keyword_release(keyword)
     415              : 
     416              :       ! Temp_control
     417              :       CALL section_create(subsubsection, __LOCATION__, name="TEMP_CONTROL", &
     418              :                           description="Setup parameters to control the temperature during a BAND MD run.", &
     419        10679 :                           repeats=.FALSE.)
     420              :       CALL keyword_create(keyword, __LOCATION__, name="TEMPERATURE", &
     421              :                           description="Specify the target temperature", &
     422        10679 :                           type_of_var=real_t, unit_str="K")
     423        10679 :       CALL section_add_keyword(subsubsection, keyword)
     424        10679 :       CALL keyword_release(keyword)
     425              : 
     426              :       CALL keyword_create(keyword, __LOCATION__, name="TEMP_TOL", &
     427              :                           description="Specify the tolerance on the temperature for rescaling", &
     428              :                           default_r_val=cp_unit_to_cp2k(value=0.0_dp, &
     429              :                                                         unit_str="K"), &
     430        10679 :                           unit_str="K")
     431        10679 :       CALL section_add_keyword(subsubsection, keyword)
     432        10679 :       CALL keyword_release(keyword)
     433              : 
     434              :       CALL keyword_create(keyword, __LOCATION__, name="TEMP_TOL_STEPS", &
     435              :                           description="Specify the number of steps to apply a temperature control", &
     436        10679 :                           default_i_val=0)
     437        10679 :       CALL section_add_keyword(subsubsection, keyword)
     438        10679 :       CALL keyword_release(keyword)
     439        10679 :       CALL section_add_subsection(subsection, subsubsection)
     440        10679 :       CALL section_release(subsubsection)
     441              : 
     442              :       ! Vel_control
     443              :       CALL section_create(subsubsection, __LOCATION__, name="VEL_CONTROL", &
     444              :                           description="Setup parameters to control the velocity during a BAND MD run.", &
     445        10679 :                           repeats=.FALSE.)
     446              :       CALL keyword_create(keyword, __LOCATION__, name="ANNEALING", &
     447              :                           description="Specify the annealing coefficient", &
     448        10679 :                           default_r_val=1.0_dp)
     449        10679 :       CALL section_add_keyword(subsubsection, keyword)
     450        10679 :       CALL keyword_release(keyword)
     451              :       CALL keyword_create(keyword, __LOCATION__, name="PROJ_VELOCITY_VERLET", &
     452              :                           description="Uses a Projected Velocity Verlet instead of a normal Velocity Verlet."// &
     453              :                           " Every time the cosine between velocities and forces is < 0 velocities are"// &
     454              :                           " zeroed.", &
     455              :                           usage="PROJ_VELOCITY_VERLET <LOGICAL>", &
     456        10679 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     457        10679 :       CALL section_add_keyword(subsubsection, keyword)
     458        10679 :       CALL keyword_release(keyword)
     459              :       CALL keyword_create(keyword, __LOCATION__, name="SD_LIKE", &
     460              :                           description="Zeros velocity at each MD step emulating a steepest descent like "// &
     461              :                           "(SD_LIKE) approach", &
     462              :                           usage="SD_LIKE <LOGICAL>", &
     463        10679 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     464        10679 :       CALL section_add_keyword(subsubsection, keyword)
     465        10679 :       CALL keyword_release(keyword)
     466        10679 :       CALL section_add_subsection(subsection, subsubsection)
     467        10679 :       CALL section_release(subsubsection)
     468              :       ! End of MD
     469        10679 :       CALL section_add_subsection(section, subsection)
     470        10679 :       CALL section_release(subsection)
     471              : 
     472              :       ! DIIS optimization section
     473              :       CALL section_create(subsection, __LOCATION__, name="DIIS", &
     474              :                           description="Activate the DIIS based optimization procedure for BAND", &
     475        10679 :                           repeats=.FALSE.)
     476              : 
     477              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_SD_STEPS", &
     478              :                           description="Specify the maximum number of SD steps to perform"// &
     479              :                           " before switching on DIIS (the minimum number will always be equal to N_DIIS).", &
     480        10679 :                           default_i_val=1)
     481        10679 :       CALL section_add_keyword(subsection, keyword)
     482        10679 :       CALL keyword_release(keyword)
     483              : 
     484              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_STEPS", &
     485              :                           description="Specify the maximum number of optimization steps", &
     486        10679 :                           default_i_val=100)
     487        10679 :       CALL section_add_keyword(subsection, keyword)
     488        10679 :       CALL keyword_release(keyword)
     489              : 
     490              :       CALL keyword_create(keyword, __LOCATION__, name="N_DIIS", &
     491              :                           variants=["NDIIS"], &
     492              :                           description="Number of history vectors to be used with DIIS", &
     493              :                           usage="N_DIIS 4", &
     494        21358 :                           default_i_val=7)
     495        10679 :       CALL section_add_keyword(subsection, keyword)
     496        10679 :       CALL keyword_release(keyword)
     497              : 
     498              :       CALL keyword_create(keyword, __LOCATION__, name="STEPSIZE", &
     499              :                           description="Initial stepsize used for the line search, sometimes this parameter "// &
     500              :                           "can be reduced to stabilize DIIS", &
     501              :                           usage="STEPSIZE <REAL>", &
     502        10679 :                           default_r_val=1.0_dp)
     503        10679 :       CALL section_add_keyword(subsection, keyword)
     504        10679 :       CALL keyword_release(keyword)
     505              : 
     506              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_STEPSIZE", &
     507              :                           description="Maximum stepsize used for the line search, sometimes this parameter "// &
     508              :                           "can be reduced to stabilize the LS for particularly difficult initial geometries", &
     509              :                           usage="MAX_STEPSIZE <REAL>", &
     510        10679 :                           default_r_val=2.0_dp)
     511        10679 :       CALL section_add_keyword(subsection, keyword)
     512        10679 :       CALL keyword_release(keyword)
     513              : 
     514              :       CALL keyword_create(keyword, __LOCATION__, name="NP_LS", &
     515              :                           description="Number of points used in the line search SD.", &
     516              :                           usage="NP_LS <INTEGER>", &
     517        10679 :                           default_i_val=2)
     518        10679 :       CALL section_add_keyword(subsection, keyword)
     519        10679 :       CALL keyword_release(keyword)
     520              : 
     521              :       CALL keyword_create(keyword, __LOCATION__, name="NO_LS", &
     522              :                           description="Does not perform LS during SD. Useful in combination with a proper STEPSIZE"// &
     523              :                           " for particularly out of equilibrium starting geometries.", &
     524        10679 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     525        10679 :       CALL section_add_keyword(subsection, keyword)
     526        10679 :       CALL keyword_release(keyword)
     527              : 
     528              :       CALL keyword_create(keyword, __LOCATION__, name="CHECK_DIIS", &
     529              :                           description="Performs a series of checks on the DIIS solution in order to accept the DIIS step."// &
     530              :                           " If set to .FALSE. the only check performed is that the angle between the DIIS solution and the"// &
     531              :                           " reference vector is less than Pi/2. Can be useful if many DIIS steps are rejected.", &
     532        10679 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     533        10679 :       CALL section_add_keyword(subsection, keyword)
     534        10679 :       CALL keyword_release(keyword)
     535              : 
     536              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "diis_info", &
     537              :                                        description="Controls the printing of DIIS info during a BAND run", &
     538        10679 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
     539        10679 :       CALL section_add_subsection(subsection, print_key)
     540        10679 :       CALL section_release(print_key)
     541              : 
     542        10679 :       CALL section_add_subsection(section, subsection)
     543        10679 :       CALL section_release(subsection)
     544        10679 :    END SUBROUTINE create_opt_band_section
     545              : 
     546              : END MODULE input_cp2k_neb
        

Generated by: LCOV version 2.0-1