diff --git a/docs/input_params/common_options.rst b/docs/input_params/common_options.rst index ff26ce5..6fa8044 100644 --- a/docs/input_params/common_options.rst +++ b/docs/input_params/common_options.rst @@ -1,6 +1,7 @@ -======================================== +============== Common Options -======================================== +============== + .. _`common_options`: common_options: @@ -37,7 +38,7 @@ common_options: | type: ``str``, optional, default: ``float32`` | argument path: ``common_options/dtype`` - The digital number's precison, choose among: + The digital number's precison, choose among: Default: `float32` - `float32`: indicating torch.float32 - `float64`: indicating torch.float64 diff --git a/docs/input_params/run_options.rst b/docs/input_params/run_options.rst index f7d1d8a..85c0bc3 100644 --- a/docs/input_params/run_options.rst +++ b/docs/input_params/run_options.rst @@ -1,6 +1,9 @@ -======================================== +=========== Run Options -======================================== +=========== + +.. _`run_options`: + .. _`run_op`: run_op: @@ -13,7 +16,7 @@ run_op: | type: ``dict``, optional | argument path: ``run_op/task_options`` - the task to run, includes: band, dos, pdos, FS2D, FS3D, ifermi + Which transport task to run and its detailed options. See `task_options` below. Depending on the value of *task*, different sub args are accepted. @@ -23,1146 +26,3430 @@ run_op: task: | type: ``str`` (flag key) | argument path: ``run_op/task_options/task`` - | possible choices: |code:run_op/task_options[band]|_, |code:run_op/task_options[dos]|_, |code:run_op/task_options[pdos]|_, |code:run_op/task_options[FS2D]|_, |code:run_op/task_options[FS3D]|_, |code:run_op/task_options[write_sk]|_, |code:run_op/task_options[ifermi]|_, |code:run_op/task_options[negf]|_, |code:run_op/task_options[tbtrans_negf]|_, |code:run_op/task_options[write_block]|_ - - The string define the task DeePTB conduct, includes: - - `band`: for band structure plotting. - - `dos`: for density of states plotting. - - `pdos`: for projected density of states plotting. - - `FS2D`: for 2D fermi-surface plotting. - - `FS3D`: for 3D fermi-surface plotting. - - `write_sk`: for transcript the nnsk model to standard sk parameter table - - `ifermi`: for fermi surface plotting. + | possible choices: |code:run_op/task_options[negf]|_, |code:run_op/task_options[tbtrans_negf]|_ + + The string define the task to conduct: - `negf`: for non-equilibrium green function calculation. - `tbtrans_negf`: for non-equilibrium green function calculation with tbtrans. - .. |code:run_op/task_options[band]| replace:: ``band`` - .. _`code:run_op/task_options[band]`: `run_op/task_options[band]`_ - .. |code:run_op/task_options[dos]| replace:: ``dos`` - .. _`code:run_op/task_options[dos]`: `run_op/task_options[dos]`_ - .. |code:run_op/task_options[pdos]| replace:: ``pdos`` - .. _`code:run_op/task_options[pdos]`: `run_op/task_options[pdos]`_ - .. |code:run_op/task_options[FS2D]| replace:: ``FS2D`` - .. _`code:run_op/task_options[FS2D]`: `run_op/task_options[FS2D]`_ - .. |code:run_op/task_options[FS3D]| replace:: ``FS3D`` - .. _`code:run_op/task_options[FS3D]`: `run_op/task_options[FS3D]`_ - .. |code:run_op/task_options[write_sk]| replace:: ``write_sk`` - .. _`code:run_op/task_options[write_sk]`: `run_op/task_options[write_sk]`_ - .. |code:run_op/task_options[ifermi]| replace:: ``ifermi`` - .. _`code:run_op/task_options[ifermi]`: `run_op/task_options[ifermi]`_ .. |code:run_op/task_options[negf]| replace:: ``negf`` .. _`code:run_op/task_options[negf]`: `run_op/task_options[negf]`_ .. |code:run_op/task_options[tbtrans_negf]| replace:: ``tbtrans_negf`` .. _`code:run_op/task_options[tbtrans_negf]`: `run_op/task_options[tbtrans_negf]`_ - .. |code:run_op/task_options[write_block]| replace:: ``write_block`` - .. _`code:run_op/task_options[write_block]`: `run_op/task_options[write_block]`_ .. |flag:run_op/task_options/task| replace:: *task* .. _`flag:run_op/task_options/task`: `run_op/task_options/task`_ - .. _`run_op/task_options[band]`: + .. _`run_op/task_options[negf]`: - When |flag:run_op/task_options/task|_ is set to ``band``: + When |flag:run_op/task_options/task|_ is set to ``negf``: - .. _`run_op/task_options[band]/kline_type`: + .. _`run_op/task_options[negf]/scf`: - kline_type: - | type: ``str`` - | argument path: ``run_op/task_options[band]/kline_type`` + scf: + | type: ``bool``, optional, default: ``False`` + | argument path: ``run_op/task_options[negf]/scf`` - The different type to build kpath line mode. - - "abacus" : the abacus format - - "vasp" : the vasp format - - "ase" : the ase format - + Whether to run a self-consistent (Poisson-NEGF) loop. Default: False (non-self-consistent transport). - .. _`run_op/task_options[band]/kpath`: + .. _`run_op/task_options[negf]/block_tridiagonal`: - kpath: - | type: ``str`` | ``list`` - | argument path: ``run_op/task_options[band]/kpath`` + block_tridiagonal: + | type: ``bool``, optional, default: ``False`` + | argument path: ``run_op/task_options[negf]/block_tridiagonal`` - for abacus, this is list, for vasp it is a string to specifc the kpath. + Whether to block-tridiagonalize the device Hamiltonian for faster recursive Green's function inversion. Default: False. - .. _`run_op/task_options[band]/klabels`: + .. _`run_op/task_options[negf]/plot_blocks`: - klabels: - | type: ``list``, optional, default: ``['']`` - | argument path: ``run_op/task_options[band]/klabels`` + plot_blocks: + | type: ``bool``, optional, default: ``False`` + | argument path: ``run_op/task_options[negf]/plot_blocks`` - the labels for high symmetry kpoint + Whether to plot the block tridiagonalization process - .. _`run_op/task_options[band]/E_fermi`: + .. _`run_op/task_options[negf]/ele_T`: - E_fermi: - | type: ``float`` | ``int`` | ``NoneType``, optional, default: ``None`` - | argument path: ``run_op/task_options[band]/E_fermi`` + ele_T: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[negf]/ele_T`` - the fermi level used to plot band + Electronic temperature in Kelvin. Required. - .. _`run_op/task_options[band]/emin`: + .. _`run_op/task_options[negf]/unit`: - emin: - | type: ``float`` | ``int`` | ``NoneType``, optional, default: ``None`` - | argument path: ``run_op/task_options[band]/emin`` + unit: + | type: ``str``, optional, default: ``Hartree`` + | argument path: ``run_op/task_options[negf]/unit`` - the min energy to show the band plot + Energy unit used for the energy grid and outputs. Choose 'Hartree' (default) or 'eV'. - .. _`run_op/task_options[band]/emax`: + .. _`run_op/task_options[negf]/hs_cache`: - emax: - | type: ``float`` | ``int`` | ``NoneType``, optional, default: ``None`` - | argument path: ``run_op/task_options[band]/emax`` + hs_cache: + | type: ``dict``, optional, default: ``{}`` + | argument path: ``run_op/task_options[negf]/hs_cache`` - the max energy to show the band plot + On-disk cache of the device Hamiltonian and overlap matrix. - .. _`run_op/task_options[band]/nkpoints`: + .. _`run_op/task_options[negf]/hs_cache/use_saved`: - nkpoints: - | type: ``int``, optional, default: ``0`` - | argument path: ``run_op/task_options[band]/nkpoints`` + use_saved: + | type: ``bool``, optional, default: ``False`` + | argument path: ``run_op/task_options[negf]/hs_cache/use_saved`` - the max energy to show the band plot + Whether to load the device Hamiltonian and overlap from an on-disk cache. - .. _`run_op/task_options[band]/ref_band`: + .. _`run_op/task_options[negf]/hs_cache/save_path`: - ref_band: - | type: ``str`` | ``NoneType``, optional, default: ``None`` - | argument path: ``run_op/task_options[band]/ref_band`` + save_path: + | type: ``NoneType`` | ``str``, optional, default: ``None`` + | argument path: ``run_op/task_options[negf]/hs_cache/save_path`` - the reference band structure to be ploted together with dptb bands. + Path to the saved Hamiltonian / overlap file. Required when use_saved is true. - .. _`run_op/task_options[band]/nel_atom`: + .. _`run_op/task_options[negf]/scf_options`: - nel_atom: - | type: ``dict`` | ``NoneType``, optional, default: ``None`` - | argument path: ``run_op/task_options[band]/nel_atom`` + scf_options: + | type: ``dict``, optional, default: ``{}`` + | argument path: ``run_op/task_options[negf]/scf_options`` - the valence electron number of each type of atom. + SCF mixing options (only used when `scf` is true). - .. _`run_op/task_options[dos]`: + Depending on the value of *mode*, different sub args are accepted. - When |flag:run_op/task_options/task|_ is set to ``dos``: + .. _`run_op/task_options[negf]/scf_options/mode`: - .. _`run_op/task_options[dos]/mesh_grid`: + mode: + | type: ``str`` (flag key), default: ``PDIIS`` + | argument path: ``run_op/task_options[negf]/scf_options/mode`` + | possible choices: |code:run_op/task_options[negf]/scf_options[PDIIS]|_ - mesh_grid: - | type: ``list`` - | argument path: ``run_op/task_options[dos]/mesh_grid`` + SCF mixing algorithm. Currently only 'PDIIS' is supported. - .. _`run_op/task_options[dos]/sigma`: + .. |code:run_op/task_options[negf]/scf_options[PDIIS]| replace:: ``PDIIS`` + .. _`code:run_op/task_options[negf]/scf_options[PDIIS]`: `run_op/task_options[negf]/scf_options[PDIIS]`_ - sigma: - | type: ``float`` - | argument path: ``run_op/task_options[dos]/sigma`` + .. |flag:run_op/task_options[negf]/scf_options/mode| replace:: *mode* + .. _`flag:run_op/task_options[negf]/scf_options/mode`: `run_op/task_options[negf]/scf_options/mode`_ - .. _`run_op/task_options[dos]/npoints`: - npoints: - | type: ``int`` - | argument path: ``run_op/task_options[dos]/npoints`` + .. _`run_op/task_options[negf]/scf_options[PDIIS]`: - .. _`run_op/task_options[dos]/width`: + When |flag:run_op/task_options[negf]/scf_options/mode|_ is set to ``PDIIS``: - width: - | type: ``list`` - | argument path: ``run_op/task_options[dos]/width`` + PDIIS (Periodic-DIIS) mixing parameters. - .. _`run_op/task_options[dos]/E_fermi`: + .. _`run_op/task_options[negf]/scf_options[PDIIS]/mixing_period`: - E_fermi: - | type: ``float`` | ``int`` | ``NoneType``, optional, default: ``None`` - | argument path: ``run_op/task_options[dos]/E_fermi`` + mixing_period: + | type: ``int``, optional, default: ``3`` + | argument path: ``run_op/task_options[negf]/scf_options[PDIIS]/mixing_period`` - .. _`run_op/task_options[dos]/gamma_center`: + How many iterations between DIIS extrapolations. Default: 3. - gamma_center: - | type: ``bool``, optional, default: ``False`` - | argument path: ``run_op/task_options[dos]/gamma_center`` + .. _`run_op/task_options[negf]/scf_options[PDIIS]/step_size`: + step_size: + | type: ``int`` | ``float``, optional, default: ``0.05`` + | argument path: ``run_op/task_options[negf]/scf_options[PDIIS]/step_size`` - .. _`run_op/task_options[pdos]`: + Linear mixing step size between DIIS steps. Default: 0.05. - When |flag:run_op/task_options/task|_ is set to ``pdos``: + .. _`run_op/task_options[negf]/scf_options[PDIIS]/n_history`: - .. _`run_op/task_options[pdos]/mesh_grid`: + n_history: + | type: ``int``, optional, default: ``6`` + | argument path: ``run_op/task_options[negf]/scf_options[PDIIS]/n_history`` - mesh_grid: - | type: ``list`` - | argument path: ``run_op/task_options[pdos]/mesh_grid`` + Number of previous residuals kept for the DIIS subspace. Default: 6. - .. _`run_op/task_options[pdos]/sigma`: + .. _`run_op/task_options[negf]/scf_options[PDIIS]/abs_err`: - sigma: - | type: ``float`` - | argument path: ``run_op/task_options[pdos]/sigma`` + abs_err: + | type: ``int`` | ``float``, optional, default: ``1e-06`` + | argument path: ``run_op/task_options[negf]/scf_options[PDIIS]/abs_err`` - .. _`run_op/task_options[pdos]/npoints`: + Absolute convergence tolerance on the SCF residual. Default: 1e-6. - npoints: - | type: ``int`` - | argument path: ``run_op/task_options[pdos]/npoints`` + .. _`run_op/task_options[negf]/scf_options[PDIIS]/rel_err`: - .. _`run_op/task_options[pdos]/width`: + rel_err: + | type: ``int`` | ``float``, optional, default: ``0.0001`` + | argument path: ``run_op/task_options[negf]/scf_options[PDIIS]/rel_err`` - width: - | type: ``list`` - | argument path: ``run_op/task_options[pdos]/width`` + Relative convergence tolerance on the SCF residual. Default: 1e-4. - .. _`run_op/task_options[pdos]/E_fermi`: + .. _`run_op/task_options[negf]/scf_options[PDIIS]/max_iter`: - E_fermi: - | type: ``float`` | ``int`` | ``NoneType``, optional, default: ``None`` - | argument path: ``run_op/task_options[pdos]/E_fermi`` + max_iter: + | type: ``int``, optional, default: ``100`` + | argument path: ``run_op/task_options[negf]/scf_options[PDIIS]/max_iter`` - .. _`run_op/task_options[pdos]/atom_index`: + Maximum SCF iterations. Default: 100. - atom_index: - | type: ``list`` - | argument path: ``run_op/task_options[pdos]/atom_index`` + .. _`run_op/task_options[negf]/stru_options`: - .. _`run_op/task_options[pdos]/orbital_index`: + stru_options: + | type: ``dict`` + | argument path: ``run_op/task_options[negf]/stru_options`` - orbital_index: - | type: ``list`` - | argument path: ``run_op/task_options[pdos]/orbital_index`` + Structure partition and k-mesh options: device region, left/right leads, PBC, k-mesh. - .. _`run_op/task_options[pdos]/gamma_center`: + .. _`run_op/task_options[negf]/stru_options/device`: - gamma_center: - | type: ``bool``, optional, default: ``False`` - | argument path: ``run_op/task_options[pdos]/gamma_center`` + device: + | type: ``dict`` + | argument path: ``run_op/task_options[negf]/stru_options/device`` + Device region: atom index range and sorting. - .. _`run_op/task_options[FS2D]`: + .. _`run_op/task_options[negf]/stru_options/device/id`: - When |flag:run_op/task_options/task|_ is set to ``FS2D``: + id: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/stru_options/device/id`` - .. _`run_op/task_options[FS2D]/mesh_grid`: + Atom index range of the device region, e.g. '32-64' (0-indexed, half-open). - mesh_grid: - | type: ``list`` - | argument path: ``run_op/task_options[FS2D]/mesh_grid`` + .. _`run_op/task_options[negf]/stru_options/device/sort`: - .. _`run_op/task_options[FS2D]/sigma`: + sort: + | type: ``bool``, optional, default: ``True`` + | argument path: ``run_op/task_options[negf]/stru_options/device/sort`` - sigma: - | type: ``float`` - | argument path: ``run_op/task_options[FS2D]/sigma`` + Whether to sort atoms in the device region along the transport axis. Default: True. - .. _`run_op/task_options[FS2D]/E0`: + .. _`run_op/task_options[negf]/stru_options/lead_L`: - E0: - | type: ``int`` - | argument path: ``run_op/task_options[FS2D]/E0`` + lead_L: + | type: ``dict`` + | argument path: ``run_op/task_options[negf]/stru_options/lead_L`` - .. _`run_op/task_options[FS2D]/intpfactor`: + Left lead: atom index range, voltage, k-mesh for lead Fermi-level, Bloch expansion. - intpfactor: - | type: ``int`` - | argument path: ``run_op/task_options[FS2D]/intpfactor`` + .. _`run_op/task_options[negf]/stru_options/lead_L/id`: + id: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/stru_options/lead_L/id`` - .. _`run_op/task_options[FS3D]`: + Atom index range of the lead region, e.g. '0-32' (0-indexed, half-open). - When |flag:run_op/task_options/task|_ is set to ``FS3D``: + .. _`run_op/task_options[negf]/stru_options/lead_L/voltage`: - .. _`run_op/task_options[FS3D]/mesh_grid`: + voltage: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[negf]/stru_options/lead_L/voltage`` - mesh_grid: - | type: ``list`` - | argument path: ``run_op/task_options[FS3D]/mesh_grid`` + Applied bias voltage on this lead, in `unit`. Required. - .. _`run_op/task_options[FS3D]/sigma`: + .. _`run_op/task_options[negf]/stru_options/lead_L/useBloch`: - sigma: - | type: ``float`` - | argument path: ``run_op/task_options[FS3D]/sigma`` + useBloch: + | type: ``bool``, optional, default: ``False`` + | argument path: ``run_op/task_options[negf]/stru_options/lead_L/useBloch`` - .. _`run_op/task_options[FS3D]/E0`: + Whether to use Bloch expansion to reduce lead unit cell size. Default: False. - E0: - | type: ``int`` - | argument path: ``run_op/task_options[FS3D]/E0`` + .. _`run_op/task_options[negf]/stru_options/lead_L/bloch_factor`: - .. _`run_op/task_options[FS3D]/intpfactor`: + bloch_factor: + | type: ``list``, optional, default: ``[1, 1, 1]`` + | argument path: ``run_op/task_options[negf]/stru_options/lead_L/bloch_factor`` - intpfactor: - | type: ``int`` - | argument path: ``run_op/task_options[FS3D]/intpfactor`` + Bloch factor [nx, ny, nz] for the lead unit cell. Default: [1, 1, 1]. + .. _`run_op/task_options[negf]/stru_options/lead_L/kmesh_lead_Ef`: - .. _`run_op/task_options[write_sk]`: + kmesh_lead_Ef: + | type: ``list``, optional + | argument path: ``run_op/task_options[negf]/stru_options/lead_L/kmesh_lead_Ef`` - When |flag:run_op/task_options/task|_ is set to ``write_sk``: + K-mesh used to compute the lead Fermi level, [nkx, nky, nkz]. - .. _`run_op/task_options[write_sk]/format`: + .. _`run_op/task_options[negf]/stru_options/lead_L/charge`: - format: - | type: ``str``, optional, default: ``sktable`` - | argument path: ``run_op/task_options[write_sk]/format`` + charge: + | type: ``int`` | ``float``, optional, default: ``0.0`` + | argument path: ``run_op/task_options[negf]/stru_options/lead_L/charge`` - .. _`run_op/task_options[write_sk]/thr`: + Doping charge on the lead, used when computing the lead Fermi level. Default: 0.0. - thr: - | type: ``float``, optional, default: ``0.001`` - | argument path: ``run_op/task_options[write_sk]/thr`` + .. _`run_op/task_options[negf]/stru_options/lead_R`: + lead_R: + | type: ``dict`` + | argument path: ``run_op/task_options[negf]/stru_options/lead_R`` - .. _`run_op/task_options[ifermi]`: + Right lead: atom index range, voltage, k-mesh for lead Fermi-level, Bloch expansion. - When |flag:run_op/task_options/task|_ is set to ``ifermi``: + .. _`run_op/task_options[negf]/stru_options/lead_R/id`: - .. _`run_op/task_options[ifermi]/fermisurface`: + id: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/stru_options/lead_R/id`` - fermisurface: - | type: ``dict`` - | argument path: ``run_op/task_options[ifermi]/fermisurface`` + Atom index range of the lead region, e.g. '0-32' (0-indexed, half-open). - .. _`run_op/task_options[ifermi]/fermisurface/mesh_grid`: + .. _`run_op/task_options[negf]/stru_options/lead_R/voltage`: - mesh_grid: - | type: ``list`` - | argument path: ``run_op/task_options[ifermi]/fermisurface/mesh_grid`` + voltage: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[negf]/stru_options/lead_R/voltage`` - .. _`run_op/task_options[ifermi]/fermisurface/mu`: + Applied bias voltage on this lead, in `unit`. Required. - mu: - | type: ``float`` | ``int`` - | argument path: ``run_op/task_options[ifermi]/fermisurface/mu`` + .. _`run_op/task_options[negf]/stru_options/lead_R/useBloch`: - .. _`run_op/task_options[ifermi]/fermisurface/sigma`: + useBloch: + | type: ``bool``, optional, default: ``False`` + | argument path: ``run_op/task_options[negf]/stru_options/lead_R/useBloch`` - sigma: - | type: ``float``, optional, default: ``0.1`` - | argument path: ``run_op/task_options[ifermi]/fermisurface/sigma`` + Whether to use Bloch expansion to reduce lead unit cell size. Default: False. - .. _`run_op/task_options[ifermi]/fermisurface/intpfactor`: + .. _`run_op/task_options[negf]/stru_options/lead_R/bloch_factor`: - intpfactor: - | type: ``int`` - | argument path: ``run_op/task_options[ifermi]/fermisurface/intpfactor`` + bloch_factor: + | type: ``list``, optional, default: ``[1, 1, 1]`` + | argument path: ``run_op/task_options[negf]/stru_options/lead_R/bloch_factor`` - .. _`run_op/task_options[ifermi]/fermisurface/wigner_seitz`: + Bloch factor [nx, ny, nz] for the lead unit cell. Default: [1, 1, 1]. - wigner_seitz: - | type: ``bool``, optional, default: ``True`` - | argument path: ``run_op/task_options[ifermi]/fermisurface/wigner_seitz`` + .. _`run_op/task_options[negf]/stru_options/lead_R/kmesh_lead_Ef`: - .. _`run_op/task_options[ifermi]/fermisurface/nworkers`: + kmesh_lead_Ef: + | type: ``list``, optional + | argument path: ``run_op/task_options[negf]/stru_options/lead_R/kmesh_lead_Ef`` - nworkers: - | type: ``int``, optional, default: ``-1`` - | argument path: ``run_op/task_options[ifermi]/fermisurface/nworkers`` + K-mesh used to compute the lead Fermi level, [nkx, nky, nkz]. - .. _`run_op/task_options[ifermi]/fermisurface/plot_type`: + .. _`run_op/task_options[negf]/stru_options/lead_R/charge`: - plot_type: - | type: ``str``, optional, default: ``plotly`` - | argument path: ``run_op/task_options[ifermi]/fermisurface/plot_type`` + charge: + | type: ``int`` | ``float``, optional, default: ``0.0`` + | argument path: ``run_op/task_options[negf]/stru_options/lead_R/charge`` - plot_type: Method used for plotting. Valid options are: matplotlib, plotly, mayavi, crystal_toolkit. + Doping charge on the lead, used when computing the lead Fermi level. Default: 0.0. - .. _`run_op/task_options[ifermi]/fermisurface/use_gui`: + .. _`run_op/task_options[negf]/stru_options/kmesh`: - use_gui: - | type: ``bool``, optional, default: ``False`` - | argument path: ``run_op/task_options[ifermi]/fermisurface/use_gui`` + kmesh: + | type: ``list``, optional, default: ``[1, 1, 1]`` + | argument path: ``run_op/task_options[negf]/stru_options/kmesh`` - .. _`run_op/task_options[ifermi]/fermisurface/plot_fs_bands`: + K-mesh used for the device transverse Brillouin-zone sampling, [nkx, nky, nkz]. Default: [1, 1, 1]. - plot_fs_bands: - | type: ``bool``, optional, default: ``False`` - | argument path: ``run_op/task_options[ifermi]/fermisurface/plot_fs_bands`` + .. _`run_op/task_options[negf]/stru_options/pbc`: - .. _`run_op/task_options[ifermi]/fermisurface/fs_plane`: + pbc: + | type: ``list``, optional, default: ``[False, False, False]`` + | argument path: ``run_op/task_options[negf]/stru_options/pbc`` - fs_plane: - | type: ``list``, optional, default: ``[0, 0, 1]`` - | argument path: ``run_op/task_options[ifermi]/fermisurface/fs_plane`` + Periodic boundary condition applied to the device, list of three booleans for x/y/z. Default: [False, False, False]. - .. _`run_op/task_options[ifermi]/fermisurface/fs_distance`: + .. _`run_op/task_options[negf]/stru_options/gamma_center`: - fs_distance: - | type: ``float`` | ``int``, optional, default: ``0`` - | argument path: ``run_op/task_options[ifermi]/fermisurface/fs_distance`` + gamma_center: + | type: ``bool`` | ``list``, optional, default: ``True`` + | argument path: ``run_op/task_options[negf]/stru_options/gamma_center`` - .. _`run_op/task_options[ifermi]/fermisurface/plot_options`: + Whether the k-mesh is Gamma-centered. Default: True. - plot_options: - | type: ``dict``, optional, default: ``{}`` - | argument path: ``run_op/task_options[ifermi]/fermisurface/plot_options`` - - .. _`run_op/task_options[ifermi]/fermisurface/plot_options/colors`: - - colors: - | type: ``str`` | ``dict`` | ``NoneType`` | ``list``, optional, default: ``None`` - | argument path: ``run_op/task_options[ifermi]/fermisurface/plot_options/colors`` - - The color specification for the iso-surfaces. Valid options are: - - A single color to use for all Fermi surfaces, specified as a tuple of - rgb values from 0 to 1. E.g., red would be ``(1, 0, 0)``. - - A list of colors, specified as above. - - A dictionary of ``{Spin.up: color1, Spin.down: color2}``, where the - colors are specified as above. - - A string specifying which matplotlib colormap to use. See - https://matplotlib.org/tutorials/colors/colormaps.html for more - information. - - ``None``, in which case the default colors will be used. - + .. _`run_op/task_options[negf]/stru_options/time_reversal_symmetry`: - .. _`run_op/task_options[ifermi]/fermisurface/plot_options/projection_axis`: + time_reversal_symmetry: + | type: ``bool`` | ``list``, optional, default: ``True`` + | argument path: ``run_op/task_options[negf]/stru_options/time_reversal_symmetry`` - projection_axis: - | type: ``list`` | ``NoneType``, optional, default: ``None`` - | argument path: ``run_op/task_options[ifermi]/fermisurface/plot_options/projection_axis`` + Whether to enforce time-reversal symmetry when folding the k-mesh. Default: True. - projection_axis: Projection axis that can be used to calculate the color of - vector properties. If None, the norm of the properties will be used, - otherwise the color will be determined by the dot product of the - properties with the projection axis. Only has an effect when used with - the ``vector_properties`` option. + .. _`run_op/task_options[negf]/stru_options/e_fermi_smearing`: - .. _`run_op/task_options[ifermi]/fermisurface/plot_options/hide_surface`: + e_fermi_smearing: + | type: ``str``, optional, default: ``FD`` + | argument path: ``run_op/task_options[negf]/stru_options/e_fermi_smearing`` - hide_surface: - | type: ``bool``, optional, default: ``False`` - | argument path: ``run_op/task_options[ifermi]/fermisurface/plot_options/hide_surface`` + Smearing method for lead Fermi-level determination. Default: 'FD' (Fermi-Dirac). - hide_surface: Whether to hide the Fermi surface. Only recommended in combination with the ``vector_properties`` option. + .. _`run_op/task_options[negf]/stru_options/eig_solver`: - .. _`run_op/task_options[ifermi]/fermisurface/plot_options/hide_labels`: + eig_solver: + | type: ``str``, optional, default: ``torch`` + | argument path: ``run_op/task_options[negf]/stru_options/eig_solver`` - hide_labels: - | type: ``bool``, optional, default: ``False`` - | argument path: ``run_op/task_options[ifermi]/fermisurface/plot_options/hide_labels`` + Eigenvalue solver used for lead Fermi-level calculation. Default: 'torch'. - hide_labels: Whether to show the high-symmetry k-point labels. + .. _`run_op/task_options[negf]/stru_options/nel_atom`: - .. _`run_op/task_options[ifermi]/fermisurface/plot_options/hide_cell`: + nel_atom: + | type: ``NoneType`` | ``dict``, optional, default: ``None`` + | argument path: ``run_op/task_options[negf]/stru_options/nel_atom`` - hide_cell: - | type: ``bool``, optional, default: ``False`` - | argument path: ``run_op/task_options[ifermi]/fermisurface/plot_options/hide_cell`` + Number of valence electrons per element, e.g. {'C': 4}. Required for SCF or when computing lead Fermi-level. - hide_cell: Whether to show the reciprocal cell boundary. + .. _`run_op/task_options[negf]/poisson_options`: - .. _`run_op/task_options[ifermi]/fermisurface/plot_options/vector_spacing`: + poisson_options: + | type: ``dict``, optional, default: ``{}`` + | argument path: ``run_op/task_options[negf]/poisson_options`` - vector_spacing: - | type: ``float``, optional, default: ``0.2`` - | argument path: ``run_op/task_options[ifermi]/fermisurface/plot_options/vector_spacing`` + Poisson solver options (only used when `scf` is true). - vector_spacing: The rough spacing between arrows. Uses a custom algorithm - for resampling the Fermi surface to ensure that arrows are not too close - together. Only has an effect when used with the ``vector_properties`` - option. - .. _`run_op/task_options[ifermi]/fermisurface/plot_options/azimuth`: + Depending on the value of *solver*, different sub args are accepted. - azimuth: - | type: ``float``, optional, default: ``45.0`` - | argument path: ``run_op/task_options[ifermi]/fermisurface/plot_options/azimuth`` + .. _`run_op/task_options[negf]/poisson_options/solver`: - azimuth: The azimuth of the viewpoint in degrees. i.e. the angle subtended by the position vector on a sphere projected on to the x-y plane. + solver: + | type: ``str`` (flag key), default: ``fmm`` + | argument path: ``run_op/task_options[negf]/poisson_options/solver`` + | possible choices: |code:run_op/task_options[negf]/poisson_options[fmm]|_, |code:run_op/task_options[negf]/poisson_options[pyamg]|_, |code:run_op/task_options[negf]/poisson_options[scipy]|_ - .. _`run_op/task_options[ifermi]/fermisurface/plot_options/elevation`: + Poisson solver backend. 'fmm' (default) uses the free-space Fast Multipole Method; 'pyamg' uses an algebraic-multigrid finite-difference solver on a grid; 'scipy' uses SciPy's sparse linear algebra on a grid. - elevation: - | type: ``float``, optional, default: ``35.0`` - | argument path: ``run_op/task_options[ifermi]/fermisurface/plot_options/elevation`` + .. |code:run_op/task_options[negf]/poisson_options[fmm]| replace:: ``fmm`` + .. _`code:run_op/task_options[negf]/poisson_options[fmm]`: `run_op/task_options[negf]/poisson_options[fmm]`_ + .. |code:run_op/task_options[negf]/poisson_options[pyamg]| replace:: ``pyamg`` + .. _`code:run_op/task_options[negf]/poisson_options[pyamg]`: `run_op/task_options[negf]/poisson_options[pyamg]`_ + .. |code:run_op/task_options[negf]/poisson_options[scipy]| replace:: ``scipy`` + .. _`code:run_op/task_options[negf]/poisson_options[scipy]`: `run_op/task_options[negf]/poisson_options[scipy]`_ - The zenith angle of the viewpoint in degrees, i.e. the angle subtended by the position vector and the z-axis. + .. |flag:run_op/task_options[negf]/poisson_options/solver| replace:: *solver* + .. _`flag:run_op/task_options[negf]/poisson_options/solver`: `run_op/task_options[negf]/poisson_options/solver`_ - .. _`run_op/task_options[ifermi]/property`: - property: - | type: ``dict``, optional, default: ``{}`` - | argument path: ``run_op/task_options[ifermi]/property`` + .. _`run_op/task_options[negf]/poisson_options[fmm]`: - .. _`run_op/task_options[ifermi]/property/velocity`: + When |flag:run_op/task_options[negf]/poisson_options/solver|_ is set to ``fmm``: - velocity: - | type: ``bool``, optional, default: ``False`` - | argument path: ``run_op/task_options[ifermi]/property/velocity`` + FMM solver options. - .. _`run_op/task_options[ifermi]/property/color_properties`: + .. _`run_op/task_options[negf]/poisson_options[fmm]/err`: - color_properties: - | type: ``str`` | ``bool``, optional, default: ``False`` - | argument path: ``run_op/task_options[ifermi]/property/color_properties`` + err: + | type: ``int`` | ``float``, optional, default: ``1e-05`` + | argument path: ``run_op/task_options[negf]/poisson_options[fmm]/err`` - color_properties: Whether to use the properties to color the Fermi surface. - If the properties is a vector then the norm of the properties will be - used. Note, this will only take effect if the Fermi surface has - properties. If set to True, the viridis colormap will be used. - Alternative colormaps can be selected by setting ``color_properties`` - to a matplotlib colormap name. This setting will override the ``colors`` - option. For vector properties, the arrows are colored according to the - norm of the properties by default. If used in combination with the - ``projection_axis`` option, the color will be determined by the dot - product of the properties with the projection axis. + Requested FMM accuracy on the Coulomb sum. Default: 1e-5. - .. _`run_op/task_options[ifermi]/property/colormap`: - colormap: - | type: ``str``, optional, default: ``viridis`` - | argument path: ``run_op/task_options[ifermi]/property/colormap`` + .. _`run_op/task_options[negf]/poisson_options[pyamg]`: - .. _`run_op/task_options[ifermi]/property/prop_plane`: + When |flag:run_op/task_options[negf]/poisson_options/solver|_ is set to ``pyamg``: - prop_plane: - | type: ``list``, optional, default: ``[0, 0, 1]`` - | argument path: ``run_op/task_options[ifermi]/property/prop_plane`` + pyamg (algebraic multigrid) solver options: grid, gates, dielectric and doped regions. - .. _`run_op/task_options[ifermi]/property/prop_distance`: + .. _`run_op/task_options[negf]/poisson_options[pyamg]/err`: - prop_distance: - | type: ``float`` | ``int``, optional, default: ``0`` - | argument path: ``run_op/task_options[ifermi]/property/prop_distance`` + err: + | type: ``int`` | ``float``, optional, default: ``1e-05`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/err`` - .. _`run_op/task_options[ifermi]/property/plot_options`: + Error target passed to the AMG solver. Default: 1e-5. - plot_options: - | type: ``dict``, optional, default: ``{}`` - | argument path: ``run_op/task_options[ifermi]/property/plot_options`` - - .. _`run_op/task_options[ifermi]/property/plot_options/colors`: - - colors: - | type: ``str`` | ``dict`` | ``NoneType`` | ``list``, optional, default: ``None`` - | argument path: ``run_op/task_options[ifermi]/property/plot_options/colors`` - - The color specification for the iso-surfaces. Valid options are: - - A single color to use for all Fermi surfaces, specified as a tuple of - rgb values from 0 to 1. E.g., red would be ``(1, 0, 0)``. - - A list of colors, specified as above. - - A dictionary of ``{Spin.up: color1, Spin.down: color2}``, where the - colors are specified as above. - - A string specifying which matplotlib colormap to use. See - https://matplotlib.org/tutorials/colors/colormaps.html for more - information. - - ``None``, in which case the default colors will be used. - + .. _`run_op/task_options[negf]/poisson_options[pyamg]/tolerance`: - .. _`run_op/task_options[ifermi]/property/plot_options/projection_axis`: + tolerance: + | type: ``int`` | ``float``, optional, default: ``1e-07`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/tolerance`` - projection_axis: - | type: ``list`` | ``NoneType``, optional, default: ``None`` - | argument path: ``run_op/task_options[ifermi]/property/plot_options/projection_axis`` + Convergence tolerance of the AMG linear solve. Default: 1e-7. - projection_axis: Projection axis that can be used to calculate the color of - vector properties. If None, the norm of the properties will be used, - otherwise the color will be determined by the dot product of the - properties with the projection axis. Only has an effect when used with - the ``vector_properties`` option. + .. _`run_op/task_options[negf]/poisson_options[pyamg]/max_iter`: - .. _`run_op/task_options[ifermi]/property/plot_options/hide_surface`: + max_iter: + | type: ``int``, optional, default: ``100`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/max_iter`` - hide_surface: - | type: ``bool``, optional, default: ``False`` - | argument path: ``run_op/task_options[ifermi]/property/plot_options/hide_surface`` + Maximum AMG iterations. Default: 100. - hide_surface: Whether to hide the Fermi surface. Only recommended in combination with the ``vector_properties`` option. + .. _`run_op/task_options[negf]/poisson_options[pyamg]/mix_rate`: - .. _`run_op/task_options[ifermi]/property/plot_options/hide_labels`: + mix_rate: + | type: ``int`` | ``float``, optional, default: ``0.25`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/mix_rate`` - hide_labels: - | type: ``bool``, optional, default: ``False`` - | argument path: ``run_op/task_options[ifermi]/property/plot_options/hide_labels`` + Underrelaxation between successive Poisson solves. Default: 0.25. - hide_labels: Whether to show the high-symmetry k-point labels. + .. _`run_op/task_options[negf]/poisson_options[pyamg]/poisson_dtype`: - .. _`run_op/task_options[ifermi]/property/plot_options/hide_cell`: + poisson_dtype: + | type: ``str``, optional, default: ``float64`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/poisson_dtype`` - hide_cell: - | type: ``bool``, optional, default: ``False`` - | argument path: ``run_op/task_options[ifermi]/property/plot_options/hide_cell`` + Floating precision of the Poisson solver ('float32' or 'float64'). Default: 'float64'. - hide_cell: Whether to show the reciprocal cell boundary. + .. _`run_op/task_options[negf]/poisson_options[pyamg]/grid`: - .. _`run_op/task_options[ifermi]/property/plot_options/vector_spacing`: + grid: + | type: ``dict`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/grid`` - vector_spacing: - | type: ``float``, optional, default: ``0.2`` - | argument path: ``run_op/task_options[ifermi]/property/plot_options/vector_spacing`` + Real-space grid used to discretize the Poisson equation. - vector_spacing: The rough spacing between arrows. Uses a custom algorithm - for resampling the Fermi surface to ensure that arrows are not too close - together. Only has an effect when used with the ``vector_properties`` - option. + .. _`run_op/task_options[negf]/poisson_options[pyamg]/grid/x_range`: - .. _`run_op/task_options[ifermi]/property/plot_options/azimuth`: + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/grid/x_range`` - azimuth: - | type: ``float``, optional, default: ``45.0`` - | argument path: ``run_op/task_options[ifermi]/property/plot_options/azimuth`` + Grid range along x as 'start:stop:n' (Angstrom, n points). - azimuth: The azimuth of the viewpoint in degrees. i.e. the angle subtended by the position vector on a sphere projected on to the x-y plane. + .. _`run_op/task_options[negf]/poisson_options[pyamg]/grid/y_range`: - .. _`run_op/task_options[ifermi]/property/plot_options/elevation`: + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/grid/y_range`` - elevation: - | type: ``float``, optional, default: ``35.0`` - | argument path: ``run_op/task_options[ifermi]/property/plot_options/elevation`` + Grid range along y as 'start:stop:n' (Angstrom, n points). - The zenith angle of the viewpoint in degrees, i.e. the angle subtended by the position vector and the z-axis. + .. _`run_op/task_options[negf]/poisson_options[pyamg]/grid/z_range`: + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/grid/z_range`` - .. _`run_op/task_options[negf]`: + Grid range along z as 'start:stop:n' (Angstrom, n points). - When |flag:run_op/task_options/task|_ is set to ``negf``: + .. _`run_op/task_options[negf]/poisson_options[pyamg]/gate_top`: - .. _`run_op/task_options[negf]/scf`: + gate_top: + | type: ``dict``, optional + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/gate_top`` - scf: - | type: ``bool``, optional, default: ``False`` - | argument path: ``run_op/task_options[negf]/scf`` + Dirichlet boundary condition for a metallic gate (x/y/z range and applied voltage). - .. _`run_op/task_options[negf]/block_tridiagonal`: + .. _`run_op/task_options[negf]/poisson_options[pyamg]/gate_top/x_range`: - block_tridiagonal: - | type: ``bool``, optional, default: ``False`` - | argument path: ``run_op/task_options[negf]/block_tridiagonal`` + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/gate_top/x_range`` - .. _`run_op/task_options[negf]/ele_T`: + Range along x as 'x0:x1' (Angstrom). - ele_T: - | type: ``float`` | ``int`` - | argument path: ``run_op/task_options[negf]/ele_T`` + .. _`run_op/task_options[negf]/poisson_options[pyamg]/gate_top/y_range`: - .. _`run_op/task_options[negf]/unit`: + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/gate_top/y_range`` - unit: - | type: ``str``, optional, default: ``Hartree`` - | argument path: ``run_op/task_options[negf]/unit`` + Range along y as 'y0:y1' (Angstrom). - .. _`run_op/task_options[negf]/scf_options`: + .. _`run_op/task_options[negf]/poisson_options[pyamg]/gate_top/z_range`: - scf_options: - | type: ``dict``, optional, default: ``{}`` - | argument path: ``run_op/task_options[negf]/scf_options`` + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/gate_top/z_range`` + Range along z as 'z0:z1' (Angstrom). - Depending on the value of *mode*, different sub args are accepted. + .. _`run_op/task_options[negf]/poisson_options[pyamg]/gate_top/voltage`: - .. _`run_op/task_options[negf]/scf_options/mode`: + voltage: + | type: ``int`` | ``float`` | ``NoneType``, optional, default: ``None`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/gate_top/voltage`` - mode: - | type: ``str`` (flag key), default: ``PDIIS`` - | argument path: ``run_op/task_options[negf]/scf_options/mode`` - | possible choices: |code:run_op/task_options[negf]/scf_options[PDIIS]|_ + Applied voltage on this Dirichlet boundary in `unit`. Default: None. - .. |code:run_op/task_options[negf]/scf_options[PDIIS]| replace:: ``PDIIS`` - .. _`code:run_op/task_options[negf]/scf_options[PDIIS]`: `run_op/task_options[negf]/scf_options[PDIIS]`_ + .. _`run_op/task_options[negf]/poisson_options[pyamg]/gate_bottom`: - .. |flag:run_op/task_options[negf]/scf_options/mode| replace:: *mode* - .. _`flag:run_op/task_options[negf]/scf_options/mode`: `run_op/task_options[negf]/scf_options/mode`_ + gate_bottom: + | type: ``dict``, optional + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/gate_bottom`` + Dirichlet boundary condition for a metallic gate (x/y/z range and applied voltage). - .. _`run_op/task_options[negf]/scf_options[PDIIS]`: + .. _`run_op/task_options[negf]/poisson_options[pyamg]/gate_bottom/x_range`: - When |flag:run_op/task_options[negf]/scf_options/mode|_ is set to ``PDIIS``: + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/gate_bottom/x_range`` - .. _`run_op/task_options[negf]/scf_options[PDIIS]/mixing_period`: + Range along x as 'x0:x1' (Angstrom). - mixing_period: - | type: ``int``, optional, default: ``3`` - | argument path: ``run_op/task_options[negf]/scf_options[PDIIS]/mixing_period`` + .. _`run_op/task_options[negf]/poisson_options[pyamg]/gate_bottom/y_range`: - .. _`run_op/task_options[negf]/scf_options[PDIIS]/step_size`: + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/gate_bottom/y_range`` - step_size: - | type: ``float`` | ``int``, optional, default: ``0.05`` - | argument path: ``run_op/task_options[negf]/scf_options[PDIIS]/step_size`` + Range along y as 'y0:y1' (Angstrom). - .. _`run_op/task_options[negf]/scf_options[PDIIS]/n_history`: + .. _`run_op/task_options[negf]/poisson_options[pyamg]/gate_bottom/z_range`: - n_history: - | type: ``int``, optional, default: ``6`` - | argument path: ``run_op/task_options[negf]/scf_options[PDIIS]/n_history`` + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/gate_bottom/z_range`` - .. _`run_op/task_options[negf]/scf_options[PDIIS]/abs_err`: + Range along z as 'z0:z1' (Angstrom). - abs_err: - | type: ``float`` | ``int``, optional, default: ``1e-06`` - | argument path: ``run_op/task_options[negf]/scf_options[PDIIS]/abs_err`` + .. _`run_op/task_options[negf]/poisson_options[pyamg]/gate_bottom/voltage`: - .. _`run_op/task_options[negf]/scf_options[PDIIS]/rel_err`: + voltage: + | type: ``int`` | ``float`` | ``NoneType``, optional, default: ``None`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/gate_bottom/voltage`` - rel_err: - | type: ``float`` | ``int``, optional, default: ``0.0001`` - | argument path: ``run_op/task_options[negf]/scf_options[PDIIS]/rel_err`` + Applied voltage on this Dirichlet boundary in `unit`. Default: None. - .. _`run_op/task_options[negf]/scf_options[PDIIS]/max_iter`: + .. _`run_op/task_options[negf]/poisson_options[pyamg]/gate_left`: - max_iter: - | type: ``int``, optional, default: ``100`` - | argument path: ``run_op/task_options[negf]/scf_options[PDIIS]/max_iter`` + gate_left: + | type: ``dict``, optional + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/gate_left`` - .. _`run_op/task_options[negf]/stru_options`: + Dirichlet boundary condition for a metallic gate (x/y/z range and applied voltage). - stru_options: - | type: ``dict`` - | argument path: ``run_op/task_options[negf]/stru_options`` + .. _`run_op/task_options[negf]/poisson_options[pyamg]/gate_left/x_range`: - .. _`run_op/task_options[negf]/stru_options/device`: + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/gate_left/x_range`` - device: - | type: ``dict`` - | argument path: ``run_op/task_options[negf]/stru_options/device`` + Range along x as 'x0:x1' (Angstrom). - .. _`run_op/task_options[negf]/stru_options/device/id`: + .. _`run_op/task_options[negf]/poisson_options[pyamg]/gate_left/y_range`: - id: + y_range: | type: ``str`` - | argument path: ``run_op/task_options[negf]/stru_options/device/id`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/gate_left/y_range`` - .. _`run_op/task_options[negf]/stru_options/device/sort`: + Range along y as 'y0:y1' (Angstrom). - sort: - | type: ``bool``, optional, default: ``True`` - | argument path: ``run_op/task_options[negf]/stru_options/device/sort`` + .. _`run_op/task_options[negf]/poisson_options[pyamg]/gate_left/z_range`: - .. _`run_op/task_options[negf]/stru_options/lead_L`: + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/gate_left/z_range`` - lead_L: - | type: ``dict`` - | argument path: ``run_op/task_options[negf]/stru_options/lead_L`` + Range along z as 'z0:z1' (Angstrom). - .. _`run_op/task_options[negf]/stru_options/lead_L/id`: + .. _`run_op/task_options[negf]/poisson_options[pyamg]/gate_left/voltage`: - id: - | type: ``str`` - | argument path: ``run_op/task_options[negf]/stru_options/lead_L/id`` + voltage: + | type: ``int`` | ``float`` | ``NoneType``, optional, default: ``None`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/gate_left/voltage`` - .. _`run_op/task_options[negf]/stru_options/lead_L/voltage`: + Applied voltage on this Dirichlet boundary in `unit`. Default: None. - voltage: - | type: ``float`` | ``int`` - | argument path: ``run_op/task_options[negf]/stru_options/lead_L/voltage`` + .. _`run_op/task_options[negf]/poisson_options[pyamg]/gate_right`: - .. _`run_op/task_options[negf]/stru_options/lead_R`: + gate_right: + | type: ``dict``, optional + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/gate_right`` - lead_R: - | type: ``dict`` - | argument path: ``run_op/task_options[negf]/stru_options/lead_R`` + Dirichlet boundary condition for a metallic gate (x/y/z range and applied voltage). - .. _`run_op/task_options[negf]/stru_options/lead_R/id`: + .. _`run_op/task_options[negf]/poisson_options[pyamg]/gate_right/x_range`: - id: + x_range: | type: ``str`` - | argument path: ``run_op/task_options[negf]/stru_options/lead_R/id`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/gate_right/x_range`` - .. _`run_op/task_options[negf]/stru_options/lead_R/voltage`: + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/gate_right/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/gate_right/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/gate_right/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/gate_right/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/gate_right/voltage`: + + voltage: + | type: ``int`` | ``float`` | ``NoneType``, optional, default: ``None`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/gate_right/voltage`` + + Applied voltage on this Dirichlet boundary in `unit`. Default: None. + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region`: + + dielectric_region: + | type: ``dict`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region`` + + Rectangular region with a fixed relative permittivity. Additional regions can be added via `dielectric_region2` ... `dielectric_region6`. + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region/relative permittivity`: + + relative permittivity: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region/relative permittivity`` + + Relative permittivity of the region. + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region2`: + + dielectric_region2: + | type: ``dict``, optional + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region2`` + + Rectangular region with a fixed relative permittivity. Additional regions can be added via `dielectric_region2` ... `dielectric_region6`. + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region2/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region2/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region2/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region2/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region2/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region2/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region2/relative permittivity`: + + relative permittivity: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region2/relative permittivity`` + + Relative permittivity of the region. + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region3`: + + dielectric_region3: + | type: ``dict``, optional + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region3`` + + Rectangular region with a fixed relative permittivity. Additional regions can be added via `dielectric_region2` ... `dielectric_region6`. + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region3/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region3/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region3/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region3/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region3/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region3/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region3/relative permittivity`: + + relative permittivity: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region3/relative permittivity`` + + Relative permittivity of the region. + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region4`: + + dielectric_region4: + | type: ``dict``, optional + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region4`` + + Rectangular region with a fixed relative permittivity. Additional regions can be added via `dielectric_region2` ... `dielectric_region6`. + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region4/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region4/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region4/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region4/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region4/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region4/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region4/relative permittivity`: + + relative permittivity: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region4/relative permittivity`` + + Relative permittivity of the region. + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region5`: + + dielectric_region5: + | type: ``dict``, optional + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region5`` + + Rectangular region with a fixed relative permittivity. Additional regions can be added via `dielectric_region2` ... `dielectric_region6`. + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region5/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region5/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region5/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region5/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region5/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region5/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region5/relative permittivity`: + + relative permittivity: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region5/relative permittivity`` + + Relative permittivity of the region. + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region6`: + + dielectric_region6: + | type: ``dict``, optional + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region6`` + + Rectangular region with a fixed relative permittivity. Additional regions can be added via `dielectric_region2` ... `dielectric_region6`. + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region6/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region6/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region6/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region6/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region6/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region6/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region6/relative permittivity`: + + relative permittivity: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/dielectric_region6/relative permittivity`` + + Relative permittivity of the region. + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/doped_region`: + + doped_region: + | type: ``dict`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/doped_region`` + + Rectangular region with a fixed doping charge density. + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/doped_region/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/doped_region/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/doped_region/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/doped_region/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/doped_region/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/doped_region/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[pyamg]/doped_region/charge`: + + charge: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[negf]/poisson_options[pyamg]/doped_region/charge`` + + Fixed doping charge (electrons per unit cell of the region). + + + .. _`run_op/task_options[negf]/poisson_options[scipy]`: + + When |flag:run_op/task_options[negf]/poisson_options/solver|_ is set to ``scipy``: + + SciPy sparse solver options: grid, gates, dielectric and doped regions. + + .. _`run_op/task_options[negf]/poisson_options[scipy]/err`: + + err: + | type: ``int`` | ``float``, optional, default: ``1e-05`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/err`` + + Residual threshold on the potential update. Default: 1e-5. + + .. _`run_op/task_options[negf]/poisson_options[scipy]/tolerance`: + + tolerance: + | type: ``int`` | ``float``, optional, default: ``1e-07`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/tolerance`` + + Convergence tolerance of the sparse linear solve. Default: 1e-7. + + .. _`run_op/task_options[negf]/poisson_options[scipy]/max_iter`: + + max_iter: + | type: ``int``, optional, default: ``100`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/max_iter`` + + Maximum Poisson iterations. Default: 100. + + .. _`run_op/task_options[negf]/poisson_options[scipy]/mix_rate`: + + mix_rate: + | type: ``int`` | ``float``, optional, default: ``0.25`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/mix_rate`` + + Underrelaxation between successive Poisson solves. Default: 0.25. + + .. _`run_op/task_options[negf]/poisson_options[scipy]/poisson_dtype`: + + poisson_dtype: + | type: ``str``, optional, default: ``float64`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/poisson_dtype`` + + Floating precision of the Poisson solver ('float32' or 'float64'). Default: 'float64'. + + .. _`run_op/task_options[negf]/poisson_options[scipy]/with_Dirichlet_leads`: + + with_Dirichlet_leads: + | type: ``bool``, optional, default: ``False`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/with_Dirichlet_leads`` + + Whether to use Dirichlet boundary condition for leads + + .. _`run_op/task_options[negf]/poisson_options[scipy]/grid`: + + grid: + | type: ``dict``, optional + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/grid`` + + Real-space grid used to discretize the Poisson equation. + + .. _`run_op/task_options[negf]/poisson_options[scipy]/grid/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/grid/x_range`` + + Grid range along x as 'start:stop:n' (Angstrom, n points). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/grid/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/grid/y_range`` + + Grid range along y as 'start:stop:n' (Angstrom, n points). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/grid/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/grid/z_range`` + + Grid range along z as 'start:stop:n' (Angstrom, n points). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/gate_top`: + + gate_top: + | type: ``dict``, optional + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/gate_top`` + + Dirichlet boundary condition for a metallic gate (x/y/z range and applied voltage). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/gate_top/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/gate_top/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/gate_top/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/gate_top/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/gate_top/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/gate_top/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/gate_top/voltage`: + + voltage: + | type: ``int`` | ``float`` | ``NoneType``, optional, default: ``None`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/gate_top/voltage`` + + Applied voltage on this Dirichlet boundary in `unit`. Default: None. + + .. _`run_op/task_options[negf]/poisson_options[scipy]/gate_bottom`: + + gate_bottom: + | type: ``dict``, optional + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/gate_bottom`` + + Dirichlet boundary condition for a metallic gate (x/y/z range and applied voltage). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/gate_bottom/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/gate_bottom/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/gate_bottom/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/gate_bottom/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/gate_bottom/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/gate_bottom/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/gate_bottom/voltage`: + + voltage: + | type: ``int`` | ``float`` | ``NoneType``, optional, default: ``None`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/gate_bottom/voltage`` + + Applied voltage on this Dirichlet boundary in `unit`. Default: None. + + .. _`run_op/task_options[negf]/poisson_options[scipy]/gate_left`: + + gate_left: + | type: ``dict``, optional + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/gate_left`` + + Dirichlet boundary condition for a metallic gate (x/y/z range and applied voltage). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/gate_left/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/gate_left/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/gate_left/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/gate_left/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/gate_left/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/gate_left/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/gate_left/voltage`: + + voltage: + | type: ``int`` | ``float`` | ``NoneType``, optional, default: ``None`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/gate_left/voltage`` + + Applied voltage on this Dirichlet boundary in `unit`. Default: None. + + .. _`run_op/task_options[negf]/poisson_options[scipy]/gate_right`: + + gate_right: + | type: ``dict``, optional + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/gate_right`` + + Dirichlet boundary condition for a metallic gate (x/y/z range and applied voltage). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/gate_right/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/gate_right/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/gate_right/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/gate_right/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/gate_right/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/gate_right/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/gate_right/voltage`: + + voltage: + | type: ``int`` | ``float`` | ``NoneType``, optional, default: ``None`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/gate_right/voltage`` + + Applied voltage on this Dirichlet boundary in `unit`. Default: None. + + .. _`run_op/task_options[negf]/poisson_options[scipy]/lead_L`: + + lead_L: + | type: ``dict``, optional + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/lead_L`` + + Dirichlet boundary condition for a metallic gate (x/y/z range and applied voltage). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/lead_L/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/lead_L/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/lead_L/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/lead_L/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/lead_L/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/lead_L/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/lead_L/voltage`: + + voltage: + | type: ``int`` | ``float`` | ``NoneType``, optional, default: ``None`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/lead_L/voltage`` + + Applied voltage on this Dirichlet boundary in `unit`. Default: None. + + .. _`run_op/task_options[negf]/poisson_options[scipy]/lead_R`: + + lead_R: + | type: ``dict``, optional + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/lead_R`` + + Dirichlet boundary condition for a metallic gate (x/y/z range and applied voltage). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/lead_R/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/lead_R/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/lead_R/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/lead_R/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/lead_R/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/lead_R/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/lead_R/voltage`: + + voltage: + | type: ``int`` | ``float`` | ``NoneType``, optional, default: ``None`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/lead_R/voltage`` + + Applied voltage on this Dirichlet boundary in `unit`. Default: None. + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region`: + + dielectric_region: + | type: ``dict``, optional + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region`` + + Rectangular region with a fixed relative permittivity. Additional regions can be added via `dielectric_region2` ... `dielectric_region6`. + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region/relative permittivity`: + + relative permittivity: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region/relative permittivity`` + + Relative permittivity of the region. + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region2`: + + dielectric_region2: + | type: ``dict``, optional + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region2`` + + Rectangular region with a fixed relative permittivity. Additional regions can be added via `dielectric_region2` ... `dielectric_region6`. + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region2/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region2/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region2/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region2/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region2/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region2/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region2/relative permittivity`: + + relative permittivity: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region2/relative permittivity`` + + Relative permittivity of the region. + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region3`: + + dielectric_region3: + | type: ``dict``, optional + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region3`` + + Rectangular region with a fixed relative permittivity. Additional regions can be added via `dielectric_region2` ... `dielectric_region6`. + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region3/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region3/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region3/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region3/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region3/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region3/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region3/relative permittivity`: + + relative permittivity: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region3/relative permittivity`` + + Relative permittivity of the region. + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region4`: + + dielectric_region4: + | type: ``dict``, optional + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region4`` + + Rectangular region with a fixed relative permittivity. Additional regions can be added via `dielectric_region2` ... `dielectric_region6`. + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region4/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region4/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region4/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region4/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region4/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region4/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region4/relative permittivity`: + + relative permittivity: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region4/relative permittivity`` + + Relative permittivity of the region. + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region5`: + + dielectric_region5: + | type: ``dict``, optional + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region5`` + + Rectangular region with a fixed relative permittivity. Additional regions can be added via `dielectric_region2` ... `dielectric_region6`. + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region5/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region5/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region5/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region5/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region5/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region5/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region5/relative permittivity`: + + relative permittivity: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region5/relative permittivity`` + + Relative permittivity of the region. + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region6`: + + dielectric_region6: + | type: ``dict``, optional + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region6`` + + Rectangular region with a fixed relative permittivity. Additional regions can be added via `dielectric_region2` ... `dielectric_region6`. + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region6/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region6/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region6/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region6/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region6/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region6/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/dielectric_region6/relative permittivity`: + + relative permittivity: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/dielectric_region6/relative permittivity`` + + Relative permittivity of the region. + + .. _`run_op/task_options[negf]/poisson_options[scipy]/doped_region1`: + + doped_region1: + | type: ``dict``, optional + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/doped_region1`` + + Rectangular region with a fixed doping charge density. + + .. _`run_op/task_options[negf]/poisson_options[scipy]/doped_region1/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/doped_region1/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/doped_region1/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/doped_region1/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/doped_region1/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/doped_region1/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/doped_region1/charge`: + + charge: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/doped_region1/charge`` + + Fixed doping charge (electrons per unit cell of the region). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/doped_region2`: + + doped_region2: + | type: ``dict``, optional + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/doped_region2`` + + Rectangular region with a fixed doping charge density. + + .. _`run_op/task_options[negf]/poisson_options[scipy]/doped_region2/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/doped_region2/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/doped_region2/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/doped_region2/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/doped_region2/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/doped_region2/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[negf]/poisson_options[scipy]/doped_region2/charge`: + + charge: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[negf]/poisson_options[scipy]/doped_region2/charge`` + + Fixed doping charge (electrons per unit cell of the region). + + .. _`run_op/task_options[negf]/self_energy_options`: + + self_energy_options: + | type: ``dict``, optional, default: ``{}`` + | argument path: ``run_op/task_options[negf]/self_energy_options`` + + Self-energy stage options: SGF solver, numba JIT, on-disk cache, and CPU parallelism (joblib workers, BLAS threads, ek batching). + + .. _`run_op/task_options[negf]/self_energy_options/solver`: + + solver: + | type: ``str``, optional, default: ``Sancho-Rubio`` + | argument path: ``run_op/task_options[negf]/self_energy_options/solver`` + + Surface Green's function solver. 'Sancho-Rubio' (default) or 'Lopez-Sancho'. + + .. _`run_op/task_options[negf]/self_energy_options/numba_jit`: + + numba_jit: + | type: ``bool`` | ``NoneType``, optional, default: ``None`` + | argument path: ``run_op/task_options[negf]/self_energy_options/numba_jit`` + + Whether to JIT-compile the surface Green's function core with numba. None (default) uses numba when available. + + .. _`run_op/task_options[negf]/self_energy_options/info_display`: + + info_display: + | type: ``bool``, optional, default: ``False`` + | argument path: ``run_op/task_options[negf]/self_energy_options/info_display`` + + Whether to log per-(k, E) self-energy solver info. Verbose; off by default. + + .. _`run_op/task_options[negf]/self_energy_options/cache`: + + cache: + | type: ``dict``, optional, default: ``{}`` + | argument path: ``run_op/task_options[negf]/self_energy_options/cache`` + + On-disk cache of the self-energy for reuse across runs. + + .. _`run_op/task_options[negf]/self_energy_options/cache/use_saved`: + + use_saved: + | type: ``bool``, optional, default: ``False`` + | argument path: ``run_op/task_options[negf]/self_energy_options/cache/use_saved`` + + Whether to load self-energy from an on-disk HDF5 cache instead of recomputing. + + .. _`run_op/task_options[negf]/self_energy_options/cache/save_path`: + + save_path: + | type: ``NoneType`` | ``str``, optional, default: ``None`` + | argument path: ``run_op/task_options[negf]/self_energy_options/cache/save_path`` + + Directory that holds (or will hold) the self-energy HDF5 files. If None, defaults to `/self_energy`. + + .. _`run_op/task_options[negf]/self_energy_options/parallel`: + + parallel: + | type: ``dict``, optional, default: ``{}`` + | argument path: ``run_op/task_options[negf]/self_energy_options/parallel`` + + CPU parallelism knobs for the self-energy sweep. + + .. _`run_op/task_options[negf]/self_energy_options/parallel/n_workers`: + + n_workers: + | type: ``int`` | ``NoneType``, optional, default: ``-1`` + | argument path: ``run_op/task_options[negf]/self_energy_options/parallel/n_workers`` + + Number of joblib workers used to parallelize the self-energy sweep over (k, E). -1 (default) auto-selects based on the CPU and memory budget (see `_get_safe_n_jobs`). + + .. _`run_op/task_options[negf]/self_energy_options/parallel/cpu_budget`: + + cpu_budget: + | type: ``int`` | ``NoneType``, optional, default: ``None`` + | argument path: ``run_op/task_options[negf]/self_energy_options/parallel/cpu_budget`` + + Total CPU cores the self-energy pool is allowed to size against. None (default) uses os.cpu_count(). This bounds both `n_workers` and `blas_threads` so BLAS-thread * worker <= cpu_budget. + + .. _`run_op/task_options[negf]/self_energy_options/parallel/blas_threads`: + + blas_threads: + | type: ``int`` | ``NoneType``, optional, default: ``None`` + | argument path: ``run_op/task_options[negf]/self_energy_options/parallel/blas_threads`` + + BLAS/LAPACK threads per worker inside the Lopez-Sancho loop. None (default) auto-tunes by timing a sample (k, E) at 1, 2, 4, 8, and cpu_budget/n_workers threads and keeping the fastest. + + .. _`run_op/task_options[negf]/self_energy_options/parallel/ek_batch_size`: + + ek_batch_size: + | type: ``int``, optional, default: ``200`` + | argument path: ``run_op/task_options[negf]/self_energy_options/parallel/ek_batch_size`` + + Batch size for (k, E) tasks handed to joblib. Larger = fewer batches, more memory. Default 200. + + .. _`run_op/task_options[negf]/espacing`: + + espacing: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[negf]/espacing`` + + Energy grid spacing in `unit`. Required. + + .. _`run_op/task_options[negf]/emin`: + + emin: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[negf]/emin`` + + Lower bound of the energy grid in `unit`. Required. + + .. _`run_op/task_options[negf]/emax`: + + emax: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[negf]/emax`` + + Upper bound of the energy grid in `unit`. Required. + + .. _`run_op/task_options[negf]/rgf_options`: + + rgf_options: + | type: ``dict``, optional, default: ``{}`` + | argument path: ``run_op/task_options[negf]/rgf_options`` + + Recursive Green's function stage options: compute device ('cpu' or 'cuda') and energy-loop chunk size. Independent from the self-energy pool, which always runs on CPU. + + .. _`run_op/task_options[negf]/rgf_options/device`: + + device: + | type: ``str``, optional, default: ``cpu`` + | argument path: ``run_op/task_options[negf]/rgf_options/device`` + + Device used only for the RGF (recursive Green's function) step. 'cpu' (default) or 'cuda'. Hamiltonian initialization always runs on CPU (it is the memory-heavy phase). Self-energy always runs on CPU because it goes through joblib + numba. + + .. _`run_op/task_options[negf]/rgf_options/e_batch_size`: + + e_batch_size: + | type: ``int`` | ``float`` | ``NoneType``, optional, default: ``None`` + | argument path: ``run_op/task_options[negf]/rgf_options/e_batch_size`` + + Number of energy points solved in one batched RGF call. None (default) auto-picks from free CUDA memory on 'cuda'; on 'cpu' the full grid is used. + + .. _`run_op/task_options[negf]/e_fermi`: + + e_fermi: + | type: ``int`` | ``float`` | ``NoneType``, optional, default: ``None`` + | argument path: ``run_op/task_options[negf]/e_fermi`` + + Device Fermi level in `unit`. Optional; if None, computed from the lead Fermi level and applied to the device. + + .. _`run_op/task_options[negf]/density_options`: + + density_options: + | type: ``dict``, optional, default: ``{}`` + | argument path: ``run_op/task_options[negf]/density_options`` + + + Depending on the value of *method*, different sub args are accepted. + + .. _`run_op/task_options[negf]/density_options/method`: + + method: + | type: ``str`` (flag key), default: ``Ozaki`` + | argument path: ``run_op/task_options[negf]/density_options/method`` + | possible choices: |code:run_op/task_options[negf]/density_options[Ozaki]|_, |code:run_op/task_options[negf]/density_options[Fiori]|_ + + Density integration method. 'Ozaki' (default) uses the Ozaki contour with Matsubara-pole expansion; 'Fiori' uses real-axis integration with Gauss quadrature (used with the Fiori/effective-mass approach). + + .. |code:run_op/task_options[negf]/density_options[Ozaki]| replace:: ``Ozaki`` + .. _`code:run_op/task_options[negf]/density_options[Ozaki]`: `run_op/task_options[negf]/density_options[Ozaki]`_ + .. |code:run_op/task_options[negf]/density_options[Fiori]| replace:: ``Fiori`` + .. _`code:run_op/task_options[negf]/density_options[Fiori]`: `run_op/task_options[negf]/density_options[Fiori]`_ + + .. |flag:run_op/task_options[negf]/density_options/method| replace:: *method* + .. _`flag:run_op/task_options[negf]/density_options/method`: `run_op/task_options[negf]/density_options/method`_ + + + .. _`run_op/task_options[negf]/density_options[Ozaki]`: + + When |flag:run_op/task_options[negf]/density_options/method|_ is set to ``Ozaki``: + + Ozaki-contour options. + + .. _`run_op/task_options[negf]/density_options[Ozaki]/R`: + + R: + | type: ``int`` | ``float``, optional, default: ``1000000.0`` + | argument path: ``run_op/task_options[negf]/density_options[Ozaki]/R`` + + Radius of the semicircular contour in `unit`. Default: 1e6. + + .. _`run_op/task_options[negf]/density_options[Ozaki]/M_cut`: + + M_cut: + | type: ``int``, optional, default: ``30`` + | argument path: ``run_op/task_options[negf]/density_options[Ozaki]/M_cut`` + + Number of Ozaki poles kept. Default: 30. + + .. _`run_op/task_options[negf]/density_options[Ozaki]/n_gauss`: + + n_gauss: + | type: ``int``, optional, default: ``10`` + | argument path: ``run_op/task_options[negf]/density_options[Ozaki]/n_gauss`` + + Number of Gauss-Legendre points on the equilibrium contour. Default: 10. + + + .. _`run_op/task_options[negf]/density_options[Fiori]`: + + When |flag:run_op/task_options[negf]/density_options/method|_ is set to ``Fiori``: + + Fiori real-axis integration options. + + .. _`run_op/task_options[negf]/density_options[Fiori]/integrate_way`: + + integrate_way: + | type: ``int`` | ``str``, optional, default: ``direct`` + | argument path: ``run_op/task_options[negf]/density_options[Fiori]/integrate_way`` + + Integration strategy for the Fiori method: 'direct' or 'gauss'. Default: 'direct'. + + .. _`run_op/task_options[negf]/density_options[Fiori]/n_gauss`: + + n_gauss: + | type: ``int``, optional, default: ``100`` + | argument path: ``run_op/task_options[negf]/density_options[Fiori]/n_gauss`` + + Number of Gauss quadrature points along the real-axis integration. Default: 100. + + .. _`run_op/task_options[negf]/eta_lead`: + + eta_lead: + | type: ``int`` | ``float``, optional, default: ``1e-05`` + | argument path: ``run_op/task_options[negf]/eta_lead`` + + Small imaginary broadening added to the lead energy. Default: 1e-5. + + .. _`run_op/task_options[negf]/eta_device`: + + eta_device: + | type: ``int`` | ``float``, optional, default: ``0.0`` + | argument path: ``run_op/task_options[negf]/eta_device`` + + Small imaginary broadening added to the device energy. Default: 0. + + .. _`run_op/task_options[negf]/output_options`: + + output_options: + | type: ``dict``, optional, default: ``{}`` + | argument path: ``run_op/task_options[negf]/output_options`` + + Which physical quantities to write out at the end of the run. + + .. _`run_op/task_options[negf]/output_options/dos`: + + dos: + | type: ``bool``, optional, default: ``False`` + | argument path: ``run_op/task_options[negf]/output_options/dos`` + + Write density of states. + + .. _`run_op/task_options[negf]/output_options/tc`: + + tc: + | type: ``bool``, optional, default: ``False`` + | argument path: ``run_op/task_options[negf]/output_options/tc`` + + Write transmission coefficient. + + .. _`run_op/task_options[negf]/output_options/density`: + + density: + | type: ``bool``, optional, default: ``False`` + | argument path: ``run_op/task_options[negf]/output_options/density`` + + Write electron density. + + .. _`run_op/task_options[negf]/output_options/potential`: + + potential: + | type: ``bool``, optional, default: ``False`` + | argument path: ``run_op/task_options[negf]/output_options/potential`` + + Write electrostatic potential. + + .. _`run_op/task_options[negf]/output_options/current`: + + current: + | type: ``bool``, optional, default: ``False`` + | argument path: ``run_op/task_options[negf]/output_options/current`` + + Write self-consistent current. + + .. _`run_op/task_options[negf]/output_options/current_nscf`: + + current_nscf: + | type: ``bool``, optional, default: ``False`` + | argument path: ``run_op/task_options[negf]/output_options/current_nscf`` + + Write non-self-consistent current. + + .. _`run_op/task_options[negf]/output_options/ldos`: + + ldos: + | type: ``bool``, optional, default: ``False`` + | argument path: ``run_op/task_options[negf]/output_options/ldos`` + + Write local density of states. + + .. _`run_op/task_options[negf]/output_options/lcurrent`: + + lcurrent: + | type: ``bool``, optional, default: ``False`` + | argument path: ``run_op/task_options[negf]/output_options/lcurrent`` + + Write local current. + + + .. _`run_op/task_options[tbtrans_negf]`: + + When |flag:run_op/task_options/task|_ is set to ``tbtrans_negf``: + + .. _`run_op/task_options[tbtrans_negf]/scf`: + + scf: + | type: ``bool``, optional, default: ``False`` + | argument path: ``run_op/task_options[tbtrans_negf]/scf`` + + Whether to run a self-consistent (Poisson-NEGF) loop. Default: False (non-self-consistent transport). + + .. _`run_op/task_options[tbtrans_negf]/block_tridiagonal`: + + block_tridiagonal: + | type: ``bool``, optional, default: ``False`` + | argument path: ``run_op/task_options[tbtrans_negf]/block_tridiagonal`` + + Whether to block-tridiagonalize the device Hamiltonian for faster recursive Green's function inversion. Default: False. + + .. _`run_op/task_options[tbtrans_negf]/ele_T`: + + ele_T: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[tbtrans_negf]/ele_T`` + + Electronic temperature in Kelvin. Required. + + .. _`run_op/task_options[tbtrans_negf]/unit`: + + unit: + | type: ``str``, optional, default: ``Hartree`` + | argument path: ``run_op/task_options[tbtrans_negf]/unit`` + + Energy unit used for the energy grid and outputs. Choose 'Hartree' (default) or 'eV'. + + .. _`run_op/task_options[tbtrans_negf]/scf_options`: + + scf_options: + | type: ``dict``, optional, default: ``{}`` + | argument path: ``run_op/task_options[tbtrans_negf]/scf_options`` + + SCF mixing options (only used when `scf` is true). + + + Depending on the value of *mode*, different sub args are accepted. + + .. _`run_op/task_options[tbtrans_negf]/scf_options/mode`: + + mode: + | type: ``str`` (flag key), default: ``PDIIS`` + | argument path: ``run_op/task_options[tbtrans_negf]/scf_options/mode`` + | possible choices: |code:run_op/task_options[tbtrans_negf]/scf_options[PDIIS]|_ + + SCF mixing algorithm. Currently only 'PDIIS' is supported. + + .. |code:run_op/task_options[tbtrans_negf]/scf_options[PDIIS]| replace:: ``PDIIS`` + .. _`code:run_op/task_options[tbtrans_negf]/scf_options[PDIIS]`: `run_op/task_options[tbtrans_negf]/scf_options[PDIIS]`_ + + .. |flag:run_op/task_options[tbtrans_negf]/scf_options/mode| replace:: *mode* + .. _`flag:run_op/task_options[tbtrans_negf]/scf_options/mode`: `run_op/task_options[tbtrans_negf]/scf_options/mode`_ + + + .. _`run_op/task_options[tbtrans_negf]/scf_options[PDIIS]`: + + When |flag:run_op/task_options[tbtrans_negf]/scf_options/mode|_ is set to ``PDIIS``: + + PDIIS (Periodic-DIIS) mixing parameters. + + .. _`run_op/task_options[tbtrans_negf]/scf_options[PDIIS]/mixing_period`: + + mixing_period: + | type: ``int``, optional, default: ``3`` + | argument path: ``run_op/task_options[tbtrans_negf]/scf_options[PDIIS]/mixing_period`` + + How many iterations between DIIS extrapolations. Default: 3. + + .. _`run_op/task_options[tbtrans_negf]/scf_options[PDIIS]/step_size`: + + step_size: + | type: ``int`` | ``float``, optional, default: ``0.05`` + | argument path: ``run_op/task_options[tbtrans_negf]/scf_options[PDIIS]/step_size`` + + Linear mixing step size between DIIS steps. Default: 0.05. + + .. _`run_op/task_options[tbtrans_negf]/scf_options[PDIIS]/n_history`: + + n_history: + | type: ``int``, optional, default: ``6`` + | argument path: ``run_op/task_options[tbtrans_negf]/scf_options[PDIIS]/n_history`` + + Number of previous residuals kept for the DIIS subspace. Default: 6. + + .. _`run_op/task_options[tbtrans_negf]/scf_options[PDIIS]/abs_err`: + + abs_err: + | type: ``int`` | ``float``, optional, default: ``1e-06`` + | argument path: ``run_op/task_options[tbtrans_negf]/scf_options[PDIIS]/abs_err`` + + Absolute convergence tolerance on the SCF residual. Default: 1e-6. + + .. _`run_op/task_options[tbtrans_negf]/scf_options[PDIIS]/rel_err`: + + rel_err: + | type: ``int`` | ``float``, optional, default: ``0.0001`` + | argument path: ``run_op/task_options[tbtrans_negf]/scf_options[PDIIS]/rel_err`` + + Relative convergence tolerance on the SCF residual. Default: 1e-4. + + .. _`run_op/task_options[tbtrans_negf]/scf_options[PDIIS]/max_iter`: + + max_iter: + | type: ``int``, optional, default: ``100`` + | argument path: ``run_op/task_options[tbtrans_negf]/scf_options[PDIIS]/max_iter`` + + Maximum SCF iterations. Default: 100. + + .. _`run_op/task_options[tbtrans_negf]/stru_options`: + + stru_options: + | type: ``dict`` + | argument path: ``run_op/task_options[tbtrans_negf]/stru_options`` + + Structure partition and k-mesh options: device region, left/right leads, PBC, k-mesh. + + .. _`run_op/task_options[tbtrans_negf]/stru_options/device`: + + device: + | type: ``dict`` + | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/device`` + + Device region: atom index range and sorting. + + .. _`run_op/task_options[tbtrans_negf]/stru_options/device/id`: + + id: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/device/id`` + + Atom index range of the device region, e.g. '32-64' (0-indexed, half-open). + + .. _`run_op/task_options[tbtrans_negf]/stru_options/device/sort`: + + sort: + | type: ``bool``, optional, default: ``True`` + | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/device/sort`` + + Whether to sort atoms in the device region along the transport axis. Default: True. + + .. _`run_op/task_options[tbtrans_negf]/stru_options/lead_L`: + + lead_L: + | type: ``dict`` + | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/lead_L`` + + Left lead: atom index range, voltage, k-mesh for lead Fermi-level, Bloch expansion. + + .. _`run_op/task_options[tbtrans_negf]/stru_options/lead_L/id`: + + id: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/lead_L/id`` + + Atom index range of the lead region, e.g. '0-32' (0-indexed, half-open). + + .. _`run_op/task_options[tbtrans_negf]/stru_options/lead_L/voltage`: + + voltage: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/lead_L/voltage`` + + Applied bias voltage on this lead, in `unit`. Required. + + .. _`run_op/task_options[tbtrans_negf]/stru_options/lead_L/useBloch`: + + useBloch: + | type: ``bool``, optional, default: ``False`` + | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/lead_L/useBloch`` + + Whether to use Bloch expansion to reduce lead unit cell size. Default: False. + + .. _`run_op/task_options[tbtrans_negf]/stru_options/lead_L/bloch_factor`: + + bloch_factor: + | type: ``list``, optional, default: ``[1, 1, 1]`` + | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/lead_L/bloch_factor`` + + Bloch factor [nx, ny, nz] for the lead unit cell. Default: [1, 1, 1]. + + .. _`run_op/task_options[tbtrans_negf]/stru_options/lead_L/kmesh_lead_Ef`: + + kmesh_lead_Ef: + | type: ``list``, optional + | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/lead_L/kmesh_lead_Ef`` + + K-mesh used to compute the lead Fermi level, [nkx, nky, nkz]. + + .. _`run_op/task_options[tbtrans_negf]/stru_options/lead_L/charge`: + + charge: + | type: ``int`` | ``float``, optional, default: ``0.0`` + | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/lead_L/charge`` + + Doping charge on the lead, used when computing the lead Fermi level. Default: 0.0. + + .. _`run_op/task_options[tbtrans_negf]/stru_options/lead_R`: + + lead_R: + | type: ``dict`` + | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/lead_R`` + + Right lead: atom index range, voltage, k-mesh for lead Fermi-level, Bloch expansion. + + .. _`run_op/task_options[tbtrans_negf]/stru_options/lead_R/id`: + + id: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/lead_R/id`` + + Atom index range of the lead region, e.g. '0-32' (0-indexed, half-open). + + .. _`run_op/task_options[tbtrans_negf]/stru_options/lead_R/voltage`: + + voltage: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/lead_R/voltage`` + + Applied bias voltage on this lead, in `unit`. Required. + + .. _`run_op/task_options[tbtrans_negf]/stru_options/lead_R/useBloch`: + + useBloch: + | type: ``bool``, optional, default: ``False`` + | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/lead_R/useBloch`` + + Whether to use Bloch expansion to reduce lead unit cell size. Default: False. + + .. _`run_op/task_options[tbtrans_negf]/stru_options/lead_R/bloch_factor`: + + bloch_factor: + | type: ``list``, optional, default: ``[1, 1, 1]`` + | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/lead_R/bloch_factor`` + + Bloch factor [nx, ny, nz] for the lead unit cell. Default: [1, 1, 1]. + + .. _`run_op/task_options[tbtrans_negf]/stru_options/lead_R/kmesh_lead_Ef`: + + kmesh_lead_Ef: + | type: ``list``, optional + | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/lead_R/kmesh_lead_Ef`` + + K-mesh used to compute the lead Fermi level, [nkx, nky, nkz]. + + .. _`run_op/task_options[tbtrans_negf]/stru_options/lead_R/charge`: + + charge: + | type: ``int`` | ``float``, optional, default: ``0.0`` + | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/lead_R/charge`` + + Doping charge on the lead, used when computing the lead Fermi level. Default: 0.0. + + .. _`run_op/task_options[tbtrans_negf]/stru_options/kmesh`: + + kmesh: + | type: ``list``, optional, default: ``[1, 1, 1]`` + | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/kmesh`` + + K-mesh used for the device transverse Brillouin-zone sampling, [nkx, nky, nkz]. Default: [1, 1, 1]. + + .. _`run_op/task_options[tbtrans_negf]/stru_options/pbc`: + + pbc: + | type: ``list``, optional, default: ``[False, False, False]`` + | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/pbc`` + + Periodic boundary condition applied to the device, list of three booleans for x/y/z. Default: [False, False, False]. + + .. _`run_op/task_options[tbtrans_negf]/stru_options/gamma_center`: + + gamma_center: + | type: ``bool`` | ``list``, optional, default: ``True`` + | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/gamma_center`` + + Whether the k-mesh is Gamma-centered. Default: True. + + .. _`run_op/task_options[tbtrans_negf]/stru_options/time_reversal_symmetry`: + + time_reversal_symmetry: + | type: ``bool`` | ``list``, optional, default: ``True`` + | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/time_reversal_symmetry`` + + Whether to enforce time-reversal symmetry when folding the k-mesh. Default: True. + + .. _`run_op/task_options[tbtrans_negf]/stru_options/e_fermi_smearing`: + + e_fermi_smearing: + | type: ``str``, optional, default: ``FD`` + | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/e_fermi_smearing`` + + Smearing method for lead Fermi-level determination. Default: 'FD' (Fermi-Dirac). + + .. _`run_op/task_options[tbtrans_negf]/stru_options/eig_solver`: + + eig_solver: + | type: ``str``, optional, default: ``torch`` + | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/eig_solver`` + + Eigenvalue solver used for lead Fermi-level calculation. Default: 'torch'. + + .. _`run_op/task_options[tbtrans_negf]/stru_options/nel_atom`: + + nel_atom: + | type: ``NoneType`` | ``dict``, optional, default: ``None`` + | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/nel_atom`` + + Number of valence electrons per element, e.g. {'C': 4}. Required for SCF or when computing lead Fermi-level. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options`: + + poisson_options: + | type: ``dict``, optional, default: ``{}`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options`` + + Poisson solver options (only used when `scf` is true). + + + Depending on the value of *solver*, different sub args are accepted. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options/solver`: + + solver: + | type: ``str`` (flag key), default: ``fmm`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options/solver`` + | possible choices: |code:run_op/task_options[tbtrans_negf]/poisson_options[fmm]|_, |code:run_op/task_options[tbtrans_negf]/poisson_options[pyamg]|_, |code:run_op/task_options[tbtrans_negf]/poisson_options[scipy]|_ + + Poisson solver backend. 'fmm' (default) uses the free-space Fast Multipole Method; 'pyamg' uses an algebraic-multigrid finite-difference solver on a grid; 'scipy' uses SciPy's sparse linear algebra on a grid. + + .. |code:run_op/task_options[tbtrans_negf]/poisson_options[fmm]| replace:: ``fmm`` + .. _`code:run_op/task_options[tbtrans_negf]/poisson_options[fmm]`: `run_op/task_options[tbtrans_negf]/poisson_options[fmm]`_ + .. |code:run_op/task_options[tbtrans_negf]/poisson_options[pyamg]| replace:: ``pyamg`` + .. _`code:run_op/task_options[tbtrans_negf]/poisson_options[pyamg]`: `run_op/task_options[tbtrans_negf]/poisson_options[pyamg]`_ + .. |code:run_op/task_options[tbtrans_negf]/poisson_options[scipy]| replace:: ``scipy`` + .. _`code:run_op/task_options[tbtrans_negf]/poisson_options[scipy]`: `run_op/task_options[tbtrans_negf]/poisson_options[scipy]`_ + + .. |flag:run_op/task_options[tbtrans_negf]/poisson_options/solver| replace:: *solver* + .. _`flag:run_op/task_options[tbtrans_negf]/poisson_options/solver`: `run_op/task_options[tbtrans_negf]/poisson_options/solver`_ + + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[fmm]`: + + When |flag:run_op/task_options[tbtrans_negf]/poisson_options/solver|_ is set to ``fmm``: + + FMM solver options. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[fmm]/err`: + + err: + | type: ``int`` | ``float``, optional, default: ``1e-05`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[fmm]/err`` + + Requested FMM accuracy on the Coulomb sum. Default: 1e-5. + + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]`: + + When |flag:run_op/task_options[tbtrans_negf]/poisson_options/solver|_ is set to ``pyamg``: + + pyamg (algebraic multigrid) solver options: grid, gates, dielectric and doped regions. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/err`: + + err: + | type: ``int`` | ``float``, optional, default: ``1e-05`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/err`` + + Error target passed to the AMG solver. Default: 1e-5. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/tolerance`: + + tolerance: + | type: ``int`` | ``float``, optional, default: ``1e-07`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/tolerance`` + + Convergence tolerance of the AMG linear solve. Default: 1e-7. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/max_iter`: + + max_iter: + | type: ``int``, optional, default: ``100`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/max_iter`` + + Maximum AMG iterations. Default: 100. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/mix_rate`: + + mix_rate: + | type: ``int`` | ``float``, optional, default: ``0.25`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/mix_rate`` + + Underrelaxation between successive Poisson solves. Default: 0.25. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/poisson_dtype`: + + poisson_dtype: + | type: ``str``, optional, default: ``float64`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/poisson_dtype`` + + Floating precision of the Poisson solver ('float32' or 'float64'). Default: 'float64'. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/grid`: + + grid: + | type: ``dict`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/grid`` + + Real-space grid used to discretize the Poisson equation. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/grid/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/grid/x_range`` + + Grid range along x as 'start:stop:n' (Angstrom, n points). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/grid/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/grid/y_range`` + + Grid range along y as 'start:stop:n' (Angstrom, n points). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/grid/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/grid/z_range`` + + Grid range along z as 'start:stop:n' (Angstrom, n points). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_top`: + + gate_top: + | type: ``dict``, optional + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_top`` + + Dirichlet boundary condition for a metallic gate (x/y/z range and applied voltage). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_top/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_top/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_top/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_top/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_top/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_top/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_top/voltage`: + + voltage: + | type: ``int`` | ``float`` | ``NoneType``, optional, default: ``None`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_top/voltage`` + + Applied voltage on this Dirichlet boundary in `unit`. Default: None. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_bottom`: + + gate_bottom: + | type: ``dict``, optional + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_bottom`` + + Dirichlet boundary condition for a metallic gate (x/y/z range and applied voltage). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_bottom/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_bottom/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_bottom/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_bottom/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_bottom/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_bottom/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_bottom/voltage`: + + voltage: + | type: ``int`` | ``float`` | ``NoneType``, optional, default: ``None`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_bottom/voltage`` + + Applied voltage on this Dirichlet boundary in `unit`. Default: None. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_left`: + + gate_left: + | type: ``dict``, optional + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_left`` + + Dirichlet boundary condition for a metallic gate (x/y/z range and applied voltage). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_left/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_left/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_left/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_left/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_left/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_left/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_left/voltage`: + + voltage: + | type: ``int`` | ``float`` | ``NoneType``, optional, default: ``None`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_left/voltage`` + + Applied voltage on this Dirichlet boundary in `unit`. Default: None. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_right`: + + gate_right: + | type: ``dict``, optional + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_right`` + + Dirichlet boundary condition for a metallic gate (x/y/z range and applied voltage). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_right/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_right/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_right/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_right/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_right/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_right/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_right/voltage`: + + voltage: + | type: ``int`` | ``float`` | ``NoneType``, optional, default: ``None`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/gate_right/voltage`` + + Applied voltage on this Dirichlet boundary in `unit`. Default: None. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region`: + + dielectric_region: + | type: ``dict`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region`` + + Rectangular region with a fixed relative permittivity. Additional regions can be added via `dielectric_region2` ... `dielectric_region6`. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region/relative permittivity`: + + relative permittivity: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region/relative permittivity`` + + Relative permittivity of the region. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region2`: + + dielectric_region2: + | type: ``dict``, optional + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region2`` + + Rectangular region with a fixed relative permittivity. Additional regions can be added via `dielectric_region2` ... `dielectric_region6`. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region2/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region2/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region2/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region2/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region2/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region2/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region2/relative permittivity`: + + relative permittivity: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region2/relative permittivity`` + + Relative permittivity of the region. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region3`: + + dielectric_region3: + | type: ``dict``, optional + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region3`` + + Rectangular region with a fixed relative permittivity. Additional regions can be added via `dielectric_region2` ... `dielectric_region6`. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region3/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region3/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region3/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region3/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region3/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region3/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region3/relative permittivity`: + + relative permittivity: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region3/relative permittivity`` + + Relative permittivity of the region. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region4`: + + dielectric_region4: + | type: ``dict``, optional + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region4`` + + Rectangular region with a fixed relative permittivity. Additional regions can be added via `dielectric_region2` ... `dielectric_region6`. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region4/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region4/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region4/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region4/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region4/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region4/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region4/relative permittivity`: + + relative permittivity: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region4/relative permittivity`` + + Relative permittivity of the region. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region5`: + + dielectric_region5: + | type: ``dict``, optional + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region5`` + + Rectangular region with a fixed relative permittivity. Additional regions can be added via `dielectric_region2` ... `dielectric_region6`. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region5/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region5/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region5/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region5/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region5/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region5/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region5/relative permittivity`: + + relative permittivity: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region5/relative permittivity`` + + Relative permittivity of the region. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region6`: + + dielectric_region6: + | type: ``dict``, optional + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region6`` + + Rectangular region with a fixed relative permittivity. Additional regions can be added via `dielectric_region2` ... `dielectric_region6`. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region6/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region6/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region6/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region6/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region6/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region6/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region6/relative permittivity`: + + relative permittivity: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/dielectric_region6/relative permittivity`` + + Relative permittivity of the region. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/doped_region`: + + doped_region: + | type: ``dict`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/doped_region`` + + Rectangular region with a fixed doping charge density. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/doped_region/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/doped_region/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/doped_region/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/doped_region/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/doped_region/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/doped_region/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/doped_region/charge`: + + charge: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[pyamg]/doped_region/charge`` + + Fixed doping charge (electrons per unit cell of the region). + + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]`: + + When |flag:run_op/task_options[tbtrans_negf]/poisson_options/solver|_ is set to ``scipy``: + + SciPy sparse solver options: grid, gates, dielectric and doped regions. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/err`: + + err: + | type: ``int`` | ``float``, optional, default: ``1e-05`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/err`` + + Residual threshold on the potential update. Default: 1e-5. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/tolerance`: + + tolerance: + | type: ``int`` | ``float``, optional, default: ``1e-07`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/tolerance`` + + Convergence tolerance of the sparse linear solve. Default: 1e-7. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/max_iter`: + + max_iter: + | type: ``int``, optional, default: ``100`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/max_iter`` + + Maximum Poisson iterations. Default: 100. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/mix_rate`: + + mix_rate: + | type: ``int`` | ``float``, optional, default: ``0.25`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/mix_rate`` + + Underrelaxation between successive Poisson solves. Default: 0.25. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/poisson_dtype`: + + poisson_dtype: + | type: ``str``, optional, default: ``float64`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/poisson_dtype`` + + Floating precision of the Poisson solver ('float32' or 'float64'). Default: 'float64'. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/with_Dirichlet_leads`: + + with_Dirichlet_leads: + | type: ``bool``, optional, default: ``False`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/with_Dirichlet_leads`` + + Whether to use Dirichlet boundary condition for leads + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/grid`: + + grid: + | type: ``dict``, optional + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/grid`` + + Real-space grid used to discretize the Poisson equation. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/grid/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/grid/x_range`` + + Grid range along x as 'start:stop:n' (Angstrom, n points). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/grid/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/grid/y_range`` + + Grid range along y as 'start:stop:n' (Angstrom, n points). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/grid/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/grid/z_range`` + + Grid range along z as 'start:stop:n' (Angstrom, n points). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_top`: + + gate_top: + | type: ``dict``, optional + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_top`` + + Dirichlet boundary condition for a metallic gate (x/y/z range and applied voltage). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_top/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_top/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_top/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_top/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_top/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_top/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_top/voltage`: voltage: - | type: ``float`` | ``int`` - | argument path: ``run_op/task_options[negf]/stru_options/lead_R/voltage`` + | type: ``int`` | ``float`` | ``NoneType``, optional, default: ``None`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_top/voltage`` - .. _`run_op/task_options[negf]/stru_options/kmesh`: + Applied voltage on this Dirichlet boundary in `unit`. Default: None. - kmesh: - | type: ``list``, optional, default: ``[1, 1, 1]`` - | argument path: ``run_op/task_options[negf]/stru_options/kmesh`` + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_bottom`: - .. _`run_op/task_options[negf]/stru_options/pbc`: + gate_bottom: + | type: ``dict``, optional + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_bottom`` - pbc: - | type: ``list``, optional, default: ``[False, False, False]`` - | argument path: ``run_op/task_options[negf]/stru_options/pbc`` + Dirichlet boundary condition for a metallic gate (x/y/z range and applied voltage). - .. _`run_op/task_options[negf]/stru_options/gamma_center`: + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_bottom/x_range`: - gamma_center: - | type: ``list`` | ``bool``, optional, default: ``True`` - | argument path: ``run_op/task_options[negf]/stru_options/gamma_center`` + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_bottom/x_range`` - .. _`run_op/task_options[negf]/stru_options/time_reversal_symmetry`: + Range along x as 'x0:x1' (Angstrom). - time_reversal_symmetry: - | type: ``list`` | ``bool``, optional, default: ``True`` - | argument path: ``run_op/task_options[negf]/stru_options/time_reversal_symmetry`` + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_bottom/y_range`: - .. _`run_op/task_options[negf]/poisson_options`: + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_bottom/y_range`` - poisson_options: - | type: ``dict``, optional, default: ``{}`` - | argument path: ``run_op/task_options[negf]/poisson_options`` + Range along y as 'y0:y1' (Angstrom). + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_bottom/z_range`: - Depending on the value of *solver*, different sub args are accepted. + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_bottom/z_range`` - .. _`run_op/task_options[negf]/poisson_options/solver`: + Range along z as 'z0:z1' (Angstrom). - solver: - | type: ``str`` (flag key), default: ``fmm`` - | argument path: ``run_op/task_options[negf]/poisson_options/solver`` - | possible choices: |code:run_op/task_options[negf]/poisson_options[fmm]|_ + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_bottom/voltage`: - .. |code:run_op/task_options[negf]/poisson_options[fmm]| replace:: ``fmm`` - .. _`code:run_op/task_options[negf]/poisson_options[fmm]`: `run_op/task_options[negf]/poisson_options[fmm]`_ + voltage: + | type: ``int`` | ``float`` | ``NoneType``, optional, default: ``None`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_bottom/voltage`` - .. |flag:run_op/task_options[negf]/poisson_options/solver| replace:: *solver* - .. _`flag:run_op/task_options[negf]/poisson_options/solver`: `run_op/task_options[negf]/poisson_options/solver`_ + Applied voltage on this Dirichlet boundary in `unit`. Default: None. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_left`: + + gate_left: + | type: ``dict``, optional + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_left`` + + Dirichlet boundary condition for a metallic gate (x/y/z range and applied voltage). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_left/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_left/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_left/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_left/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_left/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_left/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_left/voltage`: + + voltage: + | type: ``int`` | ``float`` | ``NoneType``, optional, default: ``None`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_left/voltage`` + + Applied voltage on this Dirichlet boundary in `unit`. Default: None. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_right`: + + gate_right: + | type: ``dict``, optional + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_right`` + + Dirichlet boundary condition for a metallic gate (x/y/z range and applied voltage). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_right/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_right/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_right/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_right/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_right/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_right/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_right/voltage`: + + voltage: + | type: ``int`` | ``float`` | ``NoneType``, optional, default: ``None`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/gate_right/voltage`` + + Applied voltage on this Dirichlet boundary in `unit`. Default: None. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/lead_L`: + + lead_L: + | type: ``dict``, optional + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/lead_L`` + + Dirichlet boundary condition for a metallic gate (x/y/z range and applied voltage). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/lead_L/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/lead_L/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/lead_L/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/lead_L/y_range`` + + Range along y as 'y0:y1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/lead_L/z_range`: + + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/lead_L/z_range`` + + Range along z as 'z0:z1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/lead_L/voltage`: + + voltage: + | type: ``int`` | ``float`` | ``NoneType``, optional, default: ``None`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/lead_L/voltage`` + + Applied voltage on this Dirichlet boundary in `unit`. Default: None. + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/lead_R`: + + lead_R: + | type: ``dict``, optional + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/lead_R`` + + Dirichlet boundary condition for a metallic gate (x/y/z range and applied voltage). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/lead_R/x_range`: + + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/lead_R/x_range`` + + Range along x as 'x0:x1' (Angstrom). + + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/lead_R/y_range`: + + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/lead_R/y_range`` + + Range along y as 'y0:y1' (Angstrom). + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/lead_R/z_range`: - .. _`run_op/task_options[negf]/poisson_options[fmm]`: + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/lead_R/z_range`` - When |flag:run_op/task_options[negf]/poisson_options/solver|_ is set to ``fmm``: + Range along z as 'z0:z1' (Angstrom). - .. _`run_op/task_options[negf]/poisson_options[fmm]/err`: + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/lead_R/voltage`: - err: - | type: ``float`` | ``int``, optional, default: ``1e-05`` - | argument path: ``run_op/task_options[negf]/poisson_options[fmm]/err`` + voltage: + | type: ``int`` | ``float`` | ``NoneType``, optional, default: ``None`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/lead_R/voltage`` - .. _`run_op/task_options[negf]/sgf_solver`: + Applied voltage on this Dirichlet boundary in `unit`. Default: None. - sgf_solver: - | type: ``str``, optional, default: ``Sancho-Rubio`` - | argument path: ``run_op/task_options[negf]/sgf_solver`` + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region`: - .. _`run_op/task_options[negf]/espacing`: + dielectric_region: + | type: ``dict``, optional + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region`` - espacing: - | type: ``float`` | ``int`` - | argument path: ``run_op/task_options[negf]/espacing`` + Rectangular region with a fixed relative permittivity. Additional regions can be added via `dielectric_region2` ... `dielectric_region6`. - .. _`run_op/task_options[negf]/emin`: + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region/x_range`: - emin: - | type: ``float`` | ``int`` - | argument path: ``run_op/task_options[negf]/emin`` + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region/x_range`` - .. _`run_op/task_options[negf]/emax`: + Range along x as 'x0:x1' (Angstrom). - emax: - | type: ``float`` | ``int`` - | argument path: ``run_op/task_options[negf]/emax`` + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region/y_range`: - .. _`run_op/task_options[negf]/e_fermi`: + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region/y_range`` - e_fermi: - | type: ``float`` | ``int`` - | argument path: ``run_op/task_options[negf]/e_fermi`` + Range along y as 'y0:y1' (Angstrom). - .. _`run_op/task_options[negf]/density_options`: + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region/z_range`: - density_options: - | type: ``dict``, optional, default: ``{}`` - | argument path: ``run_op/task_options[negf]/density_options`` + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region/z_range`` + Range along z as 'z0:z1' (Angstrom). - Depending on the value of *method*, different sub args are accepted. + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region/relative permittivity`: - .. _`run_op/task_options[negf]/density_options/method`: + relative permittivity: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region/relative permittivity`` - method: - | type: ``str`` (flag key), default: ``Ozaki`` - | argument path: ``run_op/task_options[negf]/density_options/method`` - | possible choices: |code:run_op/task_options[negf]/density_options[Ozaki]|_ + Relative permittivity of the region. - .. |code:run_op/task_options[negf]/density_options[Ozaki]| replace:: ``Ozaki`` - .. _`code:run_op/task_options[negf]/density_options[Ozaki]`: `run_op/task_options[negf]/density_options[Ozaki]`_ + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region2`: - .. |flag:run_op/task_options[negf]/density_options/method| replace:: *method* - .. _`flag:run_op/task_options[negf]/density_options/method`: `run_op/task_options[negf]/density_options/method`_ + dielectric_region2: + | type: ``dict``, optional + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region2`` + Rectangular region with a fixed relative permittivity. Additional regions can be added via `dielectric_region2` ... `dielectric_region6`. - .. _`run_op/task_options[negf]/density_options[Ozaki]`: + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region2/x_range`: - When |flag:run_op/task_options[negf]/density_options/method|_ is set to ``Ozaki``: + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region2/x_range`` - .. _`run_op/task_options[negf]/density_options[Ozaki]/R`: + Range along x as 'x0:x1' (Angstrom). - R: - | type: ``float`` | ``int``, optional, default: ``1000000.0`` - | argument path: ``run_op/task_options[negf]/density_options[Ozaki]/R`` + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region2/y_range`: - .. _`run_op/task_options[negf]/density_options[Ozaki]/M_cut`: + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region2/y_range`` - M_cut: - | type: ``int``, optional, default: ``30`` - | argument path: ``run_op/task_options[negf]/density_options[Ozaki]/M_cut`` + Range along y as 'y0:y1' (Angstrom). - .. _`run_op/task_options[negf]/density_options[Ozaki]/n_gauss`: + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region2/z_range`: - n_gauss: - | type: ``int``, optional, default: ``10`` - | argument path: ``run_op/task_options[negf]/density_options[Ozaki]/n_gauss`` + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region2/z_range`` - .. _`run_op/task_options[negf]/eta_lead`: + Range along z as 'z0:z1' (Angstrom). - eta_lead: - | type: ``float`` | ``int``, optional, default: ``1e-05`` - | argument path: ``run_op/task_options[negf]/eta_lead`` + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region2/relative permittivity`: - .. _`run_op/task_options[negf]/eta_device`: + relative permittivity: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region2/relative permittivity`` - eta_device: - | type: ``float`` | ``int``, optional, default: ``0.0`` - | argument path: ``run_op/task_options[negf]/eta_device`` + Relative permittivity of the region. - .. _`run_op/task_options[negf]/out_dos`: + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region3`: - out_dos: - | type: ``bool``, optional, default: ``False`` - | argument path: ``run_op/task_options[negf]/out_dos`` + dielectric_region3: + | type: ``dict``, optional + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region3`` - .. _`run_op/task_options[negf]/out_tc`: + Rectangular region with a fixed relative permittivity. Additional regions can be added via `dielectric_region2` ... `dielectric_region6`. - out_tc: - | type: ``bool``, optional, default: ``False`` - | argument path: ``run_op/task_options[negf]/out_tc`` + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region3/x_range`: - .. _`run_op/task_options[negf]/out_density`: + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region3/x_range`` - out_density: - | type: ``bool``, optional, default: ``False`` - | argument path: ``run_op/task_options[negf]/out_density`` + Range along x as 'x0:x1' (Angstrom). - .. _`run_op/task_options[negf]/out_potential`: + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region3/y_range`: - out_potential: - | type: ``bool``, optional, default: ``False`` - | argument path: ``run_op/task_options[negf]/out_potential`` + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region3/y_range`` - .. _`run_op/task_options[negf]/out_current`: + Range along y as 'y0:y1' (Angstrom). - out_current: - | type: ``bool``, optional, default: ``False`` - | argument path: ``run_op/task_options[negf]/out_current`` + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region3/z_range`: - .. _`run_op/task_options[negf]/out_current_nscf`: + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region3/z_range`` - out_current_nscf: - | type: ``bool``, optional, default: ``False`` - | argument path: ``run_op/task_options[negf]/out_current_nscf`` + Range along z as 'z0:z1' (Angstrom). - .. _`run_op/task_options[negf]/out_ldos`: + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region3/relative permittivity`: - out_ldos: - | type: ``bool``, optional, default: ``False`` - | argument path: ``run_op/task_options[negf]/out_ldos`` + relative permittivity: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region3/relative permittivity`` - .. _`run_op/task_options[negf]/out_lcurrent`: + Relative permittivity of the region. - out_lcurrent: - | type: ``bool``, optional, default: ``False`` - | argument path: ``run_op/task_options[negf]/out_lcurrent`` + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region4`: + dielectric_region4: + | type: ``dict``, optional + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region4`` - .. _`run_op/task_options[tbtrans_negf]`: + Rectangular region with a fixed relative permittivity. Additional regions can be added via `dielectric_region2` ... `dielectric_region6`. - When |flag:run_op/task_options/task|_ is set to ``tbtrans_negf``: + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region4/x_range`: - .. _`run_op/task_options[tbtrans_negf]/scf`: + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region4/x_range`` - scf: - | type: ``bool``, optional, default: ``False`` - | argument path: ``run_op/task_options[tbtrans_negf]/scf`` + Range along x as 'x0:x1' (Angstrom). - .. _`run_op/task_options[tbtrans_negf]/block_tridiagonal`: + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region4/y_range`: - block_tridiagonal: - | type: ``bool``, optional, default: ``False`` - | argument path: ``run_op/task_options[tbtrans_negf]/block_tridiagonal`` + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region4/y_range`` - .. _`run_op/task_options[tbtrans_negf]/ele_T`: + Range along y as 'y0:y1' (Angstrom). - ele_T: - | type: ``float`` | ``int`` - | argument path: ``run_op/task_options[tbtrans_negf]/ele_T`` + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region4/z_range`: - .. _`run_op/task_options[tbtrans_negf]/unit`: + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region4/z_range`` - unit: - | type: ``str``, optional, default: ``Hartree`` - | argument path: ``run_op/task_options[tbtrans_negf]/unit`` + Range along z as 'z0:z1' (Angstrom). - .. _`run_op/task_options[tbtrans_negf]/scf_options`: + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region4/relative permittivity`: - scf_options: - | type: ``dict``, optional, default: ``{}`` - | argument path: ``run_op/task_options[tbtrans_negf]/scf_options`` + relative permittivity: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region4/relative permittivity`` + Relative permittivity of the region. - Depending on the value of *mode*, different sub args are accepted. + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region5`: - .. _`run_op/task_options[tbtrans_negf]/scf_options/mode`: + dielectric_region5: + | type: ``dict``, optional + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region5`` - mode: - | type: ``str`` (flag key), default: ``PDIIS`` - | argument path: ``run_op/task_options[tbtrans_negf]/scf_options/mode`` - | possible choices: |code:run_op/task_options[tbtrans_negf]/scf_options[PDIIS]|_ + Rectangular region with a fixed relative permittivity. Additional regions can be added via `dielectric_region2` ... `dielectric_region6`. - .. |code:run_op/task_options[tbtrans_negf]/scf_options[PDIIS]| replace:: ``PDIIS`` - .. _`code:run_op/task_options[tbtrans_negf]/scf_options[PDIIS]`: `run_op/task_options[tbtrans_negf]/scf_options[PDIIS]`_ + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region5/x_range`: - .. |flag:run_op/task_options[tbtrans_negf]/scf_options/mode| replace:: *mode* - .. _`flag:run_op/task_options[tbtrans_negf]/scf_options/mode`: `run_op/task_options[tbtrans_negf]/scf_options/mode`_ + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region5/x_range`` + Range along x as 'x0:x1' (Angstrom). - .. _`run_op/task_options[tbtrans_negf]/scf_options[PDIIS]`: + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region5/y_range`: - When |flag:run_op/task_options[tbtrans_negf]/scf_options/mode|_ is set to ``PDIIS``: + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region5/y_range`` - .. _`run_op/task_options[tbtrans_negf]/scf_options[PDIIS]/mixing_period`: + Range along y as 'y0:y1' (Angstrom). - mixing_period: - | type: ``int``, optional, default: ``3`` - | argument path: ``run_op/task_options[tbtrans_negf]/scf_options[PDIIS]/mixing_period`` + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region5/z_range`: - .. _`run_op/task_options[tbtrans_negf]/scf_options[PDIIS]/step_size`: + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region5/z_range`` - step_size: - | type: ``float`` | ``int``, optional, default: ``0.05`` - | argument path: ``run_op/task_options[tbtrans_negf]/scf_options[PDIIS]/step_size`` + Range along z as 'z0:z1' (Angstrom). - .. _`run_op/task_options[tbtrans_negf]/scf_options[PDIIS]/n_history`: + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region5/relative permittivity`: - n_history: - | type: ``int``, optional, default: ``6`` - | argument path: ``run_op/task_options[tbtrans_negf]/scf_options[PDIIS]/n_history`` + relative permittivity: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region5/relative permittivity`` - .. _`run_op/task_options[tbtrans_negf]/scf_options[PDIIS]/abs_err`: + Relative permittivity of the region. - abs_err: - | type: ``float`` | ``int``, optional, default: ``1e-06`` - | argument path: ``run_op/task_options[tbtrans_negf]/scf_options[PDIIS]/abs_err`` + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region6`: - .. _`run_op/task_options[tbtrans_negf]/scf_options[PDIIS]/rel_err`: + dielectric_region6: + | type: ``dict``, optional + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region6`` - rel_err: - | type: ``float`` | ``int``, optional, default: ``0.0001`` - | argument path: ``run_op/task_options[tbtrans_negf]/scf_options[PDIIS]/rel_err`` + Rectangular region with a fixed relative permittivity. Additional regions can be added via `dielectric_region2` ... `dielectric_region6`. - .. _`run_op/task_options[tbtrans_negf]/scf_options[PDIIS]/max_iter`: + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region6/x_range`: - max_iter: - | type: ``int``, optional, default: ``100`` - | argument path: ``run_op/task_options[tbtrans_negf]/scf_options[PDIIS]/max_iter`` + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region6/x_range`` - .. _`run_op/task_options[tbtrans_negf]/stru_options`: + Range along x as 'x0:x1' (Angstrom). - stru_options: - | type: ``dict`` - | argument path: ``run_op/task_options[tbtrans_negf]/stru_options`` + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region6/y_range`: - .. _`run_op/task_options[tbtrans_negf]/stru_options/device`: + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region6/y_range`` - device: - | type: ``dict`` - | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/device`` + Range along y as 'y0:y1' (Angstrom). - .. _`run_op/task_options[tbtrans_negf]/stru_options/device/id`: + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region6/z_range`: - id: + z_range: | type: ``str`` - | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/device/id`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region6/z_range`` - .. _`run_op/task_options[tbtrans_negf]/stru_options/device/sort`: + Range along z as 'z0:z1' (Angstrom). - sort: - | type: ``bool``, optional, default: ``True`` - | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/device/sort`` + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region6/relative permittivity`: - .. _`run_op/task_options[tbtrans_negf]/stru_options/lead_L`: + relative permittivity: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/dielectric_region6/relative permittivity`` - lead_L: - | type: ``dict`` - | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/lead_L`` + Relative permittivity of the region. - .. _`run_op/task_options[tbtrans_negf]/stru_options/lead_L/id`: + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/doped_region1`: - id: - | type: ``str`` - | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/lead_L/id`` + doped_region1: + | type: ``dict``, optional + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/doped_region1`` - .. _`run_op/task_options[tbtrans_negf]/stru_options/lead_L/voltage`: + Rectangular region with a fixed doping charge density. - voltage: - | type: ``float`` | ``int`` - | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/lead_L/voltage`` + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/doped_region1/x_range`: - .. _`run_op/task_options[tbtrans_negf]/stru_options/lead_R`: + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/doped_region1/x_range`` - lead_R: - | type: ``dict`` - | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/lead_R`` + Range along x as 'x0:x1' (Angstrom). - .. _`run_op/task_options[tbtrans_negf]/stru_options/lead_R/id`: + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/doped_region1/y_range`: - id: + y_range: | type: ``str`` - | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/lead_R/id`` - - .. _`run_op/task_options[tbtrans_negf]/stru_options/lead_R/voltage`: + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/doped_region1/y_range`` - voltage: - | type: ``float`` | ``int`` - | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/lead_R/voltage`` + Range along y as 'y0:y1' (Angstrom). - .. _`run_op/task_options[tbtrans_negf]/stru_options/kmesh`: + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/doped_region1/z_range`: - kmesh: - | type: ``list``, optional, default: ``[1, 1, 1]`` - | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/kmesh`` + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/doped_region1/z_range`` - .. _`run_op/task_options[tbtrans_negf]/stru_options/pbc`: + Range along z as 'z0:z1' (Angstrom). - pbc: - | type: ``list``, optional, default: ``[False, False, False]`` - | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/pbc`` + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/doped_region1/charge`: - .. _`run_op/task_options[tbtrans_negf]/stru_options/gamma_center`: + charge: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/doped_region1/charge`` - gamma_center: - | type: ``list`` | ``bool``, optional, default: ``True`` - | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/gamma_center`` + Fixed doping charge (electrons per unit cell of the region). - .. _`run_op/task_options[tbtrans_negf]/stru_options/time_reversal_symmetry`: + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/doped_region2`: - time_reversal_symmetry: - | type: ``list`` | ``bool``, optional, default: ``True`` - | argument path: ``run_op/task_options[tbtrans_negf]/stru_options/time_reversal_symmetry`` + doped_region2: + | type: ``dict``, optional + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/doped_region2`` - .. _`run_op/task_options[tbtrans_negf]/poisson_options`: + Rectangular region with a fixed doping charge density. - poisson_options: - | type: ``dict``, optional, default: ``{}`` - | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options`` + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/doped_region2/x_range`: + x_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/doped_region2/x_range`` - Depending on the value of *solver*, different sub args are accepted. + Range along x as 'x0:x1' (Angstrom). - .. _`run_op/task_options[tbtrans_negf]/poisson_options/solver`: + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/doped_region2/y_range`: - solver: - | type: ``str`` (flag key), default: ``fmm`` - | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options/solver`` - | possible choices: |code:run_op/task_options[tbtrans_negf]/poisson_options[fmm]|_ + y_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/doped_region2/y_range`` - .. |code:run_op/task_options[tbtrans_negf]/poisson_options[fmm]| replace:: ``fmm`` - .. _`code:run_op/task_options[tbtrans_negf]/poisson_options[fmm]`: `run_op/task_options[tbtrans_negf]/poisson_options[fmm]`_ + Range along y as 'y0:y1' (Angstrom). - .. |flag:run_op/task_options[tbtrans_negf]/poisson_options/solver| replace:: *solver* - .. _`flag:run_op/task_options[tbtrans_negf]/poisson_options/solver`: `run_op/task_options[tbtrans_negf]/poisson_options/solver`_ + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/doped_region2/z_range`: + z_range: + | type: ``str`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/doped_region2/z_range`` - .. _`run_op/task_options[tbtrans_negf]/poisson_options[fmm]`: + Range along z as 'z0:z1' (Angstrom). - When |flag:run_op/task_options[tbtrans_negf]/poisson_options/solver|_ is set to ``fmm``: + .. _`run_op/task_options[tbtrans_negf]/poisson_options[scipy]/doped_region2/charge`: - .. _`run_op/task_options[tbtrans_negf]/poisson_options[fmm]/err`: + charge: + | type: ``int`` | ``float`` + | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[scipy]/doped_region2/charge`` - err: - | type: ``float`` | ``int``, optional, default: ``1e-05`` - | argument path: ``run_op/task_options[tbtrans_negf]/poisson_options[fmm]/err`` + Fixed doping charge (electrons per unit cell of the region). .. _`run_op/task_options[tbtrans_negf]/sgf_solver`: @@ -1170,36 +3457,48 @@ run_op: | type: ``str``, optional, default: ``Sancho-Rubio`` | argument path: ``run_op/task_options[tbtrans_negf]/sgf_solver`` + Surface Green's function solver. 'Sancho-Rubio' (default) or 'Lopez-Sancho'. + .. _`run_op/task_options[tbtrans_negf]/espacing`: espacing: - | type: ``float`` | ``int`` + | type: ``int`` | ``float`` | argument path: ``run_op/task_options[tbtrans_negf]/espacing`` + Energy grid spacing in `unit`. Required. + .. _`run_op/task_options[tbtrans_negf]/emin`: emin: - | type: ``float`` | ``int`` + | type: ``int`` | ``float`` | argument path: ``run_op/task_options[tbtrans_negf]/emin`` + Lower bound of the energy grid in `unit`. Required. + .. _`run_op/task_options[tbtrans_negf]/emax`: emax: - | type: ``float`` | ``int`` + | type: ``int`` | ``float`` | argument path: ``run_op/task_options[tbtrans_negf]/emax`` + Upper bound of the energy grid in `unit`. Required. + .. _`run_op/task_options[tbtrans_negf]/e_fermi`: e_fermi: - | type: ``float`` | ``int`` + | type: ``int`` | ``float`` | argument path: ``run_op/task_options[tbtrans_negf]/e_fermi`` + Device Fermi level in `unit`. Required. + .. _`run_op/task_options[tbtrans_negf]/density_options`: density_options: | type: ``dict``, optional, default: ``{}`` | argument path: ``run_op/task_options[tbtrans_negf]/density_options`` + Density integration options (Ozaki or Fiori method). + Depending on the value of *method*, different sub args are accepted. @@ -1208,10 +3507,14 @@ run_op: method: | type: ``str`` (flag key), default: ``Ozaki`` | argument path: ``run_op/task_options[tbtrans_negf]/density_options/method`` - | possible choices: |code:run_op/task_options[tbtrans_negf]/density_options[Ozaki]|_ + | possible choices: |code:run_op/task_options[tbtrans_negf]/density_options[Ozaki]|_, |code:run_op/task_options[tbtrans_negf]/density_options[Fiori]|_ + + Density integration method. 'Ozaki' (default) uses the Ozaki contour with Matsubara-pole expansion; 'Fiori' uses real-axis integration with Gauss quadrature (used with the Fiori/effective-mass approach). .. |code:run_op/task_options[tbtrans_negf]/density_options[Ozaki]| replace:: ``Ozaki`` .. _`code:run_op/task_options[tbtrans_negf]/density_options[Ozaki]`: `run_op/task_options[tbtrans_negf]/density_options[Ozaki]`_ + .. |code:run_op/task_options[tbtrans_negf]/density_options[Fiori]| replace:: ``Fiori`` + .. _`code:run_op/task_options[tbtrans_negf]/density_options[Fiori]`: `run_op/task_options[tbtrans_negf]/density_options[Fiori]`_ .. |flag:run_op/task_options[tbtrans_negf]/density_options/method| replace:: *method* .. _`flag:run_op/task_options[tbtrans_negf]/density_options/method`: `run_op/task_options[tbtrans_negf]/density_options/method`_ @@ -1221,97 +3524,150 @@ run_op: When |flag:run_op/task_options[tbtrans_negf]/density_options/method|_ is set to ``Ozaki``: + Ozaki-contour options. + .. _`run_op/task_options[tbtrans_negf]/density_options[Ozaki]/R`: R: - | type: ``float`` | ``int``, optional, default: ``1000000.0`` + | type: ``int`` | ``float``, optional, default: ``1000000.0`` | argument path: ``run_op/task_options[tbtrans_negf]/density_options[Ozaki]/R`` + Radius of the semicircular contour in `unit`. Default: 1e6. + .. _`run_op/task_options[tbtrans_negf]/density_options[Ozaki]/M_cut`: M_cut: | type: ``int``, optional, default: ``30`` | argument path: ``run_op/task_options[tbtrans_negf]/density_options[Ozaki]/M_cut`` + Number of Ozaki poles kept. Default: 30. + .. _`run_op/task_options[tbtrans_negf]/density_options[Ozaki]/n_gauss`: n_gauss: | type: ``int``, optional, default: ``10`` | argument path: ``run_op/task_options[tbtrans_negf]/density_options[Ozaki]/n_gauss`` + Number of Gauss-Legendre points on the equilibrium contour. Default: 10. + + + .. _`run_op/task_options[tbtrans_negf]/density_options[Fiori]`: + + When |flag:run_op/task_options[tbtrans_negf]/density_options/method|_ is set to ``Fiori``: + + Fiori real-axis integration options. + + .. _`run_op/task_options[tbtrans_negf]/density_options[Fiori]/integrate_way`: + + integrate_way: + | type: ``int`` | ``str``, optional, default: ``direct`` + | argument path: ``run_op/task_options[tbtrans_negf]/density_options[Fiori]/integrate_way`` + + Integration strategy for the Fiori method: 'direct' or 'gauss'. Default: 'direct'. + + .. _`run_op/task_options[tbtrans_negf]/density_options[Fiori]/n_gauss`: + + n_gauss: + | type: ``int``, optional, default: ``100`` + | argument path: ``run_op/task_options[tbtrans_negf]/density_options[Fiori]/n_gauss`` + + Number of Gauss quadrature points along the real-axis integration. Default: 100. + .. _`run_op/task_options[tbtrans_negf]/eta_lead`: eta_lead: - | type: ``float`` | ``int``, optional, default: ``1e-05`` + | type: ``int`` | ``float``, optional, default: ``1e-05`` | argument path: ``run_op/task_options[tbtrans_negf]/eta_lead`` + Small imaginary broadening added to the lead energy. Default: 1e-5. + .. _`run_op/task_options[tbtrans_negf]/eta_device`: eta_device: - | type: ``float`` | ``int``, optional, default: ``0.0`` + | type: ``int`` | ``float``, optional, default: ``0.0`` | argument path: ``run_op/task_options[tbtrans_negf]/eta_device`` + Small imaginary broadening added to the device energy. Default: 0. + .. _`run_op/task_options[tbtrans_negf]/out_dos`: out_dos: | type: ``bool``, optional, default: ``False`` | argument path: ``run_op/task_options[tbtrans_negf]/out_dos`` + Whether to write density of states. Default: False. + .. _`run_op/task_options[tbtrans_negf]/out_tc`: out_tc: | type: ``bool``, optional, default: ``False`` | argument path: ``run_op/task_options[tbtrans_negf]/out_tc`` + Whether to write transmission coefficient. Default: False. + .. _`run_op/task_options[tbtrans_negf]/out_density`: out_density: | type: ``bool``, optional, default: ``False`` | argument path: ``run_op/task_options[tbtrans_negf]/out_density`` + Whether to write electron density. Default: False. + .. _`run_op/task_options[tbtrans_negf]/out_potential`: out_potential: | type: ``bool``, optional, default: ``False`` | argument path: ``run_op/task_options[tbtrans_negf]/out_potential`` + Whether to write the self-consistent electrostatic potential. Default: False. + .. _`run_op/task_options[tbtrans_negf]/out_current`: out_current: | type: ``bool``, optional, default: ``False`` | argument path: ``run_op/task_options[tbtrans_negf]/out_current`` + Whether to write self-consistent current. Default: False. + .. _`run_op/task_options[tbtrans_negf]/out_current_nscf`: out_current_nscf: | type: ``bool``, optional, default: ``False`` | argument path: ``run_op/task_options[tbtrans_negf]/out_current_nscf`` + Whether to write non-self-consistent current. Default: False. + .. _`run_op/task_options[tbtrans_negf]/out_ldos`: out_ldos: | type: ``bool``, optional, default: ``False`` | argument path: ``run_op/task_options[tbtrans_negf]/out_ldos`` + Whether to write local density of states. Default: False. + .. _`run_op/task_options[tbtrans_negf]/out_lcurrent`: out_lcurrent: | type: ``bool``, optional, default: ``False`` | argument path: ``run_op/task_options[tbtrans_negf]/out_lcurrent`` - - .. _`run_op/task_options[write_block]`: - - When |flag:run_op/task_options/task|_ is set to ``write_block``: - + Whether to write local current. Default: False. .. _`run_op/structure`: structure: - | type: ``str`` | ``NoneType``, optional, default: ``None`` + | type: ``NoneType`` | ``str``, optional, default: ``None`` | argument path: ``run_op/structure`` - the structure to run the task + Path to the structure file (xyz/vasp/etc.). Overrides the CLI `--structure` flag when set. + + .. _`run_op/pbc`: + + pbc: + | type: ``bool`` | ``list`` | ``NoneType``, optional, default: ``None`` + | argument path: ``run_op/pbc`` + + Overall periodic boundary condition of the input structure. Bool applies to all three axes; a list of three bools sets x/y/z individually. Default: None (inferred from the structure file). .. _`run_op/use_gui`: @@ -1319,64 +3675,51 @@ run_op: | type: ``bool``, optional, default: ``False`` | argument path: ``run_op/use_gui`` - To use the GUI or not + Whether to launch the GUI. Default: False. .. _`run_op/device`: device: - | type: ``str`` | ``NoneType``, optional, default: ``None`` + | type: ``NoneType`` | ``str``, optional, default: ``None`` | argument path: ``run_op/device`` - The device to run the calculation, choose among `cpu` and `cuda[:int]`, Default: None. default None means to use the device seeting in the model ckpt file. + The torch device used to build the Hamiltonian and run the calculation. Choose 'cpu' or 'cuda[:int]'. Default: None (use the device stored in the model ckpt). .. _`run_op/dtype`: dtype: - | type: ``str`` | ``NoneType``, optional, default: ``None`` + | type: ``NoneType`` | ``str``, optional, default: ``None`` | argument path: ``run_op/dtype`` - The digital number's precison, choose among: - Default: None, - - `float32`: indicating torch.float32 - - `float64`: indicating torch.float64 - default None means to use the device seeting in the model ckpt file. - + Floating precision used at build time. 'float32' or 'float64'. Default: None (use the dtype stored in the model ckpt). .. _`run_op/AtomicData_options`: AtomicData_options: - | type: ``dict`` + | type: ``NoneType`` | ``dict``, optional, default: ``None`` | argument path: ``run_op/AtomicData_options`` .. _`run_op/AtomicData_options/r_max`: r_max: - | type: ``dict`` | ``float`` | ``int`` + | type: ``int`` | ``float`` | ``dict`` | argument path: ``run_op/AtomicData_options/r_max`` - the cutoff value for bond considering in TB model. + Cutoff radius (Angstrom) for bond construction in the TB model. Can be a float or a per-species dict. .. _`run_op/AtomicData_options/er_max`: er_max: - | type: ``dict`` | ``float`` | ``int`` | ``NoneType``, optional, default: ``None`` + | type: ``int`` | ``float`` | ``dict`` | ``NoneType``, optional, default: ``None`` | argument path: ``run_op/AtomicData_options/er_max`` - The cutoff value for environment for each site for env correction model. should set for nnsk+env correction model. + Cutoff radius for the environment of each site (env-correction models). Default: None. .. _`run_op/AtomicData_options/oer_max`: oer_max: - | type: ``dict`` | ``float`` | ``int`` | ``NoneType``, optional, default: ``None`` + | type: ``int`` | ``float`` | ``dict`` | ``NoneType``, optional, default: ``None`` | argument path: ``run_op/AtomicData_options/oer_max`` - The cutoff value for onsite environment for nnsk model, for now only need to set in strain and NRL mode. - - .. _`run_op/AtomicData_options/pbc`: - - pbc: - | type: ``bool`` - | argument path: ``run_op/AtomicData_options/pbc`` - - The periodic condition for the structure, can bool or list of bool to specific x,y,z direction. + Cutoff radius for onsite environment; only used by nnsk models in strain or NRL mode. Default: None. diff --git a/dpnegf/entrypoints/run.py b/dpnegf/entrypoints/run.py index 1ae8ad8..efb2616 100644 --- a/dpnegf/entrypoints/run.py +++ b/dpnegf/entrypoints/run.py @@ -54,6 +54,10 @@ def run( jdata = j_loader(INPUT) jdata = normalize_run(jdata) + if output: + with open(os.path.join(str(output), "run_config.json"), "w") as fp: + json.dump(jdata, fp, indent=4) + task_options = j_must_have(jdata, "task_options") task = task_options["task"] use_gui = jdata.get("use_gui", False) diff --git a/dpnegf/negf/lead_property.py b/dpnegf/negf/lead_property.py index f3df706..22f509a 100644 --- a/dpnegf/negf/lead_property.py +++ b/dpnegf/negf/lead_property.py @@ -523,8 +523,8 @@ def _estimate_worker_memory(lead_L, lead_R, kpoint=None, temp_allocation_factor= return total_estimate -def _get_safe_n_jobs(lead_L, lead_R, requested_n_jobs=-1, max_memory_fraction=0.9, - min_workers=1, kpoint=None, n_cpus=None): +def _get_safe_n_workers(lead_L, lead_R, requested_n_workers=-1, max_memory_fraction=0.9, + min_workers=1, kpoint=None, cpu_budget=None): """ Calculate safe number of parallel workers based on available system memory. @@ -532,23 +532,24 @@ def _get_safe_n_jobs(lead_L, lead_R, requested_n_jobs=-1, max_memory_fraction=0. ---------- lead_L, lead_R : LeadProperty Lead objects for memory estimation. - requested_n_jobs : int - User-requested n_jobs. -1 means auto-detect. + requested_n_workers : int + User-requested n_workers. -1 means auto-detect. max_memory_fraction : float Maximum fraction of available memory to use. Default 0.9. min_workers : int Minimum number of workers to use. Default 1. kpoint : array-like, optional A sample k-point for fetching Hamiltonian matrices to estimate memory. - n_cpus : int or None - Number of CPU cores to use for memory estimation. If None, uses os.cpu_count(). + cpu_budget : int or None + Total CPU cores the self-energy pool is allowed to size against. + If None, uses os.cpu_count(). Returns ------- int Safe number of parallel workers. """ - cpu_count = n_cpus if n_cpus is not None else os.cpu_count() + cpu_count = cpu_budget if cpu_budget is not None else os.cpu_count() if cpu_count is None or cpu_count < 1: cpu_count = 1 log.warning("os.cpu_count() returned None or invalid value. Defaulting to 1 CPU core.") @@ -570,37 +571,37 @@ def _get_safe_n_jobs(lead_L, lead_R, requested_n_jobs=-1, max_memory_fraction=0. max_workers = min(max_workers_by_memory, cpu_count) safe_n_worker = 0 - # check requested_n_jobs is a number - if not isinstance(requested_n_jobs, int): - log.warning(f"Requested n_jobs={requested_n_jobs} is not an integer. \n" + # check requested_n_workers is a number + if not isinstance(requested_n_workers, int): + log.warning(f"Requested n_workers={requested_n_workers} is not an integer. \n" f"Using min_workers={min_workers}.") safe_n_worker = min_workers - if requested_n_jobs == -1: + if requested_n_workers == -1: safe_n_worker = max_workers - elif requested_n_jobs == 0: - log.warning(f"Requested n_jobs=0 is invalid. Using min_workers={min_workers}.") + elif requested_n_workers == 0: + log.warning(f"Requested n_workers=0 is invalid. Using min_workers={min_workers}.") safe_n_worker = min_workers - elif requested_n_jobs > 0: - if requested_n_jobs > max_workers: - log.warning(f"Requested n_jobs={requested_n_jobs} may exceed available memory. " + elif requested_n_workers > 0: + if requested_n_workers > max_workers: + log.warning(f"Requested n_workers={requested_n_workers} may exceed available memory. " f"Limiting to {max_workers} workers " f"(available: {available_memory / 1e9:.1f} GB, " f"est. per worker: {memory_per_worker / 1e9:.1f} GB)") safe_n_worker = max_workers else: - safe_n_worker = requested_n_jobs + safe_n_worker = requested_n_workers else: - # Negative values other than -1: joblib interprets as (cpu_count + 1 + n_jobs) - effective_n_jobs = max(cpu_count + 1 + requested_n_jobs, min_workers) - safe_n_worker = min(effective_n_jobs, max_workers) + # Negative values other than -1: joblib interprets as (cpu_count + 1 + n_workers) + effective_n_workers = max(cpu_count + 1 + requested_n_workers, min_workers) + safe_n_worker = min(effective_n_workers, max_workers) - log.info(f"Estimated safe n_jobs={safe_n_worker} based on available memory.") + log.info(f"Estimated safe n_workers={safe_n_worker} based on available memory.") return safe_n_worker def _autotune_blas_threads(leadL_pack, sample_kpoint, sample_energy, eta_lead, - n_jobs, cpu_count, se_numba_jit, requested=None): + n_workers, cpu_count, se_numba_jit, requested=None): """Pick per-worker BLAS threads by timing the real surface-green code path. The Lopez-Sancho loop in ``surface_green._surface_green_{numba,scipy}_core`` @@ -624,7 +625,7 @@ def _autotune_blas_threads(leadL_pack, sample_kpoint, sample_energy, eta_lead, computed so N and dtype match production. eta_lead : float Same broadening as production. - n_jobs : int + n_workers : int Number of joblib workers about to be launched; bounds per-worker CPU. cpu_count : int Total CPU budget. @@ -640,8 +641,8 @@ def _autotune_blas_threads(leadL_pack, sample_kpoint, sample_energy, eta_lead, int BLAS threads to give each loky worker via ``threadpool_limits``. """ - n_jobs = max(int(n_jobs), 1) - per_worker_budget = max(int(cpu_count) // n_jobs, 1) + n_workers = max(int(n_workers), 1) + per_worker_budget = max(int(cpu_count) // n_workers, 1) if requested is not None: if not isinstance(requested, int) or requested < 1: @@ -650,7 +651,7 @@ def _autotune_blas_threads(leadL_pack, sample_kpoint, sample_energy, eta_lead, else: if requested > per_worker_budget: log.warning(f"Requested blas_threads={requested} exceeds per-worker " - f"CPU budget ({per_worker_budget} = cpu_count // n_jobs). " + f"CPU budget ({per_worker_budget} = cpu_count // n_workers). " f"Clamping to {per_worker_budget}.") threads = min(requested, per_worker_budget) log.info(f"BLAS threads per worker: {threads} (user-requested).") @@ -707,7 +708,7 @@ def _autotune_blas_threads(leadL_pack, sample_kpoint, sample_energy, eta_lead, best = min(timings, key=timings.get) log.info(f"BLAS threads per worker: {best} " - f"(autotuned, N={sample_dim}, n_jobs={n_jobs}, cpu_count={cpu_count}).") + f"(autotuned, N={sample_dim}, n_workers={n_workers}, cpu_count={cpu_count}).") return best @@ -734,7 +735,7 @@ def _sample_principal_layer_dim(pack, sample_kpoint): def compute_all_self_energy(eta, lead_L, lead_R, kpoints_grid, energy_grid, self_energy_save_path=None, ek_batch_size=200, - n_cpus=None, n_jobs=-1, se_numba_jit=None, blas_threads=None): + cpu_budget=None, n_workers=-1, se_numba_jit=None, blas_threads=None): """ Computes and saves self-energy matrices for all combinations of k-points and energy values for left and right leads. @@ -758,17 +759,19 @@ def compute_all_self_energy(eta, lead_L, lead_R, kpoints_grid, energy_grid, Directory to save self-energy files. If None, uses lead_L's results_path. ek_batch_size : int, optional Number of (k, e) tasks per parallel batch. Default is 200. - n_cpus : int or None, optional - Number of CPU cores to use for memory estimation. If None, uses os.cpu_count(). - n_jobs : int, optional - Number of parallel jobs to use. Default is -1 (use all available CPUs). + cpu_budget : int or None, optional + Total CPU cores the self-energy pool is allowed to size against. + If None, uses os.cpu_count(). + n_workers : int, optional + Number of parallel joblib workers to use. Default is -1 (auto-select + based on `cpu_budget` and available memory). se_numba_jit : bool or None, optional Boolean flag controlling whether to use the Numba-accelerated surface Green's function core. If None, Numba will be used when available. Default is None. blas_threads : int or None, optional BLAS threads to give each worker. None (default) autotunes by timing - `_compute_self_energy_from_pack` across a few candidate thread counts and picking the fastest. - Pass an int to force that value; it is still clamped to `cpu_count // n_jobs` to avoid + `_compute_self_energy_from_pack` across a few candidate thread counts and picking the fastest. + Pass an int to force that value; it is still clamped to `cpu_budget // n_workers` to avoid oversubscription. Returns @@ -785,14 +788,14 @@ def compute_all_self_energy(eta, lead_L, lead_R, kpoints_grid, energy_grid, # Calculate safe number of workers based on available memory # Use first k-point for memory estimation sample_kpoint = kpoints_grid[0] if len(kpoints_grid) > 0 else None - safe_n_jobs = _get_safe_n_jobs(lead_L, lead_R, - requested_n_jobs=n_jobs, - kpoint=sample_kpoint, - n_cpus=n_cpus) - if n_jobs == -1: - log.info(f"Auto-detected safe n_jobs={safe_n_jobs} based on available memory") - elif safe_n_jobs < n_jobs: - log.info(f"Adjusted n_jobs from {n_jobs} to {safe_n_jobs} due to memory constraints") + safe_n_workers = _get_safe_n_workers(lead_L, lead_R, + requested_n_workers=n_workers, + kpoint=sample_kpoint, + cpu_budget=cpu_budget) + if n_workers == -1: + log.info(f"Auto-detected safe n_workers={safe_n_workers} based on available memory") + elif safe_n_workers < n_workers: + log.info(f"Adjusted n_workers from {n_workers} to {safe_n_workers} due to memory constraints") # Precompute all k-dependent matrices in the parent so workers receive # only plain tensors (the hamiltonian holds a torch.jit.ScriptFunction- @@ -803,11 +806,11 @@ def compute_all_self_energy(eta, lead_L, lead_R, kpoints_grid, energy_grid, # Choose BLAS threads-per-worker by autotuning on the real code path at the # sample (k, E). Cheaper than a hardware-agnostic table and always correct # for the actual N / BLAS backend the workers will run under. - cpu_budget = n_cpus if n_cpus is not None else os.cpu_count() + cpu_count = cpu_budget if cpu_budget is not None else os.cpu_count() sample_energy = energy_grid[0] if len(energy_grid) > 0 else 0.0 blas_threads_per_worker = _autotune_blas_threads( leadL_pack, sample_kpoint, sample_energy, eta, - safe_n_jobs, cpu_budget, se_numba_jit, requested=blas_threads, + safe_n_workers, cpu_count, se_numba_jit, requested=blas_threads, ) total_tasks = [(k, e) for k in kpoints_grid for e in energy_grid] @@ -815,7 +818,7 @@ def compute_all_self_energy(eta, lead_L, lead_R, kpoints_grid, energy_grid, # logging state and the WARNING default) can match it when they reinit. parent_log_level = logging.getLogger().getEffectiveLevel() if len(total_tasks) <= ek_batch_size: - Parallel(n_jobs=min(safe_n_jobs, len(total_tasks)), backend="loky")( + Parallel(n_jobs=min(safe_n_workers, len(total_tasks)), backend="loky")( delayed(_self_energy_worker_blas)(k, e, eta, leadL_pack, leadR_pack, self_energy_save_path, se_numba_jit, parent_log_level, blas_threads_per_worker) @@ -824,7 +827,7 @@ def compute_all_self_energy(eta, lead_L, lead_R, kpoints_grid, energy_grid, else: for i in range(0, len(total_tasks), ek_batch_size): batch = total_tasks[i:i+ek_batch_size] - Parallel(n_jobs=min(safe_n_jobs, len(batch)), backend="loky")( + Parallel(n_jobs=min(safe_n_workers, len(batch)), backend="loky")( delayed(_self_energy_worker_blas)(k, e, eta, leadL_pack, leadR_pack, self_energy_save_path, se_numba_jit, parent_log_level, blas_threads_per_worker) @@ -1077,7 +1080,7 @@ def _self_energy_worker_blas(k, e, eta, leadL_pack, leadR_pack, self_energy_save `solve` / `inv` / matmul calls whose payoff from BLAS threading depends on the principal-layer dimension N: single-threaded already wins for small N, but multi-threaded solve/GEMM helps for larger N when the CPU budget left - over from the memory-driven `n_jobs` cap is not zero. + over from the memory-driven `n_workers` cap is not zero. `blas_threads` is chosen by `_autotune_blas_threads` in the parent and passed in per call; default 1 preserves the historical behavior for any diff --git a/dpnegf/runner/NEGF.py b/dpnegf/runner/NEGF.py index d18a134..4faf305 100644 --- a/dpnegf/runner/NEGF.py +++ b/dpnegf/runner/NEGF.py @@ -1,5 +1,14 @@ import torch -from dpnegf.negf.negf_utils import quad, gauss_xw,leggauss,update_kmap +import ase +import numpy as np +import logging +import json +from typing import Optional, Union +from pyinstrument import Profiler +import os + +from dptb.utils.argcheck import get_cutoffs_from_model_options +from dpnegf.negf.negf_utils import gauss_xw from dpnegf.utils.constants import valence_electron from dpnegf.negf.ozaki_res_cal import ozaki_residues from dpnegf.negf.negf_hamiltonian_init import NEGFHamiltonianInit @@ -7,19 +16,11 @@ from dpnegf.negf.density import Ozaki,Fiori from dpnegf.negf.device_property import DeviceProperty from dpnegf.negf.lead_property import LeadProperty, compute_all_self_energy, _has_saved_self_energy -from dpnegf.negf.negf_utils import is_fully_covered -import ase from dpnegf.utils.constants import Boltzmann, eV2J -import numpy as np from dpnegf.utils.make_kpoints import kmesh_sampling_negf -import logging -import json from dpnegf.negf.poisson_init import Grid,Interface3D,Dirichlet,Dielectric from dpnegf.negf.scf_method import PDIISMixer,DIISMixer,BroydenFirstMixer,BroydenSecondMixer,AndersonMixer -from typing import Optional, Union -from dpnegf.utils.tools import apply_gaussian_filter_3d -from pyinstrument import Profiler -import os + log = logging.getLogger(__name__) @@ -46,29 +47,47 @@ def __init__(self, scf: bool, poisson_options: dict, stru_options: dict,eta_lead: float,eta_device: float, block_tridiagonal: bool, - sgf_solver: str, + self_energy_options: Optional[dict] = None, + rgf_options: Optional[dict] = None, + hs_cache: Optional[dict] = None, + output_options: Optional[dict] = None, e_fermi: float=None, - use_saved_HS: bool=False, saved_HS_path: str=None, - use_saved_se: bool=False, self_energy_save_path: str=None, - se_info_display: bool=False, se_numba_jit: Optional[bool]=None, - out_tc: bool=False,out_dos: bool=False,out_density: bool=False,out_potential: bool=False, - out_current: bool=False,out_current_nscf: bool=False,out_ldos: bool=False,out_lcurrent: bool=False, results_path: Optional[str]=None, plot_blocks: Optional[bool]=False, - rgf_device: Union[str, torch.device]='cpu', AtomicData_options: Optional[dict]=None, - n_cpus: Optional[int]=None, - e_batch_size: Optional[int]=None, **kwargs): # self.model = model # No need to set model as property for memory saving self.results_path = results_path self.cdtype = torch.complex128 + + # --- unpack the three nested option groups added in the schema refactor --- + # rgf_options: device placement and energy-loop chunking for the RGF sweep + rgf_options = dict(rgf_options or {}) + rgf_device = rgf_options.get("device", "cpu") if isinstance(rgf_device, str): rgf_device = torch.device(rgf_device) self.rgf_device = rgf_device - self.n_cpus = n_cpus - self.e_batch_size = e_batch_size + self.e_batch_size = rgf_options.get("e_batch_size", None) + + # self_energy_options: solver, cache, and CPU parallelism for the SE sweep + se_opts = dict(self_energy_options or {}) + self.sgf_solver = se_opts.get("solver", "Sancho-Rubio") + self.se_numba_jit = se_opts.get("numba_jit", None) + self.se_info_display = se_opts.get("info_display", False) + se_cache = dict(se_opts.get("cache", {}) or {}) + self.use_saved_se = se_cache.get("use_saved", False) + self.self_energy_save_path = se_cache.get("save_path", None) + se_parallel = dict(se_opts.get("parallel", {}) or {}) + self.cpu_budget = se_parallel.get("cpu_budget", None) + self.n_workers = se_parallel.get("n_workers", -1) + self.blas_threads = se_parallel.get("blas_threads", None) + self.ek_batch_size = se_parallel.get("ek_batch_size", 200) + + # hs_cache: on-disk cache of device H / S + hs_cache = dict(hs_cache or {}) + self.use_saved_HS = hs_cache.get("use_saved", False) + self.saved_HS_path = hs_cache.get("save_path", None) # The RGF q-loop allocates/frees many small slabs; with the default # cudaMalloc-backed caching allocator this fragments quickly on long @@ -83,7 +102,7 @@ def __init__(self, "PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True BEFORE invoking " "dpnegf (must be set before torch's CUDA context initializes)." ) - + # get the parameters self.ele_T = ele_T self.kBT = Boltzmann * self.ele_T / eV2J # change to eV @@ -97,14 +116,6 @@ def __init__(self, assert "kmesh_lead_Ef" in self.stru_options[lead], f"{lead} must have 'kmesh_lead_Ef' set in stru_options if e_fermi is None" - self.use_saved_HS = use_saved_HS - self.saved_HS_path = saved_HS_path - - self.sgf_solver = sgf_solver - self.use_saved_se = use_saved_se # whether to use the saved self-energy or not - self.self_energy_save_path = self_energy_save_path # The directory to save the self-energy or for saved self-energy - self.se_info_display = se_info_display # whether to display the self-energy information after calculation - self.se_numba_jit = se_numba_jit self.pbc = self.stru_options["pbc"] if self.stru_options["lead_L"]["useBloch"] or self.stru_options["lead_R"]["useBloch"]: @@ -298,14 +309,15 @@ def __init__(self, # geting the output settings - self.out_tc = out_tc - self.out_dos = out_dos - self.out_density = out_density - self.out_potential = out_potential - self.out_current = out_current - self.out_current_nscf = out_current_nscf - self.out_ldos = out_ldos - self.out_lcurrent = out_lcurrent + out_opts = dict(output_options or {}) + self.out_tc = out_opts.get("tc", False) + self.out_dos = out_opts.get("dos", False) + self.out_density = out_opts.get("density", False) + self.out_potential = out_opts.get("potential", False) + self.out_current = out_opts.get("current", False) + self.out_current_nscf = out_opts.get("current_nscf", False) + self.out_ldos = out_opts.get("ldos", False) + self.out_lcurrent = out_opts.get("lcurrent", False) assert not (self.out_lcurrent and self.block_tridiagonal) self.out = {} # initialize density class @@ -588,13 +600,19 @@ def prepare_self_energy(self, scf_require: bool) -> None: # self.deviceprop.lead_L.self_energy(kpoint=k, energy=e, eta_lead=self.eta_lead, save=True) # self.deviceprop.lead_R.self_energy(kpoint=k, energy=e, eta_lead=self.eta_lead, save=True) compute_all_self_energy(self.eta_lead, self.deviceprop.lead_L, self.deviceprop.lead_R, - self.kpoints, self.density.integrate_range, self.self_energy_save_path, - n_cpus=self.n_cpus, se_numba_jit=self.se_numba_jit) + self.kpoints, self.density.integrate_range, self.self_energy_save_path, + ek_batch_size=self.ek_batch_size, + cpu_budget=self.cpu_budget, n_workers=self.n_workers, + se_numba_jit=self.se_numba_jit, + blas_threads=self.blas_threads) elif not self.scf: # In non-scf case, the self-energy of the leads is calculated for each energy point in the energy grid. compute_all_self_energy(self.eta_lead, self.deviceprop.lead_L, self.deviceprop.lead_R, - self.kpoints, self.uni_grid, self.self_energy_save_path, - n_cpus=self.n_cpus, se_numba_jit=self.se_numba_jit) + self.kpoints, self.uni_grid, self.self_energy_save_path, + ek_batch_size=self.ek_batch_size, + cpu_budget=self.cpu_budget, n_workers=self.n_workers, + se_numba_jit=self.se_numba_jit, + blas_threads=self.blas_threads) log.info(msg="-----------------------------------\n") @@ -998,7 +1016,6 @@ def update_atomicdata_options(model,AtomicData_options: dict=None) -> dict: dict: The updated or initialized AtomicData_options dictionary. """ if AtomicData_options is None: - from dptb.utils.argcheck import get_cutoffs_from_model_options # get the cutoffs from model options r_max, er_max, oer_max = get_cutoffs_from_model_options(model.model_options) AtomicData_options = {'r_max': r_max, 'er_max': er_max, 'oer_max': oer_max} diff --git a/dpnegf/tests/test_auto_memory.py b/dpnegf/tests/test_auto_memory.py index 5061a67..c24c7e2 100644 --- a/dpnegf/tests/test_auto_memory.py +++ b/dpnegf/tests/test_auto_memory.py @@ -3,7 +3,7 @@ Tests cover: - _estimate_worker_memory: Memory estimation per worker -- _get_safe_n_jobs: Safe parallel worker calculation +- _get_safe_n_workers: Safe parallel worker calculation """ import numpy as np @@ -11,7 +11,7 @@ import torch from unittest.mock import Mock, patch, MagicMock -from dpnegf.negf.lead_property import _estimate_worker_memory, _get_safe_n_jobs +from dpnegf.negf.lead_property import _estimate_worker_memory, _get_safe_n_workers class MockHamiltonian: @@ -192,23 +192,23 @@ def test_mixed_success_and_failure(self): # ============================================================================= -# Tests for _get_safe_n_jobs +# Tests for _get_safe_n_workers # ============================================================================= class TestGetSafeNJobs: - """Tests for _get_safe_n_jobs function.""" + """Tests for _get_safe_n_workers function.""" @patch('dpnegf.negf.lead_property.psutil') @patch('dpnegf.negf.lead_property.os') def test_auto_detect_n_jobs(self, mock_os, mock_psutil): - """Test auto-detection with n_jobs=-1.""" + """Test auto-detection with n_workers=-1.""" mock_os.cpu_count.return_value = 8 mock_psutil.virtual_memory.return_value = Mock(available=16 * 1024**3) # 16 GB lead_L = MockLead("lead_L", matrix_size=10) lead_R = MockLead("lead_R", matrix_size=10) - result = _get_safe_n_jobs(lead_L, lead_R, requested_n_jobs=-1) + result = _get_safe_n_workers(lead_L, lead_R, requested_n_workers=-1) # Should return a positive integer assert isinstance(result, int) @@ -218,21 +218,21 @@ def test_auto_detect_n_jobs(self, mock_os, mock_psutil): @patch('dpnegf.negf.lead_property.psutil') @patch('dpnegf.negf.lead_property.os') def test_respects_requested_n_jobs(self, mock_os, mock_psutil): - """Test that requested n_jobs is respected when safe.""" + """Test that requested n_workers is respected when safe.""" mock_os.cpu_count.return_value = 16 mock_psutil.virtual_memory.return_value = Mock(available=64 * 1024**3) # 64 GB lead_L = MockLead("lead_L", matrix_size=10) lead_R = MockLead("lead_R", matrix_size=10) - result = _get_safe_n_jobs(lead_L, lead_R, requested_n_jobs=4) + result = _get_safe_n_workers(lead_L, lead_R, requested_n_workers=4) assert result == 4 @patch('dpnegf.negf.lead_property.psutil') @patch('dpnegf.negf.lead_property.os') def test_limits_when_memory_constrained(self, mock_os, mock_psutil): - """Test that n_jobs is limited when memory is constrained.""" + """Test that n_workers is limited when memory is constrained.""" mock_os.cpu_count.return_value = 16 # Only 1 GB available - should limit workers mock_psutil.virtual_memory.return_value = Mock(available=1 * 1024**3) @@ -241,7 +241,7 @@ def test_limits_when_memory_constrained(self, mock_os, mock_psutil): lead_R = MockLead("lead_R", matrix_size=100) # Request many workers - result = _get_safe_n_jobs(lead_L, lead_R, requested_n_jobs=16) + result = _get_safe_n_workers(lead_L, lead_R, requested_n_workers=16) # Should be limited due to memory constraints assert result < 16 @@ -256,37 +256,37 @@ def test_respects_min_workers(self, mock_os, mock_psutil): lead_L = MockLead("lead_L", matrix_size=100) lead_R = MockLead("lead_R", matrix_size=100) - result = _get_safe_n_jobs(lead_L, lead_R, requested_n_jobs=-1, min_workers=2) + result = _get_safe_n_workers(lead_L, lead_R, requested_n_workers=-1, min_workers=2) assert result >= 2 @patch('dpnegf.negf.lead_property.psutil') @patch('dpnegf.negf.lead_property.os') def test_handles_zero_n_jobs(self, mock_os, mock_psutil): - """Test handling of n_jobs=0 (invalid).""" + """Test handling of n_workers=0 (invalid).""" mock_os.cpu_count.return_value = 4 mock_psutil.virtual_memory.return_value = Mock(available=8 * 1024**3) lead_L = MockLead("lead_L", matrix_size=10) lead_R = MockLead("lead_R", matrix_size=10) - result = _get_safe_n_jobs(lead_L, lead_R, requested_n_jobs=0, min_workers=1) + result = _get_safe_n_workers(lead_L, lead_R, requested_n_workers=0, min_workers=1) - # Should return min_workers when n_jobs=0 + # Should return min_workers when n_workers=0 assert result == 1 @patch('dpnegf.negf.lead_property.psutil') @patch('dpnegf.negf.lead_property.os') def test_handles_negative_n_jobs(self, mock_os, mock_psutil): - """Test handling of negative n_jobs (joblib convention).""" + """Test handling of negative n_workers (joblib convention).""" mock_os.cpu_count.return_value = 8 mock_psutil.virtual_memory.return_value = Mock(available=32 * 1024**3) lead_L = MockLead("lead_L", matrix_size=10) lead_R = MockLead("lead_R", matrix_size=10) - # n_jobs=-2 means (cpu_count + 1 + (-2)) = cpu_count - 1 = 7 - result = _get_safe_n_jobs(lead_L, lead_R, requested_n_jobs=-2) + # n_workers=-2 means (cpu_count + 1 + (-2)) = cpu_count - 1 = 7 + result = _get_safe_n_workers(lead_L, lead_R, requested_n_workers=-2) assert result >= 1 assert result <= 8 @@ -301,7 +301,7 @@ def test_handles_none_cpu_count(self, mock_os, mock_psutil): lead_L = MockLead("lead_L", matrix_size=10) lead_R = MockLead("lead_R", matrix_size=10) - result = _get_safe_n_jobs(lead_L, lead_R, requested_n_jobs=-1) + result = _get_safe_n_workers(lead_L, lead_R, requested_n_workers=-1) # Should default to 1 CPU and still work assert result >= 1 @@ -317,9 +317,9 @@ def test_respects_max_memory_fraction(self, mock_os, mock_psutil): lead_R = MockLead("lead_R", matrix_size=10) # With higher fraction, should allow more workers - result_high = _get_safe_n_jobs(lead_L, lead_R, requested_n_jobs=-1, + result_high = _get_safe_n_workers(lead_L, lead_R, requested_n_workers=-1, max_memory_fraction=0.9) - result_low = _get_safe_n_jobs(lead_L, lead_R, requested_n_jobs=-1, + result_low = _get_safe_n_workers(lead_L, lead_R, requested_n_workers=-1, max_memory_fraction=0.3) assert result_high >= result_low @@ -327,7 +327,7 @@ def test_respects_max_memory_fraction(self, mock_os, mock_psutil): @patch('dpnegf.negf.lead_property.psutil') @patch('dpnegf.negf.lead_property.os') def test_handles_non_integer_n_jobs(self, mock_os, mock_psutil): - """Test handling of non-integer n_jobs logs a warning.""" + """Test handling of non-integer n_workers logs a warning.""" mock_os.cpu_count.return_value = 4 mock_psutil.virtual_memory.return_value = Mock(available=8 * 1024**3) @@ -337,7 +337,7 @@ def test_handles_non_integer_n_jobs(self, mock_os, mock_psutil): # Pass a float instead of int - function logs warning but continues # Note: current implementation has a bug where final_worker is set to min_workers # but subsequent conditionals may overwrite it. This test documents current behavior. - result = _get_safe_n_jobs(lead_L, lead_R, requested_n_jobs=2.5, min_workers=1) + result = _get_safe_n_workers(lead_L, lead_R, requested_n_workers=2.5, min_workers=1) # Result should still be a valid positive number assert result >= 1 @@ -353,7 +353,7 @@ def test_capped_by_cpu_count(self, mock_os, mock_psutil): lead_L = MockLead("lead_L", matrix_size=10) lead_R = MockLead("lead_R", matrix_size=10) - result = _get_safe_n_jobs(lead_L, lead_R, requested_n_jobs=-1) + result = _get_safe_n_workers(lead_L, lead_R, requested_n_workers=-1) # Should be capped at CPU count assert result <= 4 @@ -377,7 +377,7 @@ def test_small_system_allows_parallelism(self, mock_os, mock_psutil): lead_L = MockLead("lead_L", matrix_size=10) lead_R = MockLead("lead_R", matrix_size=10) - result = _get_safe_n_jobs(lead_L, lead_R, requested_n_jobs=-1) + result = _get_safe_n_workers(lead_L, lead_R, requested_n_workers=-1) # With 8GB and tiny matrices, should allow many workers assert result >= 4 @@ -394,7 +394,7 @@ def test_large_system_limits_parallelism(self, mock_os, mock_psutil): lead_R = MockLead("lead_R", matrix_size=1000) memory_estimate = _estimate_worker_memory(lead_L, lead_R) - n_jobs = _get_safe_n_jobs(lead_L, lead_R, requested_n_jobs=-1) + n_workers = _get_safe_n_workers(lead_L, lead_R, requested_n_workers=-1) # Memory per worker should be significant (> 500 MB) # 1000x1000 matrices: 2 leads * 6 matrices * 1000^2 * 16 bytes * 3.0 factor + 100MB overhead @@ -402,7 +402,7 @@ def test_large_system_limits_parallelism(self, mock_os, mock_psutil): assert memory_estimate > 500 * 1024**2 # > 500 MB # Should limit workers due to memory (4 GB * 0.9 / ~676 MB per worker ~= 5, below CPU count of 16) - assert n_jobs <= 8 + assert n_workers <= 8 def test_consistent_estimates(self): """Test that estimates are consistent across calls.""" diff --git a/dpnegf/tests/test_surface_green_fastmath.py b/dpnegf/tests/test_surface_green_fastmath.py new file mode 100644 index 0000000..b5ce254 --- /dev/null +++ b/dpnegf/tests/test_surface_green_fastmath.py @@ -0,0 +1,94 @@ +"""Equivalence and micro-benchmark for `_surface_green_numba_core`. + +The numba core is compiled with ``fastmath=True`` in production (see +`dpnegf/negf/surface_green.py`), which lets numba reassociate the pointwise +complex ops and use FMA where available. Reassociation can change the last +bit or two of the answer, so we pin numerical equivalence against a sibling +compiled without ``fastmath`` on a battery of synthetic lead problems. + +We also time both variants at a couple of realistic principal-layer sizes and +print the ratio, so a reviewer can see the acceleration. The timings are +noisy under CI load and are not asserted. +""" + +import time + +import numpy as np +import pytest + +from dpnegf.negf.surface_green import ( + _numba_available, + _surface_green_numba_core, + _surface_green_numba_core_nofastmath, +) + + +pytestmark = pytest.mark.skipif(not _numba_available, reason="numba is not available") + + +def _make_lead_problem(N, seed): + """Random hermitian on-site + small off-diagonal hopping. Not physical but + passes Lopez-Sancho convergence over the tested energies, which is all the + core cares about.""" + rng = np.random.default_rng(seed) + H = rng.standard_normal((N, N)) + 1j * rng.standard_normal((N, N)) + H = ((H + H.conj().T) / 2).astype(np.complex128) + H = np.ascontiguousarray(H) + + h01 = (rng.standard_normal((N, N)) + 1j * rng.standard_normal((N, N))) * 0.05 + h01 = np.ascontiguousarray(h01.astype(np.complex128)) + + S = np.eye(N, dtype=np.complex128) + s01 = (rng.standard_normal((N, N)) + 1j * rng.standard_normal((N, N))) * 0.005 + s01 = np.ascontiguousarray(s01.astype(np.complex128)) + + h10 = np.ascontiguousarray(np.conj(h01.T)) + s10 = np.ascontiguousarray(np.conj(s01.T)) + return H, h01, S, s01, h10, s10 + + +@pytest.mark.parametrize("N,seed", [(32, 0), (32, 1), (64, 2), (64, 3)]) +@pytest.mark.parametrize("ee", [ + np.complex128(-1.5 + 1e-5j), + np.complex128(0.25 + 1e-5j), + np.complex128(2.0 + 1e-5j), +]) +def test_fastmath_matches_nofastmath(N, seed, ee): + """Fastmath must not perturb the surface Green's function beyond + reassociation noise. 1e-10 leaves 2 orders of margin over the outer + Lopez warning threshold (1e-8) but is strict enough to catch a genuine + numerical divergence.""" + H, h01, S, s01, h10, s10 = _make_lead_problem(N, seed) + + gs_fast, _, _, _ = _surface_green_numba_core(H, h01, S, s01, h10, s10, ee) + gs_slow, _, _, _ = _surface_green_numba_core_nofastmath(H, h01, S, s01, h10, s10, ee) + + max_abs = np.max(np.abs(gs_fast - gs_slow)) + assert max_abs < 1e-10, f"fastmath deviated by {max_abs:g} at N={N}, seed={seed}, ee={ee}" + + +def _time_core(core, args, n_calls): + # warm-up: absorb JIT compile + core(*args) + t0 = time.perf_counter() + for _ in range(n_calls): + core(*args) + return (time.perf_counter() - t0) / n_calls + + +# @pytest.mark.parametrize("N,n_calls", [(256, 5), (512, 3)]) +# def test_fastmath_speedup(N, n_calls, capsys): +# """Not asserted — just prints so ``pytest -s`` shows the speedup.""" +# H, h01, S, s01, h10, s10 = _make_lead_problem(N, seed=42) +# ee = np.complex128(0.25 + 1e-5j) +# args = (H, h01, S, s01, h10, s10, ee) + +# t_fast = _time_core(_surface_green_numba_core, args, n_calls) +# t_slow = _time_core(_surface_green_numba_core_nofastmath, args, n_calls) + +# with capsys.disabled(): +# print( +# f"\n[N={N:4d}] fastmath={t_fast * 1e3:7.1f} ms " +# f"nofastmath={t_slow * 1e3:7.1f} ms " +# f"speedup={t_slow / t_fast:.2f}x" +# ) diff --git a/dpnegf/utils/argcheck.py b/dpnegf/utils/argcheck.py index 8526e8f..673c777 100644 --- a/dpnegf/utils/argcheck.py +++ b/dpnegf/utils/argcheck.py @@ -1,76 +1,15 @@ -from typing import List, Callable, Dict, Any, Union -from dargs import dargs, Argument, Variant, ArgumentEncoder +from typing import Dict, Union +from dargs import Argument, Variant import logging from numbers import Number log = logging.getLogger(__name__) -nnsk_model_config_checklist = ['unit','skfunction-skformula'] -nnsk_model_config_updatelist = ['sknetwork-sk_hop_nhidden', 'sknetwork-sk_onsite_nhidden', 'sknetwork-sk_soc_nhidden'] -dptb_model_config_checklist = ['dptb-if_batch_normalized', 'dptb-hopping_net_type', 'dptb-soc_net_type', 'dptb-env_net_type', 'dptb-onsite_net_type', 'dptb-hopping_net_activation', 'dptb-soc_net_activation', 'dptb-env_net_activation', 'dptb-onsite_net_activation', - 'dptb-hopping_net_neuron', 'dptb-env_net_neuron', 'dptb-soc_net_neuron', 'dptb-onsite_net_neuron', 'dptb-axis_neuron', 'skfunction-skformula', 'sknetwork-sk_onsite_nhidden', - 'sknetwork-sk_hop_nhidden'] - - -def gen_doc_train(*, make_anchor=True, make_link=True, **kwargs): - if make_link: - make_anchor = True - co = common_options() - tr = train_options() - da = data_options() - mo = model_options() - ptr = [] - ptr.append(co.gen_doc(make_anchor=make_anchor, make_link=make_link, **kwargs)) - ptr.append(tr.gen_doc(make_anchor=make_anchor, make_link=make_link, **kwargs)) - ptr.append(da.gen_doc(make_anchor=make_anchor, make_link=make_link, **kwargs)) - ptr.append(mo.gen_doc(make_anchor=make_anchor, make_link=make_link, **kwargs)) - - key_words = [] - for ii in "\n\n".join(ptr).split("\n"): - if "argument path" in ii: - key_words.append(ii.split(":")[1].replace("`", "").strip()) - # ptr.insert(0, make_index(key_words)) - - return "\n\n".join(ptr) - - -def gen_doc_run(*, make_anchor=True, make_link=True, **kwargs): - if make_link: - make_anchor = True - rop = run_options() - - ptr = [] - ptr.append(rop.gen_doc(make_anchor=make_anchor, make_link=make_link, **kwargs)) - - key_words = [] - for ii in "\n\n".join(ptr).split("\n"): - if "argument path" in ii: - key_words.append(ii.split(":")[1].replace("`", "").strip()) - # ptr.insert(0, make_index(key_words)) - - return "\n\n".join(ptr) - - -def gen_doc_setinfo(*, make_anchor=True, make_link=True, **kwargs): - if make_link: - make_anchor = True - sio = set_info_options() - ptr = [] - ptr.append(sio.gen_doc(make_anchor=make_anchor, make_link=make_link, **kwargs)) - - key_words = [] - for ii in "\n\n".join(ptr).split("\n"): - if "argument path" in ii: - key_words.append(ii.split(":")[1].replace("`", "").strip()) - # ptr.insert(0, make_index(key_words)) - - return "\n\n".join(ptr) - def common_options(): doc_device = "The device to run the calculation, choose among `cpu` and `cuda[:int]`, Default: `cpu`" - doc_dtype = """The digital number's precison, choose among: + doc_dtype = """The digital number's precison, choose among: Default: `float32` - `float32`: indicating torch.float32 - `float64`: indicating torch.float64 @@ -93,893 +32,33 @@ def common_options(): return Argument("common_options", dict, optional=False, sub_fields=args, sub_variants=[], doc=doc_common_options) -def train_options(): - doc_num_epoch = "Total number of training epochs. It is worth noted, if the model is reloaded with `-r` or `--restart` option, epoch which have been trained will counted from the time that the checkpoint is saved." - doc_save_freq = "Frequency, or every how many iteration to saved the current model into checkpoints, The name of checkpoint is formulated as `latest|best_dptb|nnsk_b_c_w`. Default: `10`" - doc_validation_freq = "Frequency or every how many iteration to do model validation on validation datasets. Default: `10`" - doc_display_freq = "Frequency, or every how many iteration to display the training log to screem. Default: `1`" - doc_use_tensorboard = "Set true to use tensorboard. It will record iteration error once every `25` iterations, epoch error once per epoch. " \ - "There are tree types of error will be recorded. `train_loss_iter` is iteration loss, `train_loss_last` is the error of the last iteration in an epoch, `train_loss_mean` is the mean error of all iterations in an epoch." \ - "Learning rates are tracked as well. A folder named `tensorboard_logs` will be created in the working directory. Use `tensorboard --logdir=tensorboard_logs` to view the logs." \ - "Default: `False`" - update_lr_per_step_flag = "Set true to update learning rate per-step. By default, it's false." - - doc_optimizer = "\ - The optimizer setting for selecting the gradient optimizer of model training. Optimizer supported includes `Adam`, `SGD` and `LBFGS` \n\n\ - For more information about these optmization algorithm, we refer to:\n\n\ - - `Adam`: [Adam: A Method for Stochastic Optimization.](https://arxiv.org/abs/1412.6980)\n\n\ - - `SGD`: [Stochastic Gradient Descent.](https://pytorch.org/docs/stable/generated/torch.optim.SGD.html)\n\n\ - - `LBFGS`: [On the limited memory BFGS method for large scale optimization.](http://users.iems.northwestern.edu/~nocedal/PDFfiles/limited-memory.pdf) \n\n\ - " - doc_lr_scheduler = "The learning rate scheduler tools settings, the lr scheduler is used to scales down the learning rate during the training process. Proper setting can make the training more stable and efficient. The supported lr schedular includes: `Exponential Decaying (exp)`, `Linear multiplication (linear)`, `Reduce on pleatau (rop)`, `Cyclic learning rate (cyclic)`. See more documentation on Pytorch. " - doc_batch_size = "The batch size used in training, Default: 1" - doc_ref_batch_size = "The batch size used in reference data, Default: 1" - doc_val_batch_size = "The batch size used in validation data, Default: 1" - doc_max_ckpt = "The maximum number of saved checkpoints, Default: 4" - - args = [ - Argument("num_epoch", int, optional=False, doc=doc_num_epoch), - Argument("batch_size", int, optional=True, default=1, doc=doc_batch_size), - Argument("ref_batch_size", int, optional=True, default=1, doc=doc_ref_batch_size), - Argument("val_batch_size", int, optional=True, default=1, doc=doc_val_batch_size), - Argument("optimizer", dict, sub_fields=[], optional=True, default={}, sub_variants=[optimizer()], doc = doc_optimizer), - Argument("lr_scheduler", dict, sub_fields=[], optional=True, default={}, sub_variants=[lr_scheduler()], doc = doc_lr_scheduler), - Argument("save_freq", int, optional=True, default=10, doc=doc_save_freq), - Argument("validation_freq", int, optional=True, default=10, doc=doc_validation_freq), - Argument("display_freq", int, optional=True, default=1, doc=doc_display_freq), - Argument("use_tensorboard", bool, optional=True, default=False, doc=doc_use_tensorboard), - Argument("update_lr_per_step_flag", bool, optional=True, default=False, doc=update_lr_per_step_flag), - Argument("max_ckpt", int, optional=True, default=4, doc=doc_max_ckpt), - loss_options() - ] - - doc_train_options = "Options that defines the training behaviour of DeePTB." - - return Argument("train_options", dict, sub_fields=args, sub_variants=[], optional=True, doc=doc_train_options) - -def test_options(): - doc_display_freq = "Frequency, or every how many iteration to display the training log to screem. Default: `1`" - doc_batch_size = "The batch size used in testing, Default: 1" - - args = [ - Argument("batch_size", int, optional=True, default=1, doc=doc_batch_size), - Argument("display_freq", int, optional=True, default=1, doc=doc_display_freq), - loss_options() - ] - - doc_test_options = "Options that defines the testing behaviour of DeePTB." - - return Argument("test_options", dict, sub_fields=args, sub_variants=[], optional=False, doc=doc_test_options) - - -def Adam(): - doc_lr = "learning rate. Default: 1e-3" - doc_betas = "coefficients used for computing running averages of gradient and its square Default: (0.9, 0.999)" - doc_eps = "term added to the denominator to improve numerical stability, Default: 1e-8" - doc_weight_decay = "weight decay (L2 penalty), Default: 0" - doc_amsgrad = "whether to use the AMSGrad variant of this algorithm from the paper On the [Convergence of Adam and Beyond](https://openreview.net/forum?id=ryQu7f-RZ) ,Default: False" - - return [ - Argument("lr", float, optional=True, default=1e-3, doc=doc_lr), - Argument("betas", list, optional=True, default=[0.9, 0.999], doc=doc_betas), - Argument("eps", float, optional=True, default=1e-8, doc=doc_eps), - Argument("weight_decay", float, optional=True, default=0, doc=doc_weight_decay), - Argument("amsgrad", bool, optional=True, default=False, doc=doc_amsgrad) - ] - -def SGD(): - doc_lr = "learning rate. Default: 1e-3" - doc_weight_decay = "weight decay (L2 penalty), Default: 0" - doc_momentum = "momentum factor Default: 0" - doc_dampening = "dampening for momentum, Default: 0" - doc_nesterov = "enables Nesterov momentum, Default: False" - - return [ - Argument("lr", float, optional=True, default=1e-3, doc=doc_lr), - Argument("momentum", float, optional=True, default=0., doc=doc_momentum), - Argument("weight_decay", float, optional=True, default=0., doc=doc_weight_decay), - Argument("dampening", float, optional=True, default=0., doc=doc_dampening), - Argument("nesterov", bool, optional=True, default=False, doc=doc_nesterov) - ] - - -def RMSprop(): - doc_lr = "learning rate. Default: 1e-2" - doc_alpha = "smoothing constant, Default: 0.99" - doc_eps = "term added to the denominator to improve numerical stability, Default: 1e-8" - doc_weight_decay = "weight decay (L2 penalty), Default: 0" - doc_momentum = "momentum factor, Default: 0" - doc_centered = "if True, compute the centered RMSProp, the gradient is normalized by an estimation of its variance, Default: False" - - return [ - Argument("lr", float, optional=True, default=1e-2, doc=doc_lr), - Argument("alpha", float, optional=True, default=0.99, doc=doc_alpha), - Argument("eps", float, optional=True, default=1e-8, doc=doc_eps), - Argument("weight_decay", float, optional=True, default=0, doc=doc_weight_decay), - Argument("momentum", float, optional=True, default=0, doc=doc_momentum), - Argument("centered", bool, optional=True, default=False, doc=doc_centered) - ] - - -def LBFGS(): - doc_lr = "learning rate. Default: 1" - doc_max_iter = "maximal number of iterations per optimization step. Default: 20" - doc_max_eval = "maximal number of function evaluations per optimization step. Default: None -> max_iter*1.25" - # doc_tolerance_grad = "termination tolerance on first order optimality (default: 1e-7)." - # doc_line_search_fn = "either 'strong_wolfe' or None (default: None)." - # doc_history_size = "update history size. Default: 100" - # doc_tolerance_change = "termination tolerance on function value/parameter changes (default: 1e-9)." - - return [ - Argument("lr", float, optional=True, default=1, doc=doc_lr), - Argument("max_iter", int, optional=True, default=20, doc=doc_max_iter), - Argument("max_eval", int, optional=True, default=None, doc=doc_max_eval) - ] - -def optimizer(): - doc_type = "select type of optimizer, support type includes: `Adam`, `SGD` and `LBFGS`. Default: `Adam`" - - return Variant("type", [ - Argument("Adam", dict, Adam()), - Argument("SGD", dict, SGD()), - Argument("RMSprop", dict, RMSprop()), - Argument("LBFGS", dict, LBFGS()), - ],optional=True, default_tag="Adam", doc=doc_type) - -def ExponentialLR(): - doc_gamma = "Multiplicative factor of learning rate decay." - - return [ - Argument("gamma", float, optional=True, default=0.999, doc=doc_gamma) - ] - -def LinearLR(): - doc_start_factor = "The number we multiply learning rate in the first epoch. \ - The multiplication factor changes towards end_factor in the following epochs. Default: 1./3." - doc_end_factor = "The number we multiply learning rate in the first epoch. \ - The multiplication factor changes towards end_factor in the following epochs. Default: 1./3." - doc_total_iters = "The number of iterations that multiplicative factor reaches to 1. Default: 5." - - return [ - Argument("start_factor", float, optional=True, default=0.3333333, doc=doc_start_factor), - Argument("end_factor", float, optional=True, default=0.3333333, doc=doc_end_factor), - Argument("total_iters", int, optional=True, default=5, doc=doc_total_iters) - ] - -def ReduceOnPlateau(): - doc_mode = "One of min, max. In min mode, lr will be reduced when the quantity monitored has stopped decreasing; \ - in max mode it will be reduced when the quantity monitored has stopped increasing. Default: 'min'." - doc_factor = "Factor by which the learning rate will be reduced. new_lr = lr * factor. Default: 0.1." - doc_patience = "Number of epochs with no improvement after which learning rate will be reduced. For example, \ - if patience = 2, then we will ignore the first 2 epochs with no improvement, \ - and will only decrease the LR after the 3rd epoch if the loss still hasn't improved then. Default: 10." - doc_threshold = "Threshold for measuring the new optimum, to only focus on significant changes. Default: 1e-4." - doc_threshold_mode = "One of rel, abs. In rel mode, dynamic_threshold = best * ( 1 + threshold ) in 'max' mode or \ - best * ( 1 - threshold ) in min mode. In abs mode, \ - dynamic_threshold = best + threshold in max mode or best - threshold in min mode. Default: 'rel'." - doc_cooldown = "Number of epochs to wait before resuming normal operation after lr has been reduced. Default: 0." - doc_min_lr = "A scalar or a list of scalars. \ - A lower bound on the learning rate of all param groups or each group respectively. Default: 0." - doc_eps = "Minimal decay applied to lr. \ - If the difference between new and old lr is smaller than eps, the update is ignored. Default: 1e-8." - - return [ - Argument("mode", str, optional=True, default="min", doc=doc_mode), - Argument("factor", float, optional=True, default=0.1, doc=doc_factor), - Argument("patience", int, optional=True, default=10, doc=doc_patience), - Argument("threshold", float, optional=True, default=1e-4, doc=doc_threshold), - Argument("threshold_mode", str, optional=True, default="rel", doc=doc_threshold_mode), - Argument("cooldown", int, optional=True, default=0, doc=doc_cooldown), - Argument("min_lr", [float, list], optional=True, default=0, doc=doc_min_lr), - Argument("eps", float, optional=True, default=1e-8, doc=doc_eps), - ] - -def CyclicLR(): - doc_base_lr = "Initial learning rate which is the lower boundary in the cycle for each parameter group." - doc_max_lr = "Upper learning rate boundaries in the cycle for each parameter group. Functionally, it defines the cycle amplitude (max_lr - base_lr). The lr at any cycle is the sum of base_lr and some scaling of the amplitude; therefore max_lr may not actually be reached depending on scaling function." - doc_step_size_up = "Number of training iterations in the increasing half of a cycle. Default: 2000" - doc_step_size_down = "Number of training iterations in the decreasing half of a cycle. If step_size_down is None, it is set to step_size_up. Default: None" - doc_mode = "One of {triangular, triangular2, exp_range}. Values correspond to policies detailed above. If scale_fn is not None, this argument is ignored. Default: 'triangular'" - doc_gamma = "Constant in 'exp_range' scaling function: gamma**(cycle iterations) Default: 1.0" - doc_scale_fn = "Custom scaling policy defined by a single argument lambda function, where 0 <= scale_fn(x) <= 1 for all x >= 0. If specified, then 'mode' is ignored. Default: None" - doc_scale_mode = "{'cycle', 'iterations'}. Defines whether scale_fn is evaluated on cycle number or cycle iterations (training iterations since start of cycle). Default: 'cycle'" - doc_cycle_momentum = "If True, momentum is cycled inversely to learning rate between 'base_momentum' and 'max_momentum'. Default: True" - doc_base_momentum = "Lower momentum boundaries in the cycle for each parameter group. Note that momentum is cycled inversely to learning rate; at the start of a cycle, momentum is 'max_momentum' and learning rate is 'base_lr'. Default: 0.8" - doc_max_momentum = "Upper momentum boundaries in the cycle for each parameter group. Functionally, it defines the cycle amplitude (max_momentum - base_momentum). The momentum at any cycle is the difference of max_momentum and some scaling of the amplitude; therefore base_momentum may not actually be reached depending on scaling function. Note that momentum is cycled inversely to learning rate; at the start of a cycle, momentum is 'max_momentum' and learning rate is 'base_lr'. Default: 0.9" - doc_last_epoch = "The index of the last batch. This parameter is used when resuming a training job. Since step() should be invoked after each batch instead of after each epoch, this number represents the total number of batches computed, not the total number of epochs computed. When last_epoch=-1, the schedule is started from the beginning. Default: -1" - doc_verbose = "If True, prints a message to stdout for each update. Default: False." - - return [ - Argument("base_lr", [float, list], optional=False, doc=doc_base_lr), - Argument("max_lr", [float, list], optional=False, doc=doc_max_lr), - Argument("step_size_up", int, optional=True, default=10, doc=doc_step_size_up), - Argument("step_size_down", int, optional=True, default=40, doc=doc_step_size_down), - Argument("mode", str, optional=True, default="exp_range", doc=doc_mode), - Argument("gamma", float, optional=True, default=1.0, doc=doc_gamma), - Argument("scale_fn", object, optional=True, default=None, doc=doc_scale_fn), - Argument("scale_mode", str, optional=True, default="cycle", doc=doc_scale_mode), - Argument("cycle_momentum", bool, optional=True, default=False, doc=doc_cycle_momentum), - Argument("base_momentum", [float, list], optional=True, default=0.8, doc=doc_base_momentum), - Argument("max_momentum", [float, list], optional=True, default=0.9, doc=doc_max_momentum), - Argument("last_epoch", int, optional=True, default=-1, doc=doc_last_epoch), - Argument("verbose", [bool, str], optional=True, default="deprecated", doc=doc_verbose) - ] - - -def CosineAnnealingLR(): - doc_T_max = "Maximum number of iterations. Default: 100." - doc_eta_min = "Minimum learning rate. Default: 0." - - return [ - Argument("T_max", int, optional=True, default=100, doc=doc_T_max), - Argument("eta_min", float, optional=True, default=0, doc=doc_eta_min), - ] - -def lr_scheduler(): - doc_type = "select type of lr_scheduler, support type includes `exp`, `linear`" - - return Variant("type", [ - Argument("exp", dict, ExponentialLR()), - Argument("linear", dict, LinearLR()), - Argument("rop", dict, ReduceOnPlateau(), doc="rop: reduce on plateau"), - Argument("cos", dict, CosineAnnealingLR(), doc="cos: cosine annealing"), - Argument("cyclic", dict, CyclicLR(), doc="Cyclic learning rate") - ],optional=True, default_tag="exp", doc=doc_type) - - -def train_data_sub(): - doc_root = "This is where the dataset stores data files." - doc_prefix = "The prefix of the folders under root, which will be loaded in dataset." - doc_ham = "Choose whether the Hamiltonian blocks (and overlap blocks, if provided) are loaded when building dataset." - doc_eig = "Choose whether the eigenvalues and k-points are loaded when building dataset." - doc_vlp = "Choose whether the overlap blocks are loaded when building dataset." - doc_DM = "Choose whether the density matrix is loaded when building dataset." - doc_separator = "the sepatator used to separate the prefix and suffix in the dataset directory. Default: '.'" - - args = [ - Argument("type", str, optional=True, default="DefaultDataset", doc="The type of dataset."), - Argument("root", str, optional=False, doc=doc_root), - Argument("prefix", str, optional=True, default=None, doc=doc_prefix), - Argument("separator", str, optional=True, default='.', doc=doc_separator), - Argument("get_Hamiltonian", bool, optional=True, default=False, doc=doc_ham), - Argument("get_overlap", bool, optional=True, default=False, doc=doc_vlp), - Argument("get_DM", bool, optional=True, default=False, doc=doc_DM), - Argument("get_eigenvalues", bool, optional=True, default=False, doc=doc_eig) - ] - - doc_train = "The dataset settings for training." - - return Argument("train", dict, optional=False, sub_fields=args, sub_variants=[], doc=doc_train) - -def validation_data_sub(): - doc_root = "This is where the dataset stores data files." - doc_prefix = "The prefix of the folders under root, which will be loaded in dataset." - doc_ham = "Choose whether the Hamiltonian blocks (and overlap blocks, if provided) are loaded when building dataset." - doc_eig = "Choose whether the eigenvalues and k-points are loaded when building dataset." - doc_vlp = "Choose whether the overlap blocks are loaded when building dataset." - doc_DM = "Choose whether the density matrix is loaded when building dataset." - doc_separator = "the sepatator used to separate the prefix and suffix in the dataset directory. Default: '.'" - - args = [ - Argument("type", str, optional=True, default="DefaultDataset", doc="The type of dataset."), - Argument("root", str, optional=False, doc=doc_root), - Argument("prefix", str, optional=True, default=None, doc=doc_prefix), - Argument("separator", str, optional=True, default='.', doc=doc_separator), - Argument("get_Hamiltonian", bool, optional=True, default=False, doc=doc_ham), - Argument("get_overlap", bool, optional=True, default=False, doc=doc_vlp), - Argument("get_DM", bool, optional=True, default=False, doc=doc_DM), - Argument("get_eigenvalues", bool, optional=True, default=False, doc=doc_eig) - ] - - doc_validation = "The dataset settings for validation." - - return Argument("validation", dict, optional=True, sub_fields=args, sub_variants=[], doc=doc_validation) - -def reference_data_sub(): - doc_root = "This is where the dataset stores data files." - doc_prefix = "The prefix of the folders under root, which will be loaded in dataset." - doc_ham = "Choose whether the Hamiltonian blocks (and overlap blocks, if provided) are loaded when building dataset." - doc_eig = "Choose whether the eigenvalues and k-points are loaded when building dataset." - doc_vlp = "Choose whether the overlap blocks are loaded when building dataset." - doc_DM = "Choose whether the density matrix is loaded when building dataset." - doc_separator = "the sepatator used to separate the prefix and suffix in the dataset directory. Default: '.'" - - args = [ - Argument("type", str, optional=True, default="DefaultDataset", doc="The type of dataset."), - Argument("root", str, optional=False, doc=doc_root), - Argument("prefix", str, optional=True, default=None, doc=doc_prefix), - Argument("separator", str, optional=True, default='.', doc=doc_separator), - Argument("get_Hamiltonian", bool, optional=True, default=False, doc=doc_ham), - Argument("get_overlap", bool, optional=True, default=False, doc=doc_vlp), - Argument("get_DM", bool, optional=True, default=False, doc=doc_DM), - Argument("get_eigenvalues", bool, optional=True, default=False, doc=doc_eig) - ] - - doc_reference = "The dataset settings for reference." - - return Argument("reference", dict, optional=True, sub_fields=args, sub_variants=[], doc=doc_reference) - -def test_data_sub(): - doc_root = "This is where the dataset stores data files." - doc_prefix = "The prefix of the folders under root, which will be loaded in dataset." - doc_ham = "Choose whether the Hamiltonian blocks (and overlap blocks, if provided) are loaded when building dataset." - doc_eig = "Choose whether the eigenvalues and k-points are loaded when building dataset." - doc_vlp = "Choose whether the overlap blocks are loaded when building dataset." - doc_DM = "Choose whether the density matrix is loaded when building dataset." - doc_separator = "the sepatator used to separate the prefix and suffix in the dataset directory. Default: '.'" - - args = [ - Argument("type", str, optional=True, default="DefaultDataset", doc="The type of dataset."), - Argument("root", str, optional=False, doc=doc_root), - Argument("prefix", str, optional=True, default=None, doc=doc_prefix), - Argument("get_Hamiltonian", bool, optional=True, default=False, doc=doc_ham), - Argument("get_eigenvalues", bool, optional=True, default=False, doc=doc_eig), - Argument("get_overlap", bool, optional=True, default=False, doc=doc_vlp), - Argument("get_DM", bool, optional=True, default=False, doc=doc_DM), - Argument("separator", str, optional=True, default='.', doc=doc_separator) - ] - - doc_test = "The dataset settings for testing." - - return Argument("test", dict, optional=False, sub_fields=args, default={}, sub_variants=[], doc=doc_test) - - -def data_options(): - args = [ - Argument("r_max", [float,int], optional=True, default=5.0, doc="r_max"), - Argument("oer_max", [float,int], optional=True, default=5.0, doc="oer_max"), - Argument("er_max", [float,int], optional=True, default=5.0, doc="er_max"), - train_data_sub(), - validation_data_sub(), - reference_data_sub() - ] - - doc_data_options = "The options for dataset settings in training." - - return Argument("data_options", dict, sub_fields=args, sub_variants=[], optional=False, doc=doc_data_options) - -def test_data_options(): - - args = [ - test_data_sub() - ] - - doc_test_data_options = "The options for dataset settings in testing" - - return Argument("data_options", dict, sub_fields=args, sub_variants=[], optional=False, doc=doc_test_data_options) - - -def embedding(): - doc_method = "The parameters to define the embedding model." - - return Variant("method", [ - Argument("se2", dict, se2()), - Argument("baseline", dict, baseline()), - Argument("deeph-e3", dict, deephe3()), - Argument("e3baseline_5", dict, e3baselinev5()), - Argument("e3baseline_6", dict, e3baselinev5()), - Argument("slem", dict, slem()), - Argument("lem", dict, slem()), - Argument("e3baseline_nonlocal", dict, e3baselinev5()), - ],optional=True, default_tag="se2", doc=doc_method) - -def se2(): - - doc_rs = "The soft cutoff where the smooth function starts." - doc_rc = "The hard cutoff where the smooth function value ~0.0" - doc_n_axis = "the out axis shape of the deepmd-se2 descriptor." - doc_radial_net = "network to build the descriptors." - - doc_neurons = "the size of nn for descriptor" - doc_activation = "activation" - doc_if_batch_normalized = "whether to turn on the batch normalization." - - radial_net = [ - Argument("neurons", list, optional=False, doc=doc_neurons), - Argument("activation", str, optional=True, default="tanh", doc=doc_activation), - Argument("if_batch_normalized", bool, optional=True, default=False, doc=doc_if_batch_normalized), - ] - - return [ - Argument("rs", [float, int], optional=False, doc=doc_rs), - Argument("rc", [float, int], optional=False, doc=doc_rc), - Argument("radial_net", dict, sub_fields=radial_net, optional=False, doc=doc_radial_net), - Argument("n_axis", [int, None], optional=True, default=None, doc=doc_n_axis), - ] - - -def baseline(): - - doc_rs = "" - doc_rc = "" - doc_n_axis = "" - doc_radial_embedding = "" - - doc_neurons = "" - doc_activation = "" - doc_if_batch_normalized = "" - - radial_embedding = [ - Argument("neurons", list, optional=False, doc=doc_neurons), - Argument("activation", str, optional=True, default="tanh", doc=doc_activation), - Argument("if_batch_normalized", bool, optional=True, default=False, doc=doc_if_batch_normalized), - ] - - return [ - Argument("p", [float, int], optional=False, doc=doc_rs), - Argument("rc", [float, int], optional=False, doc=doc_rc), - Argument("n_basis", int, optional=False, doc=doc_rc), - Argument("n_radial", int, optional=False, doc=doc_rc), - Argument("n_sqrt_radial", int, optional=False, doc=doc_rc), - Argument("n_layer", int, optional=False, doc=doc_rc), - Argument("radial_net", dict, sub_fields=radial_embedding, optional=False, doc=doc_radial_embedding), - Argument("hidden_net", dict, sub_fields=radial_embedding, optional=False, doc=doc_radial_embedding), - Argument("n_axis", [int, None], optional=True, default=None, doc=doc_n_axis), - ] - -def deephe3(): - doc_irreps_embed = "" - doc_irreps_mid = "" - doc_lmax = "" - doc_n_basis = "" - doc_rc = "" - doc_n_layer = "" - - return [ - Argument("irreps_embed", str, optional=True, default="64x0e", doc=doc_irreps_embed), - Argument("irreps_mid", str, optional=True, default="64x0e+32x1o+16x2e+8x3o+8x4e+4x5o", doc=doc_irreps_mid), - Argument("lmax", int, optional=True, default=3, doc=doc_lmax), - Argument("n_basis", int, optional=True, default=128, doc=doc_n_basis), - Argument("rc", float, optional=False, doc=doc_rc), - Argument("n_layer", int, optional=True, default=3, doc=doc_n_layer), - ] - -def e3baseline(): - doc_irreps_hidden = "" - doc_lmax = "" - doc_avg_num_neighbors = "" - doc_n_radial_basis = "" - doc_r_max = "" - doc_n_layers = "" - doc_env_embed_multiplicity = "" - doc_linear_after_env_embed = "" - doc_latent_resnet_update_ratios_learnable = "" - doc_latent_kwargs = "" - - return [ - Argument("irreps_hidden", str, optional=True, default="64x0e+32x1o+16x2e+8x3o+8x4e+4x5o", doc=doc_irreps_hidden), - Argument("lmax", int, optional=True, default=3, doc=doc_lmax), - Argument("avg_num_neighbors", [int, float], optional=True, default=50, doc=doc_avg_num_neighbors), - Argument("r_max", [float, int, dict], optional=False, doc=doc_r_max), - Argument("n_layers", int, optional=True, default=3, doc=doc_n_layers), - Argument("n_radial_basis", int, optional=True, default=3, doc=doc_n_radial_basis), - Argument("PolynomialCutoff_p", int, optional=True, default=6, doc="The order of polynomial cutoff function. Default: 6"), - Argument( - "latent_kwargs", dict, - optional={ - "mlp_latent_dimensions": [128, 128, 256], - "mlp_nonlinearity": "silu", - "mlp_initialization": "uniform" - }, - default=None, - doc=doc_latent_kwargs - ), - Argument("env_embed_multiplicity", int, optional=True, default=1, doc=doc_env_embed_multiplicity), - Argument("linear_after_env_embed", bool, optional=True, default=False, doc=doc_linear_after_env_embed), - Argument("latent_resnet_update_ratios_learnable", bool, optional=True, default=False, doc=doc_latent_resnet_update_ratios_learnable) - ] - -def e3baselinev5(): - doc_irreps_hidden = "" - doc_lmax = "" - doc_avg_num_neighbors = "" - doc_n_radial_basis = "" - doc_r_max = "" - doc_n_layers = "" - doc_env_embed_multiplicity = "" - - return [ - Argument("irreps_hidden", str, optional=False, doc=doc_irreps_hidden), - Argument("lmax", int, optional=False, doc=doc_lmax), - Argument("avg_num_neighbors", [int, float], optional=False, doc=doc_avg_num_neighbors), - Argument("r_max", [float, int, dict], optional=False, doc=doc_r_max), - Argument("n_layers", int, optional=False, doc=doc_n_layers), - Argument("n_radial_basis", int, optional=True, default=10, doc=doc_n_radial_basis), - Argument("PolynomialCutoff_p", int, optional=True, default=6, doc="The order of polynomial cutoff function. Default: 6"), - Argument("cutoff_type", str, optional=True, default="polynomial", doc="The type of cutoff function. Default: polynomial"), - Argument("env_embed_multiplicity", int, optional=True, default=1, doc=doc_env_embed_multiplicity), - Argument("tp_radial_emb", bool, optional=True, default=False, doc="Whether to use tensor product radial embedding."), - Argument("tp_radial_channels", list, optional=True, default=[128, 128], doc="The number of channels in tensor product radial embedding."), - Argument("latent_channels", list, optional=True, default=[128, 128], doc="The number of channels in latent embedding."), - Argument("latent_dim", int, optional=True, default=256, doc="The dimension of latent embedding."), - Argument("res_update", bool, optional=True, default=True, doc="Whether to use residual update."), - Argument("res_update_ratios", float, optional=True, default=0.5, doc="The ratios of residual update, should in (0,1)."), - Argument("res_update_ratios_learnable", bool, optional=True, default=False, doc="Whether to make the ratios of residual update learnable."), - ] - -def slem(): - doc_irreps_hidden = "" - doc_avg_num_neighbors = "" - doc_n_radial_basis = "" - doc_r_max = "" - doc_n_layers = "" - doc_env_embed_multiplicity = "" - - return [ - Argument("irreps_hidden", str, optional=False, doc=doc_irreps_hidden), - Argument("avg_num_neighbors", [int, float], optional=False, doc=doc_avg_num_neighbors), - Argument("r_max", [float, int, dict], optional=False, doc=doc_r_max), - Argument("n_layers", int, optional=False, doc=doc_n_layers), - - Argument("n_radial_basis", int, optional=True, default=10, doc=doc_n_radial_basis), - Argument("PolynomialCutoff_p", int, optional=True, default=6, doc="The order of polynomial cutoff function. Default: 6"), - Argument("cutoff_type", str, optional=True, default="polynomial", doc="The type of cutoff function. Default: polynomial"), - Argument("env_embed_multiplicity", int, optional=True, default=10, doc=doc_env_embed_multiplicity), - Argument("tp_radial_emb", bool, optional=True, default=False, doc="Whether to use tensor product radial embedding."), - Argument("tp_radial_channels", list, optional=True, default=[32], doc="The number of channels in tensor product radial embedding."), - Argument("latent_channels", list, optional=True, default=[32], doc="The number of channels in latent embedding."), - Argument("latent_dim", int, optional=True, default=64, doc="The dimension of latent embedding."), - Argument("res_update", bool, optional=True, default=True, doc="Whether to use residual update."), - Argument("res_update_ratios", float, optional=True, default=0.5, doc="The ratios of residual update, should in (0,1)."), - Argument("res_update_ratios_learnable", bool, optional=True, default=False, doc="Whether to make the ratios of residual update learnable."), - ] - - -def prediction(): - doc_method = "The options to indicate the prediction model. Can be sktb or e3tb." - doc_nn = "neural network options for prediction model." - - return Variant("method", [ - Argument("sktb", dict, sktb_prediction(), doc=doc_nn), - Argument("e3tb", dict, e3tb_prediction(), doc=doc_nn), - ], optional=False, doc=doc_method) - -def sktb_prediction(): - doc_neurons = "neurons in the neural network." - doc_activation = "activation function." - doc_if_batch_normalized = "if to turn on batch normalization" - - nn = [ - Argument("neurons", list, optional=False, doc=doc_neurons), - Argument("activation", str, optional=True, default="tanh", doc=doc_activation), - Argument("if_batch_normalized", bool, optional=True, default=False, doc=doc_if_batch_normalized), - ] - - return nn - - -def e3tb_prediction(): - doc_scales_trainable = "whether to scale the trianing target." - doc_shifts_trainable = "whether to shift the training target." - doc_neurons = "neurons in the neural network." - doc_activation = "activation function." - doc_if_batch_normalized = "if to turn on batch normalization" - - nn = [ - Argument("scales_trainable", bool, optional=True, default=False, doc=doc_scales_trainable), - Argument("shifts_trainable", bool, optional=True, default=False, doc=doc_shifts_trainable), - Argument("neurons", list, optional=True, default=None, doc=doc_neurons), - Argument("activation", str, optional=True, default="tanh", doc=doc_activation), - Argument("if_batch_normalized", bool, optional=True, default=False, doc=doc_if_batch_normalized), - ] - - return nn - - - -def model_options(): - - doc_model_options = "The parameters to define the `nnsk`,`mix` and `dptb` model." - doc_embedding = "The parameters to define the embedding model." - doc_prediction = "The parameters to define the prediction model" - - return Argument("model_options", dict, sub_fields=[ - Argument("embedding", dict, optional=True, sub_fields=[], sub_variants=[embedding()], doc=doc_embedding), - Argument("prediction", dict, optional=True, sub_fields=[], sub_variants=[prediction()], doc=doc_prediction), - nnsk(), - dftbsk(), - ], sub_variants=[], optional=True, doc=doc_model_options) - -def dftbsk(): - doc_dftbsk = "The parameters to define the dftb sk model." - - return Argument("dftbsk", dict, sub_fields=[ - Argument("skdata", str, optional=False, doc="The path to the skfile or sk database."), - Argument("r_max", float, optional=False, doc="the cutoff values to use sk files."), - ], sub_variants=[], optional=True, doc=doc_dftbsk) - -def nnsk(): - doc_nnsk = "The parameters to define the nnsk model." - doc_onsite = "The onsite options to define the onsite of nnsk model." - doc_hopping = "The hopping options to define the hopping of nnsk model." - doc_soc = """The soc options to define the soc of nnsk model, - Default: {} # empty dict\n - - {'method':'none'} : use database soc value. - - {'method':uniform} : set lambda_il; assign a soc lambda value for each orbital -l on each atomtype i; l=0,1,2 for s p d.""" - doc_freeze = """The parameters to define the freeze of nnsk model can be bool and string and list.\n - Default: False\n - - True: freeze all the nnsk parameters\n - - False: train all the nnsk parameters\n - - 'hopping','onsite','overlap' and 'soc' to freeze the corresponding parameters. - - list of the strings e.g. ['overlap','soc'] to freeze both overlap and soc parameters.""" - doc_std = "The std value to initialize the nnsk parameters. Default: 0.01" - - # overlap = Argument("overlap", bool, optional=True, default=False, doc="The parameters to define the overlap correction of nnsk model.") - - return Argument("nnsk", dict, sub_fields=[ - Argument("onsite", dict, optional=False, sub_fields=[], sub_variants=[onsite()], doc=doc_onsite), - Argument("hopping", dict, optional=False, sub_fields=[], sub_variants=[hopping()], doc=doc_hopping), - Argument("soc", dict, optional=True, default={}, doc=doc_soc), - Argument("freeze", [bool,str,list], optional=True, default=False, doc=doc_freeze), - Argument("std", float, optional=True, default=0.01, doc=doc_std), - push(), - ], sub_variants=[], optional=True, doc=doc_nnsk) - -def push(): - doc_rs_thr = "The step size for cutoff value for smooth function in the nnsk anlytical formula." - doc_rc_thr = "The step size for cutoff value for smooth function in the nnsk anlytical formula." - doc_w_thr = "The step size for decay factor w." - doc_ovp_thr = "The step size for overlap reduction" - doc_period = "the interval of iterations to modify the rs w values." - - return Argument("push", [bool,dict], sub_fields=[ - Argument("rs_thr", [int,float], optional=True, default=0., doc=doc_rs_thr), - Argument("rc_thr", [int,float], optional=True, default=0., doc=doc_rc_thr), - Argument("w_thr", [int,float], optional=True, default=0., doc=doc_w_thr), - Argument("ovp_thr", [int,float], optional=True, default=0., doc=doc_ovp_thr), - Argument("period", int, optional=True, default=100, doc=doc_period), - ], sub_variants=[], optional=True, default=False, doc="The parameters to define the push the soft cutoff of nnsk model.") - -def onsite(): - doc_method = r"""The onsite correction mode, the onsite energy is expressed as the energy of isolated atoms plus the model correction, the correction mode are: - Default: `none`: use the database onsite energy value. - - `strain`: The strain mode correct the onsite matrix densly by $$H_{i,i}^{lm,l^\prime m^\prime} = \epsilon_l^0 \delta_{ll^\prime}\delta_{mm^\prime} + \sum_p \sum_{\zeta} \Big[ \mathcal{U}_{\zeta}(\hat{\br}_{ip}) \ \epsilon_{ll^\prime \zeta} \Big]_{mm^\prime}$$ which is also parameterized as a set of Slater-Koster like integrals.\n\n\ - - `uniform`: The correction is a energy shift respect of orbital of each atom. Which is formally written as: - $$H_{i,i}^{lm,l^\prime m^\prime} = (\epsilon_l^0+\epsilon_l^\prime) \delta_{ll^\prime}\delta_{mm^\prime}$$ Where $\epsilon_l^0$ is the isolated energy level from the DeePTB onsite database, and $\epsilon_l^\prime$ is the parameters to fit. - - `NRL`: use the NRL-TB formula. - """ - - doc_rs = "The smooth cutoff `fc` for strain model. rs is where fc = 0.5" - doc_w = "The decay factor of `fc` for strain and nrl model." - doc_rc = "The smooth cutoff of `fc` for nrl model, rc is where fc ~ 0.0" - doc_lda = "The lambda type encoding value in nrl model. now only support elementary substance" - - strain = [ - Argument("rs", float, optional=True, default=6.0, doc=doc_rs), - Argument("w", float, optional=True, default=0.1, doc=doc_w), - ] - - NRL = [ - Argument("rs", float, optional=True, default=6.0, doc=doc_rc), - Argument("w", float, optional=True, default=0.1, doc=doc_w), - Argument("lda", float, optional=True, default=1.0, doc=doc_lda) - ] - - return Variant("method", [ - Argument("strain", dict, strain), - Argument("uniform", dict, []), - Argument("NRL", dict, NRL), - Argument("none", dict, []), - ],optional=False, doc=doc_method) - -def hopping(): - doc_method = """The hopping formula. - - `powerlaw`: the powerlaw formula for bond length dependence for sk integrals. - - `varTang96`: a variational formula based on Tang96 formula. - - `NRL0`: the old version of NRL formula for overlap, we set overlap and hopping share same options. - - `NRL1`: the new version of NRL formula for overlap. - """ - doc_rs_soft = "The cut-off for smooth function fc for powerlaw and varTang96, fc(rs)=0.5" - doc_w = " The decay w in fc" - doc_rs_hard = "The cut-off for smooth function fc, fc(rs) = 0." - - powerlaw = [ - Argument("rs", float, optional=True, default=6.0, doc=doc_rs_soft), - Argument("w", float, optional=True, default=0.1, doc=doc_w), - ] - varTang96 = [ - Argument("rs", float, optional=True, default=6.0, doc=doc_rs_soft), - Argument("w", float, optional=True, default=0.1, doc=doc_w), - ] - common_params = [ - Argument("rs", float, optional=True, default=6.0, doc=doc_rs_hard), - Argument("w", float, optional=True, default=0.1, doc=doc_w), - ] - - formulas = [ - 'poly1pow', - 'poly2pow', - 'poly3pow', - 'poly4pow', - 'poly2exp', - 'poly3exp', - 'poly4exp', - 'NRL0', - "NRL1"] - - args = [ - Argument("powerlaw", dict, powerlaw), - Argument("varTang96", dict, varTang96), - Argument("custom", dict, []) - ] - - for ii in formulas: - args.append(Argument(ii, dict, common_params)) - - return Variant("method", args,optional=False, doc=doc_method) - - -def loss_options(): - doc_method = """The loss function type, defined by a string like `_`, Default: `eigs_l2dsf`. supported loss functions includes:\n\n\ - - `eigvals`: The mse loss predicted and labeled eigenvalues and Delta eigenvalues between different k. - - `hamil`: - - `hamil_abs`: - - `hamil_blas`: - """ - doc_train = "Loss options for training." - doc_validation = "Loss options for validation." - doc_reference = "Loss options for reference data in training." - - hamil = [ - Argument("onsite_shift", bool, optional=True, default=False, doc="Whether to use onsite shift in loss function. Default: False"), - ] - - wt = [ - Argument("onsite_weight", [int, float, dict], optional=True, default=1., doc="Whether to use onsite shift in loss function. Default: False"), - Argument("hopping_weight", [int, float, dict], optional=True, default=1., doc="Whether to use onsite shift in loss function. Default: False"), - ] - - eigvals = [ - Argument("diff_on", bool, optional=True, default=False, doc="Whether to use random differences in loss function. Default: False"), - Argument("eout_weight", float, optional=True, default=0.01, doc="The weight of eigenvalue out of range. Default: 0.01"), - Argument("diff_weight", float, optional=True, default=0.01, doc="The weight of eigenvalue difference. Default: 0.01"), - Argument("diff_valence", [dict,None], optional=True, default=None, doc="set the difference of the number of valence electrons in DFT and TB. eg {'A':6,'B':7}, Default: None, which means no difference"), - Argument("spin_deg", int, optional=True, default=2, doc="The spin degeneracy of band structure. Default: 2"), - ] - - eig_ham = [ - Argument("coeff_ham", float, optional=True, default=1., doc="The coefficient of the hamiltonian penalty. Default: 1"), - Argument("coeff_ovp", float, optional=True, default=1., doc="The coefficient of the hamiltonian penalty. Default: 1"), - ] - - skints = [ - Argument("skdata", str, optional=False, doc="The path to the skfile or sk database."), - ] - - loss_args = Variant("method", [ - # Argument("hamil", dict, sub_fields=hamil), - Argument("eigvals", dict, sub_fields=eigvals), - Argument("skints", dict, sub_fields=skints), - Argument("hamil_abs", dict, sub_fields=hamil), - Argument("hamil_blas", dict, sub_fields=hamil), - Argument("hamil_wt", dict, sub_fields=hamil+wt), - Argument("eig_ham", dict, sub_fields=hamil+eigvals+eig_ham), - ], optional=False, doc=doc_method) - - - - args = [ - Argument("train", dict, optional=False, sub_fields=[], sub_variants=[loss_args], doc=doc_train), - Argument("validation", dict, optional=True, sub_fields=[], sub_variants=[loss_args], doc=doc_validation), - Argument("reference", dict, optional=True, sub_fields=[], sub_variants=[loss_args], doc=doc_reference), - ] - - doc_loss_options = "" - return Argument("loss_options", dict, sub_fields=args, sub_variants=[], optional=False, doc=doc_loss_options) - - -def normalize(data): - - co = common_options() - tr = train_options() - da = data_options() - mo = model_options() - - base = Argument("base", dict, [co, tr, da, mo]) - data = base.normalize_value(data) - # data = base.normalize_value(data, trim_pattern="_*") - base.check_value(data, strict=True) - - # add check loss and use wannier: - - # if data['data_options']['use_wannier']: - # if not data['loss_options']['losstype'] .startswith("block"): - # log.info(msg='\n Warning! set data_options use_wannier true, but the loss type is not block_l2! The the wannier TB will not be used when training!\n') - - # if data['loss_options']['losstype'] .startswith("block"): - # if not data['data_options']['use_wannier']: - # log.error(msg="\n ERROR! for block loss type, must set data_options:use_wannier True\n") - # raise ValueError - - return data - -# def normalize_restart(data): - -# co = common_options() -# da = data_options() - -# base = Argument("base", dict, [co, da]) -# data = base.normalize_value(data) -# # data = base.normalize_value(data, trim_pattern="_*") -# base.check_value(data, strict=True) - -# # add check loss and use wannier: - -# # if data['data_options']['use_wannier']: -# # if not data['loss_options']['losstype'] .startswith("block"): -# # log.info(msg='\n Warning! set data_options use_wannier true, but the loss type is not block_l2! The the wannier TB will not be used when training!\n') - -# # if data['loss_options']['losstype'] .startswith("block"): -# # if not data['data_options']['use_wannier']: -# # log.error(msg="\n ERROR! for block loss type, must set data_options:use_wannier True\n") -# # raise ValueError - -# return data - -# def normalize_init_model(data): - -# co = common_options() -# da = data_options() -# tr = train_options() - -# base = Argument("base", dict, [co, da, tr]) -# data = base.normalize_value(data) -# # data = base.normalize_value(data, trim_pattern="_*") -# base.check_value(data, strict=True) - -# # add check loss and use wannier: - -# # if data['data_options']['use_wannier']: -# # if not data['loss_options']['losstype'] .startswith("block"): -# # log.info(msg='\n Warning! set data_options use_wannier true, but the loss type is not block_l2! The the wannier TB will not be used when training!\n') - -# # if data['loss_options']['losstype'] .startswith("block"): -# # if not data['data_options']['use_wannier']: -# # log.error(msg="\n ERROR! for block loss type, must set data_options:use_wannier True\n") -# # raise ValueError - -# return data - -def normalize_test(data): - - co = common_options() - da = test_data_options() - to = test_options() - - base = Argument("base", dict, [co, da, to, lo]) - data = base.normalize_value(data) - # data = base.normalize_value(data, trim_pattern="_*") - base.check_value(data, strict=True) - - return data - - def tbtrans_negf(): - doc_scf = "" - doc_block_tridiagonal = "" - doc_ele_T = "" - doc_unit = "" - doc_scf_options = "" - doc_stru_options = "" - doc_poisson_options = "" - doc_sgf_solver = "" - doc_espacing = "" - doc_emin = "" - doc_emax = "" - doc_e_fermi = "" - doc_eta_lead = "" - doc_eta_device = "" - doc_out_dos = "" - doc_out_tc = "" - doc_out_current = "" - doc_out_current_nscf = "" - doc_out_ldos = "" - doc_out_density = "" - doc_out_lcurrent = "" - doc_density_options = "" - doc_out_potential = "" + doc_scf = "Whether to run a self-consistent (Poisson-NEGF) loop. Default: False (non-self-consistent transport)." + doc_block_tridiagonal = ("Whether to block-tridiagonalize the device Hamiltonian for " + "faster recursive Green's function inversion. Default: False.") + doc_ele_T = "Electronic temperature in Kelvin. Required." + doc_unit = "Energy unit used for the energy grid and outputs. Choose 'Hartree' (default) or 'eV'." + doc_scf_options = "SCF mixing options (only used when `scf` is true)." + doc_stru_options = "Structure partition and k-mesh options: device region, left/right leads, PBC, k-mesh." + doc_poisson_options = "Poisson solver options (only used when `scf` is true)." + doc_sgf_solver = "Surface Green's function solver. 'Sancho-Rubio' (default) or 'Lopez-Sancho'." + doc_espacing = "Energy grid spacing in `unit`. Required." + doc_emin = "Lower bound of the energy grid in `unit`. Required." + doc_emax = "Upper bound of the energy grid in `unit`. Required." + doc_e_fermi = "Device Fermi level in `unit`. Required." + doc_eta_lead = "Small imaginary broadening added to the lead energy. Default: 1e-5." + doc_eta_device = "Small imaginary broadening added to the device energy. Default: 0." + doc_out_dos = "Whether to write density of states. Default: False." + doc_out_tc = "Whether to write transmission coefficient. Default: False." + doc_out_current = "Whether to write self-consistent current. Default: False." + doc_out_current_nscf = "Whether to write non-self-consistent current. Default: False." + doc_out_ldos = "Whether to write local density of states. Default: False." + doc_out_density = "Whether to write electron density. Default: False." + doc_out_lcurrent = "Whether to write local current. Default: False." + doc_density_options = "Density integration options (Ozaki or Fiori method)." + doc_out_potential = "Whether to write the self-consistent electrostatic potential. Default: False." return [ Argument("scf", bool, optional=True, default=False, doc=doc_scf), @@ -1010,31 +89,32 @@ def tbtrans_negf(): - def negf(): - doc_scf = "" - doc_block_tridiagonal = "" - doc_ele_T = "" - doc_unit = "" - doc_scf_options = "" - doc_stru_options = "" - doc_poisson_options = "" - doc_sgf_solver = "" - doc_espacing = "" - doc_emin = "" - doc_emax = "" - doc_e_fermi = "" - doc_eta_lead = "" - doc_eta_device = "" - doc_out_dos = "" - doc_out_tc = "" - doc_out_current = "" - doc_out_current_nscf = "" - doc_out_ldos = "" - doc_out_density = "" - doc_out_lcurrent = "" + doc_scf = "Whether to run a self-consistent (Poisson-NEGF) loop. Default: False (non-self-consistent transport)." + doc_block_tridiagonal = ("Whether to block-tridiagonalize the device Hamiltonian for " + "faster recursive Green's function inversion. Default: False.") + doc_ele_T = "Electronic temperature in Kelvin. Required." + doc_unit = "Energy unit used for the energy grid and outputs. Choose 'Hartree' (default) or 'eV'." + doc_scf_options = "SCF mixing options (only used when `scf` is true)." + doc_stru_options = "Structure partition and k-mesh options: device region, left/right leads, PBC, k-mesh." + doc_poisson_options = "Poisson solver options (only used when `scf` is true)." + doc_espacing = "Energy grid spacing in `unit`. Required." + doc_emin = "Lower bound of the energy grid in `unit`. Required." + doc_emax = "Upper bound of the energy grid in `unit`. Required." + doc_e_fermi = ("Device Fermi level in `unit`. Optional; if None, computed from the " + "lead Fermi level and applied to the device.") + doc_eta_lead = "Small imaginary broadening added to the lead energy. Default: 1e-5." + doc_eta_device = "Small imaginary broadening added to the device energy. Default: 0." + + doc_self_energy_options = ("Self-energy stage options: SGF solver, numba JIT, " + "on-disk cache, and CPU parallelism (joblib workers, " + "BLAS threads, ek batching).") + doc_rgf_options = ("Recursive Green's function stage options: compute device " + "('cpu' or 'cuda') and energy-loop chunk size. Independent " + "from the self-energy pool, which always runs on CPU.") + doc_hs_cache = "On-disk cache of the device Hamiltonian and overlap matrix." doc_density_options = "" - doc_out_potential = "" + doc_output_options = "Which physical quantities to write out at the end of the run." return [ Argument("scf", bool, optional=True, default=False, doc=doc_scf), @@ -1042,51 +122,118 @@ def negf(): Argument("plot_blocks", bool, optional=True, default=False, doc="Whether to plot the block tridiagonalization process"), Argument("ele_T", [float, int], optional=False, doc=doc_ele_T), Argument("unit", str, optional=True, default="Hartree", doc=doc_unit), - Argument("use_saved_HS", bool, optional=True, default=False, doc="Whether to use saved Hamiltonian and overlap matrix"), - Argument("saved_HS_path", str, optional=True, default=None, doc="The path to the saved Hamiltonian and overlap matrix"), + Argument("hs_cache", dict, optional=True, default={}, sub_fields=hs_cache_options(), doc=doc_hs_cache), Argument("scf_options", dict, optional=True, default={}, sub_fields=[], sub_variants=[scf_options()], doc=doc_scf_options), Argument("stru_options", dict, optional=False, sub_fields=stru_options(), doc=doc_stru_options), Argument("poisson_options", dict, optional=True, default={}, sub_fields=[], sub_variants=[poisson_options()], doc=doc_poisson_options), - Argument("sgf_solver", str, optional=True, default="Sancho-Rubio", doc=doc_sgf_solver), - Argument("use_saved_se", bool, optional=True, default=False, doc="whether to use saved self energy"), - Argument("self_energy_save_path", str, optional=True, default=None, doc="the directory to save the self energy or load the self energy"), - Argument("se_info_display", bool, optional=True, default=False, doc="whether to display the self energy information"), - Argument("se_numba_jit", [bool, None], optional=True, default=None, doc="whether to use numba JIT for self energy calculation"), + Argument("self_energy_options", dict, optional=True, default={}, sub_fields=self_energy_options(), doc=doc_self_energy_options), Argument("espacing", [int, float], optional=False, doc=doc_espacing), Argument("emin", [int, float], optional=False, doc=doc_emin), Argument("emax", [int, float], optional=False, doc=doc_emax), - Argument("e_batch_size", [int, float], optional=True, default=None, doc="the batch size for energy points in NEGF calculation"), + Argument("rgf_options", dict, optional=True, default={}, sub_fields=rgf_options_group(), doc=doc_rgf_options), Argument("e_fermi", [int, float], optional=True, default=None ,doc=doc_e_fermi), Argument("density_options", dict, optional=True, default={}, sub_fields=[], sub_variants=[density_options()], doc=doc_density_options), Argument("eta_lead", [int, float], optional=True, default=1e-5, doc=doc_eta_lead), Argument("eta_device", [int, float], optional=True, default=0., doc=doc_eta_device), - Argument("out_dos", bool, optional=True, default=False, doc=doc_out_dos), - Argument("out_tc", bool, optional=True, default=False, doc=doc_out_tc), - Argument("out_density", bool, optional=True, default=False, doc=doc_out_density), - Argument("out_potential", bool, optional=True, default=False, doc=doc_out_potential), - Argument("out_current", bool, optional=True, default=False, doc=doc_out_current), - Argument("out_current_nscf", bool, optional=True, default=False, doc=doc_out_current_nscf), - Argument("out_ldos", bool, optional=True, default=False, doc=doc_out_ldos), - Argument("out_lcurrent", bool, optional=True, default=False, doc=doc_out_lcurrent), - Argument("n_cpus", [int, None], optional=True, default=None, doc="Number of CPU cores for parallel self-energy calculation. Default None uses os.cpu_count()."), - Argument("rgf_device", str, optional=True, default="cpu", - doc="Device used only for the RGF (recursive Green's function) step. " - "'cpu' (default) or 'cuda'. Hamiltonian initialization always runs " - "on CPU (it is the memory-heavy phase). Self-energy always runs on " - "CPU because it goes through joblib + numba.") + Argument("output_options", dict, optional=True, default={}, sub_fields=output_options(), doc=doc_output_options), + ] + + +def output_options(): + return [ + Argument("dos", bool, optional=True, default=False, doc="Write density of states."), + Argument("tc", bool, optional=True, default=False, doc="Write transmission coefficient."), + Argument("density", bool, optional=True, default=False, doc="Write electron density."), + Argument("potential", bool, optional=True, default=False, doc="Write electrostatic potential."), + Argument("current", bool, optional=True, default=False, doc="Write self-consistent current."), + Argument("current_nscf", bool, optional=True, default=False, doc="Write non-self-consistent current."), + Argument("ldos", bool, optional=True, default=False, doc="Write local density of states."), + Argument("lcurrent", bool, optional=True, default=False, doc="Write local current."), + ] + + +def self_energy_cache_options(): + return [ + Argument("use_saved", bool, optional=True, default=False, + doc="Whether to load self-energy from an on-disk HDF5 cache instead of recomputing."), + Argument("save_path", [str, None], optional=True, default=None, + doc="Directory that holds (or will hold) the self-energy HDF5 files. " + "If None, defaults to `/self_energy`."), + ] + + +def self_energy_parallel_options(): + doc_n_workers = ("Number of joblib workers used to parallelize the self-energy " + "sweep over (k, E). -1 (default) auto-selects based on the CPU " + "and memory budget (see `_get_safe_n_workers`).") + doc_cpu_budget = ("Total CPU cores the self-energy pool is allowed to size against. " + "None (default) uses os.cpu_count(). This bounds both `n_workers` " + "and `blas_threads` so BLAS-thread * worker <= cpu_budget.") + doc_blas_threads = ("BLAS/LAPACK threads per worker inside the Lopez-Sancho loop. " + "None (default) auto-tunes by timing a sample (k, E) at 1, 2, 4, " + "8, and cpu_budget/n_workers threads and keeping the fastest.") + doc_ek_batch = ("Batch size for (k, E) tasks handed to joblib. Larger = fewer " + "batches, more memory. Default 200.") + return [ + Argument("n_workers", [int, None], optional=True, default=-1, doc=doc_n_workers), + Argument("cpu_budget", [int, None], optional=True, default=None, doc=doc_cpu_budget), + Argument("blas_threads", [int, None], optional=True, default=None, doc=doc_blas_threads), + Argument("ek_batch_size", int, optional=True, default=200, doc=doc_ek_batch), + ] + + +def self_energy_options(): + doc_solver = ("Surface Green's function solver. 'Sancho-Rubio' (default) or " + "'Lopez-Sancho'.") + doc_numba_jit = ("Whether to JIT-compile the surface Green's function core with " + "numba. None (default) uses numba when available.") + doc_info_display = ("Whether to log per-(k, E) self-energy solver info. Verbose; " + "off by default.") + doc_cache = "On-disk cache of the self-energy for reuse across runs." + doc_parallel = "CPU parallelism knobs for the self-energy sweep." + return [ + Argument("solver", str, optional=True, default="Sancho-Rubio", doc=doc_solver), + Argument("numba_jit", [bool, None], optional=True, default=None, doc=doc_numba_jit), + Argument("info_display", bool, optional=True, default=False, doc=doc_info_display), + Argument("cache", dict, optional=True, default={}, sub_fields=self_energy_cache_options(), doc=doc_cache), + Argument("parallel", dict, optional=True, default={}, sub_fields=self_energy_parallel_options(), doc=doc_parallel), + ] + + +def rgf_options_group(): + doc_device = ("Device used only for the RGF (recursive Green's function) step. " + "'cpu' (default) or 'cuda'. Hamiltonian initialization always runs " + "on CPU (it is the memory-heavy phase). Self-energy always runs on " + "CPU because it goes through joblib + numba.") + doc_e_batch = ("Number of energy points solved in one batched RGF call. None " + "(default) auto-picks from free CUDA memory on 'cuda'; on 'cpu' " + "the full grid is used.") + return [ + Argument("device", str, optional=True, default="cpu", doc=doc_device), + Argument("e_batch_size", [int, float, None], optional=True, default=None, doc=doc_e_batch), + ] + + +def hs_cache_options(): + return [ + Argument("use_saved", bool, optional=True, default=False, + doc="Whether to load the device Hamiltonian and overlap from an on-disk cache."), + Argument("save_path", [str, None], optional=True, default=None, + doc="Path to the saved Hamiltonian / overlap file. Required when use_saved is true."), ] def stru_options(): - doc_kmesh = "" - doc_pbc = "" - doc_device = "" - doc_lead_L = "" - doc_lead_R = "" - doc_gamma_center="" - doc_time_reversal_symmetry="" - doc_e_fermi_smearing="The smearing method for Fermi level." - doc_eig_solver="The eigenvalue solver to use." - doc_nel_atom = "The number of electrons in each element." + doc_kmesh = "K-mesh used for the device transverse Brillouin-zone sampling, [nkx, nky, nkz]. Default: [1, 1, 1]." + doc_pbc = ("Periodic boundary condition applied to the device, list of three booleans " + "for x/y/z. Default: [False, False, False].") + doc_device = "Device region: atom index range and sorting." + doc_lead_L = "Left lead: atom index range, voltage, k-mesh for lead Fermi-level, Bloch expansion." + doc_lead_R = "Right lead: atom index range, voltage, k-mesh for lead Fermi-level, Bloch expansion." + doc_gamma_center = "Whether the k-mesh is Gamma-centered. Default: True." + doc_time_reversal_symmetry = "Whether to enforce time-reversal symmetry when folding the k-mesh. Default: True." + doc_e_fermi_smearing = "Smearing method for lead Fermi-level determination. Default: 'FD' (Fermi-Dirac)." + doc_eig_solver = "Eigenvalue solver used for lead Fermi-level calculation. Default: 'torch'." + doc_nel_atom = "Number of valence electrons per element, e.g. {'C': 4}. Required for SCF or when computing lead Fermi-level." return [ Argument("device", dict, optional=False, sub_fields=device(), doc=doc_device), Argument("lead_L", dict, optional=False, sub_fields=lead(), doc=doc_lead_L), @@ -1101,8 +248,8 @@ def stru_options(): ] def device(): - doc_id="" - doc_sort="" + doc_id = "Atom index range of the device region, e.g. '32-64' (0-indexed, half-open)." + doc_sort = "Whether to sort atoms in the device region along the transport axis. Default: True." return [ Argument("id", str, optional=False, doc=doc_id), @@ -1110,12 +257,12 @@ def device(): ] def lead(): - doc_id="" - doc_voltage="" - doc_useBloch="" - doc_bloch_factor="" - doc_kmesh_lead_Ef = "The kmesh for lead Fermi level calculation." - doc_charge = "The charge of the doped lead, used for Fermi level calculation." + doc_id = "Atom index range of the lead region, e.g. '0-32' (0-indexed, half-open)." + doc_voltage = "Applied bias voltage on this lead, in `unit`. Required." + doc_useBloch = "Whether to use Bloch expansion to reduce lead unit cell size. Default: False." + doc_bloch_factor = "Bloch factor [nx, ny, nz] for the lead unit cell. Default: [1, 1, 1]." + doc_kmesh_lead_Ef = "K-mesh used to compute the lead Fermi level, [nkx, nky, nkz]." + doc_charge = "Doping charge on the lead, used when computing the lead Fermi level. Default: 0.0." return [ Argument("id", str, optional=False, doc=doc_id), Argument("voltage", [int, float], optional=False, doc=doc_voltage), @@ -1126,20 +273,20 @@ def lead(): ] def scf_options(): - doc_mode = "" - doc_PDIIS = "" + doc_mode = "SCF mixing algorithm. Currently only 'PDIIS' is supported." + doc_PDIIS = "PDIIS (Periodic-DIIS) mixing parameters." return Variant("mode", [ Argument("PDIIS", dict, PDIIS(), doc=doc_PDIIS) ], optional=True, default_tag="PDIIS", doc=doc_mode) def PDIIS(): - doc_mixing_period = "" - doc_step_size = "" - doc_n_history = "" - doc_abs_err = "" - doc_rel_err = "" - doc_max_iter = "" + doc_mixing_period = "How many iterations between DIIS extrapolations. Default: 3." + doc_step_size = "Linear mixing step size between DIIS steps. Default: 0.05." + doc_n_history = "Number of previous residuals kept for the DIIS subspace. Default: 6." + doc_abs_err = "Absolute convergence tolerance on the SCF residual. Default: 1e-6." + doc_rel_err = "Relative convergence tolerance on the SCF residual. Default: 1e-4." + doc_max_iter = "Maximum SCF iterations. Default: 100." return [ Argument("mixing_period", int, optional=True, default=3, doc=doc_mixing_period), @@ -1151,10 +298,12 @@ def PDIIS(): ] def poisson_options(): - doc_solver = "" - doc_fmm = "" - doc_pyamg= "" - doc_scipy= "" + doc_solver = ("Poisson solver backend. 'fmm' (default) uses the free-space Fast Multipole " + "Method; 'pyamg' uses an algebraic-multigrid finite-difference solver on a " + "grid; 'scipy' uses SciPy's sparse linear algebra on a grid.") + doc_fmm = "FMM solver options." + doc_pyamg = "pyamg (algebraic multigrid) solver options: grid, gates, dielectric and doped regions." + doc_scipy = "SciPy sparse solver options: grid, gates, dielectric and doped regions." return Variant("solver", [ Argument("fmm", dict, fmm(), doc=doc_fmm), Argument("pyamg", dict, pyamg(), doc=doc_pyamg), @@ -1162,18 +311,20 @@ def poisson_options(): ], optional=True, default_tag="fmm", doc=doc_solver) def density_options(): - doc_method = "" - doc_Ozaki = "" - doc_Fiori = "" + doc_method = ("Density integration method. 'Ozaki' (default) uses the Ozaki contour with " + "Matsubara-pole expansion; 'Fiori' uses real-axis integration with Gauss " + "quadrature (used with the Fiori/effective-mass approach).") + doc_Ozaki = "Ozaki-contour options." + doc_Fiori = "Fiori real-axis integration options." return Variant("method", [ Argument("Ozaki", dict, Ozaki(), doc=doc_Ozaki), Argument("Fiori", dict, Fiori(), doc=doc_Fiori) ], optional=True, default_tag="Ozaki", doc=doc_method) def Ozaki(): - doc_M_cut = "" - doc_R = "" - doc_n_gauss = "" + doc_M_cut = "Number of Ozaki poles kept. Default: 30." + doc_R = "Radius of the semicircular contour in `unit`. Default: 1e6." + doc_n_gauss = "Number of Gauss-Legendre points on the equilibrium contour. Default: 10." return [ Argument("R", [int, float], optional=True, default=1e6, doc=doc_R), Argument("M_cut", int, optional=True, default=30, doc=doc_M_cut), @@ -1181,30 +332,31 @@ def Ozaki(): ] def Fiori(): - doc_n_gauss = "" - doc_integrate_way="" + doc_n_gauss = "Number of Gauss quadrature points along the real-axis integration. Default: 100." + doc_integrate_way = "Integration strategy for the Fiori method: 'direct' or 'gauss'. Default: 'direct'." return [ Argument("integrate_way", int, optional=True, default='direct', doc=doc_integrate_way), Argument("n_gauss", int, optional=True, default=100, doc=doc_n_gauss) ] def fmm(): - doc_err = "" + doc_err = "Requested FMM accuracy on the Coulomb sum. Default: 1e-5." return [ Argument("err", [int, float], optional=True, default=1e-5, doc=doc_err) ] def pyamg(): - doc_err = "" - doc_tolerance="" - doc_grid="" - doc_gate="" - doc_dielectric="" - doc_doped="" - doc_max_iter="" - doc_mix_rate="" - doc_poisson_dtype="The dtype of the poisson solver" + doc_err = "Error target passed to the AMG solver. Default: 1e-5." + doc_tolerance = "Convergence tolerance of the AMG linear solve. Default: 1e-7." + doc_grid = "Real-space grid used to discretize the Poisson equation." + doc_gate = "Dirichlet boundary condition for a metallic gate (x/y/z range and applied voltage)." + doc_dielectric = ("Rectangular region with a fixed relative permittivity. Additional regions " + "can be added via `dielectric_region2` ... `dielectric_region6`.") + doc_doped = "Rectangular region with a fixed doping charge density." + doc_max_iter = "Maximum AMG iterations. Default: 100." + doc_mix_rate = "Underrelaxation between successive Poisson solves. Default: 0.25." + doc_poisson_dtype = "Floating precision of the Poisson solver ('float32' or 'float64'). Default: 'float64'." return [ Argument("err", [int, float], optional=True, default=1e-5, doc=doc_err), Argument("tolerance", [int, float], optional=True, default=1e-7, doc=doc_tolerance), @@ -1225,15 +377,16 @@ def pyamg(): ] def scipy(): - doc_err = "" - doc_tolerance="" - doc_grid="" - doc_gate="" - doc_dielectric="" - doc_doped="" - doc_max_iter="" - doc_mix_rate="" - doc_poisson_dtype="The dtype of the poisson solver" + doc_err = "Residual threshold on the potential update. Default: 1e-5." + doc_tolerance = "Convergence tolerance of the sparse linear solve. Default: 1e-7." + doc_grid = "Real-space grid used to discretize the Poisson equation." + doc_gate = "Dirichlet boundary condition for a metallic gate (x/y/z range and applied voltage)." + doc_dielectric = ("Rectangular region with a fixed relative permittivity. Additional regions " + "can be added via `dielectric_region2` ... `dielectric_region6`.") + doc_doped = "Rectangular region with a fixed doping charge density." + doc_max_iter = "Maximum Poisson iterations. Default: 100." + doc_mix_rate = "Underrelaxation between successive Poisson solves. Default: 0.25." + doc_poisson_dtype = "Floating precision of the Poisson solver ('float32' or 'float64'). Default: 'float64'." return [ Argument("err", [int, float], optional=True, default=1e-5, doc=doc_err), Argument("tolerance", [int, float], optional=True, default=1e-7, doc=doc_tolerance), @@ -1258,9 +411,9 @@ def scipy(): ] def grid(): - doc_xrange="" - doc_yrange="" - doc_zrange="" + doc_xrange = "Grid range along x as 'start:stop:n' (Angstrom, n points)." + doc_yrange = "Grid range along y as 'start:stop:n' (Angstrom, n points)." + doc_zrange = "Grid range along z as 'start:stop:n' (Angstrom, n points)." return [ Argument("x_range", str, optional=False, doc=doc_xrange), Argument("y_range", str, optional=False, doc=doc_yrange), @@ -1268,10 +421,10 @@ def grid(): ] def Dirichlet_BC(): - doc_xrange="" - doc_yrange="" - doc_zrange="" - doc_voltage="" + doc_xrange = "Range along x as 'x0:x1' (Angstrom)." + doc_yrange = "Range along y as 'y0:y1' (Angstrom)." + doc_zrange = "Range along z as 'z0:z1' (Angstrom)." + doc_voltage = "Applied voltage on this Dirichlet boundary in `unit`. Default: None." return [ Argument("x_range", str, optional=False, doc=doc_xrange), Argument("y_range", str, optional=False, doc=doc_yrange), @@ -1280,10 +433,10 @@ def Dirichlet_BC(): ] def dielectric(): - doc_xrange="" - doc_yrange="" - doc_zrange="" - doc_permittivity="" + doc_xrange = "Range along x as 'x0:x1' (Angstrom)." + doc_yrange = "Range along y as 'y0:y1' (Angstrom)." + doc_zrange = "Range along z as 'z0:z1' (Angstrom)." + doc_permittivity = "Relative permittivity of the region." return [ Argument("x_range", str, optional=False, doc=doc_xrange), Argument("y_range", str, optional=False, doc=doc_yrange), @@ -1292,10 +445,10 @@ def dielectric(): ] def doped(): - doc_xrange="" - doc_yrange="" - doc_zrange="" - doc_charge="" + doc_xrange = "Range along x as 'x0:x1' (Angstrom)." + doc_yrange = "Range along y as 'y0:y1' (Angstrom)." + doc_zrange = "Range along z as 'z0:z1' (Angstrom)." + doc_charge = "Fixed doping charge (electrons per unit cell of the region)." return [ Argument("x_range", str, optional=False, doc=doc_xrange), Argument("y_range", str, optional=False, doc=doc_yrange), @@ -1304,22 +457,16 @@ def doped(): ] def run_options(): - doc_task = "the task to run, includes: band, dos, pdos, FS2D, FS3D, ifermi" - doc_structure = "the structure to run the task" - doc_gui = "To use the GUI or not" - doc_device = "The device to run the calculation, choose among `cpu` and `cuda[:int]`, Default: None. default None means to use the device seeting in the model ckpt file." - doc_dtype = """The digital number's precison, choose among: - Default: None, - - `float32`: indicating torch.float32 - - `float64`: indicating torch.float64 - default None means to use the device seeting in the model ckpt file. - """ - doc_pbc = """The periodic boundary condition, choose among: - Default: True, - - True: indicating the structure is periodic - - False: indicating the structure is not periodic - - list of bool: indicating the structure is periodic in x,y,z direction respectively. - """ + doc_task = "Which transport task to run and its detailed options. See `task_options` below." + doc_structure = "Path to the structure file (xyz/vasp/etc.). Overrides the CLI `--structure` flag when set." + doc_gui = "Whether to launch the GUI. Default: False." + doc_device = ("The torch device used to build the Hamiltonian and run the calculation. " + "Choose 'cpu' or 'cuda[:int]'. Default: None (use the device stored in the model ckpt).") + doc_dtype = ("Floating precision used at build time. 'float32' or 'float64'. " + "Default: None (use the dtype stored in the model ckpt).") + doc_pbc = ("Overall periodic boundary condition of the input structure. " + "Bool applies to all three axes; a list of three bools sets x/y/z individually. " + "Default: None (inferred from the structure file).") args = [ Argument("task_options", dict, sub_fields=[], optional=True, sub_variants=[task_options()], doc = doc_task), @@ -1335,325 +482,106 @@ def run_options(): def normalize_run(data): + _migrate_legacy_negf_task_options(data) + run_op = run_options() data = run_op.normalize_value(data) run_op.check_value(data, strict=True) return data + +# (flat legacy key) -> tuple describing where it now lives inside task_options. +# Tuples of length 1 = top-level under task_options; length 2 = one sub-dict; etc. +_NEGF_LEGACY_KEY_MAP = { + "sgf_solver": ("self_energy_options", "solver"), + "se_numba_jit": ("self_energy_options", "numba_jit"), + "se_info_display": ("self_energy_options", "info_display"), + "use_saved_se": ("self_energy_options", "cache", "use_saved"), + "self_energy_save_path": ("self_energy_options", "cache", "save_path"), + "n_cpus": ("self_energy_options", "parallel", "cpu_budget"), + "rgf_device": ("rgf_options", "device"), + "e_batch_size": ("rgf_options", "e_batch_size"), + "use_saved_HS": ("hs_cache", "use_saved"), + "saved_HS_path": ("hs_cache", "save_path"), + "out_dos": ("output_options", "dos"), + "out_tc": ("output_options", "tc"), + "out_density": ("output_options", "density"), + "out_potential": ("output_options", "potential"), + "out_current": ("output_options", "current"), + "out_current_nscf": ("output_options", "current_nscf"), + "out_ldos": ("output_options", "ldos"), + "out_lcurrent": ("output_options", "lcurrent"), +} + + +def _migrate_legacy_negf_task_options(data): + """Rewrite pre-refactor flat NEGF keys into the new nested shape in place. + + The NEGF `task_options` block used to expose parallelism, RGF device, + self-energy caching, and HS caching as top-level flat keys. They now live + under `self_energy_options`, `rgf_options`, and `hs_cache`. To avoid + breaking existing input files, this function inspects `task_options` + before strict-schema check, and for each legacy key it finds: + + * emits `log.warning` naming the new location, + * moves the value into the correct nested sub-dict (creating parents), + * deletes the flat key so the strict check sees the new shape only. + + Only runs when `task_options.task == 'negf'`. Silent no-op otherwise. + """ + if not isinstance(data, dict): + return + task_options = data.get("task_options") + if not isinstance(task_options, dict): + return + if task_options.get("task") != "negf": + return + + for legacy_key, path in _NEGF_LEGACY_KEY_MAP.items(): + if legacy_key not in task_options: + continue + value = task_options.pop(legacy_key) + new_location = "task_options." + ".".join(path) + log.warning( + f"NEGF task_options: '{legacy_key}' is deprecated; " + f"use '{new_location}' instead. " + f"Migrating value automatically for this run." + ) + + cursor = task_options + for parent in path[:-1]: + existing = cursor.get(parent) + if not isinstance(existing, dict): + existing = {} + cursor[parent] = existing + cursor = existing + leaf = path[-1] + if leaf in cursor: + log.warning( + f"NEGF task_options: both legacy '{legacy_key}' and " + f"'{new_location}' are set; keeping the value from '{new_location}'." + ) + else: + cursor[leaf] = value + def task_options(): - doc_task = '''The string define the task DeePTB conduct, includes: - - `band`: for band structure plotting. - - `dos`: for density of states plotting. - - `pdos`: for projected density of states plotting. - - `FS2D`: for 2D fermi-surface plotting. - - `FS3D`: for 3D fermi-surface plotting. - - `write_sk`: for transcript the nnsk model to standard sk parameter table - - `ifermi`: for fermi surface plotting. + doc_task = '''The string define the task to conduct: - `negf`: for non-equilibrium green function calculation. - `tbtrans_negf`: for non-equilibrium green function calculation with tbtrans. ''' - write_block = [] return Variant("task", [ - Argument("band", dict, band()), - Argument("dos", dict, dos()), - Argument("pdos", dict, pdos()), - Argument("FS2D", dict, FS2D()), - Argument("FS3D", dict, FS3D()), - Argument("write_sk", dict, write_sk()), - Argument("ifermi", dict, ifermi()), Argument("negf", dict, negf()), Argument("tbtrans_negf", dict, tbtrans_negf()), - Argument("write_block", dict, write_block), ],optional=False, doc=doc_task) -def band(): - doc_kline_type ="""The different type to build kpath line mode. - - "abacus" : the abacus format - - "vasp" : the vasp format - - "ase" : the ase format - """ - doc_kpath = "for abacus, this is list of list of float, for vasp it is a list[str] to specify the kpath." - doc_klabels = "the labels for high symmetry kpoint" - doc_emin="the min energy to show the band plot" - doc_emax="the max energy to show the band plot" - doc_E_fermi = "the fermi level used to plot band" - doc_ref_band = "the reference band structure to be ploted together with dptb bands." - doc_nel_atom = "the valence electron number of each type of atom." - doc_high_sym_kpoints = "the high symmetry kpoints dict, e.g. {'G':[0,0,0],'K':[0.5,0.5,0]}, only used for kline_type is vasp" - doc_num_in_line = "the number of kpoints in each line path, only used for kline_type is vasp." - return [ - Argument("kline_type", str, optional=False, doc=doc_kline_type), - Argument("kpath", [str,list], optional=False, doc=doc_kpath), - Argument("high_sym_kpoints",dict,optional=True,default={},doc=doc_high_sym_kpoints), - Argument("number_in_line", int, optional=True, default=None, doc=doc_num_in_line), - Argument("klabels", list, optional=True, default=[''], doc=doc_klabels), - Argument("E_fermi", [float, int, None], optional=True, doc=doc_E_fermi, default=None), - Argument("emin", [float, int, None], optional=True, doc=doc_emin, default=None), - Argument("emax", [float, int, None], optional=True, doc=doc_emax, default=None), - Argument("nkpoints", int, optional=True, doc=doc_emax, default=0), - Argument("ref_band", [str, None], optional=True, default=None, doc=doc_ref_band), - Argument("nel_atom", [dict,None], optional=True, default=None, doc=doc_nel_atom) - ] - - -def dos(): - doc_mesh_grid = "" - doc_gamma_center = "" - doc_sigma = "" - doc_npoints = "" - doc_width = "" - doc_E_fermi="" - - return [ - Argument("mesh_grid", list, optional=False, doc=doc_mesh_grid), - Argument("sigma", float, optional=False, doc=doc_sigma), - Argument("npoints", int, optional=False, doc=doc_npoints), - Argument("width", list, optional=False, doc=doc_width), - Argument("E_fermi", [float, int, None], optional=True, doc=doc_E_fermi, default=None), - Argument("gamma_center", bool, optional=True, default=False, doc=doc_gamma_center) - ] - -def pdos(): - doc_mesh_grid = "" - doc_gamma_center = "" - doc_sigma = "" - doc_npoints = "" - doc_width = "" - doc_E_fermi="" - doc_atom_index = "" - doc_orbital_index = "" - - return [ - Argument("mesh_grid", list, optional=False, doc=doc_mesh_grid), - Argument("sigma", float, optional=False, doc=doc_sigma), - Argument("npoints", int, optional=False, doc=doc_npoints), - Argument("width", list, optional=False, doc=doc_width), - Argument("E_fermi", [float, int, None], optional=True, doc=doc_E_fermi, default=None), - Argument("atom_index", list, optional=False, doc=doc_atom_index), - Argument("orbital_index", list, optional=False, doc=doc_orbital_index), - Argument("gamma_center", bool, optional=True, default=False, doc=doc_gamma_center) - ] - -def FS2D(): - doc_mesh_grid = "" - doc_E0 = "" - doc_sigma = "" - doc_intpfactor = "" - - return [ - Argument("mesh_grid", list, optional=False, doc=doc_mesh_grid), - Argument("sigma", float, optional=False, doc=doc_sigma), - Argument("E0", int, optional=False, doc=doc_E0), - Argument("intpfactor", int, optional=False, doc=doc_intpfactor) - ] - -def FS3D(): - doc_mesh_grid = "" - doc_E0 = "" - doc_sigma = "" - doc_intpfactor = "" - - return [ - Argument("mesh_grid", list, optional=False, doc=doc_mesh_grid), - Argument("sigma", float, optional=False, doc=doc_sigma), - Argument("E0", int, optional=False, doc=doc_E0), - Argument("intpfactor", int, optional=False, doc=doc_intpfactor) - ] - - -def ifermi(): - doc_fermi = "" - doc_prop = "" - doc_mesh_grid = "" - doc_mu = "" - doc_sigma = "" - doc_intpfactor = "" - doc_wigner_seitz = "" - doc_nworkers = "" - doc_plot_type = "plot_type: Method used for plotting. Valid options are: matplotlib, plotly, mayavi, crystal_toolkit." - doc_use_gui="" - doc_plot_fs_bands = "" - doc_fs_plane = "" - doc_fs_distanc= "" - doc_color_properties ="""color_properties: Whether to use the properties to color the Fermi surface. - If the properties is a vector then the norm of the properties will be - used. Note, this will only take effect if the Fermi surface has - properties. If set to True, the viridis colormap will be used. - Alternative colormaps can be selected by setting ``color_properties`` - to a matplotlib colormap name. This setting will override the ``colors`` - option. For vector properties, the arrows are colored according to the - norm of the properties by default. If used in combination with the - ``projection_axis`` option, the color will be determined by the dot - product of the properties with the projection axis.""" - doc_fs_plot_options="" - doc_projection_axis = """projection_axis: Projection axis that can be used to calculate the color of - vector properties. If None, the norm of the properties will be used, - otherwise the color will be determined by the dot product of the - properties with the projection axis. Only has an effect when used with - the ``vector_properties`` option.""" - - doc_velocity = "" - doc_colormap = "" - doc_prop_plane = "" - doc_prop_distance="" - doc_prop_plot_options="" - doc_hide_surface = """hide_surface: Whether to hide the Fermi surface. Only recommended in combination with the ``vector_properties`` option.""" - doc_hide_labels ="""hide_labels: Whether to show the high-symmetry k-point labels.""" - doc_hide_cell = """hide_cell: Whether to show the reciprocal cell boundary.""" - doc_vector_spacing="""vector_spacing: The rough spacing between arrows. Uses a custom algorithm - for resampling the Fermi surface to ensure that arrows are not too close - together. Only has an effect when used with the ``vector_properties`` - option.""" - doc_azimuth="azimuth: The azimuth of the viewpoint in degrees. i.e. the angle subtended by the position vector on a sphere projected on to the x-y plane." - doc_elevation="The zenith angle of the viewpoint in degrees, i.e. the angle subtended by the position vector and the z-axis." - doc_colors ="""The color specification for the iso-surfaces. Valid options are: - - A single color to use for all Fermi surfaces, specified as a tuple of - rgb values from 0 to 1. E.g., red would be ``(1, 0, 0)``. - - A list of colors, specified as above. - - A dictionary of ``{Spin.up: color1, Spin.down: color2}``, where the - colors are specified as above. - - A string specifying which matplotlib colormap to use. See - https://matplotlib.org/tutorials/colors/colormaps.html for more - information. - - ``None``, in which case the default colors will be used. - """ - - """Defaults.""" - - AZIMUTH = 45.0 - ELEVATION = 35.0 - VECTOR_SPACING = 0.2 - COLORMAP = "viridis" - SYMPREC = 1e-3 - KTOL = 1e-5 - SCALE = 4 - - - plot_options=[ - Argument("colors", [str,dict,list,None], optional=True, default=None, doc=doc_colors), - Argument("projection_axis", [list,None], optional=True, default=None, doc=doc_projection_axis), - Argument("hide_surface", bool, optional=True, default=False, doc=doc_hide_surface), - Argument("hide_labels", bool, optional=True, default=False, doc=doc_hide_labels), - Argument("hide_cell", bool, optional=True, default=False, doc=doc_hide_cell), - Argument("vector_spacing",float, optional=True, default=VECTOR_SPACING, doc=doc_vector_spacing), - Argument("azimuth", float, optional=True, default=AZIMUTH, doc=doc_azimuth), - Argument("elevation", float, optional=True, default=ELEVATION, doc=doc_elevation), - ] - - - plot_options_fs=[ - Argument("projection_axis", [list,None], optional=True, default=None, doc=doc_projection_axis) - ] - args_fermi = [ - Argument("mesh_grid", list, optional = False, default=[2,2,2], doc = doc_mesh_grid), - Argument("mu", [float,int], optional = False, default=0.0, doc = doc_mu), - Argument("sigma", float, optional = True, default=0.1, doc = doc_sigma), - Argument("intpfactor", int, optional = False, default=1, doc = doc_intpfactor), - Argument("wigner_seitz", bool, optional = True, default=True, doc = doc_wigner_seitz), - Argument("nworkers", int, optional = True, default=-1, doc = doc_nworkers), - Argument("plot_type", str, optional = True, default="plotly", doc = doc_plot_type), - Argument("use_gui", bool, optional = True, default=False, doc = doc_use_gui), - Argument("plot_fs_bands", bool, optional = True, default = False, doc = doc_plot_fs_bands), - Argument("fs_plane", list, optional = True, default=[0,0,1], doc = doc_fs_plane), - Argument("fs_distance", [int,float], optional = True, default=0, doc = doc_fs_distanc), - Argument("plot_options", dict, optional=True, sub_fields=plot_options, sub_variants=[], default={}, doc=doc_fs_plot_options) - ] - - - args_prop = [ - Argument("velocity", bool, optional = True, default=False, doc = doc_velocity), - Argument("color_properties", [str,bool], optional = True, default=False, doc = doc_color_properties), - Argument("colormap", str, optional = True,default="viridis",doc = doc_colormap), - Argument("prop_plane", list, optional = True, default=[0,0,1],doc = doc_prop_plane), - Argument("prop_distance", [int,float], optional = True, default=0, doc = doc_prop_distance), - Argument("plot_options", dict, optional = True, sub_fields=plot_options, sub_variants=[], default={}, doc = doc_prop_plot_options) - ] - - fermiarg = Argument("fermisurface", dict, optional=False, sub_fields=args_fermi, sub_variants=[], default={}, doc=doc_fermi) - prop = Argument("property", dict, optional=True, sub_fields=args_prop, sub_variants=[], default={}, doc=doc_prop) - - return [fermiarg, prop] - -def write_sk(): - doc_thr = "" - doc_format = "" - - return [ - Argument("format", str, optional=True, default="sktable", doc=doc_format), - Argument("thr", float, optional=True, default=1e-3, doc=doc_thr) - ] - - -def host_normalize(data): - - co = common_options() - mo = model_options() - - base = Argument("base", dict, [co, mo]) - data = base.normalize_value(data) - # data = base.normalize_value(data, trim_pattern="_*") - base.check_value(data, strict=False) - - return data - - -def normalize_bandinfo(data): - doc_band_min = "" - doc_band_max = "" - doc_emin = "" - doc_emax = "" - doc_gap_penalty = "" - doc_fermi_band = "" - doc_loss_gap_eta = "" - doc_eout_weight="" - doc_weight = "" - doc_wannier_proj = "" - doc_orb_wan = "" - - args = [ - Argument("band_min", int, optional=True, doc=doc_band_min, default=0), - Argument("band_max", [int, None], optional=True, doc=doc_band_max, default=None), - Argument("emin", [float, None], optional=True, doc=doc_emin,default=None), - Argument("emax", [float, None], optional=True, doc=doc_emax,default=None), - Argument("gap_penalty", bool, optional=True, doc=doc_gap_penalty, default=False), - Argument("fermi_band", int, optional=True, doc=doc_fermi_band,default=0), - Argument("loss_gap_eta", float, optional=True, doc=doc_loss_gap_eta, default=0.01), - Argument("eout_weight", float, optional=True, doc=doc_eout_weight, default=0.00), - Argument("weight", [int, float, list], optional=True, doc=doc_weight, default=1.), - Argument("wannier_proj",dict, optional=True, doc=doc_wannier_proj, default={}), - Argument("orb_wan",[dict, None], optional=True, doc=doc_orb_wan, default=None) - ] - bandinfo = Argument("bandinfo", dict, sub_fields=args) - data = bandinfo.normalize_value(data) - bandinfo.check_value(data, strict=True) - - return data - -def bandinfo_sub(): - doc_band_min = """the minum band index for the training band window with respected to the correctly selected DFT bands. - `important`: before setting this tag you should make sure you have already exclude all the irrelevant in your training data. - This logic for band_min and max is based on the simple fact the total number TB bands > the bands you care. - """ - doc_band_max = "The maxmum band index for training band window" - doc_emin = "the minmum energy window, 0 meand the min value of the band at index band_min" - doc_emax = "the max energy window, emax value is respect to the min value of the band at index band_min" - - args = [ - Argument("band_min", int, optional=True, doc=doc_band_min, default=0), - Argument("band_max", [int, None], optional=True, doc=doc_band_max, default=None), - Argument("emin", [float, None], optional=True, doc=doc_emin,default=None), - Argument("emax", [float, None], optional=True, doc=doc_emax,default=None), - ] - - return Argument("bandinfo", dict, optional=True, sub_fields=args, sub_variants=[], doc="") def AtomicData_options_sub(): - doc_r_max = "the cutoff value for bond considering in TB model." - doc_er_max = "The cutoff value for environment for each site for env correction model. should set for nnsk+env correction model." - doc_oer_max = "The cutoff value for onsite environment for nnsk model, for now only need to set in strain and NRL mode." - doc_pbc = "The periodic condition for the structure, can bool or list of bool to specific x,y,z direction." + doc_r_max = "Cutoff radius (Angstrom) for bond construction in the TB model. Can be a float or a per-species dict." + doc_er_max = "Cutoff radius for the environment of each site (env-correction models). Default: None." + doc_oer_max = "Cutoff radius for onsite environment; only used by nnsk models in strain or NRL mode. Default: None." + doc_pbc = "Periodic boundary condition, bool or list of three bools for x/y/z." args = [ Argument("r_max", [float, int, dict], optional=False, doc=doc_r_max, default=4.0), @@ -1663,46 +591,6 @@ def AtomicData_options_sub(): return Argument("AtomicData_options", dict, optional=True, sub_fields=args, sub_variants=[], doc="", default=None) -def set_info_options(): - doc_nframes = "Number of frames in this trajectory." - doc_natoms = "Number of atoms in each frame." - doc_pos_type = "Type of atomic position input. Can be frac / cart / ase." - doc_pbc = "The periodic condition for the structure, can bool or list of bool to specific x,y,z direction." - - args = [ - Argument("nframes", int, optional=False, doc=doc_nframes), - Argument("natoms", int, optional=True, default=-1, doc=doc_natoms), - Argument("pos_type", str, optional=False, doc=doc_pos_type), - Argument("pbc", [bool, list], optional=False, doc=doc_pbc), - bandinfo_sub() - ] - - return Argument("setinfo", dict, sub_fields=args) - -def lmdbset_info_options(): - doc_r_max = "the cutoff value for bond considering in TB model." - - args = [ - Argument("r_max", [float, int, dict], optional=False, doc=doc_r_max, default=4.0) - ] - return Argument("setinfo", dict, sub_fields=args) - -def normalize_setinfo(data): - - setinfo = set_info_options() - data = setinfo.normalize_value(data) - setinfo.check_value(data, strict=True) - - return data - -def normalize_lmdbsetinfo(data): - - setinfo = lmdbset_info_options() - data = setinfo.normalize_value(data) - setinfo.check_value(data, strict=True) - - return data - def format_cuts(rcut: Union[Dict[str, Number], Number], decay_w: Number, nbuffer: int) -> Union[Dict[str, Number], Number]: if not isinstance(decay_w, Number) or decay_w <= 0: @@ -1721,12 +609,12 @@ def get_cutoffs_from_model_options(model_options): """ Extract cutoff values from the provided model options. - This function retrieves the cutoff values `r_max`, `er_max`, and `oer_max` from the `model_options` - dictionary. It handles different model types such as `embedding`, `nnsk`, and `dftbsk`, ensuring + This function retrieves the cutoff values `r_max`, `er_max`, and `oer_max` from the `model_options` + dictionary. It handles different model types such as `embedding`, `nnsk`, and `dftbsk`, ensuring that the appropriate cutoff values are provided and valid. Parameters: - model_options (dict): A dictionary containing model configuration options. It may include keys + model_options (dict): A dictionary containing model configuration options. It may include keys like `embedding`, `nnsk`, and `dftbsk` with their respective cutoff values. Returns: @@ -1754,21 +642,17 @@ def get_cutoffs_from_model_options(model_options): if model_options.get("nnsk", None) is not None: assert r_max is None, "r_max should not be provided in outside the nnsk for training nnsk model." if model_options["nnsk"]["hopping"].get("rs",None) is not None: - # 其他方法在模型公式中,已经包含了 +5w 的范围,所以这里为了保险额外加上3w 的范围; + # 其他方法在模型公式中,已经包含了 +5w 的范围,所以这里为了保险额外加上3w 的范围; # 对于两个特例,powerlaw 和 varTang96 的情况,为了和旧版存档的兼容, 模型公式的本身并没有 +5w 的范围,所以这里额外加上8w 的范围。 if model_options["nnsk"]["hopping"]['method'] in ["powerlaw","varTang96"]: - # r_max = model_options["nnsk"]["hopping"]["rs"] + 8 * model_options["nnsk"]["hopping"]["w"] r_max = format_cuts(model_options["nnsk"]["hopping"]["rs"], model_options["nnsk"]["hopping"]["w"], 8) else: - # r_max = model_options["nnsk"]["hopping"]["rs"] + 3 * model_options["nnsk"]["hopping"]["w"] r_max = format_cuts(model_options["nnsk"]["hopping"]["rs"], model_options["nnsk"]["hopping"]["w"], 3) if model_options["nnsk"]["onsite"].get("rs",None) is not None: if model_options["nnsk"]["onsite"]['method'] == "strain" and model_options["nnsk"]["hopping"]['method'] in ["powerlaw","varTang96"]: - # oer_max = model_options["nnsk"]["onsite"]["rs"] + 8 * model_options["nnsk"]["onsite"]["w"] oer_max = format_cuts(model_options["nnsk"]["onsite"]["rs"], model_options["nnsk"]["onsite"]["w"], 8) else: - # oer_max = model_options["nnsk"]["onsite"]["rs"] + 3 * model_options["nnsk"]["onsite"]["w"] oer_max = format_cuts(model_options["nnsk"]["onsite"]["rs"], model_options["nnsk"]["onsite"]["w"], 3) elif model_options.get("dftbsk", None) is not None: @@ -1780,132 +664,3 @@ def get_cutoffs_from_model_options(model_options): assert model_options.get("embedding",None) is not None return r_max, er_max, oer_max -def collect_cutoffs(jdata): - """ - Collect cutoff values from the provided JSON data. - - This function extracts the cutoff values `r_max`, `er_max`, and `oer_max` from the `model_options` - in the provided JSON data. If the `nnsk` push model is used, it ensures that the necessary - cutoff values are provided in `data_options` and overrides the values from `model_options` - accordingly. - - Parameters: - jdata (dict): A dictionary containing model and data options. It must include `model_options` - and optionally `data_options` if `nnsk` push model is used. - - Returns: - dict: A dictionary containing the cutoff options with keys `r_max`, `er_max`, and `oer_max`. - - Raises: - AssertionError: If required keys are missing in `jdata` or if `r_max` is not provided when - using the `nnsk` push model. - - Logs: - Various informational messages about the cutoff values and their sources. - """ - - model_options = jdata["model_options"] - r_max, er_max, oer_max = get_cutoffs_from_model_options(model_options) - - if model_options.get("nnsk", None) is not None: - if model_options["nnsk"]["push"]: - assert jdata.get("data_options",None) is not None, "data_options should be provided in jdata for nnsk push" - assert jdata['data_options'].get("r_max") is not None, "r_max should be provided in data_options for nnsk push" - log.info('YOU ARE USING NNSK PUSH MODEL, r_max will be used from data_options. Be careful! check the value in data options and model options. r_max or rs/rc !') - r_max = jdata['data_options']['r_max'] - - if model_options["nnsk"]["onsite"]["method"] in ["strain", "NRL"]: - assert jdata['data_options'].get("oer_max") is not None, "oer_max should be provided in data_options for nnsk push with strain onsite mode" - log.info('YOU ARE USING NNSK PUSH MODEL with `strain` onsite mode, oer_max will be used from data_options. Be careful! check the value in data options and model options. rs/rc !') - oer_max = jdata['data_options']['oer_max'] - - if jdata['data_options'].get("er_max") is not None: - log.info("IN PUSH mode, the env correction should not be used. the er_max will not take effect.") - else: - if jdata['data_options'].get("r_max") is not None: - log.info("When not nnsk/push. the cutoffs will take from the model options: r_max rs and rc values. this seting in data_options will be ignored.") - - assert r_max is not None - cutoff_options = ({"r_max": r_max, "er_max": er_max, "oer_max": oer_max}) - - log.info("-"*66) - log.info(' {:<55} '.format("Cutoff options:")) - log.info(' {:<55} '.format(" "*30)) - log.info(' {:<16} : {:<36} '.format("r_max", f"{r_max}")) - log.info(' {:<16} : {:<36} '.format("er_max", f"{er_max}")) - log.info(' {:<16} : {:<36} '.format("oer_max", f"{oer_max}")) - log.info("-"*66) - - return cutoff_options - - -def normalize(data): - - co = common_options() - tr = train_options() - da = data_options() - mo = model_options() - - base = Argument("base", dict, [co, tr, da, mo]) - data = base.normalize_value(data) - # data = base.normalize_value(data, trim_pattern="_*") - base.check_value(data, strict=True) - - # add check loss and use wannier: - - # if data['data_options']['use_wannier']: - # if not data['loss_options']['losstype'] .startswith("block"): - # log.info(msg='\n Warning! set data_options use_wannier true, but the loss type is not block_l2! The the wannier TB will not be used when training!\n') - - # if data['loss_options']['losstype'] .startswith("block"): - # if not data['data_options']['use_wannier']: - # log.error(msg="\n ERROR! for block loss type, must set data_options:use_wannier True\n") - # raise ValueError - - return data - -def normalize_skf2nnsk(data): - common_ops = [ - Argument("basis", [dict,str], optional=False, default='auto', doc="The basis set for the model, can be a dict or a string, default is 'auto'."), - Argument("skdata",str, optional=False, doc="The path to the skf file."), - Argument("device",str, optional=True, default='cpu', doc="The device to run the calculation, choose among `cpu` and `cuda[:int]`, Default: 'cpu'."), - Argument("dtype",str, optional=True, default='float32', doc="The digital number's precison, choose among: 'float32', 'float64', Default: 'float32'."), - Argument("seed", int, optional=True, default=3982377700, doc="The random seed used to initialize the parameters and determine the shuffling order of datasets. Default: `3982377700`") - ] - - model_ops = [ - Argument('method',str, optional=False, default='poly2pow', doc="The method for the hopping term, default is 'powerlaw'."), - Argument('rs',[float,None,int], optional=True, default=None, doc="The rs value for the hopping term."), - Argument('w', [float,int], optional=True, default=0.2, doc="The w value for the hopping term."), - Argument('atomic_radius',[str,dict], optional=True, default='cov', doc="The atomic radius for the hopping term, default is 'cov'.") - ] - - doc_lr_scheduler = "The learning rate scheduler tools settings, the lr scheduler is used to scales down the learning rate during the training process. Proper setting can make the training more stable and efficient. The supported lr schedular includes: `Exponential Decaying (exp)`, `Linear multiplication (linear)`" - doc_optimizer = "\ - The optimizer setting for selecting the gradient optimizer of model training. Optimizer supported includes `Adam`, `SGD` and `LBFGS` \n\n\ - For more information about these optmization algorithm, we refer to:\n\n\ - - `Adam`: [Adam: A Method for Stochastic Optimization.](https://arxiv.org/abs/1412.6980)\n\n\ - - `SGD`: [Stochastic Gradient Descent.](https://pytorch.org/docs/stable/generated/torch.optim.SGD.html)\n\n\ - - `LBFGS`: [On the limited memory BFGS method for large scale optimization.](http://users.iems.northwestern.edu/~nocedal/PDFfiles/limited-memory.pdf) \n\n\ - " - - train_ops = [ - Argument('nstep', int, optional=False, doc="The number of steps for the training."), - Argument('nsample', int, optional=True, default=256, doc="The number of steps for the training."), - Argument('max_elmt_batch', int, optional=True, default=4, doc="The max number of elements in a batch."), - Argument('dis_freq', int, optional=True, default=1, doc="The frequency of the display."), - Argument('save_freq', int, optional=True, default=1, doc="The frequency of the save."), - Argument("optimizer", dict, sub_fields=[], optional=True, default={}, sub_variants=[optimizer()], doc = doc_optimizer), - Argument("lr_scheduler", dict, sub_fields=[], optional=True, default={}, sub_variants=[lr_scheduler()], doc = doc_lr_scheduler) - ] - co = Argument("common_options", dict, optional=False, sub_fields=common_ops, sub_variants=[], doc='The common options.') - mo = Argument("model_options", dict, optional=False, sub_fields=model_ops, sub_variants=[], doc='The model options.') - tr = Argument("train_options", dict, sub_fields=train_ops, sub_variants=[], optional=False, doc='The training options.') - - base = Argument("base", dict, [co, mo, tr]) - data = base.normalize_value(data) - # data = base.normalize_value(data, trim_pattern="_*") - base.check_value(data, strict=True) - - return data - diff --git a/dpnegf/utils/gen_input_docs.py b/dpnegf/utils/gen_input_docs.py index 6714fb1..3265a5e 100644 --- a/dpnegf/utils/gen_input_docs.py +++ b/dpnegf/utils/gen_input_docs.py @@ -1,69 +1,42 @@ -def render_argument(arg, indent=0): - """Render an Argument object (and its children) into RST format.""" - ind = " " * indent - out = [] - - if isinstance(arg, str): - return f"{ind}{arg}" - - out.append(f"{ind}{arg.name}:") - out.append(f"{ind} | type: ``{arg.dtype}``") - - if getattr(arg, "optional", False): - out.append(f"{ind} | optional: True") - - if getattr(arg, "default", None) is not None: - out.append(f"{ind} | default: ``{arg.default}``") - - if getattr(arg, "doc", ""): - doc_lines = arg.doc.strip().splitlines() - for line in doc_lines: - out.append(f"{ind} {line.strip()}") - - # 如果有子字段 - for sub in getattr(arg, "sub_fields", []): - out.append("") # 空行分隔 - out.append(render_argument(sub, indent + 1)) +import os +from dpnegf.utils import argcheck - # 如果有子变体 - for var in getattr(arg, "sub_variants", []): - out.append("") - out.append(f"{ind} Variant:") - out.append(render_argument(var, indent + 2)) - return "\n".join(out) +def _render_top_level(arg): + """Render an Argument tree to RST using dargs' built-in generator. + The `dargs` Argument tree already knows how to emit fully-nested RST + (types, defaults, doc strings, and Variant branches). We just wrap the + output in a header and a section anchor. + """ + return arg.gen_doc(make_anchor=True, make_link=True) -import os -from dpnegf.utils import argcheck def generate_rst_from_argcheck(output_dir="docs/input_params"): os.makedirs(output_dir, exist_ok=True) - # 这里你可以写死,也可以动态扫描 modules = { "common_options": argcheck.common_options, "run_options": argcheck.run_options, } for name, func in modules.items(): - # arg = func() if callable(func) else func - # print(f"[DEBUG] {name} returned:", arg, type(arg)) arg = func() - rst = f""" -======================================== -{name.replace("_", " ").title()} -======================================== - -.. _`{name}`: - -{render_argument(arg)} -""" + title = name.replace("_", " ").title() + underline = "=" * len(title) + body = _render_top_level(arg) + parts = [f"{underline}\n{title}\n{underline}\n"] + if name != arg.name: + parts.append(f".. _`{name}`:\n") + parts.append(body) + rst = "\n".join(parts) + "\n" with open(os.path.join(output_dir, f"{name}.rst"), "w", encoding="utf-8") as f: f.write(rst) + def main(): generate_rst_from_argcheck() + if __name__ == "__main__": main() diff --git a/examples/CNT/input.json b/examples/CNT/input.json index 9cc8644..da27f1c 100644 --- a/examples/CNT/input.json +++ b/examples/CNT/input.json @@ -3,88 +3,116 @@ "task": "negf", "scf": false, "block_tridiagonal": true, - "n_cpus": 8, - "rgf_device": "cpu", "ele_T": 300, "unit": "eV", - "scf_options":{ + "espacing": 0.05, + "emin": -3, + "emax": 3, + "eta_lead": 1e-05, + "eta_device": 1e-05, + "self_energy_options": { + "solver": "Sancho-Rubio", + "parallel": { + "cpu_budget": 8 + } + }, + "rgf_options": { + "device": "cpu" + }, + "scf_options": { "mode": "PDIIS", "mixing_period": 3, "step_size": 0.05, "n_history": 6, - "abs_err": 1e-6, - "rel_err": 1e-4, + "abs_err": 1e-06, + "rel_err": 0.0001, "max_iter": 100 }, - "stru_options":{ + "stru_options": { "gamma_center": true, "time_reversal_symmetry": true, - "nel_atom": {"C": 4.0}, - "kmesh":[1,1,1], - "pbc":[true, true, false], - "device":{ - "id":"56-574", + "nel_atom": { + "C": 4.0 + }, + "kmesh": [ + 1, + 1, + 1 + ], + "pbc": [ + true, + true, + false + ], + "device": { + "id": "56-574", "sort": true }, - "lead_L":{ - "id":"0-56", - "voltage":0, + "lead_L": { + "id": "0-56", + "voltage": 0, "useBloch": false, - "kmesh_lead_Ef": [1,1,10] + "kmesh_lead_Ef": [ + 1, + 1, + 10 + ] }, - "lead_R":{ - "id":"574-630", - "voltage":0, + "lead_R": { + "id": "574-630", + "voltage": 0, "useBloch": false, - "kmesh_lead_Ef": [1,1,10] + "kmesh_lead_Ef": [ + 1, + 1, + 10 + ] } }, "poisson_options": { "solver": "scipy", - "err": 1e-2, - "tolerance":1e-5, - "max_iter":1000, - "mix_rate":0.2, - "grid":{ - "x_range":"-20:20:9", - "y_range":"-20:20:9", - "z_range":"8.6:88:2" - }, - "gate_top":{ + "err": 0.01, + "tolerance": 1e-05, + "max_iter": 1000, + "mix_rate": 0.2, + "grid": { + "x_range": "-20:20:9", + "y_range": "-20:20:9", + "z_range": "8.6:88:2" + }, + "gate_top": { "x_range": "-20:-20", "y_range": "-20:20", "z_range": "38.64:58.64", "voltage": 0 }, - "gate_bottom":{ + "gate_bottom": { "x_range": "20:20", "y_range": "-20:20", "z_range": "38.64:58.64", "voltage": 0 }, - "dielectric_region":{ - "x_range": "-20:20", - "y_range": "-20:20", - "z_range": "8.6:88", - "relative permittivity": 20 + "dielectric_region": { + "x_range": "-20:20", + "y_range": "-20:20", + "z_range": "8.6:88", + "relative permittivity": 20 } }, - "sgf_solver": "Sancho-Rubio", - "espacing": 0.05, - "emin": -3, - "emax": 3, "density_options": { "method": "Fiori", "integrate_way": "direct" }, - "eta_lead":1e-5, - "eta_device":1e-5, - "out_dos": true, - "out_tc": true, - "out_ldos": false, - "out_current_nscf": true, - "out_density": true -}, -"structure": "./ready_struct.xyz", -"AtomicData_options" : {"r_max": 4.6} -} \ No newline at end of file + "output_options": { + "dos": true, + "tc": true, + "ldos": false, + "current_nscf": true, + "density": true + } + }, + "structure": "./ready_struct.xyz", + "AtomicData_options": { + "r_max": 4.6 + } +} diff --git a/examples/MoS2/negf.json b/examples/MoS2/negf.json index efa5199..7996117 100644 --- a/examples/MoS2/negf.json +++ b/examples/MoS2/negf.json @@ -1,52 +1,74 @@ -{ - "structure":"./struct_negf.xyz", - "task_options": - { - "task": "negf", - "scf": false, - "block_tridiagonal": true, - "ele_T": 300, - "unit": "eV", - "stru_options":{ - "gamma_center": false, - "time_reversal_symmetry": true, - "nel_atom": {"Mo":6,"S":6}, - "kmesh":[1,1,1], - "pbc":[true, false, false], - "device":{ - "id":"24-48", - "sort": true - }, - "lead_L":{ - "id":"0-24", - "voltage":0.0, - "kmesh_lead_Ef":[50,1,20], - "useBloch": false - }, - "lead_R":{ - "id":"48-72", - "voltage":0.0, - "kmesh_lead_Ef":[50,1,20], - "useBloch": false - } +{ + "structure": "./struct_negf.xyz", + "task_options": { + "task": "negf", + "scf": false, + "block_tridiagonal": true, + "ele_T": 300, + "unit": "eV", + "espacing": 0.05, + "emin": -10, + "emax": 10, + "eta_lead": 1e-05, + "eta_device": 0.0, + "stru_options": { + "gamma_center": false, + "time_reversal_symmetry": true, + "nel_atom": { + "Mo": 6, + "S": 6 }, - "density_options": { + "kmesh": [ + 1, + 1, + 1 + ], + "pbc": [ + true, + false, + false + ], + "device": { + "id": "24-48", + "sort": true + }, + "lead_L": { + "id": "0-24", + "voltage": 0.0, + "kmesh_lead_Ef": [ + 50, + 1, + 20 + ], + "useBloch": false + }, + "lead_R": { + "id": "48-72", + "voltage": 0.0, + "kmesh_lead_Ef": [ + 50, + 1, + 20 + ], + "useBloch": false + } + }, + "density_options": { "method": "Fiori", "integrate_way": "direct" - }, - "poisson_options": { + }, + "poisson_options": { "solver": "fmm", - "err": 1e-5 - }, - "sgf_solver": "Sancho-Rubio", - "espacing": 0.05, - "emin": -10, - "emax": 10, - "eta_lead":1e-5, - "eta_device":0.0, - "out_dos": true, - "out_tc": true, - "out_ldos": true, - "out_current_nscf": false + "err": 1e-05 + }, + "self_energy_options": { + "solver": "Sancho-Rubio" + }, + "output_options": { + "dos": true, + "tc": true, + "ldos": true, + "current_nscf": false + } } } diff --git a/examples/atomic_chain_api/input_files/negf_chain_new.json b/examples/atomic_chain_api/input_files/negf_chain_new.json index 6701c79..e7f1b7d 100644 --- a/examples/atomic_chain_api/input_files/negf_chain_new.json +++ b/examples/atomic_chain_api/input_files/negf_chain_new.json @@ -5,60 +5,82 @@ "block_tridiagonal": false, "ele_T": 300, "unit": "eV", - "scf_options":{ + "espacing": 0.02, + "emin": -1.5, + "emax": 1.5, + "eta_lead": 1e-05, + "eta_device": 0.0, + "scf_options": { "mode": "PDIIS", "mixing_period": 3, "step_size": 0.05, "n_history": 6, - "abs_err": 1e-6, - "rel_err": 1e-4, + "abs_err": 1e-06, + "rel_err": 0.0001, "max_iter": 100 }, - "stru_options":{ + "stru_options": { "gamma_center": true, "time_reversal_symmetry": true, - "nel_atom": {"C": 1.0}, - "kmesh":[1,1,1], - "eig_solver":"numpy", - "pbc":[false, false, false], - "device":{ - "id":"4-8", + "nel_atom": { + "C": 1.0 + }, + "kmesh": [ + 1, + 1, + 1 + ], + "eig_solver": "numpy", + "pbc": [ + false, + false, + false + ], + "device": { + "id": "4-8", "sort": true }, - "lead_L":{ - "id":"0-4", - "voltage":0.0, - "kmesh_lead_Ef":[1,1,20], + "lead_L": { + "id": "0-4", + "voltage": 0.0, + "kmesh_lead_Ef": [ + 1, + 1, + 20 + ], "useBloch": false }, - "lead_R":{ - "id":"8-12", - "voltage":0.0, - "kmesh_lead_Ef":[1,1,20], + "lead_R": { + "id": "8-12", + "voltage": 0.0, + "kmesh_lead_Ef": [ + 1, + 1, + 20 + ], "useBloch": false } }, "poisson_options": { "solver": "fmm", - "err": 1e-5 + "err": 1e-05 + }, + "self_energy_options": { + "solver": "Sancho-Rubio" }, - "sgf_solver": "Sancho-Rubio", - "espacing": 0.02, - "emin": -1.5, - "emax": 1.5, "density_options": { "method": "Fiori", "integrate_way": "direct" }, - "eta_lead":1e-5, - "eta_device":0.0, - "out_dos": true, - "out_tc": true, - "out_ldos": true, - "out_current_nscf": false -}, -"AtomicData_options" :{ - "r_max": 3.0 -}, -"structure":"./chain.vasp" + "output_options": { + "dos": true, + "tc": true, + "ldos": true, + "current_nscf": false + } + }, + "AtomicData_options": { + "r_max": 3.0 + }, + "structure": "./chain.vasp" } diff --git a/examples/atomic_chain_cli/input_files/negf_chain_new.json b/examples/atomic_chain_cli/input_files/negf_chain_new.json index 5567523..21c2288 100644 --- a/examples/atomic_chain_cli/input_files/negf_chain_new.json +++ b/examples/atomic_chain_cli/input_files/negf_chain_new.json @@ -2,30 +2,58 @@ "task_options": { "task": "negf", "scf": false, - "n_cpus": 2, "block_tridiagonal": false, "ele_T": 300, "unit": "eV", - "stru_options":{ + "espacing": 0.01, + "emin": -2, + "emax": 2, + "eta_lead": 1e-05, + "eta_device": 0.0, + "self_energy_options": { + "solver": "Sancho-Rubio", + "parallel": { + "cpu_budget": 2 + } + }, + "stru_options": { "gamma_center": true, "time_reversal_symmetry": true, - "nel_atom": {"C": 1.0}, - "kmesh":[1,1,1], - "pbc":[false, false, false], - "device":{ - "id":"4-8", + "nel_atom": { + "C": 1.0 + }, + "kmesh": [ + 1, + 1, + 1 + ], + "pbc": [ + false, + false, + false + ], + "device": { + "id": "4-8", "sort": true }, - "lead_L":{ - "id":"0-4", - "voltage":0.0, - "kmesh_lead_Ef":[1,1,20], + "lead_L": { + "id": "0-4", + "voltage": 0.0, + "kmesh_lead_Ef": [ + 1, + 1, + 20 + ], "useBloch": false }, - "lead_R":{ - "id":"8-12", - "voltage":0.0, - "kmesh_lead_Ef":[1,1,20], + "lead_R": { + "id": "8-12", + "voltage": 0.0, + "kmesh_lead_Ef": [ + 1, + 1, + 20 + ], "useBloch": false } }, @@ -33,19 +61,15 @@ "method": "Fiori", "integrate_way": "direct" }, - "sgf_solver": "Sancho-Rubio", - "espacing": 0.01, - "emin": -2, - "emax": 2, - "eta_lead":1e-5, - "eta_device":0.0, - "out_dos": true, - "out_tc": true, - "out_ldos": true, - "out_current_nscf": true -}, -"AtomicData_options" :{ - "r_max": 2.0 -}, -"structure":"./chain.vasp" + "output_options": { + "dos": true, + "tc": true, + "ldos": true, + "current_nscf": true + } + }, + "AtomicData_options": { + "r_max": 2.0 + }, + "structure": "./chain.vasp" } diff --git a/examples/graphene/negf.json b/examples/graphene/negf.json index e04d965..fe53d5d 100644 --- a/examples/graphene/negf.json +++ b/examples/graphene/negf.json @@ -1,52 +1,73 @@ -{ - "structure":"./struct_negf.xyz", - "task_options": - { - "task": "negf", - "scf": false, - "block_tridiagonal": true, - "ele_T": 300, - "unit": "eV", - "stru_options":{ - "gamma_center": false, - "time_reversal_symmetry": true, - "nel_atom": {"C": 4}, - "kmesh":[1,1,1], - "pbc":[false, true, false], - "device":{ - "id":"32-64", - "sort": true - }, - "lead_L":{ - "id":"0-32", - "voltage":0.0, - "kmesh_lead_Ef":[1,50,20], - "useBloch": false - }, - "lead_R":{ - "id":"64-96", - "voltage":0.0, - "kmesh_lead_Ef":[1,50,20], - "useBloch": false - } +{ + "structure": "./struct_negf.xyz", + "task_options": { + "task": "negf", + "scf": false, + "block_tridiagonal": true, + "ele_T": 300, + "unit": "eV", + "espacing": 0.05, + "emin": -10, + "emax": 10, + "eta_lead": 1e-05, + "eta_device": 0.0, + "stru_options": { + "gamma_center": false, + "time_reversal_symmetry": true, + "nel_atom": { + "C": 4 }, - "density_options": { + "kmesh": [ + 1, + 1, + 1 + ], + "pbc": [ + false, + true, + false + ], + "device": { + "id": "32-64", + "sort": true + }, + "lead_L": { + "id": "0-32", + "voltage": 0.0, + "kmesh_lead_Ef": [ + 1, + 50, + 20 + ], + "useBloch": false + }, + "lead_R": { + "id": "64-96", + "voltage": 0.0, + "kmesh_lead_Ef": [ + 1, + 50, + 20 + ], + "useBloch": false + } + }, + "density_options": { "method": "Fiori", "integrate_way": "direct" - }, - "poisson_options": { + }, + "poisson_options": { "solver": "fmm", - "err": 1e-5 - }, - "sgf_solver": "Sancho-Rubio", - "espacing": 0.05, - "emin": -10, - "emax": 10, - "eta_lead":1e-5, - "eta_device":0.0, - "out_dos": true, - "out_tc": true, - "out_ldos": true, - "out_current_nscf": false + "err": 1e-05 + }, + "self_energy_options": { + "solver": "Sancho-Rubio" + }, + "output_options": { + "dos": true, + "tc": true, + "ldos": true, + "current_nscf": false + } } } diff --git a/examples/hBN/negf.json b/examples/hBN/negf.json index 3cbef14..579ba1a 100644 --- a/examples/hBN/negf.json +++ b/examples/hBN/negf.json @@ -1,53 +1,74 @@ -{ - "structure":"./struct_negf.xyz", - "task_options": - { - "task": "negf", - "scf": false, - "block_tridiagonal": true, - "ele_T": 300, - "unit": "eV", - "stru_options":{ - "gamma_center": false, - "time_reversal_symmetry": true, - "nel_atom": {"B": 3, - "N": 5}, - "kmesh":[1,1,1], - "pbc":[false, true, false], - "device":{ - "id":"32-64", - "sort": true - }, - "lead_L":{ - "id":"0-32", - "voltage":0.0, - "kmesh_lead_Ef":[1,50,20], - "useBloch": false - }, - "lead_R":{ - "id":"64-96", - "voltage":0.0, - "kmesh_lead_Ef":[1,50,20], - "useBloch": false - } +{ + "structure": "./struct_negf.xyz", + "task_options": { + "task": "negf", + "scf": false, + "block_tridiagonal": true, + "ele_T": 300, + "unit": "eV", + "espacing": 0.05, + "emin": -10, + "emax": 10, + "eta_lead": 1e-05, + "eta_device": 0.0, + "stru_options": { + "gamma_center": false, + "time_reversal_symmetry": true, + "nel_atom": { + "B": 3, + "N": 5 }, - "density_options": { + "kmesh": [ + 1, + 1, + 1 + ], + "pbc": [ + false, + true, + false + ], + "device": { + "id": "32-64", + "sort": true + }, + "lead_L": { + "id": "0-32", + "voltage": 0.0, + "kmesh_lead_Ef": [ + 1, + 50, + 20 + ], + "useBloch": false + }, + "lead_R": { + "id": "64-96", + "voltage": 0.0, + "kmesh_lead_Ef": [ + 1, + 50, + 20 + ], + "useBloch": false + } + }, + "density_options": { "method": "Fiori", "integrate_way": "direct" - }, - "poisson_options": { + }, + "poisson_options": { "solver": "fmm", - "err": 1e-5 - }, - "sgf_solver": "Sancho-Rubio", - "espacing": 0.05, - "emin": -10, - "emax": 10, - "eta_lead":1e-5, - "eta_device":0.0, - "out_dos": true, - "out_tc": true, - "out_ldos": true, - "out_current_nscf": false + "err": 1e-05 + }, + "self_energy_options": { + "solver": "Sancho-Rubio" + }, + "output_options": { + "dos": true, + "tc": true, + "ldos": true, + "current_nscf": false + } } }