Hello again,

For the translation vectors, I managed to do some progress. I don't know how I should declare by arguments so that they get where they are supposed to. Here is what I have until now:

---------------------------------------------------------
kwant_model = kwant.Builder()
kwant_model[lattice.shape(shape, (0, 0, 15))] = 0
model.add_hoppings_kwant(kwant_model)

def onsite(site, params=dict(B=0, k_x=0, k_y=0, k_z=0)):
  return kwant_model[site]

def hopx(site1, site2, params=dict(B=0, k_x=0, k_y=0, k_z=0)):
  x1, y1, z1 = site1.pos
  x2, y2, z2 = site2.pos
  for key, value in params.items():
    if key == 'B':
      B=value
  return kwant_model[site1,site2] * np.exp(-0.5j * B * (x1 + x2) * (y1 - y2))

#Make a new model pointing in the previous model
new_model = kwant.Builder(sym)
#Change the on-site elements
new_model[lattice.shape(shape, (0, 0, 15))] = onsite

#Change the lattice hoppings
for i in (range(len(lattice.sublattices))):
  kwant_model[lattice.sublattices[i].neighbors()] = hopx

for R, mat in model.hop.items():
  dir = tuple(np.array(R))
  for i, s1 in enumerate(lattice.sublattices):
    for j, s2 in enumerate(lattice.sublattices):
      if i !=j:
new_model[kwant.builder.HoppingKind(dir, lattice.sublattices[i],lattice.sublattices[j])] = hopx

# Finalize the system.
sys = wraparound.wraparound(new_model).finalized()


------------------------------------------------------------------------------------------

But I am still getting errors.


So my questions are:

1) Do I have to use a dictionary in the onsite and hopping function definitions? From what I understand, if I only use the B argument, maybe it gets 'eaten' in the memoize and I get a 'missing positional arguments error'.

2) What do you think the symmetry of the original model should be and what of the new_model so that I can write on the momentum operator arguments properly?


Kind Regards,


Eleni





Quoting Joseph Weston <joseph.westo...@gmail.com>:

Hi


sym = kwant.TranslationalSymmetry(
    lattice.vec((1, 0, 0)),
    lattice.vec((0, 1, 0)),
    lattice.vec((0, 0, 1))
)

[....]

#Hall bar
def onsite(site, B):
  (x, y, z) = site.pos
  return stored_model[site]

def hopping_Ax(site1, site2, B):
      x1, y1, z1 = site1.pos
      x2, y2, z2 = site2.pos
      return stored_model[site1,site2] * np.exp(-0.5j * B * (x1 + x2)
* (y1 - y2))

kwant_model[lattice.shape(shape, (0, 0, 15))] = onsite
kwant_model[lattice.neighbors()] = hopping_Ax

kwant_sys = wraparound.wraparound(kwant_model).finalized()

 B = 0.02
# Obtain the Hamiltonian as a dense matrix
ham_mat = kwant_sys.hamiltonian_submatrix(args=[B], sparse=True)

The docstring for 'wraparound' [1] says that the wrapped around system will
have additional parameters, corresponding to the momenta. As you have a 3D
system and have wrapped around all 3 dimensions, the parameters will be
'k_x', 'k_y', and 'k_z'.

As you have only supplied a single argument (B) to your system, an error
is raised.
You will need to provide all the arguments to your system:

    kwant_sys.hamiltonian_submatrix(params=dict(k_x=0, k_y=0, k_z=0,
B=B), sparse=True)

Happy Kwanting,

Joe


[1]:
https://kwant-project.org/doc/1/reference/generated/kwant.wraparound.wraparound#kwant.wraparound.wraparound



--
Dr. Eleni Chatzikyriakou
Computational Physics lab
Aristotle University of Thessaloniki
elch...@auth.gr - tel:+30 2310 998109

Reply via email to