diff --git a/docs/src/versions.md b/docs/src/versions.md index 398af75d8..96dbbb842 100644 --- a/docs/src/versions.md +++ b/docs/src/versions.md @@ -10,11 +10,12 @@ experimental function [`modify_exchange_with_truncated_dipole_dipole!`](@ref) will accept a real-space cutoff. * Intensities calculated with [`dynamical_correlations`](@ref) now avoid - "smearing artifacts" at gapless modes. See [PR - 246](https://github.com/SunnySuite/Sunny.jl/pull/246) for details. -* In dipole mode, fix bugs to support the case that spin-``S`` varies between - sites. In SU(``N``) mode, however, there is still no support for varying - the Hilbert space dimension ``N`` between sites. + "smearing artifacts" at low-energy (long-timescale) modes. See [PR + 246](https://github.com/SunnySuite/Sunny.jl/pull/246) for details. This + eliminates the need for `process_trajectory=:symmetrize`. +* In dipole mode, having spin-``S`` vary between sites was previously broken, + and is now fixed. In SU(``N``) mode, however, there is still no support for + varying the Hilbert space dimension ``N`` between sites. * Long-range dipole-dipole was previously broken for systems with multiple cells, but is now fixed. * General biquadratic interactions (beyond scalar) in dipole mode are fixed in diff --git a/docs/src/writevtk.md b/docs/src/writevtk.md index 9d1a39336..b70cabf24 100644 --- a/docs/src/writevtk.md +++ b/docs/src/writevtk.md @@ -44,7 +44,7 @@ end ωmax=10. -dsf = dynamical_correlations(sys; dt, nω=48, ωmax, process_trajectory=:symmetrize) +dsf = dynamical_correlations(sys; dt, nω=48, ωmax) nsamples = 10 for _ in 1:nsamples diff --git a/examples/03_LLD_CoRh2O4.jl b/examples/03_LLD_CoRh2O4.jl index 18c76c5d9..c18ff5200 100644 --- a/examples/03_LLD_CoRh2O4.jl +++ b/examples/03_LLD_CoRh2O4.jl @@ -132,7 +132,7 @@ heatmap(q1s, q2s, iq; dt = 2*langevin.dt ωmax = 6.0 # Maximum energy to resolve (meV) nω = 50 # Number of energies to resolve -sc = dynamical_correlations(sys; dt, nω, ωmax, process_trajectory=:symmetrize) +sc = dynamical_correlations(sys; dt, nω, ωmax) # Use Langevin dynamics to sample spin configurations from thermal equilibrium. # For each sample, use [`add_sample!`](@ref) to run a classical spin dynamics diff --git a/src/SampledCorrelations/CorrelationSampling.jl b/src/SampledCorrelations/CorrelationSampling.jl index 4aa32a983..4777e271e 100644 --- a/src/SampledCorrelations/CorrelationSampling.jl +++ b/src/SampledCorrelations/CorrelationSampling.jl @@ -60,17 +60,6 @@ function new_sample!(sc::SampledCorrelations, sys::System) return nothing end -# At the sacrifice of code modularity, this processing step could be effected -# more efficiently by simply taking the real part of the trajectory after the -# Fourier transform -function symmetrize!(sc::SampledCorrelations) - (; samplebuf) = sc - nsteps = size(samplebuf, 6) - mid = floor(Int, nsteps/2) - for t in 1:mid, idx in CartesianIndices(size(samplebuf)[1:5]) - samplebuf[idx, t] = samplebuf[idx, nsteps-t+1] = 0.5*(samplebuf[idx, t] + samplebuf[idx, nsteps-t+1]) - end -end function subtract_mean!(sc::SampledCorrelations) (; samplebuf) = sc diff --git a/src/SampledCorrelations/SampledCorrelations.jl b/src/SampledCorrelations/SampledCorrelations.jl index da3e1f50a..515eaea53 100644 --- a/src/SampledCorrelations/SampledCorrelations.jl +++ b/src/SampledCorrelations/SampledCorrelations.jl @@ -88,7 +88,7 @@ end """ dynamical_correlations(sys::System; dt, nω, ωmax, - process_trajectory=:none, observables=nothing, correlations=nothing) + observables=nothing, correlations=nothing) Creates an empty `SampledCorrelations` object for calculating and storing dynamical structure factor intensities ``𝒮(𝐪,ω)``. Call [`add_sample!`](@ref) @@ -125,12 +125,16 @@ Additional keyword options are the following: """ function dynamical_correlations(sys::System{N}; dt=nothing, Δt=nothing, nω, ωmax, apply_g=true, observables=nothing, correlations=nothing, - calculate_errors=false, process_trajectory=:none) where N + calculate_errors=false, process_trajectory=no_processing) where N if !isnothing(Δt) @warn "`Δt` argument is deprecated! Use `dt` instead." dt = @something dt Δt end isnothing(dt) && error("`dt` parameter required") + if process_trajectory == :symmetrize + @warn "`process_trajectory=:symmetrize` is deprecated and will be ignored" + process_trajectory = no_processing + end observables = parse_observables(N; observables, correlations, g = apply_g ? sys.gs : nothing) @@ -152,17 +156,6 @@ function dynamical_correlations(sys::System{N}; dt=nothing, Δt=nothing, nω, ω Δω = 2π / (dt*measperiod*n_all_ω) end - # Set up trajectory processing function (e.g., symmetrize) - processtraj! = if process_trajectory == :none - no_processing - elseif process_trajectory == :symmetrize - symmetrize! - elseif process_trajectory == :subtract_mean - subtract_mean! - else - error("Unknown argument for `process_trajectory`") - end - # Preallocation na = natoms(sys.crystal) @@ -186,7 +179,7 @@ function dynamical_correlations(sys::System{N}; dt=nothing, Δt=nothing, nω, ω # Make Structure factor and add an initial sample origin_crystal = isnothing(sys.origin) ? nothing : sys.origin.crystal sc = SampledCorrelations{N}(data, M, sys.crystal, origin_crystal, Δω, observables, - samplebuf, fft!, measperiod, apply_g, dt, nsamples, processtraj!) + samplebuf, fft!, measperiod, apply_g, dt, nsamples, process_trajectory) return sc end