LCOV - code coverage report
Current view: top level - src - input_cp2k_neb.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:561f475) Lines: 100.0 % 185 185
Test Date: 2026-06-21 06:48:54 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        10629 :    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        10629 :       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        63774 :                           citations=[Elber1987, Jonsson1998, Jonsson2000_1, Jonsson2000_2, Wales2004])
      70        10629 :       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        10629 :                           default_i_val=1)
      76        10629 :       CALL section_add_keyword(section, keyword)
      77        10629 :       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        10629 :                           default_i_val=do_rep_blocked)
      88        10629 :       CALL section_add_keyword(section, keyword)
      89        10629 :       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        10629 :                           enum_i_vals=[do_b_neb, do_it_neb, do_ci_neb, do_d_neb, do_sm, do_eb])
     108        10629 :       CALL section_add_keyword(section, keyword)
     109        10629 :       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.", &
     119        10629 :                           default_i_val=10)
     120        10629 :       CALL section_add_keyword(section, keyword)
     121        10629 :       CALL keyword_release(keyword)
     122              : 
     123              :       CALL keyword_create(keyword, __LOCATION__, name="USE_COLVARS", &
     124              :                           description="Uses a version of the band scheme projected in a subspace of colvars.", &
     125        10629 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     126        10629 :       CALL section_add_keyword(section, keyword)
     127        10629 :       CALL keyword_release(keyword)
     128              : 
     129              :       CALL keyword_create(keyword, __LOCATION__, name="POT_TYPE", &
     130              :                           description="Specifies the type of potential used in the BAND calculation", &
     131              :                           usage="POT_TYPE (FULL|FE|ME)", &
     132              :                           default_i_val=pot_neb_full, &
     133              :                           enum_c_vals=s2a("FULL", &
     134              :                                           "FE", &
     135              :                                           "ME"), &
     136              :                           enum_desc=s2a("Full potential (no projections in a subspace of colvars)", &
     137              :                                         "Free energy (requires a projections in a subspace of colvars)", &
     138              :                                         "Minimum energy (requires a projections in a subspace of colvars)"), &
     139        10629 :                           enum_i_vals=[pot_neb_full, pot_neb_fe, pot_neb_me])
     140        10629 :       CALL section_add_keyword(section, keyword)
     141        10629 :       CALL keyword_release(keyword)
     142              : 
     143              :       CALL keyword_create(keyword, __LOCATION__, name="ROTATE_FRAMES", &
     144              :                           description="Compute at each BAND step the RMSD and rotate the frames in order"// &
     145              :                           " to minimize it.", &
     146        10629 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     147        10629 :       CALL section_add_keyword(section, keyword)
     148        10629 :       CALL keyword_release(keyword)
     149              : 
     150              :       CALL keyword_create(keyword, __LOCATION__, name="ALIGN_FRAMES", &
     151              :                           description="Enables the alignment of the frames at the beginning of a BAND calculation. "// &
     152              :                           "This keyword does not affect the rotation of the replicas during a BAND calculation.", &
     153        10629 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     154        10629 :       CALL section_add_keyword(section, keyword)
     155        10629 :       CALL keyword_release(keyword)
     156              : 
     157              :       CALL keyword_create(keyword, __LOCATION__, name="K_SPRING", &
     158              :                           variants=["K"], &
     159              :                           description="Specify the value of the spring constant", &
     160        21258 :                           default_r_val=0.02_dp)
     161        10629 :       CALL section_add_keyword(section, keyword)
     162        10629 :       CALL keyword_release(keyword)
     163              : 
     164              :       ! Convergence_control
     165              :       CALL section_create(subsection, __LOCATION__, name="CONVERGENCE_CONTROL", &
     166              :                           description="Setup parameters to control the convergence criteria for BAND", &
     167        10629 :                           repeats=.FALSE.)
     168              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_DR", &
     169              :                           description="Tolerance on the maximum value of the displacement on the BAND.", &
     170              :                           usage="MAX_DR {real}", &
     171        10629 :                           default_r_val=0.0002_dp)
     172        10629 :       CALL section_add_keyword(subsection, keyword)
     173        10629 :       CALL keyword_release(keyword)
     174              : 
     175              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_FORCE", &
     176              :                           description="Tolerance on the maximum value of Forces on the BAND.", &
     177              :                           usage="MAX_FORCE {real}", &
     178        10629 :                           default_r_val=0.00045_dp)
     179        10629 :       CALL section_add_keyword(subsection, keyword)
     180        10629 :       CALL keyword_release(keyword)
     181              : 
     182              :       CALL keyword_create(keyword, __LOCATION__, name="RMS_DR", &
     183              :                           description="Tolerance on RMS displacements on the BAND.", &
     184              :                           usage="RMS_DR {real}", &
     185        10629 :                           default_r_val=0.0001_dp)
     186        10629 :       CALL section_add_keyword(subsection, keyword)
     187        10629 :       CALL keyword_release(keyword)
     188              : 
     189              :       CALL keyword_create(keyword, __LOCATION__, name="RMS_FORCE", &
     190              :                           description="Tolerance on RMS Forces on the BAND.", &
     191              :                           usage="RMS_FORCE {real}", &
     192        10629 :                           default_r_val=0.00030_dp)
     193        10629 :       CALL section_add_keyword(subsection, keyword)
     194        10629 :       CALL keyword_release(keyword)
     195        10629 :       CALL section_add_subsection(section, subsection)
     196        10629 :       CALL section_release(subsection)
     197              : 
     198        10629 :       NULLIFY (subsection, subsubsection)
     199              :       ! CI-NEB section
     200              :       CALL section_create(subsection, __LOCATION__, name="CI_NEB", &
     201              :                           description="Controls parameters for CI-NEB type calculation only.", &
     202        10629 :                           repeats=.FALSE.)
     203              :       CALL keyword_create(keyword, __LOCATION__, name="NSTEPS_IT", &
     204              :                           description="Specify the number of steps of IT-NEB to perform before "// &
     205              :                           "switching on the CI algorithm", &
     206        10629 :                           default_i_val=5)
     207        10629 :       CALL section_add_keyword(subsection, keyword)
     208        10629 :       CALL keyword_release(keyword)
     209        10629 :       CALL section_add_subsection(section, subsection)
     210        10629 :       CALL section_release(subsection)
     211              : 
     212              :       ! String Method section
     213              :       CALL section_create(subsection, __LOCATION__, name="STRING_METHOD", &
     214              :                           description="Controls parameters for String Method type calculation only.", &
     215        10629 :                           repeats=.FALSE.)
     216              : 
     217              :       CALL keyword_create(keyword, __LOCATION__, name="SPLINE_ORDER", &
     218              :                           description="Specify the oder of the spline used in the String Method.", &
     219        10629 :                           default_i_val=1)
     220        10629 :       CALL section_add_keyword(subsection, keyword)
     221        10629 :       CALL keyword_release(keyword)
     222              :       CALL keyword_create(keyword, __LOCATION__, name="SMOOTHING", &
     223              :                           description="Smoothing parameter for the reparametrization of the frames.", &
     224        10629 :                           default_r_val=0.2_dp)
     225        10629 :       CALL section_add_keyword(subsection, keyword)
     226        10629 :       CALL keyword_release(keyword)
     227              : 
     228        10629 :       CALL section_add_subsection(section, subsection)
     229        10629 :       CALL section_release(subsection)
     230              : 
     231              :       ! Optimization section
     232              :       CALL section_create(subsection, __LOCATION__, name="optimize_band", &
     233              :                           description="Specify the optimization method for the band", &
     234        10629 :                           repeats=.TRUE.)
     235        10629 :       CALL create_opt_band_section(subsection)
     236        10629 :       CALL section_add_subsection(section, subsection)
     237        10629 :       CALL section_release(subsection)
     238              : 
     239              :       ! replica section: to specify coordinates and velocities (possibly) of the
     240              :       ! different replica used in the BAND
     241              :       CALL section_create(subsection, __LOCATION__, name="replica", &
     242              :                           description="Specify coordinates and velocities (possibly) of the replica", &
     243        10629 :                           repeats=.TRUE.)
     244              :       ! Colvar
     245              :       CALL keyword_create(keyword, __LOCATION__, name="COLLECTIVE", &
     246              :                           description="Specifies the value of the collective variables used in the projected"// &
     247              :                           " BAND method. The order of the values is the order of the COLLECTIVE section in the"// &
     248              :                           " constraints/restraints section", &
     249              :                           usage="COLLECTIVE {real} .. {real}", &
     250        10629 :                           type_of_var=real_t, n_var=-1)
     251        10629 :       CALL section_add_keyword(subsection, keyword)
     252        10629 :       CALL keyword_release(keyword)
     253              :       ! Coordinates read through an external file
     254              :       CALL keyword_create(keyword, __LOCATION__, name="COORD_FILE_NAME", &
     255              :                           description="Name of the xyz file with coordinates (alternative to &COORD section)", &
     256              :                           usage="COORD_FILE_NAME <CHAR>", &
     257        10629 :                           default_lc_val="")
     258        10629 :       CALL section_add_keyword(subsection, keyword)
     259        10629 :       CALL keyword_release(keyword)
     260              :       ! Coordinates and velocities
     261        10629 :       CALL create_coord_section(subsubsection, "BAND")
     262        10629 :       CALL section_add_subsection(subsection, subsubsection)
     263        10629 :       CALL section_release(subsubsection)
     264        10629 :       CALL create_velocity_section(subsubsection, "BAND")
     265        10629 :       CALL section_add_subsection(subsection, subsubsection)
     266        10629 :       CALL section_release(subsubsection)
     267              : 
     268        10629 :       CALL section_add_subsection(section, subsection)
     269        10629 :       CALL section_release(subsection)
     270              : 
     271              :       ! Print key section
     272              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "PROGRAM_RUN_INFO", &
     273              :                                        description="Controls the printing basic info about the BAND run", &
     274        10629 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
     275              : 
     276              :       CALL keyword_create(keyword, __LOCATION__, name="INITIAL_CONFIGURATION_INFO", &
     277              :                           description="Print information for the setup of the initial configuration.", &
     278              :                           usage="INITIAL_CONFIGURATION_INFO <LOGICAL>", &
     279        10629 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     280        10629 :       CALL section_add_keyword(print_key, keyword)
     281        10629 :       CALL keyword_release(keyword)
     282              : 
     283              :       CALL keyword_create(keyword, __LOCATION__, name="PLOT_REL_ENERGY", &
     284              :                           description="If a simple plot of relative energy of each replica is shown "// &
     285              :                           "alongside data vertically. This makes the output format less compact than "// &
     286              :                           "default, but creates a visual aid for ease of monitoring with some special "// &
     287              :                           "marks for the local maxima (X) or minima (x) in the plot.", &
     288              :                           usage="PLOT_REL_ENERGY <LOGICAL>", &
     289        10629 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     290        10629 :       CALL section_add_keyword(print_key, keyword)
     291        10629 :       CALL keyword_release(keyword)
     292              : 
     293        10629 :       CALL section_add_subsection(section, print_key)
     294        10629 :       CALL section_release(print_key)
     295              : 
     296              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "CONVERGENCE_INFO", &
     297              :                                        description="Controls the printing of the convergence criteria during a BAND run", &
     298        10629 :                                        print_level=low_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
     299        10629 :       CALL section_add_subsection(section, print_key)
     300        10629 :       CALL section_release(print_key)
     301              : 
     302              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "REPLICA_INFO", &
     303              :                                        description="Controls the printing of each replica info during a BAND run", &
     304        10629 :                                        print_level=medium_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
     305        10629 :       CALL section_add_subsection(section, print_key)
     306        10629 :       CALL section_release(print_key)
     307              : 
     308              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "ENERGY", &
     309              :                                        description="Controls the printing of the ENER file in a BAND run", &
     310              :                                        print_level=low_print_level, common_iter_levels=1, &
     311        10629 :                                        filename="")
     312        10629 :       CALL section_add_subsection(section, print_key)
     313        10629 :       CALL section_release(print_key)
     314              : 
     315              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "FINAL_BAND", &
     316              :                                        description="Controls the printing of the final structures as an "// &
     317              :                                        "XYZ trajectory file after a BAND run, regardless of convergence "// &
     318              :                                        "status. The unit is angstrom for coordinates and cell vectors.", &
     319              :                                        print_level=low_print_level, common_iter_levels=1, &
     320        10629 :                                        filename="FINAL")
     321              : 
     322              :       CALL keyword_create(keyword, __LOCATION__, name="PRINT_ATOM_KIND", &
     323              :                           description="Write the atom kind given in the subsys section instead "// &
     324              :                           "of the element symbol in the XYZ trajectory file.", &
     325              :                           usage="PRINT_ATOM_KIND {LOGICAL}", &
     326        10629 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     327        10629 :       CALL section_add_keyword(print_key, keyword)
     328        10629 :       CALL keyword_release(keyword)
     329              : 
     330        10629 :       CALL section_add_subsection(section, print_key)
     331        10629 :       CALL section_release(print_key)
     332              : 
     333              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "BANNER", &
     334              :                                        description="Controls the printing of the BAND banner", &
     335              :                                        print_level=low_print_level, common_iter_levels=1, &
     336        10629 :                                        filename="__STD_OUT__")
     337        10629 :       CALL section_add_subsection(section, print_key)
     338        10629 :       CALL section_release(print_key)
     339        10629 :    END SUBROUTINE create_band_section
     340              : 
     341              : ! **************************************************************************************************
     342              : !> \brief creates the optimization section for a BAND run
     343              : !> \param section will contain the pint section
     344              : !> \author Teodoro Laino 02.2007 [tlaino]
     345              : ! **************************************************************************************************
     346        10629 :    SUBROUTINE create_opt_band_section(section)
     347              :       TYPE(section_type), POINTER                        :: section
     348              : 
     349              :       TYPE(keyword_type), POINTER                        :: keyword
     350              :       TYPE(section_type), POINTER                        :: print_key, subsection, subsubsection
     351              : 
     352        10629 :       CPASSERT(ASSOCIATED(section))
     353        10629 :       NULLIFY (keyword, print_key, subsection, subsubsection)
     354              : 
     355              :       CALL keyword_create(keyword, __LOCATION__, name="OPT_TYPE", &
     356              :                           description="Specifies the type optimizer used for the band", &
     357              :                           usage="OPT_TYPE (MD|DIIS)", &
     358              :                           default_i_val=band_diis_opt, &
     359              :                           enum_c_vals=s2a("MD", &
     360              :                                           "DIIS"), &
     361              :                           enum_desc=s2a("Molecular dynamics-based optimizer", &
     362              :                                         "Coupled steepest descent / direct inversion in the iterative subspace"), &
     363        10629 :                           enum_i_vals=[band_md_opt, band_diis_opt])
     364        10629 :       CALL section_add_keyword(section, keyword)
     365        10629 :       CALL keyword_release(keyword)
     366              : 
     367              :       CALL keyword_create(keyword, __LOCATION__, name="OPTIMIZE_END_POINTS", &
     368              :                           description="Performs also an optimization of the end points of the band.", &
     369        10629 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     370        10629 :       CALL section_add_keyword(section, keyword)
     371        10629 :       CALL keyword_release(keyword)
     372              : 
     373              :       ! MD optimization section
     374              :       CALL section_create(subsection, __LOCATION__, name="MD", &
     375              :                           description="Activate the MD based optimization procedure for BAND", &
     376        10629 :                           repeats=.FALSE.)
     377              : 
     378              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_STEPS", &
     379              :                           description="Specify the maximum number of MD steps", &
     380        10629 :                           default_i_val=100)
     381        10629 :       CALL section_add_keyword(subsection, keyword)
     382        10629 :       CALL keyword_release(keyword)
     383              : 
     384              :       CALL keyword_create( &
     385              :          keyword, __LOCATION__, &
     386              :          name="timestep", &
     387              :          description="The length of an integration step", &
     388              :          usage="timestep 1.0", &
     389              :          default_r_val=cp_unit_to_cp2k(value=0.5_dp, &
     390              :                                        unit_str="fs"), &
     391        10629 :          unit_str="fs")
     392        10629 :       CALL section_add_keyword(subsection, keyword)
     393        10629 :       CALL keyword_release(keyword)
     394              : 
     395              :       CALL keyword_create(keyword, __LOCATION__, name="TEMPERATURE", &
     396              :                           description="Specify the initial temperature", &
     397              :                           default_r_val=cp_unit_to_cp2k(value=0.0_dp, &
     398              :                                                         unit_str="K"), &
     399        10629 :                           unit_str="K")
     400        10629 :       CALL section_add_keyword(subsection, keyword)
     401        10629 :       CALL keyword_release(keyword)
     402              : 
     403              :       ! Temp_control
     404              :       CALL section_create(subsubsection, __LOCATION__, name="TEMP_CONTROL", &
     405              :                           description="Setup parameters to control the temperature during a BAND MD run.", &
     406        10629 :                           repeats=.FALSE.)
     407              :       CALL keyword_create(keyword, __LOCATION__, name="TEMPERATURE", &
     408              :                           description="Specify the target temperature", &
     409        10629 :                           type_of_var=real_t, unit_str="K")
     410        10629 :       CALL section_add_keyword(subsubsection, keyword)
     411        10629 :       CALL keyword_release(keyword)
     412              : 
     413              :       CALL keyword_create(keyword, __LOCATION__, name="TEMP_TOL", &
     414              :                           description="Specify the tolerance on the temperature for rescaling", &
     415              :                           default_r_val=cp_unit_to_cp2k(value=0.0_dp, &
     416              :                                                         unit_str="K"), &
     417        10629 :                           unit_str="K")
     418        10629 :       CALL section_add_keyword(subsubsection, keyword)
     419        10629 :       CALL keyword_release(keyword)
     420              : 
     421              :       CALL keyword_create(keyword, __LOCATION__, name="TEMP_TOL_STEPS", &
     422              :                           description="Specify the number of steps to apply a temperature control", &
     423        10629 :                           default_i_val=0)
     424        10629 :       CALL section_add_keyword(subsubsection, keyword)
     425        10629 :       CALL keyword_release(keyword)
     426        10629 :       CALL section_add_subsection(subsection, subsubsection)
     427        10629 :       CALL section_release(subsubsection)
     428              : 
     429              :       ! Vel_control
     430              :       CALL section_create(subsubsection, __LOCATION__, name="VEL_CONTROL", &
     431              :                           description="Setup parameters to control the velocity during a BAND MD run.", &
     432        10629 :                           repeats=.FALSE.)
     433              :       CALL keyword_create(keyword, __LOCATION__, name="ANNEALING", &
     434              :                           description="Specify the annealing coefficient", &
     435        10629 :                           default_r_val=1.0_dp)
     436        10629 :       CALL section_add_keyword(subsubsection, keyword)
     437        10629 :       CALL keyword_release(keyword)
     438              :       CALL keyword_create(keyword, __LOCATION__, name="PROJ_VELOCITY_VERLET", &
     439              :                           description="Uses a Projected Velocity Verlet instead of a normal Velocity Verlet."// &
     440              :                           " Every time the cosine between velocities and forces is < 0 velocities are"// &
     441              :                           " zeroed.", &
     442              :                           usage="PROJ_VELOCITY_VERLET <LOGICAL>", &
     443        10629 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     444        10629 :       CALL section_add_keyword(subsubsection, keyword)
     445        10629 :       CALL keyword_release(keyword)
     446              :       CALL keyword_create(keyword, __LOCATION__, name="SD_LIKE", &
     447              :                           description="Zeros velocity at each MD step emulating a steepest descent like "// &
     448              :                           "(SD_LIKE) approach", &
     449              :                           usage="SD_LIKE <LOGICAL>", &
     450        10629 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     451        10629 :       CALL section_add_keyword(subsubsection, keyword)
     452        10629 :       CALL keyword_release(keyword)
     453        10629 :       CALL section_add_subsection(subsection, subsubsection)
     454        10629 :       CALL section_release(subsubsection)
     455              :       ! End of MD
     456        10629 :       CALL section_add_subsection(section, subsection)
     457        10629 :       CALL section_release(subsection)
     458              : 
     459              :       ! DIIS optimization section
     460              :       CALL section_create(subsection, __LOCATION__, name="DIIS", &
     461              :                           description="Activate the DIIS based optimization procedure for BAND", &
     462        10629 :                           repeats=.FALSE.)
     463              : 
     464              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_SD_STEPS", &
     465              :                           description="Specify the maximum number of SD steps to perform"// &
     466              :                           " before switching on DIIS (the minimum number will always be equal to N_DIIS).", &
     467        10629 :                           default_i_val=1)
     468        10629 :       CALL section_add_keyword(subsection, keyword)
     469        10629 :       CALL keyword_release(keyword)
     470              : 
     471              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_STEPS", &
     472              :                           description="Specify the maximum number of optimization steps", &
     473        10629 :                           default_i_val=100)
     474        10629 :       CALL section_add_keyword(subsection, keyword)
     475        10629 :       CALL keyword_release(keyword)
     476              : 
     477              :       CALL keyword_create(keyword, __LOCATION__, name="N_DIIS", &
     478              :                           variants=["NDIIS"], &
     479              :                           description="Number of history vectors to be used with DIIS", &
     480              :                           usage="N_DIIS 4", &
     481        21258 :                           default_i_val=7)
     482        10629 :       CALL section_add_keyword(subsection, keyword)
     483        10629 :       CALL keyword_release(keyword)
     484              : 
     485              :       CALL keyword_create(keyword, __LOCATION__, name="STEPSIZE", &
     486              :                           description="Initial stepsize used for the line search, sometimes this parameter "// &
     487              :                           "can be reduced to stabilize DIIS", &
     488              :                           usage="STEPSIZE <REAL>", &
     489        10629 :                           default_r_val=1.0_dp)
     490        10629 :       CALL section_add_keyword(subsection, keyword)
     491        10629 :       CALL keyword_release(keyword)
     492              : 
     493              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_STEPSIZE", &
     494              :                           description="Maximum stepsize used for the line search, sometimes this parameter "// &
     495              :                           "can be reduced to stabilize the LS for particularly difficult initial geometries", &
     496              :                           usage="MAX_STEPSIZE <REAL>", &
     497        10629 :                           default_r_val=2.0_dp)
     498        10629 :       CALL section_add_keyword(subsection, keyword)
     499        10629 :       CALL keyword_release(keyword)
     500              : 
     501              :       CALL keyword_create(keyword, __LOCATION__, name="NP_LS", &
     502              :                           description="Number of points used in the line search SD.", &
     503              :                           usage="NP_LS <INTEGER>", &
     504        10629 :                           default_i_val=2)
     505        10629 :       CALL section_add_keyword(subsection, keyword)
     506        10629 :       CALL keyword_release(keyword)
     507              : 
     508              :       CALL keyword_create(keyword, __LOCATION__, name="NO_LS", &
     509              :                           description="Does not perform LS during SD. Useful in combination with a proper STEPSIZE"// &
     510              :                           " for particularly out of equilibrium starting geometries.", &
     511        10629 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     512        10629 :       CALL section_add_keyword(subsection, keyword)
     513        10629 :       CALL keyword_release(keyword)
     514              : 
     515              :       CALL keyword_create(keyword, __LOCATION__, name="CHECK_DIIS", &
     516              :                           description="Performs a series of checks on the DIIS solution in order to accept the DIIS step."// &
     517              :                           " If set to .FALSE. the only check performed is that the angle between the DIIS solution and the"// &
     518              :                           " reference vector is less than Pi/2. Can be useful if many DIIS steps are rejected.", &
     519        10629 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     520        10629 :       CALL section_add_keyword(subsection, keyword)
     521        10629 :       CALL keyword_release(keyword)
     522              : 
     523              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "diis_info", &
     524              :                                        description="Controls the printing of DIIS info during a BAND run", &
     525        10629 :                                        print_level=high_print_level, add_last=add_last_numeric, filename="__STD_OUT__")
     526        10629 :       CALL section_add_subsection(subsection, print_key)
     527        10629 :       CALL section_release(print_key)
     528              : 
     529        10629 :       CALL section_add_subsection(section, subsection)
     530        10629 :       CALL section_release(subsection)
     531        10629 :    END SUBROUTINE create_opt_band_section
     532              : 
     533              : END MODULE input_cp2k_neb
        

Generated by: LCOV version 2.0-1