Skip to content

Commit

Permalink
mnt: fixed #477 and #478, changed *_current to *_transmission
Browse files Browse the repository at this point in the history
The orbital_current was confusing for end-users as it
signalled it was a bias-window integrated quantity.

Now the routines have changed names and additional ones
have been added.

*_transmission: are the orbital/atom/... resolved
  transmissions (they have `E` as argument)
*_current: are the orbital/atom/... bias window
  integrated quantities that reflects the total
  current (they don't have `E` as argument)

This will break old users scripts as the interfaces
has also changed.
Now all electrode arguments defaults to the 1st electrode
and energy arguments are generally the first ones (except DOS).

This *should* be more what users want as for 2 electrode systems
they'll generally only calculate one orbital_current for the first
electrode.

For old users one can accommodate these settings by using this
small snippet:

if sisl.__version_tuple__[:3] >= (0, 13, 0):
   tbt.orbital_transmission(0.1, "Left")
else:
   tbt.orbital_current("Left", 0.1)

Same goes for the other equivalent routines.
  • Loading branch information
zerothi committed Jul 29, 2022
1 parent 7f1f979 commit 70e5bf5
Show file tree
Hide file tree
Showing 4 changed files with 786 additions and 395 deletions.
15 changes: 14 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) once
we hit release version 1.0.0.

## [UNRELEASED] - YYYY-MM-DD
## [0.13.0] - YYYY-MM-DD

### Added
- enabled unit specification for lengths in cube-files
Expand All @@ -18,6 +18,19 @@ we hit release version 1.0.0.
- orbital quantum numbers from HSX file was wrong in v1, #462
- RealSpaceSI for right semi-infinite directions, #475

### Changed
- tbtncSileTBtrans and its derivates has changed, drastically.
This will accommodate changes related to #477 and #478.
Now `*_transmission` refers to energy resolved transmissions
and `*_current` reflects bias-window integrated quantities.
The defaults and argument order has changed drastically, so
users should adapt their scripts depending on `sisl` version.
A check can be made, `if sisl.__version_tuple__[:3] >= (0, 13, 0):`
- To streamline argument order the `*_ACO[OH]P` routines have changed
`elec` and `E` argument order. This makes them compatible with
`orbital_transmission` etc.


## [0.12.2] - 2022-5-2

### Added
Expand Down
37 changes: 37 additions & 0 deletions sisl/io/tbtrans/_cdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
# Import the geometry object
from sisl import Geometry, Atom, SuperCell
from sisl.unit.siesta import unit_convert
from sisl.physics.distribution import fermi_dirac


__all__ = ['_ncSileTBtrans', '_devncSileTBtrans']

Expand Down Expand Up @@ -177,6 +179,41 @@ def Eindex(self, E):
f"{E:.5f} eV, found {ret_E:.5f} eV as the closest energy!")
return idxE

def _bias_window_integrator(self, elec_from=0, elec_to=1):
r""" An integrator for the bias window between two electrodes
Given two chemical potentials this returns an integrator (function) which
returns weights for an input energy-point roughly equivalent to:
.. math::
dI = \mathrm dE\,[n_F(\mu_t, k_B T_t) - n_F(\mu_f, k_B T_f)]
In this case :mathrm:`\mathrm dE` is the distance between two consecutive
energy points in this file.
Parameters
----------
elec_from: str, int
the originating electrode
elec_to: str, int
the absorbing electrode (different from `elec_from`)
"""
elec_from = self._elec(elec_from)
kt_from = self.kT(elec_from)
mu_from = self.chemical_potential(elec_from)
elec_to = self._elec(elec_to)
kt_to = self.kT(elec_to)
mu_to = self.chemical_potential(elec_to)
# Get energies
E = self._E_T_sorted(elec_from, elec_to)[0]
dE = E[1] - E[0]

def integrator(E):
return dE * (fermi_dirac(E, kt_from, mu_from) - fermi_dirac(E, kt_to, mu_to))

return integrator

def kindex(self, k):
""" Return the index of the k-point that is closests to the queried k-point (in reduced coordinates)
Expand Down
Loading

0 comments on commit 70e5bf5

Please sign in to comment.