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 /intro/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 ~tenpy.tools.params.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.
- Created a class
~tenpy.tools.params.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
~tenpy.algorithms.dmrg.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(Si/Sj) < log(symmetrytol), but simply log(Si/Sj) < degeneracytol. The latter makes more sense, as it is equivalent to :math:(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 class~tenpy.linalg.sparse.NpcLinearOperatorWrapper
, which serves as baseclass for~tenpy.linalg.sparse.OrthogonalNpcLinearOperator
. The argument ortho_to_envs has been removed from~tenpy.algorithms.mps_common.EffectiveH
. - Switch order of the sites in the unit cell for the
~tenpy.models.toric_code.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 2L − 1 on each bond. - Deprecated the Lanczos funciton/class argument orthogonal_to of in
~tenpy.linalg.lanczos.LanczosGroundState
. Instead, one can use the~tenpy.linalg.sparse.OrthogonalNpcLinearOperator
. - Deprecation warning for changing the default argument of shift_ket for non-zero shift_bra of the
~tenpy.networks.mps.TransferMatrix
.
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
~tenpy.models.model.MPOModel
,~tenpy.models.model.CouplingModel
and~tenpy.networks.mpo.MPO
, 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
and~tenpy.networks.site.Site.hc_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/intro/input_output
.- human-readable boundary_conditions property in
~tenpy.models.lattice.Lattice
. - save_hdf5 and load_hdf5 methods to support saving/loading to HDF5 for the following classes (and their subclasses):
~tenpy.linalg.charges.ChargeInfo
~tenpy.linalg.charges.LegCharge
~tenpy.linalg.charges.LegPipe
~tenpy.linalg.np_conserved.Array
~tenpy.networks.mps.MPS
~tenpy.networks.mpo.MPO
~tenpy.models.lattice.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:
~tenpy.networks.mps.MPS
~tenpy.networks.mpo.MPO
~tenpy.models.lattice.Lattice
~tenpy.models.model.Model
,~tenpy.models.model.MPOModel
,~tenpy.models.model.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 of~tenpy.algorithms.mps_common.prepare_update
.- attribute
~tenpy.models.model.options
for the Model. tenpy.networks.mps.MPS.roll_mps_unit_cell
.
- 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
~tenpy.tools.hdf5_io.Hdf5Exportable
to support saving to HDF5:~tenpy.networks.site.Site
~tenpy.networks.terms.Terms
~tenpy.networks.terms.OnsiteTerms
~tenpy.networks.terms.CouplingTerms
~tenpy.models.model.Model
, i.e., all model classes.
- Instead of just defining to_matrix and adjoint for
~tenpy.algorithms.mps_common.EffectiveH
, define the interface directly for~tenpy.linalg.sparse.NpcLinearOperator
. - Try to keep the charge block structure as far as possible for
~tenpy.linalg.np_conserved.add_charge
and~tenpy.linalg.np_conserved.drop_charge
- 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).
~tenpy.linalg.charges.LegCharge.sort(bunch=True)
could return un-bunched Array, but still set the bunched flag.~tenpy.linalg.charges.LegPipe
did not initializeself.bunched
correctly.98
: Error of calling psi.canonical_form() directly after disabling the DMRG mixer.~tenpy.linalg.np_conserved.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
~tenpy.models.lattice.Honeycomb
. - Continue in
tenpy.algorithms.dmrg.full_diag_effH
with a warning instaed of raising an Error, if the effective Hamltonian is zero. ~tenpy.networks.mps.MPS.correlation_length
: check for hermitian Flag might have raised and Error with new numpy warnings~tenpy.networks.mps.MPS.correlation_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.105
Unintended side-effects using lanczos_params.verbose in combination with orthogonal_to108
tenpy.linalg.sparse.FlatLinearOperator._matvec
changesself._charge_sector