And also, when I am plotting the spectrum in varing magnetic field with the hamiltonian as a sparse matrix. I am getting an value error.
*ValueError: x and y must have same first dimension, but have shapes (100,) and (1, 15)* I don't know what does it mean? *def plot_spectrum(syst, Bfields): energies = [] for B in Bfields: ham_mat = syst.hamiltonian_submatrix(params=dict(B=B), sparse=True) ev = sla.eigsh(ham_mat.tocsc(), k=15, sigma=0, return_eigenvectors=False) energies.append(ev) pyplot.figure() pyplot.plot(Bfields, energies) pyplot.xlabel("magnetic field [arbitrary units]") pyplot.ylabel("energy [t]") pyplot.show()* *plot_spectrum(syst, [iB * 0.002 for iB in range(100)])* Best regards, Naveen On Tue, May 7, 2019 at 1:35 PM Naveen Yadav <naveengunwa...@gmail.com> wrote: > That is okay, but still something wrong. > > > > > > > > > > > > > > Naveen > Department of Physics & Astrophysics > University of Delhi > New Delhi-110007 > > On Tue, May 7, 2019, 13:29 Joseph Weston <joseph.westo...@gmail.com> > wrote: > >> >> > Dear Joseph, >> > >> > As per your instructions I have build the system, but the code is not >> > giving the desired result. >> > Here is the code please have a look on it. >> >> >> 'y' should be the y position of the sites of the hopping, not an input >> parameter to the system construction: >> >> def hoppingz(site0, site1): >> >> y = site0.pos[1] >> >> ... >> >> >> Happy Kwanting, >> >> Joe >> >> >> >> -- With Best Regards NAVEEN YADAV Ph.D Research Scholar Deptt. Of Physics & Astrophysics University Of Delhi.