Welcome to PyBlock’s documentation!¶
DMRG Theoretical Aspects¶
DMRG Quantum Chemistry Hamiltonian in Spatial Orbitals¶
Hamiltonian¶
The quantum chemistry Hamiltonian is written as follows
where
Note that here the order of \(ijkl\) is the same as that in FCIDUMP
(chemist’s notation \([ij|kl]\)).
Partitioning in Spatial Orbitals¶
The partitioning of Hamiltonian in left (\(L\)) and right (\(R\)) blocks is given by
where the normal and complementary operators are defined by
Note that we need to move all on-site interaction into local Hamiltonian, so that when construction interaction terms in Hamiltonian, operators anticommute (without giving extra constant terms).
Derivation¶
First consider one-electron term. \(ij\) indices have only two possibilities: \(i\) left, \(j\) right, or \(i\) right, \(j\) left. Index \(i\) must be associated with creation operator. So the second case is the Hermitian conjugate of the first case. Namely,
Next consider one of \(ijkl\) in left, and three of them in right. These terms are
where the terms in bracket equal to first and third terms in left-hand-side. Outside the bracket are second, forth terms.
The conjugate of third term in rhs is second term in rhs
The conjugate of forth term in rhs is first term in rhs
Therefore, using \(v_{ijkl} = v_{klij}\)
Next consider the two creation operators together in left or in together in right. There are two cases. The second case is the conjugate of the first case, namely,
This explains the \(\hat{A}\hat{P}\) term. The last situation is, one creation in left and one creation in right. Note that when exchange two elementary operators, one creation and one annihilation, one in left and one in right, they must anticommute.
where the first, forth terms are combing different spins. The second, third terms are for the same spin. First consider the same-spin case
For the different-spin case,
Normal/Complementary Partitioning¶
The above version is used when left block is short in length. Note that all terms should be written in a way that operators for particles in left block should appear in the left side of operator string, and operators for particles in right block should appear in the right side of operator string. To write the Hermitian conjugate explicitly, we have
Note that no minus sign for Hermitian conjugate terms with \(A, P\) because these are not Fermion operators.
Also note that
Define
we have
With this normal/complementary partitioning, the operators required in left block are
The operators required in right block are
Assuming that there are \(K\) sites in total, and \(K_L/K_R\) sites in left/right block (optimally, \(K_L \le K_R\)), the total number of operators (and also the number of terms in Hamiltonian with partition) in left or right block is
Complementary/Normal Partitioning¶
Now the operators required in left block are
The operators required in right block are
The total number of operators (and also the number of terms in Hamiltonian with partition) in left or right block is
Blocking¶
The enlarged left/right block is denoted as \(L*/R*\). Make sure that all \(L\) operators are to the left of \(*\) operators.
Now there are two possibilities. In NC partition, in \(L\) we have \(A,A^\dagger, B, B'\) and in \(*\) we have \(P,P^\dagger,Q, Q'\). In CN partition, the opposite is true. Therefore, we have
Similarly,
Number of terms
Blocking of other complementary operators is straightforward
and
and
Middle-Site Transformation¶
When the sweep is performed from left to right, passing the middle site, we need to switch from NC partition to CN partition. The cost is \(O(K^4/16)\). This happens only once in the sweep. The cost of one blocking procedure is \(O(K_<^2K_>)\), but there are \(K\) blocking steps in one sweep. So the cost for blocking in one sweep is \(O(KK_<^2K_>)\). Note that the most expensive part in the program should be the Hamiltonian step in Davidson, which scales as \(O(K_<^2)\).
DMRG Quantum Chemistry Hamiltonian in Unrestricted Spatial Orbitals¶
Hamiltonian¶
The quantum chemistry Hamiltonian is written as follows
where
Note that here the order of \(ijkl\) is the same as that in FCIDUMP
(chemist’s notation \([ij|kl]\)).
Partitioning in Spatial Orbitals¶
The partitioning of Hamiltonian in left (\(L\)) and right (\(R\)) blocks is given by
where the normal and complementary operators are defined by
Note that we need to move all on-site interaction into local Hamiltonian, so that when construction interaction terms in Hamiltonian, operators anticommute (without giving extra constant terms).
Define
Then we have
Normal/Complementary Partitioning¶
With this normal/complementary partitioning, the operators required in left block are
The operators required in right block are
Assuming that there are \(K\) sites in total, and \(K_L/K_R\) sites in left/right block (optimally, \(K_L \le K_R\)), the total number of operators (and also the number of terms in Hamiltonian with partition) in left or right block is
Complementary/Normal Partitioning¶
Now the operators required in left block are
The operators required in right block are
The total number of operators (and also the number of terms in Hamiltonian with partition) in left or right block is
Blocking¶
The enlarged left/right block is denoted as \(L*/R*\). Make sure that all \(L\) operators are to the left of \(*\) operators.
Now there are two possibilities. In NC partition, in \(L\) we have \(A,A^\dagger, B, B'\) and in \(*\) we have \(P,P^\dagger,Q, Q'\). In CN partition, the opposite is true. Therefore, we have
Simplified Form¶
Define
we have N/C form
With this normal/complementary partitioning, the operators required in left block are
The operators required in right block are
Assuming that there are \(K\) sites in total, and \(K_L/K_R\) sites in left/right block (optimally, \(K_L \le K_R\)), the total number of operators (and also the number of terms in Hamiltonian with partition) in left or right block is
and C/N form
Now the operators required in left block are
The operators required in right block are
The total number of operators (and also the number of terms in Hamiltonian with partition) in left or right block is
Then for blocking
Spin-Adapted DMRG Quantum Chemistry Hamiltonian¶
Partitioning in SU(2)¶
The partitioning of Hamiltonian in left (\(L\)) and right (\(R\)) blocks is given by
where the normal and complementary operators are defined by
Derivation¶
CG Factors¶
From \(j_2 = 1/2\) CG factors
and symmetry relation
and
we have
let \(j_1 = 1\), we have
So the coefficients for \([\tfrac{1}{2}] \otimes_{[\tfrac{1}{2}]} [1]\) are
The coefficients for \([1] \otimes_{[\tfrac{1}{2}]} [\tfrac{1}{2}]\) are
This means that the SU(2) operator exchange factor for \([\tfrac{1}{2}] \otimes_{[\tfrac{1}{2}]} [1] \to [1] \otimes_{[\tfrac{1}{2}]} [\tfrac{1}{2}]\) is \(-1\). The fermion factor is \(+1\). So the overall exchange factor for this case is \(-1\).
Tensor Product Formulas¶
Singlet
Triplet
Doublet times singlet/triplet
Therefore,
\[\begin{split}\sqrt{3} U^{[1/2]} - V^{[1/2]} =&\ \frac{1}{\sqrt{2}} \begin{pmatrix} - a_{p\alpha}^\dagger a_{r\beta} a_{s\alpha} - a_{p\alpha}^\dagger a_{r\alpha} a_{s\beta} -2 a_{p\beta}^\dagger a_{r\beta} a_{s\beta} \\ 2 a_{p\alpha}^\dagger a_{r\alpha} a_{s\alpha} +a_{p\beta}^\dagger a_{r\beta} a_{s\alpha} + a_{p\beta}^\dagger a_{r\alpha} a_{s\beta} \end{pmatrix}^{[1/2]} - \frac{1}{\sqrt{2}} \begin{pmatrix} -a_{p\alpha}^\dagger a_{r\beta} a_{s\alpha} + a_{p\alpha}^\dagger a_{r\alpha} a_{s\beta}\\ -a_{p\beta}^\dagger a_{r\beta} a_{s\alpha} + a_{p\beta}^\dagger a_{r\alpha} a_{s\beta}\end{pmatrix}^{[1/2]} \\ =&\ \frac{1}{\sqrt{2}} \begin{pmatrix} -a_{p\alpha}^\dagger a_{r\beta} a_{s\alpha} - a_{p\alpha}^\dagger a_{r\alpha} a_{s\beta} -2 a_{p\beta}^\dagger a_{r\beta} a_{s\beta} +a_{p\alpha}^\dagger a_{r\beta} a_{s\alpha} - a_{p\alpha}^\dagger a_{r\alpha} a_{s\beta}\\ 2 a_{p\alpha}^\dagger a_{r\alpha} a_{s\alpha} +a_{p\beta}^\dagger a_{r\beta} a_{s\alpha} + a_{p\beta}^\dagger a_{r\alpha} a_{s\beta} +a_{p\beta}^\dagger a_{r\beta} a_{s\alpha} - a_{p\beta}^\dagger a_{r\alpha} a_{s\beta}\end{pmatrix}^{[1/2]} \\ =&\ \sqrt{2} \begin{pmatrix} - a_{p\alpha}^\dagger a_{r\alpha} a_{s\beta} - a_{p\beta}^\dagger a_{r\beta} a_{s\beta} \\ a_{p\alpha}^\dagger a_{r\alpha} a_{s\alpha} + a_{p\beta}^\dagger a_{r\beta} a_{s\alpha} \end{pmatrix}^{[1/2]}\end{split}\]
Another case
Therefore,
Triplet times triplet
Using
we have
Another case
Using
we have
S Term¶
From second singlet formula we have
R Term¶
This is the same as the S term. Note that in the expression for \(\hat{R}\), we have a \(\otimes_{[0]}\), this is because in the original spatial expression there is a summation over \(\sigma\). Then there is a \([0] \otimes_{[1/2]} [1/2]\), which will not produce any extra coefficients.
AP Term¶
Using definition
We have
Note that in last step, we can anticommute \(a_{l\sigma'}, a_{j\sigma}\) because it’s assumed that in the \(\sigma\) summation, when \(j=l\), \(\sigma \neq \sigma'\). Otherwise there will be two \(a\) operators acting on the same site and the contribution is zero.
BQ Term¶
In spatial expression, this term is \(BQ - B'Q'\). Now \(-\sqrt{3} Z^{[0]} + W^{[0]}\) gives \(B'Q'\). And \(2 W^{[0]}\) gives \(BQ\). Therefore,
This looks like \(\hat{A}\hat{P}\) term, but without \(\frac{1}{2}\) and \(h.c.\). But this is not correct, because the definition of \(Q, Q'\) is not equivalent due to the index order in \(v_{ijkl}\). So they will give different \(W^{[0]}\). Instead we have (note that \(\big( \hat{B}_{ij} \big)^{[0]} = \big( {\hat{B}'}_{ij} \big)^{[0]}\))
Note that \(B, Q\) do not have \([1]\) form.
Normal/Complementary Partitioning¶
Note that
Therefore,
So define
Here \(\frac{\sqrt{2}}{4}\) should be understood as \(\frac{1}{2} \cdot \frac{1}{\sqrt{2}}\). The \(\frac{1}{2}\) is the same as spatial case, and \(\frac{1}{\sqrt{2}}\) is because the expected \(\sqrt{2}\) factor is not added for the \(\hat{R}\) term.
Operator Exchange factors¶
Here we consider fermion and SU(2) exchange factors together. From \(j_2 = 1/2\) CG factors
Let \(j_1 = \frac{1}{2}\) we have
The exchange factor formula is
For \([1/2] \otimes_{[0]} [1/2]\), this is
For \([1/2] \otimes_{[1]} [1/2]\), this is
From CG factors
we have
we have
With this normal/complementary partitioning, the operators required in left block are
The operators required in right block are
Assuming that there are \(K\) sites in total, and \(K_L/K_R\) sites in left/right block (optimally, \(K_L \le K_R\)), the total number of operators (and also the number of terms in Hamiltonian with partition) in left or right block is
Complementary/Normal Partitioning¶
Note that due the CG factors, exchange any \(\otimes_{[0]}\) product will not produce extra sign.
Now the operators required in left block are
The operators required in right block are
The total number of operators (and also the number of terms in Hamiltonian with partition) in left or right block is
Blocking¶
The enlarged left/right block is denoted as \(L*/R*\). Make sure that all \(L\) operators are to the left of \(*\) operators. (The exchange factor for this is -1 for doublet \(\otimes\) triplet and +1 doublet \(\otimes\) singlet.)
First we have
From the formula \(\sqrt{3} U^{[1/2]} - V^{[1/2]}\) we have
From the formula \(\sqrt{3} S^{[1/2]} - T^{[1/2]}\) we have (for \(k\neq l\))
We have
After reordering of terms
By definition (The overall exchange factor for \([1/2] \otimes_{[0]} [1/2]\) is 1, and for \([1/2] \otimes_{[1]} [1/2]\) is -1)
we have
To generate symmetrized \(P\), we need to change the \(A\) line to the following
Similarly,
Number of terms
Blocking of other complementary operators is straightforward
and
and
Middle-Site Transformation¶
Diagonal Two-Particle Density Matrix¶
PDM Definition¶
One-particle density matrix
Two-particle density matrix
Spatial one-particle density matrix
Spatial two-particle density matrix
Spatial two-spin density matrix
where
NPC Definition¶
Number of particle correlation (pure spin)
Number of particle correlation (mixed spin)
Spin/Charge Correlation¶
Spin correlation
Charge correlation
Diagonal Spatial Two-Particle Density Matrix (Pure Spin)¶
Using anticommutation relation
We have
Then
Therefore,
Similarly,
Therefore,
Diagonal Spatial Two-Particle Density Matrix (Mixed Spin)¶
Using anticommutation relation
we have
Therefore,
pyblock API References¶
pyblock.symmetry¶
pyblock.symmetry.symmetry¶
Symmetry related data structures.
-
class
pyblock.symmetry.symmetry.
DirectProdGroup
(*args)¶ Bases:
object
Irreducible representation for symmetry formed by direct product of sub-symmetries.
- Attributes:
- irs : list(Group)
- A list of irreducible representations for sub-symmetries.
- ng : int
- Number of sub-symmetries.
-
sub_group
(idx)¶ Return a subgroup of this object, given a list of indices.
-
class
pyblock.symmetry.symmetry.
HashIrrep
(ir)¶ Bases:
object
Base class for irreducible representation, supporting hashing.
-
class
pyblock.symmetry.symmetry.
PGC1
(ir)¶ Bases:
pyblock.symmetry.symmetry.PointGroup
\(C_1\) point group.
-
Cached
= [None]¶
-
InverseElem
= array([0])¶
-
IrrepNames
= ['A']¶
-
Table
= array([[0]])¶
-
-
class
pyblock.symmetry.symmetry.
PGC2
(ir)¶ Bases:
pyblock.symmetry.symmetry.PGCI
\(C_2\) point group.
-
IrrepNames
= ['A', 'B']¶
-
-
class
pyblock.symmetry.symmetry.
PGC2H
(ir)¶ Bases:
pyblock.symmetry.symmetry.PGC2V
\(C_{2h}\) point group.
-
IrrepNames
= ['Ag', 'Au', 'Bu', 'Bg']¶
-
-
class
pyblock.symmetry.symmetry.
PGC2V
(ir)¶ Bases:
pyblock.symmetry.symmetry.PointGroup
\(D_{c2v}\) point group.
-
Cached
= [None, None, None, None]¶
-
InverseElem
= array([0, 1, 2, 3])¶
-
IrrepNames
= ['A1', 'B1', 'B2', 'A2']¶
-
Table
= array([[0, 1, 2, 3], [1, 0, 3, 2], [2, 3, 0, 1], [3, 2, 1, 0]])¶
-
-
class
pyblock.symmetry.symmetry.
PGCI
(ir)¶ Bases:
pyblock.symmetry.symmetry.PointGroup
\(C_i\) point group.
-
Cached
= [None, None]¶
-
InverseElem
= array([0, 1])¶
-
IrrepNames
= ['Ag', 'Au']¶
-
Table
= array([[0, 1], [1, 0]])¶
-
-
class
pyblock.symmetry.symmetry.
PGCS
(ir)¶ Bases:
pyblock.symmetry.symmetry.PGCI
\(C_s\) point group.
-
IrrepNames
= ["A'", "A''"]¶
-
-
class
pyblock.symmetry.symmetry.
PGD2
(ir)¶ Bases:
pyblock.symmetry.symmetry.PGC2V
\(D_2\) point group.
-
IrrepNames
= ['A1', 'B3', 'B2', 'B1']¶
-
-
class
pyblock.symmetry.symmetry.
PGD2H
(ir)¶ Bases:
pyblock.symmetry.symmetry.PointGroup
\(D_{2h}\) point group.
-
Cached
= [None, None, None, None, None, None, None, None]¶
-
InverseElem
= array([0, 1, 2, 3, 4, 5, 6, 7])¶
-
IrrepNames
= ['Ag', 'B3u', 'B2u', 'B1g', 'B1u', 'B2g', 'B3g', 'Au']¶
-
Table
= array([[0, 1, 2, 3, 4, 5, 6, 7], [1, 0, 3, 2, 5, 4, 7, 6], [2, 3, 0, 1, 6, 7, 4, 5], [3, 2, 1, 0, 7, 6, 5, 4], [4, 5, 6, 7, 0, 1, 2, 3], [5, 4, 7, 6, 1, 0, 3, 2], [6, 7, 4, 5, 2, 3, 0, 1], [7, 6, 5, 4, 3, 2, 1, 0]])¶
-
-
class
pyblock.symmetry.symmetry.
ParticleN
(ir)¶ Bases:
pyblock.symmetry.symmetry.HashIrrep
Irreducible representation for particle number symmetry.
-
CachedM
= []¶
-
CachedP
= []¶
-
static
clebsch_gordan
(a, b, c)¶
-
multiplicity
¶
-
-
class
pyblock.symmetry.symmetry.
PointGroup
(ir)¶ Bases:
pyblock.symmetry.symmetry.HashIrrep
Base class for irreducible representation for point group symmetry.
- Attributes:
- Table : rank-2 numpy.ndarray
- Mutiplication table of the group.
- InverseElem : rank-1 numpy.ndarray
- Inverse Element of each element in the group.
- IrrepNames : list(str)
- Name of each irreducible representation in the group.
-
InverseElem
= array([], dtype=int64)¶
-
IrrepNames
= []¶
-
Table
= array([], shape=(0, 0), dtype=int64)¶
-
static
clebsch_gordan
(a, b, c)¶
-
multiplicity
¶
-
class
pyblock.symmetry.symmetry.
SU2
(s)¶ Bases:
pyblock.symmetry.symmetry.HashIrrep
Irreducible representation for SU(2) spin symmetry.
-
Cached
= []¶
-
static
clebsch_gordan
(a, b, c)¶ Return rank-3 numpy.ndarray for CG coefficients with all possible projected quantum numbers.
-
j
¶ SU(2) spin quantum number.
-
multiplicity
¶
-
to_multi
()¶
-
-
class
pyblock.symmetry.symmetry.
SU2Proj
(s, sz)¶ Bases:
pyblock.symmetry.symmetry.SU2
Irreducible representation for SU(2) spin symmetry with extra projected spin label.
-
Cached
= []¶
-
copy
()¶
-
jz
¶ SU(2) projected spin quantum number.
-
multiplicity
¶
-
static
random_from_multi
(multi)¶
-
to_multi
()¶
-
-
class
pyblock.symmetry.symmetry.
SZ
(sz)¶ Bases:
pyblock.symmetry.symmetry.HashIrrep
Irreducible representation for projected spin symmetry.
-
CachedM
= []¶
-
CachedP
= []¶
-
static
clebsch_gordan
(a, b, c)¶
-
multiplicity
¶
-
-
pyblock.symmetry.symmetry.
point_group
(pg_name)¶ Return point group class corresponding to the point group name.
pyblock.symmetry.cg¶
Clebsch-Gordan coefficients.
-
class
pyblock.symmetry.cg.
CG
¶ Bases:
object
Precomputed numerical constants.
- Attributes:
- NSqrtFact : int
- Number of constants to generate.
- SqrtFact : [float]
- A list of size
NSqrtFact
, with element at index \(i\) being \(\sqrt{i!}\).
-
NSqrtFact
= 200¶
-
SqrtFact
= [1.0, 1.0, 1.4142135623730951, 2.4494897427831783, 4.898979485566357, 10.954451150103324, 26.832815729997478, 70.9929573971954, 200.79840636817815, 602.3952191045345, 1904.9409439665055, 6317.974358922329, 21886.105181141756, 78911.47445080469, 295259.7012800765, 1143535.9058639132, 4574143.623455653, 18859677.306253154, 80014834.28544986, 348776576.6344295, 1559776268.6284986, 7147792818.185868, 33526120082.371723, 160785623545.4059, 787685471322.9384, 3938427356614.692, 20082117944245.96, 104349745809073.98, 552166953567228.56, 2973510046012911.0, 1.6286585271694958e+16, 9.067986906793549e+16, 5.129628026803635e+17, 2.9467469553410734e+18, 1.7182339742875652e+19, 1.016520927791757e+20, 6.099125566750542e+20, 3.709953246501409e+21, 2.28696877430935e+22, 1.4282115417961528e+23, 9.032802905233224e+23, 5.78381592144527e+24, 3.748341123420972e+25, 2.4579516484946122e+26, 1.6304206741784305e+27, 1.0937194378152021e+28, 7.417966136220958e+28, 5.085501366740237e+29, 3.523338699662022e+30, 2.4663370897634156e+31, 1.743963680863606e+32, 1.2454391808865588e+33, 8.980989654316716e+33, 6.538259159791714e+34, 4.804619624270389e+35, 3.5632012788584193e+36, 2.666455677120592e+37, 2.013129889124823e+38, 1.5331540468207618e+39, 1.1776379687564844e+40, 9.12194448171079e+40, 7.124466393192019e+41, 5.609810447812648e+42, 4.452649004137246e+43, 3.5621192033097967e+44, 2.8718723147247465e+45, 2.333120097803461e+46, 1.9097411059666882e+47, 1.574812859496909e+48, 1.3081378078327272e+49, 1.094466613011557e+50, 9.222139602976429e+50, 7.825244940376377e+51, 6.685892207860282e+52, 5.751421947239992e+53, 4.9808775141931966e+54, 4.3422283469044446e+55, 3.810289910601107e+56, 3.365156932181069e+57, 2.9910169058002633e+58, 2.6752468492881897e+59, 2.4077221643593707e+60, 2.18028515039039e+61, 1.9863343046226287e+62, 1.8205054612841334e+63, 1.6784231035053562e+64, 1.5565055535934573e+65, 1.4518117296604024e+66, 1.3619201234191327e+67, 1.28483287477043e+68, 1.2188994890809342e+69, 1.1627560052213894e+70, 1.1152763807523816e+71, 1.0755335917960174e+72, 1.042768505784838e+73, 1.0163650175128552e+74, 9.958302741285535e+74, 9.807790764615758e+75, 9.709217501366035e+76, 9.66054943799493e+77, 9.660549437994932e+78, 9.708732028353838e+79, 9.805338706559366e+80, 9.95133192918726e+81, 1.0148407138632953e+83, 1.039902283024848e+84, 1.0706449288791818e+85, 1.1074837259283488e+86, 1.1509308491181515e+87, 1.2016070835354184e+88, 1.2602561412358772e+89, 1.327762234396748e+90, 1.4051714689748987e+91, 1.4937177607097716e+92, 1.5948541417547213e+93, 1.710290528972495e+94, 1.842039273319627e+95, 1.9924701154117024e+96, 2.1643765498993683e+97, 2.3610560690520687e+98, 2.586407337108586e+99, 2.845048070819445e+100, 3.142458305345292e+101, 3.4851548555301434e+102, 3.880904200712949e+103, 4.338982803479321e+104, 4.870496117317052e+105, 5.488770370909736e+106, 6.209834799433722e+107, 7.053016533709026e+108, 8.041676124552938e+109, 9.204119018612712e+110, 1.0574727661722569e+112, 1.2195370868041227e+113, 1.411716241374845e+114, 1.6402660477245914e+115, 1.9128624838060237e+116, 2.2389481343423286e+117, 2.630168525516852e+118, 3.100922958885159e+119, 3.6690615252019864e+120, 4.356769168863748e+121, 5.191689645855348e+122, 6.208357848239801e+123, 7.450029417887761e+124, 8.971023385028039e+125, 1.083972879914858e+127, 1.3142472714275038e+128, 1.598850811637179e+129, 1.9516461353510194e+130, 2.390268595042376e+131, 2.937211223973046e+132, 3.621237199747418e+133, 4.479223040992357e+134, 5.5585696126317876e+135, 6.920363358569688e+136, 8.643531064491464e+137, 1.083031338155279e+139, 1.3613492826948325e+140, 1.716596129698258e+141, 2.1713414369905214e+142, 2.7551234190045317e+143, 3.5066996146511464e+144, 4.477054362575133e+145, 5.733427060261861e+146, 7.364720406187589e+147, 9.488778480804807e+148, 1.2262204185483942e+150, 1.58936331434106e+151, 2.066172308643378e+152, 2.693959096814204e+153, 3.522808638313566e+154, 4.62012021572425e+155, 6.076819373438455e+156, 8.015875288043762e+157, 1.0604006276336018e+159, 1.4067804037272116e+160, 1.871599597838781e+161, 2.4970253096918963e+162, 3.340792175676754e+163, 4.482143042107585e+164, 6.030106741372272e+165, 8.135058752612967e+166, 1.1004903500825924e+168, 1.4927777395010379e+169, 2.0303972399920127e+170, 2.7690926476069663e+171, 3.7866772440000606e+172, 5.192030253612592e+173, 7.1378614943041415e+174, 9.838863082315585e+175, 1.3597579310207216e+177, 1.884135858018101e+178, 2.6175251876030417e+179, 3.645790713824437e+180, 5.0910696677188154e+181, 7.127497534806342e+182, 1.0003919511075688e+184, 1.4076762520426352e+185, 1.9857717232411065e+186]¶
pyblock.tensor¶
pyblock.tensor.tensor¶
Block-sparse tensor and tensor network.
-
class
pyblock.tensor.tensor.
SubTensor
(q_labels=None, reduced=None, cgs=None)¶ Bases:
object
A block in block-sparse tensor.
- Attributes:
- q_labels : tuple(DirectProdGroup..)
- Quantum labels for this sub-tensor block. Each element in the tuple corresponds one rank of the tensor.
- rank : int
- Rank of the tensor.
rank == len(q_labels)
. - ng : int
- Number of sub-symmetry groups.
ng == q_labels[0].ng
. - reduced : numpy.ndarray
- Rank-
rank
dense reduced matrix. - reduced_shape : tuple(int..)
- Shape of
reduced
- cgs : list(numpy.ndarray)
- A list of CG factors of length
ng
with each element being Rank-rank
dense reduced matrix representing CG coefficients for projected quantum numbers in each sub-symmetry group.
-
T
¶ Transpose.
-
add_noise
(noise)¶ Add noise to reduced matrix by random numbers in [-0.5 * noise, 0.5 * noise).
- Args:
- noise : float
- prefactor for the noise.
-
build_random
()¶ Set reduced matrix with random numbers in [0, 1).
-
build_rank3_cg
()¶ Generate
cgs
for rank-3 tensor.
-
build_zero
()¶ Set reduced matrix to zero.
-
equal_shape
(o)¶
-
class
pyblock.tensor.tensor.
Tensor
(blocks=None, tags=None, contractor=None)¶ Bases:
object
Block-sparse tensor.
- Attributes:
- blocks : list(SubTensor)
- A list of (non-zero) blocks.
- tags : set(str or int)
- Tags of the tensor for labeling the type or site index of the tensor.
- contractor :
- If not None, this is used to perform specialized tensor contraction and diagonalization.
-
add_noise
(noise)¶ Add noise to reduced matrix by random numbers in [-0.5 * noise, 0.5 * noise).
- Args:
- noise : float
- prefactor for the noise.
Add the tags, return
self
for chain notation.
-
align
(o)¶
-
build_identity
()¶ Set the reduced matrix to identity. Not work for general situations.
-
build_random
()¶ Fill the reduced matrix with random numbers in [0, 1).
-
build_rank3_cg
()¶ Generate CG coefficients for rank-3 tensor.
-
build_zero
()¶ Fill the reduced matrix with zero.
-
static
contract
(tsa, tsb, idxa, idxb, target_q_labels=None)¶ Contract two Tensor to form a new Tensor.
- Args:
- tsa : Tensor
- Tensor a, as left operand.
- tsb : Tensor
- Tensor b, as right operand.
- idxa : list(int)
- Indices to be contracted in tensor a.
- idxb : list(int)
- Indices to be contracted in tensor b.
- target_q_labels : None or DirectProdGroup or [DirectProdGroup]
- If None, this is contraction of states. For all other cases, this is contraction of operators. If DirectProdGroup, the resulting direct product operator will have the specific quantum label. If [DirectProdGroup], the resulting direct product operator will have mixed quantum labels (not very useful).
- Returns:
- tensor : Tensor
- The contracted Tensor.
-
copy
()¶ Shallow copy.
-
deep_copy
()¶ Deep copy.
-
diag_eigs
(k=-1, limit=None)¶
-
equal_shape
(o)¶
-
fit
(o, v)¶
-
fuse_index
(idxl, fused, target=None, equal=None)¶
-
get_diag_density_matrix
(trace_right, noise=0.0)¶
-
left_canonicalize
(mode='reduced')¶ Left canonicalization (using QR factorization).
- Returns:
- r_blocks : dict((DirectProdGroup, ) -> numpy.ndarray)
- The R matrix for each right-index quantum label.
-
left_multiply
(mats)¶ Left Multiplication. Currently only used for multiplying R obtained from right-canonicalization.
- Args:
- mats : dict((DirectProdGroup, ) -> numpy.ndarray)
- The R matrix for each right-index quantum label.
-
modify
(other)¶ Modify the blocks according to another Tensor’s blocks.
-
n_blocks
¶ Number of (non-zero) blocks.
-
ng
¶ Number of sub-symmetry groups.
-
norm
()¶
-
static
operator_init
(basis, repr, op_q_labels)¶ Build tensor for single-site primiary operator. When this is a tensor operator,
repr
andop_q_labels
will contain multiple items.cgs
andreduced
will be calculated.- Args:
- basis : list(DirectProdGroup)
- Site basis.
- repr : list(numpy.ndarray)
- A list of dense matrices for different
op_q_label
s. - op_q_labels : list(DirectProdGroup)
- A list of operator quantum labels.
- Returns:
- tensor : Tensor
- Operator Tensor.
-
static
partial_trace
(ts, idx_l, idx_r, target_q_labels=None)¶ Partial trace of a tensor. The indices in
idx_l
will be combined. The indices inidx_r
will also be combined. Then for each tensor block with q_label[idx_l] == q_label[idx_r], the term will be included, with its reduced matrix traced in corresponding indices.- Args:
- ts : Tensor
- Tensor to be traced.
- idx_l : list(int)
- Left traced indices.
- idx_r : list(int)
- Right traced indices.
- target_q_labels : None
- Defaults to None. Currently only the default is implemented.
- Returns:
- tensor : Tensor
- The resulting Tensor with indices
idx_l
andidx_r
are traced.
-
rank
¶ Rank of the tensor.
-
static
rank2_init_target
(left, right, target)¶
-
static
rank3_init_left
(pre, basis, post)¶ Build the MPS rank-3 tensor by coupling states in
pre
andbasis
into states inpost
.cgs
andreduced
will not be calculated.- Args:
- pre : dict(DirectProdGroup -> int)
- Left basis.
- basis : dict(DirectProdGroup -> int)
- Site basis.
- post : dict(DirectProdGroup -> int)
- Right basis. Right basis should be obtained from truncating the direct product of left and site basis.
- Returns:
- tensor : Tensor
-
static
rank3_init_right
(pre, basis, post)¶ Build the MPS rank-3 tensor by coupling states in
pre
andbasis
into states inpost
.cgs
andreduced
will not be calculated.- Args:
- pre : dict(DirectProdGroup -> int)
- Right basis.
- basis : dict(DirectProdGroup -> int)
- Site basis.
- post : dict(DirectProdGroup -> int)
- Left basis. Left basis should be obtained from truncating the direct product of right and site basis.
- Returns:
- tensor : Tensor
-
right_canonicalize
(mode='reduced')¶ Right canonicalization (using LQ factorization).
- Returns:
- l_blocks : dict((DirectProdGroup, ) -> numpy.ndarray)
- The L matrix for each left-index quantum label.
-
right_multiply
(mats)¶ Right Multiplication. Currently only used for multiplying L obtained from right-canonicalization.
- Args:
- mats : dict((DirectProdGroup, ) -> numpy.ndarray)
- The L matrix for each left-index quantum label.
-
set_contractor
(contractor)¶ Change the contractor, return
self
for chain notation.
Change the tags, return
self
for chain notation.
-
sort
()¶ Sort non-zero blocks in increasing order of quantum labels.
-
split
(absorb_right, k=-1)¶ Split rank-2 block-diagonal Tensor to two tensors (using SVD).
- Args:
- absorb_right : bool
- If absorb_right is True, singlular values will be multiplied into right Tensor. Otherwise, They will be multiplied into left Tensor.
- k : int
- Maximal bond length. Defaults to -1 (no truncation).
- Returns:
- left_tensor : Tensor
- Left tensor.
- right_tensor : Tensor
- Right tensor.
- error : float
- Sum of Discarded weights.
-
split_using_density_matrix
(dm, absorb_right, k=-1, limit=None)¶
-
svd
(q_label_left, k=-1)¶ Singular Value Decomposition of rank-2 block-diagonal Tensor.
- Args:
- k : int
- Maximal bond length. Defaults to -1 (no truncation).
- Returns:
- left_tensor : Tensor
- Left tensor.
- right_tensor : Tensor
- Right tensor.
- svd_s : list(numpy.ndarray)
- A list including singular values for each tensor block.
- error : float
- Sum of Discarded weights (square of singular values).
-
to_dict
(idx)¶
-
unfuse_index
(idx, left, right)¶
-
zero_copy
()¶ A deep copy with zero reduced matrices.
-
class
pyblock.tensor.tensor.
TensorNetwork
(tensors=None)¶ Bases:
object
An inefficient implementation for Quimb TensorNetwork.
- Attributes:
- tensors : list(Tensor)
- List of tensors in the network.
-
add
(tn)¶ Add a Tensor or TensorNetwork to the tensor network.
Add tags to all tensors in the tensor network.
-
contract
(tags, in_place=False)¶ Contract a sub tensor network specified by tags. If any Tensor in the sub tensor network has a
contractor
, the specialized contraction will be used. Currently the general contraction is not implemented.- Args:
- tags : tuple(str or int..)
- Tags of sub tensor network.
- Kwargs:
- in_place : bool
- Defaults to False. Indicating whether the current tensor network should be changed.
- Returns:
- tn : TensorNetwork
- The tensor network with selected sub tensor network replaced by its contraction.
-
copy
()¶ Shallow copy.
-
deep_copy
()¶ Deep copy.
-
remove
(tags, which='all', in_place=False)¶ Remove a sub tensor network specified by tags.
- Args:
- tags : set(str or int)
- Tags of sub tensor network.
- Kwargs:
- which : ‘all’ or ‘any’ or ‘exact’
- Defaults to ‘all’. Indicating how the
tags
should be applied for selection. - in_place : bool
- Defaults to False. Indicating whether the current tensor network should be changed.
- Returns:
- tn : TensorNetwork
- The remaining tensor network.
Remove tags from all tensors in the tensor network.
-
replace
(tags, tn, which='all')¶
-
select
(tags, which='all', inverse=False)¶ Extract a sub tensor network specified by tags.
- Args:
- tags : set(str or int)
- Tags of sub tensor network.
- Kwargs:
- which : ‘all’ or ‘any’ or ‘exact’
- Defaults to ‘all’. Indicating how the
tags
should be applied for selection. - inverse : bool
- Defaults to False. Indicating whether the selection should be inversed.
- Returns:
- tn : TensorNetwork
- The selected tensor network.
-
set_contractor
(contractor)¶ Set contractor for all tensors in the tensor network.
Return a list of tags collected from all tensors in the tensor network.
-
zero_copy
()¶ Deep copy with zeros.
-
exception
pyblock.tensor.tensor.
TensorNetworkError
¶ Bases:
Exception
pyblock.qchem¶
pyblock.qchem.core¶
Translation of low-level objects in Block code.
-
exception
pyblock.qchem.core.
BlockError
¶ Bases:
Exception
-
class
pyblock.qchem.core.
BlockEvaluation
¶ Bases:
object
-
classmethod
eigen_values
(mat)¶ Return all eigenvalues of a StackSparseMatrix.
-
classmethod
expr_diagonal_eval
(expr, a, b, sts)¶ Evaluate the diagonal elements of the result of a symbolic operator expression. The diagonal elements are required for perconditioning in Davidson algorithm.
- Args:
- expr : OpString or OpCollection or ParaOpCollection
- The operator expression to evaluate.
- a : dict(OpElement -> StackSparseMatrix)
- A map from operator symbol in left block to its matrix representation.
- b : dict(OpElement -> StackSparseMatrix)
- A map from operator symbol in right block to its matrix representation.
- sts : VectorStateInfo
- StateInfo in which the result of the operator expression is represented.
- Returns:
- diag : DiagonalMatrix
-
classmethod
expr_eval
(expr, a, b, sts, q_label, nmat=0)¶ Evaluate the result of a symbolic operator expression. The operator expression is usually a sum of direct products of operators in left and right blocks.
- Args:
- expr : OpString or OpSum
- The operator expression to evaluate.
- a : dict(OpElement -> StackSparseMatrix)
- A map from operator symbol in left block to its matrix representation.
- b : dict(OpElement -> StackSparseMatrix)
- A map from operator symbol in right block to its matrix representation.
- sts : VectorStateInfo
- StateInfo in which the result of the operator expression is represented.
- q_label : DirectProdGroup
- Quantum label of the result operator (indicating how it changes the state quantum labels).
- Returns:
- nmat : StackSparseMatrix
-
classmethod
expr_expectation
(expr, a, b, ket, bra, work, sts)¶
-
classmethod
expr_multiply_eval
(expr, a, b, c, nwave, sts)¶ Evaluate the result of a symbolic operator expression applied on a wavefunction.
- Args:
- expr : OpString or OpCollection or ParaOpCollection
- The operator expression.
- a : dict(OpElement -> StackSparseMatrix)
- A map from operator symbol in left block to its matrix representation.
- b : dict(OpElement -> StackSparseMatrix)
- A map from operator symbol in right block to its matrix representation.
- c : Wavefunction
- The input wavefuction.
- nwave : Wavefunction
- The output wavefuction.
- sts : VectorStateInfo
- StateInfo in which the wavefuction is represented.
-
expr_perturbative_density_eval
(expr, a, b, c, d, forward, sts)¶
-
classmethod
left_contract
(i, optl, optd, mpo_info, mps_info, bra_mps_info=None)¶ Perform blocking MPO x MPO for left block.
- Args:
- i : int
- Site index.
- optl: OperatorTensor or DualOperatorTensor
- Contracted MPO operator tensor at previous left block.
- optd : OperatorTensor or DualOperatorTensor
- MPO operator tensor at dot block.
- mpo_info : MPOInfo
- MPOInfo object.
- mps_info : MPSInfo
- MPSInfo object.
- bra_mps_info : MPSInfo or None (if same as mps_info)
- MPSInfo object for bra state.
- Returns:
- new_opt : OperatorTensor or DualOperatorTensor
- Operator tensor in untruncated basis in current left block.
-
classmethod
left_right_contract
(i, optl, optr, mpo_info, tag)¶ Symbolically construct the super block MPO.
- Args:
- i : int
- Site index of first/left dot block.
- optl: OperatorTensor
- Contracted MPO operator at (enlarged) left block.
- optr: OperatorTensor
- Contracted MPO operator at (enlarged) right block.
- mpo_info : MPOInfo
- MPOInfo object.
- tag : str
- Extra tag for caching.
- Returns:
- new_opt : OperatorTensor
- Operator tensor for super block. This method does not evaluate the super block operator experssion.
-
classmethod
left_rotate
(i, opt, mpst, mps_info, bra_mpst=None, bra_mps_info=None)¶ Perform rotation <MPS|MPO|MPS> for left block.
- Args:
- i : int
- Site index.
- opt : OperatorTensor or DualOperatorTensor
- Operator tensor in (untruncated) old basis.
- mpst : Tensor
- MPS tensor defining rotation in ket side.
- mps_info : MPSInfo
- MPSInfo object for ket state.
- bra_mpst : Tensor or None (if same as mpst)
- MPS tensor defining rotation in bra side.
- bra_mps_info : MPSInfo
- MPSInfo object for bra state.
- Returns:
- new_opt : OperatorTensor or DualOperatorTensor
- Operator tensor in (truncated) new basis.
-
parallelizer
= None¶ Explicit evaluation of symbolic expression for operators.
-
classmethod
right_contract
(i, optr, optd, mpo_info, mps_info, bra_mps_info=None)¶ Perform blocking MPO x MPO for right block.
- Args:
- i : int
- Site index.
- optr: OperatorTensor or DualOperatorTensor
- Contracted MPO operator tensor at previous right block.
- optd : OperatorTensor or DualOperatorTensor
- MPO operator tensor at dot block.
- mpo_info : MPOInfo
- MPOInfo object.
- mps_info : MPSInfo
- MPSInfo object.
- bra_mps_info : MPSInfo or None (if same as mps_info)
- MPSInfo object for bra state.
- Returns:
- new_opt : OperatorTensor or DualOperatorTensor
- Operator tensor in untruncated basis in current right block.
-
classmethod
right_rotate
(i, opt, mpst, mps_info, bra_mpst=None, bra_mps_info=None)¶ Perform rotation <MPS|MPO|MPS> for right block.
- Args:
- i : int
- Site index.
- opt : OperatorTensor or DualOperatorTensor
- Operator tensor in (untruncated) old basis.
- mpst : Tensor
- MPS tensor defining rotation in ket side.
- mps_info : MPSInfo
- MPSInfo object for ket state.
- bra_mpst : Tensor or None (if same as mpst)
- MPS tensor defining rotation in bra side.
- bra_mps_info : MPSInfo or None (if same as mps_info)
- MPSInfo object for bra state.
- Returns:
- new_opt : OperatorTensor or DualOperatorTensor
- Operator tensor in (truncated) new basis.
-
simplifier
= <pyblock.qchem.simplifier.NoSimplifier object>¶
-
classmethod
tensor_rotate
(opt, sts, rmats)¶ Transform basis of MPO using rotation matrix.
- Args:
- opt : OperatorTensor or DualOperatorTensor
- Operator tensor in (untruncated) old basis.
- sts : VectorStateInfo
- Old (untruncated) and new (truncated) basis.
- rmats : VectorVectorMatrix
- Rotation matrices for ket (or bra and ket).
- Returns:
- new_opt : OperatorTensor or DualOperatorTensor
- Operator tensor in (truncated) new basis.
-
classmethod
-
class
pyblock.qchem.core.
BlockHamiltonian
(*args, **kwargs)¶ Bases:
object
Initialization of block code.
- Attributes:
- output_level : int
- Output level of block code.
- point_group : str
- Point group of molecule.
- n_sites : int
- Number of sites/orbitals.
- n_electrons : int
- Number of electrons.
- target_s : Fraction
- SU(2) quantum number of target state.
- spatial_syms : [int]
- point group irrep number at each site.
- target_spatial_sym : int
- point group irrep number of target state.
- dot : int
- two-dot (2) or one-dot (1) scheme.
- t : TInt
- One-electron integrals.
- v : VInt
- Two-electron integrals.
- e : float
- Const term in energy.
-
static
block_operator_summary
(block)¶ Return a summary str of operators included in one Block (block code).
-
static
get
(fcidump, pg, su2, dot=2, output_level=0, memory=2000, page=None, omp_threads=1, **kwargs)¶
-
static
get_current_memory
()¶ Return current stack memory position.
-
get_site_operators
(m, op_set)¶ Return operator representations dict(OpElement -> StackSparseMatrix) at site m.
-
static
release_memory
()¶
-
static
set_current_memory
(m)¶ Reset current stack memory to given position.
-
class
pyblock.qchem.core.
BlockSymmetry
¶ Bases:
object
Including functions for translating quantum label related objects.
-
classmethod
from_spin_quantum
(sq)¶ Translate from SpinQuantum (block code) to
DirectProdGroup
.
-
classmethod
from_state_info
(state_info)¶ Translate from StateInfo (block code) to [(
DirectProdGroup
, int)].
-
classmethod
initial_state_info
(i=0)¶ Return StateInfo for site basis at site i.
-
classmethod
to_spin_quantum
(dpg)¶ Translate from
DirectProdGroup
to SpinQuantum (block code).
-
classmethod
to_state_info
(states)¶ Translate from [(
DirectProdGroup
, int)] to StateInfo (block code).
-
classmethod
pyblock.qchem.fcidump¶
FCIDUMP file and storage of integrals.
-
class
pyblock.qchem.fcidump.
GVInt
(n)¶ Bases:
pyblock.qchem.fcidump.TInt
General rank-4 array for two-electron integral storage.
- Attributes:
- n : int
- Number of orbitals.
- data : numpy.ndarray
- 1D flat array of size \(n^4\).
-
class
pyblock.qchem.fcidump.
TInt
(n)¶ Bases:
object
Symmetric rank-2 array (\(T_{ij} = T_{ji}\)) for one-electron integral storage.
- Attributes:
- n : int
- Number of orbitals.
- data : numpy.ndarray
- 1D flat array of size \(n(n+1)/2\).
-
copy
()¶
-
find_index
(i, j)¶ Find linear index from full indices (i, j).
-
class
pyblock.qchem.fcidump.
UVInt
(n)¶ Bases:
pyblock.qchem.fcidump.TInt
Symmetric rank-4 array (\(V_{ijkl} = V_{jikl} = V_{ijlk}\)) for two-electron integral storage.
- Attributes:
- n : int
- Number of orbitals.
- data : numpy.ndarray
- 1D flat array of size \(m^2\) where \(m=n(n+1)/2\).
-
find_index
(i, j, k, l)¶ Find linear index from full indices (i, j, k, l).
-
class
pyblock.qchem.fcidump.
VInt
(n)¶ Bases:
pyblock.qchem.fcidump.TInt
Symmetric rank-4 array (\(V_{ijkl} = V_{jikl} = V_{ijlk} = V_{klij}\)) for two-electron integral storage.
- Attributes:
- n : int
- Number of orbitals.
- data : numpy.ndarray
- 1D flat array of size \(m(m+1)/2\) where \(m=n(n+1)/2\).
-
find_index
(i, j, k, l)¶ Find linear index from full indices (i, j, k, l).
-
pyblock.qchem.fcidump.
read_fcidump
(filename)¶ Read FCI options and integrals from FCIDUMP file.
- Args:
- filename : str
- Returns:
- cont_dict : dict
- FCI options or input parameters.
- (t, v, e) : (TInt, VInt, float)
- One- and two-electron integrals and const energy.
-
pyblock.qchem.fcidump.
write_fcidump
(filename, h1e, h2e, nmo, nelec, nuc, ms, isym=1, orbsym=None, tol=1e-15)¶
pyblock.qchem.operator¶
Symbolic operators.
-
class
pyblock.qchem.operator.
OpElement
(name, site_index, factor=1, q_label=None)¶ Bases:
pyblock.qchem.operator.OpExpression
Single operator symbol.
- Attributes:
- name :
OpNames
- Type of the operator.
- site_index : () or tuple(int..)
- Site indices of the operator.
- factor : float
- scalar factor.
- q_label : DirectProdGroup
- Quantum label of the operator.
- name :
-
Cached
= {}¶
-
factor
¶
-
name
¶
-
static
parse
(expr)¶ Parse a str to operator symbol.
-
static
parse_site_index
(expr)¶
-
q_label
¶
-
site_index
¶
-
class
pyblock.qchem.operator.
OpExpression
¶ Bases:
object
-
class
pyblock.qchem.operator.
OpNames
¶ Bases:
enum.Enum
Operator Names.
-
A
= 12¶
-
AD
= 13¶
-
B
= 16¶
-
C
= 6¶
-
D
= 7¶
-
H
= 1¶
-
I
= 2¶
-
N
= 3¶
-
NN
= 4¶
-
NUD
= 5¶
-
P
= 14¶
-
PD
= 15¶
-
PDM1
= 18¶
-
Q
= 17¶
-
R
= 10¶
-
RD
= 11¶
-
S
= 8¶
-
SD
= 9¶
-
-
class
pyblock.qchem.operator.
OpString
(ops, factor=1)¶ Bases:
pyblock.qchem.operator.OpExpression
String of operator symbols representing direct product of single operator symbols.
- Attributes:
- ops : list(
OpElement
) - A list of single operator symbols.
- sign : int (1 or -1)
- Sign factor. With SU(2) factor considered
- ops : list(
-
factor
¶
-
op
¶
-
ops
¶
-
class
pyblock.qchem.operator.
OpSum
(strings)¶ Bases:
pyblock.qchem.operator.OpExpression
Sum of direct product of single operator symbols.
- Attributes:
- strings : list(
OpString
)
-
strings
¶
pyblock.qchem.mps¶
Matrix Product State for quantum chemistry calculations.
-
class
pyblock.qchem.mps.
LineCoupling
(n_sites, basis, empty, target)¶ Bases:
object
-
set_bond_dimension
(m, exact=False)¶ Truncate the renormalized basis, using the given bond dimension. Note that the ceiling is used for rounding for each quantum number, so the actual bond dimension is often larger than the given value.
-
set_bond_dimension_using_occ
(m, occ, bias=1)¶
-
tensor_product
(p, q)¶
-
-
class
pyblock.qchem.mps.
MPS
(lcp, center, dot=2, iprint=False, tensors=None)¶ Bases:
pyblock.tensor.tensor.TensorNetwork
Matrix Product State.
-
canonicalize
(random=False)¶ Canonicalization.
-
deep_copy
()¶ Deep copy.
-
fill_identity
()¶ Fill MPS reduced matrices with identity matrices whenever possible.
-
fit
(o, v)¶
-
static
from_tensor_network
(tn, mps_info, center, dot=2)¶
-
randomize
()¶ Fill MPS reduced matrices with random numbers in [0, 1).
-
update_line_coupling
()¶
-
zero_copy
()¶ Deep copy with zeros.
-
-
class
pyblock.qchem.mps.
MPSInfo
(lcp)¶ Bases:
object
-
from_left_rotation_matrix
(i, rot)¶ Translate rotation matrix (block code) in left block to rank-3
Tensor
.- Args:
- i : int
- Site index.
- rot : VectorMatrix
- Rotation matrix, defining the transformation from untruncated (but collected) basis to truncated basis.
- Returns:
- tensor : class:Tensor
-
from_right_rotation_matrix
(i, rot)¶ Translate rotation matrix (block code) in right block to rank-3
Tensor
.- Args:
- i : int
- Site index.
- rot : VectorMatrix
- Rotation matrix, defining the transformation from untruncated (but collected) basis to truncated basis.
- Returns:
- tensor : class:Tensor
-
from_wavefunction_fused
(i, wfn, sts=None)¶ Construct rank-2
Tensor
with fused indices from Wavefunction (block code).- Args:
- i : int
- Site index of first/left dot.
- wfn : Wavefunction
- Wavefunction.
- Returns:
- tensor : class:Tensor
- In two-dot scheme, the rank-2 tensor representing two-dot object. Both left and right rank indices are fused. No CG factor are generated. One-dot scheme is not implemented.
-
get_left_rotation_matrix
(i, tensor)¶ Translate rank-3
Tensor
to rotation matrix (block code) in left block.- Args:
- i : int
- Site index.
- tensor : class:Tensor
- MPS tensor.
- Returns:
- rot : VectorMatrix
- Rotation matrix, defining the transformation from untruncated (but collected) basis to truncated basis.
-
get_left_state_info
(i, left=None)¶ Construct StateInfo for left block [0..i] (used internally)
-
get_right_rotation_matrix
(i, tensor)¶ Translate rank-3
Tensor
to rotation matrix (block code) in right block.- Args:
- i : int
- Site index.
- tensor : class:Tensor
- MPS tensor.
- Returns:
- rot : VectorMatrix
- Rotation matrix, defining the transformation from untruncated (but collected) basis to truncated basis.
-
get_right_state_info
(i, right=None)¶ Construct StateInfo for right block [i..:attr:n_sites-1] (used internally)
-
get_wavefunction_fused
(i, tensor, dot, sts=None)¶ Construct Wavefunction (block code) from rank-2
Tensor
.- Args:
- i : int
- Site index of first/left dot.
- tensors : [Tensor]
- Rank-2
Tensor
with fused indices. - dot : int
- One-dot or two-dot (default) scheme.
- Returns:
- wfn : Wavefunction
-
update_local_left_block_basis
(i, left_block_basis)¶ Update renormalized basis at site i and associated StateInfo objects.
This will update for left block with sites [0..i] and [0..i+1]
- Args:
- i : int
- Center site, for determining assocated left and right blocks.
- left_block_basis : [(DirectProdGroup, int)]
- Renormalized basis for left block with sites [0..i].
-
update_local_left_state_info
(i, left=None)¶ Update StateInfo objects for left block ending at site i.
- Args:
- i : int
- Last site in the left block.
- Kwargs:
- left : StateInfo
- The (optional) StateInfo object for previous left block. Defaults to None.
- Returns:
- right : StateInfo
- The StateInfo object for current left block.
-
update_local_right_block_basis
(i, right_block_basis)¶ Update renormalized basis at site i and associated StateInfo objects.
This will update for right block with sites [i+1..:attr:n_sites-1] and [i..:attr:n_sites-1].
- Args:
- i : int
- Center site, for determining assocated left and right blocks.
- right_block_basis : [(DirectProdGroup, int)]
- Renormalized basis for right block with sites [i+1..:attr:n_sites-1].
-
update_local_right_state_info
(i, right=None)¶ Update StateInfo objects for right block starting at site i.
- Args:
- i : int
- First site in the right block.
- Kwargs:
- right : StateInfo
- The (optional) StateInfo object for previous right block. Defaults to None.
- Returns:
- left : StateInfo
- The StateInfo object for current right block.
-
-
pyblock.qchem.mps.
random_choice
(data, m)¶
pyblock.qchem.mpo¶
Matrix Product Operator for quantum chemistry calculations.
-
class
pyblock.qchem.mpo.
DualOperatorTensor
(lmat=None, rmat=None, ops=None, tags=None, contractor=None)¶ Bases:
pyblock.tensor.tensor.Tensor
MPO tensor or contracted MPO tensor with dual (left and right) representation.
-
copy
()¶ Return shallow copy of this object.
-
-
class
pyblock.qchem.mpo.
IdentityMPO
(hamil, iprint=False)¶ Bases:
pyblock.qchem.mpo.MPO
-
class
pyblock.qchem.mpo.
IdentityMPOInfo
(hamil, cache_contraction=True)¶ Bases:
pyblock.qchem.mpo.MPOInfo
-
class
pyblock.qchem.mpo.
LocalMPO
(hamil, op_name, site_index=(), **kwargs)¶ Bases:
pyblock.qchem.mpo.MPO
-
class
pyblock.qchem.mpo.
LocalMPOInfo
(hamil, op_name, site_index=(), **kwargs)¶ Bases:
pyblock.qchem.mpo.MPOInfo
-
class
pyblock.qchem.mpo.
MPO
(hamil, iprint=False)¶
-
class
pyblock.qchem.mpo.
MPOInfo
(hamil, cache_contraction=True)¶ Bases:
object
-
class
pyblock.qchem.mpo.
OperatorTensor
(mat, ops, tags=None, contractor=None)¶ Bases:
pyblock.tensor.tensor.Tensor
Represent MPO tensor or contracted MPO tensor.
- Attributes:
- mat : numpy.ndarray(dtype=OpExpression)
- 2-D array of Symbolic operator expressions.
- ops : dict(OpElement -> StackSparseMatrix)
- Numeric representation of operator symbols.
When the object is the super block MPO,
ops
is a pair of dicts representing operator symbols for left and right blocks, respectively.
-
copy
()¶ Return shallow copy of this object.
-
class
pyblock.qchem.mpo.
ProdMPO
(hamil, opa_name, opb_name, opab_name, site_index_a=(), site_index_b=(), site_index_ab=(), **kwargs)¶ Bases:
pyblock.qchem.mpo.MPO
-
class
pyblock.qchem.mpo.
ProdMPOInfo
(hamil, opa_name, opb_name, opab_name, site_index_a=(), site_index_b=(), site_index_ab=(), **kwargs)¶ Bases:
pyblock.qchem.mpo.MPOInfo
-
class
pyblock.qchem.mpo.
SquareMPO
(hamil, op_name, opsq_name, site_index=(), **kwargs)¶ Bases:
pyblock.qchem.mpo.MPO
-
class
pyblock.qchem.mpo.
SquareMPOInfo
(hamil, op_name, opsq_name, site_index=(), **kwargs)¶ Bases:
pyblock.qchem.mpo.MPOInfo
pyblock.qchem.contractor¶
Specialized MPS/MPO operations for DMRG.
-
class
pyblock.qchem.contractor.
BlockMultiplyH
(opt, sts, diag=True)¶ Bases:
object
A wrapper of Block.MultiplyH (block code) for Davidson algorithm.
- Attributes:
- opt : OperatorTensor
- The (symbolic) super block Hamiltonian.
- st : StateInfo
- StateInfo of super block.
- diag_mat : DiagonalMatrix
- Diagonal elements of super block Hamiltonian, in flatten form with no quantum labels.
-
apply
(other, result)¶ Perform \(\hat{H}|\psi\rangle\).
- Args:
- other : BlockWavefunction
- Input vector/wavefunction.
- result : BlockWavefunction
- Output vector/wavefunction.
-
diag
()¶ Returns Diagonal elements (for preconditioning).
-
diag_norm
()¶
-
expect
(ket, bra)¶
-
class
pyblock.qchem.contractor.
BlockWavefunction
(wave, factor=1.0)¶ Bases:
object
A wrapper of Wavefunction (block code) for Davidson algorithm.
-
clear_copy
()¶ Return a deep copy of this object, but all the matrix elements are set to zero.
-
copy
()¶ Return a deep copy of this object.
-
copy_data
(other)¶ Fill the matrix elements in this object with data from another
BlockWavefunction
object.
-
deallocate
()¶ Deallocate the memory associated with this object.
-
dot
(other)¶ Return dot product of two
BlockWavefunction
.
-
normalize
()¶ Normalization.
-
precondition
(ld, diag)¶ Apply precondition on this object.
- Args:
- ld : float
- Eigenvalue.
- diag : DiagonalMatrix
- Diagonal elements of Hamiltonian.
-
ref
¶
-
-
exception
pyblock.qchem.contractor.
ContractionError
¶ Bases:
Exception
-
class
pyblock.qchem.contractor.
DMRGContractor
(mps_info, mpo_info, simplifier=None, parallelizer=None, davidson_tol=5e-06)¶ Bases:
object
bra_mps_info is MPSInfo of some constant MPS.
-
apply
(opt, mpst)¶
-
bond_left
(tags={})¶
-
bond_right
(tags={})¶
-
bond_upper_limit_left
(tags={})¶
-
bond_upper_limit_right
(tags={})¶
-
contract
(tn, tags)¶ Tensor network contraction.
- Args:
- tn : TensorNetwork
- Part of tensor network to be contracted.
- tags : (str, int) or (str, )
- Tags of the tensor network to be contracted. If tags = (‘_LEFT’, i), the contraction is corresponding to blocking and renormalizing left block at site i. If tags = (‘_RIGHT’, i), the contraction is corresponding to blocking and renormalizing right block at site i. If tags = (‘_HAM’), the contraction is corresponding to blocking both left and right block and forming the super block hamiltonian.
- Returns:
- mpo : OperatorTensor
- The contracted MPO tensor.
-
eigs
(opt, mpst)¶ Davidson diagonalization.
- Args:
- opt : OperatorTensor
- Super block contracted operator tensor.
- mpst : Tensor
- Contracted MPS tensor in dot blocks.
- Returns:
- energy : float
- Ground state energy.
- v : class:Tensor
- In two-dot scheme, the rank-2 tensor representing two-dot object. Both left and right rank indices are fused. One-dot scheme is not implemented.
- ndav : int
- Number of Davidson iterations.
-
expect
(opt, brat, kett)¶
-
expo_apply
(opt, mpst, beta)¶
-
fuse_left
(i, tensor, original_form)¶
-
fuse_right
(i, tensor, original_form)¶
-
perturbative_noise
(opt, mpst)¶
-
post_sweep
()¶ Operations performed at the end of each DMRG sweep.
-
pre_sweep
()¶ Operations performed at the beginning of each DMRG sweep.
-
unfuse_left
(i, tensor)¶
-
unfuse_right
(i, tensor)¶
-
update_local_left_mps_info
(i, l_fused)¶ Update
info
for site i using the left tensor from SVD.
-
update_local_right_mps_info
(i, r_fused)¶ Update
info
for site i using the right tensor from SVD.
-
-
class
pyblock.qchem.contractor.
DMRGDataPage
(save_dir='node0', n_frames=1)¶ Bases:
pyblock.qchem.contractor.DataPage
Determine how to swap data between disk and memory for DMRG calculation.
-
activate
(tags, reset=False)¶ Activate one data page in memory for writing data.
-
clean
()¶ Delete all temporary files.
-
get
()¶
-
initialize
()¶ Allocate memory for all pages.
-
load
(tags)¶ Load data page from disk to memory, for reading data.
-
release
()¶ Deallocate memory for all pages.
-
save
(tags)¶ Save the data page in memory to disk.
-
unload
(tags)¶ Unload data page in memory for reading data.
-
pyblock.qchem.simplifier¶
Rules for simplifying symbolic operator expressions.
-
class
pyblock.qchem.simplifier.
AllRules
(su2=True)¶
-
class
pyblock.qchem.simplifier.
NoSimplifier
¶ Bases:
object
No simplification is performed.
-
simplify
(zipped)¶
-
-
class
pyblock.qchem.simplifier.
NoTransposeRules
(su2=True, rule=None)¶
-
class
pyblock.qchem.simplifier.
OpCollection
(uniq, linked=None)¶ Bases:
object
-
class
pyblock.qchem.simplifier.
OpLink
(op, trans, scale)¶ Bases:
object
-
class
pyblock.qchem.simplifier.
OpShell
(data)¶ Bases:
object
-
class
pyblock.qchem.simplifier.
PDM1Rules
(su2=True)¶
-
class
pyblock.qchem.simplifier.
Rule
(f=<function Rule.<lambda>>)¶ Bases:
object
-
class
pyblock.qchem.simplifier.
RuleSU2
¶ Bases:
object
-
class
A
(f=<function Rule.<lambda>>)¶
-
class
B
(f=<function Rule.<lambda>>)¶
-
class
D
(f=<function Rule.<lambda>>)¶
-
class
P
(f=<function Rule.<lambda>>)¶
-
class
PDM1
(f=<function Rule.<lambda>>)¶
-
class
Q
(f=<function Rule.<lambda>>)¶
-
class
R
(f=<function Rule.<lambda>>)¶
-
class
-
class
pyblock.qchem.simplifier.
RuleSZ
¶ Bases:
object
-
class
A
(f=<function Rule.<lambda>>)¶
-
class
B
(f=<function Rule.<lambda>>)¶
-
class
D
(f=<function Rule.<lambda>>)¶
-
class
P
(f=<function Rule.<lambda>>)¶
-
class
PDM1
(f=<function Rule.<lambda>>)¶
-
class
Q
(f=<function Rule.<lambda>>)¶
-
class
R
(f=<function Rule.<lambda>>)¶
-
class
pyblock.qchem.parallelizer¶
MPI parallelization.
-
class
pyblock.qchem.parallelizer.
ParaOpCollection
(uniq, linked=None, partial=None, collect=None, broadcast=None, bcast_all=False)¶
-
class
pyblock.qchem.parallelizer.
ParaProperty
(owner, repeated, repeated_num, partial)¶ Bases:
object
-
avail
¶
-
-
class
pyblock.qchem.parallelizer.
ParaRule
(size=<sphinx.ext.autodoc.importer._MockObject object>)¶ Bases:
object
pyblock.qchem.thermal¶
Setting up integral for calculating thermal quantities.
pyblock.qchem.occupation¶
Initialize quantum numbers using occupation numbers.
pyblock.qchem.ancilla¶
Ancilla approach for finite temperature simulation.
-
class
pyblock.qchem.ancilla.mps.
AncillaLineCoupling
(n_sites, basis, empty, target)¶ Bases:
pyblock.qchem.mps.LineCoupling
-
set_thermal_limit
()¶
-
-
class
pyblock.qchem.ancilla.mps.
AncillaMPS
(lcp, center, dot=2, iprint=False, tensors=None)¶ Bases:
pyblock.qchem.mps.MPS
-
fill_thermal_limit
()¶
-
pyblock.qchem.npdm¶
N-particle density matrix.
MPO for N-particle density matrix.
-
class
pyblock.qchem.npdm.mpo.
NRMMPO
(hamil, iprint=False)¶ Bases:
pyblock.qchem.mpo.MPO
-
class
pyblock.qchem.npdm.mpo.
NRMMPOInfo
(hamil, cache_contraction=True)¶ Bases:
pyblock.qchem.mpo.MPOInfo
-
class
pyblock.qchem.npdm.mpo.
PDM1MPO
(hamil, iprint=False)¶ Bases:
pyblock.qchem.mpo.MPO
-
class
pyblock.qchem.npdm.mpo.
PDM1MPOInfo
(hamil, cache_contraction=True)¶ Bases:
pyblock.qchem.mpo.MPOInfo
pyblock.legacy¶
pyblock.legacy.block_dmrg¶
Python wrapper for high-level DMRG algorithm in block code.
-
class
pyblock.legacy.block_dmrg.
DMRG
(input_file, output_level=0)¶ Bases:
object
Block DMRG in its original workflow.
-
block_and_decimate
(warm_up, dot_with_sys)¶ Block and renormalize operators in Block.
-
dmrg
(gen_block=False, rot_mats=None, tol=None, forward=True)¶ Perform DMRG.
-
do_one
(warm_up, forward, restart=False, restart_size=0)¶ Perform one sweep.
-
finalize
()¶ Release stack memory.
-
gen_block_block_and_decimate
(dot_with_sys, rot_mats=None, forward=True, implicit_trans=True, do_norms=None, do_comp=None)¶ Blocking and renormalization step for generating operators from rotation matrix.
-
gen_block_do_one
(rot_mats=None, forward=True, implicit_trans=True, do_norms=None, do_comp=None)¶ Perform one sweep for generating blocks from rotation matrices.
-
integral_index
= 0¶
-
output_level
= 0¶
-
sweep_params
= None¶
-
system
= None¶
-
pyblock.numerical¶
pyblock.numerical.davidson¶
Davidson diagonalization algorithm.
-
exception
pyblock.numerical.davidson.
DavidsonError
¶ Bases:
Exception
-
class
pyblock.numerical.davidson.
Matrix
(arr)¶ Bases:
object
General interface of Matrix for Davidson algorithm.
-
apply
(other, result)¶ Perform \(\hat{H}|\psi\rangle\).
- Args:
- other : Vector
- Input vector.
- result : Vector
- Output vector.
-
diag
()¶ Diagonal elements.
-
diag_norm
()¶
-
-
class
pyblock.numerical.davidson.
Vector
(arr, factor=1.0)¶ Bases:
object
General interface of Vector for Davidson algorithm
-
clear_copy
()¶ Return a deep copy of this object, but all the matrix elements are set to zero.
-
copy
()¶ Return a deep copy of this object.
-
deallocate
()¶ Deallocate the memory associated with this object. This is no-op for numpy.ndarray backend used here.
-
dot
(other)¶ Dot product.
-
normalize
()¶ Normalization.
-
precondition
(ld, diag)¶ Apply precondition on this object.
- Args:
- ld : float
- Eigenvalue.
- diag : numpy.ndarray
- Diagonal elements of Hamiltonian, stored in 1D array.
-
ref
¶
-
-
pyblock.numerical.davidson.
davidson
(a, b, k, max_iter=500, conv_thold=5e-06, deflation_min_size=2, deflation_max_size=30, iprint=False, mpi=False)¶ Davidson diagonalization.
- Args:
- a : Matrix
- The matrix to diagonalize.
- b : list(Vector)
- The initial guesses for eigenvectors.
- Kwargs:
- max_iter : int
- Maximal number of davidson iteration.
- conv_thold : float
- Convergence threshold for squared norm of eigenvector.
- deflation_min_size : int
- Sub-space size after deflation.
- deflation_max_size : int
- Maximal sub-space size before deflation.
- iprint : bool
- Indicate whether davidson iteration information should be printed.
- Returns:
- ld : list(float)
- List of eigenvalues.
- b : list(Vector)
- List of eigenvectors.
-
pyblock.numerical.davidson.
olsen_precondition
(q, c, ld, diag)¶ Olsen precondition.
pyblock.algorithm¶
pyblock.algorithm.dmrg¶
DMRG algorithm.
-
class
pyblock.algorithm.dmrg.
DMRG
(mpo, mps, bond_dims, noise=0.0, contractor=None)¶ Bases:
object
DMRG algorithm.
- Attributes:
- n_sites : int
- Number of sites/orbitals
- dot : int
- Two-dot (2) or one-dot (1) scheme.
- bond_dims : list(int) or int
- Bond dimension for each sweep.
- noise : list(float) or float
- Noise prefactor for each sweep.
- energies : list(float)
- Energies collected for all sweeps.
-
blocking
(i, forward, bond_dim, noise)¶ Perform one blocking iteration.
- Args:
- i : int
- Site index of left dot
- forward : bool
- Direction of current sweep. If True, sweep is performed from left to right.
- bond_dim : int
- Bond dimension of current sweep.
- noise : float
- Noise prefactor of current sweep.
- Returns:
- energy : float
- Ground state energy.
- error : float
- Sum of discarded weights.
- ndav : int
- Number of Davidson iterations.
-
construct_envs
()¶
-
set_mps
(tags, wfn)¶
-
solve
(n_sweeps, tol, forward=True, two_dot_to_one_dot=-1)¶ Perform DMRG algorithm.
- Args:
- n_sweeps : int
- Maximum number of sweeps.
- tol : float
- Energy convergence threshold.
- forward : bool
- Direction of first sweep. If True, sweep is performed from left to right.
- two_dot_to_one_dot : int or -1
- Indicating when to switch to one-dot scheme. If -1, no switching.
- Returns:
- energy : float
- Final ground state energy.
-
sweep
(forward, bond_dim, noise)¶ Perform one sweep iteration.
- Args:
- forward : bool
- Direction of current sweep. If True, sweep is performed from left to right.
- bond_dims : int
- Bond dimension of current sweep.
- noise : float
- Noise prefactor of current sweep.
- Returns:
- energy : float
- Ground state energy.
-
update_one_dot
(i, forward, bond_dim, noise)¶ Update local site in one-dot scheme.
- Args:
- i : int
- Site index of left dot
- forward : bool
- Direction of current sweep. If True, sweep is performed from left to right.
- bond_dim : int
- Bond dimension of current sweep.
- noise : float
- Noise prefactor of current sweep.
- Returns:
- energy : float
- Ground state energy.
- error : float
- Sum of discarded weights.
- ndav : int
- Number of Davidson iterations.
-
update_two_dot
(i, forward, bond_dim, noise)¶ Update local sites in two-dot scheme.
- Args:
- i : int
- Site index of left dot
- forward : bool
- Direction of current sweep. If True, sweep is performed from left to right.
- bond_dim : int
- Bond dimension of current sweep.
- noise : float
- Noise prefactor of current sweep.
- Returns:
- energy : float
- Ground state energy.
- error : float
- Sum of discarded weights.
- ndav : int
- Number of Davidson iterations.
-
exception
pyblock.algorithm.dmrg.
DMRGError
¶ Bases:
Exception
-
class
pyblock.algorithm.dmrg.
MovingEnvironment
(n_sites, center, dot, tn, iprint=True)¶ Bases:
object
Environment blocks in DMRG.
- Attributes:
- n_sites : int
- Number of sites/orbitals.
- dot : int
- Two-dot (2) or one-dot (1) scheme.
- tnc : TensorNetwork
- The tensor network <bra|H|ket> before contraction.
- pos : int
- Current site position of left dot.
- envs : dict(int -> TensorNetwork)
- DMRG Environment for different positions of left dot.
-
init_environments
()¶ Initialize DMRG Environment blocks by contraction.
-
move_to
(i)¶ Change the current left dot site to
i
(by zero or one site).
-
prepare_sweep
(dot, pos)¶ Prepare environment for next sweep.
-
pyblock.algorithm.dmrg.
pprint
(*args, **kwargs)¶
pyblock.algorithm.time_evolution¶
Imaginary time evolution algorithm.
-
class
pyblock.algorithm.time_evolution.
ExpoApply
(mpo, mps, beta, bond_dims, contractor=None, canonical_form=None)¶ Bases:
object
Apply exp(beta H) to MPS (tangent space approach).
- Attributes:
- n_sites : int
- Number of sites/orbitals
- dot : int
- Two-dot (2) or one-dot (1) scheme.
- bond_dims : list(int) or int
- Bond dimension for each sweep.
- energies : list(float)
- Energies collected for all sweeps.
- canonical_form : list(str)
- The canonical form of initial MPS. If None, assumming it is LL..CC..RR (dot=2) or LL..C..RR (dot=1)
-
blocking
(i, forward, bond_dim, beta)¶ Perform one blocking iteration.
- Args:
- i : int
- Site index of left dot
- forward : bool
- Direction of current sweep. If True, sweep is performed from left to right.
- bond_dim : int
- Bond dimension of current sweep.
- beta : float
- Beta parameter in \(\exp(-\beta H)\).
- Returns:
- energy : float
- Energy of state \(\exp(-\beta H) |\psi\rangle\).
- normsq : float
- Self inner product of state \(\exp(-\beta H) |\psi\rangle\).
- error : float
- Sum of discarded weights.
- nexpos : (int, int)
- Number of operator multiplication in forward and backward exponential step.
-
construct_envs
()¶
-
set_mps
(tags, wfn)¶
-
solve
(n_sweeps, forward=True, two_dot_to_one_dot=-1, current_beta=0.0, iprint=True)¶ Perform time evolution algorithm.
- Args:
- n_sweeps : int
- Maximum number of sweeps (two sweeps will calculate one exp(-beta H) application)
- forward : bool
- Direction of first sweep. If True, sweep is performed from left to right.
- two_dot_to_one_dot : int or -1
- Indicating when to switch to one-dot scheme. If -1, no switching.
- Returns:
- energy : float
- Energy of state \(\exp(-\beta * (n_{sweeps}/2) H) |\psi\rangle\).
-
sweep
(forward, bond_dim, beta)¶ Perform one sweep iteration.
- Args:
- forward : bool
- Direction of current sweep. If True, sweep is performed from left to right.
- bond_dim : int
- Bond dimension of current sweep.
- beta : float
- Beta parameter in \(\exp(-\beta H)\).
- Returns:
- energy : float
- Energy of state \(\exp(-\beta H) |\psi\rangle\).
- normsq : float
- Self inner product of state \(\exp(-\beta H) |\psi\rangle\).
- error : float
- Largest sum of discarded weights.
-
update_one_dot
(i, forward, bond_dim, beta)¶ Update local site in one-dot scheme.
- Args:
- i : int
- Site index of left dot
- forward : bool
- Direction of current sweep. If True, sweep is performed from left to right.
- bond_dim : int
- Bond dimension of current sweep.
- beta : float
- Beta parameter in \(\exp(-\beta H)\).
- Returns:
- energy : float
- Energy of state \(\exp(-\beta H) |\psi\rangle\).
- normsq : float
- Self inner product of state \(\exp(-\beta H) |\psi\rangle\).
- error : float
- Sum of discarded weights.
- nexpos : (int, int)
- Number of operator multiplication in forward and backward exponential step.
-
update_two_dot
(i, forward, bond_dim, beta)¶ Update local sites in two-dot scheme.
- Args:
- i : int
- Site index of left dot
- forward : bool
- Direction of current sweep. If True, sweep is performed from left to right.
- bond_dim : int
- Bond dimension of current sweep.
- beta : float
- Beta parameter in \(\exp(-\beta H)\).
- Returns:
- energy : float
- Energy of state \(\exp(-\beta H) |\psi\rangle\).
- normsq : float
- Self inner product of state \(\exp(-\beta H) |\psi\rangle\).
- error : float
- Sum of discarded weights.
- nexpos : (int, int)
- Number of operator multiplication in forward and backward exponential step.
-
exception
pyblock.algorithm.time_evolution.
TEError
¶ Bases:
Exception
-
pyblock.algorithm.time_evolution.
pprint
(*args, **kwargs)¶
pyblock.algorithm.expectation¶
Expectation calculation for <MPS1|MPO|MPS2>.
-
class
pyblock.algorithm.expectation.
Expect
(mpo, bra_mps, ket_mps, bra_canonical_form=None, ket_canonical_form=None, contractor=None)¶ Bases:
object
Calculation of expectation value <MPS1|MPO|MPS2>. The expectation value can be evaluated at current canonical form, when forward is None. Otherwise, it is recommended that bond_dim (bond dimension) of the MPS is given, and one sweep will be performed and expectation value will be evaluated at each canonical form. The sweep will thus change the canonical form of MPS and MPSInfo in contractor. Therefore, it is recommended that a copy of MPS and MPSInfo is used here.
- Attributes:
- n_sites : int
- Number of sites/orbitals
- dot : int
- Two-dot (2) or one-dot (1) scheme.
-
blocking
(i, forward, bond_dim)¶ Perform one blocking iteration.
- Args:
- i : int
- Site index of left dot
- forward : bool or None
- Direction of current sweep. If True, sweep is performed from left to right. If None, no sweep is performed (local evaluation).
- bond_dim : int
- Bond dimension of current sweep.
- Returns:
- result : float
- Expectation value.
-
construct_envs
()¶
-
get_1pdm
(normsq=1)¶ 1-particle density matrix.
-
get_1pdm_spatial
(normsq=1)¶ Spatial 1-particle density matrix.
-
solve
(forward=None, bond_dim=-1)¶ Calculate expectation value.
- Args:
- forward : bool or None
- Direction of current sweep. If True, sweep is performed from left to right. If None, no sweep is performed (local evaluation).
- bond_dim : int
- Bond dimension of current sweep.
- Returns:
- expect : float
- Expectation value.
-
update_one_dot
(i, forward, bond_dim)¶ Update local sites in one-dot scheme.
- Args:
- i : int
- Site index of left dot
- forward : bool or None
- Direction of current sweep. If True, sweep is performed from left to right. If None, no sweep is performed (local evaluation).
- bond_dim : int
- Bond dimension of current sweep.
- Returns:
- expect : float
- Expectation value.
-
update_two_dot
(i, forward, bond_dim)¶ Update local sites in two-dot scheme.
- Args:
- i : int
- Site index of left dot
- forward : bool or None
- Direction of current sweep. If True, sweep is performed from left to right. If None, no sweep is performed (local evaluation).
- bond_dim : int
- Bond dimension of current sweep.
- Returns:
- expect : float
- Expectation value.
-
exception
pyblock.algorithm.expectation.
ExpectationError
¶ Bases:
Exception
-
pyblock.algorithm.expectation.
pprint
(*args, **kwargs)¶
pyblock.algorithm.compress¶
Compression algorithm.
-
class
pyblock.algorithm.compress.
Compress
(mpo, mps, ket_mps, bond_dims, noise, ket_bond_dim=-1, bra_canonical_form=None, ket_canonical_form=None, contractor=None)¶ Bases:
object
Compression after apply MPO on MPS.
- Attributes:
- n_sites : int
- Number of sites/orbitals
- dot : int
- Two-dot (2) or one-dot (1) scheme.
- bond_dims : list(int) or int
- Bond dimension for each sweep.
-
blocking
(i, forward, bond_dim, ket_bond_dim, noise, beta)¶ Perform one blocking iteration.
- Args:
- i : int
- Site index of left dot
- forward : bool
- Direction of current sweep. If True, sweep is performed from left to right.
- bond_dim : int
- Bra bond dimension of current sweep.
- ket_bond_dim : int
- Ket bond dimension of current sweep.
- noise : float
- Noise prefactor of current sweep.
- beta : float
- Not used.
- Returns:
- norm : float
- Norm of compressed state.
- error : float
- Sum of discarded weights.
- nexpo : int
- Number of operator multiplication steps.
-
construct_envs
()¶
-
set_mps
(tags, wfn)¶
-
solve
(n_sweeps, tol, forward=True, two_dot_to_one_dot=-1)¶ Perform Compression algorithm.
- Args:
- n_sweeps : int
- Maximum number of sweeps.
- tol : float
- Norm convergence threshold.
- forward : bool
- Direction of first sweep. If True, sweep is performed from left to right.
- two_dot_to_one_dot : int or -1
- Indicating when to switch to one-dot scheme. If -1, no switching.
- Returns:
- nrom : float
- Final compressed stae norm.
-
sweep
(forward, bond_dim, ket_bond_dim, noise, beta)¶ Perform one sweep iteration.
- Args:
- forward : bool
- Direction of current sweep. If True, sweep is performed from left to right.
- bond_dim : int
- Bra bond dimension of current sweep.
- ket_bond_dim : int
- Ket bond dimension of current sweep.
- noise : float
- Noise prefactor of current sweep.
- beta : float
- Not used.
- Returns:
- norm : float
- Norm of compressed state.
-
update_one_dot
(i, forward, bond_dim, ket_bond_dim, noise, beta)¶ Update local sites in one-dot scheme.
- Args:
- i : int
- Site index of left dot
- forward : bool
- Direction of current sweep. If True, sweep is performed from left to right.
- bond_dim : int
- Bra bond dimension of current sweep.
- ket_bond_dim : int
- Ket bond dimension of current sweep.
- beta : float
- Not used.
- Returns:
- norm : float
- Norm of compressed state.
- error : float
- Sum of discarded weights.
- nexpos : (int, int)
- Number of operator multiplication steps.
-
update_two_dot
(i, forward, bond_dim, ket_bond_dim, noise, beta)¶ Update local sites in two-dot scheme.
- Args:
- i : int
- Site index of left dot
- forward : bool
- Direction of current sweep. If True, sweep is performed from left to right.
- bond_dim : int
- Bra bond dimension of current sweep.
- ket_bond_dim : int
- Ket bond dimension of current sweep.
- beta : float
- Not used.
- Returns:
- norm : float
- Norm of compressed state.
- error : float
- Sum of discarded weights.
- nexpos : (int, int)
- Number of operator multiplication steps.
-
exception
pyblock.algorithm.compress.
CompressionError
¶ Bases:
Exception
-
pyblock.algorithm.compress.
pprint
(*args, **kwargs)¶
Block API References¶
block module¶
Python3 wrapper for block 1.5.3 (spin adapted).
-
class
block.
DiagonalMatrix
(*args, **kwargs)¶ Bases:
object
NEWMAT10 diagonal matrix.
-
cols
¶
-
ref
¶ A numpy.ndarray reference.
-
resize
(self: block.DiagonalMatrix, nr: int) → None¶
-
rows
¶
-
-
class
block.
Matrix
(*args, **kwargs)¶ Bases:
object
NEWMAT10 matrix.
-
cols
¶
-
ref
¶ A numpy.ndarray reference.
-
rows
¶
-
-
class
block.
VectorBool
(*args, **kwargs)¶ Bases:
object
-
append
(self: block.VectorBool, x: bool) → None¶ Add an item to the end of the list
-
count
(self: block.VectorBool, x: bool) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
- extend(self: block.VectorBool, L: block.VectorBool) -> None
Extend the list by appending all the items in the given list
- extend(self: block.VectorBool, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: block.VectorBool, i: int, x: bool) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
- pop(self: block.VectorBool) -> bool
Remove and return the last item
- pop(self: block.VectorBool, i: int) -> bool
Remove and return the item at index
i
-
remove
(self: block.VectorBool, x: bool) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
class
block.
VectorDouble
(*args, **kwargs)¶ Bases:
object
-
append
(self: block.VectorDouble, x: float) → None¶ Add an item to the end of the list
-
count
(self: block.VectorDouble, x: float) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
- extend(self: block.VectorDouble, L: block.VectorDouble) -> None
Extend the list by appending all the items in the given list
- extend(self: block.VectorDouble, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: block.VectorDouble, i: int, x: float) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
- pop(self: block.VectorDouble) -> float
Remove and return the last item
- pop(self: block.VectorDouble, i: int) -> float
Remove and return the item at index
i
-
remove
(self: block.VectorDouble, x: float) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
class
block.
VectorInt
(*args, **kwargs)¶ Bases:
object
-
append
(self: block.VectorInt, x: int) → None¶ Add an item to the end of the list
-
count
(self: block.VectorInt, x: int) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
- extend(self: block.VectorInt, L: block.VectorInt) -> None
Extend the list by appending all the items in the given list
- extend(self: block.VectorInt, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: block.VectorInt, i: int, x: int) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
- pop(self: block.VectorInt) -> int
Remove and return the last item
- pop(self: block.VectorInt, i: int) -> int
Remove and return the item at index
i
-
remove
(self: block.VectorInt, x: int) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
class
block.
VectorMatrix
(*args, **kwargs)¶ Bases:
object
-
append
(self: block.VectorMatrix, x: block.Matrix) → None¶ Add an item to the end of the list
-
count
(self: block.VectorMatrix, x: block.Matrix) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
- extend(self: block.VectorMatrix, L: block.VectorMatrix) -> None
Extend the list by appending all the items in the given list
- extend(self: block.VectorMatrix, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: block.VectorMatrix, i: int, x: block.Matrix) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
- pop(self: block.VectorMatrix) -> block.Matrix
Remove and return the last item
- pop(self: block.VectorMatrix, i: int) -> block.Matrix
Remove and return the item at index
i
-
remove
(self: block.VectorMatrix, x: block.Matrix) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
class
block.
VectorVectorInt
(*args, **kwargs)¶ Bases:
object
-
append
(self: block.VectorVectorInt, x: block.VectorInt) → None¶ Add an item to the end of the list
-
count
(self: block.VectorVectorInt, x: block.VectorInt) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
- extend(self: block.VectorVectorInt, L: block.VectorVectorInt) -> None
Extend the list by appending all the items in the given list
- extend(self: block.VectorVectorInt, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: block.VectorVectorInt, i: int, x: block.VectorInt) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
- pop(self: block.VectorVectorInt) -> block.VectorInt
Remove and return the last item
- pop(self: block.VectorVectorInt, i: int) -> block.VectorInt
Remove and return the item at index
i
-
remove
(self: block.VectorVectorInt, x: block.VectorInt) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
class
block.
VectorVectorMatrix
(*args, **kwargs)¶ Bases:
object
-
append
(self: block.VectorVectorMatrix, x: block.VectorMatrix) → None¶ Add an item to the end of the list
-
count
(self: block.VectorVectorMatrix, x: block.VectorMatrix) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
- extend(self: block.VectorVectorMatrix, L: block.VectorVectorMatrix) -> None
Extend the list by appending all the items in the given list
- extend(self: block.VectorVectorMatrix, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: block.VectorVectorMatrix, i: int, x: block.VectorMatrix) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
- pop(self: block.VectorVectorMatrix) -> block.VectorMatrix
Remove and return the last item
- pop(self: block.VectorVectorMatrix, i: int) -> block.VectorMatrix
Remove and return the item at index
i
-
remove
(self: block.VectorVectorMatrix, x: block.VectorMatrix) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
block.
load_rotation_matrix
(arg0: block.VectorInt, arg1: block.VectorMatrix, arg2: int) → None¶ Load rotation matrix.
-
block.
save_rotation_matrix
(arg0: block.VectorInt, arg1: block.VectorMatrix, arg2: int) → None¶ Save rotation matrix.
block.io¶
Contains Input/Output related interfaces.
-
class
block.io.
AlgorithmTypes
¶ Bases:
enum.Enum
Types of algorithm: one-dot or two-dot or other types.
Members:
OneDot
TwoDot
TwoDotToOneDot
PartialSweep
-
OneDot
= 1¶
-
PartialSweep
= 4¶
-
TwoDot
= 2¶
-
TwoDotToOneDot
= 3¶
-
-
class
block.io.
CumulTimer
(*args, **kwargs)¶ Bases:
object
-
reset
(self: block.io.CumulTimer) → None¶
-
start
(self: block.io.CumulTimer) → None¶
-
stop
(self: block.io.CumulTimer) → None¶
-
-
class
block.io.
Global
¶ Bases:
object
Wrapper for global variables.
-
dmrginp
= None¶
-
non_abelian_sym
= None¶
-
point_group
= None¶
-
-
class
block.io.
Input
(*args, **kwargs)¶ Bases:
object
-
algorithm_type
¶ Algorithm type: one-dot or two-dot or other types.
-
effective_molecule_quantum_vec
(self: block.io.Input) → block.symmetry.VectorSpinQuantum¶ Often this simply returns a vector containing one
molecule_quantum
. For non-interacting orbitals or Bogoliubov algorithm, this may be more than that.
-
hf_occupancy
¶
-
is_spin_adapted
¶ Indicates whether SU(2) symmetry is utilized. If SU(2) is not used, The Abelian subgroup of SU(2) (Sz symmetry) is used.
-
molecule_quantum
¶ Symmetry of target state.
-
n_electrons
¶ Number of electrons
-
n_max_iters
¶ The maximal number of sweep iterations (outer loop).
-
n_roots
(self: block.io.Input, sweep_iter: int) → int¶ Get number of states to solve for given sweep iteration.
-
output_level
¶
-
slater_size
¶ Number of spin-orbitals
-
spin_orbs_symmetry
¶ Spatial symmetry (irrep number) of each spin-orbital.
-
sweep_tol
¶
-
timer_guessgen
¶ Timer for generating or loading dot blocks and environment block.
-
timer_multiplier
¶ Timer for blocking.
-
timer_operrot
¶ Timer for operator rotation.
-
twodot_to_onedot_iter
¶ Indicating at which sweep iteration the switching from two-dot to one-dot will happen.
-
-
class
block.io.
Timer
(*args, **kwargs)¶ Bases:
object
-
elapsed_cputime
(self: block.io.Timer) → float¶
-
elapsed_walltime
(self: block.io.Timer) → int¶
-
start
(self: block.io.Timer) → None¶
-
-
block.io.
get_current_stack_memory
() → int¶
-
block.io.
init_stack_memory
() → None¶
-
block.io.
read_input
(arg0: str) → None¶
-
block.io.
release_stack_memory
() → None¶
-
block.io.
set_current_stack_memory
(arg0: int) → None¶
block.dmrg¶
DMRG calculations.
-
class
block.dmrg.
MPS
(*args, **kwargs)¶ Bases:
object
-
get_site_tensors
(self: block.dmrg.MPS, arg0: int) → block.VectorMatrix¶
-
get_w
(self: block.dmrg.MPS) → block.operator.Wavefunction¶
-
n_sweep_iters
= None¶
-
site_blocks
= None¶
-
write_to_disk
(self: block.dmrg.MPS, state_index: int, write_state_average: bool = False) → None¶
-
-
block.dmrg.
MPS_init
(arg0: bool) → None¶ Initialize the single site blocks
MPS.site_blocks
.
-
class
block.dmrg.
SweepParams
(*args, **kwargs)¶ Bases:
object
-
additional_noise
¶
-
backward_starting_size
¶ Initial size of system block if in backward direction.
-
block_iter
¶ Counter for controlling the blocking iteration (inner loop).
-
current_root
¶
-
davidson_tol
¶
-
env_add
¶ The dot block size near environment block.
-
forward_starting_size
¶ Initial size of system block if in forward direction.
-
guess_type
¶
-
largest_dw
¶ Largest discarded weight (or largest error).
-
lowest_energy
¶
-
lowest_energy_spin
¶
-
lowest_error
¶
-
n_block_iters
¶ The number of blocking iterations (inner loops) needed in one sweep.
-
n_keep_qstates
¶ (May not be useful.)
-
n_keep_states
¶ The bond dimension for states in current sweep.
-
noise
¶
-
one_dot
¶ Whether it is the one-dot scheme.
-
save_state
(self: block.dmrg.SweepParams, forward: bool, size: int) → None¶ Save the sweep direction and number of sites in system block into the disk file ‘statefile.*.tmp’.
-
set_sweep_parameters
(self: block.dmrg.SweepParams) → None¶
-
sweep_iter
¶ Counter for controlling the sweep iteration (outer loop).
-
sys_add
¶ The dot block size near system block.
-
-
block.dmrg.
block_and_decimate
(sweep_params: block.dmrg.SweepParams, system: block.block.Block, new_system: block.block.Block, use_slater: bool, dot_with_sys: bool) → None¶ Block and decimate to generate the new system block.
-
block.dmrg.
calldmrg
(input_file_name: str) → None¶ Global driver.
-
block.dmrg.
dmrg
(sweep_tol: float) → None¶ Perform DMRG calculation.
-
block.dmrg.
do_one
(sweep_params: block.dmrg.SweepParams, warm_up: bool, forward: bool, restart: bool, restart_size: int) → float¶ Perform one sweep procedure.
-
block.dmrg.
get_dot_with_sys
(system: block.block.Block, one_dot: bool, forward: bool) → bool¶ Return the dot_with_sys variable, determing whether the complementary operators should be defined based on system block indicies.
-
block.dmrg.
guess_wavefunction
(solution: block.operator.Wavefunction, e: block.DiagonalMatrix, big: block.block.Block, guess_wave_type: block.block.GuessWaveTypes, one_dot: bool, state: int, transpose_guess_wave: bool, additional_noise: float = 0.0) → None¶
-
block.dmrg.
make_system_environment_big_overlap_blocks
(system_sites: block.VectorInt, system_dot: block.block.Block, environment_dot: block.block.Block, system: block.block.Block, new_system: block.block.Block, environment: block.block.Block, new_environment: block.block.Block, big: block.block.Block, sweep_params: block.dmrg.SweepParams, dot_with_sys: bool, use_slater: bool, integral_index: int, bra_state: int, ket_state: int) → None¶
block.block¶
Block definition and operator operations.
-
class
block.block.
Block
(*args, **kwargs)¶ Bases:
object
-
add_additional_ops
(self: block.block.Block) → None¶
-
add_all_comp_ops
(self: block.block.Block) → None¶
-
bra_state_info
¶
-
clear
(self: block.block.Block) → None¶
-
deallocate
(self: block.block.Block) → None¶
-
diagonal_h
(self: block.block.Block, arg0: block.DiagonalMatrix) → None¶
-
ket_state_info
¶
-
left_block
¶ If this is a sum block, return left sub-block for building it.
-
loop_block
¶ Whether the block is loop block.
-
move_and_free_memory
(self: block.block.Block, arg0: block.block.Block) → None¶ If the parameter
system
is allocated beforethis
object, but we need to freesystem
. Then we have to move the memory ofthis
tosystem
then clearsystem
.
-
multiply_overlap
(self: block.block.Block, c: block.operator.Wavefunction, v: block.operator.Wavefunction, num_threads: int = 1) → None¶
-
name
¶ A random integer.
-
ops
¶ Map from operator types to matrix representation of operators.
-
print_operator_summary
(self: block.block.Block) → None¶ Print operator summary when
block.io.Input.output_level
at least = 2.
-
remove_additional_ops
(self: block.block.Block) → None¶
-
renormalize_from
(self: block.block.Block, energies: block.VectorDouble, spins: block.VectorDouble, error: float, rotate_matrix: block.VectorMatrix, kept_states: int, kept_qstates: int, tol: float, big: block.block.Block, guess_wave_type: block.block.GuessWaveTypes, noise: float, additional_noise: float, one_dot: bool, system: block.block.Block, system_dot: block.block.Block, environment: block.block.Block, dot_with_sys: bool, warm_up: bool, sweep_iter: int, current_root: int, lower_states: block.operator.VectorWavefunction) → float¶
-
restore
(self: block.block.Block, forward: bool, sites: block.VectorInt, left: int, right: int) → None¶ Read a
Block
from disk.- Args:
- forward : bool
- The direction of sweep.
- sites :
block.VectorInt
- List of indices of sites contained in the block. left : int Bra state (-1 for normal case).
- right : int
- Ket state (-1 for normal case).
-
right_block
¶ If this is a sum block, return right sub-block for building it.
-
sites
¶ List of indices of sites contained in the block.
-
store
(self: block.block.Block, forward: bool, sites: block.VectorInt, left: int, right: int) → None¶ Store a
Block
into disk.- Args:
- forward : bool
- The direction of sweep.
- sites :
block.VectorInt
- List of indices of sites contained in the block. This is kind of redundant and can be obtained from
Block.sites
. - left : int
- Bra state (-1 for normal case).
- right : int
- Ket state (-1 for normal case).
-
transform_operators
(self: block.block.Block, arg0: block.VectorMatrix) → None¶
-
transform_operators_2
(self: block.block.Block, left_rotate_matrix: block.VectorMatrix, right_rotate_matrix: block.VectorMatrix, clear_right_block: bool = True, clear_left_block: bool = True) → None¶
-
-
class
block.block.
GuessWaveTypes
¶ Bases:
enum.Enum
Types of guess wavefunction for initialize Davidson algorithm (enumerator).
Members:
Basic
Transform
Transpose
-
Basic
= 1¶
-
Transform
= 2¶
-
Transpose
= 3¶
-
-
class
block.block.
MapOperators
(*args, **kwargs)¶ Bases:
object
-
items
(self: block.block.MapOperators) → iterator¶
-
-
class
block.block.
StorageTypes
¶ Bases:
enum.Enum
Types of storage (enumerator).
Members:
LocalStorage
DistributedStorage
-
DistributedStorage
= 2¶
-
LocalStorage
= 1¶
-
-
class
block.block.
VectorBlock
(*args, **kwargs)¶ Bases:
object
-
append
(self: block.block.VectorBlock, x: block.block.Block) → None¶ Add an item to the end of the list
-
extend
(*args, **kwargs)¶ Overloaded function.
- extend(self: block.block.VectorBlock, L: block.block.VectorBlock) -> None
Extend the list by appending all the items in the given list
- extend(self: block.block.VectorBlock, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: block.block.VectorBlock, i: int, x: block.block.Block) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
- pop(self: block.block.VectorBlock) -> block.block.Block
Remove and return the last item
- pop(self: block.block.VectorBlock, i: int) -> block.block.Block
Remove and return the item at index
i
-
-
block.block.
init_big_block
(left_block: block.block.Block, right_block: block.block.Block, big_block: block.block.Block, bra_quanta: block.symmetry.VectorSpinQuantum = VectorSpinQuantum[], ket_quanta: block.symmetry.VectorSpinQuantum = VectorSpinQuantum[]) → None¶ Initialize big (super) block.
-
block.block.
init_new_environment_block
(environment: block.block.Block, environment_dot: block.block.Block, new_environment: block.block.Block, system: block.block.Block, system_dot: block.block.Block, left_state: int, right_state: int, sys_add: int, env_add: int, forward: bool, direct: bool, one_dot: bool, use_slater: bool, integral_index: int, have_norm_ops: bool, have_comp_ops: bool, dot_with_sys: bool) → None¶ Initialize new environment block
-
block.block.
init_new_system_block
(system: block.block.Block, system_dot: block.block.Block, new_system: block.block.Block, left_state: int, right_state: int, sys_add: int, direct: bool, integral_index: int, storage: block.block.StorageTypes, have_norm_ops: bool, have_comp_ops: bool) → None¶ Initialize new system block
-
block.block.
init_starting_block
(starting_block: block.block.Block, forward: bool, left_state: int, right_state: int, forward_starting_size: int, backward_starting_size: int, restart_size: int, restart: bool, warm_up: bool, integral_index: int, bra_quanta: block.symmetry.VectorSpinQuantum = VectorSpinQuantum[], ket_quanta: block.symmetry.VectorSpinQuantum = VectorSpinQuantum[]) → None¶ Initialize starting block
block.operator¶
Classes for operator matrices and operations.
-
class
block.operator.
DensityMatrix
(*args, **kwargs)¶ Bases:
block.operator.StackSparseMatrix
Block-sparse matrix. Non-zero blocks are identified by symmetry (quantum numbers) requirements and stored as
StackMatrix
objects
-
class
block.operator.
MapPairInt
(*args, **kwargs)¶ Bases:
object
-
items
(self: block.operator.MapPairInt) → iterator¶
-
-
class
block.operator.
OpTypes
¶ Bases:
enum.Enum
Types of operators (enumerator).
Members:
Hamiltonian
Cre
CreCre
DesDesComp
CreDes
CreDesComp
CreCreDesComp
Des
DesDes
CreCreComp
DesCre
DesCreComp
CreDesDesComp
Overlap
-
Cre
= 2¶
-
CreCre
= 3¶
-
CreCreComp
= 10¶
-
CreCreDesComp
= 7¶
-
CreDes
= 5¶
-
CreDesComp
= 6¶
-
CreDesDesComp
= 13¶
-
Des
= 8¶
-
DesCre
= 11¶
-
DesCreComp
= 12¶
-
DesDes
= 9¶
-
DesDesComp
= 4¶
-
Hamiltonian
= 1¶
-
Overlap
= 14¶
-
-
class
block.operator.
OperatorArrayBase
¶ Bases:
object
-
class
block.operator.
OperatorArrayCre
(*args, **kwargs)¶ Bases:
block.operator.OperatorArrayBase
An array of Cre operators defined at different sites.
-
global_element_linear
(self: block.operator.OperatorArrayCre, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in global storage).
-
global_indices
¶ A 1d array contains the site indices of non-zero elements (in local or global storage). It gives a map from flattened single index to multiple site indices. Then this array itself is flattened.
-
has_global
(self: block.operator.OperatorArrayCre, arg0: int) → bool¶ Query whether the element is non-zero (in local or global storage). The parameters are site indices.
-
has_local
(self: block.operator.OperatorArrayCre, arg0: int) → bool¶ Query whether the element is non-zero in local storage. The parameters are site indices.
-
local_element
(self: block.operator.OperatorArrayCre, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given site indices (in local storage).
-
local_element_linear
(self: block.operator.OperatorArrayCre, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in local storage).
-
local_indices
¶ A 2d array contains the site indices of non-zero elements in local storage. It gives a map from flattened single index to multiple site indices (which is represented as an array).
-
n_global_nz
¶ Number of non-zero elements in global storage.
-
n_local_nz
¶ Number of non-zero elements in local storage.
-
op_string
¶ Name of the type of operators contained in this array.
-
-
class
block.operator.
OperatorArrayCreCre
(*args, **kwargs)¶ Bases:
block.operator.OperatorArrayBase
An array of CreCre operators defined at different sites.
-
global_element_linear
(self: block.operator.OperatorArrayCreCre, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in global storage).
-
global_indices
¶ A 1d array contains the site indices of non-zero elements (in local or global storage). It gives a map from flattened single index to multiple site indices. Then this array itself is flattened.
-
has_global
(self: block.operator.OperatorArrayCreCre, arg0: int, arg1: int) → bool¶ Query whether the element is non-zero (in local or global storage). The parameters are site indices.
-
has_local
(self: block.operator.OperatorArrayCreCre, arg0: int, arg1: int) → bool¶ Query whether the element is non-zero in local storage. The parameters are site indices.
-
local_element
(self: block.operator.OperatorArrayCreCre, arg0: int, arg1: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given site indices (in local storage).
-
local_element_linear
(self: block.operator.OperatorArrayCreCre, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in local storage).
-
local_indices
¶ A 2d array contains the site indices of non-zero elements in local storage. It gives a map from flattened single index to multiple site indices (which is represented as an array).
-
n_global_nz
¶ Number of non-zero elements in global storage.
-
n_local_nz
¶ Number of non-zero elements in local storage.
-
op_string
¶ Name of the type of operators contained in this array.
-
-
class
block.operator.
OperatorArrayCreCreComp
(*args, **kwargs)¶ Bases:
block.operator.OperatorArrayBase
An array of CreCreComp operators defined at different sites.
-
global_element_linear
(self: block.operator.OperatorArrayCreCreComp, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in global storage).
-
global_indices
¶ A 1d array contains the site indices of non-zero elements (in local or global storage). It gives a map from flattened single index to multiple site indices. Then this array itself is flattened.
-
has_global
(self: block.operator.OperatorArrayCreCreComp, arg0: int, arg1: int) → bool¶ Query whether the element is non-zero (in local or global storage). The parameters are site indices.
-
has_local
(self: block.operator.OperatorArrayCreCreComp, arg0: int, arg1: int) → bool¶ Query whether the element is non-zero in local storage. The parameters are site indices.
-
local_element
(self: block.operator.OperatorArrayCreCreComp, arg0: int, arg1: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given site indices (in local storage).
-
local_element_linear
(self: block.operator.OperatorArrayCreCreComp, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in local storage).
-
local_indices
¶ A 2d array contains the site indices of non-zero elements in local storage. It gives a map from flattened single index to multiple site indices (which is represented as an array).
-
n_global_nz
¶ Number of non-zero elements in global storage.
-
n_local_nz
¶ Number of non-zero elements in local storage.
-
op_string
¶ Name of the type of operators contained in this array.
-
-
class
block.operator.
OperatorArrayCreCreDesComp
(*args, **kwargs)¶ Bases:
block.operator.OperatorArrayBase
An array of CreCreDesComp operators defined at different sites.
-
global_element_linear
(self: block.operator.OperatorArrayCreCreDesComp, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in global storage).
-
global_indices
¶ A 1d array contains the site indices of non-zero elements (in local or global storage). It gives a map from flattened single index to multiple site indices. Then this array itself is flattened.
-
has_global
(self: block.operator.OperatorArrayCreCreDesComp, arg0: int) → bool¶ Query whether the element is non-zero (in local or global storage). The parameters are site indices.
-
has_local
(self: block.operator.OperatorArrayCreCreDesComp, arg0: int) → bool¶ Query whether the element is non-zero in local storage. The parameters are site indices.
-
local_element
(self: block.operator.OperatorArrayCreCreDesComp, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given site indices (in local storage).
-
local_element_linear
(self: block.operator.OperatorArrayCreCreDesComp, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in local storage).
-
local_indices
¶ A 2d array contains the site indices of non-zero elements in local storage. It gives a map from flattened single index to multiple site indices (which is represented as an array).
-
n_global_nz
¶ Number of non-zero elements in global storage.
-
n_local_nz
¶ Number of non-zero elements in local storage.
-
op_string
¶ Name of the type of operators contained in this array.
-
-
class
block.operator.
OperatorArrayCreDes
(*args, **kwargs)¶ Bases:
block.operator.OperatorArrayBase
An array of CreDes operators defined at different sites.
-
global_element_linear
(self: block.operator.OperatorArrayCreDes, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in global storage).
-
global_indices
¶ A 1d array contains the site indices of non-zero elements (in local or global storage). It gives a map from flattened single index to multiple site indices. Then this array itself is flattened.
-
has_global
(self: block.operator.OperatorArrayCreDes, arg0: int, arg1: int) → bool¶ Query whether the element is non-zero (in local or global storage). The parameters are site indices.
-
has_local
(self: block.operator.OperatorArrayCreDes, arg0: int, arg1: int) → bool¶ Query whether the element is non-zero in local storage. The parameters are site indices.
-
local_element
(self: block.operator.OperatorArrayCreDes, arg0: int, arg1: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given site indices (in local storage).
-
local_element_linear
(self: block.operator.OperatorArrayCreDes, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in local storage).
-
local_indices
¶ A 2d array contains the site indices of non-zero elements in local storage. It gives a map from flattened single index to multiple site indices (which is represented as an array).
-
n_global_nz
¶ Number of non-zero elements in global storage.
-
n_local_nz
¶ Number of non-zero elements in local storage.
-
op_string
¶ Name of the type of operators contained in this array.
-
-
class
block.operator.
OperatorArrayCreDesComp
(*args, **kwargs)¶ Bases:
block.operator.OperatorArrayBase
An array of CreDesComp operators defined at different sites.
-
global_element_linear
(self: block.operator.OperatorArrayCreDesComp, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in global storage).
-
global_indices
¶ A 1d array contains the site indices of non-zero elements (in local or global storage). It gives a map from flattened single index to multiple site indices. Then this array itself is flattened.
-
has_global
(self: block.operator.OperatorArrayCreDesComp, arg0: int, arg1: int) → bool¶ Query whether the element is non-zero (in local or global storage). The parameters are site indices.
-
has_local
(self: block.operator.OperatorArrayCreDesComp, arg0: int, arg1: int) → bool¶ Query whether the element is non-zero in local storage. The parameters are site indices.
-
local_element
(self: block.operator.OperatorArrayCreDesComp, arg0: int, arg1: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given site indices (in local storage).
-
local_element_linear
(self: block.operator.OperatorArrayCreDesComp, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in local storage).
-
local_indices
¶ A 2d array contains the site indices of non-zero elements in local storage. It gives a map from flattened single index to multiple site indices (which is represented as an array).
-
n_global_nz
¶ Number of non-zero elements in global storage.
-
n_local_nz
¶ Number of non-zero elements in local storage.
-
op_string
¶ Name of the type of operators contained in this array.
-
-
class
block.operator.
OperatorArrayCreDesDesComp
(*args, **kwargs)¶ Bases:
block.operator.OperatorArrayBase
An array of CreDesDesComp operators defined at different sites.
-
global_element_linear
(self: block.operator.OperatorArrayCreDesDesComp, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in global storage).
-
global_indices
¶ A 1d array contains the site indices of non-zero elements (in local or global storage). It gives a map from flattened single index to multiple site indices. Then this array itself is flattened.
-
has_global
(self: block.operator.OperatorArrayCreDesDesComp, arg0: int) → bool¶ Query whether the element is non-zero (in local or global storage). The parameters are site indices.
-
has_local
(self: block.operator.OperatorArrayCreDesDesComp, arg0: int) → bool¶ Query whether the element is non-zero in local storage. The parameters are site indices.
-
local_element
(self: block.operator.OperatorArrayCreDesDesComp, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given site indices (in local storage).
-
local_element_linear
(self: block.operator.OperatorArrayCreDesDesComp, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in local storage).
-
local_indices
¶ A 2d array contains the site indices of non-zero elements in local storage. It gives a map from flattened single index to multiple site indices (which is represented as an array).
-
n_global_nz
¶ Number of non-zero elements in global storage.
-
n_local_nz
¶ Number of non-zero elements in local storage.
-
op_string
¶ Name of the type of operators contained in this array.
-
-
class
block.operator.
OperatorArrayDes
(*args, **kwargs)¶ Bases:
block.operator.OperatorArrayBase
An array of Des operators defined at different sites.
-
global_element_linear
(self: block.operator.OperatorArrayDes, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in global storage).
-
global_indices
¶ A 1d array contains the site indices of non-zero elements (in local or global storage). It gives a map from flattened single index to multiple site indices. Then this array itself is flattened.
-
has_global
(self: block.operator.OperatorArrayDes, arg0: int) → bool¶ Query whether the element is non-zero (in local or global storage). The parameters are site indices.
-
has_local
(self: block.operator.OperatorArrayDes, arg0: int) → bool¶ Query whether the element is non-zero in local storage. The parameters are site indices.
-
local_element
(self: block.operator.OperatorArrayDes, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given site indices (in local storage).
-
local_element_linear
(self: block.operator.OperatorArrayDes, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in local storage).
-
local_indices
¶ A 2d array contains the site indices of non-zero elements in local storage. It gives a map from flattened single index to multiple site indices (which is represented as an array).
-
n_global_nz
¶ Number of non-zero elements in global storage.
-
n_local_nz
¶ Number of non-zero elements in local storage.
-
op_string
¶ Name of the type of operators contained in this array.
-
-
class
block.operator.
OperatorArrayDesCre
(*args, **kwargs)¶ Bases:
block.operator.OperatorArrayBase
An array of DesCre operators defined at different sites.
-
global_element_linear
(self: block.operator.OperatorArrayDesCre, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in global storage).
-
global_indices
¶ A 1d array contains the site indices of non-zero elements (in local or global storage). It gives a map from flattened single index to multiple site indices. Then this array itself is flattened.
-
has_global
(self: block.operator.OperatorArrayDesCre, arg0: int, arg1: int) → bool¶ Query whether the element is non-zero (in local or global storage). The parameters are site indices.
-
has_local
(self: block.operator.OperatorArrayDesCre, arg0: int, arg1: int) → bool¶ Query whether the element is non-zero in local storage. The parameters are site indices.
-
local_element
(self: block.operator.OperatorArrayDesCre, arg0: int, arg1: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given site indices (in local storage).
-
local_element_linear
(self: block.operator.OperatorArrayDesCre, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in local storage).
-
local_indices
¶ A 2d array contains the site indices of non-zero elements in local storage. It gives a map from flattened single index to multiple site indices (which is represented as an array).
-
n_global_nz
¶ Number of non-zero elements in global storage.
-
n_local_nz
¶ Number of non-zero elements in local storage.
-
op_string
¶ Name of the type of operators contained in this array.
-
-
class
block.operator.
OperatorArrayDesCreComp
(*args, **kwargs)¶ Bases:
block.operator.OperatorArrayBase
An array of DesCreComp operators defined at different sites.
-
global_element_linear
(self: block.operator.OperatorArrayDesCreComp, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in global storage).
-
global_indices
¶ A 1d array contains the site indices of non-zero elements (in local or global storage). It gives a map from flattened single index to multiple site indices. Then this array itself is flattened.
-
has_global
(self: block.operator.OperatorArrayDesCreComp, arg0: int, arg1: int) → bool¶ Query whether the element is non-zero (in local or global storage). The parameters are site indices.
-
has_local
(self: block.operator.OperatorArrayDesCreComp, arg0: int, arg1: int) → bool¶ Query whether the element is non-zero in local storage. The parameters are site indices.
-
local_element
(self: block.operator.OperatorArrayDesCreComp, arg0: int, arg1: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given site indices (in local storage).
-
local_element_linear
(self: block.operator.OperatorArrayDesCreComp, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in local storage).
-
local_indices
¶ A 2d array contains the site indices of non-zero elements in local storage. It gives a map from flattened single index to multiple site indices (which is represented as an array).
-
n_global_nz
¶ Number of non-zero elements in global storage.
-
n_local_nz
¶ Number of non-zero elements in local storage.
-
op_string
¶ Name of the type of operators contained in this array.
-
-
class
block.operator.
OperatorArrayDesDes
(*args, **kwargs)¶ Bases:
block.operator.OperatorArrayBase
An array of DesDes operators defined at different sites.
-
global_element_linear
(self: block.operator.OperatorArrayDesDes, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in global storage).
-
global_indices
¶ A 1d array contains the site indices of non-zero elements (in local or global storage). It gives a map from flattened single index to multiple site indices. Then this array itself is flattened.
-
has_global
(self: block.operator.OperatorArrayDesDes, arg0: int, arg1: int) → bool¶ Query whether the element is non-zero (in local or global storage). The parameters are site indices.
-
has_local
(self: block.operator.OperatorArrayDesDes, arg0: int, arg1: int) → bool¶ Query whether the element is non-zero in local storage. The parameters are site indices.
-
local_element
(self: block.operator.OperatorArrayDesDes, arg0: int, arg1: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given site indices (in local storage).
-
local_element_linear
(self: block.operator.OperatorArrayDesDes, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in local storage).
-
local_indices
¶ A 2d array contains the site indices of non-zero elements in local storage. It gives a map from flattened single index to multiple site indices (which is represented as an array).
-
n_global_nz
¶ Number of non-zero elements in global storage.
-
n_local_nz
¶ Number of non-zero elements in local storage.
-
op_string
¶ Name of the type of operators contained in this array.
-
-
class
block.operator.
OperatorArrayDesDesComp
(*args, **kwargs)¶ Bases:
block.operator.OperatorArrayBase
An array of DesDesComp operators defined at different sites.
-
global_element_linear
(self: block.operator.OperatorArrayDesDesComp, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in global storage).
-
global_indices
¶ A 1d array contains the site indices of non-zero elements (in local or global storage). It gives a map from flattened single index to multiple site indices. Then this array itself is flattened.
-
has_global
(self: block.operator.OperatorArrayDesDesComp, arg0: int, arg1: int) → bool¶ Query whether the element is non-zero (in local or global storage). The parameters are site indices.
-
has_local
(self: block.operator.OperatorArrayDesDesComp, arg0: int, arg1: int) → bool¶ Query whether the element is non-zero in local storage. The parameters are site indices.
-
local_element
(self: block.operator.OperatorArrayDesDesComp, arg0: int, arg1: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given site indices (in local storage).
-
local_element_linear
(self: block.operator.OperatorArrayDesDesComp, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in local storage).
-
local_indices
¶ A 2d array contains the site indices of non-zero elements in local storage. It gives a map from flattened single index to multiple site indices (which is represented as an array).
-
n_global_nz
¶ Number of non-zero elements in global storage.
-
n_local_nz
¶ Number of non-zero elements in local storage.
-
op_string
¶ Name of the type of operators contained in this array.
-
-
class
block.operator.
OperatorArrayHamiltonian
(*args, **kwargs)¶ Bases:
block.operator.OperatorArrayBase
An array of Hamiltonian operators defined at different sites.
-
global_element_linear
(self: block.operator.OperatorArrayHamiltonian, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in global storage).
-
global_indices
¶ A 1d array contains the site indices of non-zero elements (in local or global storage). It gives a map from flattened single index to multiple site indices. Then this array itself is flattened.
-
has_global
(self: block.operator.OperatorArrayHamiltonian) → bool¶ Query whether the element is non-zero (in local or global storage).
-
has_local
(self: block.operator.OperatorArrayHamiltonian) → bool¶ Query whether the element is non-zero in local storage.
-
local_element
(self: block.operator.OperatorArrayHamiltonian) → block.operator.VectorStackSparseMatrix¶ Get the array of operators (for different spin quantum numbers, in local storage).
-
local_element_linear
(self: block.operator.OperatorArrayHamiltonian, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in local storage).
-
local_indices
¶ A 2d array contains the site indices of non-zero elements in local storage. It gives a map from flattened single index to multiple site indices (which is represented as an array).
-
n_global_nz
¶ Number of non-zero elements in global storage.
-
n_local_nz
¶ Number of non-zero elements in local storage.
-
op_string
¶ Name of the type of operators contained in this array.
-
-
class
block.operator.
OperatorArrayOverlap
(*args, **kwargs)¶ Bases:
block.operator.OperatorArrayBase
An array of Overlap operators defined at different sites.
-
global_element_linear
(self: block.operator.OperatorArrayOverlap, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in global storage).
-
global_indices
¶ A 1d array contains the site indices of non-zero elements (in local or global storage). It gives a map from flattened single index to multiple site indices. Then this array itself is flattened.
-
has_global
(self: block.operator.OperatorArrayOverlap) → bool¶ Query whether the element is non-zero (in local or global storage).
-
has_local
(self: block.operator.OperatorArrayOverlap) → bool¶ Query whether the element is non-zero in local storage.
-
local_element
(self: block.operator.OperatorArrayOverlap) → block.operator.VectorStackSparseMatrix¶ Get the array of operators (for different spin quantum numbers, in local storage).
-
local_element_linear
(self: block.operator.OperatorArrayOverlap, arg0: int) → block.operator.VectorStackSparseMatrix¶ Get an array of operators (for different spin quantum numbers) defined for the given (flattened) linear index (in local storage).
-
local_indices
¶ A 2d array contains the site indices of non-zero elements in local storage. It gives a map from flattened single index to multiple site indices (which is represented as an array).
-
n_global_nz
¶ Number of non-zero elements in global storage.
-
n_local_nz
¶ Number of non-zero elements in local storage.
-
op_string
¶ Name of the type of operators contained in this array.
-
-
class
block.operator.
OperatorCre
(*args, **kwargs)¶ Bases:
block.operator.StackSparseMatrix
Block-sparse matrix. Non-zero blocks are identified by symmetry (quantum numbers) requirements and stored as
StackMatrix
objects
-
class
block.operator.
OperatorCreCre
(*args, **kwargs)¶ Bases:
block.operator.StackSparseMatrix
Block-sparse matrix. Non-zero blocks are identified by symmetry (quantum numbers) requirements and stored as
StackMatrix
objects
-
class
block.operator.
OperatorCreCreComp
(*args, **kwargs)¶ Bases:
block.operator.StackSparseMatrix
Block-sparse matrix. Non-zero blocks are identified by symmetry (quantum numbers) requirements and stored as
StackMatrix
objects
-
class
block.operator.
OperatorCreCreDesComp
(*args, **kwargs)¶ Bases:
block.operator.StackSparseMatrix
Block-sparse matrix. Non-zero blocks are identified by symmetry (quantum numbers) requirements and stored as
StackMatrix
objects
-
class
block.operator.
OperatorCreDes
(*args, **kwargs)¶ Bases:
block.operator.StackSparseMatrix
Block-sparse matrix. Non-zero blocks are identified by symmetry (quantum numbers) requirements and stored as
StackMatrix
objects
-
class
block.operator.
OperatorCreDesComp
(*args, **kwargs)¶ Bases:
block.operator.StackSparseMatrix
Block-sparse matrix. Non-zero blocks are identified by symmetry (quantum numbers) requirements and stored as
StackMatrix
objects
-
class
block.operator.
OperatorCreDesDesComp
(*args, **kwargs)¶ Bases:
block.operator.StackSparseMatrix
Block-sparse matrix. Non-zero blocks are identified by symmetry (quantum numbers) requirements and stored as
StackMatrix
objects
-
class
block.operator.
OperatorDes
(*args, **kwargs)¶ Bases:
block.operator.StackSparseMatrix
Block-sparse matrix. Non-zero blocks are identified by symmetry (quantum numbers) requirements and stored as
StackMatrix
objects
-
class
block.operator.
OperatorDesCre
(*args, **kwargs)¶ Bases:
block.operator.StackSparseMatrix
Block-sparse matrix. Non-zero blocks are identified by symmetry (quantum numbers) requirements and stored as
StackMatrix
objects
-
class
block.operator.
OperatorDesCreComp
(*args, **kwargs)¶ Bases:
block.operator.StackSparseMatrix
Block-sparse matrix. Non-zero blocks are identified by symmetry (quantum numbers) requirements and stored as
StackMatrix
objects
-
class
block.operator.
OperatorDesDes
(*args, **kwargs)¶ Bases:
block.operator.StackSparseMatrix
Block-sparse matrix. Non-zero blocks are identified by symmetry (quantum numbers) requirements and stored as
StackMatrix
objects
-
class
block.operator.
OperatorDesDesComp
(*args, **kwargs)¶ Bases:
block.operator.StackSparseMatrix
Block-sparse matrix. Non-zero blocks are identified by symmetry (quantum numbers) requirements and stored as
StackMatrix
objects
-
class
block.operator.
OperatorHamiltonian
(*args, **kwargs)¶ Bases:
block.operator.StackSparseMatrix
Block-sparse matrix. Non-zero blocks are identified by symmetry (quantum numbers) requirements and stored as
StackMatrix
objects
-
class
block.operator.
OperatorOverlap
(*args, **kwargs)¶ Bases:
block.operator.StackSparseMatrix
Block-sparse matrix. Non-zero blocks are identified by symmetry (quantum numbers) requirements and stored as
StackMatrix
objects
-
class
block.operator.
StackMatrix
(*args, **kwargs)¶ Bases:
object
Very simple Matrix class that provides a Matrix type interface for a double array. It does not own its own data.
Note that the C++ class used indices counting from 1. Here we count from 0. Row-major (C) storage.
-
cols
¶
-
ref
¶ A numpy.ndarray reference.
-
rows
¶
-
-
class
block.operator.
StackSparseMatrix
(*args, **kwargs)¶ Bases:
object
Block-sparse matrix. Non-zero blocks are identified by symmetry (quantum numbers) requirements and stored as
StackMatrix
objects-
allocate
(self: block.operator.StackSparseMatrix, arg0: block.symmetry.VectorStateInfo) → None¶
-
allocate_memory
(self: block.operator.StackSparseMatrix, arg0: int) → None¶
-
allowed
(self: block.operator.StackSparseMatrix, arg0: int, arg1: int) → bool¶
-
clear
(self: block.operator.StackSparseMatrix) → None¶
-
cols
¶
-
conjugacy
¶
-
deallocate
(self: block.operator.StackSparseMatrix) → None¶
-
deep_clear_copy
(self: block.operator.StackSparseMatrix, arg0: block.operator.StackSparseMatrix) → None¶
-
deep_copy
(self: block.operator.StackSparseMatrix, arg0: block.operator.StackSparseMatrix) → None¶
-
delta_quantum
¶ Allowed change of quantum numbers between states.
-
fermion
¶
-
get_scaling
(self: block.operator.StackSparseMatrix, leftq: block.symmetry.SpinQuantum, rightq: block.symmetry.SpinQuantum) → float¶
-
initialized
¶
-
map_to_non_zero_blocks
¶ A map from pair of bra and ket indices, to the index in
StackSparseMatrix.non_zero_blocks
.
-
non_zero_blocks
¶ A list of non zero blocks. Each element in the list is a pair of a pair of bra and ket indices, and
StackMatrix
.
-
operator_element
(self: block.operator.StackSparseMatrix, arg0: int, arg1: int) → block.operator.StackMatrix¶
-
ref
¶ A numpy.ndarray reference.
-
rows
¶
-
shallow_copy
(self: block.operator.StackSparseMatrix, arg0: block.operator.StackSparseMatrix) → None¶
-
symm_scale
¶
-
total_memory
¶
-
transpose
(self: block.operator.StackSparseMatrix) → SpinAdapted::StackTransposeview¶
-
-
class
block.operator.
StackTransposeView
(*args, **kwargs)¶ Bases:
block.operator.StackSparseMatrix
Block-sparse matrix. Non-zero blocks are identified by symmetry (quantum numbers) requirements and stored as
StackMatrix
objects
-
class
block.operator.
VectorCre
(*args, **kwargs)¶ Bases:
object
-
append
(self: block.operator.VectorCre, x: block.operator.OperatorCre) → None¶ Add an item to the end of the list
-
count
(self: block.operator.VectorCre, x: block.operator.OperatorCre) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
- extend(self: block.operator.VectorCre, L: block.operator.VectorCre) -> None
Extend the list by appending all the items in the given list
- extend(self: block.operator.VectorCre, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: block.operator.VectorCre, i: int, x: block.operator.OperatorCre) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
- pop(self: block.operator.VectorCre) -> block.operator.OperatorCre
Remove and return the last item
- pop(self: block.operator.VectorCre, i: int) -> block.operator.OperatorCre
Remove and return the item at index
i
-
remove
(self: block.operator.VectorCre, x: block.operator.OperatorCre) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
class
block.operator.
VectorCreCre
(*args, **kwargs)¶ Bases:
object
-
append
(self: block.operator.VectorCreCre, x: block.operator.OperatorCreCre) → None¶ Add an item to the end of the list
-
count
(self: block.operator.VectorCreCre, x: block.operator.OperatorCreCre) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
- extend(self: block.operator.VectorCreCre, L: block.operator.VectorCreCre) -> None
Extend the list by appending all the items in the given list
- extend(self: block.operator.VectorCreCre, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: block.operator.VectorCreCre, i: int, x: block.operator.OperatorCreCre) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
- pop(self: block.operator.VectorCreCre) -> block.operator.OperatorCreCre
Remove and return the last item
- pop(self: block.operator.VectorCreCre, i: int) -> block.operator.OperatorCreCre
Remove and return the item at index
i
-
remove
(self: block.operator.VectorCreCre, x: block.operator.OperatorCreCre) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
class
block.operator.
VectorCreCreComp
(*args, **kwargs)¶ Bases:
object
-
append
(self: block.operator.VectorCreCreComp, x: block.operator.OperatorCreCreComp) → None¶ Add an item to the end of the list
-
count
(self: block.operator.VectorCreCreComp, x: block.operator.OperatorCreCreComp) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
- extend(self: block.operator.VectorCreCreComp, L: block.operator.VectorCreCreComp) -> None
Extend the list by appending all the items in the given list
- extend(self: block.operator.VectorCreCreComp, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: block.operator.VectorCreCreComp, i: int, x: block.operator.OperatorCreCreComp) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
- pop(self: block.operator.VectorCreCreComp) -> block.operator.OperatorCreCreComp
Remove and return the last item
- pop(self: block.operator.VectorCreCreComp, i: int) -> block.operator.OperatorCreCreComp
Remove and return the item at index
i
-
remove
(self: block.operator.VectorCreCreComp, x: block.operator.OperatorCreCreComp) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
class
block.operator.
VectorCreCreDesComp
(*args, **kwargs)¶ Bases:
object
-
append
(self: block.operator.VectorCreCreDesComp, x: block.operator.OperatorCreCreDesComp) → None¶ Add an item to the end of the list
-
count
(self: block.operator.VectorCreCreDesComp, x: block.operator.OperatorCreCreDesComp) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
- extend(self: block.operator.VectorCreCreDesComp, L: block.operator.VectorCreCreDesComp) -> None
Extend the list by appending all the items in the given list
- extend(self: block.operator.VectorCreCreDesComp, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: block.operator.VectorCreCreDesComp, i: int, x: block.operator.OperatorCreCreDesComp) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
- pop(self: block.operator.VectorCreCreDesComp) -> block.operator.OperatorCreCreDesComp
Remove and return the last item
- pop(self: block.operator.VectorCreCreDesComp, i: int) -> block.operator.OperatorCreCreDesComp
Remove and return the item at index
i
-
remove
(self: block.operator.VectorCreCreDesComp, x: block.operator.OperatorCreCreDesComp) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
class
block.operator.
VectorCreDes
(*args, **kwargs)¶ Bases:
object
-
append
(self: block.operator.VectorCreDes, x: block.operator.OperatorCreDes) → None¶ Add an item to the end of the list
-
count
(self: block.operator.VectorCreDes, x: block.operator.OperatorCreDes) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
- extend(self: block.operator.VectorCreDes, L: block.operator.VectorCreDes) -> None
Extend the list by appending all the items in the given list
- extend(self: block.operator.VectorCreDes, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: block.operator.VectorCreDes, i: int, x: block.operator.OperatorCreDes) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
- pop(self: block.operator.VectorCreDes) -> block.operator.OperatorCreDes
Remove and return the last item
- pop(self: block.operator.VectorCreDes, i: int) -> block.operator.OperatorCreDes
Remove and return the item at index
i
-
remove
(self: block.operator.VectorCreDes, x: block.operator.OperatorCreDes) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
class
block.operator.
VectorCreDesComp
(*args, **kwargs)¶ Bases:
object
-
append
(self: block.operator.VectorCreDesComp, x: block.operator.OperatorCreDesComp) → None¶ Add an item to the end of the list
-
count
(self: block.operator.VectorCreDesComp, x: block.operator.OperatorCreDesComp) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
- extend(self: block.operator.VectorCreDesComp, L: block.operator.VectorCreDesComp) -> None
Extend the list by appending all the items in the given list
- extend(self: block.operator.VectorCreDesComp, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: block.operator.VectorCreDesComp, i: int, x: block.operator.OperatorCreDesComp) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
- pop(self: block.operator.VectorCreDesComp) -> block.operator.OperatorCreDesComp
Remove and return the last item
- pop(self: block.operator.VectorCreDesComp, i: int) -> block.operator.OperatorCreDesComp
Remove and return the item at index
i
-
remove
(self: block.operator.VectorCreDesComp, x: block.operator.OperatorCreDesComp) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
class
block.operator.
VectorCreDesDesComp
(*args, **kwargs)¶ Bases:
object
-
append
(self: block.operator.VectorCreDesDesComp, x: block.operator.OperatorCreDesDesComp) → None¶ Add an item to the end of the list
-
count
(self: block.operator.VectorCreDesDesComp, x: block.operator.OperatorCreDesDesComp) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
- extend(self: block.operator.VectorCreDesDesComp, L: block.operator.VectorCreDesDesComp) -> None
Extend the list by appending all the items in the given list
- extend(self: block.operator.VectorCreDesDesComp, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: block.operator.VectorCreDesDesComp, i: int, x: block.operator.OperatorCreDesDesComp) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
- pop(self: block.operator.VectorCreDesDesComp) -> block.operator.OperatorCreDesDesComp
Remove and return the last item
- pop(self: block.operator.VectorCreDesDesComp, i: int) -> block.operator.OperatorCreDesDesComp
Remove and return the item at index
i
-
remove
(self: block.operator.VectorCreDesDesComp, x: block.operator.OperatorCreDesDesComp) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
class
block.operator.
VectorDes
(*args, **kwargs)¶ Bases:
object
-
append
(self: block.operator.VectorDes, x: block.operator.OperatorDes) → None¶ Add an item to the end of the list
-
count
(self: block.operator.VectorDes, x: block.operator.OperatorDes) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
- extend(self: block.operator.VectorDes, L: block.operator.VectorDes) -> None
Extend the list by appending all the items in the given list
- extend(self: block.operator.VectorDes, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: block.operator.VectorDes, i: int, x: block.operator.OperatorDes) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
- pop(self: block.operator.VectorDes) -> block.operator.OperatorDes
Remove and return the last item
- pop(self: block.operator.VectorDes, i: int) -> block.operator.OperatorDes
Remove and return the item at index
i
-
remove
(self: block.operator.VectorDes, x: block.operator.OperatorDes) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
class
block.operator.
VectorDesCre
(*args, **kwargs)¶ Bases:
object
-
append
(self: block.operator.VectorDesCre, x: block.operator.OperatorDesCre) → None¶ Add an item to the end of the list
-
count
(self: block.operator.VectorDesCre, x: block.operator.OperatorDesCre) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
- extend(self: block.operator.VectorDesCre, L: block.operator.VectorDesCre) -> None
Extend the list by appending all the items in the given list
- extend(self: block.operator.VectorDesCre, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: block.operator.VectorDesCre, i: int, x: block.operator.OperatorDesCre) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
- pop(self: block.operator.VectorDesCre) -> block.operator.OperatorDesCre
Remove and return the last item
- pop(self: block.operator.VectorDesCre, i: int) -> block.operator.OperatorDesCre
Remove and return the item at index
i
-
remove
(self: block.operator.VectorDesCre, x: block.operator.OperatorDesCre) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
class
block.operator.
VectorDesCreComp
(*args, **kwargs)¶ Bases:
object
-
append
(self: block.operator.VectorDesCreComp, x: block.operator.OperatorDesCreComp) → None¶ Add an item to the end of the list
-
count
(self: block.operator.VectorDesCreComp, x: block.operator.OperatorDesCreComp) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
- extend(self: block.operator.VectorDesCreComp, L: block.operator.VectorDesCreComp) -> None
Extend the list by appending all the items in the given list
- extend(self: block.operator.VectorDesCreComp, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: block.operator.VectorDesCreComp, i: int, x: block.operator.OperatorDesCreComp) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
- pop(self: block.operator.VectorDesCreComp) -> block.operator.OperatorDesCreComp
Remove and return the last item
- pop(self: block.operator.VectorDesCreComp, i: int) -> block.operator.OperatorDesCreComp
Remove and return the item at index
i
-
remove
(self: block.operator.VectorDesCreComp, x: block.operator.OperatorDesCreComp) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
class
block.operator.
VectorDesDes
(*args, **kwargs)¶ Bases:
object
-
append
(self: block.operator.VectorDesDes, x: block.operator.OperatorDesDes) → None¶ Add an item to the end of the list
-
count
(self: block.operator.VectorDesDes, x: block.operator.OperatorDesDes) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
- extend(self: block.operator.VectorDesDes, L: block.operator.VectorDesDes) -> None
Extend the list by appending all the items in the given list
- extend(self: block.operator.VectorDesDes, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: block.operator.VectorDesDes, i: int, x: block.operator.OperatorDesDes) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
- pop(self: block.operator.VectorDesDes) -> block.operator.OperatorDesDes
Remove and return the last item
- pop(self: block.operator.VectorDesDes, i: int) -> block.operator.OperatorDesDes
Remove and return the item at index
i
-
remove
(self: block.operator.VectorDesDes, x: block.operator.OperatorDesDes) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
class
block.operator.
VectorDesDesComp
(*args, **kwargs)¶ Bases:
object
-
append
(self: block.operator.VectorDesDesComp, x: block.operator.OperatorDesDesComp) → None¶ Add an item to the end of the list
-
count
(self: block.operator.VectorDesDesComp, x: block.operator.OperatorDesDesComp) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
- extend(self: block.operator.VectorDesDesComp, L: block.operator.VectorDesDesComp) -> None
Extend the list by appending all the items in the given list
- extend(self: block.operator.VectorDesDesComp, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: block.operator.VectorDesDesComp, i: int, x: block.operator.OperatorDesDesComp) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
- pop(self: block.operator.VectorDesDesComp) -> block.operator.OperatorDesDesComp
Remove and return the last item
- pop(self: block.operator.VectorDesDesComp, i: int) -> block.operator.OperatorDesDesComp
Remove and return the item at index
i
-
remove
(self: block.operator.VectorDesDesComp, x: block.operator.OperatorDesDesComp) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
class
block.operator.
VectorHamiltonian
(*args, **kwargs)¶ Bases:
object
-
append
(self: block.operator.VectorHamiltonian, x: block.operator.OperatorHamiltonian) → None¶ Add an item to the end of the list
-
count
(self: block.operator.VectorHamiltonian, x: block.operator.OperatorHamiltonian) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
- extend(self: block.operator.VectorHamiltonian, L: block.operator.VectorHamiltonian) -> None
Extend the list by appending all the items in the given list
- extend(self: block.operator.VectorHamiltonian, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: block.operator.VectorHamiltonian, i: int, x: block.operator.OperatorHamiltonian) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
- pop(self: block.operator.VectorHamiltonian) -> block.operator.OperatorHamiltonian
Remove and return the last item
- pop(self: block.operator.VectorHamiltonian, i: int) -> block.operator.OperatorHamiltonian
Remove and return the item at index
i
-
remove
(self: block.operator.VectorHamiltonian, x: block.operator.OperatorHamiltonian) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
class
block.operator.
VectorNonZeroStackMatrix
(*args, **kwargs)¶ Bases:
object
-
append
(self: block.operator.VectorNonZeroStackMatrix, x: Tuple[Tuple[int, int], block.operator.StackMatrix]) → None¶ Add an item to the end of the list
-
extend
(*args, **kwargs)¶ Overloaded function.
- extend(self: block.operator.VectorNonZeroStackMatrix, L: block.operator.VectorNonZeroStackMatrix) -> None
Extend the list by appending all the items in the given list
- extend(self: block.operator.VectorNonZeroStackMatrix, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: block.operator.VectorNonZeroStackMatrix, i: int, x: Tuple[Tuple[int, int], block.operator.StackMatrix]) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
- pop(self: block.operator.VectorNonZeroStackMatrix) -> Tuple[Tuple[int, int], block.operator.StackMatrix]
Remove and return the last item
- pop(self: block.operator.VectorNonZeroStackMatrix, i: int) -> Tuple[Tuple[int, int], block.operator.StackMatrix]
Remove and return the item at index
i
-
-
class
block.operator.
VectorOperatorArrayBase
(*args, **kwargs)¶ Bases:
object
-
append
(self: block.operator.VectorOperatorArrayBase, x: block.operator.OperatorArrayBase) → None¶ Add an item to the end of the list
-
count
(self: block.operator.VectorOperatorArrayBase, x: block.operator.OperatorArrayBase) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
- extend(self: block.operator.VectorOperatorArrayBase, L: block.operator.VectorOperatorArrayBase) -> None
Extend the list by appending all the items in the given list
- extend(self: block.operator.VectorOperatorArrayBase, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: block.operator.VectorOperatorArrayBase, i: int, x: block.operator.OperatorArrayBase) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
- pop(self: block.operator.VectorOperatorArrayBase) -> block.operator.OperatorArrayBase
Remove and return the last item
- pop(self: block.operator.VectorOperatorArrayBase, i: int) -> block.operator.OperatorArrayBase
Remove and return the item at index
i
-
remove
(self: block.operator.VectorOperatorArrayBase, x: block.operator.OperatorArrayBase) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
class
block.operator.
VectorOverlap
(*args, **kwargs)¶ Bases:
object
-
append
(self: block.operator.VectorOverlap, x: block.operator.OperatorOverlap) → None¶ Add an item to the end of the list
-
count
(self: block.operator.VectorOverlap, x: block.operator.OperatorOverlap) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
- extend(self: block.operator.VectorOverlap, L: block.operator.VectorOverlap) -> None
Extend the list by appending all the items in the given list
- extend(self: block.operator.VectorOverlap, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: block.operator.VectorOverlap, i: int, x: block.operator.OperatorOverlap) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
- pop(self: block.operator.VectorOverlap) -> block.operator.OperatorOverlap
Remove and return the last item
- pop(self: block.operator.VectorOverlap, i: int) -> block.operator.OperatorOverlap
Remove and return the item at index
i
-
remove
(self: block.operator.VectorOverlap, x: block.operator.OperatorOverlap) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
class
block.operator.
VectorStackSparseMatrix
(*args, **kwargs)¶ Bases:
object
-
append
(self: block.operator.VectorStackSparseMatrix, x: block.operator.StackSparseMatrix) → None¶ Add an item to the end of the list
-
count
(self: block.operator.VectorStackSparseMatrix, x: block.operator.StackSparseMatrix) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
- extend(self: block.operator.VectorStackSparseMatrix, L: block.operator.VectorStackSparseMatrix) -> None
Extend the list by appending all the items in the given list
- extend(self: block.operator.VectorStackSparseMatrix, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: block.operator.VectorStackSparseMatrix, i: int, x: block.operator.StackSparseMatrix) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
- pop(self: block.operator.VectorStackSparseMatrix) -> block.operator.StackSparseMatrix
Remove and return the last item
- pop(self: block.operator.VectorStackSparseMatrix, i: int) -> block.operator.StackSparseMatrix
Remove and return the item at index
i
-
remove
(self: block.operator.VectorStackSparseMatrix, x: block.operator.StackSparseMatrix) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
class
block.operator.
VectorWavefunction
(*args, **kwargs)¶ Bases:
object
-
append
(self: block.operator.VectorWavefunction, x: block.operator.Wavefunction) → None¶ Add an item to the end of the list
-
extend
(*args, **kwargs)¶ Overloaded function.
- extend(self: block.operator.VectorWavefunction, L: block.operator.VectorWavefunction) -> None
Extend the list by appending all the items in the given list
- extend(self: block.operator.VectorWavefunction, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: block.operator.VectorWavefunction, i: int, x: block.operator.Wavefunction) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
- pop(self: block.operator.VectorWavefunction) -> block.operator.Wavefunction
Remove and return the last item
- pop(self: block.operator.VectorWavefunction, i: int) -> block.operator.Wavefunction
Remove and return the item at index
i
-
-
class
block.operator.
Wavefunction
(*args, **kwargs)¶ Bases:
block.operator.StackSparseMatrix
Block-sparse matrix. Non-zero blocks are identified by symmetry (quantum numbers) requirements and stored as
StackMatrix
objects-
copy_data
(self: block.operator.Wavefunction, arg0: block.operator.Wavefunction) → None¶
-
initialize
(self: block.operator.Wavefunction, arg0: block.symmetry.VectorSpinQuantum, arg1: block.symmetry.StateInfo, arg2: block.symmetry.StateInfo, arg3: bool) → None¶
-
initialize_from
(self: block.operator.Wavefunction, arg0: block.operator.Wavefunction) → None¶
-
onedot
¶
-
save_wavefunction_info
(self: block.operator.Wavefunction, arg0: block.symmetry.StateInfo, arg1: block.VectorInt, arg2: int) → None¶
-
-
block.operator.
multiply_with_own_transpose
(arg0: block.operator.StackSparseMatrix, arg1: block.operator.StackSparseMatrix, arg2: float) → None¶
block.symmetry¶
Classes for handling symmetries and quantum numbers.
-
class
block.symmetry.
IrrepSpace
(*args, **kwargs)¶ Bases:
object
A wrapper class for molecular point group symmetry irrep.
-
irrep
¶
-
-
class
block.symmetry.
SpinQuantum
(*args, **kwargs)¶ Bases:
object
A collection of quantum numbers associated with a specific state (irreducible representation). One such collection defines a specific sector in the state space.
-
n
¶ Particle number.
-
s
¶ Irreducible representation for spin symmetry (\(S\) or \(S_z\)).
-
symm
¶ Irreducible representation for molecular point group symmetry.
-
-
class
block.symmetry.
SpinSpace
(*args, **kwargs)¶ Bases:
object
A wrapper class for the spin irrep.
In \(S_z\) symmetry, the irrep is \(2S_z\). In SU(2) symmetry, the irrep is \(2S\). The behaviour is toggled checking
block.io.Global.dmrginp.spin_adapted
.-
irrep
¶
-
-
class
block.symmetry.
StateInfo
(*args, **kwargs)¶ Bases:
object
A collection of symmetry sectors. Each sector can contain several internal states (which can no longer be differentiated by symmetries), the number of which is also stored.
-
collect_quanta
(self: block.symmetry.StateInfo) → None¶
-
copy
(self: block.symmetry.StateInfo) → block.symmetry.StateInfo¶
-
left_state_info
¶
-
left_unmap_quanta
¶ Index in left StateInfo, for each combined state.
-
n_states
¶ Number of states per (combined) quantum number.
-
n_total_states
¶
-
old_to_new_state
¶ old_to_new_state[i] = [k1, k2, k3, …] where i is the index in the collected StateInfo and k’s are indices in the uncollected StateInfo.
-
quanta
¶ Quantum numbers for a set of sites.
-
right_state_info
¶
-
right_unmap_quanta
¶ Index in right StateInfo, for each combined state.
-
set_left_state_info
(self: block.symmetry.StateInfo, arg0: block.symmetry.StateInfo) → None¶
-
set_right_state_info
(self: block.symmetry.StateInfo, arg0: block.symmetry.StateInfo) → None¶
-
set_uncollected_state_info
(self: block.symmetry.StateInfo, arg0: block.symmetry.StateInfo) → None¶
-
uncollected_state_info
¶
-
-
class
block.symmetry.
VectorSpinQuantum
(*args, **kwargs)¶ Bases:
object
-
append
(self: block.symmetry.VectorSpinQuantum, x: block.symmetry.SpinQuantum) → None¶ Add an item to the end of the list
-
count
(self: block.symmetry.VectorSpinQuantum, x: block.symmetry.SpinQuantum) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
- extend(self: block.symmetry.VectorSpinQuantum, L: block.symmetry.VectorSpinQuantum) -> None
Extend the list by appending all the items in the given list
- extend(self: block.symmetry.VectorSpinQuantum, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: block.symmetry.VectorSpinQuantum, i: int, x: block.symmetry.SpinQuantum) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
- pop(self: block.symmetry.VectorSpinQuantum) -> block.symmetry.SpinQuantum
Remove and return the last item
- pop(self: block.symmetry.VectorSpinQuantum, i: int) -> block.symmetry.SpinQuantum
Remove and return the item at index
i
-
remove
(self: block.symmetry.VectorSpinQuantum, x: block.symmetry.SpinQuantum) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
class
block.symmetry.
VectorStateInfo
(*args, **kwargs)¶ Bases:
object
-
append
(self: block.symmetry.VectorStateInfo, x: block.symmetry.StateInfo) → None¶ Add an item to the end of the list
-
count
(self: block.symmetry.VectorStateInfo, x: block.symmetry.StateInfo) → int¶ Return the number of times
x
appears in the list
-
extend
(*args, **kwargs)¶ Overloaded function.
- extend(self: block.symmetry.VectorStateInfo, L: block.symmetry.VectorStateInfo) -> None
Extend the list by appending all the items in the given list
- extend(self: block.symmetry.VectorStateInfo, L: iterable) -> None
Extend the list by appending all the items in the given list
-
insert
(self: block.symmetry.VectorStateInfo, i: int, x: block.symmetry.StateInfo) → None¶ Insert an item at a given position.
-
pop
(*args, **kwargs)¶ Overloaded function.
- pop(self: block.symmetry.VectorStateInfo) -> block.symmetry.StateInfo
Remove and return the last item
- pop(self: block.symmetry.VectorStateInfo, i: int) -> block.symmetry.StateInfo
Remove and return the item at index
i
-
remove
(self: block.symmetry.VectorStateInfo, x: block.symmetry.StateInfo) → None¶ Remove the first item from the list whose value is x. It is an error if there is no such item.
-
-
block.symmetry.
get_commute_parity
(a: block.symmetry.SpinQuantum, b: block.symmetry.SpinQuantum, c: block.symmetry.SpinQuantum) → float¶
-
block.symmetry.
state_tensor_product
(arg0: block.symmetry.StateInfo, arg1: block.symmetry.StateInfo) → block.symmetry.StateInfo¶
-
block.symmetry.
state_tensor_product_target
(arg0: block.symmetry.StateInfo, arg1: block.symmetry.StateInfo) → block.symmetry.StateInfo¶
-
block.symmetry.
wigner_9j
(arg0: int, arg1: int, arg2: int, arg3: int, arg4: int, arg5: int, arg6: int, arg7: int, arg8: int) → float¶
block.rev¶
Revised Block functions.
-
block.rev.
product
(a: block.operator.StackSparseMatrix, b: block.operator.StackSparseMatrix, c: block.operator.StackSparseMatrix, state_info: block.symmetry.StateInfo, scale: float = 1.0) → None¶
-
block.rev.
tensor_dot_product
(a: block.operator.StackSparseMatrix, b: block.operator.StackSparseMatrix) → float¶
-
block.rev.
tensor_precondition
(a: block.operator.StackSparseMatrix, e: float, diag: block.DiagonalMatrix) → None¶
-
block.rev.
tensor_product
(a: block.operator.StackSparseMatrix, b: block.operator.StackSparseMatrix, c: block.operator.StackSparseMatrix, state_info: block.symmetry.VectorStateInfo, scale: float = 1.0) → None¶
-
block.rev.
tensor_product_diagonal
(a: block.operator.StackSparseMatrix, b: block.operator.StackSparseMatrix, c: block.DiagonalMatrix, state_info: block.symmetry.VectorStateInfo, scale: float = 1.0) → None¶
-
block.rev.
tensor_product_multiply
(a: block.operator.StackSparseMatrix, b: block.operator.StackSparseMatrix, c: block.operator.Wavefunction, v: block.operator.Wavefunction, state_info: block.symmetry.VectorStateInfo, op_q: block.symmetry.SpinQuantum, scale: float) → None¶
-
block.rev.
tensor_rotate
(a: block.operator.StackSparseMatrix, c: block.operator.StackSparseMatrix, state_info: block.symmetry.VectorStateInfo, rotate_matrices: block.VectorVectorMatrix, scale: float = 1.0) → None¶
-
block.rev.
tensor_scale
(scale: float, a: block.operator.StackSparseMatrix) → None¶
-
block.rev.
tensor_scale_add
(scale: float, a: block.operator.StackSparseMatrix, c: block.operator.StackSparseMatrix, state_info: block.symmetry.VectorStateInfo) → None¶
-
block.rev.
tensor_scale_add_no_trans
(scale: float, a: block.operator.StackSparseMatrix, c: block.operator.StackSparseMatrix) → None¶
-
block.rev.
tensor_trace
(a: block.operator.StackSparseMatrix, c: block.operator.StackSparseMatrix, state_info: block.symmetry.VectorStateInfo, trace_right: bool, scale: float = 1.0) → None¶
-
block.rev.
tensor_trace_diagonal
(a: block.operator.StackSparseMatrix, c: block.DiagonalMatrix, state_info: block.symmetry.VectorStateInfo, trace_right: bool, scale: float = 1.0) → None¶
-
block.rev.
tensor_trace_multiply
(a: block.operator.StackSparseMatrix, c: block.operator.Wavefunction, v: block.operator.Wavefunction, state_info: block.symmetry.StateInfo, trace_right: bool, scale: float) → None¶
block.data_page¶
Revised data page functions.
-
block.data_page.
activate_data_page
(ip: int) → None¶
-
block.data_page.
get_data_page_pointer
(ip: int) → int¶
-
block.data_page.
init_data_pages
(n_pages: int) → None¶
-
block.data_page.
load_data_page
(ip: int, filename: str) → None¶
-
block.data_page.
release_data_pages
() → None¶
-
block.data_page.
save_data_page
(ip: int, filename: str) → None¶
-
block.data_page.
set_data_page_pointer
(ip: int, offset: int) → None¶