> In the meantime, would you be so kind and suggest how to plot > ldos for spin-up and spin-down components separately?
You basically need get only the even or only odd elements of an array local_dos. For that you can use local_dos[0::2] # Only even elements local_dos[1::2] # Only odd elements Such stuff is explained in NumPy tutorial, and this particular question over here: http://docs.scipy.org/doc/numpy/reference/arrays.indexing.html Cheers, Anton > >> Hi Jerzy, >> >> Note for the future: it is always helpful to add the actual error >> messages to your reports. In this case however, the problem is clear: >> >> kwant.ldos calculates local density of states on each degree of >> freedom of the system (so spin up and spin down separately). On the >> other hand, kwant.plotter.map expects to have as many values to plot >> as there are sites in the system, not more and not less. Both of these >> things are behaving as written in the docs. You can modify your >> function to plot the density of states per site for example like this: >> >> def plot_ldos(sys, energy): >> # Compute local dos >> local_dos = kwant.ldos(sys, energy) >> # Calculate ldos per site, by summing spin up and spin down components >> local_dos = np.sum(local_dos.reshape(-1, 2), axis=1) >> kwant.plotter.map(sys, local_dos, num_lead_cells=5) >> >> The line that I have added, as you can check, uses NumPy functions for >> manipulations with arrays: first out of a 1D array with shape (2xN) an >> array with shape (N, 2): >> my_array.reshape(-1, 2) >> where the elements with the same value of the 0th coordinate (NumPy >> counts array axes starting from 0) have the same site number. Then I >> sum this array along the second axis: >> np.sum(my_array, axis=1) >> >> I hope this helps. >> >> Best, >> Anton >> >> On Tue, Sep 24, 2013 at 8:20 PM, Jerzy Wrobel <wro...@ifpan.edu.pl> wrote: >>> Hi All, >>> >>> I have modified quantum_wire_revisited.py by adding new function >>> >>> def plot_ldos(sys, energy): >>> # Compute local dos >>> local_dos = kwant.ldos(sys, energy) >>> kwant.plotter.map(sys, local_dos, num_lead_cells=5) >>> >>> and adding new command >>> >>> plot_ldos(sys, energy=0.5) >>> >>> to the already existing function main(). >>> >>> It works well. However, when I have modified the spin-orbit.py file >>> in the same way, program halts. Some cryptic messages, >>> which ended with ValueError: different number of values and points, >>> are generated. >>> >>> How to resolve this? Thanks in advance, >>> >>> Jerzy >>> >> > >