Skip to content

Commit

Permalink
Add symmetrize_coupling
Browse files Browse the repository at this point in the history
This is currently an internal function, and needs
more testing.
  • Loading branch information
kbarros committed Sep 20, 2024
1 parent c47ef56 commit 00bf729
Showing 1 changed file with 15 additions and 0 deletions.
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

0 comments on commit 00bf729

Please sign in to comment.