Hello,
The program will work if you do the following changes:
from kwant import wraparound
and write correctly the paths and names of your files.
The code is as follows:
#############################################
import kwant
import tbmodels
from kwant import wraparound
import numpy as np
import scipy.linalg as la
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
model = tbmodels.Model.from_wannier_files(hr_file='data/wannier90_hr.dat')
lattice = model.to_kwant_lattice()
wire = kwant.Builder()
def shape(p):
x, y, z = p
return -20 < x < 20 and -5 < y < 5 and -5 < z < 5
wire[lattice.shape(shape, (0, 0, 0))] = 0
model.add_hoppings_kwant(wire)
fig = plt.figure()
ax = plt.subplot()
ax = kwant.plot(wire)
plt.savefig('wire.png')
######################
I hope this helps.
Adel
On Tue, Feb 6, 2018 at 3:28 PM,
Hello,
I have just started using kwant, and I am trying to write a code excerpt that saves a figure of my system, but I just get a blank 3-D space. The code is the following, as taken by the TBModels website: -----------------------------------------------------------------
import kwant import tbmodels import wraparound
import numpy as np import scipy.linalg as la import matplotlib matplotlib.use('agg') import matplotlib.pyplot as plt
model = tbmodels.Model.from_wannier_files( hr_file='..._hr.dat', wsvec_file='..._wsvec.dat', xyz_file='..._centres.xyz', win_file='....win' )
lattice = model.to_kwant_lattice()
wire = kwant.Builder()
def shape(p): x, y, z = p return -20 < x < 20 and -5 < y < 5 and -5 < z < 5
wire[lattice.shape(shape, (0, 0, 0))] = 0
model.add_hoppings_kwant(wire)
fig = plt.figure()
ax = plt.subplot()
ax = kwant.plot(wire)
plt.savefig('wire.png') ------------------------------------------------------------ ----------------------------
If anyone knows whether the problem is with the system or with the plotting it would be greatly appreciated.
Regards
-- Dr. Eleni Chatzikyriakou Computational Physics lab Aristotle University of Thessaloniki elchatz@auth.gr - tel:+30 2310 998109
-- Abbout Adel