[0.6.0] - 2020-05-16
Release Notes
This release contains a major update of the documentation, which is now hosted by “Read the Docs” at https://tenpy.readthedocs.io/. Update your bookmark :-)
Apart from that, this release introduces a format how to save and load data (in particular TeNPy classes) to HDF5 files.
See Saving to disk: input/output for more details.
To use that feature, you need to install the h5py package (and therefore some version of the HDF5 library).
This is easy with anaconda, conda install h5py
, but might be cumbersome on your local computing cluster.
(However, many university computing clusters have some version of HDF5 installed already. Check with your local sysadmin.)
Moreover, we changed how we read out parameter dictionaries - instead of the get_parameter() function,
we have now a Config
class which behaves like a dictionary, you can simpy use
options.get(key, default)
for model parameters - as you would do for a python dictionary.
Changelog
Backwards incompatible changes
Created a class
Config
to replace Python-native parameter dictionaries and add some useful functionality. Old code usingtenpy.tools.params.get_parameter()
andtenpy.tools.params.unused_parameters()
still works as before, but raises a warning, and should be replaced. For example, if you defined your own models, you should replace callsget_parameter(model_params, "key", "default_value", "ModelName")
withmodel_params.get("key", "default_value")
, the latter syntax being what you would use for a normal python dictionary as well.Renamed the following class parameter dictionaries to simply options for more consitency. Old code using the class attributes should still work (since we provide property aliases), but raises warnings. Note that this affects also derived classes (for example the
TwoSiteDMRGEngine
).tenpy.algorithms.dmrg.DMRGEngine.DMRG_params
(was already renamed to engine_params in versin 0.5.0)tenpy.algorithms.mps_common.Sweep.engine_params
tenpy.algorithms.tebd.Engine.TEBD_params
tenpy.algorithms.tdvp.Engine.TDVP_params
tenpy.linalg.lanczos.Lanczos
Changed the arguments of
tenpy.models.model.MultiCouplingModel()
: We replaced the three arguments u0, op0 and other_op withother_ops=[(u1, op1, dx1), (op2, u2, dx2), ...]
by single, equivalent argment ops which should now readops=[(op0, dx0, u0), (op1, dx1, u1), (op2, dx2, u2), ...]
, wheredx0 = [0]*lat.dim
. Note the changed order inside the tuple! Old code (which specifies opstr and category as keyword argument, if at all) still works as before, but raises a warning, and should be replaced. Sincetenpy.lattice.Lattice.possible_multi_couplings()
used similar arguments, they were changed as well.Don’t save H_MPO_graph as model attribute anymore - this also wasn’t documented.
Renamed the truncation parameter symmetry_tol to degeneracy_tol and make the criterion more reasonable by not checking \(log(S_i/S_j) < log(symmetry_tol)\), but simply \(log(S_i/S_j) < degeneracy_tol`\). The latter makes more sense, as it is equivalent to \((S_i - S_j)/S_j < exp(degeneracy_tol) - 1 = degeneracy_tol + \mathcal{O}(degeneracy_tol^2)\).
Deprecated
tenpy.networks.mps.MPS.increase_L()
in favor of the newly addedtenpy.networks.mps.MPS.enlarge_mps_unit_cell()
(takingfactor
instead ofnew_L=factor*L
as argument).tenpy.networks.mps.MPS.correlation_function()
now auto-determines whether a Jordan-Wigner string is necessary. If any of the given operators is directly an npc Array, it will now raise an error; setautoJW=False
in that case.Instead of “monkey-patching” matvec of the
tenpy.algorithms.mps_common.EffectiveH
for the case that ortho_to_envs is not empty, we defined a proper classNpcLinearOperatorWrapper
, which serves as baseclass forOrthogonalNpcLinearOperator
. The argument ortho_to_envs has been removed fromEffectiveH
.Switch order of the sites in the unit cell for the
DualSquare
, and redefine what the"default"
order means. This is a huge optimization of DMRG, reducing the necessary MPS bond dimension for the ground state to the optimal \(2^{L-1}\) on each bond.Deprecated the Lanczos funciton/class argument orthogonal_to of in
LanczosGroundState
. Instead, one can use theOrthogonalNpcLinearOperator
.Deprecation warning for changing the default argument of shift_ket for non-zero shift_bra of the
TransferMatrix
.
Added
tenpy.networks.mpo.MPO.variance()
to calculate the variance of an MPO against a finite MPS.Classmethod
tenpy.networks.MPS.from_lat_product_state()
to initialize an MPS from a product state given in lattice coordinates (independent of the order of the lattice).argument plus_hc for
tenpy.models.model.CouplingModel.add_onsite()
,tenpy.models.model.CouplingModel.add_coupling()
, andtenpy.models.model.MultiCouplingModel.add_multi_coupling()
to simplify adding the hermitian conjugate terms.parameter explicit_plus_hc for
MPOModel
,CouplingModel
andMPO
, to reduce MPO bond dimension by not storing Hermitian conjugate terms, but computing them at runtime.tenpy.models.model.CouplingModel.add_local_term()
for adding a single term to the lattice, and still handling Jordan-Wigner strings etc.tenpy.networks.site.Site.get_hc_opname()
andhc_ops
to allow getting the hermitian conjugate operator (name) of the onsite operators.tenpy.tools.hdf5_io
with convenience functions for import and output with pickle, as well as an implementation allowing to save and load objects to HDF5 files in the format specified in Saving to disk: input/output.human-readable boundary_conditions property in
Lattice
.save_hdf5 and load_hdf5 methods to support saving/loading to HDF5 for the following classes (and their subclasses): -
ChargeInfo
-LegCharge
-LegPipe
-Array
-MPS
-MPO
-Lattice
tenpy.networks.mps.MPSEnvironment.get_initialization_data()
for a convenient way of saving the necessary parts of the environment after an DMRG run.Method enlarge_mps_unit_cell for the following classes: -
MPS
-MPO
-Lattice
-Model
,MPOModel
,NearestNeighborModel
tenpy.tools.misc.to_iterable_of_len()
for convenience of handling arguments.tenpy.models.lattice.Lattice.mps2lat_values_masked()
as generalization oftenpy.models.lattice.Lattice.mps2lat_values()
.tenpy.linalg.sparse.OrthogonalNpcLinearOperator
to orthogonalize against vectors.tenpy.linalg.sparse.ShiftNpcLinearOperator
to add a constant.tenpy.linalg.sparse.SumNpcLinearOperator
which serves e.g. to add the h.c. during the matvec (in combination with the newtenpy.linalg.sparse.NpcLinearOperator.adjoint()
).tenpy.algorithms.mps_common.make_eff_H()
to simplify implementations ofprepare_update()
.attribute
options
for the Model.
Changed
DEFAULT DMRG paramter
'diag_method'
from'lanczos'
to'default'
, which is the same for large bond dimensions, but performs a full exact diagonalization if the effective Hamiltonian has small dimensions. The threshold introduced is the new DMRG parameter'max_N_for_ED'
.DEFAULT parameter
charge_sector=None
instead ofcharge_sector=0
intenpy.networks.mps.MPS.overlap()
to look for eigenvalues of the transfer matrix in all charge sectors, and not assume that it’s the 0 sector.Derive the following classes (and their subclasses) from the new
Hdf5Exportable
to support saving to HDF5: -Site
-Terms
-OnsiteTerms
-CouplingTerms
-Model
, i.e., all model classes.Instead of just defining to_matrix and adjoint for
EffectiveH
, define the interface directly forNpcLinearOperator
.Try to keep the charge block structure as far as possible for
add_charge()
anddrop_charge()
Fixed
Adjust the default DMRG parameter min_sweeps if chi_list is set.
Avoid some unnecessary transpositions in MPO environments for MPS sweeps (e.g. in DMRG).
sort(bunch=True)
could return un-bunched Array, but still set the bunched flag.LegPipe
did not initializeself.bunched
correctly.issue #98: Error of calling psi.canonical_form() directly after disabling the DMRG mixer.
svd()
withfull_matrices=True
gave wrong charges.tenpy.linalg.np_conserved.Array.drop_charge()
andtenpy.lina.np_conserved.Array.drop_charge()
did not copy over labels.wrong pairs for the fifth_nearest_neighbors of the
Honeycomb
.Continue in
tenpy.algorithms.dmrg.full_diag_effH()
with a warning instaed of raising an Error, if the effective Hamltonian is zero.correlation_length()
: check for hermitian Flag might have raised and Error with new numpy warningscorrelation_function()
did not respect argumentstr_on_first=False
.tenpy.networks.mps.MPS.get_op()
worked unexpected for infinite bc with incomensurateself.L
andlen(op_list)
.tenpy.networks.mps.MPS.permute_sites()
did modify the given perm.issue #105 Unintended side-effects using lanczos_params.verbose in combination with orthogonal_to
issue #108
tenpy.linalg.sparse.FlatLinearOperator._matvec()
changesself._charge_sector