FermionSite¶
full name: tenpy.networks.site.FermionSite
parent module:
tenpy.networks.sitetype: class
Inheritance Diagram

Methods
|
Initialize self. |
|
Add one on-site operators. |
|
Change the charges of the site (in place). |
|
Load instance from a HDF5 file. |
Return the hermitian conjugate of a given operator. |
|
|
Return operator of given name. |
Multiply operator names together. |
|
|
Whether an (composite) onsite operator is fermionic and needs a Jordan-Wigner string. |
|
Remove an added operator. |
|
Rename an added operator. |
|
Export self into a HDF5 file. |
|
Return index of a basis state from its label. |
|
Same as |
Sanity check, raises ValueErrors, if something is wrong. |
|
|
Check whether ‘name’ labels a valid onsite-operator. |
Class Attributes and Properties
Dimension of the local Hilbert space. |
|
Dictionary of on-site operators for iteration. |
-
class
tenpy.networks.site.FermionSite(conserve='N', filling=0.5)[source]¶ Bases:
tenpy.networks.site.SiteCreate a
Sitefor spin-less fermions.Local states are
emptyandfull.Warning
Using the Jordan-Wigner string (
JW) is crucial to get correct results, otherwise you just describe hardcore bosons! Further details in Fermions and the Jordan-Wigner transformation.operator
description
IdIdentity \(\mathbb{1}\)
JWSign for the Jordan-Wigner string.
CAnnihilation operator \(c\) (up to ‘JW’-string left of it)
CdCreation operator \(c^\dagger\) (up to ‘JW’-string left of it)
NNumber operator \(n= c^\dagger c\)
dN\(\delta n := n - filling\)
dNdN\((\delta n)^2\)
conserve
qmod
exluded onsite operators
'N'[1]
–
'parity'[2]
–
None[]
–
- Parameters
-
add_op(name, op, need_JW=False, hc=None)[source]¶ Add one on-site operators.
- Parameters
name (str) – A valid python variable name, used to label the operator. The name under which op is added as attribute to self.
op (np.ndarray |
Array) – A matrix acting on the local hilbert space representing the local operator. Dense numpy arrays are automatically converted toArray. LegCharges have to be[leg, leg.conj()]. We set labels'p', 'p*'.need_JW (bool) – Whether the operator needs a Jordan-Wigner string. If
True, add name toneed_JW_string.hc (None | False | str) – The name for the hermitian conjugate operator, to be used for
hc_ops. By default (None), try to auto-determine it. IfFalse, disable adding antries tohc_ops.
-
change_charge(new_leg_charge=None, permute=None)[source]¶ Change the charges of the site (in place).
- Parameters
new_leg_charge (
LegCharge| None) – The new charges to be used. IfNone, use trivial charges.permute (ndarray | None) – The permuation applied to the physical leg, which gets used to adjust
state_labelsandperm. If you sorted the previous leg withperm_qind, new_leg_charge = leg.sort(), useold_leg.perm_flat_from_perm_qind(perm_qind). Ignored ifNone.
-
property
dim¶ Dimension of the local Hilbert space.
-
classmethod
from_hdf5(hdf5_loader, h5gr, subpath)[source]¶ Load instance from a HDF5 file.
This method reconstructs a class instance from the data saved with
save_hdf5().
-
get_op(name)[source]¶ Return operator of given name.
- Parameters
name (str) – 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
op – The operator given by name, with labels
'p', 'p*'. If name already was an npc Array, it’s directly returned.- Return type
-
multiply_op_names(names)[source]¶ Multiply operator names together.
Join the operator names in names such that get_op returns the product of the corresponding operators.
- Parameters
names (list of str) – List of valid operator labels.
- Returns
combined_opname – A valid operator name Operatorname representing the product of operators in names.
- Return type
-
property
onsite_ops¶ Dictionary of on-site operators for iteration.
Single operators are accessible as attributes.
-
op_needs_JW(name)[source]¶ Whether an (composite) onsite operator is fermionic and needs a Jordan-Wigner string.
-
remove_op(name)[source]¶ Remove an added operator.
- Parameters
name (str) – The name of the operator to be removed.
-
save_hdf5(hdf5_saver, h5gr, subpath)[source]¶ Export self into a HDF5 file.
This method saves all the data it needs to reconstruct self with
from_hdf5().This implementation saves the content of
__dict__withsave_dict_content(), storing the format under the attribute'format'.
-
state_index(label)[source]¶ Return index of a basis state from its label.
- Parameters
label (int | string) – eather the index directly or a label (string) set before.
- Returns
state_index – the index of the basis state associated with the label.
- Return type
-
state_indices(labels)[source]¶ Same as
state_index(), but for multiple labels.