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
HolsteinModelandSpinBosonModel.- Parameters:
basis (
listofBasisSet) – Local basis for each site of the MPS. The order determines the DoF order in the MPS.ham_terms (
listofOp) – 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 (
listofBasisSet) – 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. RavelsOpSumintoterms. Errors will be raised if the type of operator is notOpor 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 (
listofMol) – Information for the molecules contains in the system. See theMolclass for more details.j_matrix (
np.ndarrayorQuantity.) – \(J_{ij}\) in the Holstein Hamiltonian. WhenQuantityis 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 theperiodicoption.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
schemeis set to 4, all electronic DoF is contained in oneBasisSetusingBasisMultiElectronVacand 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_matrixfromQuantity. Default isFalse.
- check_operator_terms(terms: List[Op])#
Check and clean operator terms in the input
terms. RavelsOpSumintoterms. Errors will be raised if the type of operator is notOpor 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. RavelsOpSumintoterms. Errors will be raised if the type of operator is notOpor 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 (
listofBasisSet) – Local basis of each site for a single unit cell of the system. The full basis set is constructed by repeating the basisncelltimes. 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), wheredofis the original DoF name and the"cell0"indicates the cell ID.local_ham_terms (
listofOp) – Terms of the system local Hamiltonian \(\hat h_i\) in sum-of-product form. DoF names should be consistent with thebasisargument.nonlocal_ham_terms (
listofOp) – 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 inbasisshould 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. RavelsOpSumintoterms. Errors will be raised if the type of operator is notOpor 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
listortupleof anything that can be hashed.nbas (int) – number of dimension of the basis set
sigmaqn (List) – the quantum number of each basis. The length of the list should be the same as
nbas. Each element of the list should be an integer or a 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:
Examples
>>> # Single DoF basis >>> basis_sho = BasisSHO("v", 1.0, 10) >>> basis_sho.dofs ('v',)
>>> # Multi-electron basis >>> basis_me = BasisMultiElectron(["S0", "S1", "S2"], sigmaqn=[0, 0, 0]) >>> basis_me.dofs ('S0', 'S1', 'S2')
>>> # Multi-electron vacuum basis >>> basis_me_vac = BasisMultiElectronVac(["S0", "S1"]) >>> basis_me_vac.dofs ('S0', 'S1')
>>> # Simple electron basis >>> basis_se = BasisSimpleElectron("e") >>> basis_se.dofs ('e',)
>>> # Half-spin basis >>> basis_spin = BasisHalfSpin("spin") >>> basis_spin.dofs ('spin',)
Notes
For single DoF bases (BasisSHO, BasisSineDVR, BasisSimpleElectron, BasisHalfSpin), this returns a 1-element tuple containing the DoF name
For multi-DoF bases (BasisMultiElectron, BasisMultiElectronVac), this returns a tuple of all electronic state names
The returned tuple can be used as keys in condition dictionaries for Mps.hartree_product_state
- 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, scale_omega: bool = 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.
scale_omega (bool) – whether scale the frequency into \(x\) and \(p\). If not scaled, the SHO Hamiltonian is written as \(p^2/2 + 1/2\omega^2 x^2\). If scaled, \(x\) and \(p\) become dimensionless, and the SHO Hamiltonian becomes \(\omega/2(p^2 + x^2)\).
- 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:
Examples
>>> # Single DoF basis >>> basis_sho = BasisSHO("v", 1.0, 10) >>> basis_sho.dofs ('v',)
>>> # Multi-electron basis >>> basis_me = BasisMultiElectron(["S0", "S1", "S2"], sigmaqn=[0, 0, 0]) >>> basis_me.dofs ('S0', 'S1', 'S2')
>>> # Multi-electron vacuum basis >>> basis_me_vac = BasisMultiElectronVac(["S0", "S1"]) >>> basis_me_vac.dofs ('S0', 'S1')
>>> # Simple electron basis >>> basis_se = BasisSimpleElectron("e") >>> basis_se.dofs ('e',)
>>> # Half-spin basis >>> basis_spin = BasisHalfSpin("spin") >>> basis_spin.dofs ('spin',)
Notes
For single DoF bases (BasisSHO, BasisSineDVR, BasisSimpleElectron, BasisHalfSpin), this returns a 1-element tuple containing the DoF name
For multi-DoF bases (BasisMultiElectron, BasisMultiElectronVac), this returns a tuple of all electronic state names
The returned tuple can be used as keys in condition dictionaries for Mps.hartree_product_state
- 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:
stris 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:
Examples
>>> # Single DoF basis >>> basis_sho = BasisSHO("v", 1.0, 10) >>> basis_sho.dofs ('v',)
>>> # Multi-electron basis >>> basis_me = BasisMultiElectron(["S0", "S1", "S2"], sigmaqn=[0, 0, 0]) >>> basis_me.dofs ('S0', 'S1', 'S2')
>>> # Multi-electron vacuum basis >>> basis_me_vac = BasisMultiElectronVac(["S0", "S1"]) >>> basis_me_vac.dofs ('S0', 'S1')
>>> # Simple electron basis >>> basis_se = BasisSimpleElectron("e") >>> basis_se.dofs ('e',)
>>> # Half-spin basis >>> basis_spin = BasisHalfSpin("spin") >>> basis_spin.dofs ('spin',)
Notes
For single DoF bases (BasisSHO, BasisSineDVR, BasisSimpleElectron, BasisHalfSpin), this returns a 1-element tuple containing the DoF name
For multi-DoF bases (BasisMultiElectron, BasisMultiElectronVac), this returns a tuple of all electronic state names
The returned tuple can be used as keys in condition dictionaries for Mps.hartree_product_state
- 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:
stris 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 and dissociative modes with fixed boundary conditions. The wavefunction is zero at the boundaries, making it suitable for systems where the particle is confined to a finite region. For torsional modes or angular motion with periodic boundary conditions, use exponential DVR.
Important: This basis uses fixed boundary conditions (wavefunction goes to zero at boundaries) and is NOT suitable for periodic systems like torsional modes. For periodic boundary conditions, use a different basis.
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\]
Useful attributes include
self.L(the box length),self.dvr_x(the grid points).- 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\).quadrature (bool, optional.) – Whether calculate unimplemented operators numerically. Experimental. Defaults to False.
dvr (bool, optional.) – Whether enable DVR (\(x\) eigenbasis). Defaults to False.
- 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:
Examples
>>> # Single DoF basis >>> basis_sho = BasisSHO("v", 1.0, 10) >>> basis_sho.dofs ('v',)
>>> # Multi-electron basis >>> basis_me = BasisMultiElectron(["S0", "S1", "S2"], sigmaqn=[0, 0, 0]) >>> basis_me.dofs ('S0', 'S1', 'S2')
>>> # Multi-electron vacuum basis >>> basis_me_vac = BasisMultiElectronVac(["S0", "S1"]) >>> basis_me_vac.dofs ('S0', 'S1')
>>> # Simple electron basis >>> basis_se = BasisSimpleElectron("e") >>> basis_se.dofs ('e',)
>>> # Half-spin basis >>> basis_spin = BasisHalfSpin("spin") >>> basis_spin.dofs ('spin',)
Notes
For single DoF bases (BasisSHO, BasisSineDVR, BasisSimpleElectron, BasisHalfSpin), this returns a 1-element tuple containing the DoF name
For multi-DoF bases (BasisMultiElectron, BasisMultiElectronVac), this returns a tuple of all electronic state names
The returned tuple can be used as keys in condition dictionaries for Mps.hartree_product_state
- 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:
stris 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:
Examples
>>> # Single DoF basis >>> basis_sho = BasisSHO("v", 1.0, 10) >>> basis_sho.dofs ('v',)
>>> # Multi-electron basis >>> basis_me = BasisMultiElectron(["S0", "S1", "S2"], sigmaqn=[0, 0, 0]) >>> basis_me.dofs ('S0', 'S1', 'S2')
>>> # Multi-electron vacuum basis >>> basis_me_vac = BasisMultiElectronVac(["S0", "S1"]) >>> basis_me_vac.dofs ('S0', 'S1')
>>> # Simple electron basis >>> basis_se = BasisSimpleElectron("e") >>> basis_se.dofs ('e',)
>>> # Half-spin basis >>> basis_spin = BasisHalfSpin("spin") >>> basis_spin.dofs ('spin',)
Notes
For single DoF bases (BasisSHO, BasisSineDVR, BasisSimpleElectron, BasisHalfSpin), this returns a 1-element tuple containing the DoF name
For multi-DoF bases (BasisMultiElectron, BasisMultiElectronVac), this returns a tuple of all electronic state names
The returned tuple can be used as keys in condition dictionaries for Mps.hartree_product_state
- 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:
stris 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 multiple electronic states on a single site. The basis order is [dof_names[0], dof_names[1], dof_names[2], …].
- Parameters:
dof (list or tuple of hashable objects) – The names of the electronic states. Each element represents a different electronic state (e.g., ground state, first excited state, etc.) on the same site.
sigmaqn (list of int or list of containers of int) – The quantum number(s) for each basis state. The length must match the number of electronic states. Each element can be an integer or a tuple of integers representing the quantum numbers. Set all to 0 if quantum numbers are not needed.
Notes
The parameter name
dofcan be misleading. In this context, it refers to different electronic states within the same physical degree of freedom (site), not different physical degrees of freedom.Important: When using with
hartree_product_state(), the condition dictionary should use ANY ONE of the DoF names as the key to specify the state of the entire basis. For example, for a basis with dof_names = [“S0”, “S1”, “S2”], you can use: -{"S0": 0}to put the system in the S0 state -{"S1": 1}to put the system in the S1 state -{"S2": 2}to put the system in the S2 state The key can be ANY of the DoF names: “S0”, “S1”, or “S2” - they all refer to the same basisExamples
>>> # Create a basis with three electronic states (S0, S1, S2) with quantum numbers disabled >>> b = BasisMultiElectron(["S0", "S1", "S2"], sigmaqn=[0, 0, 0]) >>> b BasisMultiElectron(dof: ['S0', 'S1', 'S2'], nbas: 3) >>> b.dofs ('S0', 'S1', 'S2') >>> from renormalizer import Op >>> # Create an operator that transfers from S0 to S1 >>> b.op_mat(Op("a^\dagger a", ["S0", "S1"])) array([[0., 1., 0.], [0., 0., 0.], [0., 0., 0.]]) >>> # Create an operator for the number operator on S2 >>> b.op_mat(Op("a^\dagger a", "S2")) array([[0., 0., 0.], [0., 0., 0.], [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:
Examples
>>> # Single DoF basis >>> basis_sho = BasisSHO("v", 1.0, 10) >>> basis_sho.dofs ('v',)
>>> # Multi-electron basis >>> basis_me = BasisMultiElectron(["S0", "S1", "S2"], sigmaqn=[0, 0, 0]) >>> basis_me.dofs ('S0', 'S1', 'S2')
>>> # Multi-electron vacuum basis >>> basis_me_vac = BasisMultiElectronVac(["S0", "S1"]) >>> basis_me_vac.dofs ('S0', 'S1')
>>> # Simple electron basis >>> basis_se = BasisSimpleElectron("e") >>> basis_se.dofs ('e',)
>>> # Half-spin basis >>> basis_spin = BasisHalfSpin("spin") >>> basis_spin.dofs ('spin',)
Notes
For single DoF bases (BasisSHO, BasisSineDVR, BasisSimpleElectron, BasisHalfSpin), this returns a 1-element tuple containing the DoF name
For multi-DoF bases (BasisMultiElectron, BasisMultiElectronVac), this returns a tuple of all electronic state names
The returned tuple can be used as keys in condition dictionaries for Mps.hartree_product_state
- 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:
stris 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
listortupleof hashable objects.) – The names of the DoFs contained in the basis set.
Notes
Important: When using with
hartree_product_state(), the condition dictionary should use ANY ONE of the DoF names as the key to specify the state of the entire basis. For example, for a basis with dof_names = [“S0”, “S1”], you can use: -{"S0": 0}to put the system in the vacuum state -{"S1": 1}to put the system in the S0 state -{"S0": 2}to put the system in the S1 state The key can be ANY of the DoF names: “S0”, “S1”, or “S2” - they all refer to the same basis.- 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:
Examples
>>> # Single DoF basis >>> basis_sho = BasisSHO("v", 1.0, 10) >>> basis_sho.dofs ('v',)
>>> # Multi-electron basis >>> basis_me = BasisMultiElectron(["S0", "S1", "S2"], sigmaqn=[0, 0, 0]) >>> basis_me.dofs ('S0', 'S1', 'S2')
>>> # Multi-electron vacuum basis >>> basis_me_vac = BasisMultiElectronVac(["S0", "S1"]) >>> basis_me_vac.dofs ('S0', 'S1')
>>> # Simple electron basis >>> basis_se = BasisSimpleElectron("e") >>> basis_se.dofs ('e',)
>>> # Half-spin basis >>> basis_spin = BasisHalfSpin("spin") >>> basis_spin.dofs ('spin',)
Notes
For single DoF bases (BasisSHO, BasisSineDVR, BasisSimpleElectron, BasisHalfSpin), this returns a 1-element tuple containing the DoF name
For multi-DoF bases (BasisMultiElectron, BasisMultiElectronVac), this returns a tuple of all electronic state names
The returned tuple can be used as keys in condition dictionaries for Mps.hartree_product_state
- 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:
stris 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:
Examples
>>> # Single DoF basis >>> basis_sho = BasisSHO("v", 1.0, 10) >>> basis_sho.dofs ('v',)
>>> # Multi-electron basis >>> basis_me = BasisMultiElectron(["S0", "S1", "S2"], sigmaqn=[0, 0, 0]) >>> basis_me.dofs ('S0', 'S1', 'S2')
>>> # Multi-electron vacuum basis >>> basis_me_vac = BasisMultiElectronVac(["S0", "S1"]) >>> basis_me_vac.dofs ('S0', 'S1')
>>> # Simple electron basis >>> basis_se = BasisSimpleElectron("e") >>> basis_se.dofs ('e',)
>>> # Half-spin basis >>> basis_spin = BasisHalfSpin("spin") >>> basis_spin.dofs ('spin',)
Notes
For single DoF bases (BasisSHO, BasisSineDVR, BasisSimpleElectron, BasisHalfSpin), this returns a 1-element tuple containing the DoF name
For multi-DoF bases (BasisMultiElectron, BasisMultiElectronVac), this returns a tuple of all electronic state names
The returned tuple can be used as keys in condition dictionaries for Mps.hartree_product_state
- 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:
stris 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
listof 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,strandtupleof 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 (
floatorcomplexorQuantity) – The prefactor of the operator.qn (
intorlistofintorlistof containers ofint.) – The quantum number of the symbol. For simple symbol theqnshould be anint. For complex symbol quantum number of each simple symbol contained in the complex symbol should be provided in alist. Ifqnis 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 numberslistof containers ofintshould 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
listinstead oftuple. Because in the latter case thetupleis recognized as a single DoF and the DoFs of all simple symbols are set to thetuple.Examples
>>> from renormalizer.model import Op >>> 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)] >>> Op(r"a^\dagger a", ['site0', "site1"], 2., qn=[1, -1]) # off-diagonal hopping operator Op('a^\\dagger a', ['site0', 'site1'], 2.0, [[1], [-1]]) >>> Op(r"a^\dagger a", 'site0', 2., qn=[1, -1]) # diagonal occupation operator Op('a^\\dagger a', ['site0', 'site0'], 2.0, [[1], [-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)