About the wavefunction plotting
hello everyone. I am not getting eigenfunction plot of a chain lattice. Showing some bug.Please tell me what is wrong with my code: import kwant from cmath import exp import matplotlib.pyplot import tinyarray import numpy as np import scipy.sparse.linalg as sla lat = kwant.lattice.general([(1,0),(0,1)],[(0,0),(0,1)]) A,B = lat.sublattices s_0 = np.identity(2) s_z =np.array([[1, 0], [0, -1]]) s_x = np.array([[0, 1], [1, 0]]) s_y = np.array([[0, -1j], [1j, 0]]) def make(a=10,b=1,t=1,delta=.00,mu=.0): def Square(pos): x , y = pos return 0<=x<=a and 0<=y<=b sys = kwant.Builder() sys[lat.shape(Square,(0,0))] = -mu*s_0 sys[lat.neighbors()] = -t*s_0 + delta*s_x return sys def plot_wave_function(sys): # Calculate the wave functions in the system. ham_mat = sys.hamiltonian_submatrix(sparse=True) evecs = sla.eigsh(ham_mat, k=12)[1] # Plot the probability density of the 10th eigenmode. kwant.plotter.map(sys, np.abs(evecs[:, 7])**2,colorbar=True, oversampling=10) def main(): sys = make() kwant.plot(sys) sys = sys.finalized() plot_wave_function(sys) if __name__ == '__main__': main() this code is showing following error: OverflowError: cannot convert float infinity to integer
Dear Anant, The lattice that you use has positions of sites on one sublattice coincide with the sites from the other sublattice: the displacement from A to B is (0, 1), and so it coincides with one of the lattice vectors. The plotter.map function doesn't work then, since it doesn't know how to interpolate between values that occupy exactly the same position in space. Once you fix this by ensuring that there are no sites with overlapping positions, you'll encounter another problem, namely your wave function has more than one component on each site, and plotter.map wouldn't work with that. For details see the discussion in http://thread.gmane.org/gmane.comp.science.kwant.user/6 Best, Anton PS @kwant-developers: I'll catch this situation and make a clearer error message On Wed, Nov 19, 2014 at 12:26 PM, ANANT <avterminator@gmail.com> wrote:
participants (2)
-
ANANT
-
Anton Akhmerov