Skip to content

Conversation

@OrbitalC
Copy link
Collaborator

@OrbitalC OrbitalC commented Sep 23, 2024

This commit a new binary for the thermal conductivity, adding four phonon and including single mode, collective and off-diagonal contributions.

The code is less demanding in terms of memory, significantly faster than the previous one and implement a Monte-Carlo double grid sampling to reduce drastically the cost of the scattering computation.

Changes compared with the previous binary (in no particular order)

Added

  • Four phonon scattering (both in the single mode and collective contribution)
  • Added the possibility to compute kappa in the classical limit, by changing phonons occupations and heat capacity to their classical values
  • Use of linear algebra to compute the scattering matrix elements (as for lineshape) for faster computation
  • Use of irreducible triplet and quartet to reduce the number of scattering element to compute
  • Imposes more symmetries (for the thermal conductivity tensor, and also the scattering matrix elements). There is no more tiny but spurious xy kappa from the iterative or off-diagonal contributions
  • Includes a Monte-Carlo integration for the scattering, where it is computed on a subset of the full grid.
  • Added a lo_fftgrid_help in libolle. This contains the thing related to the Monte-Carlo grid and the functions to get a third or fourth q-point conserving quasi-momentum for a fft grid. I put it here to make it possible to use these tools for other binaries.
  • In the log, I added a little thing to recap the parameters used in the calculation. I'm also using the lo_timer types to provide a detailed summary of the timing of the different part of the code

Removed

  • Not compatible with tetrahedron integration. This is due to the Monte-Carlo double grid. It might be possible to implement it, but that's probably a lot of work
  • Is restricted to one temperature at a time. This comes from the memory reduction scheme, which was necessary for the fourth-order contribution to the scattering matrix. (Shortly, the matrix is directly computed with the linewidth instead of computing the processes and adding temperature prefactors when solving for kappa)
  • Does not give access to + and - (or ++, +- and --) scattering rates (this is due to the previous point)
  • The cumulative kappa has not been reimplemented (yet).
  • There is no skip of processes if the energy difference is larger than 4 times the sigma parameter, all processes are included. This is because when we get to the moment to compute the scattering, all the heavy computation necessary to get the scattering matrix element are already done, so skipping processes would not incur substantial speed

Modified

  • Also, the scattering processes are computed a bit differently. The old binary uses a Boltzmann equation formulation while here all was derived from a many-body correlation functions approach. Theoretically, both way to compute the scattering are strictly equivalent. However this relies on a perfect conservation of energy, so for underconverged grid, the results may be different. The formulation is also different for the off-diagonal term (due to the new derivation using displacement operators instead of creation/anihilation). In the end, the new derivation using spectral function things, it is more in line with what is happening in lineshape in grid mode. With this, I actually have single mode results agreeing with RTA results from lineshape (not the case before !)
  • Changed the way the things related to thermal conductivity are written in type_phonons_dispersion. This is because the old version only printed it if p_minus was allocated and, as stated above, we don't have access to it now.
  • Changed a bit the way the adaptive smearing for Gaussians is computed, with a theoretical justification of the new way (it's in the paper). The new version seems to converge faster
  • Slightly different way to pretransform the force constants for the linear algebra scheme. Only difference is that the eigenvectors are divided by the square root of the frequencies from the start, thus avoiding some loops to renormalize the force constants afterwards.
  • The scattering matrix is in matrix form. So the iterative solution for the collective kappa is done slightly differently, but uses BLAS to apply the scattering matrix on the F vectors.

The documentation and test are included for this binary. Also, a note to warn about this new binary has been included in the documentation for the thermal_conductivity binary.
Only thing missing is the link to the paper going with this implementation, that can be added as soon as the preprint is out.

@flokno flokno self-requested a review September 23, 2024 11:05
@flokno flokno added the enhancement New feature or request label Sep 23, 2024
@OrbitalC
Copy link
Collaborator Author

I changed the binary to kubo_transport, as discussed, to avoid confusion with the fourth order and the thermal_conductivity binary.

@flokno
Copy link
Contributor

flokno commented Sep 25, 2024

I had to increase the symmetry tolerance here from lo_sqtol to lo_tol to make it work for my system. Should we make this the default? Are there any possible unwanted side effects? Pinging @ollehellman

@ollehellman
Copy link
Contributor

Increasing the symmetry tolerance should be fine.

nullspace | increase symmetry tolerance for quartets
@flokno flokno added this to the 24.12 release milestone Nov 14, 2024
@flokno
Copy link
Contributor

flokno commented Nov 14, 2024

Remaining for me:

  • general code review
  • test the test
  • document high-kappa simulations, ongoing investigation in comparison to ShengBTE/FourPhonon

Copy link
Contributor

@flokno flokno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First round of comments, mostly on docs and user stuff

Copy link
Contributor

@flokno flokno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More comments, let's discuss them before you change anything

@flokno
Copy link
Contributor

flokno commented Nov 15, 2024

When the paper is out: Document for which materials thermal_conductivity was tested and benchmarked, and for which we are (yet) uncertain. Reminder --> #102

@flokno flokno self-requested a review November 20, 2024 09:37
@flokno
Copy link
Contributor

flokno commented Nov 20, 2024

One more comment: Now that we have seed, we should test the full 4ph binary. I suggest for tests/thermal_conductivity/Makefile:

testfiles:
        extract_forceconstants -rc2 0 -rc3 3 -rc4 0 --polar
        ln -sf outfile.forceconstant infile.forceconstant
        ln -sf outfile.forceconstant_thirdorder infile.forceconstant_thirdorder
        ln -sf outfile.forceconstant_fourthorder infile.forceconstant_fourthorder
        thermal_conductivity -qg 5 5 5 --fourthorder -qg4ph 3 3 3 --seed 1

which takes 3s on my computer. Alternatively it takes 0.5s with a 2x2x2 4ph grid

@flokno flokno merged commit 0e91f45 into tdep-developers:main Dec 2, 2024
@flokno
Copy link
Contributor

flokno commented Dec 2, 2024

Thanks @OrbitalC ! Great development!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants