Model#
Use the Model
classes to define the system to be calculated.
We provide the Holstein model renormalizer.model.HolsteinModel
and the spin-boson model SpinBosonModel
out of box, yet any arbitrary model
with sum-of-product Hamiltonian
can be constructed by using the most general Model
class.
These classes require BasisSet
and Op
as input.
The Model classes#
- class renormalizer.model.Model(basis: List[BasisSet], ham_terms: List[Op], dipole: Optional[Dict] = None, output_ordering: Optional[List[BasisSet]] = None)[source]#
The most general model that supports any Hamiltonian in sum-of-product form. Base class for
HolsteinModel
andSpinBosonModel
.- Parameters:
basis (
list
ofBasisSet
) – Local basis for each site of the MPS. The order determines the DoF order in the MPS.ham_terms (
list
ofOp
) – Terms of the system Hamiltonian in sum-of-product form. Identities can be omitted in the operators. All terms must be included, without assuming Hermitian or something else.dipole (dict) – Contains the transition dipole matrix element. The key is the dof name.
output_ordering (
list
ofBasisSet
) – The ordering of the local basis for output. Default is the same withbasis
.
- check_operator_terms(terms: List[Op])[source]#
Check and clean operator terms in the input
terms
. Errors will be raised if the type of operator is notOp
or the operator contains DoF not defined inself.basis
. Operators with factor = 0 are discarded.
- get_mpos(key: str, fun: Callable)[source]#
Get MPOs related to the model, such as MPOs to calculate electronic occupations \({a^\dagger_i a_i}\). The purpose of the function is to avoid repeated MPO construction.
- Parameters:
- Returns:
mpos – The required MPOs.
- Return type:
list of
Mpo
- n_dofs#
Number of total DoFs.
- n_edofs#
Number of total electronic DoFs.
- n_vdofs#
Number of total vibrational DoFs.
- nsite#
Number of sites in the MPS/MPO to be constructed. Length of
self.basis
.
- class renormalizer.model.HolsteinModel(mol_list: List[Mol], j_matrix: Union[Quantity, ndarray], scheme: int = 2, periodic: bool = False)[source]#
Interface for convenient Holstein model construction. The Hamiltonian of the Holstein model:
\[\hat H = \sum_{ij} J_{ij} a^\dagger_i a_j + \sum_{i\lambda} \omega_{i\lambda} b^\dagger_{i\lambda} b_{i\lambda} + \sum_{i\lambda} g_{i\lambda} \omega_{i\lambda} a^\dagger_i a_i (b^\dagger_{i\lambda} + b_{i\lambda})\]- Parameters:
mol_list (
list
ofMol
) – Information for the molecules contains in the system. See theMol
class for more details.j_matrix (
np.ndarray
orQuantity
.) – \(J_{ij}\) in the Holstein Hamiltonian. WhenQuantity
is used as input, the system is taken to have homogeneous nearest-neighbour interaction \(J_{ij}=J \delta_{i, j+1} + J \delta_{i, j-1}\). For the boundary condition, see theperiodic
option.scheme (int) –
The scheme of the basis for the model. Historically four numbers are permitted: 1, 2, 3, 4. Now 1, 2 and 3 are equivalent, and the bases are arranged as:
\[[\rm{e}_{0}, \rm{ph}_{0,0}, \rm{ph}_{0,1}, \cdots, \rm{e}_{1}, \rm{ph}_{1,0}, \rm{ph}_{1,1}, \cdots ]\]And when
scheme
is set to 4, all electronic DoF is contained in oneBasisSet
usingBasisMultiElectronVac
and the bases are arranged as:\[[\rm{ph}_{0,0}, \rm{ph}_{0,1}, \cdots, \rm{ph}_{n/2, 0}, \rm{ph}_{n/2, 1}, \cdots, \rm{e}_{0, 1, \cdots, n} \rm{ph}_{n/2+1, 0}, \rm{ph}_{n/2+1, 1}, \cdots]\]periodic (bool) – Whether use periodical boundary condition when constructing
j_matrix
fromQuantity
. Default isFalse
.
- check_operator_terms(terms: List[Op])#
Check and clean operator terms in the input
terms
. Errors will be raised if the type of operator is notOp
or the operator contains DoF not defined inself.basis
. Operators with factor = 0 are discarded.
- get_mpos(key: str, fun: Callable)#
Get MPOs related to the model, such as MPOs to calculate electronic occupations \({a^\dagger_i a_i}\). The purpose of the function is to avoid repeated MPO construction.
- Parameters:
- Returns:
mpos – The required MPOs.
- Return type:
list of
Mpo
- property j_constant#
Extract electronic coupling constant from
self.j_matrix
. Useful in transport model when \(J\) is a constant.. If J is actually not a constant, a value error will be raised.- Returns:
j constant – J constant extracted from
self.j_matrix
.- Return type:
- n_dofs#
Number of total DoFs.
- n_edofs#
Number of total electronic DoFs.
- n_vdofs#
Number of total vibrational DoFs.
- nsite#
Number of sites in the MPS/MPO to be constructed. Length of
self.basis
.
- switch_scheme(scheme: int) HolsteinModel [source]#
Switch the scheme of the current model.
- Parameters:
scheme (int) – The target scheme.
- Returns:
new_model – The new model with the specified scheme.
- Return type:
- class renormalizer.model.SpinBosonModel(epsilon: Quantity, delta: Quantity, ph_list: List[Phonon], dipole: Optional[float] = None)[source]#
Spin-Boson model
\[\hat{H} = \epsilon \sigma_z + \Delta \sigma_x + \frac{1}{2} \sum_i(p_i^2+\omega^2_i q_i^2) + \sigma_z \sum_i c_i q_i\]- check_operator_terms(terms: List[Op])#
Check and clean operator terms in the input
terms
. Errors will be raised if the type of operator is notOp
or the operator contains DoF not defined inself.basis
. Operators with factor = 0 are discarded.
- copy()#
- get_mpos(key: str, fun: Callable)#
Get MPOs related to the model, such as MPOs to calculate electronic occupations \({a^\dagger_i a_i}\). The purpose of the function is to avoid repeated MPO construction.
- Parameters:
- Returns:
mpos – The required MPOs.
- Return type:
list of
Mpo
- n_dofs#
Number of total DoFs.
- n_edofs#
Number of total electronic DoFs.
- n_vdofs#
Number of total vibrational DoFs.
- nsite#
Number of sites in the MPS/MPO to be constructed. Length of
self.basis
.
- class renormalizer.model.TI1DModel(basis: List[BasisSet], local_ham_terms: List[Op], nonlocal_ham_terms: List[Op], ncell: int)[source]#
Translational invariant one dimensional model with periodic boundary condition. The Hamiltonian should take the form:
\[\hat H = \sum_i(\hat h_i + \sum_j \hat h_{i,j})\]where \(\hat h_i\) is the local Hamiltonian acting on one single unit cell and \(\hat h_{i,j}\) represents the \(j\) th interaction between the \(i\) th cell and other unit cells.
Yet doesn’t support setting transition dipoles.
- Parameters:
basis (
list
ofBasisSet
) – Local basis of each site for a single unit cell of the system. The full basis set is constructed by repeating the basisncell
times. To distinguish between different DoFs at different unit cells, the DoF names in the unit cell are transformed to a two-element-tuple of the form("cell0", dof)
, wheredof
is the original DoF name and the"cell0"
indicates the cell ID.local_ham_terms (
list
ofOp
) – Terms of the system local Hamiltonian \(\hat h_i\) in sum-of-product form. DoF names should be consistent with thebasis
argument.nonlocal_ham_terms (
list
ofOp
) – Terms of system nonlocal Hamiltonian \(\hat h_{i,j}\). To indicate the IDs of the unit cells that are involved in the nonlocal interaction, the DoF name inbasis
should be transformed to a two-element-tuple, in which the first element is an integer indicating its distance from \(i\), and the second element is the original DoF name. For example, if one unit cell contains one electron DoF with namee
, a nearest neighbour hopping interaction should take the formOp(r"a^\dagger a", [(0, "e"), (1, "e")])
(with its Hermite conjugation being another term). The definition is not unique in thatOp(r"a^\dagger a", [(1, "e"), (2, "e")])
produces equivalent output.ncell (int) – Number of unit cells in the system.
- check_operator_terms(terms: List[Op])#
Check and clean operator terms in the input
terms
. Errors will be raised if the type of operator is notOp
or the operator contains DoF not defined inself.basis
. Operators with factor = 0 are discarded.
- copy()#
- get_mpos(key: str, fun: Callable)#
Get MPOs related to the model, such as MPOs to calculate electronic occupations \({a^\dagger_i a_i}\). The purpose of the function is to avoid repeated MPO construction.
- Parameters:
- Returns:
mpos – The required MPOs.
- Return type:
list of
Mpo
- n_dofs#
Number of total DoFs.
- n_edofs#
Number of total electronic DoFs.
- n_vdofs#
Number of total vibrational DoFs.
- nsite#
Number of sites in the MPS/MPO to be constructed. Length of
self.basis
.
Basis Functions#
- class renormalizer.model.basis.BasisSet(dof, nbas: int, sigmaqn: List)[source]#
the parent class for local basis set
- Parameters:
dof_name – The name(s) of the DoF(s) contained in the basis set. For basis containing only one DoF, the type could be anything that can be hashed. For basis containing multiple DoFs, the type should be a
list
ortuple
of anything that can be hashed.nbas (int) – number of dimension of the basis set
sigmaqn (List) – the quantum number of each basis. Could be an integer or tuple of integers
- copy(new_dof)[source]#
Return a copy of the basis set with new DoF name specified in the argument.
- Parameters:
new_dof – New DoF name.
- Returns:
new_basis – A copy of the basis with new DoF name.
- Return type:
Basis
- property dofs#
Names of the DoFs contained in the basis. Returns a tuple even if the basis contains only one DoF.
- Returns:
dof names – A tuple of DoF names.
- Return type:
- is_electron = False#
If the basis set represent electronic DoF.
- is_phonon = False#
If the basis set represent vibrational DoF.
- is_spin = False#
If the basis set represent spin DoF.
- multi_dof = False#
If the basis set contains multiple DoFs.
- class renormalizer.model.basis.BasisSHO(dof, omega, nbas, x0=0.0, dvr=False, general_xp_power=False)[source]#
simple harmonic oscillator basis set
- Parameters:
dof – The name of the DoF contained in the basis set. The type could be anything that can be hashed.
omega (float) – the frequency of the oscillator.
nbas (int) – number of dimension of the basis set (highest occupation number of the harmonic oscillator)
x0 (float) – the origin of the harmonic oscillator. Default = 0.
dvr (bool) – whether to use discrete variable representation. Default = False.
general_xp_power (bool) – whether calculate \(x\) and \(x^2\) (or \(p\) and \(p^2\)) through general expression for \(x`power or :math:`p\) power. This is not efficient because \(x\) and \(x^2\) (or \(p\) and \(p^2\)) have been hard-coded already. The option is only used for testing.
- copy(new_dof)[source]#
Return a copy of the basis set with new DoF name specified in the argument.
- Parameters:
new_dof – New DoF name.
- Returns:
new_basis – A copy of the basis with new DoF name.
- Return type:
Basis
- property dofs#
Names of the DoFs contained in the basis. Returns a tuple even if the basis contains only one DoF.
- Returns:
dof names – A tuple of DoF names.
- Return type:
- is_electron = False#
If the basis set represent electronic DoF.
- is_phonon = True#
If the basis set represent vibrational DoF.
- is_spin = False#
If the basis set represent spin DoF.
- multi_dof = False#
If the basis set contains multiple DoFs.
- op_mat(op: Union[Op, str])[source]#
Matrix representation under the basis set of the input operator. The factor is included.
- Parameters:
op (Op) – The operator. For basis set with only one DoF, :class:
str
is also acceptable.- Returns:
mat – Matrix representation of
op
.- Return type:
np.ndarray
- sigmaqn: ndarray#
- class renormalizer.model.basis.BasisHopsBoson(dof, nbas)[source]#
Bosonic like basis but with uncommon ladder operator, used in Hierarchy of Pure States method
\[\begin{split}\tilde{b}^\dagger | n \rangle = (n+1) | n+1\rangle \\ \tilde{b} | n \rangle = | n-1\rangle\end{split}\]- Parameters:
dof – The name of the DoF contained in the basis set. The type could be anything that can be hashed.
nbas (int) – number of dimension of the basis set (the highest occupation number)
- copy(new_dof)[source]#
Return a copy of the basis set with new DoF name specified in the argument.
- Parameters:
new_dof – New DoF name.
- Returns:
new_basis – A copy of the basis with new DoF name.
- Return type:
Basis
- property dofs#
Names of the DoFs contained in the basis. Returns a tuple even if the basis contains only one DoF.
- Returns:
dof names – A tuple of DoF names.
- Return type:
- is_electron = False#
If the basis set represent electronic DoF.
- is_phonon = True#
If the basis set represent vibrational DoF.
- is_spin = False#
If the basis set represent spin DoF.
- multi_dof = False#
If the basis set contains multiple DoFs.
- op_mat(op: Union[Op, str])[source]#
Matrix representation under the basis set of the input operator. The factor is included.
- Parameters:
op (Op) – The operator. For basis set with only one DoF, :class:
str
is also acceptable.- Returns:
mat – Matrix representation of
op
.- Return type:
np.ndarray
- sigmaqn: ndarray#
- class renormalizer.model.basis.BasisSineDVR(dof, nbas, xi, xf, endpoint=False, quadrature=False, dvr=False)[source]#
Sine DVR basis (particle-in-a-box) for vibrational, angular, and dissociative modes. See Phys. Rep. 324, 1–105 (2000).
\[\psi_j(x) = \sqrt{\frac{2}{L}} \sin(j\pi(x-x_0)/L) \, \textrm{for} \, x_0 \le x \le x_{N+1}, L = x_{N+1} - x_0\]the grid points are at
\[x_\alpha = x_0 + \alpha \frac{L}{N+1}\]- Operators supported:
- \[I, x, x^1, x^2, x^\textrm{moment}, dx, dx^2, p, p^2, x dx, x^2 p^2, x^2 dx, x p^2, x^3 p^2\]
- Parameters:
dof (str, int) – The name of the DoF contained in the basis set. The type could be anything that can be hashed.
nbas (int) – Number of grid points.
xi (float) – The leftmost grid point of the coordinate.
xf (float) – The rightmost grid point of the coordinate.
endpoint (bool, optional) – If
endpoint=False
, \(x_0=x_i, x_{N+1}=x_f\); otherwise \(x_1=x_i, x_{N}=x_f\).
- copy(new_dof)[source]#
Return a copy of the basis set with new DoF name specified in the argument.
- Parameters:
new_dof – New DoF name.
- Returns:
new_basis – A copy of the basis with new DoF name.
- Return type:
Basis
- property dofs#
Names of the DoFs contained in the basis. Returns a tuple even if the basis contains only one DoF.
- Returns:
dof names – A tuple of DoF names.
- Return type:
- property eigenfunc#
- is_electron = False#
If the basis set represent electronic DoF.
- is_phonon = True#
If the basis set represent vibrational DoF.
- is_spin = False#
If the basis set represent spin DoF.
- multi_dof = False#
If the basis set contains multiple DoFs.
- op_mat(op: Union[Op, str])[source]#
Matrix representation under the basis set of the input operator. The factor is included.
- Parameters:
op (Op) – The operator. For basis set with only one DoF, :class:
str
is also acceptable.- Returns:
mat – Matrix representation of
op
.- Return type:
np.ndarray
- sigmaqn: ndarray#
- class renormalizer.model.basis.BasisSimpleElectron(dof, sigmaqn=None)[source]#
The basis set for simple electron DoF, two state with 0: unoccupied, 1: occupied
- Parameters:
dof (any hashable object) – The name of the DoF contained in the basis set.
Examples
>>> b = BasisSimpleElectron(0) >>> b BasisSimpleElectron(dof: 0, nbas: 2, qn: [[0], [1]]) >>> b.op_mat(r"a^\dagger") array([[0., 0.], [1., 0.]])
- copy(new_dof)[source]#
Return a copy of the basis set with new DoF name specified in the argument.
- Parameters:
new_dof – New DoF name.
- Returns:
new_basis – A copy of the basis with new DoF name.
- Return type:
Basis
- property dofs#
Names of the DoFs contained in the basis. Returns a tuple even if the basis contains only one DoF.
- Returns:
dof names – A tuple of DoF names.
- Return type:
- is_electron = True#
If the basis set represent electronic DoF.
- is_phonon = False#
If the basis set represent vibrational DoF.
- is_spin = False#
If the basis set represent spin DoF.
- multi_dof = False#
If the basis set contains multiple DoFs.
- op_mat(op)[source]#
Matrix representation under the basis set of the input operator. The factor is included.
- Parameters:
op (Op) – The operator. For basis set with only one DoF, :class:
str
is also acceptable.- Returns:
mat – Matrix representation of
op
.- Return type:
np.ndarray
- sigmaqn: ndarray#
- class renormalizer.model.basis.BasisMultiElectron(dof, sigmaqn: List)[source]#
The basis set for multi electronic state on one single site, The basis order is [dof_names[0], dof_names[1], dof_names[2], …].
- Parameters:
- copy(new_dof)[source]#
Return a copy of the basis set with new DoF name specified in the argument.
- Parameters:
new_dof – New DoF name.
- Returns:
new_basis – A copy of the basis with new DoF name.
- Return type:
Basis
- property dofs#
Names of the DoFs contained in the basis. Returns a tuple even if the basis contains only one DoF.
- Returns:
dof names – A tuple of DoF names.
- Return type:
- is_electron = True#
If the basis set represent electronic DoF.
- is_phonon = False#
If the basis set represent vibrational DoF.
- is_spin = False#
If the basis set represent spin DoF.
- multi_dof = True#
If the basis set contains multiple DoFs.
- op_mat(op: Op)[source]#
Matrix representation under the basis set of the input operator. The factor is included.
- Parameters:
op (Op) – The operator. For basis set with only one DoF, :class:
str
is also acceptable.- Returns:
mat – Matrix representation of
op
.- Return type:
np.ndarray
- sigmaqn: ndarray#
- class renormalizer.model.basis.BasisMultiElectronVac(dof)[source]#
Another basis set for multi electronic state on one single site. Vacuum state is included. The basis order is [vacuum, dof_names[0], dof_names[1],…]. sigma qn is [0, 1, 1, 1, …]
- Parameters:
dof (a
list
ortuple
of hashable objects.) – The names of the DoFs contained in the basis set.
- copy(new_dof)[source]#
Return a copy of the basis set with new DoF name specified in the argument.
- Parameters:
new_dof – New DoF name.
- Returns:
new_basis – A copy of the basis with new DoF name.
- Return type:
Basis
- property dofs#
Names of the DoFs contained in the basis. Returns a tuple even if the basis contains only one DoF.
- Returns:
dof names – A tuple of DoF names.
- Return type:
- is_electron = True#
If the basis set represent electronic DoF.
- is_phonon = False#
If the basis set represent vibrational DoF.
- is_spin = False#
If the basis set represent spin DoF.
- multi_dof = True#
If the basis set contains multiple DoFs.
- op_mat(op: Op)[source]#
Matrix representation under the basis set of the input operator. The factor is included.
- Parameters:
op (Op) – The operator. For basis set with only one DoF, :class:
str
is also acceptable.- Returns:
mat – Matrix representation of
op
.- Return type:
np.ndarray
- sigmaqn: ndarray#
- class renormalizer.model.basis.BasisHalfSpin(dof, sigmaqn: Optional[List] = None)[source]#
The basis the for 1/2 spin DoF
- Parameters:
Examples
>>> b = BasisHalfSpin(0) >>> b BasisHalfSpin(dof: 0, nbas: 2) >>> b.op_mat("X") array([[0., 1.], [1., 0.]]) >>> -1 * b.op_mat("iY") @ b.op_mat("iY") # convenient for real Hamiltonian array([[1., 0.], [0., 1.]])
- copy(new_dof)[source]#
Return a copy of the basis set with new DoF name specified in the argument.
- Parameters:
new_dof – New DoF name.
- Returns:
new_basis – A copy of the basis with new DoF name.
- Return type:
Basis
- property dofs#
Names of the DoFs contained in the basis. Returns a tuple even if the basis contains only one DoF.
- Returns:
dof names – A tuple of DoF names.
- Return type:
- is_electron = False#
If the basis set represent electronic DoF.
- is_phonon = False#
If the basis set represent vibrational DoF.
- is_spin = True#
If the basis set represent spin DoF.
- multi_dof = False#
If the basis set contains multiple DoFs.
- op_mat(op: Union[Op, str])[source]#
Matrix representation under the basis set of the input operator. The factor is included.
- Parameters:
op (Op) – The operator. For basis set with only one DoF, :class:
str
is also acceptable.- Returns:
mat – Matrix representation of
op
.- Return type:
np.ndarray
- sigmaqn: ndarray#
The Operator Class#
- class renormalizer.model.Op(symbol: str, dof, factor: Union[float, Quantity] = 1.0, qn: Optional[Union[List, int]] = None)[source]#
The operator class. The class can be considered as a symbolic way to express quantum operator such as \(a^\dagger_i a_j\), \(b^\dagger_i + b_i\) or \(g \omega a^\dagger_i a_i (b^\dagger_{ij} + b_{ij})\). Additions and multiplications between operators are supported.
- Parameters:
symbol (str) – The string of the operator, such as
"a"
,"a^\dagger a"
andr"b^\dagger + b"
. The supported operators are defined inBasisSet
. For complex symbols consisting of multiplication of simple symbols, separate the simple symbols with a single space.dof (hashable object or
list
of hashable objects.) – The name of the DoF related to the operator. For simple symbol such as"a"
, the type could be any hashable object.int
,str
andtuple
of them are recommended types fordof
. For complex symbol such as"a^\dagger a"
, the type should be a list of hashable objects, with each element representing one of the simple symbol contained in the complex symbol. Using a single hashable object is also supported for complex symbol, in which case every symbol is assumed to share the same DoF name.factor (
float
orcomplex
orQuantity
) – The prefactor of the operator.qn (
int
orlist
ofint
orlist
of containers ofint
.) – The quantum number of the symbol. For simple symbol theqn
should be anint
. For complex symbol quantum number of each simple symbol contained in the complex symbol should be provided in alist
. Ifqn
is set toNone
, then the quantum number for every symbol is set to 0 except for``”a^dagger”`` and"a"
, whose quantum number are set to 1 and -1 respectively. For multiple quantum numberslist
of containers ofint
should be provided without any abbreviation.
Notes
Symbols connected by plus
"+"
such asr"b^\dagger + b"
is considered as a simple symbol, because this class is designed to deal with operator multiplication rather than addition.Warning
If you wish to specify the DoF of each symbol in a complex symbol, you should use a
list
instead oftuple
. Because in the latter case thetuple
is recognized as a single DoF and the DoFs of all simple symbols are set to thetuple
.Examples
>>> from renormalizer.model import Op >>> Op(r"a^\dagger a", ['site0', "site1"], 2., qn=[1, -1]) Op('a^\\dagger a', ['site0', 'site1'], 2.0, [[1], [-1]]) >>> x = Op("X", 0, 0.5) >>> 3 * x Op('X', [0], 1.5) >>> y = Op("Y", 1, 0.2) >>> x + y [Op('X', [0], 0.5), Op('Y', [1], 0.2)] >>> x - y [Op('X', [0], 0.5), Op('Y', [1], -0.2)] >>> x * y Op('X Y', [0, 1], 0.1) >>> x * (x + y) [Op('X X', [0, 0], 0.25), Op('X Y', [0, 1], 0.1)] >>> (y + x) * x [Op('Y X', [1, 0], 0.1), Op('X X', [0, 0], 0.25)] >>> (y + x) * (x + y) [Op('Y X', [1, 0], 0.1), Op('Y Y', [1, 1], 0.04000000000000001), Op('X X', [0, 0], 0.25), Op('X Y', [0, 1], 0.1)]
- property factor#
The factor of the operator.
- property is_identity: bool#
Whether the operator is the identity operator. Note the factor is not taken into account.
- classmethod product(op_list: List[Op])[source]#
Construct a new operator as a multiplication product of operators.
- property qn: ndarray#
Total quantum number of the operator. Sum of
self.qn_list
. Quantum number of"a^\dagger"
and"a"
is taken to be 1 and -1 if not specified.
- same_term(other) bool [source]#
Judge whether two operators are the same term and can be added together.
- Parameters:
other (Op) – The other operator to compare
- Returns:
result – Whether the two terms
- Return type:
Examples
>>> from renormalizer.model import Op >>> op1 = Op("X", 0, 0.1) >>> op2 = Op("X", 0, 0.2) >>> op1.same_term(op2) True >>> op3 = Op("Y", 1) >>> op1.same_term(op3) False
- split_elementary(dof_to_siteidx) Tuple[List[Op], Union[float, complex]] [source]#
Construct elementary operators according to site index. “elementary operator” means that in the operator every DoF is on the same MPS site.
- Parameters:
dof_to_siteidx (dict) – Mapping from DoF name to MPS site index.
- Returns:
Examples
>>> from renormalizer.model import Op >>> op = Op("X Y", [3, 2], 0.5) * Op("Y X", [2, 3], 3.0) * Op("Z Z", [2, 2], 1.0) >>> op.split_elementary({2:0, 3:1}) ([Op('Y Y Z Z', [2, 2, 2, 2], 1.0), Op('X X', [3, 3], 1.0)], 1.5)
- squeeze_identity()[source]#
Remove all the identity terms in
Op
.- Returns:
op – The operator with identity term removed
- Return type:
Examples
>>> from renormalizer.model import Op >>> op = Op("X I Y I", [0, 1, 2, 3], 0.5) >>> op.squeeze_identity() Op('X Y', [0, 2], 0.5) >>> op = Op("I", 0, -0.5) >>> op.squeeze_identity() Op('I', [0], -0.5)