From fa33452fc68e52e3adfbdc3ebc708cfd0a1a80f4 Mon Sep 17 00:00:00 2001 From: Kun Chen Date: Fri, 28 Oct 2022 22:10:28 -0400 Subject: [PATCH 1/3] remove redundant parameter --- src/BaseMesh.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BaseMesh.jl b/src/BaseMesh.jl index 6293f7a..72b8243 100644 --- a/src/BaseMesh.jl +++ b/src/BaseMesh.jl @@ -373,7 +373,7 @@ end return c0 * (1 - yd) + c1 * yd end -function interp(data, mesh::UniformMesh{3,N,MT}, x) where {T,N,MT} +function interp(data, mesh::UniformMesh{3,N,MT}, x) where {N,MT} # find floor index and normalized x y z displacement = SVector{3,Float64}(x) - mesh.origin xyz = (mesh.invlatvec * displacement) .* N .+ (1 - meshshift(MT)) .* (1 + 4 * eps(N * 1.0)) @@ -382,7 +382,7 @@ function interp(data, mesh::UniformMesh{3,N,MT}, x) where {T,N,MT} return linear3D(data, xi, yi, zi, xyz..., N) end -@inline function linear3D(data, xi, yi, zi, x, y, z, N) where {T} +@inline function linear3D(data, xi, yi, zi, x, y, z, N) xd, yd, zd = x - xi, y - yi, z - zi c00 = data[xi+(yi-1)*N+(zi-1)*N^2] * (1 - xd) + data[xi+(yi-1)*N+(zi-1)*N^2] * xd From 06165de9ffe692a331e186671f49a4a64f27cdd2 Mon Sep 17 00:00:00 2001 From: Kun Chen Date: Fri, 28 Oct 2022 23:37:11 -0400 Subject: [PATCH 2/3] atoms and pos can not be empty --- src/Model.jl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Model.jl b/src/Model.jl index 980bdbc..888ddb1 100644 --- a/src/Model.jl +++ b/src/Model.jl @@ -88,8 +88,8 @@ end function Brillouin(; lattice::Matrix{T}, - atoms::AbstractVector{Int}=Vector{Int}([]), - positions=nothing, + atoms::AbstractVector{Int}=Vector{Int}([1,]), + positions=[zeros(size(lattice, 1)),], G_vector=nothing) where {T} DIM = size(lattice, 1) @@ -161,8 +161,11 @@ function standard_brillouin(; tol_symmetry=PointSymmetry.SYMMETRY_TOLERANCE, G_vector=nothing) + DIM = size(lattice, 1) + # @assert DIM == 3 "Only 3D lattices are supported." + # Atoms and terms if length(atoms) != length(positions) error("Length of atoms and positions vectors need to agree.") @@ -184,6 +187,7 @@ function standard_brillouin(; # magnetic_moments = normalize_magnetic_moment.(std_cell.magmoms) ### truncate 3D convention to DIM + lattice = zeros(dtype, DIM, DIM) lattice[1:DIM, 1:DIM] .= _lattice[1:DIM, 1:DIM] positions = [] for i in eachindex(_positions) @@ -192,8 +196,8 @@ function standard_brillouin(; ## make sure the truncation doesn't cause error __lattice, __positions = PointSymmetry._make3D(lattice, positions) - @assert __lattice ≈ _lattice - @assert __positions ≈ _positions + @assert __lattice ≈ _lattice "lattice $_lattice is truncated to $__lattice" + @assert __positions ≈ _positions "position $_positions is truncated to $__position" return Brillouin(; lattice=lattice, From d5a3b8891b34ba2420ce13580a7b6a36c4d4445b Mon Sep 17 00:00:00 2001 From: Kun Chen Date: Sat, 29 Oct 2022 16:51:28 -0400 Subject: [PATCH 3/3] minor fix --- src/BZMeshes.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BZMeshes.jl b/src/BZMeshes.jl index b78a1bb..8d42a4f 100644 --- a/src/BZMeshes.jl +++ b/src/BZMeshes.jl @@ -71,7 +71,7 @@ function UniformBZMesh(; _shift = [s == true ? 1 // 2 : 0 for s in shift] return UniformBZMesh{T,DIM}( - br, (br.recip_lattice * ones(T, DIM)) * origin, size, _shift + br, (br.recip_lattice * ones(T, DIM)) * origin, tuple(size...), _shift ) end @@ -83,7 +83,7 @@ function DFTK_Monkhorst_Pack(; return UniformBZMesh( br=br, origin=-1 // 2, #origin - size=size, + size=tuple(size...), shift=kshift ) end