detect_qtotal

tenpy.linalg.np_conserved.detect_qtotal(flat_array, legcharges, cutoff=None)[source]

Returns the total charge (w.r.t legs) of the sector with largest entry in flat_array.

Parameters:
  • flat_array (array) – The flat numpy array from which you want to detect the charges.

  • legcharges (list of LegCharge) – For each leg the LegCharge.

  • cutoff (float) – If the largest (absolute) value is smaller than that, raise a warning and return zero charges.

Returns:

qtotal – The total charge fo the first non-zero (i.e. > cutoff) charge block.

Return type:

charge

See also

detect_legcharge

detects the charges of one missing LegCharge if qtotal is known.

detect_grid_outer_legcharge

similar functionality if the flat array is given by a ‘grid’.