Dear All, I have a Hamaltonian (BHZ hamiltonian) and i'm trying to introduce a magnetic field. I believe I have to use the Peierls phase, however i'm not sure how to implement this after I have finalized the BHZ hamiltonian. Any assistance is appreciated. I will paste the code i have to generate my hamiltonian. You can find more information about the BHZ hamiltonian here: arxiv:0801.0901 https://arxiv.org/abs/0801.0901 """ import kwant import numpy as np import scipy.linalg as la import scipy.sparse.linalg as sla import sympy import matplotlib.pyplot as plt from ipywidgets import interact Gamma_so = [[0, 0, 0, -1], [0, 0, +1, 0], [0, +1, 0, 0], [-1, 0, 0, 0]] hamiltonian = """ + M * kron(sigma_0, sigma_z) - B * (k_x**2 + k_y**2) * kron(sigma_0, sigma_z) - D * (k_x**2 + k_y**2) * kron(sigma_0, sigma_0) + A * k_x * kron(sigma_z, sigma_x) - A * k_y * kron(sigma_0, sigma_y) + Delta * Gamma_so """ params_bhz=dict(A=364.5, B=-686, D=-512, M=-10, Delta=1.6) hamiltonian = kwant.continuum.sympify(hamiltonian, locals=dict(Gamma_so=Gamma_so)) hamiltonian grid_spacing = 5 template = kwant.continuum.discretize(hamiltonian, grid_spacing=grid_spacing) syst = kwant.wraparound.wraparound(template) syst = syst.finalized() """ Best, Alex
Hi Alex,
The trick is to add the Peierls phase after you discretized your
Hamiltonian, I do it in the following way:
def apply_peierls_to_template(template, xyz_offset=(0, 0, 0)):
template = deepcopy(template) # Needed because kwant.Builder is mutable
x0, y0, z0 = xyz_offset
lat = template.lattice
a = np.max(lat.prim_vecs) # lattice contant
def phase(site1, site2, B_x, B_y, B_z, orbital, e, hbar):
x, y, z = site1.tag
direction = site2.tag - site1.tag
A = [B_y * (z - z0) - B_z * (y - y0), 0, B_x * (y - y0)]
A = np.dot(A, direction) * a**2 * 1e-18 * e / hbar
phase = np.exp(-1j * A)
if lat.norbs == 2: # No PH degrees of freedom
return phase
elif lat.norbs == 4:
return np.array([phase, phase.conj(), phase, phase.conj()],
dtype='complex128')
for (site1, site2), hop in template.hopping_value_pairs():
template[site1, site2] = combine(hop, phase, operator.mul, 2)
return template
You can apply this function to your template builder. In short, it does
this combine(hop, phase, operator.mul, 2), which is creating a new function
from the phase function and the hopping function and combining the
arguments.
You would probably need to adjust the form of the vector potential, the
units (this is using nm) and change the form of the phase function.
I have attached the combine.py script you will need to combine the
functions.
Please let me know whether it works or not.
Best, Bas
On Tue, Sep 19, 2017 at 11:26 PM, Alex Currie
Dear All,
I have a Hamaltonian (BHZ hamiltonian) and i'm trying to introduce a magnetic field. I believe I have to use the Peierls phase, however i'm not sure how to implement this after I have finalized the BHZ hamiltonian. Any assistance is appreciated. I will paste the code i have to generate my hamiltonian. You can find more information about the BHZ hamiltonian here: arxiv:0801.0901 https://arxiv.org/abs/0801.0901
""" import kwant import numpy as np import scipy.linalg as la import scipy.sparse.linalg as sla
import sympy
import matplotlib.pyplot as plt
from ipywidgets import interact
Gamma_so = [[0, 0, 0, -1], [0, 0, +1, 0], [0, +1, 0, 0], [-1, 0, 0, 0]]
hamiltonian = """ + M * kron(sigma_0, sigma_z) - B * (k_x**2 + k_y**2) * kron(sigma_0, sigma_z) - D * (k_x**2 + k_y**2) * kron(sigma_0, sigma_0) + A * k_x * kron(sigma_z, sigma_x) - A * k_y * kron(sigma_0, sigma_y) + Delta * Gamma_so """
params_bhz=dict(A=364.5, B=-686, D=-512, M=-10, Delta=1.6)
hamiltonian = kwant.continuum.sympify(hamiltonian, locals=dict(Gamma_so=Gamma_so)) hamiltonian
grid_spacing = 5 template = kwant.continuum.discretize(hamiltonian, grid_spacing=grid_spacing)
syst = kwant.wraparound.wraparound(template) syst = syst.finalized()
"""
Best,
Alex
Hi Alex,
The way Bas is doing it is one way of doing it - it acts on the template
system combining it hopping functions with Peierls phase.
There is also another code
https://gitlab.kwant-project.org/r-j-skolasinski/semicon/tree/magnetic_field
out there that could be useful - it is however work in progress code so you
need to check if it gives you what you want.
It requires you however to use the discretizer from continuum
https://kwant-project.org/doc/1/tutorial/discretize module introduced in
Kwant 1.3.
This approach is based on three steps:
1. Discretize symbolically continuous Hamitonian to the tight-binding
form
2. Modify hoppings with Peierls phase
3. build discretized system.
You can find required codes here
https://gitlab.kwant-project.org/r-j-skolasinski/semicon/blob/magnetic_field...
and example notebook here
https://gitlab.kwant-project.org/r-j-skolasinski/semicon/blob/magnetic_field...
.
Please be aware that these method uses the same gauge (vector potential)
for the whole system.
Just choose the approach that fits more your code.
Best,
Rafal
P.S. Please be aware that in current code there phi_0 is defined as h/(2e)
instead of h/e.
--
Rafał Skolasiński
GitHub: https://github.com/RafalSkolasinski
Kwant GitLab: https://gitlab.kwant-project.org/r-j-skolasinski
On 20 September 2017 at 10:59, Bas Nijholt
Hi Alex,
The trick is to add the Peierls phase after you discretized your Hamiltonian, I do it in the following way:
def apply_peierls_to_template(template, xyz_offset=(0, 0, 0)): template = deepcopy(template) # Needed because kwant.Builder is mutable x0, y0, z0 = xyz_offset lat = template.lattice a = np.max(lat.prim_vecs) # lattice contant
def phase(site1, site2, B_x, B_y, B_z, orbital, e, hbar): x, y, z = site1.tag direction = site2.tag - site1.tag A = [B_y * (z - z0) - B_z * (y - y0), 0, B_x * (y - y0)] A = np.dot(A, direction) * a**2 * 1e-18 * e / hbar phase = np.exp(-1j * A)
if lat.norbs == 2: # No PH degrees of freedom return phase elif lat.norbs == 4: return np.array([phase, phase.conj(), phase, phase.conj()], dtype='complex128')
for (site1, site2), hop in template.hopping_value_pairs(): template[site1, site2] = combine(hop, phase, operator.mul, 2)
return template
You can apply this function to your template builder. In short, it does this combine(hop, phase, operator.mul, 2), which is creating a new function from the phase function and the hopping function and combining the arguments.
You would probably need to adjust the form of the vector potential, the units (this is using nm) and change the form of the phase function.
I have attached the combine.py script you will need to combine the functions.
Please let me know whether it works or not.
Best, Bas
On Tue, Sep 19, 2017 at 11:26 PM, Alex Currie
wrote: Dear All,
I have a Hamaltonian (BHZ hamiltonian) and i'm trying to introduce a magnetic field. I believe I have to use the Peierls phase, however i'm not sure how to implement this after I have finalized the BHZ hamiltonian. Any assistance is appreciated. I will paste the code i have to generate my hamiltonian. You can find more information about the BHZ hamiltonian here: arxiv:0801.0901 https://arxiv.org/abs/0801.0901
""" import kwant import numpy as np import scipy.linalg as la import scipy.sparse.linalg as sla
import sympy
import matplotlib.pyplot as plt
from ipywidgets import interact
Gamma_so = [[0, 0, 0, -1], [0, 0, +1, 0], [0, +1, 0, 0], [-1, 0, 0, 0]]
hamiltonian = """ + M * kron(sigma_0, sigma_z) - B * (k_x**2 + k_y**2) * kron(sigma_0, sigma_z) - D * (k_x**2 + k_y**2) * kron(sigma_0, sigma_0) + A * k_x * kron(sigma_z, sigma_x) - A * k_y * kron(sigma_0, sigma_y) + Delta * Gamma_so """
params_bhz=dict(A=364.5, B=-686, D=-512, M=-10, Delta=1.6)
hamiltonian = kwant.continuum.sympify(hamiltonian, locals=dict(Gamma_so=Gamma_so)) hamiltonian
grid_spacing = 5 template = kwant.continuum.discretize(hamiltonian, grid_spacing=grid_spacing)
syst = kwant.wraparound.wraparound(template) syst = syst.finalized()
"""
Best,
Alex
Hello, I've tried both methods so far. Both have not worked. With the second method, the BHZ hamiltonian doesn't seem to be compatible as it gets an error with 'sympify'. The first method doesn't work when I call the "apply_peierls_to_template" function. It gives an error saying 'operator' is not defined. I'm not sure what 'operator.mul' is doing either. I'll attach the whole script. Thanks for the help. Alex On Wed, Sep 20, 2017 at 12:09 PM, Rafal Skolasinski < r.j.skolasinski@gmail.com> wrote:
Hi Alex,
The way Bas is doing it is one way of doing it - it acts on the template system combining it hopping functions with Peierls phase. There is also another code https://gitlab.kwant-project.org/r-j-skolasinski/semicon/tree/magnetic_field out there that could be useful - it is however work in progress code so you need to check if it gives you what you want.
It requires you however to use the discretizer from continuum https://kwant-project.org/doc/1/tutorial/discretize module introduced in Kwant 1.3. This approach is based on three steps:
1. Discretize symbolically continuous Hamitonian to the tight-binding form 2. Modify hoppings with Peierls phase 3. build discretized system.
You can find required codes here https://gitlab.kwant-project.org/r-j-skolasinski/semicon/blob/magnetic_field... and example notebook here https://gitlab.kwant-project.org/r-j-skolasinski/semicon/blob/magnetic_field... .
Please be aware that these method uses the same gauge (vector potential) for the whole system.
Just choose the approach that fits more your code.
Best, Rafal
P.S. Please be aware that in current code there phi_0 is defined as h/(2e) instead of h/e.
-- Rafał Skolasiński
GitHub: https://github.com/RafalSkolasinski Kwant GitLab: https://gitlab.kwant-project.org/r-j-skolasinski
On 20 September 2017 at 10:59, Bas Nijholt
wrote: Hi Alex,
The trick is to add the Peierls phase after you discretized your Hamiltonian, I do it in the following way:
def apply_peierls_to_template(template, xyz_offset=(0, 0, 0)): template = deepcopy(template) # Needed because kwant.Builder is mutable x0, y0, z0 = xyz_offset lat = template.lattice a = np.max(lat.prim_vecs) # lattice contant
def phase(site1, site2, B_x, B_y, B_z, orbital, e, hbar): x, y, z = site1.tag direction = site2.tag - site1.tag A = [B_y * (z - z0) - B_z * (y - y0), 0, B_x * (y - y0)] A = np.dot(A, direction) * a**2 * 1e-18 * e / hbar phase = np.exp(-1j * A)
if lat.norbs == 2: # No PH degrees of freedom return phase elif lat.norbs == 4: return np.array([phase, phase.conj(), phase, phase.conj()], dtype='complex128')
for (site1, site2), hop in template.hopping_value_pairs(): template[site1, site2] = combine(hop, phase, operator.mul, 2)
return template
You can apply this function to your template builder. In short, it does this combine(hop, phase, operator.mul, 2), which is creating a new function from the phase function and the hopping function and combining the arguments.
You would probably need to adjust the form of the vector potential, the units (this is using nm) and change the form of the phase function.
I have attached the combine.py script you will need to combine the functions.
Please let me know whether it works or not.
Best, Bas
On Tue, Sep 19, 2017 at 11:26 PM, Alex Currie
wrote: Dear All,
I have a Hamaltonian (BHZ hamiltonian) and i'm trying to introduce a magnetic field. I believe I have to use the Peierls phase, however i'm not sure how to implement this after I have finalized the BHZ hamiltonian. Any assistance is appreciated. I will paste the code i have to generate my hamiltonian. You can find more information about the BHZ hamiltonian here: arxiv:0801.0901 https://arxiv.org/abs/0801.0901
""" import kwant import numpy as np import scipy.linalg as la import scipy.sparse.linalg as sla
import sympy
import matplotlib.pyplot as plt
from ipywidgets import interact
Gamma_so = [[0, 0, 0, -1], [0, 0, +1, 0], [0, +1, 0, 0], [-1, 0, 0, 0]]
hamiltonian = """ + M * kron(sigma_0, sigma_z) - B * (k_x**2 + k_y**2) * kron(sigma_0, sigma_z) - D * (k_x**2 + k_y**2) * kron(sigma_0, sigma_0) + A * k_x * kron(sigma_z, sigma_x) - A * k_y * kron(sigma_0, sigma_y) + Delta * Gamma_so """
params_bhz=dict(A=364.5, B=-686, D=-512, M=-10, Delta=1.6)
hamiltonian = kwant.continuum.sympify(hamiltonian, locals=dict(Gamma_so=Gamma_so)) hamiltonian
grid_spacing = 5 template = kwant.continuum.discretize(hamiltonian, grid_spacing=grid_spacing)
syst = kwant.wraparound.wraparound(template) syst = syst.finalized()
"""
Best,
Alex
Hi,
With second method you don't need to do sympy. Function
''disctretize_symbolic'' will handle the sympification process.
Best,
Rafal
On 20 Sep 2017 15:49, "Alex Currie"
Hello,
I've tried both methods so far. Both have not worked. With the second method, the BHZ hamiltonian doesn't seem to be compatible as it gets an error with 'sympify'.
The first method doesn't work when I call the "apply_peierls_to_template" function. It gives an error saying 'operator' is not defined. I'm not sure what 'operator.mul' is doing either. I'll attach the whole script.
Thanks for the help.
Alex
On Wed, Sep 20, 2017 at 12:09 PM, Rafal Skolasinski < r.j.skolasinski@gmail.com> wrote:
Hi Alex,
The way Bas is doing it is one way of doing it - it acts on the template system combining it hopping functions with Peierls phase. There is also another code https://gitlab.kwant-project.org/r-j-skolasinski/semicon/tree/magnetic_field out there that could be useful - it is however work in progress code so you need to check if it gives you what you want.
It requires you however to use the discretizer from continuum https://kwant-project.org/doc/1/tutorial/discretize module introduced in Kwant 1.3. This approach is based on three steps:
1. Discretize symbolically continuous Hamitonian to the tight-binding form 2. Modify hoppings with Peierls phase 3. build discretized system.
You can find required codes here https://gitlab.kwant-project.org/r-j-skolasinski/semicon/blob/magnetic_field... and example notebook here https://gitlab.kwant-project.org/r-j-skolasinski/semicon/blob/magnetic_field... .
Please be aware that these method uses the same gauge (vector potential) for the whole system.
Just choose the approach that fits more your code.
Best, Rafal
P.S. Please be aware that in current code there phi_0 is defined as h/(2e) instead of h/e.
-- Rafał Skolasiński
GitHub: https://github.com/RafalSkolasinski Kwant GitLab: https://gitlab.kwant-project.org/r-j-skolasinski
On 20 September 2017 at 10:59, Bas Nijholt
wrote: Hi Alex,
The trick is to add the Peierls phase after you discretized your Hamiltonian, I do it in the following way:
def apply_peierls_to_template(template, xyz_offset=(0, 0, 0)): template = deepcopy(template) # Needed because kwant.Builder is mutable x0, y0, z0 = xyz_offset lat = template.lattice a = np.max(lat.prim_vecs) # lattice contant
def phase(site1, site2, B_x, B_y, B_z, orbital, e, hbar): x, y, z = site1.tag direction = site2.tag - site1.tag A = [B_y * (z - z0) - B_z * (y - y0), 0, B_x * (y - y0)] A = np.dot(A, direction) * a**2 * 1e-18 * e / hbar phase = np.exp(-1j * A)
if lat.norbs == 2: # No PH degrees of freedom return phase elif lat.norbs == 4: return np.array([phase, phase.conj(), phase, phase.conj()], dtype='complex128')
for (site1, site2), hop in template.hopping_value_pairs(): template[site1, site2] = combine(hop, phase, operator.mul, 2)
return template
You can apply this function to your template builder. In short, it does this combine(hop, phase, operator.mul, 2), which is creating a new function from the phase function and the hopping function and combining the arguments.
You would probably need to adjust the form of the vector potential, the units (this is using nm) and change the form of the phase function.
I have attached the combine.py script you will need to combine the functions.
Please let me know whether it works or not.
Best, Bas
On Tue, Sep 19, 2017 at 11:26 PM, Alex Currie
wrote: Dear All,
I have a Hamaltonian (BHZ hamiltonian) and i'm trying to introduce a magnetic field. I believe I have to use the Peierls phase, however i'm not sure how to implement this after I have finalized the BHZ hamiltonian. Any assistance is appreciated. I will paste the code i have to generate my hamiltonian. You can find more information about the BHZ hamiltonian here: arxiv:0801.0901 https://arxiv.org/abs/0801.0901
""" import kwant import numpy as np import scipy.linalg as la import scipy.sparse.linalg as sla
import sympy
import matplotlib.pyplot as plt
from ipywidgets import interact
Gamma_so = [[0, 0, 0, -1], [0, 0, +1, 0], [0, +1, 0, 0], [-1, 0, 0, 0]]
hamiltonian = """ + M * kron(sigma_0, sigma_z) - B * (k_x**2 + k_y**2) * kron(sigma_0, sigma_z) - D * (k_x**2 + k_y**2) * kron(sigma_0, sigma_0) + A * k_x * kron(sigma_z, sigma_x) - A * k_y * kron(sigma_0, sigma_y) + Delta * Gamma_so """
params_bhz=dict(A=364.5, B=-686, D=-512, M=-10, Delta=1.6)
hamiltonian = kwant.continuum.sympify(hamiltonian, locals=dict(Gamma_so=Gamma_so)) hamiltonian
grid_spacing = 5 template = kwant.continuum.discretize(hamiltonian, grid_spacing=grid_spacing)
syst = kwant.wraparound.wraparound(template) syst = syst.finalized()
"""
Best,
Alex
participants (3)
-
Alex Currie
-
Bas Nijholt
-
Rafal Skolasinski