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