DipolarChargeInfo

Inheritance Diagram

Inheritance diagram of tenpy.linalg.charges.DipolarChargeInfo

Methods

DipolarChargeInfo.__init__([mod, names, ...])

DipolarChargeInfo.add(chinfos)

Create a ChargeInfo combining multiple charges.

DipolarChargeInfo.change(chinfo, charge, ...)

Change the qmod of a given charge.

DipolarChargeInfo.check_valid(charges)

Check, if charges has all entries as expected from self.mod.

DipolarChargeInfo.drop(chinfo[, charge])

Remove a charge from a ChargeInfo.

DipolarChargeInfo.from_hdf5(hdf5_loader, ...)

Load instance from a HDF5 file.

DipolarChargeInfo.make_valid([charges])

Take charges modulo self.mod.

DipolarChargeInfo.save_hdf5(hdf5_saver, ...)

Export self into a HDF5 file.

DipolarChargeInfo.shift_charges(charges, dx)

Spatial translation acting on charges.

DipolarChargeInfo.shift_charges_horizontal(...)

Like shift_charges(), but restricted to the first dimension.

DipolarChargeInfo.test_sanity()

Sanity check, raises ValueErrors, if something is wrong.

Class Attributes and Properties

DipolarChargeInfo.mod

Modulo how much each of the charges is taken.

DipolarChargeInfo.qnumber

The number of charges.

DipolarChargeInfo.trivial_shift

class tenpy.linalg.charges.DipolarChargeInfo(mod=[], names=None, charge_idcs=[], dipole_idcs=[], dipole_dims=None)[source]

Bases: ChargeInfo

Version of ChargeInfo that supports dipole conservation.

Assumes that one (or more) of the charges is the dipole moment associated with another charge. This results in non-trivial behavior under spatial translations. See the notes on Dipole Conservation.

Given charges q_i on sites i, the associated local dipole moment is p_i = r_i * q_i, where r_i is the position (or e.g. its x- or y- component) of site i. We take the lattice.order[0] position as the origin where r_i == 0. Since we need integer values for the charges, we can not use the true lattice positions, but rather use the lattice index, which is the dimensionless position of the unit cell in units of the lattice basis vector.

Warning

This means that the position of a site within a unit cell is ignored. This only gives a valid proxy for the physical dipole moment if all sites of the unit cell that may carry charge q_i != 0 are at the same spatial position, e.g. if there is only one site per unit cell.

Warning

The possible mod for the dipole charge is restricted as follows; Consider the n-th dipole charge p specified by dipole_idcs[n], with the underlying charge q specified by charge_idcs[n]. First, if q has qmod_q > 1, i.e. if it is a \(\mathbb{Z}_N\) charge, the dipole moment can at most by conserved module qmod_q, thus qmod_p must divide qmod_q. Second, for the dipole moment along a dipole_dims[n] > 0, e.g. along the circumference of a cylinder, the periodic boundary conditions imply that (at most) the dipole moment modulo L_pbc * e can be conserved, where L_pbc is the length of the periodic direction and e is the “unit” of the original charge q specified by , i.e. the GCD of its charge values. Lastly, if both cases apply, i.e. if qmod_q > 1 and dipole_dims[n] > 0, we can conserve the dipole only modulo gcd(L_pbc * e, qmod_q). If that GCD is one, no non-trivial symmetry remains.

Parameters:
  • mod – Same as for ChargeInfo.

  • names – Same as for ChargeInfo.

  • charge_idcs (list of int) – For every dipole charge, which charge is the original charge q_i.

  • dipole_idcs (list of int) – For every dipole charge, which charge is the local dipole moment p_i.

  • dipole_dims (list of int, optional) – For every dipole charge, which spatial component of the dipole moment is conserved. An entry dim indicates that the r_i as described above are integer coefficients of lattice.basis[dim], i.e. that the dipole moment in that direction is conserved. Defaults to all 0, i.e. x-component of the dipole moment.

_charge_idcs, _dipole_idcs, _dipole_dims

Like parameters of same name

shift_charges(charges, dx)[source]

Spatial translation acting on charges.

Some conserved charges, such as e.g. an electric dipole moment, transform non-trivially under spatial translations. This method defines how the charges transform. See the notes on Dipole Conservation. The base class ChargeInfo only implements a trivial version, that does not change the charges.

As positions are mapped pos -> pos + dx, the charges are mapped:

charges -> shift_charges(charges, dx)
Parameters:
  • charges (2D ndarray of dtype QTYPE) – The charges to map.

  • dx ((dim + 1)D ndarray) – The difference of lattice indices, i.e. dx == lat_idx_before - lat_idx_after == [dx_0, ..., dx_{D-1}, du]. Note that these are integer values in units of the lattice vectors.

Returns:

charges – The mapped charges. Note that

Return type:

2D ndarray of dtype QTYPE

shift_charges_horizontal(charges, dx_0)[source]

Like shift_charges(), but restricted to the first dimension.

The base class ChargeInfo only implements a trivial version, that does not change the charges.

Parameters:
  • charges (2D ndarray of dtype QTYPE) – The charges to map.

  • dx_0 (float) – Number of lattice indices of the translation. Horizontal shift is a general shift by dx=[dx_0] + [0] * dim.

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().

It stores the names under the path "names", and mod as dataset "U1_ZN".

Parameters:
  • hdf5_saver (Hdf5Saver) – Instance of the saving engine.

  • h5gr (:class`Group`) – HDF5 group which is supposed to represent self.

  • subpath (str) – The name of h5gr with a '/' in the end.

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().

The "U1_ZN" dataset is mandatory, 'names' are optional.

Parameters:
  • hdf5_loader (Hdf5Loader) – Instance of the loading engine.

  • h5gr (Group) – HDF5 group which is represent the object to be constructed.

  • subpath (str) – The name of h5gr with a '/' in the end.

Returns:

obj – Newly generated class instance containing the required data.

Return type:

cls

test_sanity()[source]

Sanity check, raises ValueErrors, if something is wrong.

classmethod add(chinfos)[source]

Create a ChargeInfo combining multiple charges.

Parameters:

chinfos (iterable of ChargeInfo) – ChargeInfo instances to be combined into a single one (in the given order).

Returns:

chinfo – ChargeInfo combining all the given charges.

Return type:

ChargeInfo

classmethod change(chinfo, charge, new_qmod, new_name='')[source]

Change the qmod of a given charge.

Parameters:
  • chinfo (ChargeInfo) – The ChargeInfo for which qmod of charge should be changed.

  • new_qmod (int) – The new qmod to be set.

  • new_name (str) – The new name of the charge.

Returns:

chinfo – ChargeInfo where qmod of the specified charge was changed.

Return type:

ChargeInfo

check_valid(charges)[source]

Check, if charges has all entries as expected from self.mod.

Parameters:

charges (2D ndarray QTYPE_t) – Charge values to be checked.

Returns:

res – True, if all 0 <= charges <= self.mod (wherever self.mod != 1)

Return type:

bool

classmethod drop(chinfo, charge=None)[source]

Remove a charge from a ChargeInfo.

Parameters:
  • chinfo (ChargeInfo) – The ChargeInfo from where to drop/remove a charge.

  • charge (int | str) – Number or name of the charge (within chinfo) which is to be dropped. None means dropping all charges.

Returns:

chinfo – ChargeInfo where the specified charge is dropped.

Return type:

ChargeInfo

make_valid(charges=None)[source]

Take charges modulo self.mod.

Parameters:

charges (array_like or None) – 1D or 2D array of charges, last dimension self.qnumber None defaults to trivial charges np.zeros(qnumber, dtype=QTYPE).

Returns:

A copy of charges taken modulo mod, but with x % 1 := x

Return type:

charges

property mod

Modulo how much each of the charges is taken.

Entries are 1 for a \(U(1)\) charge, and N for a \(Z_N\) symmetry.

property qnumber

The number of charges.