Skip to content

Commit

Permalink
update example in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Libor Vojacek committed Oct 10, 2024
1 parent a9d3e1e commit ac8e6fc
Show file tree
Hide file tree
Showing 25 changed files with 469 additions and 11 deletions.
Binary file modified docs/build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/build/doctrees/example.doctree
Binary file not shown.
Binary file added docs/build/html/_images/clean_wire.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/build/html/_images/single_middle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/build/html/_images/single_middle_shifted.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 44 additions & 3 deletions docs/build/html/_sources/example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ There is also a time-complexity study in ``./examples/time_complexity.ipynb``.
chain = LinearChain(N=100, eps_0=0.0, t=1.0, a=1.0, H_impurity=None, plot_dispersion=True)
.. image::
./_images/clean_wire.png
:width: 370px
:align: center

.. image::
./_images/linear_chain_dispersion_analytic_vs_diagonalized.png
:width: 550px
Expand All @@ -34,6 +39,12 @@ There is also a time-complexity study in ``./examples/time_complexity.ipynb``.
chain.add_H_impurity(H_impurity, plot_dispersion=False)
chain.plot_onsite_energy()
.. image::
./_images/single_middle_shifted_more.png
:width: 450px
:align: center


.. image::
./_images/impurity_single_middle.png
:width: 450px
Expand All @@ -53,6 +64,7 @@ This can be demonstrated by calculating the occupation function profile.
Without any relaxation mechanism, strong resonances arise, making the potential drop unclear.

.. code-block:: python
# no relaxation
D0_phase = 0.00 * t**2
D0_phase_momentum = 0.00 * t**2
Expand All @@ -61,7 +73,7 @@ Without any relaxation mechanism, strong resonances arise, making the potential
.. image::
./_images/single_imp_middle_no_relaxation.png
:width: 350px
:width: 380px
:align: center

3.2. Phase relaxation
Expand All @@ -70,6 +82,7 @@ Without any relaxation mechanism, strong resonances arise, making the potential
Phase relaxation attenuates the Fabry-Pérot resonances.

.. code-block:: python
# only phase
D0_phase = 0.09 * t**2
D0_phase_momentum = 0.00 * t**2
Expand All @@ -78,7 +91,7 @@ Phase relaxation attenuates the Fabry-Pérot resonances.
.. image::
./_images/single_imp_middle_phase_relaxation.png
:width: 350px
:width: 380px
:align: center


Expand All @@ -88,6 +101,7 @@ Phase relaxation attenuates the Fabry-Pérot resonances.
With an additional momentum relaxation, the potential drop is partially distributed over the whole channel length.

.. code-block:: python
# phase and momentum
D0_phase = 0.09 * t**2
D0_phase_momentum = 0.03 * t**2
Expand All @@ -96,7 +110,7 @@ With an additional momentum relaxation, the potential drop is partially distribu
.. image::
./_images/single_imp_middle_phase_and_momentum_relaxation.png
:width: 350px
:width: 380px
:align: center


Expand Down Expand Up @@ -141,6 +155,33 @@ Let us now compare the transmission for several cases.
4. With many distributed impurities of equivalent total strength :math:`\Sigma_i U_i = -2.0 t`, the transmission starts to resemble the clean limit :math:`T(E) = 1.0 = \mathrm{const.}`


.. code-block:: python
# RELAXATION
D0_phase = 0.12 * t**2
D0_phase_momentum = 0.03 * t**2
N_sc = 90
# IMPURITY HAMILTONIANS
H_imp_clean = np.zeros((N, N))
H_imp_single = np.zeros((N, N))
H_imp_single[N // 2, N // 2] = -2 * t
...
H_impurities = [H_imp_clean, H_imp_single, H_imp_double, H_imp_multiple]
# CALCULATE AND PLOT
fig, axes = plt.subplots(5,len(H_impurities))
for i, H_imp in enumerate(H_impurities):
chain = LinearChain(N, eps_0, t, a, H_impurity=H_imp, plot_dispersion=False)
chain.plot_onsite_energy(axes[0, i])
chain.plot_occupation(
D0_phase=0, D0_phase_momentum=0, E_to_plot=E_to_plot, N_sc=N_sc, ax=axes[1, i]
)
...
.. image::
./_images/example_fuNEGF.png
:width: 950px
Expand Down
54 changes: 51 additions & 3 deletions docs/build/html/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ <h2>1. Linear-chain tight-binding Hamiltonian<a class="headerlink" href="#linear
<span class="n">chain</span> <span class="o">=</span> <span class="n">LinearChain</span><span class="p">(</span><span class="n">N</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span> <span class="n">eps_0</span><span class="o">=</span><span class="mf">0.0</span><span class="p">,</span> <span class="n">t</span><span class="o">=</span><span class="mf">1.0</span><span class="p">,</span> <span class="n">a</span><span class="o">=</span><span class="mf">1.0</span><span class="p">,</span> <span class="n">H_impurity</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">plot_dispersion</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</pre></div>
</div>
<a class="reference internal image-reference" href="_images/clean_wire.png"><img alt="_images/clean_wire.png" class="align-center" src="_images/clean_wire.png" style="width: 370px;" /></a>
<a class="reference internal image-reference" href="_images/linear_chain_dispersion_analytic_vs_diagonalized.png"><img alt="_images/linear_chain_dispersion_analytic_vs_diagonalized.png" class="align-center" src="_images/linear_chain_dispersion_analytic_vs_diagonalized.png" style="width: 550px;" /></a>
</div>
<div class="section" id="impurity-potential">
Expand All @@ -345,6 +346,7 @@ <h2>2. Impurity potential<a class="headerlink" href="#impurity-potential" title=
<span class="n">chain</span><span class="o">.</span><span class="n">plot_onsite_energy</span><span class="p">()</span>
</pre></div>
</div>
<a class="reference internal image-reference" href="_images/single_middle_shifted_more.png"><img alt="_images/single_middle_shifted_more.png" class="align-center" src="_images/single_middle_shifted_more.png" style="width: 450px;" /></a>
<a class="reference internal image-reference" href="_images/impurity_single_middle.png"><img alt="_images/impurity_single_middle.png" class="align-center" src="_images/impurity_single_middle.png" style="width: 450px;" /></a>
</div>
<div class="section" id="chemical-potential-with-impurities">
Expand All @@ -354,17 +356,38 @@ <h2>3. Chemical potential with impurities<a class="headerlink" href="#chemical-p
<div class="section" id="no-relaxation">
<h3>3.1. No relaxation<a class="headerlink" href="#no-relaxation" title="Permalink to this heading">#</a></h3>
<p>Without any relaxation mechanism, strong resonances arise, making the potential drop unclear.</p>
<a class="reference internal image-reference" href="_images/single_imp_middle_no_relaxation.png"><img alt="_images/single_imp_middle_no_relaxation.png" class="align-center" src="_images/single_imp_middle_no_relaxation.png" style="width: 350px;" /></a>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># no relaxation</span>
<span class="n">D0_phase</span> <span class="o">=</span> <span class="mf">0.00</span> <span class="o">*</span> <span class="n">t</span><span class="o">**</span><span class="mi">2</span>
<span class="n">D0_phase_momentum</span> <span class="o">=</span> <span class="mf">0.00</span> <span class="o">*</span> <span class="n">t</span><span class="o">**</span><span class="mi">2</span>

<span class="n">plot_onsite_and_occupation</span><span class="p">(</span><span class="n">E_to_plot</span><span class="p">,</span> <span class="n">D0_phase</span><span class="p">,</span> <span class="n">D0_phase_momentum</span><span class="p">,</span> <span class="n">N_sc</span><span class="p">)</span>
</pre></div>
</div>
<a class="reference internal image-reference" href="_images/single_imp_middle_no_relaxation.png"><img alt="_images/single_imp_middle_no_relaxation.png" class="align-center" src="_images/single_imp_middle_no_relaxation.png" style="width: 380px;" /></a>
</div>
<div class="section" id="phase-relaxation">
<h3>3.2. Phase relaxation<a class="headerlink" href="#phase-relaxation" title="Permalink to this heading">#</a></h3>
<p>Phase relaxation attenuates the Fabry-Pérot resonances.</p>
<a class="reference internal image-reference" href="_images/single_imp_middle_phase_relaxation.png"><img alt="_images/single_imp_middle_phase_relaxation.png" class="align-center" src="_images/single_imp_middle_phase_relaxation.png" style="width: 350px;" /></a>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># only phase</span>
<span class="n">D0_phase</span> <span class="o">=</span> <span class="mf">0.09</span> <span class="o">*</span> <span class="n">t</span><span class="o">**</span><span class="mi">2</span>
<span class="n">D0_phase_momentum</span> <span class="o">=</span> <span class="mf">0.00</span> <span class="o">*</span> <span class="n">t</span><span class="o">**</span><span class="mi">2</span>

<span class="n">plot_onsite_and_occupation</span><span class="p">(</span><span class="n">E_to_plot</span><span class="p">,</span> <span class="n">D0_phase</span><span class="p">,</span> <span class="n">D0_phase_momentum</span><span class="p">,</span> <span class="n">N_sc</span><span class="p">)</span>
</pre></div>
</div>
<a class="reference internal image-reference" href="_images/single_imp_middle_phase_relaxation.png"><img alt="_images/single_imp_middle_phase_relaxation.png" class="align-center" src="_images/single_imp_middle_phase_relaxation.png" style="width: 380px;" /></a>
</div>
<div class="section" id="phase-and-momentum-relaxation">
<h3>3.3. Phase and momentum relaxation<a class="headerlink" href="#phase-and-momentum-relaxation" title="Permalink to this heading">#</a></h3>
<p>With an additional momentum relaxation, the potential drop is partially distributed over the whole channel length.</p>
<a class="reference internal image-reference" href="_images/single_imp_middle_phase_and_momentum_relaxation.png"><img alt="_images/single_imp_middle_phase_and_momentum_relaxation.png" class="align-center" src="_images/single_imp_middle_phase_and_momentum_relaxation.png" style="width: 350px;" /></a>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># phase and momentum</span>
<span class="n">D0_phase</span> <span class="o">=</span> <span class="mf">0.09</span> <span class="o">*</span> <span class="n">t</span><span class="o">**</span><span class="mi">2</span>
<span class="n">D0_phase_momentum</span> <span class="o">=</span> <span class="mf">0.03</span> <span class="o">*</span> <span class="n">t</span><span class="o">**</span><span class="mi">2</span>

<span class="n">plot_onsite_and_occupation</span><span class="p">(</span><span class="n">E_to_plot</span><span class="p">,</span> <span class="n">D0_phase</span><span class="p">,</span> <span class="n">D0_phase_momentum</span><span class="p">,</span> <span class="n">N_sc</span><span class="p">)</span>
</pre></div>
</div>
<a class="reference internal image-reference" href="_images/single_imp_middle_phase_and_momentum_relaxation.png"><img alt="_images/single_imp_middle_phase_and_momentum_relaxation.png" class="align-center" src="_images/single_imp_middle_phase_and_momentum_relaxation.png" style="width: 380px;" /></a>
</div>
</div>
<div class="section" id="transmission-function">
Expand Down Expand Up @@ -396,6 +419,31 @@ <h3>4.2. Different impurity distributions<a class="headerlink" href="#different-
</ol>
</dd>
</dl>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># RELAXATION</span>
<span class="n">D0_phase</span> <span class="o">=</span> <span class="mf">0.12</span> <span class="o">*</span> <span class="n">t</span><span class="o">**</span><span class="mi">2</span>
<span class="n">D0_phase_momentum</span> <span class="o">=</span> <span class="mf">0.03</span> <span class="o">*</span> <span class="n">t</span><span class="o">**</span><span class="mi">2</span>
<span class="n">N_sc</span> <span class="o">=</span> <span class="mi">90</span>

<span class="c1"># IMPURITY HAMILTONIANS</span>
<span class="n">H_imp_clean</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">zeros</span><span class="p">((</span><span class="n">N</span><span class="p">,</span> <span class="n">N</span><span class="p">))</span>
<span class="n">H_imp_single</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">zeros</span><span class="p">((</span><span class="n">N</span><span class="p">,</span> <span class="n">N</span><span class="p">))</span>
<span class="n">H_imp_single</span><span class="p">[</span><span class="n">N</span> <span class="o">//</span> <span class="mi">2</span><span class="p">,</span> <span class="n">N</span> <span class="o">//</span> <span class="mi">2</span><span class="p">]</span> <span class="o">=</span> <span class="o">-</span><span class="mi">2</span> <span class="o">*</span> <span class="n">t</span>
<span class="o">...</span>

<span class="n">H_impurities</span> <span class="o">=</span> <span class="p">[</span><span class="n">H_imp_clean</span><span class="p">,</span> <span class="n">H_imp_single</span><span class="p">,</span> <span class="n">H_imp_double</span><span class="p">,</span> <span class="n">H_imp_multiple</span><span class="p">]</span>

<span class="c1"># CALCULATE AND PLOT</span>
<span class="n">fig</span><span class="p">,</span> <span class="n">axes</span> <span class="o">=</span> <span class="n">plt</span><span class="o">.</span><span class="n">subplots</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span><span class="nb">len</span><span class="p">(</span><span class="n">H_impurities</span><span class="p">))</span>

<span class="k">for</span> <span class="n">i</span><span class="p">,</span> <span class="n">H_imp</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">H_impurities</span><span class="p">):</span>
<span class="n">chain</span> <span class="o">=</span> <span class="n">LinearChain</span><span class="p">(</span><span class="n">N</span><span class="p">,</span> <span class="n">eps_0</span><span class="p">,</span> <span class="n">t</span><span class="p">,</span> <span class="n">a</span><span class="p">,</span> <span class="n">H_impurity</span><span class="o">=</span><span class="n">H_imp</span><span class="p">,</span> <span class="n">plot_dispersion</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="n">chain</span><span class="o">.</span><span class="n">plot_onsite_energy</span><span class="p">(</span><span class="n">axes</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="n">i</span><span class="p">])</span>
<span class="n">chain</span><span class="o">.</span><span class="n">plot_occupation</span><span class="p">(</span>
<span class="n">D0_phase</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">D0_phase_momentum</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">E_to_plot</span><span class="o">=</span><span class="n">E_to_plot</span><span class="p">,</span> <span class="n">N_sc</span><span class="o">=</span><span class="n">N_sc</span><span class="p">,</span> <span class="n">ax</span><span class="o">=</span><span class="n">axes</span><span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="n">i</span><span class="p">]</span>
<span class="p">)</span>
<span class="o">...</span>
</pre></div>
</div>
<a class="reference internal image-reference" href="_images/example_fuNEGF.png"><img alt="_images/example_fuNEGF.png" class="align-center" src="_images/example_fuNEGF.png" style="width: 950px;" /></a>
</div>
</div>
Expand Down
Loading

0 comments on commit ac8e6fc

Please sign in to comment.