Skip to content

Z2 combine_rule can produce -1 #766

@chiamin

Description

@chiamin

I am not sure if this is a bug or is on purpose, but the current combine_rule for Z2 symmetry can produce 0, 1, or -1, while -1 quantum number is now allowed in creating a bond. To me, it is more natural to restrict Z2 qn to only {0,1}.

I attached an example code as follows

import cytnx

sym = cytnx.Symmetry.Zn(2)

# combine_rule can give 0, 1 or -1
print("=== Z2 combine_rule ===")
for a in range(-1, 3):
    for b in range(-1, 3):
        result = sym.combine_rule(a, b)
        print("  combine(", a, ",", b, ") =", result)

# However, Bond rejects qnums -1 ---
b_bad = cytnx.Bond(cytnx.BD_IN, [[-1], [0]], [1, 1], [sym]) # raise error

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions