Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

minor updates #40

Merged
merged 4 commits into from
Oct 29, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
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