From 9ae0c312f93e2d292be32ddd25c8663cb0429354 Mon Sep 17 00:00:00 2001 From: Kipton Barros Date: Mon, 30 Sep 2024 15:27:42 -0600 Subject: [PATCH] Tutorial 2 fixes --- examples/02_LLD_CoRh2O4.jl | 19 ++++++++++--------- src/Binning/Binning.jl | 2 -- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/examples/02_LLD_CoRh2O4.jl b/examples/02_LLD_CoRh2O4.jl index 0bb8f537d..c244b56aa 100644 --- a/examples/02_LLD_CoRh2O4.jl +++ b/examples/02_LLD_CoRh2O4.jl @@ -40,7 +40,7 @@ plot_spins(sys; color=[S[3] for S in sys.dipoles]) # We will be using a [`Langevin`](@ref) spin dynamics to thermalize the system. # This dynamics is a variant of the Landau-Lifshitz equation that incorporates # noise and dissipation terms, which are linked by a fluctuation-dissipation -# theorem. The temperature 6 K ≈ 1.38 meV is slightly above ordering for this +# theorem. The temperature 16 K ≈ 1.38 meV is slightly above ordering for this # model. The dimensionless `damping` magnitude sets a timescale for coupling to # the implicit thermal bath; 0.2 is usually a good choice. @@ -88,8 +88,10 @@ plot_spins(sys; color=[S'*S0 for S in sys.dipoles]) # ### Static structure factor # Use [`SampledCorrelationsStatic`](@ref) to estimate spatial correlations for -# configurations in classical thermal equilibrium. Each call to -# [`add_sample!`](@ref) will accumulate data for the current spin snapshot. +# configurations in classical thermal equilibrium. Measure [`ssf_perp`](@ref), +# which is appropriate for unpolarized neutron scattering. Include the +# [`FormFactor`](@ref) for Co2⁺. Each call to [`add_sample!`](@ref) will +# accumulate data for the current spin snapshot. formfactors = [1 => FormFactor("Co2")] measure = ssf_perp(sys; formfactors) @@ -112,11 +114,10 @@ end grid = q_space_grid(cryst, [1, 0, 0], range(-10, 10, 200), [0, 1, 0], (-10, 10)) -# Calculate and plot the instantaneous structure factor on the slice by -# integrating over all energy values ω. We employ the appropriate -# [`FormFactor`](@ref) for Co2⁺. Selecting `saturation = 1.0` sets the color -# saturation point to the maximum intensity value. This is reasonable because we -# are above the ordering temperature, and do not have sharp Bragg peaks. +# Calculate and plot the instantaneous structure factor on the slice. Selecting +# `saturation = 1.0` sets the color saturation point to the maximum intensity +# value. This is reasonable because we are above the ordering temperature, and +# do not have sharp Bragg peaks. res = intensities_static(sc, grid) plot_intensities(res; saturation=1.0, title="Static Intensities at T = 16 K") @@ -132,7 +133,7 @@ plot_intensities(res; saturation=1.0, title="Static Intensities at T = 16 K") dt = 2*langevin.dt energies = range(0, 6, 50) -sc = SampledCorrelations(sys; dt, energies, measure=ssf_perp(sys)) +sc = SampledCorrelations(sys; dt, energies, measure) # Like before, use Langevin dynamics to sample spin configurations from thermal # equilibrium. Now, however, each call to [`add_sample!`](@ref) will run a diff --git a/src/Binning/Binning.jl b/src/Binning/Binning.jl index 70d6fc46c..3b8267595 100644 --- a/src/Binning/Binning.jl +++ b/src/Binning/Binning.jl @@ -376,7 +376,6 @@ function binned_intensities(sc, params::BinningParameters; kT=nothing, integrate end # Bin (and broaden) those intensities according to BinningParameters - k = zero(MVector{3, Float64}) v = zero(MVector{4, Float64}) q = view(v,1:3) coords = zero(MVector{4, Float64}) @@ -415,7 +414,6 @@ function binned_intensities(sc, params::BinningParameters; kT=nothing, integrate for cell_ix in eachindex(cells), (iω, ω) in enumerate(energies) cell = cells[cell_ix] q .= ((cell.I .- 1) ./ Ls) # q is in R.L.U. - k .= (static_mode ? sc.parent : sc).crystal.recipvecs * q if isnothing(integrated_kernel) # `Delta-function energy' logic # Figure out which bin this goes in v[4] = ω