Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Taking integration paths seriously #325

Merged
merged 1 commit into from
Dec 5, 2024
Merged

Taking integration paths seriously #325

merged 1 commit into from
Dec 5, 2024

Conversation

pablosanjose
Copy link
Owner

@pablosanjose pablosanjose commented Nov 28, 2024

We introduce submodule Paths that contain different possible integration paths for densitymatrix and josephson. The default densitymatrix(gs, ω0; kw...) corresponds to densitymatrix(gs, Paths.radial(ω0, π/4); kw...). This no longer an integral from -ω0 to ω0, but rather along a path as shown in the figure, where the angle in orange is set to ϕ = π/4, and the outer arcs are taken to infinity. (The angle can of course be changed by using the full densitymatrix(gs, Paths.radial(ω0, ϕ); kw...) syntax)

image

The integral over the arcs is analytic (thanks to spectral weight normalization), so only the radial parts need to be computed numerically. Along these radial parts the path is parametrized as ω = x * ω0 * cis(sign(x)*ϕ) with x from -Inf to Inf, so that ω0 has the meaning of a radial speed. This method is often faster than the old sawtooth path default, and does not require precomputing ω0 precisely as we did before (where it needed to be greater than the system half-bandwidth): the integral will converge to the same value regardless of ω0, only integration time will change, making this a much more robust default.

The old sawtooth path is available through Paths.sawtooth(reak_ω_points...; slope = 1, imshift = true) and we also have a general Paths.polygon(complex_ω_points...). Note that josephson(gs, ωs::Tuple) defaults to josephson(gs, Paths.sawtooth(ωs...)), and the same for densitymatrix.

The old path_override hack is no longer necessary, since we now also have Paths.polygon((µ, kBT; params...) -> ωpoints) as a possible path, which changes depending on chemical potential, temperature or system parameters.

As this is a breaking change, I summarize what needs to be done to old codebases to adapt:

  • josephson(gs, ωmax) will now use a different (often faster) algorithm, and ωmax may be replaced with any estimated ω0 energy scale that dominates the contribution to the Josephson current (no need to compute a band range explicitly). This parameter only affects integration speed, not the result. To get the old behavior use josephson(gs, (-ωmax, ωmax)) instead. Same story for densitymatrix
  • J(kBT, ωpoints; params...) as syntax to override ωpoints should now be replace with J = josephson(gs, Paths.polygon((µ, kBT; params...) -> ωpoints), and then simply J(kBT; params...). Note the use of µ in the polygon function signature, which is simply ignored in the josephson case, as µ = 0 there. Same story for densitymatrix, although in that case ωpoints can depend on µ too.

@codecov-commenter
Copy link

codecov-commenter commented Dec 4, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 92.71255% with 18 lines in your changes missing coverage. Please review.

Project coverage is 92.45%. Comparing base (6197b8b) to head (4a828d2).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/integrator.jl 90.27% 7 Missing ⚠️
src/observables.jl 92.72% 4 Missing ⚠️
src/solvers/green/internal.jl 88.88% 2 Missing ⚠️
src/types.jl 60.00% 2 Missing ⚠️
src/greenfunction.jl 97.87% 1 Missing ⚠️
src/specialmatrices.jl 97.05% 1 Missing ⚠️
src/tools.jl 90.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #325      +/-   ##
==========================================
- Coverage   92.47%   92.45%   -0.03%     
==========================================
  Files          39       41       +2     
  Lines        6907     7074     +167     
==========================================
+ Hits         6387     6540     +153     
- Misses        520      534      +14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pablosanjose pablosanjose force-pushed the matsubara branch 4 times, most recently from 275c5fa to 8bb0fb8 Compare December 5, 2024 15:01
@pablosanjose pablosanjose merged commit 8a8b193 into master Dec 5, 2024
9 checks passed
@pablosanjose pablosanjose deleted the matsubara branch December 5, 2024 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants