Skip to content

Commit

Permalink
Merge pull request #40 from numericalEFT/dev_kun
Browse files Browse the repository at this point in the history
minor updates
  • Loading branch information
iintSjds committed Oct 29, 2022
2 parents 151a9ed + d5a3b88 commit 34a611d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/BZMeshes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -83,7 +83,7 @@ function DFTK_Monkhorst_Pack(;
return UniformBZMesh(
br=br,
origin=-1 // 2, #origin
size=size,
size=tuple(size...),
shift=kshift
)
end
Expand Down
4 changes: 2 additions & 2 deletions src/BaseMesh.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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
Expand Down
12 changes: 8 additions & 4 deletions src/Model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.")
Expand All @@ -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)
Expand All @@ -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,
Expand Down

0 comments on commit 34a611d

Please # to comment.