detect_qtotal

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

Returns the total charge (w.r.t legs) of first non-zero sector found 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) – Blocks with np.max(np.abs(block)) > cutoff are considered as zero. Defaults to QCUTOFF.

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’.