LCOV - code coverage report
Current view: top level - src - input_cp2k_negf.F (source / functions) Coverage Total Hit
Test: CP2K Regtests (git:591cf04) Lines: 99.5 % 199 198
Test Date: 2026-09-21 02:17:57 Functions: 100.0 % 6 6

            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              : !> \brief Input section for NEGF based quantum transport calculations.
      10              : ! **************************************************************************************************
      11              : 
      12              : MODULE input_cp2k_negf
      13              :    USE bibliography,                    ONLY: Bailey2006,&
      14              :                                               Papior2017
      15              :    USE cp_output_handling,              ONLY: add_last_numeric,&
      16              :                                               cp_print_key_section_create,&
      17              :                                               debug_print_level,&
      18              :                                               high_print_level,&
      19              :                                               low_print_level,&
      20              :                                               medium_print_level,&
      21              :                                               silent_print_level
      22              :    USE input_constants,                 ONLY: negfint_method_cc,&
      23              :                                               negfint_method_simpson
      24              :    USE input_keyword_types,             ONLY: keyword_create,&
      25              :                                               keyword_release,&
      26              :                                               keyword_type
      27              :    USE input_section_types,             ONLY: section_add_keyword,&
      28              :                                               section_add_subsection,&
      29              :                                               section_create,&
      30              :                                               section_release,&
      31              :                                               section_type
      32              :    USE input_val_types,                 ONLY: char_t,&
      33              :                                               enum_t,&
      34              :                                               integer_t,&
      35              :                                               real_t
      36              :    USE kinds,                           ONLY: dp
      37              :    USE physcon,                         ONLY: kelvin
      38              :    USE qs_density_mixing_types,         ONLY: create_mixing_section
      39              :    USE string_utilities,                ONLY: s2a
      40              : #include "./base/base_uses.f90"
      41              : 
      42              :    IMPLICIT NONE
      43              :    PRIVATE
      44              : 
      45              :    CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_negf'
      46              : 
      47              :    PUBLIC :: create_negf_section
      48              : 
      49              : CONTAINS
      50              : 
      51              : ! **************************************************************************************************
      52              : !> \brief Create NEGF input section.
      53              : !> \param section input section
      54              : !> \par History
      55              : !>    * 02.2017 created [Sergey Chulkov]
      56              : ! **************************************************************************************************
      57         1380 :    SUBROUTINE create_negf_section(section)
      58              :       TYPE(section_type), POINTER                        :: section
      59              : 
      60              :       TYPE(keyword_type), POINTER                        :: keyword
      61              :       TYPE(section_type), POINTER                        :: print_key, subsection
      62              : 
      63         1380 :       CPASSERT(.NOT. ASSOCIATED(section))
      64              :       CALL section_create(section, __LOCATION__, name="NEGF", &
      65              :                           description="Parameters which control quantum transport calculation"// &
      66              :                           " based on Non-Equilibrium Green Function method.", &
      67              :                           citations=[Bailey2006, Papior2017], &
      68         4140 :                           n_keywords=18, n_subsections=6, repeats=.FALSE.)
      69              : 
      70         1380 :       NULLIFY (keyword, print_key, subsection)
      71              : 
      72         1380 :       CALL create_contact_section(subsection)
      73         1380 :       CALL section_add_subsection(section, subsection)
      74         1380 :       CALL section_release(subsection)
      75              : 
      76         1380 :       CALL create_scattering_region_section(subsection)
      77         1380 :       CALL section_add_subsection(section, subsection)
      78         1380 :       CALL section_release(subsection)
      79              : 
      80              :       ! mixing section
      81         1380 :       CALL create_mixing_section(subsection, ls_scf=.FALSE.)
      82         1380 :       CALL section_add_subsection(section, subsection)
      83         1380 :       CALL section_release(subsection)
      84              : 
      85              :       CALL keyword_create(keyword, __LOCATION__, name="DISABLE_CACHE", &
      86              :                           description="Do not keep contact self-energy matrices for future reuse", &
      87         1380 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
      88         1380 :       CALL section_add_keyword(section, keyword)
      89         1380 :       CALL keyword_release(keyword)
      90              : 
      91              :       ! convergence thresholds
      92              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_DENSITY", &
      93              :                           description="Target accuracy for electronic density.", &
      94         1380 :                           n_var=1, type_of_var=real_t, default_r_val=1.0e-5_dp)
      95         1380 :       CALL section_add_keyword(section, keyword)
      96         1380 :       CALL keyword_release(keyword)
      97              : 
      98              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_GREEN", &
      99              :                           description="Target accuracy for surface Green's functions.", &
     100         1380 :                           n_var=1, type_of_var=real_t, default_r_val=1.0e-5_dp)
     101         1380 :       CALL section_add_keyword(section, keyword)
     102         1380 :       CALL keyword_release(keyword)
     103              : 
     104              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_SCF", &
     105              :                           description="Target accuracy for SCF convergence.", &
     106         1380 :                           n_var=1, type_of_var=real_t, default_r_val=1.0e-5_dp)
     107         1380 :       CALL section_add_keyword(section, keyword)
     108         1380 :       CALL keyword_release(keyword)
     109              : 
     110              :       CALL keyword_create(keyword, __LOCATION__, name="EPS_GEO", &
     111              :                           description="Accuracy in mapping atoms between different force environments.", &
     112              :                           n_var=1, type_of_var=real_t, unit_str="angstrom", &
     113         1380 :                           default_r_val=1.0e-6_dp)
     114         1380 :       CALL section_add_keyword(section, keyword)
     115         1380 :       CALL keyword_release(keyword)
     116              : 
     117              :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY_LBOUND", &
     118              :                           description="Lower bound energy of the conductance band.", &
     119              :                           n_var=1, type_of_var=real_t, unit_str="hartree", &
     120         1380 :                           default_r_val=-5.0_dp)
     121         1380 :       CALL section_add_keyword(section, keyword)
     122         1380 :       CALL keyword_release(keyword)
     123              : 
     124              :       CALL keyword_create(keyword, __LOCATION__, name="ETA", &
     125              :                           description="Infinitesimal offset from the real axis.", &
     126              :                           n_var=1, type_of_var=real_t, unit_str="hartree", &
     127         1380 :                           default_r_val=1.0e-5_dp)
     128         1380 :       CALL section_add_keyword(section, keyword)
     129         1380 :       CALL keyword_release(keyword)
     130              : 
     131              :       CALL keyword_create(keyword, __LOCATION__, name="HOMO_LUMO_GAP", &
     132              :                           description="The gap between the HOMO and some fictitious LUMO. This option is used as"// &
     133              :                           " an initial offset to determine the actual Fermi level of bulk contacts."// &
     134              :                           " It does not need to be exact HOMO-LUMO gap, just some value to start with.", &
     135              :                           n_var=1, type_of_var=real_t, unit_str="hartree", &
     136         1380 :                           default_r_val=0.2_dp)
     137         1380 :       CALL section_add_keyword(section, keyword)
     138         1380 :       CALL keyword_release(keyword)
     139              : 
     140              :       CALL keyword_create(keyword, __LOCATION__, name="DELTA_NPOLES", &
     141              :                           description="Number of poles of Fermi function to consider.", &
     142              :                           n_var=1, type_of_var=integer_t, &
     143         1380 :                           default_i_val=4)
     144         1380 :       CALL section_add_keyword(section, keyword)
     145         1380 :       CALL keyword_release(keyword)
     146              : 
     147              :       CALL keyword_create(keyword, __LOCATION__, name="GAMMA_KT", &
     148              :                           description="Offset from the axis (in terms of k*T)"// &
     149              :                           " where poles of the Fermi function reside.", &
     150              :                           n_var=1, type_of_var=integer_t, &
     151         1380 :                           default_i_val=20)
     152         1380 :       CALL section_add_keyword(section, keyword)
     153         1380 :       CALL keyword_release(keyword)
     154              : 
     155              :       CALL keyword_create(keyword, __LOCATION__, name="INTEGRATION_METHOD", &
     156              :                           description="Method to integrate Green's functions along a closed-circuit contour.", &
     157              :                           default_i_val=negfint_method_cc, &
     158              :                           enum_c_vals=s2a("CLENSHAW-CURTIS", "SIMPSON"), &
     159              :                           enum_desc=s2a( &
     160              :                           "Adaptive Clenshaw-Curtis quadrature method. Requires FFTW3 library.", &
     161              :                           "Adaptive Simpson method. Works without FFTW3."), &
     162         1380 :                           enum_i_vals=[negfint_method_cc, negfint_method_simpson])
     163         1380 :       CALL section_add_keyword(section, keyword)
     164         1380 :       CALL keyword_release(keyword)
     165              : 
     166              :       CALL keyword_create(keyword, __LOCATION__, name="INTEGRATION_MIN_POINTS", &
     167              :                           description="Initial (minimal) number of grid point for adaptive numerical integration.", &
     168              :                           n_var=1, type_of_var=integer_t, &
     169         1380 :                           default_i_val=16)
     170         1380 :       CALL section_add_keyword(section, keyword)
     171         1380 :       CALL keyword_release(keyword)
     172              : 
     173              :       CALL keyword_create(keyword, __LOCATION__, name="INTEGRATION_MAX_POINTS", &
     174              :                           description="Maximal number of grid point for adaptive numerical integration.", &
     175              :                           n_var=1, type_of_var=integer_t, &
     176         1380 :                           default_i_val=512)
     177         1380 :       CALL section_add_keyword(section, keyword)
     178         1380 :       CALL keyword_release(keyword)
     179              : 
     180              :       CALL keyword_create(keyword, __LOCATION__, name="MAX_SCF", &
     181              :                           description="Maximum number of SCF iterations to be performed.", &
     182              :                           n_var=1, type_of_var=integer_t, &
     183         1380 :                           default_i_val=30)
     184         1380 :       CALL section_add_keyword(section, keyword)
     185         1380 :       CALL keyword_release(keyword)
     186              : 
     187              :       CALL keyword_create(keyword, __LOCATION__, name="NPROC_POINT", &
     188              :                           description="Number of MPI processes to be used per energy point."// &
     189              :                           " Default is to use all processors (0).", &
     190              :                           n_var=1, type_of_var=integer_t, &
     191         1380 :                           default_i_val=0)
     192         1380 :       CALL section_add_keyword(section, keyword)
     193         1380 :       CALL keyword_release(keyword)
     194              : 
     195              :       CALL keyword_create(keyword, __LOCATION__, name="V_SHIFT", &
     196              :                           description="Initial value of the Hartree potential shift", &
     197              :                           n_var=1, type_of_var=real_t, unit_str="hartree", &
     198         1380 :                           default_r_val=0.0_dp)
     199         1380 :       CALL section_add_keyword(section, keyword)
     200         1380 :       CALL keyword_release(keyword)
     201              : 
     202              :       CALL keyword_create(keyword, __LOCATION__, name="V_SHIFT_OFFSET", &
     203              :                           description="Initial offset to determine the optimal shift in Hartree potential.", &
     204         1380 :                           n_var=1, type_of_var=real_t, default_r_val=0.10_dp)
     205         1380 :       CALL section_add_keyword(section, keyword)
     206         1380 :       CALL keyword_release(keyword)
     207              : 
     208              :       CALL keyword_create(keyword, __LOCATION__, name="V_SHIFT_MAX_ITERS", &
     209              :                           description="Maximal number of iteration to determine the optimal shift in Hartree potential.", &
     210         1380 :                           n_var=1, type_of_var=integer_t, default_i_val=30)
     211         1380 :       CALL section_add_keyword(section, keyword)
     212         1380 :       CALL keyword_release(keyword)
     213              : 
     214              :       ! PRINT subsection
     215              :       CALL section_create(subsection, __LOCATION__, "PRINT", "Printing of information during the NEGF.", &
     216         1380 :                           repeats=.FALSE.)
     217              : 
     218         1380 :       CALL create_print_program_run_info_section(print_key)
     219         1380 :       CALL section_add_subsection(subsection, print_key)
     220         1380 :       CALL section_release(print_key)
     221              : 
     222         1380 :       CALL create_print_dos_section(print_key, "DOS", "the Density of States (DOS) in the scattering region")
     223         1380 :       CALL section_add_subsection(subsection, print_key)
     224         1380 :       CALL section_release(print_key)
     225              : 
     226         1380 :       CALL create_print_dos_section(print_key, "TRANSMISSION", "the transmission function")
     227         1380 :       CALL section_add_subsection(subsection, print_key)
     228         1380 :       CALL section_release(print_key)
     229              : 
     230              :       CALL keyword_create(keyword, __LOCATION__, name="ENERGY_UNIT", &
     231              :                           description="Energy unit used for the printed Transmission/DOS energy axis. "// &
     232              :                           "Density of states (DOS) values are converted consistently to the selected energy unit.", &
     233              :                           usage="ENERGY_UNIT HARTREE", type_of_var=enum_t, &
     234              :                           enum_c_vals=s2a("HARTREE", "EV"), &
     235              :                           enum_i_vals=[1, 2], &
     236              :                           enum_desc=s2a("Print energies in Hartree (a.u.).", &
     237              :                                         "Print energies in electronvolt (eV)."), &
     238         1380 :                           default_i_val=2)
     239         1380 :       CALL section_add_keyword(subsection, keyword)
     240         1380 :       CALL keyword_release(keyword)
     241              : 
     242              :       ! RESTART subsection
     243              :       CALL cp_print_key_section_create(print_key, __LOCATION__, "RESTART", &
     244              :                                        description="Controls the dumping of the restart files during NEGF SCF."// &
     245              :                                        " By default keeps a short history of three restarts.", &
     246              :                                        print_level=low_print_level, common_iter_levels=3, &
     247              :                                        each_iter_names=s2a("NEGF_SCF"), each_iter_values=[1], &
     248         1380 :                                        add_last=add_last_numeric, filename="RESTART")
     249              :       CALL keyword_create(keyword, __LOCATION__, name="BACKUP_COPIES", &
     250              :                           description="Specifies the maximum number of backup copies.", &
     251              :                           usage="BACKUP_COPIES {int}", &
     252         1380 :                           default_i_val=3)
     253         1380 :       CALL section_add_keyword(print_key, keyword)
     254         1380 :       CALL keyword_release(keyword)
     255         1380 :       CALL section_add_subsection(subsection, print_key)
     256         1380 :       CALL section_release(print_key)
     257              : 
     258         1380 :       CALL section_add_subsection(section, subsection)
     259         1380 :       CALL section_release(subsection)
     260              : 
     261              :       ! SCF subsection
     262              :       CALL section_create(subsection, __LOCATION__, "SCF", "Additional parameters for an NEGF SCF run.", &
     263         1380 :                           repeats=.FALSE.)
     264              : 
     265              :       CALL keyword_create(keyword, __LOCATION__, name="UPDATE_HS", &
     266              :                           description="Change the atomic Hamiltonian during NEGF self-consistent cycle."// &
     267              :                           " If .FALSE., only the density matrix is updated.", &
     268         1380 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     269         1380 :       CALL section_add_keyword(subsection, keyword)
     270         1380 :       CALL keyword_release(keyword)
     271              : 
     272              :       CALL keyword_create(keyword, __LOCATION__, name="RESTART_SCF", &
     273              :                           description="Restart SCF from files saved as defined in NEGF%PRINT%RESTART", &
     274         1380 :                           default_l_val=.TRUE., lone_keyword_l_val=.TRUE.)
     275         1380 :       CALL section_add_keyword(subsection, keyword)
     276         1380 :       CALL keyword_release(keyword)
     277              : 
     278         1380 :       CALL section_add_subsection(section, subsection)
     279         1380 :       CALL section_release(subsection)
     280              : 
     281         1380 :    END SUBROUTINE create_negf_section
     282              : 
     283              : ! **************************************************************************************************
     284              : !> \brief Create NEGF%CONTACT input section.
     285              : !> \param section input section
     286              : !> \par History
     287              : !>    * 09.2017 split from create_negf_section() [Sergey Chulkov]
     288              : ! **************************************************************************************************
     289         1380 :    SUBROUTINE create_contact_section(section)
     290              :       TYPE(section_type), POINTER                        :: section
     291              : 
     292              :       TYPE(keyword_type), POINTER                        :: keyword
     293              :       TYPE(section_type), POINTER                        :: print_key, subsection, subsection2
     294              : 
     295         1380 :       CPASSERT(.NOT. ASSOCIATED(section))
     296              : 
     297              :       CALL section_create(section, __LOCATION__, name="CONTACT", &
     298              :                           description="Section defining the contact region of NEGF setup.", &
     299         1380 :                           n_keywords=5, n_subsections=3, repeats=.TRUE.)
     300              : 
     301         1380 :       NULLIFY (keyword, print_key, subsection, subsection2)
     302              : 
     303              :       CALL create_atomlist_section(subsection, "BULK_REGION", &
     304         1380 :                                    "the bulk contact adjacent to the screening region.", .FALSE.)
     305         1380 :       CALL section_add_subsection(section, subsection)
     306              :       CALL create_atomlist_section(subsection2, "CELL", &
     307              :                                    "a single bulk contact unit cell. Bulk Hamiltonian will be contstructed "// &
     308              :                                    "using two such unit cells instead of performing k-point bulk calculation. "// &
     309         1380 :                                    "FORCE_EVAL_SECTION must be 0.", .TRUE.)
     310         1380 :       CALL section_add_subsection(subsection, subsection2)
     311         1380 :       CALL section_release(subsection2)
     312         1380 :       CALL section_release(subsection)
     313              : 
     314              :       CALL create_atomlist_section(subsection, "SCREENING_REGION", &
     315         1380 :                                    "the given contact adjacent to the scattering region.", .FALSE.)
     316         1380 :       CALL section_add_subsection(section, subsection)
     317         1380 :       CALL section_release(subsection)
     318              : 
     319              :       CALL keyword_create(keyword, __LOCATION__, name="FORCE_EVAL_SECTION", &
     320              :                           description=" Index of the FORCE_EVAL section which will be used for bulk calculation.", &
     321         1380 :                           n_var=1, type_of_var=integer_t, default_i_val=0)
     322         1380 :       CALL section_add_keyword(section, keyword)
     323         1380 :       CALL keyword_release(keyword)
     324              : 
     325              :       CALL keyword_create(keyword, __LOCATION__, name="ELECTRIC_POTENTIAL", &
     326              :                           description="External electrostatic potential applied to the given contact.", &
     327              :                           n_var=1, type_of_var=real_t, unit_str="hartree", &
     328         1380 :                           default_r_val=0.0_dp)
     329         1380 :       CALL section_add_keyword(section, keyword)
     330         1380 :       CALL keyword_release(keyword)
     331              : 
     332              :       CALL keyword_create(keyword, __LOCATION__, name="FERMI_LEVEL", &
     333              :                           description="Contact Fermi level at the given temperature."// &
     334              :                           " If this keyword is not given explicitly, the Fermi level"// &
     335              :                           " will be automatically computed prior the actual NEGF calculation.", &
     336              :                           n_var=1, type_of_var=real_t, unit_str="hartree", &
     337         1380 :                           default_r_val=0.0_dp)
     338         1380 :       CALL section_add_keyword(section, keyword)
     339         1380 :       CALL keyword_release(keyword)
     340              : 
     341              :       CALL keyword_create(keyword, __LOCATION__, name="REFINE_FERMI_LEVEL", &
     342              :                           description="Compute the Fermi level using the value from the FERMI_LEVEL keyword"// &
     343              :                           " as a starting point. By default the Fermi level is computed only"// &
     344              :                           " when the keyword FERMI_LEVEL is not given explicitly.", &
     345         1380 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     346         1380 :       CALL section_add_keyword(section, keyword)
     347         1380 :       CALL keyword_release(keyword)
     348              : 
     349              :       CALL keyword_create(keyword, __LOCATION__, name="FERMI_LEVEL_SHIFTED", &
     350              :                           description="Used to shift the zero-energy level of an electrode to the common zero-energy level."// &
     351              :                           " If this keyword is specified, the Fermi level,"// &
     352              :                           " calculated by standard DFT or NEGF (using the REFINE_FERMI_LEVEL keyword),"// &
     353              :                           " or previously specified using the FERMI_LEVEL keyword,"// &
     354              :                           " is changed to this value. All diagonal elements of the Hamiltonian are shifted accordingly.", &
     355              :                           n_var=1, type_of_var=real_t, unit_str="hartree", &
     356         1380 :                           default_r_val=0.0_dp)
     357         1380 :       CALL section_add_keyword(section, keyword)
     358         1380 :       CALL keyword_release(keyword)
     359              : 
     360              :       CALL keyword_create(keyword, __LOCATION__, name="TEMPERATURE", &
     361              :                           description="Electronic temperature.", &
     362              :                           n_var=1, type_of_var=real_t, unit_str="K", &
     363         1380 :                           default_r_val=300.0_dp/kelvin)
     364         1380 :       CALL section_add_keyword(section, keyword)
     365         1380 :       CALL keyword_release(keyword)
     366              : 
     367              :       ! PRINT subsection
     368              :       CALL section_create(subsection, __LOCATION__, "PRINT", "Print properties for the given contact.", &
     369         1380 :                           repeats=.FALSE.)
     370              : 
     371         1380 :       CALL create_print_dos_section(print_key, "DOS", "the Density of States (DOS)")
     372         1380 :       CALL section_add_subsection(subsection, print_key)
     373         1380 :       CALL section_release(print_key)
     374              : 
     375         1380 :       CALL section_add_subsection(section, subsection)
     376         1380 :       CALL section_release(subsection)
     377              : 
     378              :       ! RESTART subsection
     379              :       CALL section_create(subsection, __LOCATION__, "RESTART", &
     380         1380 :                           "Controls reading and writing of the restart files for the specified contact.", repeats=.FALSE.)
     381              : 
     382              :       CALL keyword_create(keyword, __LOCATION__, name="FILENAME", &
     383              :                           description=' Controls part of the filename for output. '// &
     384              :                           ' Use filename to obtain projectname-filename. '// &
     385              :                           ' Use ./filename to get filename.'// &
     386              :                           ' A middle name (contact number, type of matrix, spin if 2 spins) and extension '// &
     387              :                           ' are always added to the filename.', &
     388              :                           usage="FILENAME ./filename ", &
     389         1380 :                           default_lc_val="")
     390         1380 :       CALL section_add_keyword(subsection, keyword)
     391         1380 :       CALL keyword_release(keyword)
     392              : 
     393              :       CALL keyword_create(keyword, __LOCATION__, name="READ_WRITE_HS", &
     394              :                           description="Requests reading of the electrode Hamiltonian and overlap matrices from a file."// &
     395              :                           " If at least one of these files doesn't exist, all Hamiltonian and overlap matrices"// &
     396              :                           " are calculated and saved. If no name is specified by FILENAME, the default file names are"// &
     397              :                           " projectname-Nn-H00, projectname-Nn-H01, projectname-Nn-S00, projectname-Nn-S01"// &
     398              :                           " for restricted calculations with identical spin population, or"// &
     399              :                           " projectname-Nn-H00-Ss, projectname-Nn-H01-Ss, projectname-Nn-S00-Ss, projectname-Nn-S01-Ss"// &
     400              :                           " for unrestricted calculations with two spin components,"// &
     401              :                           " where n is the number of the contact and s is the spin index."// &
     402              :                           " Otherwise, projectname is modified. Note that the code does not distinguish"// &
     403              :                           " between the files created by a separate electrode or the entire system.", &
     404         1380 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     405         1380 :       CALL section_add_keyword(subsection, keyword)
     406         1380 :       CALL keyword_release(keyword)
     407              : 
     408         1380 :       CALL section_add_subsection(section, subsection)
     409         1380 :       CALL section_release(subsection)
     410              : 
     411         1380 :    END SUBROUTINE create_contact_section
     412              : 
     413              : ! **************************************************************************************************
     414              : !> \brief Create a scattering region section.
     415              : !> \param section              NEGF section
     416              : !> \par History
     417              : !>    * 02.2026 created [Dmitry Ryndyk]
     418              : ! **************************************************************************************************
     419         1380 :    SUBROUTINE create_scattering_region_section(section)
     420              :       TYPE(section_type), POINTER                        :: section
     421              : 
     422              :       TYPE(keyword_type), POINTER                        :: keyword
     423              :       TYPE(section_type), POINTER                        :: subsection
     424              : 
     425         1380 :       CPASSERT(.NOT. ASSOCIATED(section))
     426              : 
     427              :       CALL section_create(section, __LOCATION__, name="SCATTERING_REGION", &
     428              :                           description="Section defining the scattering region of NEGF setup.", &
     429         1380 :                           n_keywords=2, n_subsections=1, repeats=.FALSE.)
     430              : 
     431         1380 :       NULLIFY (keyword, subsection)
     432              : 
     433              :       CALL keyword_create(keyword, __LOCATION__, name="LIST", &
     434              :                           description="Specifies a list of atoms.", &
     435              :                           usage="LIST {integer} {integer} .. {integer}", repeats=.TRUE., &
     436         1380 :                           n_var=-1, type_of_var=integer_t)
     437         1380 :       CALL section_add_keyword(section, keyword)
     438         1380 :       CALL keyword_release(keyword)
     439              : 
     440              :       CALL keyword_create(keyword, __LOCATION__, name="MOLNAME", &
     441              :                           description="Specifies a list of named molecular fragments.", &
     442              :                           usage="MOLNAME WAT MEOH", repeats=.TRUE., &
     443         1380 :                           n_var=-1, type_of_var=char_t)
     444         1380 :       CALL section_add_keyword(section, keyword)
     445         1380 :       CALL keyword_release(keyword)
     446              : 
     447              :       ! RESTART subsection
     448              :       CALL section_create(subsection, __LOCATION__, "RESTART", &
     449              :                           "Controls reading and writing of the initial restart files for the scattering region,"// &
     450         1380 :                           " including the coupling to the electrodes.", repeats=.FALSE.)
     451              :       CALL keyword_create(keyword, __LOCATION__, name="FILENAME", &
     452              :                           description=' Controls part of the filename. '// &
     453              :                           ' Use filename to obtain projectname-filename. '// &
     454              :                           ' Use ./filename to get filename.'// &
     455              :                           ' A middle name (type of matrix, contact number for coupling matrices, spin if 2 spins)'// &
     456              :                           ' and extension are always added to the filename.', &
     457              :                           usage="FILENAME ./filename ", &
     458         1380 :                           default_lc_val="")
     459         1380 :       CALL section_add_keyword(subsection, keyword)
     460         1380 :       CALL keyword_release(keyword)
     461              :       CALL keyword_create(keyword, __LOCATION__, name="READ_WRITE_HS", &
     462              :                           description="Requests reading of the Hamiltonian and overlap matrices from a file."// &
     463              :                           " For the scattering region, including the coupling to the electrodes."// &
     464              :                           " If at least one of these files doesn't exist, all Hamiltonian and overlap matrices"// &
     465              :                           " are calculated and saved. If no name is specified by FILENAME, the default file names are"// &
     466              :                           " projectname-H, projectname-H-Nn, projectname-S, projectname-S-Nn"// &
     467              :                           " for restricted calculations with identical spin population, or"// &
     468              :                           " projectname-H-Ss, projectname-H-Nn-Ss, projectname-S-Ss, projectname-S-Nn-Ss"// &
     469              :                           " for unrestricted calculations with two spin components,"// &
     470              :                           " where n is the number of the contact and s is the spin index."// &
     471              :                           " Otherwise, projectname is modified.", &
     472         1380 :                           default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
     473         1380 :       CALL section_add_keyword(subsection, keyword)
     474         1380 :       CALL keyword_release(keyword)
     475         1380 :       CALL section_add_subsection(section, subsection)
     476         1380 :       CALL section_release(subsection)
     477              : 
     478         1380 :    END SUBROUTINE create_scattering_region_section
     479              : 
     480              : ! **************************************************************************************************
     481              : !> \brief Create an atomic list section.
     482              : !> \param section              NEGF section
     483              : !> \param name                 name of the new section
     484              : !> \param description          section description
     485              : !> \param repeats              whether the section can be repeated
     486              : !> \par History
     487              : !>    * 02.2017 created [Sergey Chulkov]
     488              : ! **************************************************************************************************
     489         4140 :    SUBROUTINE create_atomlist_section(section, name, description, repeats)
     490              :       TYPE(section_type), POINTER                        :: section
     491              :       CHARACTER(len=*), INTENT(in)                       :: name, description
     492              :       LOGICAL, INTENT(in)                                :: repeats
     493              : 
     494              :       TYPE(keyword_type), POINTER                        :: keyword
     495              : 
     496            0 :       CPASSERT(.NOT. ASSOCIATED(section))
     497              : 
     498              :       CALL section_create(section, __LOCATION__, name=TRIM(ADJUSTL(name)), &
     499              :                           description="Atoms belonging to "//TRIM(ADJUSTL(description)), &
     500         4140 :                           n_keywords=2, n_subsections=0, repeats=repeats)
     501              : 
     502         4140 :       NULLIFY (keyword)
     503              : 
     504              :       CALL keyword_create(keyword, __LOCATION__, name="LIST", &
     505              :                           description="Specifies a list of atoms.", &
     506              :                           usage="LIST {integer} {integer} .. {integer}", repeats=.TRUE., &
     507         4140 :                           n_var=-1, type_of_var=integer_t)
     508         4140 :       CALL section_add_keyword(section, keyword)
     509         4140 :       CALL keyword_release(keyword)
     510              : 
     511              :       CALL keyword_create(keyword, __LOCATION__, name="MOLNAME", &
     512              :                           description="Specifies a list of named molecular fragments.", &
     513              :                           usage="MOLNAME WAT MEOH", repeats=.TRUE., &
     514         4140 :                           n_var=-1, type_of_var=char_t)
     515         4140 :       CALL section_add_keyword(section, keyword)
     516         4140 :       CALL keyword_release(keyword)
     517         4140 :    END SUBROUTINE create_atomlist_section
     518              : 
     519              : ! **************************************************************************************************
     520              : !> \brief Create the PROGRAM_RUN_INFO print section.
     521              : !> \param section              section to create
     522              : !> \par History
     523              : !>    * 11.2020 created [Dmitry Ryndyk]
     524              : ! **************************************************************************************************
     525         1380 :    SUBROUTINE create_print_program_run_info_section(section)
     526              : 
     527              :       TYPE(section_type), POINTER                        :: section
     528              : 
     529              :       TYPE(keyword_type), POINTER                        :: keyword
     530              : 
     531              :       CALL cp_print_key_section_create(section, __LOCATION__, "PROGRAM_RUN_INFO", &
     532              :                                        description="Controls the printing of basic information during the NEGF.", &
     533         1380 :                                        print_level=low_print_level, filename="__STD_OUT__")
     534         1380 :       NULLIFY (keyword)
     535              : 
     536              :       CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
     537              :                           description="Level starting at which this property is printed", &
     538              :                           usage="_SECTION_PARAMETERS_", &
     539              :                           default_i_val=low_print_level, lone_keyword_i_val=low_print_level, &
     540              :                           enum_c_vals=s2a("on", "off", "silent", "low", "medium", "high", "debug"), &
     541              :                           enum_i_vals=[silent_print_level - 1, debug_print_level + 1, &
     542              :                                        silent_print_level, low_print_level, &
     543         1380 :                                        medium_print_level, high_print_level, debug_print_level])
     544         1380 :       CALL section_add_keyword(section, keyword)
     545         1380 :       CALL keyword_release(keyword)
     546              : 
     547              :       CALL keyword_create(keyword, __LOCATION__, name="PRINT_LEVEL", &
     548              :                           variants=["IOLEVEL"], &
     549              :                           description="Determines the verbose level for this section "// &
     550              :                           "additionally to GLOBAL%PRINT_LEVEL and SECTION_PARAMETERS, "// &
     551              :                           "which switch on printing.", &
     552              :                           usage="PRINT_LEVEL HIGH", &
     553              :                           default_i_val=low_print_level, enum_c_vals= &
     554              :                           s2a("SILENT", "LOW", "MEDIUM", "HIGH", "DEBUG"), &
     555              :                           enum_desc=s2a("No output", &
     556              :                                         "Little output", "Quite some output", "Lots of output", &
     557              :                                         "Everything is written out, useful for debugging purposes only"), &
     558              :                           enum_i_vals=[silent_print_level, low_print_level, medium_print_level, &
     559         2760 :                                        high_print_level, debug_print_level])
     560         1380 :       CALL section_add_keyword(section, keyword)
     561         1380 :       CALL keyword_release(keyword)
     562              : 
     563         1380 :    END SUBROUTINE create_print_program_run_info_section
     564              : 
     565              : ! **************************************************************************************************
     566              : !> \brief Create the DOS/TRANSMISSION print section.
     567              : !> \param section              section to create
     568              : !> \param name                 name of the new section
     569              : !> \param description          section description
     570              : !> \par History
     571              : !>    * 11.2017 created [Sergey Chulkov]
     572              : ! **************************************************************************************************
     573         4140 :    SUBROUTINE create_print_dos_section(section, name, description)
     574              :       TYPE(section_type), POINTER                        :: section
     575              :       CHARACTER(len=*), INTENT(in)                       :: name, description
     576              : 
     577              :       TYPE(keyword_type), POINTER                        :: keyword
     578              : 
     579              :       CALL cp_print_key_section_create(section, __LOCATION__, TRIM(ADJUSTL(name)), &
     580              :                                        description="Controls the printing of "//TRIM(ADJUSTL(description))//".", &
     581         4140 :                                        print_level=high_print_level, filename="__STD_OUT__")
     582         4140 :       NULLIFY (keyword)
     583              : 
     584              :       CALL keyword_create(keyword, __LOCATION__, name="FROM_ENERGY", &
     585              :                           description="Energy point to start with.", &
     586              :                           n_var=1, type_of_var=real_t, unit_str="hartree", &
     587         4140 :                           default_r_val=-1.0_dp)
     588         4140 :       CALL section_add_keyword(section, keyword)
     589         4140 :       CALL keyword_release(keyword)
     590              : 
     591              :       CALL keyword_create(keyword, __LOCATION__, name="TILL_ENERGY", &
     592              :                           description="Energy point to end with.", &
     593              :                           n_var=1, type_of_var=real_t, unit_str="hartree", &
     594         4140 :                           default_r_val=1.0_dp)
     595         4140 :       CALL section_add_keyword(section, keyword)
     596         4140 :       CALL keyword_release(keyword)
     597              : 
     598              :       CALL keyword_create(keyword, __LOCATION__, name="N_GRIDPOINTS", &
     599              :                           description="Number of points to compute.", &
     600         4140 :                           n_var=1, type_of_var=integer_t, default_i_val=201)
     601         4140 :       CALL section_add_keyword(section, keyword)
     602         4140 :       CALL keyword_release(keyword)
     603         4140 :    END SUBROUTINE create_print_dos_section
     604              : END MODULE input_cp2k_negf
        

Generated by: LCOV version 2.0-1