Calculating topological invariants

After you’ve done all the work to get the result for a surface, calculating topological invariants is really easy:

result =
print(z2pack.invariant.chern(result))   # Prints the Chern number
print(z2pack.invariant.z2(result))      # Prints the Z2 invariant

As you can see, you simply need to pass the result to either z2pack.invariant.chern() or z2pack.invariant.z2(). That’s it.