Skip to content
Snippets Groups Projects
Commit bab5684f authored by Anton Akhmerov's avatar Anton Akhmerov Committed by Christoph Groth
Browse files

show plotter.map in tutorial3

parent 5f74b6c1
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,7 @@
def make_system(a=1, t=1.0, r=10):
@@ -70,19 +71,24 @@
@@ -70,32 +71,43 @@
energies.append(ev)
......@@ -31,6 +31,26 @@
+ fig.savefig("closed_system_result.png", dpi=_defs.dpi)
def plot_wave_function(sys):
# We reset the magnetic field to equal to 0.
global B
B = 0.
+ size = (_defs.figwidth_in, _defs.figwidth_in)
# Calculate the wave functions in the system.
ham_mat = sys.hamiltonian_submatrix(sparse=True)
evecs = sla.eigsh(ham_mat, k=20, which='SM')[1]
# Plot the probability density of the 10th eigenmode.
- kwant.plotter.map(sys, np.abs(evecs[:, 9])**2, colorbar=False)
+ kwant.plotter.map(sys, np.abs(evecs[:, 9])**2, colorbar=False,
+ file="closed_system_eigenvector.pdf",
+ fig_size=size, dpi=_defs.dpi)
+ kwant.plotter.map(sys, np.abs(evecs[:, 9])**2, colorbar=False,
+ file="closed_system_eigenvector.png",
+ fig_size=size, dpi=_defs.dpi)
def main():
sys = make_system()
......@@ -40,3 +60,11 @@
# Finalize the system.
sys = sys.finalized()
@@ -108,6 +120,7 @@
sys = make_system(r=30).finalized()
plot_wave_function(sys)
+
# Call the main function if the script gets executed (as opposed to imported).
# See <http://docs.python.org/library/__main__.html>.
if __name__ == '__main__':
......@@ -83,6 +83,21 @@ def plot_spectrum(sys, Bfields):
#HIDDEN_END_yvri
#HIDDEN_BEGIN_wave
def plot_wave_function(sys):
# We reset the magnetic field to equal to 0.
global B
B = 0.
# Calculate the wave functions in the system.
ham_mat = sys.hamiltonian_submatrix(sparse=True)
evecs = sla.eigsh(ham_mat, k=20, which='SM')[1]
# Plot the probability density of the 10th eigenmode.
kwant.plotter.map(sys, np.abs(evecs[:, 9])**2, colorbar=False)
#HIDDEN_END_wave
def main():
sys = make_system()
......@@ -96,6 +111,10 @@ def main():
# level energies with increasing magnetic field
plot_spectrum(sys, [iB * 0.002 for iB in xrange(100)])
# Plot an eigenmode of a circular dot. Here we create a larger system for
# better spatial resolution.
sys = make_system(r=30).finalized()
plot_wave_function(sys)
# Call the main function if the script gets executed (as opposed to imported).
# See <http://docs.python.org/library/__main__.html>.
......
......@@ -101,6 +101,17 @@ quantum dot is rather symmetric). These degeneracies are split
by the magnetic field, and the eigenenergies flow towards the
Landau level energies at higher magnetic fields [#]
The eigenvectors are obtained very similarly, and can be plotted directly
using `~kwant.plotter.map`:
.. literalinclude:: closed_system.py
:start-after: #HIDDEN_BEGIN_wave
:end-before: #HIDDEN_END_wave
This yields the result:
.. image:: ../images/closed_system_eigenvector.*
.. seealso::
The full source code can be found in
:download:`tutorial/closed_system.py <../../../tutorial/closed_system.py>`
......
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