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

tfim_local_array(symmetry[, jx, hz, coordinations, flat])

Build an abelian symmetric local operator for the transverse field

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[, 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.tfim_local_array(symmetry, jx=-1.0, hz=-3.0, coordinations=(1, 1), flat=False)[source]

Build an abelian symmetric local operator for the transverse field Ising model:

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) – The symmetry of the model. Should be “Z2”.

  • jx (float) – The coupling strength for the X-X interactions, by default -1.0.

  • hz (float or tuple[float, float]) – The coupling strength for the Z interactions, by default -3.0. If a tuple is given it should contain the fields for the two sites.

  • coordinations (tuple[int, int], optional) – The coordinations of the two sites, by default (1, 1). The fields are divided by these values to account for double counting.

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

Returns:

The local Hamiltonian term.

Return type:

Z2Array or Z2ArrayFlat

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) – The symmetry of the model. Should be “Z2”.

  • 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, flat=False, **kwargs)[source]

Return a dict of local 2-body Hamiltonian abelian symmetric terms for the Heisenberg 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.

  • 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]