Skip to content

Commit

Permalink
Remove process_trajectory_symmetrize from public docs
Browse files Browse the repository at this point in the history
For experts, a keyword argument with the same name still exists, but now accepts a function rather than symbol.
  • Loading branch information
kbarros committed May 19, 2024
1 parent f70682c commit 1e216b2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 32 deletions.
11 changes: 6 additions & 5 deletions docs/src/versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/src/writevtk.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/03_LLD_CoRh2O4.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ heatmap(q1s, q2s, iq;
dt = 2*langevin.dt
ωmax = 6.0 # Maximum energy to resolve (meV)
= 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
Expand Down
11 changes: 0 additions & 11 deletions src/SampledCorrelations/CorrelationSampling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 7 additions & 14 deletions src/SampledCorrelations/SampledCorrelations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand All @@ -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)

Expand All @@ -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
Expand Down

0 comments on commit 1e216b2

Please sign in to comment.