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

Generated by: LCOV version 2.0-1