nakib / elphbolt

A solver for the coupled and decoupled electron and phonon Boltzmann transport equations.
GNU General Public License v3.0
39 stars 26 forks source link

Interpolation routines and iterative cycle #96

Closed mrm24 closed 1 year ago

mrm24 commented 1 year ago

Dear Nakib,

I've changed the interpolation routine within the computation of the phonon drag contribution, so that the corners and the weights are precomputed, which prevents successive recomputation for the same point (misc.f90: precompute_interpolation_corners_and_weights). Moreover, I've removed the LAPACK algorithm and worked out the successive linear interpolations as well as allowed for N simultaneous interpolations, so the precomputed weights and corners ids can be used (misc.f90: interpolate_using_precomputed). In this last, there is the caveat of an array slicing when calling interpolate_using_precomputed, as I am calling it with response_ph(:, s, :); and might be not the best slicing especially if computed in each successive call. How is the memory here for non-toy problem in this point of the code? because it might be worth trying a reorder moving bands to first index.

I did a fast test on toy problem with Si (input.nml), with old (old.log) and the new version (new.log); and I've found a speed-up of 1.85 in the whole execution time of the code and 7 in the coupled iterative part of the code. My guess it is that as the number of calls to the interpolation routine increases, it becomes much worthier to precompute the corners-id and the weights.

I see that the interpolation routine is used for 4ph, do you feel worth moving those also to that scheme?

Best regards,

Martí

nakib commented 1 year ago

Dear Marti. Thanks for this PR! This is really impressive stuff. As I want to do some internal tests, it would be great if you could target the branch Marti_interp (which I have created just now).

Yes, I will adapt the 4-phonon part to use your new method.

Thanks again!

mrm24 commented 1 year ago

Dear Nakib,

I've targeted the new branch.

Martí