symmray.hamiltonians

Abelian symmetric and fermionic Hamiltonians in terms of local operators.

Functions

make_edge_factory(coeff)

Ensure coeff is a function that takes two sites and returns an edge

make_node_factory(coeff)

Ensure coeff is a function that takes a site and returns a node

ham_tfim_from_edges(symmetry, edges[, jx, hz, flat])

Return a dict of local 2-body Hamiltonian abelian symmetric terms for

ham_heisenberg_from_edges(symmetry, edges[, j, b, flat])

Return a dict of local 2-body Hamiltonian abelian symmetric terms for

ham_fermi_hubbard_from_edges(symmetry, edges[, t, U, ...])

Return a dict of local 2-body Hamiltonian terms for the Fermi-Hubbard

ham_fermi_hubbard_spinless_from_edges(symmetry, edges)

Return a dict of local 2-body Hamiltonian terms for the 'spinless

Module Contents

symmray.hamiltonians.make_edge_factory(coeff)[source]

Ensure coeff is a function that takes two sites and returns an edge coeff.

symmray.hamiltonians.make_node_factory(coeff)[source]

Ensure coeff is a function that takes a site and returns a node coeff.

symmray.hamiltonians.ham_tfim_from_edges(symmetry, edges, jx=-1.0, hz=-3.0, flat=False)[source]

Return a dict of local 2-body Hamiltonian abelian symmetric terms for the transverse field Ising model on the given lattice defined by edges:

H = jx * sum_ij X_i X_j + hz * sum_i Z_i

Note that its rotated into the x-basis so that the Z2 symmetry is manifest.

Parameters:
  • symmetry (str or None) – The symmetry of the model. Should be “Z2”, or None to return raw dense arrays.

  • edges (Sequence[tuple[Hashable, Hashable]]) – A list of edges representing the lattice, each edge is a tuple of two nodes, each node is some hashable label.

  • jx (float, dict, or callable, optional) – The coupling strength for the X-X interactions, by default -1.0. If a dict is given it should map edges to values, if a callable it should take the two sites as input.

  • hz (float, dict or callable, optional) – The coupling strength for the Z interactions, by default -3.0. If a dict is given it should map sites to values, if a callable it should take the site as input.

  • flat (bool, optional) – Whether to return flat arrays, by default False.

Returns:

A dictionary mapping edges to local Hamiltonian terms.

Return type:

dict[tuple[Hashable, Hashable], AbelianArray | AbelianArrayFlat]

symmray.hamiltonians.ham_heisenberg_from_edges(symmetry, edges, j=1.0, b=0.0, flat=False)[source]

Return a dict of local 2-body Hamiltonian abelian symmetric terms for the Heisenberg model on the given lattice defined by edges:

H = sum_ij (jx Sx_i Sx_j + jy Sy_i Sy_j + jz Sz_i Sz_j)
    - sum_i bz Sz_i

where the spin operators are the spin-1/2 operators (eigenvalues +/- 1/2).

Parameters:
  • symmetry (str or None) – The symmetry of the model. Either “Z2” or “U1”, or None to return raw dense arrays. Note “U1” requires the XY couplings to be equal (jx == jy), so that total magnetization is conserved.

  • edges (Sequence[tuple[Hashable, Hashable]]) – A list of edges representing the lattice, each edge is a tuple of two nodes, each node is some hashable label.

  • j (float, tuple, dict, or callable, optional) – The coupling strength, by default 1.0. A tuple is interpreted as the (jx, jy, jz) couplings. If a dict is given it should map edges to values, if a callable it should take the two sites as input.

  • b (float, dict, or callable, optional) – The magnetic field along the z-axis, by default 0.0. If a dict is given it should map sites to values, if a callable it should take the site as input, in either case allowing a different field per site. The field is divided by each site’s coordination to avoid double counting. Only z-fields are supported as transverse fields would not conserve the symmetry.

  • flat (bool, optional) – Whether to return flat arrays, by default False.

Returns:

A dictionary mapping edges to local Hamiltonian terms.

Return type:

dict[tuple[Hashable, Hashable], AbelianArray | AbelianArrayFlat]

symmray.hamiltonians.ham_fermi_hubbard_from_edges(symmetry, edges, t=1.0, U=8.0, mu=0.0, like='numpy', flat=False)[source]

Return a dict of local 2-body Hamiltonian terms for the Fermi-Hubbard model on the given lattice defined by edges. The indices are ordered as (a, b, a’, b’), with the local basis like (|00>, ad+|00>, au+|00>, au+ad+|00>) for site a with up (au) and down (ad) spin respectively and similar for site b.

Parameters:
  • symmetry (str) – The symmetry of the model. Either “Z2”, “U1”, “Z2Z2”, or “U1U1”.

  • edges (Sequence[tuple[Hashable, Hashable]]) – A list of edges representing the lattice, each edge is a tuple of two nodes, each node is some hashable label.

  • t (float, dict or callable, optional) – The hopping parameter, by default 1.0. If a dict is given it should map edges to values, if a callable it should take the two sites as input.

  • U (float dict or callable, optional) – The interaction parameter, by default 8.0. If a dict is given it should map sites to values, if a callable it should take the site as input.

  • mu (float, optional) – The chemical potential, by default 0.0.

  • like (str, optional) – The backend to use, by default “numpy”.

  • flat (bool, optional) – Whether to return flat arrays, by default False.

Returns:

A dictionary mapping edges to local Hamiltonian terms.

Return type:

dict[tuple[Hashable, Hashable], FermionicArray | FermionicArrayFlat]

symmray.hamiltonians.ham_fermi_hubbard_spinless_from_edges(symmetry, edges, t=1.0, V=0.0, mu=0.0, delta=0.0, like='numpy', flat=False)[source]

Return a dict of local 2-body Hamiltonian terms for the ‘spinless Fermi-Hubbard’ or (‘t-V’) model on the given lattice defined by edges. model on the given lattice defined by edges.

Parameters:
  • symmetry (str) – The symmetry of the model. Either “Z2” or “U1”.

  • edges (Sequence[tuple[Hashable, Hashable]]) – A list of edges representing the lattice, each edge is a tuple of two nodes, each node is some hashable label.

  • t (float, optional) – The hopping parameter, by default 1.0.

  • V (float, optional) – The nearest neighbor interaction parameter, by default 0.0.

  • mu (float, optional) – The chemical potential, by default 0.0.

  • delta (float, optional) – The nearest neighbor superconducting pairing parameter, by default 0.0.

  • like (str, optional) – The backend to use, by default “numpy”.

  • flat (bool, optional) – Whether to return flat arrays, by default False.

Returns:

A dictionary mapping edges to local Hamiltonian terms.

Return type:

dict[tuple[Hashable, Hashable], FermionicArray | FermionicArrayFlat]