From f50cb43a1e63f73d03f4bd1c7c5075fd1410029d Mon Sep 17 00:00:00 2001 From: Joseph Weston <joseph@weston.cloud> Date: Tue, 22 Jan 2019 15:10:48 +0100 Subject: [PATCH] correct magnetic field units Magnetic fields are now expressed in units of magnetic flux quantum per unit area. --- kwant/physics/gauge.py | 5 ++++- kwant/physics/tests/test_gauge.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/kwant/physics/gauge.py b/kwant/physics/gauge.py index 79682f6a..b120df8a 100644 --- a/kwant/physics/gauge.py +++ b/kwant/physics/gauge.py @@ -787,7 +787,7 @@ def calculate_phases(loops, pos, previous_phase, flux): for loop in loops: tail, head = loop[-1], loop[0] integral = flux([pos(p) for p in loop]) - phase = np.exp(2j * np.pi * integral) + phase = np.exp(1j * np.pi * integral) phases[tail, head] = phase / previous_phase(phases, loop) return phases @@ -1001,6 +1001,9 @@ class magnetic_gauge: If callable, takes a position and returns the magnetic field at that position. Can be a scalar if the system is 1D or 2D, otherwise must be a vector. + Magnetic field is expressed in units :math:`φ₀ / l²`, + where :math:`φ₀` is the magnetic flux quantum and + :math:`l` is the unit of length. *lead_fields : scalar, vector or callable The magnetic fields to apply to each of the leads, in the same format as 'syst_field'. In addition, if a callable diff --git a/kwant/physics/tests/test_gauge.py b/kwant/physics/tests/test_gauge.py index 510259d4..9798a82a 100644 --- a/kwant/physics/tests/test_gauge.py +++ b/kwant/physics/tests/test_gauge.py @@ -211,7 +211,7 @@ def _test_phase_loops(syst, phases, loops): for loop_kind, loop_flux in loops: for loop in available_loops(syst, loop_kind): loop_phase = np.prod([phases(a, b) for a, b in loop_to_links(loop)]) - expected_loop_phase = np.exp(2j * np.pi * loop_flux) + expected_loop_phase = np.exp(1j * np.pi * loop_flux) assert np.isclose(loop_phase, expected_loop_phase) -- GitLab