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 symmetrize_coupling function #320

Merged
merged 1 commit into from
Sep 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/Symmetry/AllowedCouplings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,21 @@ function is_coupling_valid(cryst::Crystal, b::Bond, J)
end


# TODO: Try for various crystals and add unit tests.
function symmetrize_coupling(cryst::Crystal, J, b::Bond)
J = Mat3(J)
acc = zero(Mat3)
cnt = 0
b = BondPos(cryst, b)
for (symop, parity) in unique(symmetries_between_bonds(cryst, b, b))
R = cryst.latvecs * symop.R * inv(cryst.latvecs)
acc += transform_coupling_by_symmetry(J, R*det(R), parity)
cnt += 1
end
return acc / cnt
end


# Orthonormal basis of 3x3 symmetric matrices
const sym_basis = begin
b = [diagm([1, 0, 0]),
Expand Down
Loading