zerothi / ts-tbt-sisl-tutorial

Tutorials for the sisl-TBtrans-TranSiesta suite
Creative Commons Attribution Share Alike 4.0 International
33 stars 29 forks source link

Erroneous electrode setup, check out-put #17

Closed Kulka21 closed 1 year ago

Kulka21 commented 1 year ago

I was trying to do two nanotubes, one in the other, in magnetic field. However, when I try to do tbtrans calculations, I get an error: Erroneous electrode setup, check out-put. My code: import math import sisl import numpy as np import matplotlib.pyplot as plt from tqdm import tqdm from functools import partial %matplotlib inline elec_in = sisl.geom.nanotube(1, atoms=sisl.Atom(6, R=5+0.01), chirality=(6, 6)) nano_in = elec_in.tile(10, 2) elec_out = sisl.geom.nanotube(1, atoms=sisl.Atom(6, R=5+0.01), chirality=(11, 11)) nano_out = elec_out.tile(10, 2) elec_out = elec_out.translate([(elec_in.xyz[:, 0].max()-elec_out.xyz[:, 0].max())/2, 0, 0]) elec_out = elec_out.translate([0, (elec_in.xyz[:, 1].max()-elec_out.xyz[:, 1].max())/2, 0]) elec_out = elec_out.translate([0, 0, -elec_in.xyz[:, 2].max()]) elec = elec_in.append(elec_out, 2) H_elec = sisl.Hamiltonian(elec) H_elec.construct([[0.1, 1.43], [0., -2.7]]) H_elec.write('ELEC.nc') nano_out = nano_out.translate([(nano_in.xyz[:, 0].max()-nano_out.xyz[:, 0].max())/2, 0, 0]) nano_out = nano_out.translate([0, (nano_in.xyz[:, 1].max()-nano_out.xyz[:, 1].max())/2, 0]) nano_out = nano_out.translate([0, 0, -nano_in.xyz[:, 2].max()]) device = nano_in.append(nano_out, 2) H = sisl.Hamiltonian(device) H.construct(([0.1, 1.43], [0., -2.7])) H.write('DEVICE.nc') xy = sisl.Hamiltonian(device) for ia in device: edges = H.edges(ia) Rij = device.Rij(ia, edges) xy[ia, edges] = Rij[:, 0] (Rij[:, 1] + 2 device.xyz[ia, 1]) xy.finalize() rec_phis = np.arange(1, 51, 4) for i, rec_phi in enumerate(tqdm(rec_phis, unit="M")): phi = 1 / rec_phi dH = H np.exp(1.0j xy * 0.5 / rec_phi) - H with sisl.getsile('M{}.dH.nc'.format(rec_phi), mode='w') as fh: fh.write_delta(dH)

zerothi commented 1 year ago

Please report errors in sisl to sisl, this is only for the tutorial aspect. I'll close and wait for you moving the issue, please also remember to use backticks for code style.