-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add ImplicitIntegration extension (#14)
* add ImplicitIntegration extension * add docstring to docs * bump ImplicitIntegration v0.1.1
- Loading branch information
Showing
6 changed files
with
65 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
module AutoBZCoreImplicitIntegrationExt | ||
|
||
using AutoBZCore | ||
using FourierSeriesEvaluators | ||
using ImplicitIntegration | ||
using LinearAlgebra | ||
using StaticArrays | ||
|
||
function AutoBZCore.init_cacheval(h, domain, p, alg::ImplicitIntegrationJL) | ||
h isa FourierSeries || throw(ArgumentError("GGR currently supports Fourier series Hamiltonians")) | ||
p isa SymmetricBZ || throw(ArgumentError("GGR supports BZ parameters from load_bz")) | ||
j = JacobianSeries(h) | ||
wj = FourierSeriesEvaluators.workspace_allocate(j, FourierSeriesEvaluators.period(j)) | ||
return wj | ||
end | ||
|
||
|
||
function AutoBZCore.dos_solve(h, domain, p, alg::ImplicitIntegrationJL, cacheval; | ||
abstol=1e-8, reltol=nothing, maxiters=nothing) | ||
domain isa Number || throw(ArgumentError("GGR supports domains of individual eigenvalues")) | ||
p isa SymmetricBZ || throw(ArgumentError("GGR supports BZ parameters from load_bz")) | ||
E = domain | ||
bz = p | ||
j = cacheval | ||
ϕ = k -> begin | ||
H = h(k)-E*I | ||
real(StaticArrays._det(StaticArrays.Size(H), H)) | ||
end | ||
f = k -> begin | ||
hk, vk = j(k) | ||
values, U = eigen(Hermitian(hk)) | ||
resid, n = findmin(x -> abs(x-E), values) | ||
u = U[:,n] | ||
return inv(sqrt(mapreduce(v -> abs2(dot(u,v,u)/u'u), +, vk))) # compute 1/|∇ϵₙ| | ||
end | ||
result = integrate(f, ϕ, map(zero, FourierSeriesEvaluators.period(h)), FourierSeriesEvaluators.period(h); surface=true, tol=abstol) | ||
return AutoBZCore.DOSSolution(result.val, AutoBZCore.Success, (; loginfo=result.logger)) | ||
end | ||
|
||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters