Skip to content

Commit

Permalink
v0.4.1 (#13)
Browse files Browse the repository at this point in the history
* initial commit

* progress on aps_example, but small eta problem?

* ptr+tai working

* nestedquad simplifications

* restore autoptr

* update example

* remove hdf5 interface

* additional algorithms with tests

* rename cache to solver

* remove frankentuples

* minor fixes

* IAI for CommonSolveFourierIntegralFunction

* bump aqua to v0.8

* implement HCubatureJL for CommonSolveFourierIntegralFunction

* test HCubatureJL for CommonSolveFourierIntegralFunction

* add tests for unitfulext and atomsbaseext

* add tests for WannierIOExt

* bump v0.4.1
  • Loading branch information
lxvm authored Sep 11, 2024
1 parent 99cb1e0 commit 26fe3f9
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 16 deletions.
12 changes: 9 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "AutoBZCore"
uuid = "66bd3e16-1600-45cf-8f55-0b550710682b"
authors = ["lxvm <lorenzo@vanmunoz.com>"]
version = "0.4.0-DEV"
version = "0.4.1"

[deps]
AutoSymPTR = "78a0c066-08f1-49a8-82f0-b29cd485e1d3"
Expand Down Expand Up @@ -29,7 +29,7 @@ UnitfulExt = "Unitful"
WannierIOExt = "WannierIO"

[compat]
Aqua = "0.7"
Aqua = "0.8"
AtomsBase = "0.3"
AutoSymPTR = "0.4"
ChunkSplitters = "2"
Expand All @@ -41,9 +41,14 @@ GeneralizedGaussianQuadrature = "0.1"
HCubature = "1.4"
IteratedIntegration = "0.5"
LinearAlgebra = "1.9"
OffsetArrays = "1"
Polyhedra = "0.6,0.7"
QuadGK = "2.6"
StaticArrays = "1"
SymmetryReduceBZ = "0.2"
Test = "1.9"
Unitful = "1"
UnitfulAtomic = "1"
WannierIO = "0.1,0.2"
julia = "1.9"

Expand All @@ -59,7 +64,8 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
SymmetryReduceBZ = "49a35663-c880-4242-bebb-1ec8c0fa8046"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
UnitfulAtomic = "a7773ee8-282e-5fa2-be4e-bd808c38a91a"
WannierIO = "cb1bc77f-5443-4951-af9f-05b616a3e422"

[targets]
test = ["Aqua", "Elliptic", "LinearAlgebra", "GeneralizedGaussianQuadrature", "Test", "StaticArrays", "OffsetArrays", "SymmetryReduceBZ", "Polyhedra"]
test = ["Aqua", "Elliptic", "LinearAlgebra", "GeneralizedGaussianQuadrature", "Test", "StaticArrays", "OffsetArrays", "SymmetryReduceBZ", "Polyhedra", "AtomsBase", "Unitful", "UnitfulAtomic", "WannierIO"]
4 changes: 2 additions & 2 deletions ext/UnitfulExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ module UnitfulExt
import AutoBZCore: canonical_reciprocal_basis, canonical_ptr_basis

function canonical_reciprocal_basis(A::AbstractMatrix{<:Quantity})
return canonical_reciprocal_basis(ustrip(A)) / unit(eltype(A))
return canonical_reciprocal_basis(ustrip.(A)) / unit(eltype(A))
end
function canonical_ptr_basis(B::AbstractMatrix{<:Quantity})
return canonical_ptr_basis(ustrip(B))
return canonical_ptr_basis(ustrip.(B))
end
end
11 changes: 11 additions & 0 deletions src/fourier.jl
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,20 @@ function init_cacheval(f::FourierIntegralFunction, dom, p, ::HCubatureJL; kws...
ws = get_fourierworkspace(f)
return ws
end
function init_cacheval(f::CommonSolveFourierIntegralFunction, dom, p, ::HCubatureJL; kws...)
# TODO utilize hcubature_buffer
ws = get_fourierworkspace(f)
cache, integrand, = _init_commonsolvefourierfunction(f, dom, p; ws)
return (; ws, cache, integrand)
end
function hcubature_integrand(f::FourierIntegralFunction, p, a, b, ws)
x -> f.f(x, ws(x), p)
end
function hcubature_integrand(f::CommonSolveFourierIntegralFunction, p, a, b, cacheval)
integrand = cacheval.integrand
ws = cacheval.ws
x -> integrand(x, ws(x), p)
end

function init_autosymptr_cache(f::FourierIntegralFunction, dom, p, bufsize; kws...)
ws = get_fourierworkspace(f)
Expand Down
2 changes: 1 addition & 1 deletion test/aqua.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Aqua
using AutoBZCore

Aqua.test_all(AutoBZCore, project_toml_formatting=false)
Aqua.test_all(AutoBZCore)
11 changes: 6 additions & 5 deletions test/atomsbaseext.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ using UnitfulAtomic
using AtomsBase
using AutoBZCore
using SymmetryReduceBZ
using LinearAlgebra: det

# do the example of getting the volume of the bz of silicon
bounding_box = 10.26 / 2 * [[0, 0, 1], [1, 0, 1], [1, 1, 0]]u"bohr"
Expand All @@ -13,10 +14,10 @@ silicon = periodic_system([:Si => ones(3)/8,
A = reinterpret(reshape,eltype(eltype(bounding_box)),AtomsBase.bounding_box(silicon))
recip_vol = det(AutoBZCore.canonical_reciprocal_basis(A))
fbz = load_bz(FBZ(), silicon)
fprob = AutoBZCore.IntegralProblem((x,p) -> 1.0, fbz)
fprob = AutoBZCore.AutoBZProblem((x,p) -> 1.0, fbz)
ibz = load_bz(IBZ(), silicon)
iprob = AutoBZCore.IntegralProblem((x,p) -> 1.0, ibz)
for alg in (IAI(), PTR(), TAI())
@test recip_vol AutoBZCore.solve(fprob, alg).u
@test recip_vol AutoBZCore.solve(iprob, alg).u
iprob = AutoBZCore.AutoBZProblem(TrivialRep(), IntegralFunction((x,p) -> 1.0), ibz)
for alg in (IAI(), PTR())
@test recip_vol AutoBZCore.solve(fprob, alg).value
@test recip_vol AutoBZCore.solve(iprob, alg).value
end
2 changes: 1 addition & 1 deletion test/fourier.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ using AutoBZCore: PuncturedInterval, HyperCube, segments, endpoints
subprob = IntegralProblem(f, (a, b), ((a+b)/2, s((a+b)/2), 1.0))
abstol = 1e-5
prob = IntegralProblem(CommonSolveFourierIntegralFunction(subprob, QuadGKJL(), update!, postsolve, s), (a, b), p; abstol)
for alg in (QuadGKJL(), QuadratureFunction(), AuxQuadGKJL(), ContQuadGKJL(), MeroQuadGKJL())
for alg in (QuadGKJL(), HCubatureJL(), QuadratureFunction(), AuxQuadGKJL(), ContQuadGKJL(), MeroQuadGKJL())
cache = init(prob, alg)
for p in [3.0, 4.0]
ref = (b-a)*(t*p + (b-a)^2/2) + (b-a)^2/2*t*(b*sin(b/t*2pi) + t*cos(b/t*2pi) - (a*sin(a/t*2pi) + t*cos(a/t*2pi)))
Expand Down
5 changes: 3 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ include("utils.jl")
@testset "brillouin" include("brillouin.jl")
@testset "fourier" include("fourier.jl")
@testset "SymmetryReduceBZExt" include("test_ibz.jl")
# @testset "AtomsBaseExt" include("atomsbaseext.jl")
# @testset "WannierIOExt" include("wannierioext.jl")
@testset "UnitfulExt" include("unitfulext.jl")
@testset "AtomsBaseExt" include("atomsbaseext.jl")
@testset "WannierIOExt" include("wannierioext.jl")
@testset "DOS" include("dos.jl")
14 changes: 14 additions & 0 deletions test/unitfulext.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Test
using Unitful
using AutoBZCore
using AutoBZCore: canonical_reciprocal_basis, canonical_ptr_basis
using LinearAlgebra: I
using StaticArrays

for A in [rand(3, 3) * u"m", rand(SMatrix{3,3,Float64,9})*u"m"]
B = canonical_reciprocal_basis(A)
@test B'A 2pi*I
pB = canonical_ptr_basis(B)
@test pB isa AutoBZCore.Basis
@test pB.B I
end
13 changes: 11 additions & 2 deletions test/wannierioext.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@ using Test
using WannierIO
using AutoBZCore
using SymmetryReduceBZ
using LinearAlgebra: det

# TODO use artefacts to provide an input wout file
fbz = load_bz(FBZ(), "svo.wout")
ibz = load_bz(IBZ(), "svo.wout")
path = joinpath(dirname(dirname(pathof(AutoBZCore))), "aps_example/svo.wout")
fbz = load_bz(FBZ(), path)
ibz = load_bz(IBZ(), path)
@test det(fbz.B) det(ibz.B)
fprob = AutoBZCore.AutoBZProblem((x,p) -> 1.0, fbz)
iprob = AutoBZCore.AutoBZProblem(TrivialRep(), IntegralFunction((x,p) -> 1.0), ibz)
for alg in (IAI(), PTR())
@test det(fbz.B) AutoBZCore.solve(fprob, alg).value
@test det(ibz.B) AutoBZCore.solve(iprob, alg).value
end

2 comments on commit 26fe3f9

@lxvm
Copy link
Owner Author

@lxvm lxvm commented on 26fe3f9 Sep 11, 2024

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/115022

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.4.1 -m "<description of version>" 26fe3f9aac93ea9a7915fe7beb59f575bb84b972
git push origin v0.4.1

Please sign in to comment.