zerothi / sisl

Electronic structure Python package for post analysis and large scale tight-binding DFT/NEGF calculations
https://zerothi.github.io/sisl
Mozilla Public License 2.0
181 stars 58 forks source link

orbital_current and bond_current arrays #387

Closed anshugaur closed 2 years ago

anshugaur commented 2 years ago

I am facing issues while writing or printing extracted orbital_current or bond_current arrays to a file or to the screen.

  1. The orbital_current/bond_current array is extracted from --.TBT.nc file and I can print it on screen (with print command). However, it shows a truncated array. I tried using np.set_printoptions(threshold-sys.maxsize/np-inf), but this does not work and the arrays are always truncated. Is there any other way to print untruncated array on scree which then can be directed to a file for further analysis?
  2. While trying to write the array object to a file using np.savetxt, python throws up an error saying 1D or 2D array was expected, while 0D array returned. If I print orbital_current.ndim, it shows "2", however, I suspect while trying to write to a file, the array goes through np.asarray() function which returns a 0D array and hence the error in writing to a file.
  3. Is it because these arrays (orbital_current and bond_current) are not enclosed in square parentheses ([ ]) as returned by "sisl"?
  4. I am able to write atom_current and vector_current arrays to file without any problem.
zerothi commented 2 years ago

The orbital_current and bond_current arrays returned are sparse matrices. So all your problems arise because it isn't a numpy.array, but a scipy.sparse.csr_matrix.

Does this help?

zerothi commented 2 years ago

@anshugaur did my comment help you?

anshugaur commented 2 years ago

Dear Nick,

Yes, realising that bond and orbital currents are arrays, I was able to use pandas to save them in csv format. Thanks for your prompt reply. One more quick question; can we relate bond currents to vector and atom currents and relate them to total current under bias?

Thanks and regards, Anshu

On Tue, 12 Oct, 2021, 5:43 pm Nick Papior, @.***> wrote:

@anshugaur https://github.com/anshugaur did my comment help you?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/zerothi/sisl/issues/387#issuecomment-940955448, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJJ7TFTALD2GJY4MMZ5UIF3UGQQ67ANCNFSM5FXQDHKQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

zerothi commented 2 years ago

You can see the difference between them in the documentation:

https://zerothi.github.io/sisl/api/io/generated/sisl.io.tbtrans.tbtavncSileTBtrans.html?highlight=vector_current#sisl.io.tbtrans.tbtavncSileTBtrans.vector_current_from_bond

Press on each of the See Also items to look.

Generally you can think of it like this:

  1. orbital-current is the main value
  2. bond-currents are calculated from orbital-currents (for the case of 1-orbital atoms they are the same)
  3. vector-currents are bond-currents scaled by the unit-vector between the two atoms (summed per atom)
  4. atom-currents are the sum of current flowing out of an atom.

The equations for all these are described in the documentation.

zerothi commented 2 years ago

Also, you can relate orbital currents to the transmission, see my PhD thesis. And thus also the total current. https://orbit.dtu.dk/en/publications/computational-tools-and-studies-of-graphene-nanostructures

zerothi commented 2 years ago

I suspect this has been answered, if not please reopen!