jonaslb / psiesta

Python bindings for "Siesta as a subroutine" DFT
https://github.com/jonaslb/psiesta
GNU General Public License v3.0
2 stars 2 forks source link

Accessing matrices #4

Open pfebrer opened 9 months ago

pfebrer commented 9 months ago

Hi @jonaslb, I guess this project is stale now (?).

I thought that using something like this might be useful for one of my projects and I had some doubts. The major one is: Just as you get the fermy energy, do you think it is possible to get the sparse matrices? And do you think it is possible to modify the matrix arrays inplace from python (or maybe through some middleware fortran/C routine)?

jonaslb commented 9 months ago

Hi! I'm very happy that you have interest in this :) With 3 years since the last commit, I guess I can't say that it's not stale. But - I have thought many times about going back and updating it, perhaps also as a means to keep a little bit of contact with comp. physics even though I've moved on professionally from physics now. So your expression of interest might be the motivation i needed to reinvest some time here ;)

As for your question about the matrices, then yes, I think a similar approach as with the fermi energy will work. I originally thought about doing it also for the Hamiltonian and overlap matrices (instead of reading them from files with sisl), but it was just easier to go the sisl route (and I guess one would want to work with them as sisl objects too, anyway). There might be some details to be figured out regarding sharing of the memory for the matrices, i.e. I guess we would want to expose them as numpy "views", not copies, which I think should be possible, I just don't know immediately how to do it.

pfebrer commented 9 months ago

Cool! :)

My use case is to transfer a matrix from sisl to SIESTA while SIESTA is running. Right now I'm doing it through disk with a .DM file. So getting an array view would be completely awesome hehe.

I think if there is some more functionality to interact directly with variables and there is a package for it available in pypi and conda this would be a very useful project!

pfebrer commented 9 months ago

By the way, I don't know if you know but the building method of SIESTA changed completely. Now it is compiled with CMake, which is much easier, but I don't know which/if changes would be required here.