diff --git a/CONTRIBUTE.rst b/CONTRIBUTE.rst index 8063c8b230b86ed2253fad9bcf26b2b9eb953b89..978d5fd3c4149a89cf5b6ba0a6d7a8d0237a7daf 100644 --- a/CONTRIBUTE.rst +++ b/CONTRIBUTE.rst @@ -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. diff --git a/doc/source/images/ab_ring.py.diff b/doc/source/images/ab_ring.py.diff index bacb520123f3c4583447ee9114e3aa06dcb39452..7bb4c59b77bd9b5800031a959d458c68b9ee4b4a 100644 --- a/doc/source/images/ab_ring.py.diff +++ b/doc/source/images/ab_ring.py.diff @@ -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)]) diff --git a/doc/source/tutorial/ab_ring.py b/doc/source/tutorial/ab_ring.py index bd23bbf18453a17d6bfe07ad95364483490246da..5df7ecda6ef7f2331fc46b0756d7e5f5104cb126 100644 --- a/doc/source/tutorial/ab_ring.py +++ b/doc/source/tutorial/ab_ring.py @@ -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. #### diff --git a/setup.py b/setup.py index b1436a4f5c4c8d6e5d44daf9c24d935a4105d7ec..3b884b97e239eedb01950de25217d13d3deb39f4 100755 --- a/setup.py +++ b/setup.py @@ -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)