Calculation Configurations#
- class renormalizer.utils.configs.CompressConfig(criteria: Union[CompressCriteria, str] = CompressCriteria.threshold, threshold: float = 0.001, max_bonddim: int = 32, vmethod: str = '2site', vprocedure=None, vrtol=1e-05, vguess_m=(5, 5), dump_matrix_size=inf, dump_matrix_dir='./', ofs: Optional[OFS] = None, ofs_swap_jw: bool = False)[source]#
Bases:
objectMPS/MPO Compress Configuration.
- Parameters:
criteria (
CompressCriteria, optional) – The criteria for compression. Default isCompressCriteria.threshold.threshold (float, optional) – The threshold to keep states if
criteriais set toCompressCriteria.thresholdorCompressCriteria.both. Default is \(10^{-3}\).max_bonddim (int, optional) – Maximum bond dimension
Munder various bond dimension distributions. Default is 32.vmethod (str, optional) –
The algorithm used in variational compression. The default is
2site.1site: optimize one site at a time during sweep.2site: optimize two site at a time during sweep.
Note
It is recommended to use the 2site algorithm in variational optimization, though 1site algorithm is much cheaper. The reason is that 1site algorithm is easy to stuck into local minima while 2site algorithm is more robust. For complicated Hamiltonian, the problem is severer. The renormalized basis selection rule used here to partly solve the local minimal problem is according to Chan. J. Chem. Phys. 2004, 120, 3172. For efficiency, you could use 2site algorithm for several sweeps and then switch to 1site algorithm to converge the final mps.
vprocedure (list, optional) –
The procedure to do variational compression. In the sublist, the first element is a CompressConfig, which controls the compression in each sweep. For backward compatibility, it can also be an int, which indicates CompressCriteria.fixed with the int as the max_bonddim. The Default is
if vmethod == "1site": vprocedure = [[max_bonddim,1.0],[max_bonddim,0.7], [max_bonddim,0.5],[max_bonddim,0.3], [max_bonddim,0.1]] + [[max_bonddim,0],]*10 else: vprocedure = [[max_bonddim,0.5],[max_bonddim,0.3], [max_bonddim,0.1]] + [[max_bonddim,0],]*10
vrtol (float, optional) – The threshold of convergence in variational compression. Default is \(10^{-5}\).
vguess_m (tuple(int), optional) – The bond dimension of
compressed_mpoandcompressed_mpsto construct the initial guesscompressed_mpo @ compressed_mpsinMatrixProduct.variational_compress. The default is (5,5).dump_matrix_size (int or float, optional) –
The total bytes threshold for dumping matrix into disks. Every local site matrix in the MPS/MPO with a size larger than the specified size will be moved from memory to the disk at
dump_matrix_dir. The matrix will be moved back to memory upon access. The dumped matrices on the disks will be removed once the MPS/MPO is garbage-collected.Note
If
dump_matrix_sizeis set and the program exits abnormally, it is possible that the dumped matrices are not deleted automatically. A common case when this can happen is that the program is killed by a signal. In such cases it is recommended to check and cleandump_matrix_dirafter the exit of the program since the dumped matrices may take a lot of disk space.dump_matrix_dir (str, optional) – The directory to dump matrix when matrix is larger than
dump_matrix_size.ofs (
OFS, optional) – Whether optimize the DOF ordering by OFS. The default value isNonewhich means does not perform OFS.ofs_swap_jw (bool, optional) – Whether swap the Jordan-Wigner transformation ordering when OFS is enabled. Set to
Truefor and only for ab initio Hamiltonian constructed by the experimentalrenormalizer.model.h_qc.qc_model. Default isFalse.
See also
CompressCriteriaCompression criteria
renormalizer.mps.mp.MatrixProduct.variational_compressVariational compression
renormalizer.mps.Mpo.contractcompress
mpo @ mps/mpdm/mpo
- property bonddim_should_set#
- copy() CompressConfig[source]#
- property threshold#
- update(other: CompressConfig)[source]#
- class renormalizer.utils.configs.CompressCriteria(value)[source]#
Bases:
EnumCriteria for compression.
- both = 'both'#
Compress combining
thresholdandfixed. The bond dimension for the two criteria are both calculated and the smaller one is used.
- fixed = 'fixed'#
Compress depending on pre-set fixed bond dimension.
- threshold = 'threshold'#
Compress depending on pre-set threshold. States with singular value smaller than the threshold are discarded.
- class renormalizer.utils.configs.EvolveConfig(method: Union[EvolveMethod, str] = EvolveMethod.prop_and_compress, adaptive=False, guess_dt=0.1, adaptive_rtol=0.0005, taylor_order: Optional[int] = None, rk_solver='C_RK4', reg_epsilon=1e-10, ivp_rtol=1e-05, ivp_atol=1e-08, ivp_solver='krylov', force_ovlp=True)[source]#
Bases:
object- property is_tdvp#
- class renormalizer.utils.configs.EvolveMethod(value)[source]#
Bases:
EnumTime evolution methods.
- prop_and_compress = 'P&C'#
- prop_and_compress_tdrk = 'P&C TD RK'#
- prop_and_compress_tdrk4 = 'P&C TD RK4'#
- tdvp_mu_cmf = 'TDVP Matrix Unfolding Constant Mean Field'#
- tdvp_mu_vmf = 'TDVP Matrix Unfolding Variable Mean Field'#
- tdvp_ps = 'TDVP PS one-site'#
- tdvp_ps2 = 'TDVP PS two-site'#
- tdvp_vmf = 'TDVP Variable Mean Field'#
- class renormalizer.utils.configs.OFS(value)[source]#
Bases:
EnumOn the fly swapping criteria
- ofs_d = 'OFS-D'#
- ofs_debug = 'OFS-Debug'#
- ofs_ds = 'OFS-D/S'#
- ofs_s = 'OFS-S'#
- class renormalizer.utils.configs.OptimizeConfig(procedure=None)[source]#
Bases:
objectDMRG ground state algorithm optimization configuration
The procedure to do ground state optimization. In the sublist, the first element is a CompressConfig, which controls the compression in each sweep. For backward compatibility, it can also be an int, which indicates CompressCriteria.fixed with the int as the max_bonddim. The second element is the percent to choose the renormalied basis from each symmetry block to avoid trapping into local minimum.