CHANGELOG¶
All notable changes to the project will be documented in this file. The project adheres semantic versioning
[0.5.0] - 2019-12-18¶
Backwards incompatible changes¶
Major rewriting of the DMRG Engines, see issue #39 and issue #85 for details. The
EngineCombineandEngineFracturehave been combined into a singleTwoSiteDMRGEnginewith an Therunfunction works as before. In case you have directly used theEngineCombineorEngineFracture, you should update your code and use theTwoSiteEngineinstead.Moved
init_LPandinit_RPmethod fromMPSintoMPSEnvironmentandMPOEnvironment.
Changed¶
Addition/subtraction of
Array: check whether the both arrays have the same labels in differnt order, and in that case raise a warning that we will transpose in the future.Made
tenpy.linalg.np_conserved.Array.get_block()public (previouslytenpy.linalg.np_conserved.Array._get_block).groundstate()now returns a tuple(E0, psi0)instead of justpsi0. Moreover, the argument charge_sector was added.Simplification in the
Lattice: Instead of having separate arguments/attributes/functions for'nearest_neighbors', 'next_nearest_neighbors', 'next_next_nearest_neighbors'and possibly (Honeycomb) even'fourth_nearest_neighbors', 'fifth_nearest_neighbors', collect them in a dictionary called pairs. Old call structures still allowed, but deprecated.issue #94: Array addition and
inner()should reflect the order of the labels, if they coincided. Will change the default behaviour in the future, raising FutureWarning for now.Default parameter for DMRG params: increased precision by setting P_tol_min down to the maximum of
1.e-30, lanczos_params['svd_min']**2 * P_tol_to_trunc, lanczos_params['trunc_cut']**2 * P_tol_to_truncby default.
Added¶
tenpy.algorithms.mps_sweepswith theSweepclass andEffectiveHto be aOneSiteHorTwoSiteH.Single-Site DMRG with the
SingleSiteDMRG.Example function in
examples/c_tebd.pyhow to run TEBD with a model originally having next-nearest neighbors.increase_L()to allow increasing the unit cell of an MPS.Additional option
order='folded'for theChain.tenpy.algorithms.exact_diag.ExactDiag.from_H_mpo()wrapper as replacement fortenpy.networks.mpo.MPO.get_full_hamiltonian()andtenpy.networks.mpo.MPO.get_grouped_mpo(). The latter are now deprecated.Argument max_size to limit the matrix dimension in
ExactDiag.tenpy.linalg.sparse.FlatLinearOperator.from_guess_with_pipe()to allow quickly converting matvec functions acting on multi-dimensional arrays to a FlatLinearOperator by combining the legs into a LegPipe.tenpy.tools.math.speigsh()for hermitian variant ofspeigs()Allow for arguments
'LA', 'SA'inargsort().tenpy.linalg.lanczos.lanczos_arpack()as possiple replacement of the self-implemented lanczos function.tenpy.algorithms.dmrg.full_diag_effH()as another replacement oflanczos().The new DMRG parameter
'diag_method'allows to select a method for the diagonalization of the effective Hamiltonian. Seetenpy.algorithms.dmrg.DMRGEngine.diag()for details.dtype attribute in
EffectiveH.tenpy.linalg.charges.LegCharge.get_qindex_of_charges()to allow selecting a block of an Array from the charges.tenpy.algorithms.mps_sweeps.EffectiveH.to_matrixto allow contracting an EffectiveH to a matrix, as well as metadatatenpy.linalg.sparse.NpcLinearOperator.acts_onandtenpy.algorithms.mps_sweeps.EffectiveH.N.argument only_physical_legs in
tenpy.networks.mps.MPS.get_total_charge()
Fixed¶
MPO
expectation_value()did not work for finite systems.Calling
compute_K()repeatedly with default parameters but on states with different chi would use the chi of the very first call for the truncation parameters.allow
MPSEnvironmentandMPOEnvironmentto have MPS/MPO with different lengthgroup_sites()didn’t work correctly in some situations.matvec_to_array()returned the transposed of A.tenpy.networks.mps.MPS.from_full()messed up the form of the first array.issue #95: blowup of errors in DMRG with update_env > 0. Turns out to be a problem in the precision of the truncation error: TruncationError.eps was set to 0 if it would be smaller than machine precision. To fix it, I added
from_S().
[0.4.1] - 2019-08-14¶
Backwards incompatible changes¶
Switch the sign of the
BoseHubbardModelandFermiHubbardModelto hopping and chemical potential having negative prefactors. Of course, the same adjustment happens in theBoseHubbardChainandFermiHubbardChain.moved
BoseHubbardModelandBoseHubbardChainas well asFermiHubbardModelandFermiHubbardChaininto the new moduletenpy.models.hubbard.Change arguments of
coupling_term_handle_JW()andmulti_coupling_term_handle_JW()to use strength and sites instead of op_needs_JW.Only accept valid identifiers as operator names in
add_op().
Changed¶
grid_concat()allows forNoneentries (representing zero blocks).from_full()allows for ‘segment’ boundary conditions.apply_local_op()allows for n-site operators.
Added¶
Nearest-neighbor interaction in
BoseHubbardModelmultiply_op_names()to replace' '.join(op_names)and allow explicit compression/multiplication.order_combine_term()to group operators together.dagger()of MPO’s (and to implement that alsoflip_charges_qconj()).has_label()to check if a label existsAddition of MPOs
3 additional examples for chern insulators in
examples/chern_insulators/.from_MPOModel()for initializing nearest-neighbor models after grouping sites.
Fixed¶
issue #36: long-range couplings could give IndexError.
issue #42: Onsite-terms in
FermiHubbardModelwere wrong for lattices with non-trivial unit cell.Missing a factor 0.5 in
GUE().Allow
TermListto have terms with multiple operators acting on the same site.Allow MPS indices outside unit cell in
mps2lat_idx()andlat2mps_idx().expectation_value()did not work for n-site operators.
[0.4.0] - 2019-04-28¶
Backwards incompatible changes¶
The argument order of
tenpy.models.lattice.Latticecould be a tuple(priority, snake_winding)before. This is no longer valid and needs to be replaced by("standard", snake_winding, priority).Moved the boundary conditions bc_coupling from the
tenpy.models.model.CouplingModelinto thetenpy.models.lattice.Lattice(as bc). Using the parameter bc_coupling will raise a FutureWarning, one should set the boundary conditions directly in the lattice.Added parameter permute (True by default) in
tenpy.networks.mps.MPS.from_product_state()andtenpy.networks.mps.MPS.from_Bflat(). The resulting state will therefore be independent of the “conserve” parameter of the Sites - unlike before, where the meaning of the p_state argument might have changed.Generalize and rename
tenpy.networks.site.DoubleSitetotenpy.networks.site.GroupedSite, to allow for an arbitrary number of sites to be grouped. Argumentssite0, site1, label0, label1of the __init__ can be replaced with[site0, site1], [label0, label1]andop0, op1of the kronecker_product with[op0, op1]; this will recover the functionality of the DoubleSite.Restructured callstructure of Mixer in DMRG, allowing an implementation of other mixers. To enable the mixer, set the DMRG parameter
"mixer"toTrueor'DensityMatrixMixer'instead of just'Mixer'.The interaction parameter in the
tenpy.models.bose_hubbbard_chain.BoseHubbardModel(andtenpy.models.bose_hubbbard_chain.BoseHubbardChain) did not correspond to \(U/2 N (N-1)\) as claimed in the Hamiltonian, but to \(U N^2\). The correcting factor 1/2 and change in the chemical potential have been fixed.Major restructuring of
tenpy.linalg.np_conservedandtenpy.linalg.charges. This should not break backwards-compatibility, but if you compiled the cython files, you need to remove the old binaries in the source directory. Usingbash cleanup.shmight be helpful to do that, but also remove other files within the repository, so be careful and make a backup beforehand to be on the save side. Afterwards recompile withbash compile.sh.Changed structure of
tenpy.models.model.CouplingModel.onsite_termsandtenpy.models.model.CouplingModel.coupling_terms: Each of them is now a dictionary with category strings as keys and the newly introducedtenpy.networks.terms.OnsiteTermsandtenpy.networks.terms.CouplingTermsas values.tenpy.models.model.CouplingModel.calc_H_onsite()is deprecated in favor of new methods.Argument raise_op2_left of
tenpy.models.model.CouplingModel.add_coupling()is deprecated.
Added¶
tenpy.networks.mps.MPS.expectation_value_term(),tenpy.networks.mps.MPS.expectation_value_terms_sum()andtenpy.networks.mps.MPS.expectation_value_multi_sites()for expectation values of terms.tenpy.networks.mpo.MPO.expectation_value()for an MPO.tenpy.linalg.np_conserved.Array.extend()andtenpy.linalg.charges.LegCharge.extend(), allowing to extend an Array with zeros.DMRG parameter
'orthogonal_to'allows to calculate excited states for finite systems.possibility to change the number of charges after creating LegCharges/Arrays.
more general way to specify the order of sites in a
tenpy.models.lattice.Lattice.new
tenpy.models.lattice.Triangular,tenpy.models.lattice.Honeycombandtenpy.models.lattice.Kagomelatticea way to specify nearest neighbor couplings in a
Lattice, along with methods to count the number of nearest neighbors for sites in the bulk, and a way to plot them (plot_coupling()and friends)tenpy.networks.mpo.MPO.from_grids()to generate the MPO from a grid.tenpy.models.model.MultiCouplingModelfor couplings involving more than 2 sites.request #8: Allow shift in boundary conditions of
CouplingModel.Allow to use state labels in
tenpy.networks.mps.MPS.from_product_state().tenpy.models.model.CouplingMPOModelstructuring the default initialization of most models.Allow to force periodic boundary conditions for finite MPS in the
CouplingMPOModel. This is not recommended, though.tenpy.models.model.NearestNeighborModel.calc_H_MPO_from_bond()andtenpy.models.model.MPOModel.calc_H_bond_from_MPO()for conversion of H_bond into H_MPO and vice versa.tenpy.algorithms.tebd.RandomUnitaryEvolutionfor random unitary circuitsAllow documentation links to github issues, arXiv, papers by doi and the forum with e.g.
:issue:`5`, :arxiv:`1805.00055`, :doi:`10.21468/SciPostPhysLectNotes.5`, :forum:`3`tenpy.models.model.CouplingModel.coupling_strength_add_ext_flux()for adding hoppings with external flux.tenpy.models.model.CouplingModel.plot_coupling_terms()to visualize the added coupling terms.tenpy.networks.terms.OnsiteTerms,tenpy.networks.terms.CouplingTerms,tenpy.networks.terms.MultiCouplingTermcontaining the of terms for theCouplingModelandMultiCouplingModel. This allowed to add the category argument toadd_onsite,add_couplingandadd_multi_coupling.tenpy.networks.terms.TermListas another (more human readable) representation of terms with conversion from and to the other*Termclasses.tenpy.networks.mps.MPS.init_LP()andtenpy.networks.mps.MPS.init_RP()to initialize left and right parts of an Environment.tenpy.networks.mpo.MPOGraph.from_terms()andtenpy.networks.mpo.MPOGraph.from_term_list().argument charge_sector in
tenpy.networks.mps.MPS.correlation_length().
Changed¶
moved toycodes from the folder
examples/to a new foldertoycodes/to separate them clearly.- major remodelling of the internals of
tenpy.linalg.np_conservedandtenpy.linalg.charges.
- major remodelling of the internals of
Restructured lanczos into a class, added time evolution calculating
exp(A*dt)|psi0>Warning for poorly conditioned Lanczos; to overcome this enable the new parameter reortho.
Restructured
tenpy.algorithms.dmrg:run()is now just a wrapper around the newrun(),run(psi, model, pars)is roughly equivalent toeng = EngineCombine(psi, model, pars); eng.run().Added
init_env()andreset_stats()to allow a simple restart of DMRG with slightly different parameters, e.g. for tuning Hamiltonian parameters.Call
canonical_form()for infinite systems if the final state is not in canonical form.
Changed default values for some parameters:
set
trunc_params['chi_max'] = 100. Not setting a chi_max at all will lead to memory problems. DisableDMRG_params['chi_list'] = Noneby default to avoid conflicting settings.reduce to
mixer_params['amplitude'] = 1.e-5. A too strong mixer screws DMRG up pretty bad.increase
Lanczos_params['N_cache'] = N_max(i.e., keep all states)set
DMRG_params['P_tol_to_trunc'] = 0.05and provide reasonable …_min and …_max values.increased (default) DMRG accuracy by setting
DMRG_params['max_E_err'] = 1.e-8andDMRG_params['max_S_err'] = 1.e-5.don’t check the (absolute) energy for convergence in Lanczos.
set
DMRG_params['norm_tol'] = 1.e-5to check whether the final state is in canonical form.
Verbosity of
get_parameter()reduced: Print parameters only for verbosity >=1. and default values only for verbosity >= 2.Don’t print the energy during real-time TEBD evolution - it’s preserved up to truncation errors.
Renamed the SquareLattice class to
tenpy.models.lattice.Squarefor better consistency.auto-determine whether Jordan-Wigner strings are necessary in
add_coupling().The way the labels of npc Arrays are stored internally changed to a simple list with None entries. There is a deprecated propery setter yielding a dictionary with the labels.
renamed first_LP and last_RP arguments of
MPSEnvironmentandMPOEnvironmentto init_LP and init_RP.Testing: insetad of the (outdated) nose, we now use pytest <https://pytest.org> for testing.
Fixed¶
issue #22: Serious bug in
tenpy.linalg.np_conserved.inner(): ifdo_conj=Trueis used with non-zeroqtotal, it returned 0. instead of non-zero values.avoid error in
tenpy.networks.mps.MPS.apply_local_op()Don’t carry around total charge when using DMRG with a mixer
Corrected couplings of the FermionicHubbardChain
issue #2: memory leak in cython parts when using intelpython/anaconda
issue #4: incompatible data types.
issue #6: the CouplingModel generated wrong Couplings in some cases
issue #19: Convergence of energy was slow for infinite systems with
N_sweeps_check=1more reasonable traceback in case of wrong labels
wrong dtype of npc.Array when adding/subtracting/… arrays of different data types
could get wrong H_bond for completely decoupled chains.
SVD could return outer indices with different axes
tenpy.networks.mps.MPS.overlap()works now for MPS with different total charge (e.g. afterpsi.apply_local_op(i, 'Sp')).skip existing graph edges in MPOGraph.add() when building up terms without the strength part.
[0.3.0] - 2018-02-19¶
This is the first version published on github.
Added¶
Cython modules for np_conserved and charges, which can optionally be compiled for speed-ups
tools.optimization for dynamical optimization
Various models.
More predefined lattice sites.
Example toy-codes.
Network contractor for general networks
Changed¶
Switch to python3
Removed¶
Python 2 support.
[0.2.0] - 2017-02-24¶
Compatible with python2 and python3 (using the 2to3 tool).
Development version.
Includes TEBD and DMRG.
Changes compared to previous TeNPy¶
This library is based on a previous (closed source) version developed mainly by Frank Pollmann, Michael P. Zaletel and Roger S. K. Mong. While allmost all files are completely rewritten and not backwards compatible, the overall structure is similar. In the following, we list only the most important changes.
Global Changes¶
syntax style based on PEP8. Use
$>yapf -r -i ./to ensure consitent formatting over the whole project. Special comments# yapf: disableand# yapf: enablecan be used for manual formatting of some regions in code.Following PEP8, we distinguish between ‘private’ functions, indicated by names starting with an underscore and to be used only within the library, and the public API. The puplic API should be backwards-compatible with different releases, while private functions might change at any time.
all modules are in the folder
tenpyto avoid name conflicts with other libraries.withing the library, relative imports are used, e.g.,
from ..tools.math import (toiterable, tonparray)Exception: the files in tests/ and examples/ run as__main__and can’t use relative importsFiles outside of the library (and in tests/, examples/) should use absolute imports, e.g.
import tenpy.algorithms.tebdrenamed tenpy/mps/ to tenpy/networks, since it containes various tensor networks.
added
Sitedescribing the local physical sites by providing the physical LegCharge and onsite operators.
np_conserved¶
pure python, no need to compile!
in module
tenpy.linalginstead ofalgorithms/linalg.moved functionality for charges to
chargesIntroduced the classes
ChargeInfo(basically the oldq_number, andmod_q) andLegCharge(the oldqind, qconj).Introduced the class
LegPipeto replace the oldleg_pipe. It is derived fromLegChargeand used as a leg in the array class. Thus any inherited array (aftertensordotetc still has all the necessary information to split the legs. (The legs are shared between different arrays, so it’s saved only once in memory)Enhanced indexing of the array class to support slices and 1D index arrays along certain axes
more functions, e.g.
grid_outer()
TEBD¶
Introduced TruncationError for easy handling of total truncation error.
some truncation parameters are renamed and may have a different meaning, e.g. svd_max -> svd_min has no ‘log’ in the definition.
DMRG¶
separate Lanczos module in tenpy/linalg/. Strangely, the old version orthoganalized against the complex conjugates of orthogonal_to (contrary to it’s doc string!) (and thus calculated ‘theta_o’ as bra, not ket).
cleaned up, provide prototypes for DMRG engine and mixer.
Tools¶
added
tenpy.tools.misc, which contains ‘random stuff’ from oldtools.mathliketo_iterableandto_array(renamed to follow PEP8, documented)moved stuff for fitting to
tenpy.tools.fitenhanced
tenpy.tools.string.vert_join()for nice formattingmoved (parts of) old cluster/omp.py to
tenpy.tools.processadded
tenpy.tools.paramsfor a simplified handling of parameter/arguments for models and/or algorithms. Similar as the old models.model.set_var, but use it also for algorithms. Also, it may modify the given dictionary.