Dispersions.jl
This project contains
Description
Common Functions
The following functions are available for all grids.
Basic access functions
Convenience functions to access fields of k grid structs.
Dispersions.KGrid — TypeKGrid{T <: KGridType, D}Fields
Nk:Int, Number of total k-pointsNs:Int, Number of sampling points per dimensiont:Float64, hopping parametertp:Float64, hopping parameter, next nearest neighbortpp:Float64, hopping parameter, next next nearest neighborkGrid:Vector{NTuple{D,Float64}}, vector of k-points. Each element is a D-tupleϵkGrid:Vector{Float64}, Dispersion relationkInd:Vector{NTuple{D,Int}}, vector of indices mapping from the full to reduced lattice.kInd_conv:Vector{NTuple{D,Int}}, vector of indices mapping from the full to reduced lattice after convolution (this incorporates possible reorderings).kInd_crossc:Vector{NTuple{D,Int}}, vector of indices mapping from the full to reduced lattice after crosscorrelation (this incorporates possible reorderings).kMult:Vector{Int}, multiplicity per k-point in reduced latticeexpand_perms:Vector{NTuple{D, Int}}, mapping of each k-point in reduced lattice to full lattice pointsexpand_cache:Array{ComplexF64}, internal cache for expansion of reduced to full lattice before executing convolutionsconv_cache:Array{ComplexF64,D}, innternal cache for convolutionsfftw_plan:FFTW.cFFTWPlan, fft plan to be executed in convolutions. WARNING: This field can not be serialized right now and needs to be reconstructed after reading aKGridfrom disk.
Dispersions.Nk — MethodNk(kG::T) where T <: KGridTotal number of k points (length of kGrid.kGrid for full grids).
Dispersions.conv! — Methodconv!(kG::KGrid, res::AbstractVector{ComplexF64}, arr1::AbstractVector{ComplexF64}, arr2::AbstractVector{ComplexF64})Inplace version of conv. The results are written to res.
Dispersions.conv — Methodconv(kG::KGrid, arr1::AbstractVector{ComplexF64}, arr2::AbstractVector{ComplexF64})Computes the convolution with a plus sign of data over two arrays arr1 and arr2, i.e. $res[k] = \sum_{q \in \text{BZ}} arr1[k] * arr2[k+q]$.
crosscorrelation sets the sign of the 'convolution' to +, i.e. $\sum_j f_i g_{i+j}$ instead of $\sum_j f_i g_{i-j}$.
Dispersions.conv_fft! — Methodconv_fft!(kG::KGrid, res::AbstractVector{ComplexF64}, arr1::AbstractVector{ComplexF64}, arr2::AbstractVector{ComplexF64})Inplace version of conv_fft.
Dispersions.conv_fft — Methodconv_fft(kG::KGrid, res::AbstractVector{ComplexF64}, arr1::AbstractVector{ComplexF64}, arr2::AbstractVector{ComplexF64})Version of conv for precomputed arr1 and arr2. Note, that reversing arr2 is also expected, see also conv_fft1, if crosscorrelation = true is assumed.
Dispersions.conv_fft1! — Methodconv_fft1!(kG::KGrid, res::AbstractVector{ComplexF64}, arr1::AbstractVector{ComplexF64}, arr2::AbstractVector{ComplexF64})Inplace version of conv_fft1.
Dispersions.conv_fft1 — Methodconv_fft1(kG::KGrid, res::AbstractVector{ComplexF64}, arr1::AbstractVector{ComplexF64}, arr2::AbstractVector{ComplexF64})Version of conv for precomputed arr2. Note, that reversing the array is also expected, i.e. arr2 = fft(reverse(in_arr2)), if crosscorrelation = true is assumed.
Dispersions.conv_post! — Methodconv_post!(kG::KGrid{cP,D}, res::Array{T,1}, x::Array{T,D}) where {D,T}Inplace version of conv_post. Warning: res should not alias kG.cache2 as some implementations may use this cache without explicitly checking for pointer aliases.
Dispersions.conv_post — Methodconv_post(kG::KGrid, x::Array{T,D})Post convolution steps e.g. reversing or shifting the result. Some lattice types may overload this, depending on the sample points. See cP.jl for an example. crosscorrelation sets the sign for the convolution. See also conv
Dispersions.conv_post_add! — Methodconv_post_add!(kG::KGrid{cP,D}, res::Array{T,1}, x::Array{T,D}) where {D,T}Inplace version of conv_post, but add values instead of replacing them. Warning: res should not alias kG.cache2 as some implementations may use this cache without explicitly checking for pointer aliases.
Dispersions.conv_sample_post — Methodconv_sample_post(kG::KGrid{cP,D}, x)This is needed in case the sampling is not starting at 0, i.e. [0,V) × [0,V) ... in order to shift the 0 frequency to the appropriate sampling point.
Dispersions.dispersion — Methoddispersion(kG::T)::Int where T <: KGridReturns dispersion relation of grid.
Dispersions.expandKArr! — MethodexpandKArr!(kG, arr)Inplace version of expandKArr. The results are written to kG.cache1.
Dispersions.expandKArr! — MethodexpandKArr!(kG, [res,] arr)Inplace version of expandKArr. The results are written to res.
Dispersions.expandKArr — MethodexpandKArr(kGrid::KGrid, arr)Takes a kGrid kGrid and arbitrary data arr over a reduced BZ and returns an array with data over full BZ. This is mainly used before convolutions, since they require data over the full BZ.
Dispersions.findnearest — Methodfindnearest(p, A::AbstractArray) = findmin(map(vi -> norm(vi .- p),A))Finds nearest sampling point in grid A to point p.
Dispersions.gen_kGrid — Methodgen_kGrid(kG::String, Ns::Int)Generates a KGrid of type and hopping strength, given in kG with Ns sampling points in the first Brillouin zone. Options are:
- '3dcP-...' : simple cubic 3D
- '2dcP-...' : simple cubic 2D
- '2dcP-...-...-...' : simple cubic 2D with next-next nearest neighbor hopping
- 'cF-...' : FCC
- 'cI-...' : BCC
Examples
julia> gen_kGrid("3dcP-1.5", 10)
cP(t=1.5) grid in 3 dimensions with 1000 k-points.Dispersions.gridPoints — MethodgridPoints(kG::T)::Int where T <: KGridk vektors for the given grid. Elements of the irreducible part only.
Dispersions.grid_dimension — Methodgrid_dimension(kG::KGrid)Maps the given grid onto its dimension.
Returns:
D : Int, dimension of the reciprocal lattice space.
Dispersions.grid_type — Methodgrid_type(kG::KGrid)
Maps the given grid onto its KGridType without the number of dimensions.Returns:
type : KGridType, type of the reciprocal lattice space, e.g. cP.
Dispersions.gridshape — Methodgridshape(kG::T) where T <: KGridshape of kGrid (e.g. (kG.Ns, kG.Ns) for 2D cP)
Dispersions.map_to_indices — Methodmap_to_indices(path::AbstractVector, grid::AbstractArray, kG::KGrid)Finds indices for points along path for reduced k-grid. Also returns residual values for points, i.e. norm of distance vector between point on path and point in grid.
Dispersions.map_to_indices — Methodmap_to_indices(path::AbstractVector, grid::AbstractArray)Maps vectors in the given input array path to indices in the given k-grid grid. This is used internally, to construct indices for symmetry paths.
Dispersions.map_to_indices_full — Methodmap_to_indices_full(path::AbstractVector, grid::AbstractArray)Finds indices for points along path. Also returns residual values for points, i.e. norm of distance vector between point on path and point in grid.
Dispersions.reduceKArr! — MethodreduceKArr!(kGrid::KGrid, res, arr)Inplace version of reduceKArr. The results are written to res.
Dispersions.reduceKArr — MethodreduceKArr(kGrid::KGrid, arr)Takes a kGrid kGrid and arbitrary data arr over a full BZ and returns an array with data over fully irreducible BZ. This is mainly used after convolutions, since they require data over the full BZ.
Dispersions.reverseKArr — MethodreverseKArr(kGrid::KGrid, arr)Takes a kGrid kGrid and arbitrary data arr over a reduced OR full BZ and returns an array with reversed k-indices. I.e., $\f_q \to f_{-q}$.
Dispersions.sample_along_path — Methodsample_along_path(data::AbstractArray, path::AbstractVector, kG::KGrid)Sample data from reduced grid kG along path. Returns data and residual values (Vector of distances between points along path and sample points used).
Dispersions.ϵ_k_plus_q — Methodϵ_k_plus_q(kG::KGrid, q::NTuple)
Evaluates the dispersion relation on the given reciprocal space but expanded and shifted by a constant vector `q`. The corresponding points in reciprocal space are given by `expandKArr(kG, gridPoints(kG))`.Returns:
`\epsilon(k+\mathrm{shift}):Vector{NTuple{D,Float64}}`, where D is the diemenion of the grid. Dispersion relation evaluated on the given grid but shifted by the the vector q.
ATTENTION: So far this function is tested for the simple cubic lattice only!
Arguments:
kG: reciprocal latticeq: vector in reciprocal space