Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 16 additions & 19 deletions src/problems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ BPProblem(H, N) = BPProblem(; H=H, N=N)

# Problem for calculating the first Chern number
@doc raw"""
FCProblem{T1<:Function,T2<:Union{Tuple,AbstractVector,Int},T3<:Real,T4<:Bool} <: TopologicalNumbersProblems
FCProblem{T1<:Function,T2<:Int,T3<:Real,T4<:Bool} <: TopologicalNumbersProblems

A struct representing a problem for calculating the first Chern number.

# Fields
- `H::T1`: The Hamiltonian function `H=H(k, p)` that defines the system. `k` is a abstract vector (or a tuple) of the wavenumber vector and `p` contains parameter. Dimension of `k` must be 2.
- `N::T2`: The number of points for one direction in the Brillouin zone. Default is 51.
- `N::T2`: Brillouin zone のメッシュ数を表す整数。既定値は51です。
- `gapless::T3`: The threshold for considering a band as gapless. Default is 0.0.
- `rounds::T4`: A boolean indicating whether to round a returned variable. Default is true.

Expand All @@ -83,9 +83,8 @@ A struct representing a problem for calculating the first Chern number.
julia>
```
"""
Base.@kwdef struct FCProblem{
T1<:Function,T2<:Union{Tuple,AbstractVector,Int},T3<:Real,T4<:Bool
} <: TopologicalNumbersProblems
Base.@kwdef struct FCProblem{T1<:Function,T2<:Int,T3<:Real,T4<:Bool} <:
TopologicalNumbersProblems
H::T1
N::T2 = 51
gapless::T3 = 0.0
Expand Down Expand Up @@ -118,7 +117,7 @@ Constructs a first Chern number problem with the default parameters.

# Arguments
- `H`: The Hamiltonian function `H=H(k, p)` that defines the system. `k` is a abstract vector (or a tuple) of the wavenumber vector and `p` contains parameter. Dimension of `k` must be 2.
- `N`: The number of points for one direction in the Brillouin zone.
- `N`: Brillouin zone のメッシュ数を表す整数。

# Returns
A `FCProblem` object.
Expand Down Expand Up @@ -304,14 +303,14 @@ Z2Problem(H, Nf, N) = Z2Problem(; H=H, Nfill=Nf, N=N)

# Problem for calculating the local Berry flux
@doc raw"""
LBFProblem{T1<:Function,T2<:AbstractVector,T3<:Union{Tuple,AbstractVector,Int},T4<:Real,T5<:Bool} <: TopologicalNumbersProblems
LBFProblem{T1<:Function,T2<:AbstractVector,T3<:Int,T4<:Real,T5<:Bool} <: TopologicalNumbersProblems

A struct representing a problem for calculating the $k$-local value of Berry flux.

# Fields
- `H::T1`: The Hamiltonian function `H=H(k)` that defines the system. `k` is an `AbstractVector` (or a `Tuple`) of the wavenumber vector. Dimension of `k` must be 2.
- `n::T2`: An `AbstractVector` (or a `Tuple`) including two elements of `Int`, which represents wavenumber ($2\pi n/N$) when calculating Berry flux. Dimension of `n` must be 2.
- `N::T3`: The number of points for one direction in the Brillouin zone. Default is 51.
- `N::T3`: Brillouin zone のメッシュ数を表す整数。既定値は51です。
- `gapless::T4`: The threshold for considering a band as gapless. Default is 0.0.
- `rounds::T5`: A boolean indicating whether to round a returned variable. Default is true.

Expand All @@ -320,9 +319,8 @@ A struct representing a problem for calculating the $k$-local value of Berry flu
julia>
```
"""
Base.@kwdef struct LBFProblem{
T1<:Function,T2<:AbstractVector,T3<:Union{Tuple,AbstractVector,Int},T4<:Real,T5<:Bool
} <: TopologicalNumbersProblems
Base.@kwdef struct LBFProblem{T1<:Function,T2<:AbstractVector,T3<:Int,T4<:Real,T5<:Bool} <:
TopologicalNumbersProblems
H::T1
n::T2
N::T3 = 51
Expand Down Expand Up @@ -358,7 +356,7 @@ Constructs a local Berry flux problem with the default parameters.
# Arguments
- `H`: The Hamiltonian function `H=H(k)` that defines the system. `k` is a abstract vector (or a tuple) of the wavenumber vector. Dimension of `k` must be 2.
- `n`: An `AbstractVector` (or a `Tuple`) including two elements of `Int`, which represents wavenumber ($2\pi n/N$) when calculating Berry flux. Dimension of `n` must be 2.
- `N`: The number of points for one direction in the Brillouin zone.
- `N`: Brillouin zone のメッシュ数を表す整数。

# Returns
A `LBFProblem` object.
Expand All @@ -372,15 +370,15 @@ LBFProblem(H, n, N) = LBFProblem(; H=H, n=n, N=N)

# Problem for finding and calculating the Weyl points
@doc raw"""
WCSProblem{T1<:Function,T2<:String,T3<:Int,T4<:Union{Tuple,AbstractVector,Int},T5<:Real,T6<:Bool} <: TopologicalNumbersProblems
WCSProblem{T1<:Function,T2<:String,T3<:Int,T4<:Int,T5<:Real,T6<:Bool} <: TopologicalNumbersProblems

A struct representing a problem for finding and calculating the Weyl points.

# Fields
- `H::T1`: The Hamiltonian function `H=H(k)` that defines the system. `k` is a abstract vector (or a tuple) of the wavenumber vector. Dimension of `k` must be 3.
- `kn::T2`: Compute the Chern number of the plane perpendicular to the `"kn"` direction in Brillouin zone (`"k1"`, `"k2"`, `"k3"`).
- `kn_mesh::T3`: Number of mesh in `"kn"` direction. Default is 51.
- `N::T4`: The number of points for one direction in the Brillouin zone. Default is 51.
- `N::T4`: 各切断面の1方向あたりのメッシュ数を表す整数。既定値は51です。
- `gapless::T5`: The threshold for considering a band as gapless. Default is 0.0.
- `rounds::T6`: A boolean indicating whether to round a returned variable. Default is true.

Expand All @@ -389,9 +387,8 @@ A struct representing a problem for finding and calculating the Weyl points.
julia>
```
"""
Base.@kwdef struct WCSProblem{
T1<:Function,T2<:String,T3<:Int,T4<:Union{Tuple,AbstractVector,Int},T5<:Real,T6<:Bool
} <: TopologicalNumbersProblems
Base.@kwdef struct WCSProblem{T1<:Function,T2<:String,T3<:Int,T4<:Int,T5<:Real,T6<:Bool} <:
TopologicalNumbersProblems
H::T1
kn::T2
kn_mesh::T3 = 51
Expand Down Expand Up @@ -428,7 +425,7 @@ Constructs a problem for finding and calculating the Weyl points with the defaul
# Arguments
- `H`: The Hamiltonian function `H=H(k)` that defines the system. `k` is a abstract vector (or a tuple) of the wavenumber vector. Dimension of `k` must be 3.
- `kn`: Compute the Chern number of the plane perpendicular to the `"kn"` direction in Brillouin zone (`"k1"`, `"k2"`, `"k3"`).
- `N`: The number of points for one direction in the Brillouin zone.
- `N`: 各切断面の1方向あたりのメッシュ数を表す整数。

# Returns
A `WCSProblem` object.
Expand All @@ -449,7 +446,7 @@ Constructs a problem for finding and calculating the Weyl points with the defaul
- `H`: The Hamiltonian function `H=H(k)` that defines the system. `k` is a abstract vector (or a tuple) of the wavenumber vector. Dimension of `k` must be 3.
- `kn`: Compute the Chern number of the plane perpendicular to the `"kn"` direction in Brillouin zone (`"k1"`, `"k2"`, `"k3"`).
- `N1`: Number of mesh in `"kn"` direction.
- `N2`: The number of points for one direction in the Brillouin zone.
- `N2`: 各切断面の1方向あたりのメッシュ数を表す整数。

# Returns
A `WCSProblem` object.
Expand Down
9 changes: 6 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ const np = pyimport("numpy")

@test calcChern(H) == (TopologicalNumber=[1, 1, -2, -2, 1, 1], Total=0)

FCProblem(H, 41)
@test FCProblem(H, 41).N == 41
@test_throws MethodError FCProblem(H, (41, 41))
prob = FCProblem(H)
@test solve(prob).TopologicalNumber == [1, 1, -2, -2, 1, 1]

Expand All @@ -226,7 +227,8 @@ const np = pyimport("numpy")
@test C1 == [1, 1, -2, -2, 1, 1]
@test C2 ≈ [1, 1, -2, -2, 1, 1]

LBFProblem(H, zeros(3), 41)
@test LBFProblem(H, zeros(3), 41).N == 41
@test_throws MethodError LBFProblem(H, zeros(2), (41, 41))
C1 = zeros(6)
C2 = zeros(6)
N = 51
Expand Down Expand Up @@ -624,7 +626,8 @@ const np = pyimport("numpy")
@test result.nums[:, 2] == -result.nums[:, 1]

WCSProblem(H₀, "k1")
WCSProblem(H₀, "k1", 11, 41)
@test WCSProblem(H₀, "k1", 11, 41).N == 41
@test_throws MethodError WCSProblem(H₀, "k1", 11, (41, 41))
prob = WCSProblem(H₀, "k1", 11)
result = solve(prob)
@test result.kn == "k1"
Expand Down
Loading