Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kbarros committed Jul 25, 2023
1 parent 8727a70 commit 0984daa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/System/System.jl
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,8 @@ end
Polarize the spin at a [`Site`](@ref) along the direction `dir`.
"""
function polarize_spin!(sys::System{N}, dir, site) where N
setspin!(sys, dipolar_state(sys, site, dir), to_cartesian(site))
site = to_cartesian(site)
setspin!(sys, dipolar_state(sys, site, dir), site)
end

"""
Expand Down
7 changes: 4 additions & 3 deletions test/test_optimization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ end

@testitem "Optimization" begin
# H = -∑Sᵢ⋅Sⱼ - ∑(Sᵢᶻ)² on 2D square lattice (z-polarized ground state)
function simple_sys(; mode=:dipole, dims=(4,4,1), seed=nothing, S)
function simple_sys(; dims=(4,4,1), mode, seed, S)
cryst = Crystal(lattice_vectors(1,1,2,90,90,90), [[0,0,0]])
sys = System(cryst, dims, [SpinInfo(1; S)], mode; seed)
set_exchange!(sys, -1, Bond(1,1,[1,0,0]))
Expand All @@ -27,8 +27,9 @@ end
S = 3/2
is_z_polarized(sys) = all(s -> abs(s[3]) S, sys.dipoles)

sys_dip = simple_sys(; mode=:dipole, seed=101, S)
sys_sun = simple_sys(; mode=:SUN, seed=102, S)
seed = 101
sys_dip = simple_sys(; mode=:dipole, seed, S)
sys_sun = simple_sys(; mode=:SUN, seed, S)

# Thermalize near ground state
Δt = 0.05
Expand Down

0 comments on commit 0984daa

Please sign in to comment.