dipc-cc / hubbard

Python tools for mean-field Hubbard models
https://dipc-cc.github.io/hubbard/
GNU Lesser General Public License v3.0
21 stars 8 forks source link

Implement block tridiagonal inversion for NEGF class #49

Open sofiasanz opened 4 years ago

sofiasanz commented 4 years ago

It could be nice to implement in the NEGF class a method to invert the Green's function using the block tridiagonal inversion algorithm to reduce the time that this operation consumes.

sofiasanz commented 4 years ago

@zerothi, you implemented this algorithm in a template file called btd.py a yer ago o so, right? Thomas showed me a little bit how it works, and I was wondering if you mind if I use your implementation as a reference to try to adapt it to the Hubbard package :)

zerothi commented 4 years ago

I will have no problem with that. As long as it is disclosed that it originates from me, ;) Then you can do whatever with it ;)

zerothi commented 4 years ago

Note however, that for small systems <500 it may not be faster than full inversion since the overhead of managing the blocks in Python is pretty high (compared to fortran).

sofiasanz commented 4 years ago

I will have no problem with that. As long as it is disclosed that it originates from me, ;) Then you can do whatever with it ;)

Of course! Thanks :)

Note however, that for small systems <500 it may not be faster than full inversion since the overhead of managing the blocks in Python is pretty high (compared to fortran).

I see, maybe we can profile the two methods and then see if it's worth to make the NEGF class to choose between the direct inversion or the btd for small or large systems, respectively. Or something similar :)

zerothi commented 4 years ago

Yes, you could use sisl.selector code to let it automatically decide which one to use. It basically runs through all available methods, and then once it has tried them all, uses the one which takes the least amount of time. :)

sofiasanz commented 4 years ago

Excellent! Thanks ;)