-
Notifications
You must be signed in to change notification settings - Fork 19
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
Generalized pair couplings #176
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
How many terms in the SVD sum do you need in the best/worst/typical case? |
This illustrates the behavior on the this branch. The user interface is subject to change, and that's the current blocker for this PR. using Sunny
S1 = spin_matrices(; N=3)
S2 = spin_matrices(; N=4)
Si, Sj = Sunny.to_product_space(S1, S2)
D = Si'*randn(3,3)*Sj
@assert length(Sunny.svd_tensor_expansion(D, 3, 4)) == 3
D = (Si'*randn(3,3)*Sj)^2
@assert length(Sunny.svd_tensor_expansion(D, 3, 4)) == 9
# In practice, though, parameters to `set_pair_coupling!` will pass through this
# decomposition function:
bilin, tensordec = Sunny.decompose_general_coupling(D, S1, S2; fast=true)
@assert length(tensordec.data) == 6 # Just 6 terms left after extracting 3x3 dipole-dipole part
# As an optimization, `decompose_general_coupling`, could also extract the 5x5
# quadrupole-quadrupole part. For this particular example, there would be no terms
# left in the "genereal" expansion. (Not yet implemented.)
# bilin, biquad, tensordec = Sunny.decompose_general_coupling(D, S1, S2; fast=true) |
Basic things work, but seems to be missing 20% performance on "test_conservation", even in dipole mode.
The `foreachbond` abstraction was actually slowing various tests down.
This can be useful because general pair coupling can be very slow -- scales like O(N^2), whereas custom generated functions for spin operators scales like O(N). In the future, could also imagine special handling of all quadrupoles.
Export instead `to_product_space`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR provides initial support for #63, with some differences:
LinearAlgebra.kron
as the tensor product operation.:dipole
mode simulations cannot handle anything but scalar biquadratic. That will be addressed in another PR.