triqs.operators.util.hamiltonians.backward_compat

triqs.operators.util.hamiltonians.backward_compat(fname, n_orb, orb_names)[source]

Validate and normalize the orbital count for backward compatibility.

Raises if the removed orb_names argument is supplied, and converts a list passed in place of n_orb into its length while emitting a UserWarning.

Parameters:
fnamestr

Name of the calling function, used in the warning message.

n_orbint or list

Number of orbitals. A list is accepted for backward compatibility and replaced by its length.

orb_namesobject

Removed argument retained for error reporting. Must be None; otherwise a RuntimeError is raised.

Returns:
int

The (normalized) number of orbitals.