Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add non-local observables #243

Closed
wants to merge 2 commits into from

Conversation

Lazersmoke
Copy link
Contributor

This PR adds support for a new type of observable to be used with SampledCorrelations: a NonLocalObservableOperator. There should probably be error handling and/or support added for the spin wave theory case, where I'm not sure that this type of observable can be used. (This PR implements the functionality only)

The reason for this is to support computing correlations of the form <s_i(t) energy_grad_j(t')> where energy_grad is the gradient of the Hamiltonian with respect to the spins (component index j). This observable is non-site-local because it depends on exchanges with distant sites along bonds. This type of correlation is important for computing classical response functions.

For such non-local observable, the (only) fast way to generally support it is to let the observable be a callback which computes the value on every site at once.

Currently, the NonLocalObservableOperator constructor and energy_gradient_dipole_observable are not exported, but it can be used like this:

observables = [
  :Sx => [1. 0 0], 
  :Sy => [0. 1 0], 
  :Sz => [0. 0 1],
  :A => Sunny.energy_gradient_dipole_observable(1),
  :B => Sunny.energy_gradient_dipole_observable(2),
  :C => Sunny.energy_gradient_dipole_observable(3),
  :dipoleNorm => Sunny.NonLocalObservableOperator(sys -> norm.(sys.dipoles))]

dsc = dynamical_correlations(sys;Δt = 0.05, nω = 600, ωmax = 1.0, observables)

which results in the usual x,y,z spin (not magnetization) observables, plus the three components of the energy gradient, plus the dipole sector norm being available to compute correlations between.

@@ -1,8 +1,12 @@

struct NonLocalObservableOperator
localize :: Function # A function of System, returning an ObservableOperator which is *not* a NonLocalObservableOperator
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Julia type system is not strong enough to enforce this comment 😢

@kbarros
Copy link
Member

kbarros commented Aug 19, 2024

This feature is currently out of scope, but can be revisited if there is sufficient user demand.

@kbarros kbarros closed this Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants