sisl icon indicating copy to clipboard operation
sisl copied to clipboard

Plotting bond/orbital-current maps sisl.viz

Open zerothi opened this issue 2 years ago • 9 comments

Describe the feature

Like #77 it would be nice with an intrinsic bond-current plotting functionality. Possibly allowing to extract individual orbitals contributions (@pfebrer ping)

Some things that I have generally found intriguing:

  • [ ] plotting bond-currents (tbt.bond_current(elec, energy))
  • [ ] scaling atoms according to the atomic current (tbt.atom_current(elec, energy))

These could be really cool in sisl.viz

zerothi avatar Mar 14 '22 08:03 zerothi

Perhaps this could also be a good lesson for me to learn about viz, i.e. once #446 is in, this could be a bit easier it seems.

zerothi avatar Mar 14 '22 09:03 zerothi

Nicee! Yes once #446 is in it will be fairly easy. If it's just plotting the magnitude of the currents it will be trivial. If you need to plot the direction of the bond current with an arrow then that's a bit more difficult because there's nothing implementing "directional bonds" yet, but it shouldn't be too hard.

pfebrer avatar Mar 14 '22 15:03 pfebrer

Nicee! Yes once #446 is in it will be fairly easy. If it's just plotting the magnitude of the currents it will be trivial. If you need to plot the direction of the bond current with an arrow then that's a bit more difficult because there's nothing implementing "directional bonds" yet, but it shouldn't be too hard.

I think it should plot like forces? No?

I am not sure I fully understand the problem you are foreseeing? Isn't it just getting a starting point and vector and then plotting that? Is viz doing anything differently?

zerothi avatar Mar 27 '22 10:03 zerothi

Yes sure you can do it like that if you want. I was thinking more in terms of the bonds that the plot shows, but you can do it by plotting an arrow on each atom instead. But the problem then would be (if you wanted a smooth interface with the current implementation) that currently the support for arrows in GeometryPlot is linked to the atoms, in the sense that it accepts one arrow per atom.

But once the other PR is in we can think of the best way of merging this feature. I think the best way should probably be through bond styling, since this is a bond property. (i.e. have some way of specifying the directionality of the bond and then if the bonds are directional plot them with arrows instead of lines)

pfebrer avatar Mar 27 '22 10:03 pfebrer

But the bond currents are not *bond currents * in the strictest sense, they are just like forces with non-bond directions. So I don't think there is anything prohibiting it?

zerothi avatar Mar 27 '22 11:03 zerothi

Aaah ok, I didn't know that. And there is one per atom?

pfebrer avatar Mar 27 '22 11:03 pfebrer

Aaah ok, I didn't know that. And there is one per atom?

Yes. That is what people generally do. :)

zerothi avatar Mar 27 '22 11:03 zerothi

Then there's no problem! One can already plot them with the current API: https://zerothi.github.io/sisl/visualization/viz_module/showcase/GeometryPlot.html#Drawing-arrows.

So it would be just a matter of providing an even smoother interface for this specific case (if needed).

pfebrer avatar Mar 27 '22 11:03 pfebrer

Ok, so I should try your wiz in the viz and learn it! ;)

I'll get to it when time allows!

zerothi avatar Mar 27 '22 12:03 zerothi