Skip to content
Snippets Groups Projects
Commit fa16ce52 authored by Kostas Vilkelis's avatar Kostas Vilkelis :flamingo:
Browse files

resolve conflicts

parent 1d928851
No related branches found
No related tags found
1 merge request!8Builder fixes
Pipeline #180712 passed
This commit is part of merge request !8. Comments created here will be created in the context of that merge request.
...@@ -4,7 +4,7 @@ jupytext: ...@@ -4,7 +4,7 @@ jupytext:
extension: .md extension: .md
format_name: myst format_name: myst
format_version: 0.13 format_version: 0.13
jupytext_version: 1.14.4 jupytext_version: 1.16.0
kernelspec: kernelspec:
display_name: Python 3 (ipykernel) display_name: Python 3 (ipykernel)
language: python language: python
...@@ -25,13 +25,11 @@ And yet, the workflow is the same as in the previous tutorial and remains simple ...@@ -25,13 +25,11 @@ And yet, the workflow is the same as in the previous tutorial and remains simple
As in the previous tutorial, we could construct a tight-binding dictionary of graphene by hand, but instead it is much easier to use [`kwant`](https://kwant-project.org/) to build the system. As in the previous tutorial, we could construct a tight-binding dictionary of graphene by hand, but instead it is much easier to use [`kwant`](https://kwant-project.org/) to build the system.
For a more detailed explanation on `kwant` see the [tutorial](https://kwant-project.org/doc/1/tutorial/graphene). For a more detailed explanation on `kwant` see the [tutorial](https://kwant-project.org/doc/1/tutorial/graphene).
```{code-cell} ipython3 ```{code-cell} ipython3
import numpy as np
import matplotlib.pyplot as plt
import kwant import kwant
import matplotlib.pyplot as plt
import meanfi import meanfi
import numpy as np
from meanfi.kwant_helper import utils from meanfi.kwant_helper import utils
s0 = np.identity(2) s0 = np.identity(2)
...@@ -40,8 +38,9 @@ sy = np.array([[0, -1j], [1j, 0]]) ...@@ -40,8 +38,9 @@ sy = np.array([[0, -1j], [1j, 0]])
sz = np.diag([1, -1]) sz = np.diag([1, -1])
# Create graphene lattice # Create graphene lattice
graphene = kwant.lattice.general([(1, 0), (1 / 2, np.sqrt(3) / 2)], graphene = kwant.lattice.general(
[(0, 0), (0, 1 / np.sqrt(3))], norbs=2) [(1, 0), (1 / 2, np.sqrt(3) / 2)], [(0, 0), (0, 1 / np.sqrt(3))], norbs=2
)
a, b = graphene.sublattices a, b = graphene.sublattices
# Create bulk system # Create bulk system
...@@ -120,8 +119,12 @@ rho_0, _ = meanfi.density_matrix(h_0, filling=filling, nk=40) ...@@ -120,8 +119,12 @@ rho_0, _ = meanfi.density_matrix(h_0, filling=filling, nk=40)
cdw_order_parameter = meanfi.expectation_value(rho, cdw_operator) cdw_order_parameter = meanfi.expectation_value(rho, cdw_operator)
cdw_order_parameter_0 = meanfi.expectation_value(rho_0, cdw_operator) cdw_order_parameter_0 = meanfi.expectation_value(rho_0, cdw_operator)
print(f"CDW order parameter for interacting system: {np.round(np.abs(cdw_order_parameter), 2)}") print(
print(f"CDW order parameter for non-interacting system: {np.round(np.abs(cdw_order_parameter_0), 2)}") f"CDW order parameter for interacting system: {np.round(np.abs(cdw_order_parameter), 2)}"
)
print(
f"CDW order parameter for non-interacting system: {np.round(np.abs(cdw_order_parameter_0), 2)}"
)
``` ```
We see that the CDW order parameter is non-zero only for the interacting system, indicating the presence of a CDW phase. We see that the CDW order parameter is non-zero only for the interacting system, indicating the presence of a CDW phase.
...@@ -166,11 +169,11 @@ for U in Us: ...@@ -166,11 +169,11 @@ for U in Us:
gaps = np.asarray(gaps, dtype=float).reshape((len(Us), len(Vs))) gaps = np.asarray(gaps, dtype=float).reshape((len(Us), len(Vs)))
mf_sols = np.asarray(mf_sols).reshape((len(Us), len(Vs))) mf_sols = np.asarray(mf_sols).reshape((len(Us), len(Vs)))
plt.imshow(gaps.T, extent=(Us[0], Us[-1], Vs[0], Vs[-1]), origin='lower', aspect='auto') plt.imshow(gaps.T, extent=(Us[0], Us[-1], Vs[0], Vs[-1]), origin="lower", aspect="auto")
plt.colorbar() plt.colorbar()
plt.xlabel('V') plt.xlabel("V")
plt.ylabel('U') plt.ylabel("U")
plt.title('Gap') plt.title("Gap")
plt.show() plt.show()
``` ```
...@@ -188,13 +191,13 @@ for mf_sol in mf_sols.flatten(): ...@@ -188,13 +191,13 @@ for mf_sol in mf_sols.flatten():
rho, _ = meanfi.density_matrix(meanfi.add_tb(h_0, mf_sol), filling=filling, nk=40) rho, _ = meanfi.density_matrix(meanfi.add_tb(h_0, mf_sol), filling=filling, nk=40)
# Compute CDW order parameter # Compute CDW order parameter
cdw_list.append(np.abs(meanfi.expectation_value(rho, cdw_operator))**2) cdw_list.append(np.abs(meanfi.expectation_value(rho, cdw_operator)) ** 2)
# Compute SDW order parameter # Compute SDW order parameter
sdw_value = 0 sdw_value = 0
for s_i in s_list: for s_i in s_list:
sdw_operator_i = {(0, 0) : np.kron(sz, s_i)} sdw_operator_i = {(0, 0): np.kron(sz, s_i)}
sdw_value += np.abs(meanfi.expectation_value(rho, sdw_operator_i))**2 sdw_value += np.abs(meanfi.expectation_value(rho, sdw_operator_i)) ** 2
sdw_list.append(sdw_value) sdw_list.append(sdw_value)
cdw_list = np.asarray(cdw_list).reshape(mf_sols.shape) cdw_list = np.asarray(cdw_list).reshape(mf_sols.shape)
...@@ -206,10 +209,25 @@ We naively do this by plotting the difference between CDW and SDW order paramete ...@@ -206,10 +209,25 @@ We naively do this by plotting the difference between CDW and SDW order paramete
```{code-cell} ipython3 ```{code-cell} ipython3
import matplotlib.ticker as mticker import matplotlib.ticker as mticker
normalized_gap = gaps/np.max(gaps)
plt.imshow((cdw_list - sdw_list).T, extent=(Us[0], Us[-1], Vs[0], Vs[-1]), origin='lower', aspect='auto', cmap="coolwarm", alpha=normalized_gap.T, vmin=-2.6, vmax=2.6) normalized_gap = gaps / np.max(gaps)
plt.colorbar(ticks=[-2.6, 0, 2.6], format=mticker.FixedFormatter(['SDW', '0', 'CDW']), label='Order parameter', extend='both') plt.imshow(
plt.xlabel('V') (cdw_list - sdw_list).T,
plt.ylabel('U') extent=(Us[0], Us[-1], Vs[0], Vs[-1]),
origin="lower",
aspect="auto",
cmap="coolwarm",
alpha=normalized_gap.T,
vmin=-2.6,
vmax=2.6,
)
plt.colorbar(
ticks=[-2.6, 0, 2.6],
format=mticker.FixedFormatter(["SDW", "0", "CDW"]),
label="Order parameter",
extend="both",
)
plt.xlabel("V")
plt.ylabel("U")
plt.show() plt.show()
``` ```
...@@ -4,7 +4,7 @@ jupytext: ...@@ -4,7 +4,7 @@ jupytext:
extension: .md extension: .md
format_name: myst format_name: myst
format_version: 0.13 format_version: 0.13
jupytext_version: 1.14.4 jupytext_version: 1.16.0
kernelspec: kernelspec:
display_name: Python 3 (ipykernel) display_name: Python 3 (ipykernel)
language: python language: python
...@@ -65,8 +65,8 @@ In the corresponding tight-binding dictionary `h_0`, the key `(0,)` contains hop ...@@ -65,8 +65,8 @@ In the corresponding tight-binding dictionary `h_0`, the key `(0,)` contains hop
To verify the validity of `h_0`, we evaluate it in the reciprocal space using the {autolink}`~meanfi.tb.transforms.tb_to_kgrid`, then diagonalize it and plot the band structure: To verify the validity of `h_0`, we evaluate it in the reciprocal space using the {autolink}`~meanfi.tb.transforms.tb_to_kgrid`, then diagonalize it and plot the band structure:
```{code-cell} ipython3 ```{code-cell} ipython3
nk = 50 # number of k-points nk = 50 # number of k-points
ks = np.linspace(0, 2*np.pi, nk, endpoint=False) ks = np.linspace(0, 2 * np.pi, nk, endpoint=False)
hamiltonians_0 = meanfi.tb_to_kgrid(h_0, nk) hamiltonians_0 = meanfi.tb_to_kgrid(h_0, nk)
vals, vecs = np.linalg.eigh(hamiltonians_0) vals, vecs = np.linalg.eigh(hamiltonians_0)
...@@ -90,8 +90,11 @@ Based on the kronecker product structure we defined earlier, the interaction Ham ...@@ -90,8 +90,11 @@ Based on the kronecker product structure we defined earlier, the interaction Ham
```{code-cell} ipython3 ```{code-cell} ipython3
U = 2 U = 2
s_x = np.array([[0, 1], [1, 0]]) s_x = np.array([[0, 1], [1, 0]])
h_int = {(0,): U * np.kron(np.eye(2), s_x),} h_int = {
(0,): U * np.kron(np.eye(2), s_x),
}
``` ```
Here `s_x` is the Pauli matrix acting on the spin degrees of freedom, which ensures that the interaction is only between electrons with opposite spins whereas the `np.eye(2)` ensures that the interaction is only between electrons on the same sublattice. Here `s_x` is the Pauli matrix acting on the spin degrees of freedom, which ensures that the interaction is only between electrons with opposite spins whereas the `np.eye(2)` ensures that the interaction is only between electrons on the same sublattice.
### Putting it all together ### Putting it all together
......
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