Skip to content
Open
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
13 changes: 13 additions & 0 deletions irrepx/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,19 @@ def _build_cg(target: Path, lmax: int, include_soc: bool = False):
data[f"{key}/coo_l"] = cols
data[f"{key}/entries"] = vals

# exchange l1 and l2
blocks = []
for l3 in range(abs(1 - l2), 1 + l2 + 1):
blocks.append(clebsch_gordan(l2, 1, l3) * np.sqrt(2 * l3 + 1))
cg_full = np.concatenate(blocks, axis=-1)
rows1, rows2, cols = np.nonzero(cg_full)
vals = cg_full[rows1, rows2, cols]
key = f"l1={l2},l2={1}"
data[f"{key}/coo_l1"] = rows1
data[f"{key}/coo_l2"] = rows2
data[f"{key}/coo_l"] = cols
data[f"{key}/entries"] = vals

out = target / "cg.npz"
np.savez_compressed(out, **data)
extra = " +SOC" if include_soc else ""
Expand Down