Skip to content
Snippets Groups Projects
Commit ad4bc56e authored by Christoph Groth's avatar Christoph Groth
Browse files

merge commits from the 1.2 branch that should have rather gone to 1.1

parents 6c3ca9b1 2de760a3
No related branches found
No related tags found
No related merge requests found
......@@ -75,13 +75,10 @@ A useful trick for working on the source code is to build in-place so that there
is no need to re-install after each change. This can be done with the following
command ::
python setup.py build_ext -i --cython
python setup.py build_ext -i
The ``kwant`` subdirectory of the source distribution will be thus turned into
a proper Python package that can be imported. To be able to import Kwant from
within Python, one can either work in the root directory of the distribution
(where the subdirectory ``kwant`` is located), or make a (symbolic) link from
somewhere in the Python search path to the the package subdirectory.
The option ``--cython`` enables the translation of .pyx files into .c files.
It is only needed if any .pyx files have been modified.
......@@ -8,27 +8,7 @@
from cmath import exp
from math import pi
@@ -40,12 +41,13 @@
sys[lat.shape(ring, (0, r1 + 1))] = 4 * t
sys[lat.neighbors()] = -t
- # In order to introduce a flux through the ring, we introduce a phase on
- # the hoppings on the line cut through one of the arms. Since we want to
- # change the flux without modifying the Builder instance repeatedly, we
- # define the modified hoppings as a function that takes the flux as its
- # parameter phi.
- def fluxphase(site1, site2, phi):
+ # In order to introduce a flux through the ring, we introduce a phase
+ # on the hoppings on the line cut through one of the arms
+
+ # since we want to change the flux without modifying Builder repeatedly,
+ # we define the modified hoppings as a function that takes the flux
+ # through the argument phi.
+ def fluxphase(site1, site2, phi=0):
return exp(1j * phi)
def crosses_branchcut(hop):
@@ -81,6 +83,50 @@
@@ -81,6 +82,50 @@
return sys
......@@ -79,7 +59,7 @@
def plot_conductance(sys, energy, fluxes):
# compute conductance
@@ -90,18 +136,31 @@
@@ -90,18 +135,31 @@
smatrix = kwant.smatrix(sys, energy, args=[flux])
data.append(smatrix.transmission(1, 0))
......@@ -116,7 +96,7 @@
# Finalize the system.
sys = sys.finalized()
@@ -111,6 +170,17 @@
@@ -111,6 +169,17 @@
for i in xrange(100)])
......
......@@ -50,8 +50,8 @@ def make_system(a=1, t=1.0, W=10, r1=10, r2=20):
# define the modified hoppings as a function that takes the flux as its
# parameter phi.
#HIDDEN_BEGIN_lvkt
def fluxphase(site1, site2, phi):
return exp(1j * phi)
def hopping_phase(site1, site2, phi):
return -t * exp(1j * phi)
def crosses_branchcut(hop):
ix0, iy0 = hop[0].tag
......@@ -65,7 +65,7 @@ def make_system(a=1, t=1.0, W=10, r1=10, r2=20):
for hop in kwant.builder.HoppingKind((1, 0), lat, lat)(sys):
if crosses_branchcut(hop):
yield hop
sys[hops_across_cut] = fluxphase
sys[hops_across_cut] = hopping_phase
#HIDDEN_END_lvkt
#### Define the leads. ####
......
......@@ -62,7 +62,7 @@ try:
sys.argv.remove(CYTHON_OPTION)
use_cython = True
except ValueError:
use_cython = False
use_cython = version_is_from_git
if use_cython:
try:
......@@ -355,7 +355,7 @@ def complain_cython_unavailable():
ver = '.'.join(str(e) for e in REQUIRED_CYTHON_VERSION)
print(msg.format(ver), file=sys.stderr)
else:
print("Run setup.py without {}.".format(NO_CYTHON_OPTION),
print("Run setup.py with the {} option.".format(CYTHON_OPTION),
file=sys.stderr)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment