Line data Source code
1 : !--------------------------------------------------------------------------------------------------!
2 : ! CP2K: A general program to perform molecular dynamics simulations !
3 : ! Copyright 2000-2024 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 8428 : 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 8428 : 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 25284 : n_keywords=18, n_subsections=6, repeats=.FALSE.)
67 :
68 8428 : NULLIFY (keyword, print_key, subsection)
69 :
70 8428 : CALL create_contact_section(subsection)
71 8428 : CALL section_add_subsection(section, subsection)
72 8428 : CALL section_release(subsection)
73 :
74 8428 : CALL create_atomlist_section(subsection, "SCATTERING_REGION", "Defines atoms which form the scattering region.", .FALSE.)
75 8428 : CALL section_add_subsection(section, subsection)
76 8428 : CALL section_release(subsection)
77 :
78 : ! mixing section
79 8428 : CALL create_mixing_section(subsection, ls_scf=.FALSE.)
80 8428 : CALL section_add_subsection(section, subsection)
81 8428 : 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 8428 : default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
86 8428 : CALL section_add_keyword(section, keyword)
87 8428 : 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 8428 : n_var=1, type_of_var=real_t, default_r_val=1.0e-5_dp)
93 8428 : CALL section_add_keyword(section, keyword)
94 8428 : CALL keyword_release(keyword)
95 :
96 : CALL keyword_create(keyword, __LOCATION__, name="EPS_GREEN", &
97 : description="Target accuracy for surface Green's functions.", &
98 8428 : n_var=1, type_of_var=real_t, default_r_val=1.0e-5_dp)
99 8428 : CALL section_add_keyword(section, keyword)
100 8428 : CALL keyword_release(keyword)
101 :
102 : CALL keyword_create(keyword, __LOCATION__, name="EPS_SCF", &
103 : description="Target accuracy for SCF convergence.", &
104 8428 : n_var=1, type_of_var=real_t, default_r_val=1.0e-5_dp)
105 8428 : CALL section_add_keyword(section, keyword)
106 8428 : 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 8428 : default_r_val=1.0e-6_dp)
112 8428 : CALL section_add_keyword(section, keyword)
113 8428 : 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 8428 : default_r_val=-5.0_dp)
119 8428 : CALL section_add_keyword(section, keyword)
120 8428 : 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 8428 : default_r_val=1.0e-5_dp)
126 8428 : CALL section_add_keyword(section, keyword)
127 8428 : 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 8428 : default_r_val=0.2_dp)
135 8428 : CALL section_add_keyword(section, keyword)
136 8428 : 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 8428 : default_i_val=4)
142 8428 : CALL section_add_keyword(section, keyword)
143 8428 : 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 8428 : default_i_val=20)
150 8428 : CALL section_add_keyword(section, keyword)
151 8428 : 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 8428 : enum_i_vals=(/negfint_method_cc, negfint_method_simpson/))
161 8428 : CALL section_add_keyword(section, keyword)
162 8428 : 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 8428 : default_i_val=16)
168 8428 : CALL section_add_keyword(section, keyword)
169 8428 : 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 8428 : default_i_val=512)
175 8428 : CALL section_add_keyword(section, keyword)
176 8428 : 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 8428 : default_i_val=30)
182 8428 : CALL section_add_keyword(section, keyword)
183 8428 : 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 8428 : default_i_val=0)
190 8428 : CALL section_add_keyword(section, keyword)
191 8428 : 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 8428 : default_r_val=0.0_dp)
197 8428 : CALL section_add_keyword(section, keyword)
198 8428 : 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 8428 : n_var=1, type_of_var=real_t, default_r_val=0.10_dp)
203 8428 : CALL section_add_keyword(section, keyword)
204 8428 : 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 8428 : n_var=1, type_of_var=integer_t, default_i_val=30)
209 8428 : CALL section_add_keyword(section, keyword)
210 8428 : CALL keyword_release(keyword)
211 :
212 : ! PRINT subsection
213 : CALL section_create(subsection, __LOCATION__, "PRINT", "Printing of information during the NEGF.", &
214 8428 : repeats=.FALSE.)
215 :
216 8428 : CALL create_print_program_run_info_section(print_key)
217 8428 : CALL section_add_subsection(subsection, print_key)
218 8428 : CALL section_release(print_key)
219 :
220 8428 : CALL create_print_dos_section(print_key, "DOS", "the Density of States (DOS) in the scattering region")
221 8428 : CALL section_add_subsection(subsection, print_key)
222 8428 : CALL section_release(print_key)
223 :
224 8428 : CALL create_print_dos_section(print_key, "TRANSMISSION", "the transmission coefficient")
225 8428 : CALL section_add_subsection(subsection, print_key)
226 8428 : CALL section_release(print_key)
227 :
228 8428 : CALL section_add_subsection(section, subsection)
229 8428 : CALL section_release(subsection)
230 :
231 8428 : 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 8428 : 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 8428 : CPASSERT(.NOT. ASSOCIATED(section))
246 :
247 : CALL section_create(section, __LOCATION__, name="CONTACT", &
248 : description="Section defining the contact region of NEGF setup.", &
249 8428 : n_keywords=5, n_subsections=3, repeats=.TRUE.)
250 :
251 8428 : NULLIFY (keyword, print_key, subsection, subsection2)
252 :
253 : CALL create_atomlist_section(subsection, "BULK_REGION", &
254 8428 : "the bulk contact adjacent to the screening region.", .FALSE.)
255 8428 : 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 8428 : "FORCE_EVAL_SECTION must be 0.", .TRUE.)
260 8428 : CALL section_add_subsection(subsection, subsection2)
261 8428 : CALL section_release(subsection2)
262 8428 : CALL section_release(subsection)
263 :
264 : CALL create_atomlist_section(subsection, "SCREENING_REGION", &
265 8428 : "the given contact adjacent to the scattering region.", .FALSE.)
266 8428 : CALL section_add_subsection(section, subsection)
267 8428 : 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 8428 : n_var=1, type_of_var=integer_t, default_i_val=0)
272 8428 : CALL section_add_keyword(section, keyword)
273 8428 : 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 8428 : default_r_val=0.0_dp)
279 8428 : CALL section_add_keyword(section, keyword)
280 8428 : 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 8428 : default_r_val=0.0_dp)
288 8428 : CALL section_add_keyword(section, keyword)
289 8428 : 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 8428 : default_l_val=.FALSE., lone_keyword_l_val=.TRUE.)
296 8428 : CALL section_add_keyword(section, keyword)
297 8428 : CALL keyword_release(keyword)
298 :
299 : CALL keyword_create(keyword, __LOCATION__, name="TEMPERATURE", &
300 : description="Electronic temperature.", &
301 : n_var=1, type_of_var=real_t, unit_str="K", &
302 8428 : default_r_val=300.0_dp/kelvin)
303 8428 : CALL section_add_keyword(section, keyword)
304 8428 : CALL keyword_release(keyword)
305 :
306 : ! PRINT subsection
307 : CALL section_create(subsection, __LOCATION__, "PRINT", "Print properties for the given contact.", &
308 8428 : repeats=.FALSE.)
309 :
310 8428 : CALL create_print_dos_section(print_key, "DOS", "the Density of States (DOS)")
311 8428 : CALL section_add_subsection(subsection, print_key)
312 8428 : CALL section_release(print_key)
313 :
314 8428 : CALL section_add_subsection(section, subsection)
315 8428 : CALL section_release(subsection)
316 :
317 8428 : END SUBROUTINE create_contact_section
318 :
319 : ! **************************************************************************************************
320 : !> \brief Create an atomic list section.
321 : !> \param section NEGF section
322 : !> \param name name of the new section
323 : !> \param description section description
324 : !> \param repeats whether the section can be repeated
325 : !> \par History
326 : !> * 02.2017 created [Sergey Chulkov]
327 : ! **************************************************************************************************
328 33712 : SUBROUTINE create_atomlist_section(section, name, description, repeats)
329 : TYPE(section_type), POINTER :: section
330 : CHARACTER(len=*), INTENT(in) :: name, description
331 : LOGICAL, INTENT(in) :: repeats
332 :
333 : TYPE(keyword_type), POINTER :: keyword
334 :
335 0 : CPASSERT(.NOT. ASSOCIATED(section))
336 :
337 : CALL section_create(section, __LOCATION__, name=TRIM(ADJUSTL(name)), &
338 : description="Atoms belonging to "//TRIM(ADJUSTL(description)), &
339 33712 : n_keywords=2, n_subsections=0, repeats=repeats)
340 :
341 33712 : NULLIFY (keyword)
342 :
343 : CALL keyword_create(keyword, __LOCATION__, name="LIST", &
344 : description="Specifies a list of atoms.", &
345 : usage="LIST {integer} {integer} .. {integer}", repeats=.TRUE., &
346 33712 : n_var=-1, type_of_var=integer_t)
347 33712 : CALL section_add_keyword(section, keyword)
348 33712 : CALL keyword_release(keyword)
349 :
350 : CALL keyword_create(keyword, __LOCATION__, name="MOLNAME", &
351 : description="Specifies a list of named molecular fragments.", &
352 : usage="MOLNAME WAT MEOH", repeats=.TRUE., &
353 33712 : n_var=-1, type_of_var=char_t)
354 33712 : CALL section_add_keyword(section, keyword)
355 33712 : CALL keyword_release(keyword)
356 33712 : END SUBROUTINE create_atomlist_section
357 :
358 : ! **************************************************************************************************
359 : !> \brief Create the PROGRAM_RUN_INFO print section.
360 : !> \param section section to create
361 : !> \par History
362 : !> * 11.2020 created [Dmitry Ryndyk]
363 : ! **************************************************************************************************
364 8428 : SUBROUTINE create_print_program_run_info_section(section)
365 :
366 : TYPE(section_type), POINTER :: section
367 :
368 : TYPE(keyword_type), POINTER :: keyword
369 :
370 : CALL cp_print_key_section_create(section, __LOCATION__, "PROGRAM_RUN_INFO", &
371 : description="Controls the printing of basic information during the NEGF.", &
372 8428 : print_level=low_print_level, filename="__STD_OUT__")
373 8428 : NULLIFY (keyword)
374 :
375 : CALL keyword_create(keyword, __LOCATION__, name="_SECTION_PARAMETERS_", &
376 : description="Level starting at which this property is printed", &
377 : usage="_SECTION_PARAMETERS_", &
378 : default_i_val=low_print_level, lone_keyword_i_val=low_print_level, &
379 : enum_c_vals=s2a("on", "off", "silent", "low", "medium", "high", "debug"), &
380 : enum_i_vals=(/silent_print_level - 1, debug_print_level + 1, &
381 : silent_print_level, low_print_level, &
382 8428 : medium_print_level, high_print_level, debug_print_level/))
383 8428 : CALL section_add_keyword(section, keyword)
384 8428 : CALL keyword_release(keyword)
385 :
386 : CALL keyword_create(keyword, __LOCATION__, name="PRINT_LEVEL", &
387 : variants=(/"IOLEVEL"/), &
388 : description="Determines the verbose level for this section "// &
389 : "additionally to GLOBAL%PRINT_LEVEL and SECTION_PARAMETERS, "// &
390 : "which switch on printing.", &
391 : usage="PRINT_LEVEL HIGH", &
392 : default_i_val=low_print_level, enum_c_vals= &
393 : s2a("SILENT", "LOW", "MEDIUM", "HIGH", "DEBUG"), &
394 : enum_desc=s2a("No output", &
395 : "Little output", "Quite some output", "Lots of output", &
396 : "Everything is written out, useful for debugging purposes only"), &
397 : enum_i_vals=(/silent_print_level, low_print_level, medium_print_level, &
398 16856 : high_print_level, debug_print_level/))
399 8428 : CALL section_add_keyword(section, keyword)
400 8428 : CALL keyword_release(keyword)
401 :
402 8428 : END SUBROUTINE create_print_program_run_info_section
403 :
404 : ! **************************************************************************************************
405 : !> \brief Create the DOS print section.
406 : !> \param section section to create
407 : !> \param name name of the new section
408 : !> \param description section description
409 : !> \par History
410 : !> * 11.2017 created [Sergey Chulkov]
411 : ! **************************************************************************************************
412 25284 : SUBROUTINE create_print_dos_section(section, name, description)
413 : TYPE(section_type), POINTER :: section
414 : CHARACTER(len=*), INTENT(in) :: name, description
415 :
416 : TYPE(keyword_type), POINTER :: keyword
417 :
418 : CALL cp_print_key_section_create(section, __LOCATION__, TRIM(ADJUSTL(name)), &
419 : description="Controls the printing of "//TRIM(ADJUSTL(description))//".", &
420 25284 : print_level=high_print_level, filename="__STD_OUT__")
421 25284 : NULLIFY (keyword)
422 :
423 : CALL keyword_create(keyword, __LOCATION__, name="FROM_ENERGY", &
424 : description="Energy point to start with.", &
425 : n_var=1, type_of_var=real_t, unit_str="hartree", &
426 25284 : default_r_val=-1.0_dp)
427 25284 : CALL section_add_keyword(section, keyword)
428 25284 : CALL keyword_release(keyword)
429 :
430 : CALL keyword_create(keyword, __LOCATION__, name="TILL_ENERGY", &
431 : description="Energy point to end with.", &
432 : n_var=1, type_of_var=real_t, unit_str="hartree", &
433 25284 : default_r_val=1.0_dp)
434 25284 : CALL section_add_keyword(section, keyword)
435 25284 : CALL keyword_release(keyword)
436 :
437 : CALL keyword_create(keyword, __LOCATION__, name="N_GRIDPOINTS", &
438 : description="Number of points to compute.", &
439 25284 : n_var=1, type_of_var=integer_t, default_i_val=201)
440 25284 : CALL section_add_keyword(section, keyword)
441 25284 : CALL keyword_release(keyword)
442 25284 : END SUBROUTINE create_print_dos_section
443 : END MODULE input_cp2k_negf
|