1!--------------------------------------------------------------------------------------------------! 2! CP2K: A general program to perform molecular dynamics simulations ! 3! Copyright (C) 2000 - 2019 CP2K developers group ! 4!--------------------------------------------------------------------------------------------------! 5 6! ************************************************************************************************** 7!> \brief Input section for NEGF based quantum transport calculations. 8! ************************************************************************************************** 9 10MODULE input_cp2k_negf 11 USE bibliography, ONLY: Bailey2006,& 12 Papior2017 13 USE cp_output_handling, ONLY: cp_print_key_section_create,& 14 high_print_level 15 USE input_constants, ONLY: negfint_method_cc,& 16 negfint_method_simpson 17 USE input_keyword_types, ONLY: keyword_create,& 18 keyword_release,& 19 keyword_type 20 USE input_section_types, ONLY: section_add_keyword,& 21 section_add_subsection,& 22 section_create,& 23 section_release,& 24 section_type 25 USE input_val_types, ONLY: char_t,& 26 integer_t,& 27 real_t 28 USE kinds, ONLY: dp 29 USE physcon, ONLY: kelvin 30 USE qs_density_mixing_types, ONLY: create_mixing_section 31 USE string_utilities, ONLY: s2a 32#include "./base/base_uses.f90" 33 34 IMPLICIT NONE 35 PRIVATE 36 37 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'input_cp2k_negf' 38 39 PUBLIC :: create_negf_section 40 41CONTAINS 42 43! ************************************************************************************************** 44!> \brief Create NEGF input section. 45!> \param section input section 46!> \par History 47!> * 02.2017 created [Sergey Chulkov] 48! ************************************************************************************************** 49 SUBROUTINE create_negf_section(section) 50 TYPE(section_type), POINTER :: section 51 52 CHARACTER(len=*), PARAMETER :: routineN = 'create_negf_section', & 53 routineP = moduleN//':'//routineN 54 55 TYPE(keyword_type), POINTER :: keyword 56 TYPE(section_type), POINTER :: print_key, subsection 57 58 CPASSERT(.NOT. ASSOCIATED(section)) 59 CALL section_create(section, __LOCATION__, name="NEGF", & 60 description="Parameters which control quantum transport calculation"// & 61 " based on Non-Equilibrium Green's Function method.", & 62 citations=(/Bailey2006, Papior2017/), & 63 n_keywords=18, n_subsections=6, repeats=.FALSE.) 64 65 NULLIFY (keyword, print_key, subsection) 66 67 CALL create_contact_section(subsection) 68 CALL section_add_subsection(section, subsection) 69 CALL section_release(subsection) 70 71 CALL create_atomlist_section(subsection, "SCATTERING_REGION", "Defines atoms which form the scattering region.", .FALSE.) 72 CALL section_add_subsection(section, subsection) 73 CALL section_release(subsection) 74 75 ! mixing section 76 CALL create_mixing_section(subsection, ls_scf=.FALSE.) 77 CALL section_add_subsection(section, subsection) 78 CALL section_release(subsection) 79 80 CALL keyword_create(keyword, __LOCATION__, name="DISABLE_CACHE", & 81 description="Do not keep contact self-energy matrices for future reuse", & 82 default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) 83 CALL section_add_keyword(section, keyword) 84 CALL keyword_release(keyword) 85 86 ! convergence thresholds 87 CALL keyword_create(keyword, __LOCATION__, name="EPS_DENSITY", & 88 description="Target accuracy for electronic density.", & 89 n_var=1, type_of_var=real_t, default_r_val=1.0e-5_dp) 90 CALL section_add_keyword(section, keyword) 91 CALL keyword_release(keyword) 92 93 CALL keyword_create(keyword, __LOCATION__, name="EPS_GREEN", & 94 description="Target accuracy for surface Green's functions.", & 95 n_var=1, type_of_var=real_t, default_r_val=1.0e-5_dp) 96 CALL section_add_keyword(section, keyword) 97 CALL keyword_release(keyword) 98 99 CALL keyword_create(keyword, __LOCATION__, name="EPS_SCF", & 100 description="Target accuracy for SCF convergence.", & 101 n_var=1, type_of_var=real_t, default_r_val=1.0e-5_dp) 102 CALL section_add_keyword(section, keyword) 103 CALL keyword_release(keyword) 104 105 CALL keyword_create(keyword, __LOCATION__, name="EPS_GEO", & 106 description="Accuracy in mapping atoms between different force environments.", & 107 n_var=1, type_of_var=real_t, unit_str="angstrom", & 108 default_r_val=1.0e-6_dp) 109 CALL section_add_keyword(section, keyword) 110 CALL keyword_release(keyword) 111 112 CALL keyword_create(keyword, __LOCATION__, name="ENERGY_LBOUND", & 113 description="Lower bound energy of the conductance band.", & 114 n_var=1, type_of_var=real_t, unit_str="hartree", & 115 default_r_val=-5.0_dp) 116 CALL section_add_keyword(section, keyword) 117 CALL keyword_release(keyword) 118 119 CALL keyword_create(keyword, __LOCATION__, name="ETA", & 120 description="Infinitesimal offset from the real axis.", & 121 n_var=1, type_of_var=real_t, unit_str="hartree", & 122 default_r_val=1.0e-5_dp) 123 CALL section_add_keyword(section, keyword) 124 CALL keyword_release(keyword) 125 126 CALL keyword_create(keyword, __LOCATION__, name="HOMO_LUMO_GAP", & 127 description="The gap between the HOMO and some fictitious LUMO. This option is used as"// & 128 " an initial offset to determine the actual Fermi level of bulk contacts."// & 129 " It does not need to be exact HOMO-LUMO gap, just some value to start with.", & 130 n_var=1, type_of_var=real_t, unit_str="hartree", & 131 default_r_val=0.2_dp) 132 CALL section_add_keyword(section, keyword) 133 CALL keyword_release(keyword) 134 135 CALL keyword_create(keyword, __LOCATION__, name="DELTA_NPOLES", & 136 description="Number of poles of Fermi function to consider.", & 137 n_var=1, type_of_var=integer_t, & 138 default_i_val=4) 139 CALL section_add_keyword(section, keyword) 140 CALL keyword_release(keyword) 141 142 CALL keyword_create(keyword, __LOCATION__, name="GAMMA_KT", & 143 description="Offset from the axis (in terms of k*T)"// & 144 " where poles of the Fermi function reside.", & 145 n_var=1, type_of_var=integer_t, & 146 default_i_val=20) 147 CALL section_add_keyword(section, keyword) 148 CALL keyword_release(keyword) 149 150 CALL keyword_create(keyword, __LOCATION__, name="INTEGRATION_METHOD", & 151 description="Method to integrate Green's functions along a closed-circuit contour.", & 152 default_i_val=negfint_method_cc, & 153 enum_c_vals=s2a("CLENSHAW-CURTIS", "SIMPSON"), & 154 enum_desc=s2a( & 155 "Adaptive Clenshaw-Curtis quadrature method. Requires FFTW3 library.", & 156 "Adaptive Simpson method. Works without FFTW3."), & 157 enum_i_vals=(/negfint_method_cc, negfint_method_simpson/)) 158 CALL section_add_keyword(section, keyword) 159 CALL keyword_release(keyword) 160 161 CALL keyword_create(keyword, __LOCATION__, name="INTEGRATION_MIN_POINTS", & 162 description="Initial (minimal) number of grid point for adaptive numerical integration.", & 163 n_var=1, type_of_var=integer_t, & 164 default_i_val=16) 165 CALL section_add_keyword(section, keyword) 166 CALL keyword_release(keyword) 167 168 CALL keyword_create(keyword, __LOCATION__, name="INTEGRATION_MAX_POINTS", & 169 description="Maximal number of grid point for adaptive numerical integration.", & 170 n_var=1, type_of_var=integer_t, & 171 default_i_val=512) 172 CALL section_add_keyword(section, keyword) 173 CALL keyword_release(keyword) 174 175 CALL keyword_create(keyword, __LOCATION__, name="MAX_SCF", & 176 description="Maximum number of SCF iterations to be performed.", & 177 n_var=1, type_of_var=integer_t, & 178 default_i_val=30) 179 CALL section_add_keyword(section, keyword) 180 CALL keyword_release(keyword) 181 182 CALL keyword_create(keyword, __LOCATION__, name="NPROC_POINT", & 183 description="Number of MPI processes to be used per energy point. "// & 184 " Default is to use all processors (0).", & 185 n_var=1, type_of_var=integer_t, & 186 default_i_val=0) 187 CALL section_add_keyword(section, keyword) 188 CALL keyword_release(keyword) 189 190 CALL keyword_create(keyword, __LOCATION__, name="V_SHIFT", & 191 description="Initial value of the Hartree potential shift", & 192 n_var=1, type_of_var=real_t, unit_str="hartree", & 193 default_r_val=0.0_dp) 194 CALL section_add_keyword(section, keyword) 195 CALL keyword_release(keyword) 196 197 CALL keyword_create(keyword, __LOCATION__, name="V_SHIFT_OFFSET", & 198 description="Initial offset to determine the optimal shift in Hartree potential.", & 199 n_var=1, type_of_var=real_t, default_r_val=0.10_dp) 200 CALL section_add_keyword(section, keyword) 201 CALL keyword_release(keyword) 202 203 CALL keyword_create(keyword, __LOCATION__, name="V_SHIFT_MAX_ITERS", & 204 description="Maximal number of iteration to determine the optimal shift in Hartree potential.", & 205 n_var=1, type_of_var=integer_t, default_i_val=30) 206 CALL section_add_keyword(section, keyword) 207 CALL keyword_release(keyword) 208 209 ! PRINT subsection 210 CALL section_create(subsection, __LOCATION__, "PRINT", "Print properties for the scattering region.", & 211 repeats=.FALSE.) 212 213 CALL create_print_dos_section(print_key, "DOS", "the Density of States (DOS)") 214 CALL section_add_subsection(subsection, print_key) 215 CALL section_release(print_key) 216 217 CALL create_print_dos_section(print_key, "TRANSMISSION", "the Transmission Coefficient") 218 CALL section_add_subsection(subsection, print_key) 219 CALL section_release(print_key) 220 221 CALL section_add_subsection(section, subsection) 222 CALL section_release(subsection) 223 224 END SUBROUTINE create_negf_section 225 226! ************************************************************************************************** 227!> \brief Create NEGF%CONTACT input section. 228!> \param section input section 229!> \par History 230!> * 09.2017 split from create_negf_section() [Sergey Chulkov] 231! ************************************************************************************************** 232 SUBROUTINE create_contact_section(section) 233 TYPE(section_type), POINTER :: section 234 235 CHARACTER(len=*), PARAMETER :: routineN = 'create_contact_section', & 236 routineP = moduleN//':'//routineN 237 238 TYPE(keyword_type), POINTER :: keyword 239 TYPE(section_type), POINTER :: print_key, subsection, subsection2 240 241 CPASSERT(.NOT. ASSOCIATED(section)) 242 243 CALL section_create(section, __LOCATION__, name="CONTACT", & 244 description="Section defining the contact region of NEGF setup.", & 245 n_keywords=5, n_subsections=3, repeats=.TRUE.) 246 247 NULLIFY (keyword, print_key, subsection, subsection2) 248 249 CALL create_atomlist_section(subsection, "BULK_REGION", & 250 "the bulk contact adjacent to the screening region.", .FALSE.) 251 CALL section_add_subsection(section, subsection) 252 CALL create_atomlist_section(subsection2, "CELL", & 253 "a single bulk contact unit cell. Bulk Hamiltonian will be contstructed "// & 254 "using two such unit cells instead of performing k-point bulk calculation. "// & 255 "FORCE_EVAL_SECTION must be 0.", .TRUE.) 256 CALL section_add_subsection(subsection, subsection2) 257 CALL section_release(subsection2) 258 CALL section_release(subsection) 259 260 CALL create_atomlist_section(subsection, "SCREENING_REGION", & 261 "the given contact adjacent to the scattering region.", .FALSE.) 262 CALL section_add_subsection(section, subsection) 263 CALL section_release(subsection) 264 265 CALL keyword_create(keyword, __LOCATION__, name="FORCE_EVAL_SECTION", & 266 description=" Index of the FORCE_EVAL section which will be used for bulk calculation.", & 267 n_var=1, type_of_var=integer_t, default_i_val=0) 268 CALL section_add_keyword(section, keyword) 269 CALL keyword_release(keyword) 270 271 CALL keyword_create(keyword, __LOCATION__, name="ELECTRIC_POTENTIAL", & 272 description="External electrostatic potential applied to the given contact.", & 273 n_var=1, type_of_var=real_t, unit_str="hartree", & 274 default_r_val=0.0_dp) 275 CALL section_add_keyword(section, keyword) 276 CALL keyword_release(keyword) 277 278 CALL keyword_create(keyword, __LOCATION__, name="FERMI_LEVEL", & 279 description="Contact Fermi level at the given temperature."// & 280 " If this keyword is not given explicitly, the Fermi level"// & 281 " will be automatically computed prior the actual NEGF calculation.", & 282 n_var=1, type_of_var=real_t, unit_str="hartree", & 283 default_r_val=0.0_dp) 284 CALL section_add_keyword(section, keyword) 285 CALL keyword_release(keyword) 286 287 CALL keyword_create(keyword, __LOCATION__, name="REFINE_FERMI_LEVEL", & 288 description="Compute the Fermi level using the value from the FERMI_LEVEL keyword"// & 289 " as a starting point. By default the Fermi level is computed only"// & 290 " when the keyword FERMI_LEVEL is not given explicitly.", & 291 default_l_val=.FALSE., lone_keyword_l_val=.TRUE.) 292 CALL section_add_keyword(section, keyword) 293 CALL keyword_release(keyword) 294 295 CALL keyword_create(keyword, __LOCATION__, name="TEMPERATURE", & 296 description="Electronic temperature.", & 297 n_var=1, type_of_var=real_t, unit_str="K", & 298 default_r_val=300.0_dp/kelvin) 299 CALL section_add_keyword(section, keyword) 300 CALL keyword_release(keyword) 301 302 ! PRINT subsection 303 CALL section_create(subsection, __LOCATION__, "PRINT", "Print properties for the given contact.", & 304 repeats=.FALSE.) 305 306 CALL create_print_dos_section(print_key, "DOS", "the Density of States (DOS)") 307 CALL section_add_subsection(subsection, print_key) 308 CALL section_release(print_key) 309 310 CALL section_add_subsection(section, subsection) 311 CALL section_release(subsection) 312 313 END SUBROUTINE create_contact_section 314 315! ************************************************************************************************** 316!> \brief Create an atomic list section. 317!> \param section NEGF section 318!> \param name name of the new section 319!> \param description section description 320!> \param repeats whether the section can be repeated 321!> \par History 322!> * 02.2017 created [Sergey Chulkov] 323! ************************************************************************************************** 324 SUBROUTINE create_atomlist_section(section, name, description, repeats) 325 TYPE(section_type), POINTER :: section 326 CHARACTER(len=*), INTENT(in) :: name, description 327 LOGICAL, INTENT(in) :: repeats 328 329 CHARACTER(len=*), PARAMETER :: routineN = 'create_atomlist_section', & 330 routineP = moduleN//':'//routineN 331 332 TYPE(keyword_type), POINTER :: keyword 333 334 CPASSERT(.NOT. ASSOCIATED(section)) 335 336 CALL section_create(section, __LOCATION__, name=TRIM(ADJUSTL(name)), & 337 description="Atoms belonging to "//TRIM(ADJUSTL(description)), & 338 n_keywords=2, n_subsections=0, repeats=repeats) 339 340 NULLIFY (keyword) 341 342 CALL keyword_create(keyword, __LOCATION__, name="LIST", & 343 description="Specifies a list of atoms.", & 344 usage="LIST {integer} {integer} .. {integer}", repeats=.TRUE., & 345 n_var=-1, type_of_var=integer_t) 346 CALL section_add_keyword(section, keyword) 347 CALL keyword_release(keyword) 348 349 CALL keyword_create(keyword, __LOCATION__, name="MOLNAME", & 350 description="Specifies a list of named molecular fragments.", & 351 usage="MOLNAME WAT MEOH", repeats=.TRUE., & 352 n_var=-1, type_of_var=char_t) 353 CALL section_add_keyword(section, keyword) 354 CALL keyword_release(keyword) 355 END SUBROUTINE create_atomlist_section 356 357! ************************************************************************************************** 358!> \brief Create the DOS print section. 359!> \param section section to create 360!> \param name name of the new section 361!> \param description section description 362!> \par History 363!> * 11.2017 created [Sergey Chulkov] 364! ************************************************************************************************** 365 SUBROUTINE create_print_dos_section(section, name, description) 366 TYPE(section_type), POINTER :: section 367 CHARACTER(len=*), INTENT(in) :: name, description 368 369 CHARACTER(len=*), PARAMETER :: routineN = 'create_print_dos_section', & 370 routineP = moduleN//':'//routineN 371 372 TYPE(keyword_type), POINTER :: keyword 373 374 CALL cp_print_key_section_create(section, __LOCATION__, TRIM(ADJUSTL(name)), & 375 description="Controls the printing of "//TRIM(ADJUSTL(description))//".", & 376 print_level=high_print_level, filename="__STD_OUT__") 377 NULLIFY (keyword) 378 379 CALL keyword_create(keyword, __LOCATION__, name="FROM_ENERGY", & 380 description="Energy point to start with.", & 381 n_var=1, type_of_var=real_t, unit_str="hartree", & 382 default_r_val=-1.0_dp) 383 CALL section_add_keyword(section, keyword) 384 CALL keyword_release(keyword) 385 386 CALL keyword_create(keyword, __LOCATION__, name="TILL_ENERGY", & 387 description="Energy point to end with.", & 388 n_var=1, type_of_var=real_t, unit_str="hartree", & 389 default_r_val=1.0_dp) 390 CALL section_add_keyword(section, keyword) 391 CALL keyword_release(keyword) 392 393 CALL keyword_create(keyword, __LOCATION__, name="N_GRIDPOINTS", & 394 description="Number of points to compute.", & 395 n_var=1, type_of_var=integer_t, default_i_val=201) 396 CALL section_add_keyword(section, keyword) 397 CALL keyword_release(keyword) 398 END SUBROUTINE create_print_dos_section 399END MODULE input_cp2k_negf 400