SpinHalfFermionSite

  • full name: tenpy.networks.site.SpinHalfFermionSite

  • parent module: tenpy.networks.site

  • type: class

class tenpy.networks.site.SpinHalfFermionSite(cons_N='N', cons_Sz='Sz', filling=1.0)[source]

Bases: tenpy.networks.site.Site

Create a Site for spinful (spin-1/2) fermions.

Local states are:

empty (vacuum), up (one spin-up electron), down (one spin-down electron), and full (both electrons)

Local operators can be built from creation operators.

Warning

Using the Jordan-Wigner string (JW) in the correct way is crucial to get correct results, otherwise you just describe hardcore bosons!

operator

description

Id

Identity \(\mathbb{1}\)

JW

Sign for the Jordan-Wigner string \((-1)^{n_{\uparrow}+n_{\downarrow}}\)

JWu

Partial sign for the Jordan-Wigner string \((-1)^{n_{\uparrow}}\)

JWd

Partial sign for the Jordan-Wigner string \((-1)^{n_{\downarrow}}\)

Cu

Annihilation operator spin-up \(c_{\uparrow}\) (up to ‘JW’-string on sites left of it).

Cdu

Creation operator spin-up \(c^\dagger_{\uparrow}\) (up to ‘JW’-string on sites left of it).

Cd

Annihilation operator spin-down \(c_{\downarrow}\) (up to ‘JW’-string on sites left of it). Includes JWu such that it anti-commutes onsite with Cu, Cdu.

Cdd

Creation operator spin-down \(c^\dagger_{\downarrow}\) (up to ‘JW’-string on sites left of it). Includes JWu such that it anti-commutes onsite with Cu, Cdu.

Nu

Number operator \(n_{\uparrow}= c^\dagger_{\uparrow} c_{\uparrow}\)

Nd

Number operator \(n_{\downarrow}= c^\dagger_{\downarrow} c_{\downarrow}\)

NuNd

Dotted number operators \(n_{\uparrow} n_{\downarrow}\)

Ntot

Total number operator \(n_t= n_{\uparrow} + n_{\downarrow}\)

dN

Total number operator compared to the filling \(\Delta n = n_t-filling\)

Sx, Sy, Sz

Spin operators \(S^{x,y,z}\), in particular \(S^z = \frac{1}{2}( n_\uparrow - n_\downarrow )\)

Sp, Sm

Spin flips \(S^{\pm} = S^{x} \pm i S^{y}\), e.g. \(S^{+} = c^\dagger_\uparrow c_\downarrow\)

The spin operators are defined as \(S^\gamma = (c^\dagger_{\uparrow}, c^\dagger_{\downarrow}) \sigma^\gamma (c_{\uparrow}, c_{\downarrow})^T\), where \(\sigma^\gamma\) are spin-1/2 matrices (i.e. half the pauli matrices).

cons_N

cons_Sz

qmod

excluded onsite operators

'N'

'Sz'

[1, 1]

Sx, Sy

'N'

'parity'

[1, 2]

'N'

None

[1]

'parity'

'Sz'

[2, 1]

Sx, Sy

'parity'

'parity'

[2, 2]

'parity'

None

[2]

None

'Sz'

[1]

Sx, Sy

None

'parity'

[2]

None

None

[]

Todo

Check if Jordan-Wigner strings for 4x4 operators are correct.

Parameters
cons_N'N' | 'parity' | None

Whether particle number is conserved, c.f. table above.

cons_Sz'Sz' | 'parity' | None

Whether spin is conserved, c.f. table above.

fillingfloat

Average filling. Used to define dN.

Attributes
cons_N'N' | 'parity' | None

Whether particle number is conserved, c.f. table above.

cons_Sz'Sz' | 'parity' | None

Whether spin is conserved, c.f. table above.

fillingfloat

Average filling. Used to define dN.

Methods

add_op(self, name, op[, need_JW])

Add one on-site operators.

change_charge(self[, new_leg_charge, permute])

Change the charges of the site (in place).

get_op(self, name)

Return operator of given name.

multiply_op_names(self, names)

Multiply operator names together.

op_needs_JW(self, name)

Whether an (composite) onsite operator is fermionic and needs a Jordan-Wigner string.

remove_op(self, name)

Remove an added operator.

rename_op(self, old_name, new_name)

Rename an added operator.

state_index(self, label)

Return index of a basis state from its label.

state_indices(self, labels)

Same as state_index(), but for multiple labels.

test_sanity(self)

Sanity check, raises ValueErrors, if something is wrong.

valid_opname(self, name)

Check whether ‘name’ labels a valid onsite-operator.

add_op(self, name, op, need_JW=False)

Add one on-site operators.

Parameters
namestr

A valid python variable name, used to label the operator. The name under which op is added as attribute to self.

opnp.ndarray | Array

A matrix acting on the local hilbert space representing the local operator. Dense numpy arrays are automatically converted to Array. LegCharges have to be [leg, leg.conj()]. We set labels 'p', 'p*'.

need_JWbool

Whether the operator needs a Jordan-Wigner string. If True, the function adds name to need_JW_string.

change_charge(self, new_leg_charge=None, permute=None)

Change the charges of the site (in place).

Parameters
new_leg_chargeLegCharge | None

The new charges to be used. If None, use trivial charges.

permutendarray | None

The permuation applied to the physical leg, which gets used to adjust state_labels and perm. If you sorted the previous leg with perm_qind, new_leg_charge = leg.sort(), use leg.perm_flat_from_perm_qind(perm_qind). Ignored if None.

property dim

Dimension of the local Hilbert space.

get_op(self, name)

Return operator of given name.

Parameters
namestr

The name of the operator to be returned. In case of multiple operator names separated by whitespace, we multiply them together to a single on-site operator (with the one on the right acting first).

Returns
opnp_conserved

The operator given by name, with labels 'p', 'p*'. If name already was an npc Array, it’s directly returned.

multiply_op_names(self, names)

Multiply operator names together.

Join the operator names in names such that get_op returns the product of the corresponding operators.

Parameters
nameslist of str

List of valid operator labels.

Returns
combined_opnamestr

A valid operator name Operatorname representing the product of operators in names.

property onsite_ops

Dictionary of on-site operators for iteration.

Single operators are accessible as attributes.

op_needs_JW(self, name)

Whether an (composite) onsite operator is fermionic and needs a Jordan-Wigner string.

Parameters
namestr

The name of the operator, as in get_op().

Returns
needs_JWbool

Whether the operator needs a Jordan-Wigner string, judging from need_JW_string.

remove_op(self, name)

Remove an added operator.

Parameters
namestr

The name of the operator to be removed.

rename_op(self, old_name, new_name)

Rename an added operator.

Parameters
old_namestr

The old name of the operator.

new_namestr

The new name of the operator.

state_index(self, label)

Return index of a basis state from its label.

Parameters
labelint | string

eather the index directly or a label (string) set before.

Returns
state_indexint

the index of the basis state associated with the label.

state_indices(self, labels)

Same as state_index(), but for multiple labels.

test_sanity(self)

Sanity check, raises ValueErrors, if something is wrong.

valid_opname(self, name)

Check whether ‘name’ labels a valid onsite-operator.

Parameters
namestr

Label for the operator. Can be multiple operator(labels) separated by whitespace, indicating that they should be multiplied together.

Returns
validbool

True if name is a valid argument to get_op().