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_arrayarray

The flat numpy array from which you want to detect the charges.

legchargeslist of LegCharge

For each leg the LegCharge.

cutofffloat

Blocks with np.max(np.abs(block)) > cutoff are considered as zero. Defaults to QCUTOFF.

Returns
qtotalcharge

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

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