-
Anton Akhmerov authoredAnton Akhmerov authored
What's new in Kwant 1.3
This article explains the user-visible changes in Kwant 1.3. Please consult the full list of changes in Kwant for all the changes up to the most recent bugfix release.
Calculating charges and currents using the operator
module
Often one may wish to calculate quantities that are defined over sites of
the system (such as charge density, spin density along some axis etc),
or over hoppings of the system (such as current or spin current). With
the introduction of the operator
module it has now become much easier
to calculate such quantities. To calculate the regular density and current
everywhere in a system due to a wavefunction wf
, one only needs to do
the following:
syst = make_system().finalized()
wfs = kwant.wave_function(syst)
wf = wfs[0]
# create the operators
Q = kwant.physics.LocalOperator(syst)
J = kwant.physics.Current(syst)
# evaluate the operator matrix elements
q = Q(wf)
j = J(wf)
See the Kwant tutorial for more details.
Sites in finalized builders have consistent ordering
In Python 3 the internal ordering of dictionaries is not deterministic. This meant that running a Kwant script twice would produce systems with different ordering of sites, which lead to non-reproducible calculations. Now, sites in finalized builders are always ordered first by their site family, then by their tag.
Coincidentally, this means that you can plot a wavefunction in a simple 1D system by just saying:
lattice_1D = chain()
syst = make_system(lattice_1D)
h = syst.hamiltonian_submatrix()
pyplot.plot(np.eigs(h)[1][0])
Improved build configuration
The name of the build configuration file, build.conf
by default, is now
configurable with the --configfile=PATH
option to setup.py
. (This
makes build configuration usable with the pip
tool.) The build
configuration as specified in this file is now more general, allowing to
modify any build parameter for any of the compiled extensions contained in
Kwant. See the :ref:`Installation instructions <build-configuration>` for
details.
Scattering states with discrete symmetries
Three discrete symmetries are especially relevant in condensed matter physics, namely time-reversal symmetry, particle-hole symmetry and chiral (or sublattice) symmetry. When one or more of these symmetries are present, and it can be useful to have leads with scattering states that reflect this. It is now possible to these discrete symmetries in Kwant, which then uses them to construct scattering states that are accordingly symmetric.
Pickling support
It is now possible to pickle and unpickle Kwant Builder
and System
.
Using Builders as templates with Builder.fill()
Builders now have a fill() method that fills the Builder with copies of a template Builder (passed as a parameter). This can be used to "cut out" shapes from high-symmetry models, or to increase the symmetry period of a lead.
attach_lead() can now handle leads with greater than nearest-neighbor hoppings
When attaching a lead with greater than nearest-neighbor hoppings, the symmetry period of the finalized lead is suitably extended and the unit cell size is increased.