Skip to content

Commit 5fcc2c4

Browse files
committed
Fix negative sign convention in cg_couple
1 parent 071440a commit 5fcc2c4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

python/featomic/featomic/clebsch_gordan/_coefficients.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,11 @@ def _cg_couple_sparse(
503503
m2 = int(m1m2mu[1])
504504
mu = int(m1m2mu[2])
505505
# Broadcast arrays, multiply together and with CG coeff
506-
output[mu, :, :] += arrays[str((m1, m2))] * cg_l1l2lam.values[i, 0]
506+
output[mu, :, :] += (
507+
arrays[str((m1, m2))]
508+
* (-1) ** (l1 + l2 + o3_lambda)
509+
* cg_l1l2lam.values[i, 0]
510+
)
507511

508512
return output.swapaxes(0, 1)
509513

@@ -531,7 +535,9 @@ def _cg_couple_dense(
531535
l1 = (array.shape[1] - 1) // 2
532536
l2 = (array.shape[2] - 1) // 2
533537

534-
cg_l1l2lam = cg_coefficients.block({"l1": l1, "l2": l2, "lambda": o3_lambda}).values
538+
cg_l1l2lam = (-1) ** (l1 + l2 + o3_lambda) * cg_coefficients.block(
539+
{"l1": l1, "l2": l2, "lambda": o3_lambda}
540+
).values
535541

536542
return _dispatch.tensordot(array, cg_l1l2lam[0, ..., 0], axes=([2, 1], [1, 0]))
537543

0 commit comments

Comments
 (0)